new Blob([res['_body']], { type: 'text/csv' }));
+ }
+ getCSVResponse(url: string){
+ var headers = new Headers();
+ headers.append('responseType', 'arraybuffer');
+ return this.http.get(url)
+ .map(res => res['_body']);
+ }
+ downloadHTMLFile(url: string, info: string){
+ var headers = new Headers();
+ headers.append('responseType', 'arraybuffer');
+ return this.http.get(url)
+ .map(res => this.addInfo(res, info))
+ .map(res => new Blob([res['_body']], { type: 'text/html' }))
+ .do(res => console.log(res))
+ }
+
+ addInfo(res:any, info:string) {
+ /*
+ var para = res.document.createElement("P"); // Create a element
+ var t = res.document.createTextNode("This is a paragraph"); // Create a text node
+ para.appendChild(t); // Append the text to
+ res.document.body.appendChild(para);
+ */
+ res['_body'] = info+res['_body'];
+ return res;
+ }
+
+ private handleError (error: Response) {
+ // in a real world app, we may send the error to some remote logging infrastructure
+ // instead of just logging it to the console
+ console.log(error);
+ return Observable.throw(error || 'Server error');
+ }
+
+
+}
diff --git a/workingUIKIT/src/app/services/reportsService.module.ts b/workingUIKIT/src/app/services/reportsService.module.ts
new file mode 100644
index 00000000..0d637dad
--- /dev/null
+++ b/workingUIKIT/src/app/services/reportsService.module.ts
@@ -0,0 +1,20 @@
+import { NgModule} from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {ReportsService} from './reports.service';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule
+ ],
+ declarations: [
+ ],
+ providers:[
+ ReportsService
+],
+ exports: [
+ ]
+})
+export class ReportsServiceModule { }
diff --git a/workingUIKIT/src/app/services/searchDataproviders.service.ts b/workingUIKIT/src/app/services/searchDataproviders.service.ts
new file mode 100644
index 00000000..024fc470
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchDataproviders.service.ts
@@ -0,0 +1,381 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+@Injectable()
+export class SearchDataprovidersService {
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchDataproviders (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ let link = OpenaireProperties. getSearchAPIURLLast()+"datasources";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+ //((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
+ advancedSearchDataproviders (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact datasource) "
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])])
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])])
+ }
+ searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+ searchEntityRegistries (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
+ }
+
+ searchDataprovidersForDeposit (id: string,type:string, page: number, size: number):any {
+ let link = OpenaireProperties.getSearchResourcesAPIURL();
+ var compatibilities = "";
+ if(type == "Datasets"){
+ compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)"
+ }else if(type == "Publications"){
+ compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
+ }
+ let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact "+id+")";
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ getDataProvidersforEntityRegistry(datasourceId: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact datasource) "
+ url += "?query=";
+ if(datasourceId!= null && datasourceId != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ searchDataprovidersForEntity (params: string, page: number, size: number):any {
+ let link = OpenaireProperties. getSearchAPIURLLast();
+ let url = link+params+"/datasources?format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ searchDataprovidersCSV (params: string, refineParams:string, page: number, size: number):any {
+
+ let link = OpenaireProperties. getSearchAPIURLLast()+"datasources";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResultsCSV(res['results']));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseResultsCSV(res['results']));
+ }
+
+ searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page - 1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResultsCSV(res['results']));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res)
+ })
+ .map(res => this.parseResultsCSV(res['results']));
+ }
+
+ searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page - 1)+"&size="+size+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResultsCSV(res['results']));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseResultsCSV(res['results']));
+ }
+
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i = new Set();
+
+ let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
+
+ for(let i=0; i res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ private quote(word: any): string {
+ return '"'+word+'"';
+ }
+}
diff --git a/workingUIKIT/src/app/services/searchDatasets.service.ts b/workingUIKIT/src/app/services/searchDatasets.service.ts
new file mode 100644
index 00000000..f83ee433
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchDatasets.service.ts
@@ -0,0 +1,339 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+@Injectable()
+export class SearchDatasetsService {
+ private sizeOfDescription: number = 497;
+
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchDatasets (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"datasets";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+ (page-1) +"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]);
+ }
+ searchDatasetById (id: string ):any {
+
+ let url = OpenaireProperties.getSearchAPIURLLast()+"datasets/"+id+"?format=json";
+ let key = url+"-searchById";
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResults(res));
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseResults(res));
+ }
+
+ searchAggregators (id: string, params: string, refineParams:string, page: number, size: number ):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"datasets";
+
+ let url = link+"?"+"&format=json";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size;
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseRefineResults(id, res['refineResults']));
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseRefineResults(id, res['refineResults']));
+ }
+
+ searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
+ let link = OpenaireProperties.getSearchAPIURLLast()+"datasets";
+ let url = link+"?";
+ var doisParams = "";
+
+ for(var i =0 ;i < DOIs.length; i++){
+ doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
+ }
+ if(doisParams.length > 0){
+ url += "&"+doisParams;
+
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+ (page-1) +"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]);
+ }
+ advancedSearchDatasets (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact result) and (resulttypeid exact dataset) "
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .map(res => [res['meta'].total, this.parseResults(res['results'])])
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+ searchDatasetsForEntity (params: string, page: number, size: number):any {
+ let link = OpenaireProperties.getSearchAPIURLLast();
+ let url = link+params+"/datasets"+"?format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ searchDatasetsForDataproviders(params: string, page: number, size: number):any {
+ let link = OpenaireProperties.getSearchAPIURLLast();
+ let url = link+params+"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i();
+ }
+
+ result['authors'].push({"name": relation.fullname, "id": /*OpenaireProperties.getsearchLinkToPerson()+*/relation['to'].content});
+ } else if(relation['to'].class == "isProducedBy") {
+ if(result['projects'] == undefined) {
+ result['projects'] = new Array<
+ { "id": string, "acronym": string, "title": string,
+ "funderShortname": string, "funderName": string,
+ "code": string
+ }>();
+ }
+
+ let countProjects = result['projects'].length;
+
+ result['projects'][countProjects] = {
+ "id": "", "acronym": "", "title": "",
+ "funderShortname": "", "funderName": "",
+ "code": ""
+ }
+
+ if(relation.title != 'unidentified') {
+ result['projects'][countProjects]['id'] =
+ /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content;
+ result['projects'][countProjects]['acronym'] = relation.acronym;
+ result['projects'][countProjects]['title'] = relation.title;
+ result['projects'][countProjects]['code'] = relation.code;
+ } else {
+ result['projects'][countProjects]['id'] = "";
+ result['projects'][countProjects]['acronym'] = "";
+ result['projects'][countProjects]['title'] = "";
+ result['projects'][countProjects]['code'] = "";
+ }
+
+ if(relation.hasOwnProperty("funding")) {
+ let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
+
+ for(let z=0; z this.sizeOfDescription) {
+ result.description = result.description.substring(0, this.sizeOfDescription)+"...";
+ }
+
+ result.embargoEndDate = resData.embargoenddate;
+
+ if(!Array.isArray(resData.publisher)) {
+ result.publisher = resData.publisher;
+ } else {
+ for(let i=0; i res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ numOfSearchDatasets(params: string):any {
+
+ //OpenaireProperties.getSearchAPIURLLast()
+ //"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
+ let url = OpenaireProperties.getSearchAPIURLLast()+"datasets/count?q=" + params + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+}
diff --git a/workingUIKIT/src/app/services/searchOrganizations.service.ts b/workingUIKIT/src/app/services/searchOrganizations.service.ts
new file mode 100644
index 00000000..a5007d77
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchOrganizations.service.ts
@@ -0,0 +1,210 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+
+@Injectable()
+export class SearchOrganizationsService {
+
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ parseResultsForDeposit(data: any): {"name": string, "id": string}[] {
+ let results: {"name": string, "id": string}[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]);
+ }
+ advancedSearchOrganizations (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact organization) "
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i();
+ }
+
+ let countProjects = result['projects'].length;
+
+ result['projects'][countProjects] = {
+ "id": "", "acronym": "", "title": "",
+ "funderShortname": "", "funderName": "",
+ "code": ""
+ }
+
+ if(relation.title != 'unidentified') {
+ result['projects'][countProjects]['id'] =
+ /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content;
+ result['projects'][countProjects]['acronym'] = relation.acronym;
+ result['projects'][countProjects]['title'] = relation.title;
+ result['projects'][countProjects]['code'] = relation.code;
+ } else {
+ result['projects'][countProjects]['id'] = "";
+ result['projects'][countProjects]['acronym'] = "";
+ result['projects'][countProjects]['title'] = "";
+ result['projects'][countProjects]['code'] = "";
+ }
+
+ if(relation.hasOwnProperty("funding")) {
+ let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
+
+ for(let z=0; z res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ numOfSearchOrganizations(params: string):any {
+
+ //OpenaireProperties.getSearchAPIURLLast()
+ //"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
+ let url = OpenaireProperties.getSearchAPIURLLast()+"organizations/count?q=" + params + "&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+}
diff --git a/workingUIKIT/src/app/services/searchPeople.service.ts b/workingUIKIT/src/app/services/searchPeople.service.ts
new file mode 100644
index 00000000..9d2aeac0
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchPeople.service.ts
@@ -0,0 +1,125 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+
+@Injectable()
+export class SearchPeopleService {
+
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchPeople (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ console.info("In searchProjects");
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"people";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && params != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]);
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]);
+ }
+ advancedSearchPeople (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact person) "
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ numOfSearchPeople(params: string):any {
+
+ //OpenaireProperties.getSearchAPIURLLast()
+ //"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
+ let url = OpenaireProperties.getSearchAPIURLLast()+"people/count?q=" + params + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+}
diff --git a/workingUIKIT/src/app/services/searchProjects.service.ts b/workingUIKIT/src/app/services/searchProjects.service.ts
new file mode 100644
index 00000000..99a7230b
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchProjects.service.ts
@@ -0,0 +1,279 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+
+@Injectable()
+export class SearchProjectsService {
+ private sizeOfDescription: number = 497;
+
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ console.info("In searchProjects");
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"projects";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
+ }
+ getProjectsforDataProvider (datasourceId: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact project) "
+ url += "?query=";
+ if(datasourceId!= null && datasourceId != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ advancedSearchProjects (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact project) "
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ getProjectsForOrganizations (organizationId: string, filterquery: string, page: number, size: number, refineFields:string[] ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact project) "
+ url += "?query=";
+ if(filterquery!= null && filterquery != '' ) {
+ url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
+ }else{
+ url +=" (( "+basicQuery+ " ) " +" and (relorganizationid exact \"" + organizationId + "\"))";
+ }
+ if(refineFields!= null && refineFields.length > 0 ) {
+ url +="&refine=true";
+ for(let i=0; i< refineFields.length ; i++ ){
+ url +="&fields="+refineFields[i];
+ }
+ }
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
+ }
+ getFunders():any {
+ let url = OpenaireProperties.getSearchAPIURLLast()+"projects?refine=true&fields=funderid&size=0"+ "&format=json";;
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, res['refineResults']['funderid']]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, res['refineResults']['funderid']]);
+
+
+ }
+
+ searchForProjectsObs(keyword:string, funderId:string):any {
+ let url = 'search?action=search&sTransformer=projects_openaire&query='+
+ '%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22'+keyword+'%22%29+or+%28projectacronym+%3D+%22'+keyword+'%22%29+or+%28projectcode+%3D+%22'+keyword+'%22%29%29+and+%28funderid+exact+'+funderId+'%29&size=10&locale=en_GB&format=json';
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url).toPromise()
+ .then(request =>{
+ return (request.json().response.results)?request.json().response.results.result:request.json().response.result;
+
+ }) ;
+ }
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i();
+ }
+
+ let countOrganizations = result['organizations'].length;
+
+ result['organizations'][countOrganizations] = { "name": "", "id": "" }
+
+ result['organizations'][countOrganizations]['id'] =
+ /*OpenaireProperties.getsearchLinkToOrganization() + */relation['to'].content;
+ result['organizations'][countOrganizations]['name'] = relation.legalname;
+ }
+ }
+ }
+ }
+ if(resData.hasOwnProperty("fundingtree")) {
+ if(result['funders'] == undefined) {
+ result['funders'] = new Array<
+ {"funderShortname": string, "funderName": string}>();
+ }
+
+ let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
+
+ for(let z=0; z res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ numOfSearchProjects(params: string):any {
+
+ //OpenaireProperties.getSearchAPIURLLast()
+ //"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
+ let url = OpenaireProperties.getSearchAPIURLLast()+"projects/count?q=" + params + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+}
diff --git a/workingUIKIT/src/app/services/searchPublications.service.ts b/workingUIKIT/src/app/services/searchPublications.service.ts
new file mode 100644
index 00000000..ac0a1c87
--- /dev/null
+++ b/workingUIKIT/src/app/services/searchPublications.service.ts
@@ -0,0 +1,461 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../shared/cache.service';
+
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {SearchResult} from '../utils/entities/searchResult';
+import {RefineResultsUtils} from './servicesUtils/refineResults.class';
+
+@Injectable()
+export class SearchPublicationsService {
+ private sizeOfDescription: number = 497;
+
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchPublications (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+"&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]);
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ // .do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]);
+ }
+ searchPublicationById (id: string ):any {
+
+ let url = OpenaireProperties.getSearchAPIURLLast()+"publications/"+id+"?format=json";
+ let key =url+"-searchById";
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResults(res));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseResults(res));
+ }
+
+ searchAggregators (id: string, params: string, refineParams:string, page: number, size: number ):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
+
+ let url = link+"?"+"&format=json";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size;
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseRefineResults(id, res['refineResults']));
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseRefineResults(id, res['refineResults']));
+ }
+
+ searchPublicationsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
+
+ let url = link+"?"+"&format=json&";
+ var doisParams = "";
+
+ for(var i =0 ;i < DOIs.length; i++){
+ doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
+ }
+ if(doisParams.length > 0){
+ url +="&"+doisParams;
+
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size;
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]);
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]);
+ }
+
+ advancedSearchPublications (params: string, page: number, size: number ):any {
+ let url = OpenaireProperties.getSearchResourcesAPIURL();
+ var basicQuery = "(oaftype exact result) and (resulttypeid exact publication) ";
+ url += "?query=";
+ if(params!= null && params != '' ) {
+ url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
+ }else{
+ url +=" ( "+basicQuery+ " ) ";
+ }
+
+ url += "&page="+(page-1)+"&size="+size;
+ url += "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ searchPublicationsForEntity (params: string, page: number, size: number):any {
+ let link = OpenaireProperties.getSearchAPIURLLast();
+ let url = link+params+"/publications"+ "?format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ searchPublicationsForDataproviders(params: string, page: number, size: number):any {
+ let link = OpenaireProperties.getSearchAPIURLLast();
+ let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => [res['meta'].total, this.parseResults(res['results'])]);
+ }
+
+ searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any {
+
+ let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
+
+ let url = link+"?";
+ if(params!= null && params != '' ) {
+ url += params;
+ }
+ if(refineParams!= null && refineParams != '' ) {
+ url += refineParams;
+ }
+ url += "&page="+(page-1)+"&size="+size+ "&format=json";
+
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key)).map(res => this.parseResultsCSV(res['results']));
+ }
+
+ return this.http.get(url)
+ .map(res => res.json())
+ //.do(res => console.info(res))
+ .do(res => {
+ this._cache.set(key, res);
+ })
+ .map(res => this.parseResultsCSV(res['results']));
+ }
+
+
+ parseResults(data: any): SearchResult[] {
+ let results: SearchResult[] = [];
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i();
+ }
+
+ result['authors'].push({"name": relation.fullname, "id": /*OpenaireProperties.getsearchLinkToPerson()+*/relation['to'].content});
+ } else if(relation['to'].class == "isProducedBy") {
+ if(result['projects'] == undefined) {
+ result['projects'] = new Array<
+ { "id": string, "acronym": string, "title": string,
+ "funderShortname": string, "funderName": string,
+ "code": string
+ }>();
+ }
+
+ let countProjects = result['projects'].length;
+
+ result['projects'][countProjects] = {
+ "id": "", "acronym": "", "title": "",
+ "funderShortname": "", "funderName": "",
+ "code": ""
+ }
+
+ if(relation.title != 'unidentified') {
+ result['projects'][countProjects]['id'] =
+ /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content;
+ result['projects'][countProjects]['acronym'] = relation.acronym;
+ result['projects'][countProjects]['title'] = relation.title;
+ result['projects'][countProjects]['code'] = relation.code;
+ } else {
+ result['projects'][countProjects]['id'] = "";
+ result['projects'][countProjects]['acronym'] = "";
+ result['projects'][countProjects]['title'] = "";
+ result['projects'][countProjects]['code'] = "";
+ }
+
+ if(relation.hasOwnProperty("funding")) {
+ let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
+
+ for(let z=0; z this.sizeOfDescription) {
+ result.description = result.description.substring(0, this.sizeOfDescription) + "...";
+ }
+
+
+ result.embargoEndDate = resData.embargoenddate;
+
+ results.push(result);
+ }
+
+ return results;
+ }
+
+ parseResultsCSV(data: any): any {
+ let results: any = [];
+
+
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i res.json())
+ .map(res => res.total)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ numOfSearchPublications(params: string):any {
+
+ //OpenaireProperties.getSearchAPIURLLast()
+ //"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
+ let url = OpenaireProperties.getSearchAPIURLLast()+"publications/count?q="+ params +"&format=json";
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ return this.http.get(url)
+ .map(res => res.json())
+ .map(res => res.total).do(res => {
+ this._cache.set(key, res);
+ });
+ }
+
+ private quote(word: any): string {
+ return '"'+word+'"';
+ }
+}
diff --git a/workingUIKIT/src/app/services/servicesUtils/refineResults.class.ts b/workingUIKIT/src/app/services/servicesUtils/refineResults.class.ts
new file mode 100644
index 00000000..ba4efc88
--- /dev/null
+++ b/workingUIKIT/src/app/services/servicesUtils/refineResults.class.ts
@@ -0,0 +1,38 @@
+
+import { Filter, Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
+import { SearchFields} from '../../utils/properties/searchFields';
+
+
+export class RefineResultsUtils {
+
+
+ public static parse (data, fields:string[], entityType:string):Filter[] {
+ // var data = this.json.refineReuslts;
+
+ var searchFields:SearchFields = new SearchFields();
+ var filters:Filter[] = [];
+ if(data){
+ for(let j=0; j res.json())
+ .catch(err => {
+ console.log('Error: ', err);
+ return Observable.throw(err);
+ });
+ }
+
+}
diff --git a/workingUIKIT/src/app/shared/cache.service.ts b/workingUIKIT/src/app/shared/cache.service.ts
new file mode 100644
index 00000000..15431f3e
--- /dev/null
+++ b/workingUIKIT/src/app/shared/cache.service.ts
@@ -0,0 +1,89 @@
+import { Inject, Injectable, isDevMode } from '@angular/core';
+
+@Injectable()
+export class CacheService {
+ static KEY = 'CacheService';
+
+ constructor(@Inject('LRU') public _cache: Map) {
+
+ }
+
+ /**
+ * check if there is a value in our store
+ */
+ has(key: string | number): boolean {
+ let _key = this.normalizeKey(key);
+ return this._cache.has(_key);
+ }
+
+ /**
+ * store our state
+ */
+ set(key: string | number, value: any): void {
+ let _key = this.normalizeKey(key);
+ this._cache.set(_key, value);
+ }
+
+ /**
+ * get our cached value
+ */
+ get(key: string | number): any {
+ console.log("Cache get :"+key);
+ let _key = this.normalizeKey(key);
+ return this._cache.get(_key);
+ }
+
+ /**
+ * release memory refs
+ */
+ clear(): void {
+ this._cache.clear();
+ }
+
+ /**
+ * convert to json for the client
+ */
+ dehydrate(): any {
+ let json = {};
+ this._cache.forEach((value: any, key: string) => json[key] = value);
+ return json;
+ }
+
+ /**
+ * convert server json into out initial state
+ */
+ rehydrate(json: any): void {
+ Object.keys(json).forEach((key: string) => {
+ let _key = this.normalizeKey(key);
+ let value = json[_key];
+ this._cache.set(_key, value);
+ });
+ }
+
+ /**
+ * allow JSON.stringify to work
+ */
+ toJSON(): any {
+ return this.dehydrate();
+ }
+
+ /**
+ * convert numbers into strings
+ */
+ normalizeKey(key: string | number): string {
+ if (isDevMode() && this._isInvalidValue(key)) {
+ throw new Error('Please provide a valid key to save in the CacheService');
+ }
+
+ return key + '';
+ }
+
+ _isInvalidValue(key): boolean {
+ return key === null ||
+ key === undefined ||
+ key === 0 ||
+ key === '' ||
+ typeof key === 'boolean' ||
+ Number.isNaN(key);
+ }
+}
diff --git a/workingUIKIT/src/app/shared/model/model.service.ts b/workingUIKIT/src/app/shared/model/model.service.ts
new file mode 100644
index 00000000..7d44a2b2
--- /dev/null
+++ b/workingUIKIT/src/app/shared/model/model.service.ts
@@ -0,0 +1,55 @@
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+
+import { CacheService } from '../cache.service';
+import { ApiService } from '../api.service';
+
+export function hashCodeString(str: string): string {
+ let hash = 0;
+ if (str.length === 0) {
+ return hash + '';
+ }
+ for (let i = 0; i < str.length; i++) {
+ let char = str.charCodeAt(i);
+ hash = ((hash << 5) - hash) + char;
+ hash = hash & hash; // Convert to 32bit integer
+ }
+ return hash + '';
+}
+
+// domain/feature service
+@Injectable()
+export class ModelService {
+ // This is only one example of one Model depending on your domain
+ constructor(public _api: ApiService, public _cache: CacheService) {
+
+ }
+
+ /**
+ * whatever domain/feature method name
+ */
+ get(url) {
+ // you want to return the cache if there is a response in it.
+ // This would cache the first response so if your API isn't idempotent
+ // you probably want to remove the item from the cache after you use it. LRU of 10
+ // you can use also hashCodeString here
+ let key = url;
+
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ // you probably shouldn't .share() and you should write the correct logic
+ return this._api.get(url)
+ .do(json => {
+ this._cache.set(key, json);
+ })
+ .share();
+ }
+ // don't cache here since we're creating
+ create() {
+ // TODO
+ }
+}
diff --git a/workingUIKIT/src/app/shared/shared.module.ts b/workingUIKIT/src/app/shared/shared.module.ts
new file mode 100644
index 00000000..a99fcdea
--- /dev/null
+++ b/workingUIKIT/src/app/shared/shared.module.ts
@@ -0,0 +1,52 @@
+import { NgModule, ModuleWithProviders } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { RouterModule } from '@angular/router';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { ApiService } from './api.service';
+import { ModelService } from './model/model.service';
+
+const MODULES = [
+ // Do NOT include UniversalModule, HttpModule, or JsonpModule here
+ CommonModule,
+ RouterModule,
+ FormsModule,
+ ReactiveFormsModule
+];
+
+const PIPES = [
+ // put pipes here
+];
+
+const COMPONENTS = [
+ // put shared components here
+];
+
+const PROVIDERS = [
+ ModelService,
+ ApiService
+]
+
+@NgModule({
+ imports: [
+ ...MODULES
+ ],
+ declarations: [
+ ...PIPES,
+ ...COMPONENTS
+ ],
+ exports: [
+ ...MODULES,
+ ...PIPES,
+ ...COMPONENTS
+ ]
+})
+export class SharedModule {
+ static forRoot(): ModuleWithProviders {
+ return {
+ ngModule: SharedModule,
+ providers: [
+ ...PROVIDERS
+ ]
+ };
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/bottom.component.ts b/workingUIKIT/src/app/sharedComponents/bottom.component.ts
new file mode 100644
index 00000000..1293b2e8
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/bottom.component.ts
@@ -0,0 +1,47 @@
+import { Component } from '@angular/core';
+import 'rxjs/Rx';
+
+@Component({
+ selector: 'bottom',
+ template: `
+
+
+`
+})
+export class BottomComponent {
+
+}
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.component.ts b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.component.ts
new file mode 100644
index 00000000..27d87037
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.component.ts
@@ -0,0 +1,148 @@
+/**
+ * angular2-cookie-law
+ *
+ * Copyright 2016-2017, @andreasonny83, All rights reserved.
+ *
+ * @author: @andreasonny83
+ */
+
+import {
+ Component,
+ OnInit,
+ ViewEncapsulation,
+ HostBinding,
+ Input,
+ Output,
+ EventEmitter,
+ animate,
+ state,
+ trigger,
+ style,
+ transition,
+ AnimationTransitionEvent,
+} from '@angular/core';
+
+import {
+ DomSanitizer,
+ SafeHtml,
+} from '@angular/platform-browser';
+
+import {
+ CookieLawService,
+} from './cookie-law.service';
+
+// import {
+// closeIcon,
+// } from './icons';
+
+export type CookieLawPosition = 'top' | 'bottom';
+export type CookieLawAnimation = 'topIn' | 'bottomIn' | 'topOut' | 'bottomOut';
+export type CookieLawTarget = '_blank' | '_self';
+
+@Component({
+ selector: 'cookie-law',
+ // encapsulation: ViewEncapsulation.None,
+ animations: [
+ trigger('state', [
+ state('bottomOut', style({ transform: 'translateY(100%)' })),
+ state('topOut', style({ transform: 'translateY(-100%)' })),
+ state('*', style({ transform: 'translateY(0)' })),
+
+ transition('void => topIn', [
+ style({ transform: 'translateY(-100%)' }),
+ animate('1000ms ease-in-out'),
+ ]),
+
+ transition('void => bottomIn', [
+ style({ transform: 'translateY(100%)' }),
+ animate('1000ms ease-in-out'),
+ ]),
+
+ transition('* => *', animate('1000ms ease-out')),
+ ])
+ ],
+ styleUrls: [ './cookie-law.css' ],
+ templateUrl: './cookie-law.html',
+})
+export class CookieLawComponent implements OnInit {
+ public cookieLawSeen: boolean;
+
+ @Input('learnMore')
+ get learnMore() { return this._learnMore; }
+ set learnMore(value: string) {
+ this._learnMore = (value !== null && `${value}` !== 'false') ? value : null;
+ }
+
+ @Input('target')
+ get target() { return this._target; }
+ set target(value: CookieLawTarget) {
+ this._target = (value !== null && `${value}` !== 'false' &&
+ (`${value}` === '_blank' || `${value}` === '_self')
+ ) ? value : '_blank';
+ }
+
+ @Input('position')
+ get position() { return this._position; }
+ set position(value: CookieLawPosition) {
+ this._position = (value !== null && `${value}` !== 'false' &&
+ (`${value}` === 'top' || `${value}` === 'bottom')
+ ) ? value : 'bottom';
+ }
+
+ @Output('isSeen')
+ private isSeenEvt: EventEmitter;
+
+ @HostBinding('attr.seen')
+ public isSeen: boolean;
+
+ private animation: CookieLawAnimation;
+ private closeSvg: SafeHtml;
+ private currentStyles: {};
+ private _learnMore: string;
+ private _target: CookieLawTarget;
+ private _position: CookieLawPosition;
+
+ constructor(
+ private _service: CookieLawService,
+ private domSanitizer: DomSanitizer,
+ ) {
+ this.isSeenEvt = new EventEmitter();
+ this.animation = 'topIn';
+ this._position = 'bottom';
+ this.cookieLawSeen = this._service.seen();
+ }
+
+ ngOnInit(): void {
+ if (typeof document !== 'undefined') {
+ this.animation = this.position === 'bottom' ? 'bottomIn' : 'topIn';
+
+ this.closeSvg = ' ' ;
+
+ if (this.cookieLawSeen) {
+ this.isSeen = true;
+ }
+
+ this.currentStyles = {
+ 'top': this.position === 'top' ? '0' : null,
+ 'bottom': this.position === 'top' ? 'initial' : null,
+ };
+ }
+ }
+
+ afterDismissAnimation(evt: AnimationTransitionEvent) {
+ if (evt.toState === 'topOut' ||
+ evt.toState === 'bottomOut') {
+ this.isSeen = true;
+ this.isSeenEvt.emit(this.isSeen);
+ }
+ }
+
+ public dismiss(evt?: MouseEvent): void {
+ if (evt) {
+ evt.preventDefault();
+ }
+
+ this._service.storeCookie();
+ this.animation = this.position === 'top' ? 'topOut' : 'bottomOut';
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.css b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.css
new file mode 100644
index 00000000..17e09689
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.css
@@ -0,0 +1,77 @@
+.cookie-law-wrapper a {
+ color: #bbb;
+ -webkit-transition: color .2s;
+ transition: color .2s;
+}
+.cookie-law-wrapper a:hover {
+ color: #fff;
+}
+.cookie-law-wrapper a:hover svg {
+ fill: #fff;
+}
+.cookie-law-wrapper {
+ background: #333;
+ color: #bbb;
+ display: block;
+ /*font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
+ font-size: 15px;
+ font-weight: 200;
+ line-height: 20px;*/
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ z-index: 999999999;
+ font-smooth: always;
+ -webkit-font-smoothing: antialiased;
+ text-align: center;
+}
+.dismiss {
+ display: block;
+ box-sizing: border-box;
+ padding: 10px;
+ position: absolute;
+ top: 0;
+ right: 10px;
+ text-decoration: none;
+ line-height: 20px;
+}
+.dismiss svg {
+ display: block;
+ fill: #bbb;
+ width: 20px;
+ height: 20px;
+ -webkit-transition: fill .2s;
+ transition: fill .2s;
+}
+.copy {
+ box-sizing: border-box;
+ padding: 10px 60px 10px 10px;
+}
+.copy span {
+ color: #fff;
+ /*font-weight: 400;*/
+}
+.copy a {
+ text-decoration: underline;
+}
+.copy a:active, .copy a:hover {
+ outline: 0;
+}
+
+@media (min-width: 600px) {
+ /* For bigger devices: */
+ .copy {
+ padding: 20px 60px 20px 20px;
+ /*font-size: 18px;
+ line-height: 24px;*/
+ }
+ .dismiss {
+ top: 10px;
+ right: 15px;
+ }
+ .dismiss svg {
+ width: 24px;
+ height: 24px;
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.html b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.html
new file mode 100644
index 00000000..4033ba13
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ By continuing to browse the site, you're agreeing to our use of cookies.
+
+ Learn more in our privacy policy .
+
+
+
+
+
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.module.ts b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.module.ts
new file mode 100644
index 00000000..cd5ae1f4
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.module.ts
@@ -0,0 +1,25 @@
+/**
+ * angular2-cookie-law
+ *
+ * Copyright 2016-2017, @andreasonny83, All rights reserved.
+ *
+ * @author: @andreasonny83
+ */
+
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { CookieLawComponent } from './cookie-law.component';
+import { CookieLawService } from './cookie-law.service';
+
+@NgModule({
+ imports: [ CommonModule ],
+ declarations: [ CookieLawComponent ],
+ providers: [ CookieLawService ],
+ exports: [ CookieLawComponent ]
+})
+export class CookieLawModule { }
+
+export {
+ CookieLawComponent,
+ CookieLawService
+};
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.service.ts b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.service.ts
new file mode 100644
index 00000000..360e7b78
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/cookie-law.service.ts
@@ -0,0 +1,57 @@
+/**
+ * angular2-cookie-law
+ *
+ * Copyright 2016-2017, @andreasonny83, All rights reserved.
+ *
+ * @author: @andreasonny83
+ */
+
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class CookieLawService {
+
+
+ seen(): boolean {
+ return this.cookieExists('cookieLawSeen');
+ }
+
+ storeCookie(): void {
+ return this.setCookie('cookieLawSeen');
+ }
+
+ /**
+ * try to read a saved cookie
+ *
+ * @param {string} name [the cookie name]
+ *
+ * @return {string} [the cookie's value]
+ */
+ private cookieExists(name: string): boolean {
+ if (typeof document !== 'undefined') {
+ let ca: Array = document.cookie.split(';');
+ let caLen: number = ca.length;
+ let cookieName = name + '=';
+ let c: string;
+
+ for (let i: number = 0; i < caLen; i += 1) {
+ c = ca[i].replace(/^\s\+/g, '');
+ if (c.indexOf(cookieName) !== -1) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * store a new cookie in the browser
+ *
+ * @param {string} name [the name for the cookie]
+ */
+ private setCookie(name: string): void {
+ if (typeof document !== 'undefined') {
+ document.cookie = encodeURIComponent(name) + '=true; path=/';
+ }
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/cookie-law/icons.ts b/workingUIKIT/src/app/sharedComponents/cookie-law/icons.ts
new file mode 100644
index 00000000..987dd766
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/cookie-law/icons.ts
@@ -0,0 +1,13 @@
+/**
+ * angular2-cookie-law
+ *
+ * Copyright 2016-2017, @andreasonny83, All rights reserved.
+ *
+ * @author: @andreasonny83
+ */
+
+export const closeIcon: string = `
+
+
+
+`;
diff --git a/workingUIKIT/src/app/sharedComponents/helper/helper.component.ts b/workingUIKIT/src/app/sharedComponents/helper/helper.component.ts
new file mode 100644
index 00000000..7afe4501
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/helper/helper.component.ts
@@ -0,0 +1,29 @@
+import { Component } from '@angular/core';
+import 'rxjs/Rx';
+import {HelperService} from './helper.service';
+@Component({
+ selector: 'helper',
+ template: `
+
+ 0 " [innerHTML]="htmltags">
+`
+})
+export class HelperComponent {
+ htmltags:string="";
+ sub:any;
+
+ constructor ( private _service: HelperService) {
+ }
+
+ ngOnInit() {
+ this.sub = this._service.getHelperJson().subscribe(
+ data => {
+ this.htmltags = data.pages.linking;
+ },
+ err => {
+ console.log(err);
+
+ }
+ );
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/helper/helper.json b/workingUIKIT/src/app/sharedComponents/helper/helper.json
new file mode 100644
index 00000000..2a39be74
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/helper/helper.json
@@ -0,0 +1,10 @@
+{
+ "version":"0.1",
+ "name":"helperText",
+ "description":"Html for ",
+ "pages":{
+ "linking":"This is the text for linking ",
+ "bulk-linking":"Bulk linking ....",
+ "deposit-publications":"Deposit...."
+ }
+}
diff --git a/workingUIKIT/src/app/sharedComponents/helper/helper.module.ts b/workingUIKIT/src/app/sharedComponents/helper/helper.module.ts
new file mode 100644
index 00000000..9350d62c
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/helper/helper.module.ts
@@ -0,0 +1,24 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { RouterModule } from "@angular/router";
+
+import {HelperComponent} from './helper.component';
+import {HelperService} from './helper.service';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule,
+ RouterModule
+ ],
+ providers:[HelperService],
+ declarations: [
+ HelperComponent
+ ],
+ exports: [
+ HelperComponent
+ ]
+})
+export class HelperModule{ }
diff --git a/workingUIKIT/src/app/sharedComponents/helper/helper.service.ts b/workingUIKIT/src/app/sharedComponents/helper/helper.service.ts
new file mode 100644
index 00000000..69550626
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/helper/helper.service.ts
@@ -0,0 +1,26 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../../shared/cache.service';
+
+@Injectable()
+export class HelperService {
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ getHelperJson():any{
+ console.log("getHelper" );
+ var file = "helper.json";
+ let key = file;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }else{
+ return JSON.parse(JSON.stringify(require('./'+file)));
+ }
+
+ }
+
+
+}
diff --git a/workingUIKIT/src/app/sharedComponents/navigationBar.component.ts b/workingUIKIT/src/app/sharedComponents/navigationBar.component.ts
new file mode 100644
index 00000000..49f8ffca
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/navigationBar.component.ts
@@ -0,0 +1,210 @@
+import { Component } from '@angular/core';
+import 'rxjs/Rx';
+import {ActivatedRoute, Router} from '@angular/router';
+
+import {Session} from '../login/utils/helper.class';
+
+@Component({
+ selector: 'navbar',
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`
+})
+export class NavigationBarComponent {
+ public isAuthorized: boolean = false;
+ sub:any;
+ constructor( private router: Router, private route: ActivatedRoute) {}
+
+ ngOnInit() {
+
+ this.initialize();
+ this.sub = this.route.queryParams.subscribe(params => {
+ this.initialize();
+ });
+ }
+ ngOnDestroy(){
+ this.sub.unsubscribe();
+ }
+ initialize(){
+ if(Session.isLoggedIn() && Session.isUserValid() && Session.isAdminUser()){
+ this.isAuthorized = true;
+ }else {
+ this.isAuthorized = false;
+ }
+
+ }
+
+}
diff --git a/workingUIKIT/src/app/sharedComponents/sharedComponents.module.ts b/workingUIKIT/src/app/sharedComponents/sharedComponents.module.ts
new file mode 100644
index 00000000..25684d12
--- /dev/null
+++ b/workingUIKIT/src/app/sharedComponents/sharedComponents.module.ts
@@ -0,0 +1,26 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { RouterModule } from "@angular/router";
+
+import {NavigationBarComponent} from './navigationBar.component';
+import {BottomComponent} from './bottom.component';
+import {UserMiniComponent} from '../login/userMini.component';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule,
+ RouterModule
+ ],
+ declarations: [
+ NavigationBarComponent,
+ BottomComponent,UserMiniComponent
+ ],
+ exports: [
+ NavigationBarComponent,
+ BottomComponent,UserMiniComponent
+ ]
+})
+export class SharedComponentsModule{ }
diff --git a/workingUIKIT/src/app/test/test-routing.module.ts b/workingUIKIT/src/app/test/test-routing.module.ts
new file mode 100644
index 00000000..07f034d4
--- /dev/null
+++ b/workingUIKIT/src/app/test/test-routing.module.ts
@@ -0,0 +1,14 @@
+import { NgModule } from '@angular/core';
+import { RouterModule } from '@angular/router';
+
+import { TestComponent } from './test.component';
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ { path: '', component: TestComponent},
+
+ ])
+ ]
+})
+export class TestRoutingModule { }
diff --git a/workingUIKIT/src/app/test/test.component.ts b/workingUIKIT/src/app/test/test.component.ts
new file mode 100644
index 00000000..7143368e
--- /dev/null
+++ b/workingUIKIT/src/app/test/test.component.ts
@@ -0,0 +1,63 @@
+import {Component, ElementRef} from '@angular/core';
+import { Subject } from 'rxjs/Subject';
+import {Observable} from 'rxjs/Observable';
+
+import {SearchFields} from '../utils/properties/searchFields';
+
+@Component({
+ selector: 'test',
+ template: `
+
+
+
+`
+
+})
+export class TestComponent {
+
+ constructor() {
+
+ }
+
+
+ ngOnInit() {
+
+ }
+
+
+ test(){
+ var sf:SearchFields = new SearchFields();
+ console.info("~~~RESULT");
+
+ this.checktables(sf.RESULT_REFINE_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS);
+ this.checktables(sf.RESULT_ADVANCED_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS);
+ console.info("~~~PR");
+
+ this.checktables(sf.PROJECT_REFINE_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS);
+ this.checktables(sf.PROJECT_ADVANCED_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS);
+ console.info("~~~DATAPR");
+
+ this.checktables(sf.DATASOURCE_REFINE_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS);
+ this.checktables(sf.DATASOURCE_ADVANCED_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS);
+
+ console.info("~~~ORG");
+ this.checktables(sf.ORGANIZATION_REFINE_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS);
+ this.checktables(sf.ORGANIZATION_ADVANCED_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS);
+ console.info("~~~PERSON");
+
+ this.checktables(sf.PERSON_REFINE_FIELDS,sf.PERSON_FIELDS,sf.PERSON_FIELDS);
+ this.checktables(sf.PERSON_ADVANCED_FIELDS,sf.PERSON_FIELDS,sf.PERSON_FIELDS);
+ }
+ checktables(fields,fieldsDetails,fieldsParam){
+ for(var i =0; i < fields.length; i++){
+ if(!fieldsDetails[fields[i]]){
+ console.info("!!!!"+fields[i]+ "field has to details");
+ }
+ }
+
+ }
+
+
+
+
+}
diff --git a/workingUIKIT/src/app/test/test.module.ts b/workingUIKIT/src/app/test/test.module.ts
new file mode 100644
index 00000000..8277654b
--- /dev/null
+++ b/workingUIKIT/src/app/test/test.module.ts
@@ -0,0 +1,19 @@
+import { NgModule } from '@angular/core';
+
+import { SharedModule } from '../shared/shared.module';
+import { TestComponent } from './test.component';
+import { TestRoutingModule } from './test-routing.module';
+
+
+
+@NgModule({
+ imports: [
+ SharedModule,
+ TestRoutingModule,
+
+ ],
+ declarations: [
+ TestComponent
+ ]
+})
+export class TestModule { }
diff --git a/workingUIKIT/src/app/utils/altmetrics.component.ts b/workingUIKIT/src/app/utils/altmetrics.component.ts
new file mode 100644
index 00000000..ab3c7292
--- /dev/null
+++ b/workingUIKIT/src/app/utils/altmetrics.component.ts
@@ -0,0 +1,43 @@
+import {Component, ElementRef, Input} from '@angular/core';
+ import {SafeHtmlPipe} from '../utils/pipes/safeHTML.pipe';
+ import {ActivatedRoute} from '@angular/router';
+declare var loadAltmetrics:any;
+//
+@Component({
+ selector: 'altmetrics',
+ template: `
+
+ `
+})
+export class AltMetricsComponent {
+ @Input() id ;
+ @Input() type = 'doi'; // doi or arxiv
+
+ // public doi="10.7717/peerj.1150";
+ public altmetrics:string;
+ private sub:any;
+
+ constructor(private route: ActivatedRoute) {
+
+ // if (typeof document !== 'undefined') {
+ // let yourModule = require('../utils/altmetrics.js');
+ // }
+ }
+ ngOnInit() {
+ this.sub = this.route.queryParams.subscribe(data => {
+ if(this.type == "doi"){
+ this.altmetrics='
';
+ }else{
+ this.altmetrics='
';
+ }
+ if (typeof document !== 'undefined') {
+ // let yourModule = require('../utils/altmetrics.js');
+ loadAltmetrics("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
+ }
+ });
+ }
+ ngOnDestroy() {
+ this.sub.unsubscribe();
+ }
+
+}
diff --git a/workingUIKIT/src/app/utils/altmetrics.js b/workingUIKIT/src/app/utils/altmetrics.js
new file mode 100644
index 00000000..c90a3753
--- /dev/null
+++ b/workingUIKIT/src/app/utils/altmetrics.js
@@ -0,0 +1,8 @@
+// !function(e,t,n){
+// var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
+// return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
+// }("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
+function loadAltmetrics(e,t,n){
+ var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
+ return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
+};
diff --git a/workingUIKIT/src/app/utils/altmetrics.module.ts b/workingUIKIT/src/app/utils/altmetrics.module.ts
new file mode 100644
index 00000000..fda0921f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/altmetrics.module.ts
@@ -0,0 +1,20 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {AltMetricsComponent} from './altmetrics.component';
+import {SafeHtmlPipe} from './pipes/safeHTML.pipe';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule
+ ],
+ declarations: [
+ AltMetricsComponent, SafeHtmlPipe
+ ],
+ exports: [
+ AltMetricsComponent, SafeHtmlPipe
+ ]
+})
+export class AltMetricsModule { }
diff --git a/workingUIKIT/src/app/utils/autoComplete.component.css b/workingUIKIT/src/app/utils/autoComplete.component.css
new file mode 100644
index 00000000..6faef1f8
--- /dev/null
+++ b/workingUIKIT/src/app/utils/autoComplete.component.css
@@ -0,0 +1,35 @@
+.auto-complete-box{
+}
+.custom-autocomplete{
+ vertical-align: top;
+}
+.custom-autocomplete .suggestions,.custom-autocomplete .messages{
+ position:absolute;
+ z-index: 1000;
+ top: 25px;
+}
+.auto-complete-choice .remove {
+ cursor: pointer;
+}
+.auto-complete-choice{
+ background: white none repeat scroll 0 0;
+ border-color: gray;
+ border-radius: 5px;
+ border-style: solid;
+ border-width: thin;
+ color: grey;
+ margin: 3px;
+ padding: 7px;
+}
+.auto-complete-input {
+ border-radius:0;
+ border-color: white;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
+ margin-left: 5px;
+}
+.form-control .auto-complete-input {
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
+}
+.auto-complete-box .suggestions .list-group-item, .custom-autocomplete .suggestions .list-group-item {
+ padding: 5px 10px;
+}
diff --git a/workingUIKIT/src/app/utils/entities/dataProviderInfo.ts b/workingUIKIT/src/app/utils/entities/dataProviderInfo.ts
new file mode 100644
index 00000000..06abc7b3
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/dataProviderInfo.ts
@@ -0,0 +1,103 @@
+export class DataProviderInfo {
+ title: { "name": string, "url": string };
+ type: string;
+ registry: boolean;
+ compatibility: string;
+ oaiPmhURL: string;
+ countries: string[];
+ tabs: {"name": string, "content": string}[];
+ tabsInTypes = {
+ "publicationsTab": new Set(
+ [ "aggregator::pubsrepository::institutional",
+ "aggregator::pubsrepository::unknown",
+ "aggregator::pubsrepository::journals",
+ "crissystem",
+ "infospace",
+ "pubsrepository::institutional",
+ "pubsrepository::journal",
+ "pubsrepository::unknown",
+ "scholarcomminfra",
+ "pubsrepository::thematic",
+ "pubscatalogue::unknown"
+ ]),
+ "datasetsTab": new Set(
+ [ "aggregator::datarepository",
+ "crissystem",
+ "datarepository::unknown"
+ ]),
+ "statisticsTab": new Set(
+ [ "aggregator::datarepository",
+ "aggregator::pubsrepository::institutional",
+ "aggregator::pubsrepository::unknown",
+ "aggregator::pubsrepository::journals",
+ "crissystem",
+ "datarepository::unknown",
+ "pubsrepository::institutional",
+ "pubsrepository::journal",
+ "pubsrepository::unknown",
+ "pubsrepository::thematic",
+ "pubscatalogue::unknown",
+ ]),
+ // "organizationsTab": new Set(
+ // [ "entityregistry::projects",
+ // "entityregistry::repositories"
+ // ]),
+ "projectsTab": new Set(["entityregistry::projects"]),
+ "datasourcesTab": new Set(["entityregistry::repositories"]),
+ "relatedDatasourcesTab": new Set(
+ [ "aggregator::pubsrepository::unknown",
+ "aggregator::pubsrepository::journals",
+ "aggregator::pubsrepository::institutional",
+ "aggregator::datarepository"
+ ])/*,
+ "metricsTab": new Set(
+ [ "aggregator::datarepository",
+ "aggregator::pubsrepository::institutional",
+ "aggregator::pubsrepository::unknown",
+ "aggregator::pubsrepository::journals",
+ "crissystem",
+ "datarepository::unknown",
+ "pubsrepository::institutional",
+ "pubsrepository::journal",
+ "pubsrepository::unknown",
+ "pubsrepository::thematic",
+ "pubscatalogue::unknown",
+
+ "infospace",
+ "scholarcomminfra",
+ "entityregistry",
+ "entityregistry::projects",
+ "entityregistry::repositories"
+ ])*/
+ };
+
+ resultsBy: string;
+ resultTypes = {
+ "collectedFrom": new Set(
+ [ "aggregator::datarepository",
+ "aggregator::pubsrepository::institutional",
+ "aggregator::pubsrepository::unknown",
+ "aggregator::pubsrepository::journals",
+ "entityregistry::projects",
+ "entityregistry::repositories",
+ "infospace",
+ "scholarcomminfra",
+ "pubscatalogue::unknown"
+ ]),
+ "hostedBy": new Set(
+ [ "crissystem",
+ "datarepository::unknown",
+ "pubsrepository::institutional",
+ "pubsrepository::journal",
+ "pubsrepository::unknown",
+ "pubsrepository::thematic"
+ ])
+ };
+
+ organizations: {"name": string, "id": string}[] = [];
+ //publications: any;
+ //datasets: any;
+ statistics: any;
+ //projects: any;
+ datasources: any;
+}
diff --git a/workingUIKIT/src/app/utils/entities/datasetInfo.ts b/workingUIKIT/src/app/utils/entities/datasetInfo.ts
new file mode 100644
index 00000000..d64669d1
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/datasetInfo.ts
@@ -0,0 +1,26 @@
+export class DatasetInfo {
+ underCurationMessage: boolean;
+ title: { "name": string, "url": string, "accessMode": string};
+ authors: { "name": string, "id": string}[];
+ date: string;
+ dateofacceptance: string;
+ embargoEndDate: string;
+ type: string;
+ downloadFrom: Map; //key is name
+ publishedIn: Map; //key is name
+ identifiers: Map;
+ publisher: string;
+ subjects: string[];
+ otherSubjects: Map;
+ classifiedSubjects: Map;
+ description: string;
+ bestlicense: string;
+ collectedFrom: { "name": string, "id": string}[];
+ fundedByProjects: { "id": string, "acronym": string, "title": string,
+ "funderShortname": string, "funderName": string,
+ "funding": string, "inline": boolean}[];
+ provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
+ relatedResearchResults: Map;
+ similarResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[];
+ contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
+}
diff --git a/workingUIKIT/src/app/utils/entities/entities.module.ts b/workingUIKIT/src/app/utils/entities/entities.module.ts
new file mode 100644
index 00000000..5415a147
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/entities.module.ts
@@ -0,0 +1,25 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+
+//Entities
+import {DatasetInfo} from './datasetInfo';
+import {OrganizationInfo} from './organizationInfo';
+import {PersonInfo} from './personInfo';
+import {ProjectInfo} from './projectInfo';
+import {Publication} from './publication';
+import {PublicationInfo} from './publicationInfo';
+import {SearchResult} from './searchResult';
+import {DataProviderInfo} from './dataProviderInfo';
+import {Metrics} from './metrics';
+
+@NgModule({
+ imports: [ CommonModule, FormsModule ],
+ declarations: [
+
+ ],
+ exports: [
+ ]
+})
+export class EntitiesModule { }
diff --git a/workingUIKIT/src/app/utils/entities/metrics.ts b/workingUIKIT/src/app/utils/entities/metrics.ts
new file mode 100644
index 00000000..097d8006
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/metrics.ts
@@ -0,0 +1,8 @@
+export class Metrics {
+ totalDownloads: string;
+ totalViews: string;
+ totalOpenaireViews: string;
+ totalOpenaireDownloads: string;
+ pageViews: string;
+ infos: Map;
+}
diff --git a/workingUIKIT/src/app/utils/entities/organizationInfo.ts b/workingUIKIT/src/app/utils/entities/organizationInfo.ts
new file mode 100644
index 00000000..74583872
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/organizationInfo.ts
@@ -0,0 +1,12 @@
+export class OrganizationInfo {
+ title: { "name": string, "url": string };
+ name: string;
+ country: string;
+
+ projects: Map;
+ //dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
+ // "organizations": {"name": string, "url": string}[]}[];
+}
diff --git a/workingUIKIT/src/app/utils/entities/personInfo.ts b/workingUIKIT/src/app/utils/entities/personInfo.ts
new file mode 100644
index 00000000..046e6f1f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/personInfo.ts
@@ -0,0 +1,9 @@
+export class PersonInfo {
+ fullname: string;
+ firstname: string;
+ secondnames: string;
+ country: string;
+
+ publications: any;
+ researchData: any;
+}
diff --git a/workingUIKIT/src/app/utils/entities/projectInfo.ts b/workingUIKIT/src/app/utils/entities/projectInfo.ts
new file mode 100644
index 00000000..1e5f9c8b
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/projectInfo.ts
@@ -0,0 +1,23 @@
+export class ProjectInfo {
+ acronym: string;
+ title: string;
+ callIdentifier: string;
+ funder: string;
+ funding: string;
+ contractNum: string;
+ startDate: string;
+ endDate: string;
+ openAccessMandate: string;
+ specialClause39: string;
+ organizations: { "name": string, "id": string }[];//Map;
+ url: string;
+ urlInfo: string;
+
+ //publications: any;
+ researchData: any;
+ statistics: any;
+
+ totalPublications: number;
+ totalDatasets: number;
+ publicationsStatus: any;
+}
diff --git a/workingUIKIT/src/app/utils/entities/publication.ts b/workingUIKIT/src/app/utils/entities/publication.ts
new file mode 100644
index 00000000..c3904b15
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/publication.ts
@@ -0,0 +1,7 @@
+export class Publication {
+ title: string;
+ publisher: string;
+ DOI: string;
+ source: string;
+ type: string;
+}
diff --git a/workingUIKIT/src/app/utils/entities/publicationInfo.ts b/workingUIKIT/src/app/utils/entities/publicationInfo.ts
new file mode 100644
index 00000000..5fd9ba2e
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/publicationInfo.ts
@@ -0,0 +1,36 @@
+export class PublicationInfo {
+ underCurationMessage: boolean;
+ title: { "name": string, "url": string, "accessMode": string};
+ authors: { "name": string, "id": string}[];
+ date: string;
+ dateofacceptance: string;
+ embargoEndDate: string;
+ types: string[];
+ downloadFrom: Map; //key is name
+ publishedIn: Map; //key is name
+ identifiers: Map; //key is the classname
+ publisher: string;
+ journal: {"journal": string, "issn": string, "lissn": string};
+ languages: string[];
+ subjects: string[];
+ otherSubjects: Map;
+ classifiedSubjects: Map; //
+ description: string;
+ bestlicense: string;
+ collectedFrom: { "name": string, "id": string}[];
+ fundedByProjects: { "id": string, "acronym": string, "title": string,
+ "funderShortname": string, "funderName": string,
+ "funding": string, "code": string, inline: boolean}[];
+ bioentities: Map>; //>
+ software: { "name": string, "url": string}[]; //>
+ //relatedPublications: { "name": string, "url": string, "date": string, "trust": string}[];
+ //relatedResearchData: { "name": string, "url": string, "date": string, "trust": string}[];
+ //similarPublications: {"name": string, "url": string, "date": string, "trust": string}[];
+ //similarDatasets: {"name": string, "url": string, "date": string, "trust": string}[];
+ provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
+ relatedResearchResults: Map;
+ similarResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[];
+ references: { "name": string, "url": string}[];
+ contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
+ organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": string}[];
+}
diff --git a/workingUIKIT/src/app/utils/entities/searchResult.ts b/workingUIKIT/src/app/utils/entities/searchResult.ts
new file mode 100644
index 00000000..e209221c
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entities/searchResult.ts
@@ -0,0 +1,30 @@
+export class SearchResult {
+ title: { "name": string, "accessMode": string, "sc39": string};
+ id:string;
+ DOI:string;
+ //publications & datasets & organizations:
+ projects: {"funderShortname": string, "funderName": string, "acronym": string, "title": string, "code": string, "id": string}[];
+ //datasets & publications
+ description: string;
+ year: string;
+ embargoEndDate: string;
+ authors: { "name": string, "id": string}[];
+ //datasets:
+ publisher: string;
+ //dataproviders & projects:
+ organizations: { "name": string, "id": string}[];
+ //projects:
+ funders: {"funderShortname": string, "funderName": string}[];
+ startYear:number;
+ endYear:number;
+ //organizations:
+ country: string;
+ //dataproviders:
+ type: string;
+ websiteURL: string;
+ OAIPMHURL: string;
+ compatibility: string;
+ countries: string[];
+ constructor(){}
+
+}
diff --git a/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts
new file mode 100644
index 00000000..4633d0b1
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts
@@ -0,0 +1,278 @@
+import {Component, ElementRef, Input, Output, EventEmitter, OnChanges, SimpleChange} from '@angular/core';
+import {Observable} from 'rxjs/Observable';
+import {Subject} from 'rxjs/Subject';
+import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
+import {EntitiesSearchService} from './entitySearch.service';
+
+//Usage example
+//
+
+@Component({
+ selector: 'entities-autocomplete',
+ styleUrls: ['../autoComplete.component.css'],
+ host: {
+ '(document:click)': 'handleClick($event)',
+ },
+ template: `
+
+
+
+ {{showItem(item)}}
+
+
+
+
+
+
+
+
+ Loading.....
+ 0" class="uk-alert uk-alert-warning" data-uk-alert="">{{warningMessage}}
+ 0" > {{results}} results found:
+
+
+
+ {{showItem(item)}}
+ No results found
+ An error occured
+
+
+
+
+
+
+
+ `
+})
+export class EntitiesAutocompleteComponent {
+ @Input() placeHolderMessage = "Search for entries";
+ @Input() title = "Autocomplete";
+ @Output() addItem = new EventEmitter(); // when selected list changes update parent component
+ @Output() selectedValueChanged = new EventEmitter(); // when changed a method for filtering will be called
+ @Input() public list = []; // the entries resulted after filtering function
+ @Input() public selected = []; // the entries selected from user
+ @Input() public keywordlimit = 3; // the minimum length of keyword
+ @Input() public showSelected = true; // the minimum length of keyword
+ @Input() public multipleSelections:boolean = true;
+ @Input() public allowDuplicates:boolean = false;
+ @Input() public selectedValue:string = '';
+ @Input() public keyword = '';
+ @Input() public fieldId:string ;
+ public currentFieldId: string ;
+ public currentFunderId: string ;
+ public warningMessage = "";
+ public infoMessage = "";
+ public tries = 0;
+ public showInput = true;
+ public sub;
+ public done = false;
+ public showLoading:boolean = false;
+ public searchTermStream = new Subject();
+ filtered: Observable<{}> ;
+ // public numFilteredResults:number = 0;
+
+ @Input() public funderId:string;
+ @Input() public entityType:string ;
+ @Input() public depositType:string ;
+ public results = 0;
+ public focus:boolean = false;
+ constructor (public _search:EntitiesSearchService, private myElement: ElementRef) {
+ this.currentFieldId=this.fieldId;
+ this.currentFunderId=this.funderId;
+ this.initialize();
+ }
+
+ ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
+ if(this.currentFieldId!=this.fieldId){ //this is going to be called when
+ this.currentFieldId=this.fieldId;
+ this.initialize();
+ }else if(this.currentFunderId!=this.funderId){
+ this.currentFunderId=this.funderId;
+ this.initialize();
+ }
+ }
+ private initialize(){
+
+ this.showInput = true;
+ if(this.entityType == "project" && this.funderId ){
+ this.filtered = this.searchTermStream
+ .debounceTime(300).distinctUntilChanged()
+ .switchMap((term: string) => {
+ var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":this.funderId));
+ this.showLoading = false;
+ this.results = results.length;
+ return results;
+ });
+ }else if(this.entityType == "organization" && this.depositType ){
+ this.filtered = this.searchTermStream
+ .debounceTime(300).distinctUntilChanged()
+ .switchMap((term: string) => {
+ var results = this._search.searchByDepositType(term, this.depositType);
+ this.showLoading = false;
+ this.results = results.length;
+ return results;
+ });
+
+ }else{
+
+ this.filtered = this.searchTermStream
+ .debounceTime(300)
+ .distinctUntilChanged()
+ .switchMap((term: string) => {
+ var results = this._search.searchByType(term, this.entityType);
+ this.showLoading = false;
+ this.results = results.length;
+ return results;
+ });
+
+ this.getSelectedNameFromGivenId();
+ }
+
+ }
+ ngOnDestroy(){
+ if(this.sub && this.sub != undefined){
+ this.sub.unsubscribe();
+ }
+ }
+
+ search() {
+ this.infoMessage = "";
+ if(this.keyword == ""){
+ this.tries = 0;
+ this.warningMessage = "";
+ } else if(this.keyword && this.keyword.length < this.keywordlimit){
+ this.tries++;
+ if(this.tries == this.keywordlimit -1 ){
+ this.warningMessage = "Type at least " + this.keywordlimit + " characters";
+ this.tries = 0;
+ }
+ }else{
+
+ this.tries = 0;
+ this.warningMessage = "";
+ this.searchTermStream.next(this.keyword);
+ // if(this.numFilteredResults ==0){
+ this.showLoading = true;
+ this.focus = true;
+ // }
+ }
+
+ }
+
+ remove(item:any){
+ var index:number =this.checkIfExists(item,this.selected);
+ if (index > -1) {
+ this.selected.splice(index, 1);
+ }
+ if(!this.multipleSelections && this.selected.length == 0 ){
+ this.showInput = true;
+ this.selectedValue = "";
+ this.selectedValueChanged.emit({
+ value: this.selectedValue
+ });
+
+
+ }
+ }
+ select(item:any){
+ if(this.multipleSelections){
+ var index:number =this.checkIfExists(item,this.selected);
+ if (index > -1 && !this.allowDuplicates) {
+ // this.keyword = "";
+ // this.filtered.splice(0, this.filtered.length);
+ this.focus=false;
+ return;
+ }
+ else{
+ this.selected.push(item);
+ // this.keyword = "";
+ // this.filtered.splice(0, this.filtered.length);
+ this.addItem.emit({
+ value: item
+ });
+ this.focus=false;
+ }
+ }else{
+ this.selected.splice(0, this.selected.length);
+ this.selected.push(item);
+ // this.filtered.splice(0, this.filtered.length);
+ this.keyword = "";
+ this.showInput = false;
+ this.selectedValue = item.id;
+ this.selectedValueChanged.emit({
+ value: this.selectedValue
+ });
+ this.focus=false;
+
+ }
+
+ }
+ private checkIfExists(item:any,list):number{
+
+ if(item.concept && item.concept.id ){
+
+ for (var _i = 0; _i < list.length; _i++) {
+ let itemInList = list[_i];
+ if(item.concept.id == itemInList.concept.id){
+ return _i;
+ }
+ }
+ }else if(item.id){
+ for (var _i = 0; _i < list.length; _i++) {
+ let itemInList = list[_i];
+ if(item.id == itemInList.id){
+ return _i;
+ }
+ }
+ }
+ return -1;
+
+ }
+ showItem(item:any):string{
+
+ if (item.name){ //search
+ return item.name;
+ }else if( item.concept && item.concept.label){ //context
+ return item.concept.label;
+ }else if (item.label){ //simple
+ return item.label;
+ }
+
+ }
+ truncate(str:string, size:number):string{
+ if(str == null){return "";}
+ return (str.length > size)?str.substr(0,size)+'...':str;
+ }
+ private getSelectedNameFromGivenId(){
+ this.showInput = true;
+ if(this.selectedValue && this.selectedValue.length > 0 ){
+
+
+ this.sub = this._search.fetchByType(this.selectedValue,this.entityType).subscribe(
+ data => {
+ this.selected.push( data[0]);
+ this.showInput = false;
+ },
+ err => console.log("An error occured"));
+ }
+ }
+
+ handleClick(event){
+ var clickedComponent = event.target;
+ var inside = false;
+ do {
+ if (clickedComponent === this.myElement.nativeElement) {
+ inside = true;
+ }
+ clickedComponent = clickedComponent.parentNode;
+ } while (clickedComponent);
+ if(!inside){
+ this.keyword = "";
+ // this.numFilteredResults = 0;
+ this.searchTermStream.next(this.keyword);
+ this.focus=false;
+ }
+ }
+
+}
diff --git a/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts
new file mode 100644
index 00000000..af8e0697
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {EntitiesAutocompleteComponent} from './entitiesAutoComplete.component';
+import {EntitySearchServiceModule} from './entitySearchService.module';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule, EntitySearchServiceModule
+ ],
+ declarations: [
+ EntitiesAutocompleteComponent
+ ],
+ exports: [
+ EntitiesAutocompleteComponent
+ ],
+ providers:[ ]
+})
+export class EntitiesAutocompleteModule { }
diff --git a/workingUIKIT/src/app/utils/entitiesAutoComplete/entitySearch.service.ts b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitySearch.service.ts
new file mode 100644
index 00000000..81f907f5
--- /dev/null
+++ b/workingUIKIT/src/app/utils/entitiesAutoComplete/entitySearch.service.ts
@@ -0,0 +1,244 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {AutoCompleteValue} from '../../searchPages/searchUtils/searchHelperClasses.class';
+import {OpenaireProperties} from '../properties/openaireProperties';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../../shared/cache.service';
+import {StringUtils} from '../string-utils.class';
+@Injectable()
+export class EntitiesSearchService {
+ private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
+ public ready:boolean = false;
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ searchProjectsByFunder(keyword:string, funderId:string):any {
+ this.ready = false;
+ let url = OpenaireProperties. getSearchAPIURLLast()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
+ return this.http.get(url).toPromise()
+ .then(request =>
+ {
+ request = request.json().results;
+ this.ready = true;
+ return this.parse(request,"oaf:project","project");
+ }).catch((ex) => {
+ console.error('An error occured', ex);
+ return [{id:'-2',label:'Error'}];;
+ });
+ }
+ searchByDepositType(keyword:string, DepositType:string):any {
+ this.ready = false;
+ console.info("In searchOrganizationsforDeposit");
+
+ let link = OpenaireProperties.getSearchResourcesAPIURL();
+
+ let url = link+"?query=";
+ if(keyword!= null && keyword != '' ) {
+ url += "((oaftype exact organization and deletedbyinference=false and "+
+ "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=*))"+
+ " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
+ // "and " + this.quote(params) + " " +
+ "and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
+
+ }
+
+ url += "&page=0&size=10";
+ url += "&format=json";
+
+ // let url = OpenaireProperties. getSearchAPIURLLast()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
+ return this.http.get(url).toPromise()
+ .then(request =>
+ {
+ request = request.json().results;
+ console.log(request);
+ this.ready = true;
+ return this.parse(request,"oaf:organization","organization");
+ }).catch((ex) => {
+ console.error('An error occured', ex);
+ return [{id:'-2',label:'Error'}];;
+ });
+ }
+ searchByType(keyword:string,type:string){
+ if (type == "project"){
+ return this.searchEntity(keyword,"projects","oaf:project","project");
+ }else if (type == "person"){
+ return this.searchEntity(keyword,"people","oaf:person","person");
+ }else if (type == "dataset"){
+ return this.searchEntity(keyword,"datasets","oaf:result","dataset");
+ }else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
+ return this.searchEntity(keyword,"datasources","oaf:datasource","datasource");
+ }else if (type == "publication"){
+ return this.searchEntity(keyword,"publications","oaf:result","publication");
+ }else if (type == "organization"){
+ return this.searchEntity(keyword,"organizations","oaf:organization","organization");
+
+ }
+
+ }
+ fetchByType(id:string,type:string){
+ if (type == "project"){
+ return this.fetchEntity(id,"projects","oaf:project","project");
+ }else if (type == "person"){
+ return this.fetchEntity(id,"people","oaf:person","person");
+ }else if (type == "dataset"){
+ return this.fetchEntity(id,"datasets","oaf:result","dataset");
+ }else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
+ return this.fetchEntity(id,"datasources","oaf:datasource","datasource");
+ }else if (type == "publication"){
+ return this.fetchEntity(id,"publications","oaf:result","publication");
+ }else if (type == "organization"){
+ return this.fetchEntity(id,"organizations","oaf:organization","organization");
+
+ }
+
+ }
+private searchEntity (keyword: string,APIname:string,oafEntityType:string, type:string):any {
+ let link = OpenaireProperties. getSearchAPIURLLast()+APIname;
+ return this.search(link,keyword,oafEntityType,type)
+
+}
+private fetchEntity (id: string,APIname:string,oafEntityType:string, type:string):any {
+ let link = OpenaireProperties. getSearchAPIURLLast()+APIname;
+ return this.fetch(link,id,oafEntityType,type)
+}
+private fetch (link,id,oafEntityType,type){
+ this.ready = false;
+ let url = link+"/"+id+"?format=json";
+ return this.http.get(url)
+ .map(request => request.json())
+ // .do(res => console.info(res))
+ .map(request => {
+ this.ready = true;
+ return this.parse(request,oafEntityType,type);
+ }).catch((ex) => {
+ console.error('An error occured', ex);
+ return [{id:'-2',label:'Error'}];;
+ });
+
+}
+ private search (link,keyword,oafEntityType,type){
+ this.ready = false;
+ let url = link+"?";
+ if(keyword!= null && keyword != '' ) {
+ url += "q="+ keyword;
+ }
+
+ url += "&page=0&size="+10+"&format=json";
+ return this.http.get(url).toPromise()
+ .then(request =>
+ {
+ request = request.json().results;
+ this.ready = true;
+ return this.parse(request,oafEntityType,type);
+ }).catch((ex) => {
+ console.error('An error occured', ex);
+ return [{id:'-2',label:'Error'}];
+ });
+
+
+ }
+
+ private parse(data: any,oafEntityType:string, type:string){
+ var array:any =[]
+ let length = Array.isArray(data) ? data.length : 1;
+
+ for(let i=0; i 0) result += columnDelimiter;
+ result += item[key];
+ ctr++;
+ });
+ result += lineDelimiter;
+ });
+*/
+
+ for(let line of data) {
+ ctr = 0;
+ for(let column of line) {
+ if (ctr > 0) result += columnDelimiter;
+ result += column;
+ ctr++;
+ }
+ result += lineDelimiter;
+ }
+
+ return result;
+ }
+
+ public static downloadCSV(data: any, filenameArg: string) {
+ console.info("downloadCSV");
+
+ var encodedData, filename, link;
+
+ var csv = this.convertArrayOfObjectsToCSV(data);
+ if (csv == null) return;
+
+ filename = filenameArg || 'export.csv';
+
+ if (!csv.match(/^data:text\/csv/i)) {
+ csv = 'data:text/csv;charset=utf-8,' + csv;
+ }
+ encodedData = encodeURI(csv);
+
+ //link = document.createElement('a');
+ link = document.getElementsByTagName('a');
+ link[0].setAttribute('href', encodedData);
+ link[0].setAttribute('download', filename);
+ //document.body.appendChild(link);
+ link[0].click();
+ //document.body.removeChild(link);
+ }
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
new file mode 100644
index 00000000..a4cc7038
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
@@ -0,0 +1,261 @@
+import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
+import { ErrorCodes} from '../../utils/properties/openaireProperties';
+ import {ExportCSVComponent} from '../../utils/exportCSV.class';
+import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+
+export class FetchDataproviders {
+ public results =[];
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ public sub: any; public subResults: any;
+ public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
+ "export":[]
+ };
+ public CSVDownloaded = false;
+ public csvParams: string;
+
+
+ constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+ }
+
+
+ public ngOnDestroy() {
+ if(this.sub){
+ this.sub.unsubscribe();
+ }
+ if(this.subResults){
+ this.subResults.unsubscribe();
+ }
+ }
+
+ public getResultsByKeyword(keyword:string, page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ parameters = "q=" + keyword;
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+
+ this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,null, page, size,[]).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+ public getNumForEntity(entity: string, id:string) {
+ console.info("getNumForEntity : Dataproviders Component");
+ var parameters="";
+
+ if(entity == "organization") {
+ parameters = "organizations/"+id+"/datasources/count";
+ }
+
+ if(parameters != "") {
+
+ this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
+ data => {
+ this.searchUtils.totalResults = data;
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+ }
+
+ public getNumForSearch(keyword: string) {
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+ var parameters="datasources/count";
+ if(keyword != "") {
+ parameters += "?q=" +keyword ;
+ }
+ this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
+ data => {
+ this.searchUtils.totalResults = data;
+ this.searchUtils.status = errorCodes.DONE;
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+public getResultsForDeposit(id:string, type:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ if(id != "") {
+
+ this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+}
+ public getResultsForEntity(entity:string, id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ var parameters = "";
+
+ if(entity == "organization") {
+ parameters = "organizations/"+id;
+ }
+
+ if(parameters != "") {
+
+ this._searchDataprovidersService.searchDataprovidersForEntity(parameters, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+ }
+
+ public getResultsForDataproviders(id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+
+
+ public downloadClicked($event) {
+ if(!this.CSVDownloaded) {
+ this.CSVDownloaded = false;
+
+ var parameters = $event.value;
+
+ //this.getResultsCSV(parameters, false, 1, 1000);
+
+ this._searchDataprovidersService.searchDataprovidersCSV(parameters, "", 1, 1000).subscribe(
+ data => {
+ this.CSV.export = data;
+ ExportCSVComponent.downloadCSV(this.CSV, "dataproviders.csv");
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ /*
+ this.CSV.export.push(
+ [
+ this.quote(project.name),
+ this.quote(project.acronym),
+ this.quote(project.code),
+ this.quote(project.funder),
+ this.quote(project.fundingStream),
+ this.quote(project.fundingLevel1),
+ this.quote(project.fundingLevel2),
+ this.quote(project.sc39),
+ this.quote(project.startDate),
+ this.quote(project.endDate)
+ ]);
+ }*/
+ }
+ }
+
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
new file mode 100644
index 00000000..feb1714f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
@@ -0,0 +1,181 @@
+import {SearchDatasetsService} from '../../services/searchDatasets.service';
+import { ErrorCodes} from '../../utils/properties/openaireProperties';
+import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+import {DOI} from '../../utils/string-utils.class';
+
+export class FetchDatasets{
+ public results =[];
+
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ private sub: any;
+ private subResults: any;
+
+ public csvParams: string;
+
+ constructor ( private _searchDatasetsService: SearchDatasetsService ) {
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+
+ }
+
+
+
+ public ngOnDestroy() {
+ if(this.sub){
+ this.sub.unsubscribe();
+ }
+ if(this.subResults){
+ this.subResults.unsubscribe();
+ }
+ }
+
+
+ public getResultsByKeyword(keyword:string, page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ var DOIs:string[] = DOI.getDOIsFromString(keyword);
+ var doisParams = "";
+
+ for(var i =0 ;i < DOIs.length; i++){
+ doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
+ }
+ if(doisParams.length > 0){
+ parameters += "&"+doisParams;
+ }else{
+ parameters = "q=" + keyword;
+ }
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchDatasetsService.searchDatasets(parameters,null, page, size, []).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Datasets: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+
+public getResultsForEntity(entity:string, id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ var parameters = "";
+
+ if(entity == "project") {
+ parameters = "projects/"+id;
+ } else if(entity == "person") {
+ parameters = "people/"+id;
+ }
+
+ if(parameters != "") {
+
+ this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Datasets for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+}
+
+public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ var parameters;
+ if(resultsFrom == "collectedFrom") {
+ parameters = "datasets?fq=collectedfromdatasourceid exact "+'"'+id+'"';
+ } else if(resultsFrom == "hostedBy") {
+ parameters = "datasets?fq=resulthostingdatasourceid exact "+'"'+id+'"';
+ }
+
+ if(parameters != "") {
+
+ this._searchDatasetsService.searchDatasetsForDataproviders(parameters, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Datasets for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+}
+
+public getAggregatorResults(id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchDatasetsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
+ data => {
+ this.results = data;
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+}
+
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts
new file mode 100644
index 00000000..0124ce01
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts
@@ -0,0 +1,66 @@
+ import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
+ import { ErrorCodes} from '../../utils/properties/openaireProperties';
+ import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+
+export class FetchOrganizations {
+ public results =[];
+
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ public sub: any;
+ public subResults: any;
+
+
+
+ constructor ( private _searchOrganizationsService: SearchOrganizationsService ) {
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+
+ }
+
+
+ public ngOnDestroy() {
+ if(this.sub){
+ this.sub.unsubscribe();
+ }
+ if(this.subResults){
+ this.subResults.unsubscribe();
+ }
+ }
+
+
+ public getResultsByKeyword(keyword:string , page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ parameters = "q=" + keyword;
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPeople.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPeople.class.ts
new file mode 100644
index 00000000..9ea61959
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPeople.class.ts
@@ -0,0 +1,59 @@
+import {SearchPeopleService} from '../../services/searchPeople.service';
+import { ErrorCodes} from '../../utils/properties/openaireProperties';
+import {SearchFields} from '../../utils/properties/searchFields';
+import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+
+export class FetchPeople {
+ public results =[];
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ public sub: any;
+ public searchFields:SearchFields = new SearchFields();
+
+ constructor ( private _searchPeopleService: SearchPeopleService ) {
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+
+ }
+
+
+
+ public ngOnDestroy() {
+ this.sub.unsubscribe();
+ }
+
+public getResultsByKeyword(keyword:string, page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ parameters = "q=" + keyword;
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this._searchPeopleService.searchPeople(parameters, null, page, size,[]).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+}
+
+
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
new file mode 100644
index 00000000..ce985a01
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
@@ -0,0 +1,150 @@
+import {SearchProjectsService} from '../../services/searchProjects.service';
+import {ErrorCodes} from '../../utils/properties/openaireProperties';
+import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+
+export class FetchProjects{
+ public results =[];
+
+ public filters; // for getResultsForOrganizations
+ public totalResults; // for getResultsForOrganizations // this is total results with the initial query - before filtering
+ public funders:any = []; // for getResultsForOrganizations // this is filled with the initial query - before filtering
+
+ public sub: any;
+ public subResults: any;
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+
+
+ constructor (private _searchProjectsService: SearchProjectsService) {
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+
+ }
+
+ public ngOnDestroy() {
+ if(this.sub){
+ this.sub.unsubscribe();
+ }
+ if(this.subResults){
+ this.subResults.unsubscribe();
+ }
+ }
+
+ public getResultsByKeyword(keyword:string, page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ parameters = "q=" + keyword;
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+ public getResultsForDataproviders(id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this._searchProjectsService.getProjectsforDataProvider(id, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+ public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results
+ console.info("search Projects for Organization: [Id:"+organizationId+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+ if(refineFields && refineFields.length > 0){
+ this.filters = data[2];
+ filterquery = decodeURIComponent(filterquery);
+ for(var i = 0; i < this.filters.length; i++){
+ if(filterquery.indexOf(this.filters[i].filterId) !== -1){
+ console.log("this.filters[i].filterId:"+this.filters[i].filterId);
+ for(var j = 0; j < this.filters[i].values.length; j++){
+ console.log("this.filters[i].values[j].id:"+this.filters[i].values[j].id);
+ if(filterquery.indexOf(this.filters[i].values[j].id) !== -1){
+ this.filters[i].values[j].selected = true;
+ }
+ }
+ }
+ }
+ }
+
+ if(!this.totalResults && filterquery == ""){
+ this.totalResults = this.searchUtils.totalResults;
+ this.funders = [];
+ for(var i = 0; i < this.filters.length; i++){
+ console.log("this.filters[i].filterId:"+this.filters[i].filterId);
+ if(this.filters[i].filterId == "funderid"){
+ this.funders = (this.filters[i].values);
+
+ }
+ }
+ console.log(" this.funders:"+ this.funders);
+
+ }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+
+
+}
diff --git a/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
new file mode 100644
index 00000000..6be0bd48
--- /dev/null
+++ b/workingUIKIT/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
@@ -0,0 +1,194 @@
+
+import {SearchPublicationsService} from '../../services/searchPublications.service';
+import {ErrorCodes} from '../../utils/properties/openaireProperties';
+import {SearchFields} from '../../utils/properties/searchFields';
+ import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
+import {DOI} from '../../utils/string-utils.class';
+
+
+export class FetchPublications {
+ public results =[];
+ // public filters =[];
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ // public baseUrl:string = "";
+ public sub: any;
+ public subResults: any;
+ public searchFields:SearchFields = new SearchFields();
+ // public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
+ // public fieldIdsMap=this.searchFields.RESULT_FIELDS;
+ //: { [key:string] :{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
+
+ public CSV: any = { "columnNames": ["Title", "Authors", "Publication Year", "DOI",
+ /*"Download From", "Publication type", "Journal",*/
+ "Funder", "Project Name (GA Number)", "Access"],
+ "export":[]
+ };
+ public CSVDownloaded = false;
+ public csvParams: string;
+
+ constructor ( private _searchPublicationsService: SearchPublicationsService ) {
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status =errorCodes.LOADING;
+ // this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
+
+ }
+
+
+ public ngOnDestroy() {
+ if(this.sub){
+ this.sub.unsubscribe();
+ }
+ if(this.subResults){
+ this.subResults.unsubscribe();
+ }
+ }
+
+ public getResultsByKeyword(keyword:string, page: number, size: number){
+ var parameters = "";
+ if(keyword.length > 0){
+ var DOIs:string[] = DOI.getDOIsFromString(keyword);
+ var doisParams = "";
+
+ for(var i =0 ;i < DOIs.length; i++){
+ doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
+ }
+ if(doisParams.length > 0){
+ parameters += "&"+doisParams;
+ }else{
+ parameters = "q=" + keyword;
+ }
+ }
+
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchPublicationsService.searchPublications(parameters,null, page, size, []).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+
+ }
+ );
+ }
+
+public getResultsForEntity(entity:string, id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ var parameters = "";
+ if(entity == "project") {
+ parameters = "projects/"+id;
+ } else if(entity == "person") {
+ parameters = "people/"+id;
+ }
+
+ if(parameters != "") {
+ this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+
+ console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+}
+
+public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ var parameters;
+ if(resultsFrom == "collectedFrom") {
+ parameters = "publications?fq=collectedfromdatasourceid exact "+'"'+id+'"';
+ } else if(resultsFrom == "hostedBy") {
+ parameters = "publications?fq=resulthostingdatasourceid exact "+'"'+id+'"';
+ }
+
+ if(parameters != "") {
+
+ this._searchPublicationsService.searchPublicationsForDataproviders(parameters, page, size).subscribe(
+ data => {
+ this.searchUtils.totalResults = data[0];
+ console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
+ this.results = data[1];
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+}
+
+public getAggregatorResults(id:string, page: number, size: number){
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ this.subResults = this._searchPublicationsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
+ data => {
+ this.results = data;
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+}
+
+
+}
diff --git a/workingUIKIT/src/app/utils/iframe.component.ts b/workingUIKIT/src/app/utils/iframe.component.ts
new file mode 100644
index 00000000..302f6431
--- /dev/null
+++ b/workingUIKIT/src/app/utils/iframe.component.ts
@@ -0,0 +1,21 @@
+import {Component, ElementRef, Input} from '@angular/core';
+import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
+//Usage :: `
+@Component({
+ selector: 'i-frame',
+ template: `
+
+ `
+})
+export class IFrameComponent {
+ public safeUrl: SafeResourceUrl;
+ @Input() url ;
+ @Input() width = '100%';
+ @Input() height = '300';
+ constructor(private sanitizer: DomSanitizer) {
+ }
+ ngOnInit() {
+ this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
+ console.info("URL:" + this.safeUrl);
+ }
+}
diff --git a/workingUIKIT/src/app/utils/iframe.module.ts b/workingUIKIT/src/app/utils/iframe.module.ts
new file mode 100644
index 00000000..702e5ab5
--- /dev/null
+++ b/workingUIKIT/src/app/utils/iframe.module.ts
@@ -0,0 +1,19 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {IFrameComponent} from './iframe.component';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule
+ ],
+ declarations: [
+ IFrameComponent
+ ],
+ exports: [
+ IFrameComponent
+ ]
+})
+export class IFrameModule { }
diff --git a/workingUIKIT/src/app/utils/metaTags/openaireMetaTags.class.ts b/workingUIKIT/src/app/utils/metaTags/openaireMetaTags.class.ts
new file mode 100644
index 00000000..18158552
--- /dev/null
+++ b/workingUIKIT/src/app/utils/metaTags/openaireMetaTags.class.ts
@@ -0,0 +1,18 @@
+import {Meta} from '../../../angular2-meta';
+
+export class OpenaireMetaTags{
+
+ constructor (private _meta: Meta ) {
+ }
+
+ updateDescription(description:string){
+ this._meta.updateMeta("description", description);
+ this._meta.updateMeta("og:description", description);
+ }
+ updateTitle(title:string){
+ var _suffix ="| OpenAIRE";
+ var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
+ this._meta.setTitle(_title );
+ this._meta.updateMeta("og:title",_title);
+ }
+}
diff --git a/workingUIKIT/src/app/utils/modal/alert.ts b/workingUIKIT/src/app/utils/modal/alert.ts
new file mode 100644
index 00000000..a86cdfe4
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/alert.ts
@@ -0,0 +1,109 @@
+import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
+// import { DynamicComponentLoader} from '@angular/core';
+
+import {Open} from './open.component';
+
+@Component({
+ selector: 'modal-alert',
+ template: `
+
+ `,
+ encapsulation: ViewEncapsulation.None,
+})
+/**
+ * API to an open alert window.
+ */
+export class AlertModal{
+ /**
+ * Caption for the title.
+ */
+ public alertTitle:string;
+ /**
+ * Describes if the alert contains Ok Button.
+ * The default Ok button will close the alert and emit the callback.
+ * Defaults to true.
+ */
+ public okButton:boolean = true;
+ /**
+ * Caption for the OK button.
+ * Default: Ok
+ */
+ public okButtonText:string= 'Ok';
+ /**
+ * Describes if the alert contains cancel Button.
+ * The default Cancelbutton will close the alert.
+ * Defaults to true.
+ */
+ public cancelButton:boolean = true;
+ /**
+ * Caption for the Cancel button.
+ * Default: Cancel
+ */
+ public cancelButtonText:string = 'Cancel';
+ /**
+ * if the alertMessage is true it will show the contentString inside alert body.
+ */
+ public alertMessage:boolean = true;
+ /**
+ * Some message/content can be set in message which will be shown in alert body.
+ */
+ public message:string;
+ /**
+ * if the value is true alert footer will be visible or else it will be hidden.
+ */
+ public alertFooter:boolean= true;
+ /**
+ * shows alert header if the value is true.
+ */
+ public alertHeader:boolean = true;
+ /**
+ * if the value is true alert will be visible or else it will be hidden.
+ */
+ public isOpen:boolean=false;
+ /**
+ * Emitted when a ok button was clicked
+ * or when Ok method is called.
+ */
+ @Output() public alertOutput:EventEmitter = new EventEmitter();
+ constructor( public _elementRef: ElementRef){}
+ /**
+ * Opens a alert window creating backdrop.
+ */
+ open(){
+ this.isOpen= true;
+ }
+ /**
+ * ok method closes the modal and emits modalOutput.
+ */
+ ok(){
+ this.isOpen = false;
+ this.alertOutput.emit(true);
+ }
+ /**
+ * cancel method closes the moda.
+ */
+ cancel(){
+ this.isOpen = false;
+ }
+}
diff --git a/workingUIKIT/src/app/utils/modal/alertModal.module.ts b/workingUIKIT/src/app/utils/modal/alertModal.module.ts
new file mode 100644
index 00000000..d39e168d
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/alertModal.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {AlertModal} from './alert';
+import {ModalModule} from './modal.module';
+
+@NgModule({
+ imports: [ CommonModule, FormsModule, ModalModule ],
+ declarations: [
+ AlertModal
+ ],
+ exports: [
+ AlertModal
+ ]
+})
+export class AlertModalModule { }
diff --git a/workingUIKIT/src/app/utils/modal/loading.component.ts b/workingUIKIT/src/app/utils/modal/loading.component.ts
new file mode 100644
index 00000000..da824f3c
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/loading.component.ts
@@ -0,0 +1,55 @@
+import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
+
+@Component({
+ selector: 'modal-loading',
+ template: `
+
+
+ `,
+ encapsulation: ViewEncapsulation.None,
+})
+/**
+ * API to an open alert window.
+ */
+export class ModalLoading{
+
+@Input() public message:string ="Loading";
+
+ /**
+ * if the value is true alert will be visible or else it will be hidden.
+ */
+ public isOpen:boolean=false;
+ /**
+ * Emitted when a ok button was clicked
+ * or when Ok method is called.
+ */
+ @Output() public alertOutput:EventEmitter = new EventEmitter();
+ constructor( public _elementRef: ElementRef){}
+ /**
+ * Opens a alert window creating backdrop.
+ */
+ open(){
+ this.isOpen= true;
+ }
+
+ close(){
+ this.isOpen = false;
+ }
+}
diff --git a/workingUIKIT/src/app/utils/modal/loadingModal.module.ts b/workingUIKIT/src/app/utils/modal/loadingModal.module.ts
new file mode 100644
index 00000000..6edf5c4a
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/loadingModal.module.ts
@@ -0,0 +1,19 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+ import {ModalLoading} from './loading.component';
+import {ModalModule} from './modal.module';
+
+//helpers
+
+@NgModule({
+ imports: [ CommonModule, FormsModule,ModalModule ],
+ declarations: [
+ ModalLoading
+ ],
+ exports: [
+ ModalLoading
+ ]
+})
+export class LoadingModalModule { }
diff --git a/workingUIKIT/src/app/utils/modal/modal.module.ts b/workingUIKIT/src/app/utils/modal/modal.module.ts
new file mode 100644
index 00000000..fd48478c
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/modal.module.ts
@@ -0,0 +1,13 @@
+/* common components of modal components */
+import { NgModule } from '@angular/core';
+import {Open} from './open.component';
+@NgModule({
+ imports: [ ],
+ declarations: [
+ Open
+ ],
+ exports: [
+ Open
+ ]
+})
+export class ModalModule { }
diff --git a/workingUIKIT/src/app/utils/modal/open.component.ts b/workingUIKIT/src/app/utils/modal/open.component.ts
new file mode 100644
index 00000000..fec771ed
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/open.component.ts
@@ -0,0 +1,57 @@
+import {Directive, Input, HostBinding} from '@angular/core';
+
+// todo: add animate
+// todo: add init and on change
+@Directive({selector: '[open]'})
+export class Open {
+ @HostBinding('style.display')
+ public display:string;
+ @HostBinding('class.in')
+ @HostBinding('attr.aria-expanded')
+ public isExpanded:boolean = true;
+
+ @Input()
+ public set open(value:boolean) {
+ this.isExpanded = value;
+ this.toggle();
+ }
+
+ public get open():boolean {
+ return this.isExpanded;
+ }
+
+ constructor() {
+ }
+ init() {
+ this.isExpanded = false;
+ this.display = 'none';
+ }
+ toggle() {
+ if (this.isExpanded) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ }
+
+ hide() {
+ this.isExpanded = false;
+ this.display = 'none';
+ if (typeof document !== 'undefined') {
+ let backDrop = document.getElementsByClassName("modal-backdrop");
+ if(backDrop.length>0){
+ document.body.removeChild(backDrop[0]);
+ }
+ }
+ }
+
+ show() {
+ if (typeof document !== 'undefined') {
+ let backDrop = document.createElement('div');
+ backDrop.className="modal-backdrop fade in";
+ document.body.appendChild(backDrop);
+ }
+ this.isExpanded = true;
+ this.display = 'block';
+ }
+}
diff --git a/workingUIKIT/src/app/utils/modal/selectModal.component.ts b/workingUIKIT/src/app/utils/modal/selectModal.component.ts
new file mode 100644
index 00000000..ce1e3b7f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/selectModal.component.ts
@@ -0,0 +1,79 @@
+import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
+
+@Component({
+ selector: 'modal-select',
+ template: `
+
+
+
+
+
+
+
{{message}}
+
+
+
+
+
+ {{option}}
+
+
+
+
+
+
+
+
+
+
+ `,
+ encapsulation: ViewEncapsulation.None,
+})
+/**
+ * API to an open alert window.
+ */
+export class ModalSelect{
+
+@Input() public message:string ="Loading";
+@Input() public options:string[] = [];
+
+public selected: string;
+
+ /**
+ * if the value is true alert will be visible or else it will be hidden.
+ */
+ public isOpen:boolean=false;
+ /**
+ * Emitted when a ok button was clicked
+ * or when Ok method is called.
+ */
+ @Output() public alertOutput:EventEmitter
= new EventEmitter();
+ constructor( public _elementRef: ElementRef){}
+ /**
+ * Opens a alert window creating backdrop.
+ */
+ open(){
+ this.isOpen= true;
+ }
+
+ close(){
+ this.isOpen = false;
+ if(!this.selected) {
+ this.selected = this.options[0];
+ }
+ this.alertOutput.emit(this.selected);
+ }
+
+}
diff --git a/workingUIKIT/src/app/utils/modal/selectModal.module.ts b/workingUIKIT/src/app/utils/modal/selectModal.module.ts
new file mode 100644
index 00000000..971a7dd7
--- /dev/null
+++ b/workingUIKIT/src/app/utils/modal/selectModal.module.ts
@@ -0,0 +1,19 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+ import {ModalSelect} from './selectModal.component';
+import {ModalModule} from './modal.module';
+
+//helpers
+
+@NgModule({
+ imports: [ CommonModule, FormsModule,ModalModule ],
+ declarations: [
+ ModalSelect
+ ],
+ exports: [
+ ModalSelect
+ ]
+})
+export class SelectModalModule { }
diff --git a/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.focus.directive.ts b/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.focus.directive.ts
new file mode 100644
index 00000000..5508ea6c
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.focus.directive.ts
@@ -0,0 +1,26 @@
+import { Directive, ElementRef, Renderer, AfterViewInit, Input } from "@angular/core";
+
+@Directive({
+ selector: "[mydpfocus]"
+})
+
+export class FocusDirective implements AfterViewInit {
+ @Input("mydpfocus") value: string;
+
+ constructor(private el: ElementRef, private renderer: Renderer) {}
+
+ // Focus to element: if value 0 = don't set focus, 1 = set only focus, 2 = set focus and set cursor position
+ ngAfterViewInit() {
+ if (this.value === "0") {
+ return;
+ }
+
+ this.renderer.invokeElementMethod(this.el.nativeElement, "focus", []);
+
+ // Set cursor position at the end of text if input element
+ if (this.value === "2") {
+ let len = this.el.nativeElement.value.length;
+ this.el.nativeElement.setSelectionRange(len, len);
+ }
+ }
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts b/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts
new file mode 100644
index 00000000..ef1a1501
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts
@@ -0,0 +1,69 @@
+import { Directive, ElementRef, Renderer, Input, HostListener } from "@angular/core";
+import { IMyInputAutoFill } from "../interfaces/my-input-auto-fill.interface";
+
+@Directive({
+ selector: "[myinputautofill]"
+})
+
+export class InputAutoFillDirective {
+ @Input("myinputautofill") opts: IMyInputAutoFill;
+
+ constructor(private el: ElementRef, private rndr: Renderer) {}
+
+ @HostListener("keyup", ["$event"]) onKeyUp(evt: KeyboardEvent) {
+ if (!this.opts.enabled || evt.keyCode === 8 || evt.keyCode === 46) {
+ return;
+ }
+
+ let val: string = this.getInputValue();
+ let ews: boolean = this.endsWith(val, this.opts.separator);
+ let parts: Array = val.split(this.opts.separator);
+ let idx: number = parts.length - 1;
+
+ if (val.indexOf(this.opts.separator + this.opts.separator) !== -1) {
+ return;
+ }
+
+ if (!ews && (val.length === this.getPartLength(0) || val.length === this.getPartLength(0) + this.getPartLength(1) + this.opts.separator.length)) {
+ this.setInputValue(val + this.opts.separator);
+ }
+ else if (ews && parts[idx - 1].length < this.getPartLength(idx - 1) && this.isNumber(parts[idx - 1]) && (this.isDay(idx - 1) || this.isMonth(idx - 1))) {
+ this.setInputValue(this.insertPos(val, val.length - 2, "0"));
+ }
+ else if (parts[idx].length < this.getPartLength(idx) && this.isNumber(parts[idx]) && (Number(parts[idx]) > 3 && this.isDay(idx) || Number(parts[idx]) > 1 && this.isMonth(idx))) {
+ this.setInputValue(this.insertPos(val, val.length - 1, "0") + (idx < 2 ? this.opts.separator : ""));
+ }
+ }
+
+ private endsWith(val: string, suffix: string): boolean {
+ return val.indexOf(suffix, val.length - suffix.length) !== -1;
+ }
+
+ private insertPos(str: string, idx: number, val: string): string {
+ return str.substr(0, idx) + val + str.substr(idx);
+ }
+
+ private getPartLength(idx: number): number {
+ return this.opts.formatParts[idx].length;
+ }
+
+ private isNumber(val: string): boolean {
+ return val.match(/[1-9]/) !== null;
+ }
+
+ private isDay(idx: number): boolean {
+ return this.opts.formatParts[idx].indexOf("d") !== -1;
+ }
+
+ private isMonth(idx: number): boolean {
+ return this.opts.formatParts[idx].indexOf("m") !== -1 && this.opts.formatParts[idx].length === 2;
+ }
+
+ private getInputValue(): string {
+ return this.el.nativeElement.value;
+ }
+
+ private setInputValue(val: string): void {
+ this.rndr.setElementProperty(this.el.nativeElement, "value", val);
+ }
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/index.ts b/workingUIKIT/src/app/utils/my-date-picker/index.ts
new file mode 100644
index 00000000..55613d2b
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/index.ts
@@ -0,0 +1,7 @@
+export * from "./services/my-date-picker.locale.service";
+export * from "./services/my-date-picker.util.service";
+export * from "./directives/my-date-picker.focus.directive";
+export * from "./directives/my-date-picker.input.auto.fill.directive";
+export * from "./my-date-picker.component";
+export * from "./my-date-picker.module";
+export * from "./interfaces/index";
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/index.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/index.ts
new file mode 100644
index 00000000..ab34b252
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/index.ts
@@ -0,0 +1,15 @@
+export * from "./my-date.interface";
+export * from "./my-date-range.interface";
+export * from "./my-day-labels.interface";
+export * from "./my-month-labels.interface";
+export * from "./my-month.interface";
+export * from "./my-calendar-day.interface";
+export * from "./my-week.interface";
+export * from "./my-options.interface";
+export * from "./my-locale.interface";
+export * from "./my-date-model.interface";
+export * from "./my-input-field-changed.interface";
+export * from "./my-input-focus-blur.interface";
+export * from "./my-weekday.interface";
+export * from "./my-calendar-view-changed.interface";
+export * from "./my-input-auto-fill.interface";
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-day.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-day.interface.ts
new file mode 100644
index 00000000..d554243a
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-day.interface.ts
@@ -0,0 +1,9 @@
+import { IMyDate } from "./my-date.interface";
+
+export interface IMyCalendarDay {
+ dateObj: IMyDate;
+ cmo: number;
+ currDay: boolean;
+ dayNbr: number;
+ disabled: boolean;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-view-changed.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-view-changed.interface.ts
new file mode 100644
index 00000000..9b9baa5e
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-calendar-view-changed.interface.ts
@@ -0,0 +1,8 @@
+import { IMyWeekday } from "./my-weekday.interface";
+
+export interface IMyCalendarViewChanged {
+ year: number;
+ month: number;
+ first: IMyWeekday;
+ last: IMyWeekday;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-model.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-model.interface.ts
new file mode 100644
index 00000000..35aa7535
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-model.interface.ts
@@ -0,0 +1,8 @@
+import { IMyDate } from "./my-date.interface";
+
+export interface IMyDateModel {
+ date: IMyDate;
+ jsdate: Date;
+ formatted: string;
+ epoc: number;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-range.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-range.interface.ts
new file mode 100644
index 00000000..e24b319b
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date-range.interface.ts
@@ -0,0 +1,6 @@
+import { IMyDate } from "./my-date.interface";
+
+export interface IMyDateRange {
+ begin: IMyDate;
+ end: IMyDate;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date.interface.ts
new file mode 100644
index 00000000..99f00796
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-date.interface.ts
@@ -0,0 +1,5 @@
+export interface IMyDate {
+ year: number;
+ month: number;
+ day: number;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-day-labels.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-day-labels.interface.ts
new file mode 100644
index 00000000..f2fcfa24
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-day-labels.interface.ts
@@ -0,0 +1,3 @@
+export interface IMyDayLabels {
+ [day: string]: string;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-auto-fill.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-auto-fill.interface.ts
new file mode 100644
index 00000000..695afa92
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-auto-fill.interface.ts
@@ -0,0 +1,5 @@
+export interface IMyInputAutoFill {
+ separator: string;
+ formatParts: Array;
+ enabled: boolean;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-field-changed.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-field-changed.interface.ts
new file mode 100644
index 00000000..c93530b6
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-field-changed.interface.ts
@@ -0,0 +1,5 @@
+export interface IMyInputFieldChanged {
+ value: string;
+ dateFormat: string;
+ valid: boolean;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-focus-blur.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-focus-blur.interface.ts
new file mode 100644
index 00000000..99678cbb
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-input-focus-blur.interface.ts
@@ -0,0 +1,4 @@
+export interface IMyInputFocusBlur {
+ reason: number;
+ value: string;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-locale.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-locale.interface.ts
new file mode 100644
index 00000000..25d268ba
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-locale.interface.ts
@@ -0,0 +1,5 @@
+import { IMyOptions } from "./my-options.interface";
+
+export interface IMyLocales {
+ [lang: string]: IMyOptions;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month-labels.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month-labels.interface.ts
new file mode 100644
index 00000000..0eede49b
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month-labels.interface.ts
@@ -0,0 +1,3 @@
+export interface IMyMonthLabels {
+ [month: number]: string;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month.interface.ts
new file mode 100644
index 00000000..846a23eb
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-month.interface.ts
@@ -0,0 +1,5 @@
+export interface IMyMonth {
+ monthTxt: string;
+ monthNbr: number;
+ year: number;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-options.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-options.interface.ts
new file mode 100644
index 00000000..89c26bea
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-options.interface.ts
@@ -0,0 +1,48 @@
+import { IMyDayLabels } from "./my-day-labels.interface";
+import { IMyMonthLabels } from "./my-month-labels.interface";
+import { IMyDate } from "./my-date.interface";
+import { IMyDateRange } from "./my-date-range.interface";
+
+export interface IMyOptions {
+ dayLabels?: IMyDayLabels;
+ monthLabels?: IMyMonthLabels;
+ dateFormat?: string;
+ showTodayBtn?: boolean;
+ todayBtnTxt?: string;
+ firstDayOfWeek?: string;
+ sunHighlight?: boolean;
+ markCurrentDay?: boolean;
+ disableUntil?: IMyDate;
+ disableSince?: IMyDate;
+ disableDays?: Array;
+ enableDays?: Array;
+ disableDateRange?: IMyDateRange;
+ disableWeekends?: boolean;
+ showWeekNumbers?: boolean;
+ height?: string;
+ width?: string;
+ selectionTxtFontSize?: string;
+ inline?: boolean;
+ showClearDateBtn?: boolean;
+ alignSelectorRight?: boolean;
+ openSelectorTopOfInput?: boolean;
+ indicateInvalidDate?: boolean;
+ editableDateField?: boolean;
+ editableMonthAndYear?: boolean;
+ disableHeaderButtons?: boolean;
+ minYear?: number;
+ maxYear?: number;
+ componentDisabled?: boolean;
+ inputValueRequired?: boolean;
+ showSelectorArrow?: boolean;
+ showInputField?: boolean;
+ openSelectorOnInputClick?: boolean;
+ inputAutoFill?: boolean;
+ ariaLabelInputField?: string;
+ ariaLabelClearDate?: string;
+ ariaLabelOpenCalendar?: string;
+ ariaLabelPrevMonth?: string;
+ ariaLabelNextMonth?: string;
+ ariaLabelPrevYear?: string;
+ ariaLabelNextYear?: string;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-week.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-week.interface.ts
new file mode 100644
index 00000000..be7bca16
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-week.interface.ts
@@ -0,0 +1,6 @@
+import { IMyCalendarDay } from "./my-calendar-day.interface";
+
+export interface IMyWeek {
+ week: Array;
+ weekNbr: number;
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-weekday.interface.ts b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-weekday.interface.ts
new file mode 100644
index 00000000..da1df557
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/interfaces/my-weekday.interface.ts
@@ -0,0 +1,4 @@
+export interface IMyWeekday {
+ number: number;
+ weekday: string;
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css
new file mode 100644
index 00000000..3c21416d
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css
@@ -0,0 +1,461 @@
+.mydp {
+ min-width: 30px;
+ border-radius: 2px;
+ line-height: 1.1;
+ display: inline-block;
+ position: relative;
+}
+
+.mydp * {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ font-family: Arial, Helvetica, sans-serif;
+ padding: 0;
+ margin: 0;
+}
+
+.mydp .selector {
+ margin-top: 2px;
+ margin-left: -1px;
+ position: absolute;
+ width: 252px;
+ padding: 0;
+ border: 1px solid #CCC;
+ border-radius: 2px;
+ z-index: 100;
+ animation: selectorfadein 0.1s;
+}
+
+.mydp .selector:focus {
+ border: 1px solid #ADD8E6;
+ outline: none;
+}
+
+@keyframes selectorfadein {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+.mydp .selectorarrow {
+ background: #FAFAFA;
+ margin-top: 12px;
+ padding: 0;
+}
+
+.mydp .selectorarrow:after,
+.mydp .selectorarrow:before {
+ bottom: 100%;
+ border: solid transparent;
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+}
+
+.mydp .selectorarrow:after {
+ border-color: rgba(250, 250, 250, 0);
+ border-bottom-color: #FAFAFA;
+ border-width: 10px;
+ margin-left: -10px;
+}
+
+.mydp .selectorarrow:before {
+ border-color: rgba(204, 204, 204, 0);
+ border-bottom-color: #CCC;
+ border-width: 11px;
+ margin-left: -11px;
+}
+
+.mydp .selectorarrow:focus:before {
+ border-bottom-color: #ADD8E6;
+}
+
+.mydp .selectorarrowleft:after,
+.mydp .selectorarrowleft:before {
+ left: 24px;
+}
+
+.mydp .selectorarrowright:after,
+.mydp .selectorarrowright:before {
+ left: 224px;
+}
+
+.mydp .alignselectorright {
+ right: -1px;
+}
+
+.mydp .selectiongroup {
+ position: relative;
+ display: table;
+ border: none;
+ border-spacing: 0;
+ background-color: #FFF;
+}
+
+.mydp .selection {
+ outline: none;
+ background-color: #FFF;
+ display: table-cell;
+ position: absolute;
+ width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ text-align: center;
+}
+
+.mydp .invaliddate,
+.mydp .invalidmonth,
+.mydp .invalidyear {
+ background-color: #F1DEDE;
+}
+
+.mydp ::-ms-clear {
+ display: none;
+}
+
+.mydp .selbtngroup {
+ position: relative;
+ vertical-align: middle;
+ white-space: nowrap;
+ width: 1%;
+ display: table-cell;
+ font-size: 0;
+}
+
+.mydp .btnpicker,
+.mydp .btnclear {
+ height: 100%;
+ width: 30px;
+ border: none;
+ padding: 0;
+ outline: 0;
+ font: inherit;
+ -moz-user-select: none;
+}
+
+.mydp .btnleftborder {
+ border-left: 1px solid #CCC;
+}
+
+.mydp .btnpickerenabled,
+.mydp .btnclearenabled,
+.mydp .headertodaybtnenabled,
+.mydp .headerbtnenabled {
+ cursor: pointer;
+}
+
+.mydp .btnpickerdisabled,
+.mydp .btncleardisabled,
+.mydp .headertodaybtndisabled,
+.mydp .headerbtndisabled {
+ cursor: not-allowed;
+}
+
+.mydp .headerbtndisabled {
+ opacity: 0.4;
+}
+
+.mydp .btnpicker,
+.mydp .btnclear,
+.mydp .headertodaybtn {
+ background: #FFF;
+}
+
+.mydp .header {
+ width: 100%;
+ height: 30px;
+ background-color: #FAFAFA;
+}
+
+.mydp .header td {
+ vertical-align: middle;
+ border: none;
+ line-height: 0;
+}
+
+.mydp .header td:nth-child(1) {
+ padding-left: 4px;
+}
+
+.mydp .header td:nth-child(2) {
+ text-align: center;
+}
+
+.mydp .header td:nth-child(3) {
+ padding-right: 4px;
+}
+
+.mydp .caltable {
+ table-layout: fixed;
+ width: 100%;
+ background-color: #FFF;
+ font-size: 14px;
+}
+
+.mydp .caltable,
+.mydp .weekdaytitle,
+.mydp .daycell {
+ border-collapse: collapse;
+ color: #003366;
+ line-height: 1.1;
+}
+
+.mydp .weekdaytitle,
+.mydp .daycell {
+ padding: 5px;
+ text-align: center;
+}
+
+.mydp .weekdaytitle {
+ background-color: #DDD;
+ font-size: 12px;
+ font-weight: bold;
+ vertical-align: middle;
+ max-width: 36px;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.mydp .weekdaytitleweeknbr {
+ width: 20px;
+ border-right: 1px solid #BBB;
+}
+
+.mydp .daycell {
+ cursor: pointer;
+ height: 30px;
+}
+
+.mydp .daycell div {
+ background-color: inherit;
+ vertical-align: middle;
+}
+
+.mydp .daycell div span {
+ vertical-align: middle;
+}
+
+.mydp .daycellweeknbr {
+ font-size: 10px;
+ border-right: 1px solid #CCC;
+ cursor: default;
+ color: #000;
+}
+
+.mydp .inlinedp {
+ position: relative;
+ margin-top: -1px;
+}
+
+.mydp .prevmonth {
+ color: #CCC;
+}
+
+.mydp .nextmonth {
+ color: #CCC;
+}
+
+.mydp .disabled {
+ cursor: default !important;
+ color: #CCC !important;
+ background: #FBEFEF !important;
+}
+
+.mydp .sunday {
+ color: #C30000;
+}
+
+.mydp .sundayDim {
+ opacity: 0.5;
+}
+
+.mydp .currmonth {
+ background-color: #F6F6F6;
+ font-weight: bold;
+}
+
+.mydp .currday {
+ text-decoration: underline;
+}
+
+.mydp .selectedday div {
+ border: 1px solid #004198;
+ background-color: #8EBFFF !important;
+ border-radius: 2px;
+}
+
+.mydp .headerbtncell {
+ background-color: #FAFAFA;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.mydp .headerbtn,
+.mydp .headerlabelbtn {
+ background: #FAFAFA;
+ border: none;
+ height: 22px;
+}
+
+.mydp .headerbtn {
+ width: 16px;
+}
+
+.mydp .headerlabelbtn {
+ font-size: 14px;
+}
+
+.mydp,
+.mydp .headertodaybtn,
+.mydp .monthinput,
+.mydp .yearinput {
+ border: 1px solid #CCC;
+}
+
+.mydp .btnpicker,
+.mydp .btnclear,
+.mydp .headerbtn,
+.mydp .headermonthtxt,
+.mydp .headeryeartxt,
+.mydp .headertodaybtn,
+.mydp .selection {
+ color: #000;
+}
+
+.mydp .headertodaybtn {
+ padding: 0 4px;
+ border-radius: 2px;
+ font-size: 11px;
+ height: 22px;
+ min-width: 60px;
+ max-width: 70px;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.mydp button::-moz-focus-inner {
+ border: 0;
+}
+
+.mydp .headermonthtxt,
+.mydp .headeryeartxt {
+ text-align: center;
+ display: table-cell;
+ vertical-align: middle;
+ font-size: 14px;
+ height: 26px;
+ width: 40px;
+ max-width: 40px;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.mydp .btnclear:focus,
+.mydp .btnpicker:focus,
+.mydp .headertodaybtn:focus {
+ background: #ADD8E6;
+}
+
+.mydp .headerbtn:focus,
+.mydp .monthlabel:focus,
+.mydp .yearlabel:focus {
+ color: #ADD8E6;
+ outline: none;
+}
+
+.mydp .daycell:focus {
+ outline: 1px solid #CCC;
+}
+
+.mydp .icon-mydpcalendar,
+.mydp .icon-mydpremove {
+ font-size: 16px;
+}
+
+.mydp .icon-mydpleft,
+.mydp .icon-mydpright {
+ color: #222;
+ font-size: 20px;
+}
+
+.mydp table {
+ display: table;
+ border-spacing: 0;
+}
+
+.mydp table td {
+ padding: 0;
+}
+
+.mydp table,
+.mydp th,
+.mydp td {
+ border: none;
+}
+
+.mydp .btnpickerenabled:hover,
+.mydp .btnclearenabled:hover,
+.mydp .headertodaybtnenabled:hover,
+.mydp .tablesingleday:hover {
+ background-color: #8BDAF4;
+}
+
+.mydp .monthlabel,
+.mydp .yearlabel {
+ cursor: pointer;
+}
+
+.mydp .yearinput,
+.mydp .monthinput {
+ width: 40px;
+ height: 22px;
+ text-align: center;
+ font-weight: bold;
+ outline: none;
+ border-radius: 2px;
+}
+
+.mydp .headerbtnenabled:hover,
+.mydp .monthlabel:hover,
+.mydp .yearlabel:hover {
+ color: #8BDAF4;
+}
+
+@font-face {
+ font-family: 'mydatepicker';
+ src: url('data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCMJXkAAAD8AAAAVE9TLzI+IEhBAAABUAAAAFZjbWFwEIvU5AAAAagAAAGiY3Z0IAbV/wQAAApQAAAAIGZwZ22KkZBZAAAKcAAAC3BnYXNwAAAAEAAACkgAAAAIZ2x5ZsNblX4AAANMAAADBGhlYWQM+nt/AAAGUAAAADZoaGVhBz0DVgAABogAAAAkaG10eA1jAAAAAAasAAAAFGxvY2EBWgHMAAAGwAAAAAxtYXhwAXUMOgAABswAAAAgbmFtZZKUFgMAAAbsAAAC/XBvc3TOA7dOAAAJ7AAAAFpwcmVw5UErvAAAFeAAAACGAAEAAAAKADAAPgACbGF0bgAOREZMVAAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAECrQGQAAUAAAJ6ArwAAACMAnoCvAAAAeAAMQECAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAQOgA6AUDUv9qAFoDUgCWAAAAAQAAAAAAAAAAAAUAAAADAAAALAAAAAQAAAFiAAEAAAAAAFwAAwABAAAALAADAAoAAAFiAAQAMAAAAAYABAABAALoAugF//8AAOgA6AX//wAAAAAAAQAGAAoAAAABAAIAAwAEAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAABAAAAAAAAAAAQAAOgAAADoAAAAAAEAAOgBAADoAQAAAAIAAOgCAADoAgAAAAMAAOgFAADoBQAAAAQAAAABAAAAAAFBAn0ADgAKtwAAAGYUAQUVKwEUDwEGIiY1ETQ+AR8BFgFBCvoLHBYWHAv6CgFeDgv6CxYOAfQPFAIM+goAAAEAAAAAAWcCfAANABdAFAABAAEBRwABAAFvAAAAZhcTAgUWKwERFAYiLwEmND8BNjIWAWUUIAn6Cgr6CxwYAlj+DA4WC/oLHAv6CxYAAAAADwAA/2oDoQNSAAMABwALAA8AEwAXABsAHwAjADMANwA7AD8ATwBzAJhAlUElAh0SSS0kAxMdAkchHwIdEwkdVBsBExkXDQMJCBMJXxgWDAMIFREHAwUECAVeFBAGAwQPCwMDAQAEAV4aARISHlggAR4eDEgOCgIDAAAcWAAcHA0cSXJwbWpnZmNgXVtWU01MRUQ/Pj08Ozo5ODc2NTQxLyknIyIhIB8eHRwbGhkYFxYVFBMSEREREREREREQIgUdKxczNSMXMzUjJzM1IxczNSMnMzUjATM1IyczNSMBMzUjJzM1IwM1NCYnIyIGBxUUFjczMjYBMzUjJzM1IxczNSM3NTQmJyMiBhcVFBY3MzI2NxEUBiMhIiY1ETQ2OwE1NDY7ATIWHQEzNTQ2OwEyFgcVMzIWR6GhxbKyxaGhxbKyxaGhAZuzs9aysgGsoaHWs7PEDAYkBwoBDAYkBwoBm6Gh1rOz1qGhEgoIIwcMAQoIIwgK1ywc/O4dKiodSDQlJCU01jYkIyU2AUcdKk+hoaEksrKyJKH9xKH6of3EoSSyATChBwoBDAahBwwBCv4msiShoaFroQcKAQwGoQcMAQos/TUdKiodAssdKjYlNDQlNjYlNDQlNioAAAABAAD/7wLUAoYAJAAeQBsiGRAHBAACAUcDAQIAAm8BAQAAZhQcFBQEBRgrJRQPAQYiLwEHBiIvASY0PwEnJjQ/ATYyHwE3NjIfARYUDwEXFgLUD0wQLBCkpBAsEEwQEKSkEBBMECwQpKQQLBBMDw+kpA9wFhBMDw+lpQ8PTBAsEKSkECwQTBAQpKQQEEwPLg+kpA8AAQAAAAEAAGAI8Y9fDzz1AAsD6AAAAADU+ZvvAAAAANT5m+8AAP9qA+gDUgAAAAgAAgAAAAAAAAABAAADUv9qAAAD6AAA//4D6AABAAAAAAAAAAAAAAAAAAAABQPoAAABZQAAAWUAAAOgAAADEQAAAAAAAAAiAEoBOAGCAAEAAAAFAHQADwAAAAAAAgBEAFQAcwAAAKkLcAAAAAAAAAASAN4AAQAAAAAAAAA1AAAAAQAAAAAAAQAMADUAAQAAAAAAAgAHAEEAAQAAAAAAAwAMAEgAAQAAAAAABAAMAFQAAQAAAAAABQALAGAAAQAAAAAABgAMAGsAAQAAAAAACgArAHcAAQAAAAAACwATAKIAAwABBAkAAABqALUAAwABBAkAAQAYAR8AAwABBAkAAgAOATcAAwABBAkAAwAYAUUAAwABBAkABAAYAV0AAwABBAkABQAWAXUAAwABBAkABgAYAYsAAwABBAkACgBWAaMAAwABBAkACwAmAflDb3B5cmlnaHQgKEMpIDIwMTcgYnkgb3JpZ2luYWwgYXV0aG9ycyBAIGZvbnRlbGxvLmNvbW15ZGF0ZXBpY2tlclJlZ3VsYXJteWRhdGVwaWNrZXJteWRhdGVwaWNrZXJWZXJzaW9uIDEuMG15ZGF0ZXBpY2tlckdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC5odHRwOi8vZm9udGVsbG8uY29tAEMAbwBwAHkAcgBpAGcAaAB0ACAAKABDACkAIAAyADAAMQA3ACAAYgB5ACAAbwByAGkAZwBpAG4AYQBsACAAYQB1AHQAaABvAHIAcwAgAEAAIABmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQBtAHkAZABhAHQAZQBwAGkAYwBrAGUAcgBSAGUAZwB1AGwAYQByAG0AeQBkAGEAdABlAHAAaQBjAGsAZQByAG0AeQBkAGEAdABlAHAAaQBjAGsAZQByAFYAZQByAHMAaQBvAG4AIAAxAC4AMABtAHkAZABhAHQAZQBwAGkAYwBrAGUAcgBHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAQIBAwEEAQUBBgAJbXlkcHJpZ2h0CG15ZHBsZWZ0DG15ZHBjYWxlbmRhcgpteWRwcmVtb3ZlAAAAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAYABgAGAAYA1L/agNS/2qwACwgsABVWEVZICBLuAAOUUuwBlNaWLA0G7AoWWBmIIpVWLACJWG5CAAIAGNjI2IbISGwAFmwAEMjRLIAAQBDYEItsAEssCBgZi2wAiwgZCCwwFCwBCZasigBCkNFY0VSW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCxAQpDRWNFYWSwKFBYIbEBCkNFY0UgsDBQWCGwMFkbILDAUFggZiCKimEgsApQWGAbILAgUFghsApgGyCwNlBYIbA2YBtgWVlZG7ABK1lZI7AAUFhlWVktsAMsIEUgsAQlYWQgsAVDUFiwBSNCsAYjQhshIVmwAWAtsAQsIyEjISBksQViQiCwBiNCsQEKQ0VjsQEKQ7ABYEVjsAMqISCwBkMgiiCKsAErsTAFJbAEJlFYYFAbYVJZWCNZISCwQFNYsAErGyGwQFkjsABQWGVZLbAFLLAHQyuyAAIAQ2BCLbAGLLAHI0IjILAAI0JhsAJiZrABY7ABYLAFKi2wBywgIEUgsAtDY7gEAGIgsABQWLBAYFlmsAFjYESwAWAtsAgssgcLAENFQiohsgABAENgQi2wCSywAEMjRLIAAQBDYEItsAosICBFILABKyOwAEOwBCVgIEWKI2EgZCCwIFBYIbAAG7AwUFiwIBuwQFlZI7AAUFhlWbADJSNhRESwAWAtsAssICBFILABKyOwAEOwBCVgIEWKI2EgZLAkUFiwABuwQFkjsABQWGVZsAMlI2FERLABYC2wDCwgsAAjQrILCgNFWCEbIyFZKiEtsA0ssQICRbBkYUQtsA4ssAFgICCwDENKsABQWCCwDCNCWbANQ0qwAFJYILANI0JZLbAPLCCwEGJmsAFjILgEAGOKI2GwDkNgIIpgILAOI0IjLbAQLEtUWLEEZERZJLANZSN4LbARLEtRWEtTWLEEZERZGyFZJLATZSN4LbASLLEAD0NVWLEPD0OwAWFCsA8rWbAAQ7ACJUKxDAIlQrENAiVCsAEWIyCwAyVQWLEBAENgsAQlQoqKIIojYbAOKiEjsAFhIIojYbAOKiEbsQEAQ2CwAiVCsAIlYbAOKiFZsAxDR7ANQ0dgsAJiILAAUFiwQGBZZrABYyCwC0NjuAQAYiCwAFBYsEBgWWawAWNgsQAAEyNEsAFDsAA+sgEBAUNgQi2wEywAsQACRVRYsA8jQiBFsAsjQrAKI7ABYEIgYLABYbUQEAEADgBCQopgsRIGK7ByKxsiWS2wFCyxABMrLbAVLLEBEystsBYssQITKy2wFyyxAxMrLbAYLLEEEystsBkssQUTKy2wGiyxBhMrLbAbLLEHEystsBwssQgTKy2wHSyxCRMrLbAeLACwDSuxAAJFVFiwDyNCIEWwCyNCsAojsAFgQiBgsAFhtRAQAQAOAEJCimCxEgYrsHIrGyJZLbAfLLEAHistsCAssQEeKy2wISyxAh4rLbAiLLEDHistsCMssQQeKy2wJCyxBR4rLbAlLLEGHistsCYssQceKy2wJyyxCB4rLbAoLLEJHistsCksIDywAWAtsCosIGCwEGAgQyOwAWBDsAIlYbABYLApKiEtsCsssCorsCoqLbAsLCAgRyAgsAtDY7gEAGIgsABQWLBAYFlmsAFjYCNhOCMgilVYIEcgILALQ2O4BABiILAAUFiwQGBZZrABY2AjYTgbIVktsC0sALEAAkVUWLABFrAsKrABFTAbIlktsC4sALANK7EAAkVUWLABFrAsKrABFTAbIlktsC8sIDWwAWAtsDAsALABRWO4BABiILAAUFiwQGBZZrABY7ABK7ALQ2O4BABiILAAUFiwQGBZZrABY7ABK7AAFrQAAAAAAEQ+IzixLwEVKi2wMSwgPCBHILALQ2O4BABiILAAUFiwQGBZZrABY2CwAENhOC2wMiwuFzwtsDMsIDwgRyCwC0NjuAQAYiCwAFBYsEBgWWawAWNgsABDYbABQ2M4LbA0LLECABYlIC4gR7AAI0KwAiVJiopHI0cjYSBYYhshWbABI0KyMwEBFRQqLbA1LLAAFrAEJbAEJUcjRyNhsAlDK2WKLiMgIDyKOC2wNiywABawBCWwBCUgLkcjRyNhILAEI0KwCUMrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyCwCEMgiiNHI0cjYSNGYLAEQ7ACYiCwAFBYsEBgWWawAWNgILABKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwAmIgsABQWLBAYFlmsAFjYSMgILAEJiNGYTgbI7AIQ0awAiWwCENHI0cjYWAgsARDsAJiILAAUFiwQGBZZrABY2AjILABKyOwBENgsAErsAUlYbAFJbACYiCwAFBYsEBgWWawAWOwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbA3LLAAFiAgILAFJiAuRyNHI2EjPDgtsDgssAAWILAII0IgICBGI0ewASsjYTgtsDkssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbkIAAgAY2MjIFhiGyFZY7gEAGIgsABQWLBAYFlmsAFjYCMuIyAgPIo4IyFZLbA6LLAAFiCwCEMgLkcjRyNhIGCwIGBmsAJiILAAUFiwQGBZZrABYyMgIDyKOC2wOywjIC5GsAIlRlJYIDxZLrErARQrLbA8LCMgLkawAiVGUFggPFkusSsBFCstsD0sIyAuRrACJUZSWCA8WSMgLkawAiVGUFggPFkusSsBFCstsD4ssDUrIyAuRrACJUZSWCA8WS6xKwEUKy2wPyywNiuKICA8sAQjQoo4IyAuRrACJUZSWCA8WS6xKwEUK7AEQy6wKystsEAssAAWsAQlsAQmIC5HI0cjYbAJQysjIDwgLiM4sSsBFCstsEEssQgEJUKwABawBCWwBCUgLkcjRyNhILAEI0KwCUMrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyBHsARDsAJiILAAUFiwQGBZZrABY2AgsAErIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbACYiCwAFBYsEBgWWawAWNhsAIlRmE4IyA8IzgbISAgRiNHsAErI2E4IVmxKwEUKy2wQiywNSsusSsBFCstsEMssDYrISMgIDywBCNCIzixKwEUK7AEQy6wKystsEQssAAVIEewACNCsgABARUUEy6wMSotsEUssAAVIEewACNCsgABARUUEy6wMSotsEYssQABFBOwMiotsEcssDQqLbBILLAAFkUjIC4gRoojYTixKwEUKy2wSSywCCNCsEgrLbBKLLIAAEErLbBLLLIAAUErLbBMLLIBAEErLbBNLLIBAUErLbBOLLIAAEIrLbBPLLIAAUIrLbBQLLIBAEIrLbBRLLIBAUIrLbBSLLIAAD4rLbBTLLIAAT4rLbBULLIBAD4rLbBVLLIBAT4rLbBWLLIAAEArLbBXLLIAAUArLbBYLLIBAEArLbBZLLIBAUArLbBaLLIAAEMrLbBbLLIAAUMrLbBcLLIBAEMrLbBdLLIBAUMrLbBeLLIAAD8rLbBfLLIAAT8rLbBgLLIBAD8rLbBhLLIBAT8rLbBiLLA3Ky6xKwEUKy2wYyywNyuwOystsGQssDcrsDwrLbBlLLAAFrA3K7A9Ky2wZiywOCsusSsBFCstsGcssDgrsDsrLbBoLLA4K7A8Ky2waSywOCuwPSstsGossDkrLrErARQrLbBrLLA5K7A7Ky2wbCywOSuwPCstsG0ssDkrsD0rLbBuLLA6Ky6xKwEUKy2wbyywOiuwOystsHAssDorsDwrLbBxLLA6K7A9Ky2wciyzCQQCA0VYIRsjIVlCK7AIZbADJFB4sAEVMC0AS7gAyFJYsQEBjlmwAbkIAAgAY3CxAAVCsgABACqxAAVCswoCAQgqsQAFQrMOAAEIKrEABkK6AsAAAQAJKrEAB0K6AEAAAQAJKrEDAESxJAGIUViwQIhYsQNkRLEmAYhRWLoIgAABBECIY1RYsQMARFlZWVmzDAIBDCq4Af+FsASNsQIARAAA') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+}
+
+.mydp .mydpicon {
+ font-family: 'mydatepicker';
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.mydp .icon-mydpright:before {
+ content: "\e800";
+}
+
+.mydp .icon-mydpleft:before {
+ content: "\e801";
+}
+
+.mydp .icon-mydpcalendar:before {
+ content: "\e802";
+}
+
+.mydp .icon-mydpremove:before {
+ content: "\e805";
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css.ts b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css.ts
new file mode 100644
index 00000000..57743407
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.css.ts
@@ -0,0 +1,7 @@
+/**
+ * This file is generated by the Angular 2 template compiler.
+ * Do not edit.
+ */
+ /* tslint:disable */
+
+export const styles:any[] = ['.mydp {\n min-width: 30px;\n border-radius: 2px;\n line-height: 1.1;\n display: inline-block;\n position: relative;\n}\n\n.mydp * {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-family: Arial, Helvetica, sans-serif;\n padding: 0;\n margin: 0;\n}\n\n.mydp .selector {\n margin-top: 2px;\n margin-left: -1px;\n position: absolute;\n width: 252px;\n padding: 0;\n border: 1px solid #CCC;\n border-radius: 2px;\n z-index: 100;\n animation: selectorfadein 0.1s;\n}\n\n.mydp .selector:focus {\n border: 1px solid #ADD8E6;\n outline: none;\n}\n\n@keyframes selectorfadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.mydp .selectorarrow {\n background: #FAFAFA;\n margin-top: 12px;\n padding: 0;\n}\n\n.mydp .selectorarrow:after,\n.mydp .selectorarrow:before {\n bottom: 100%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n}\n\n.mydp .selectorarrow:after {\n border-color: rgba(250, 250, 250, 0);\n border-bottom-color: #FAFAFA;\n border-width: 10px;\n margin-left: -10px;\n}\n\n.mydp .selectorarrow:before {\n border-color: rgba(204, 204, 204, 0);\n border-bottom-color: #CCC;\n border-width: 11px;\n margin-left: -11px;\n}\n\n.mydp .selectorarrow:focus:before {\n border-bottom-color: #ADD8E6;\n}\n\n.mydp .selectorarrowleft:after,\n.mydp .selectorarrowleft:before {\n left: 24px;\n}\n\n.mydp .selectorarrowright:after,\n.mydp .selectorarrowright:before {\n left: 224px;\n}\n\n.mydp .alignselectorright {\n right: -1px;\n}\n\n.mydp .selectiongroup {\n position: relative;\n display: table;\n border: none;\n border-spacing: 0;\n background-color: #FFF;\n}\n\n.mydp .selection {\n outline: none;\n background-color: #FFF;\n display: table-cell;\n position: absolute;\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: center;\n}\n\n.mydp .invaliddate,\n.mydp .invalidmonth,\n.mydp .invalidyear {\n background-color: #F1DEDE;\n}\n\n.mydp ::-ms-clear {\n display: none;\n}\n\n.mydp .selbtngroup {\n position: relative;\n vertical-align: middle;\n white-space: nowrap;\n width: 1%;\n display: table-cell;\n font-size: 0;\n}\n\n.mydp .btnpicker,\n.mydp .btnclear {\n height: 100%;\n width: 30px;\n border: none;\n padding: 0;\n outline: 0;\n font: inherit;\n -moz-user-select: none;\n}\n\n.mydp .btnleftborder {\n border-left: 1px solid #CCC;\n}\n\n.mydp .btnpickerenabled,\n.mydp .btnclearenabled,\n.mydp .headertodaybtnenabled,\n.mydp .headerbtnenabled {\n cursor: pointer;\n}\n\n.mydp .btnpickerdisabled,\n.mydp .btncleardisabled,\n.mydp .headertodaybtndisabled,\n.mydp .headerbtndisabled {\n cursor: not-allowed;\n}\n\n.mydp .headerbtndisabled {\n opacity: 0.4;\n}\n\n.mydp .btnpicker,\n.mydp .btnclear,\n.mydp .headertodaybtn {\n background: #FFF;\n}\n\n.mydp .header {\n width: 100%;\n height: 30px;\n background-color: #FAFAFA;\n}\n\n.mydp .header td {\n vertical-align: middle;\n border: none;\n line-height: 0;\n}\n\n.mydp .header td:nth-child(1) {\n padding-left: 4px;\n}\n\n.mydp .header td:nth-child(2) {\n text-align: center;\n}\n\n.mydp .header td:nth-child(3) {\n padding-right: 4px;\n}\n\n.mydp .caltable {\n table-layout: fixed;\n width: 100%;\n background-color: #FFF;\n font-size: 14px;\n}\n\n.mydp .caltable,\n.mydp .weekdaytitle,\n.mydp .daycell {\n border-collapse: collapse;\n color: #003366;\n line-height: 1.1;\n}\n\n.mydp .weekdaytitle,\n.mydp .daycell {\n padding: 5px;\n text-align: center;\n}\n\n.mydp .weekdaytitle {\n background-color: #DDD;\n font-size: 12px;\n font-weight: bold;\n vertical-align: middle;\n max-width: 36px;\n overflow: hidden;\n white-space: nowrap;\n}\n\n.mydp .weekdaytitleweeknbr {\n width: 20px;\n border-right: 1px solid #BBB;\n}\n\n.mydp .daycell {\n cursor: pointer;\n height: 30px;\n}\n\n.mydp .daycell div {\n background-color: inherit;\n vertical-align: middle;\n}\n\n.mydp .daycell div span {\n vertical-align: middle;\n}\n\n.mydp .daycellweeknbr {\n font-size: 10px;\n border-right: 1px solid #CCC;\n cursor: default;\n color: #000;\n}\n\n.mydp .inlinedp {\n position: relative;\n margin-top: -1px;\n}\n\n.mydp .prevmonth {\n color: #CCC;\n}\n\n.mydp .nextmonth {\n color: #CCC;\n}\n\n.mydp .disabled {\n cursor: default !important;\n color: #CCC !important;\n background: #FBEFEF !important;\n}\n\n.mydp .sunday {\n color: #C30000;\n}\n\n.mydp .sundayDim {\n opacity: 0.5;\n}\n\n.mydp .currmonth {\n background-color: #F6F6F6;\n font-weight: bold;\n}\n\n.mydp .currday {\n text-decoration: underline;\n}\n\n.mydp .selectedday div {\n border: 1px solid #004198;\n background-color: #8EBFFF !important;\n border-radius: 2px;\n}\n\n.mydp .headerbtncell {\n background-color: #FAFAFA;\n display: table-cell;\n vertical-align: middle;\n}\n\n.mydp .headerbtn,\n.mydp .headerlabelbtn {\n background: #FAFAFA;\n border: none;\n height: 22px;\n}\n\n.mydp .headerbtn {\n width: 16px;\n}\n\n.mydp .headerlabelbtn {\n font-size: 14px;\n}\n\n.mydp,\n.mydp .headertodaybtn,\n.mydp .monthinput,\n.mydp .yearinput {\n border: 1px solid #CCC;\n}\n\n.mydp .btnpicker,\n.mydp .btnclear,\n.mydp .headerbtn,\n.mydp .headermonthtxt,\n.mydp .headeryeartxt,\n.mydp .headertodaybtn,\n.mydp .selection {\n color: #000;\n}\n\n.mydp .headertodaybtn {\n padding: 0 4px;\n border-radius: 2px;\n font-size: 11px;\n height: 22px;\n min-width: 60px;\n max-width: 70px;\n overflow: hidden;\n white-space: nowrap;\n}\n\n.mydp button::-moz-focus-inner {\n border: 0;\n}\n\n.mydp .headermonthtxt,\n.mydp .headeryeartxt {\n text-align: center;\n display: table-cell;\n vertical-align: middle;\n font-size: 14px;\n height: 26px;\n width: 40px;\n max-width: 40px;\n overflow: hidden;\n white-space: nowrap;\n}\n\n.mydp .btnclear:focus,\n.mydp .btnpicker:focus,\n.mydp .headertodaybtn:focus {\n background: #ADD8E6;\n}\n\n.mydp .headerbtn:focus,\n.mydp .monthlabel:focus,\n.mydp .yearlabel:focus {\n color: #ADD8E6;\n outline: none;\n}\n\n.mydp .daycell:focus {\n outline: 1px solid #CCC;\n}\n\n.mydp .icon-mydpcalendar,\n.mydp .icon-mydpremove {\n font-size: 16px;\n}\n\n.mydp .icon-mydpleft,\n.mydp .icon-mydpright {\n color: #222;\n font-size: 20px;\n}\n\n.mydp table {\n display: table;\n border-spacing: 0;\n}\n\n.mydp table td {\n padding: 0;\n}\n\n.mydp table,\n.mydp th,\n.mydp td {\n border: none;\n}\n\n.mydp .btnpickerenabled:hover,\n.mydp .btnclearenabled:hover,\n.mydp .headertodaybtnenabled:hover,\n.mydp .tablesingleday:hover {\n background-color: #8BDAF4;\n}\n\n.mydp .monthlabel,\n.mydp .yearlabel {\n cursor: pointer;\n}\n\n.mydp .yearinput,\n.mydp .monthinput {\n width: 40px;\n height: 22px;\n text-align: center;\n font-weight: bold;\n outline: none;\n border-radius: 2px;\n}\n\n.mydp .headerbtnenabled:hover,\n.mydp .monthlabel:hover,\n.mydp .yearlabel:hover {\n color: #8BDAF4;\n}\n\n@font-face {\n font-family: \'mydatepicker\';\n src: url(\'data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCMJXkAAAD8AAAAVE9TLzI+IEhBAAABUAAAAFZjbWFwEIvU5AAAAagAAAGiY3Z0IAbV/wQAAApQAAAAIGZwZ22KkZBZAAAKcAAAC3BnYXNwAAAAEAAACkgAAAAIZ2x5ZsNblX4AAANMAAADBGhlYWQM+nt/AAAGUAAAADZoaGVhBz0DVgAABogAAAAkaG10eA1jAAAAAAasAAAAFGxvY2EBWgHMAAAGwAAAAAxtYXhwAXUMOgAABswAAAAgbmFtZZKUFgMAAAbsAAAC/XBvc3TOA7dOAAAJ7AAAAFpwcmVw5UErvAAAFeAAAACGAAEAAAAKADAAPgACbGF0bgAOREZMVAAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAECrQGQAAUAAAJ6ArwAAACMAnoCvAAAAeAAMQECAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAQOgA6AUDUv9qAFoDUgCWAAAAAQAAAAAAAAAAAAUAAAADAAAALAAAAAQAAAFiAAEAAAAAAFwAAwABAAAALAADAAoAAAFiAAQAMAAAAAYABAABAALoAugF//8AAOgA6AX//wAAAAAAAQAGAAoAAAABAAIAAwAEAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAABAAAAAAAAAAAQAAOgAAADoAAAAAAEAAOgBAADoAQAAAAIAAOgCAADoAgAAAAMAAOgFAADoBQAAAAQAAAABAAAAAAFBAn0ADgAKtwAAAGYUAQUVKwEUDwEGIiY1ETQ+AR8BFgFBCvoLHBYWHAv6CgFeDgv6CxYOAfQPFAIM+goAAAEAAAAAAWcCfAANABdAFAABAAEBRwABAAFvAAAAZhcTAgUWKwERFAYiLwEmND8BNjIWAWUUIAn6Cgr6CxwYAlj+DA4WC/oLHAv6CxYAAAAADwAA/2oDoQNSAAMABwALAA8AEwAXABsAHwAjADMANwA7AD8ATwBzAJhAlUElAh0SSS0kAxMdAkchHwIdEwkdVBsBExkXDQMJCBMJXxgWDAMIFREHAwUECAVeFBAGAwQPCwMDAQAEAV4aARISHlggAR4eDEgOCgIDAAAcWAAcHA0cSXJwbWpnZmNgXVtWU01MRUQ/Pj08Ozo5ODc2NTQxLyknIyIhIB8eHRwbGhkYFxYVFBMSEREREREREREQIgUdKxczNSMXMzUjJzM1IxczNSMnMzUjATM1IyczNSMBMzUjJzM1IwM1NCYnIyIGBxUUFjczMjYBMzUjJzM1IxczNSM3NTQmJyMiBhcVFBY3MzI2NxEUBiMhIiY1ETQ2OwE1NDY7ATIWHQEzNTQ2OwEyFgcVMzIWR6GhxbKyxaGhxbKyxaGhAZuzs9aysgGsoaHWs7PEDAYkBwoBDAYkBwoBm6Gh1rOz1qGhEgoIIwcMAQoIIwgK1ywc/O4dKiodSDQlJCU01jYkIyU2AUcdKk+hoaEksrKyJKH9xKH6of3EoSSyATChBwoBDAahBwwBCv4msiShoaFroQcKAQwGoQcMAQos/TUdKiodAssdKjYlNDQlNjYlNDQlNioAAAABAAD/7wLUAoYAJAAeQBsiGRAHBAACAUcDAQIAAm8BAQAAZhQcFBQEBRgrJRQPAQYiLwEHBiIvASY0PwEnJjQ/ATYyHwE3NjIfARYUDwEXFgLUD0wQLBCkpBAsEEwQEKSkEBBMECwQpKQQLBBMDw+kpA9wFhBMDw+lpQ8PTBAsEKSkECwQTBAQpKQQEEwPLg+kpA8AAQAAAAEAAGAI8Y9fDzz1AAsD6AAAAADU+ZvvAAAAANT5m+8AAP9qA+gDUgAAAAgAAgAAAAAAAAABAAADUv9qAAAD6AAA//4D6AABAAAAAAAAAAAAAAAAAAAABQPoAAABZQAAAWUAAAOgAAADEQAAAAAAAAAiAEoBOAGCAAEAAAAFAHQADwAAAAAAAgBEAFQAcwAAAKkLcAAAAAAAAAASAN4AAQAAAAAAAAA1AAAAAQAAAAAAAQAMADUAAQAAAAAAAgAHAEEAAQAAAAAAAwAMAEgAAQAAAAAABAAMAFQAAQAAAAAABQALAGAAAQAAAAAABgAMAGsAAQAAAAAACgArAHcAAQAAAAAACwATAKIAAwABBAkAAABqALUAAwABBAkAAQAYAR8AAwABBAkAAgAOATcAAwABBAkAAwAYAUUAAwABBAkABAAYAV0AAwABBAkABQAWAXUAAwABBAkABgAYAYsAAwABBAkACgBWAaMAAwABBAkACwAmAflDb3B5cmlnaHQgKEMpIDIwMTcgYnkgb3JpZ2luYWwgYXV0aG9ycyBAIGZvbnRlbGxvLmNvbW15ZGF0ZXBpY2tlclJlZ3VsYXJteWRhdGVwaWNrZXJteWRhdGVwaWNrZXJWZXJzaW9uIDEuMG15ZGF0ZXBpY2tlckdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC5odHRwOi8vZm9udGVsbG8uY29tAEMAbwBwAHkAcgBpAGcAaAB0ACAAKABDACkAIAAyADAAMQA3ACAAYgB5ACAAbwByAGkAZwBpAG4AYQBsACAAYQB1AHQAaABvAHIAcwAgAEAAIABmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQBtAHkAZABhAHQAZQBwAGkAYwBrAGUAcgBSAGUAZwB1AGwAYQByAG0AeQBkAGEAdABlAHAAaQBjAGsAZQByAG0AeQBkAGEAdABlAHAAaQBjAGsAZQByAFYAZQByAHMAaQBvAG4AIAAxAC4AMABtAHkAZABhAHQAZQBwAGkAYwBrAGUAcgBHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAQIBAwEEAQUBBgAJbXlkcHJpZ2h0CG15ZHBsZWZ0DG15ZHBjYWxlbmRhcgpteWRwcmVtb3ZlAAAAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAYABgAGAAYA1L/agNS/2qwACwgsABVWEVZICBLuAAOUUuwBlNaWLA0G7AoWWBmIIpVWLACJWG5CAAIAGNjI2IbISGwAFmwAEMjRLIAAQBDYEItsAEssCBgZi2wAiwgZCCwwFCwBCZasigBCkNFY0VSW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCxAQpDRWNFYWSwKFBYIbEBCkNFY0UgsDBQWCGwMFkbILDAUFggZiCKimEgsApQWGAbILAgUFghsApgGyCwNlBYIbA2YBtgWVlZG7ABK1lZI7AAUFhlWVktsAMsIEUgsAQlYWQgsAVDUFiwBSNCsAYjQhshIVmwAWAtsAQsIyEjISBksQViQiCwBiNCsQEKQ0VjsQEKQ7ABYEVjsAMqISCwBkMgiiCKsAErsTAFJbAEJlFYYFAbYVJZWCNZISCwQFNYsAErGyGwQFkjsABQWGVZLbAFLLAHQyuyAAIAQ2BCLbAGLLAHI0IjILAAI0JhsAJiZrABY7ABYLAFKi2wBywgIEUgsAtDY7gEAGIgsABQWLBAYFlmsAFjYESwAWAtsAgssgcLAENFQiohsgABAENgQi2wCSywAEMjRLIAAQBDYEItsAosICBFILABKyOwAEOwBCVgIEWKI2EgZCCwIFBYIbAAG7AwUFiwIBuwQFlZI7AAUFhlWbADJSNhRESwAWAtsAssICBFILABKyOwAEOwBCVgIEWKI2EgZLAkUFiwABuwQFkjsABQWGVZsAMlI2FERLABYC2wDCwgsAAjQrILCgNFWCEbIyFZKiEtsA0ssQICRbBkYUQtsA4ssAFgICCwDENKsABQWCCwDCNCWbANQ0qwAFJYILANI0JZLbAPLCCwEGJmsAFjILgEAGOKI2GwDkNgIIpgILAOI0IjLbAQLEtUWLEEZERZJLANZSN4LbARLEtRWEtTWLEEZERZGyFZJLATZSN4LbASLLEAD0NVWLEPD0OwAWFCsA8rWbAAQ7ACJUKxDAIlQrENAiVCsAEWIyCwAyVQWLEBAENgsAQlQoqKIIojYbAOKiEjsAFhIIojYbAOKiEbsQEAQ2CwAiVCsAIlYbAOKiFZsAxDR7ANQ0dgsAJiILAAUFiwQGBZZrABYyCwC0NjuAQAYiCwAFBYsEBgWWawAWNgsQAAEyNEsAFDsAA+sgEBAUNgQi2wEywAsQACRVRYsA8jQiBFsAsjQrAKI7ABYEIgYLABYbUQEAEADgBCQopgsRIGK7ByKxsiWS2wFCyxABMrLbAVLLEBEystsBYssQITKy2wFyyxAxMrLbAYLLEEEystsBkssQUTKy2wGiyxBhMrLbAbLLEHEystsBwssQgTKy2wHSyxCRMrLbAeLACwDSuxAAJFVFiwDyNCIEWwCyNCsAojsAFgQiBgsAFhtRAQAQAOAEJCimCxEgYrsHIrGyJZLbAfLLEAHistsCAssQEeKy2wISyxAh4rLbAiLLEDHistsCMssQQeKy2wJCyxBR4rLbAlLLEGHistsCYssQceKy2wJyyxCB4rLbAoLLEJHistsCksIDywAWAtsCosIGCwEGAgQyOwAWBDsAIlYbABYLApKiEtsCsssCorsCoqLbAsLCAgRyAgsAtDY7gEAGIgsABQWLBAYFlmsAFjYCNhOCMgilVYIEcgILALQ2O4BABiILAAUFiwQGBZZrABY2AjYTgbIVktsC0sALEAAkVUWLABFrAsKrABFTAbIlktsC4sALANK7EAAkVUWLABFrAsKrABFTAbIlktsC8sIDWwAWAtsDAsALABRWO4BABiILAAUFiwQGBZZrABY7ABK7ALQ2O4BABiILAAUFiwQGBZZrABY7ABK7AAFrQAAAAAAEQ+IzixLwEVKi2wMSwgPCBHILALQ2O4BABiILAAUFiwQGBZZrABY2CwAENhOC2wMiwuFzwtsDMsIDwgRyCwC0NjuAQAYiCwAFBYsEBgWWawAWNgsABDYbABQ2M4LbA0LLECABYlIC4gR7AAI0KwAiVJiopHI0cjYSBYYhshWbABI0KyMwEBFRQqLbA1LLAAFrAEJbAEJUcjRyNhsAlDK2WKLiMgIDyKOC2wNiywABawBCWwBCUgLkcjRyNhILAEI0KwCUMrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyCwCEMgiiNHI0cjYSNGYLAEQ7ACYiCwAFBYsEBgWWawAWNgILABKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwAmIgsABQWLBAYFlmsAFjYSMgILAEJiNGYTgbI7AIQ0awAiWwCENHI0cjYWAgsARDsAJiILAAUFiwQGBZZrABY2AjILABKyOwBENgsAErsAUlYbAFJbACYiCwAFBYsEBgWWawAWOwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbA3LLAAFiAgILAFJiAuRyNHI2EjPDgtsDgssAAWILAII0IgICBGI0ewASsjYTgtsDkssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbkIAAgAY2MjIFhiGyFZY7gEAGIgsABQWLBAYFlmsAFjYCMuIyAgPIo4IyFZLbA6LLAAFiCwCEMgLkcjRyNhIGCwIGBmsAJiILAAUFiwQGBZZrABYyMgIDyKOC2wOywjIC5GsAIlRlJYIDxZLrErARQrLbA8LCMgLkawAiVGUFggPFkusSsBFCstsD0sIyAuRrACJUZSWCA8WSMgLkawAiVGUFggPFkusSsBFCstsD4ssDUrIyAuRrACJUZSWCA8WS6xKwEUKy2wPyywNiuKICA8sAQjQoo4IyAuRrACJUZSWCA8WS6xKwEUK7AEQy6wKystsEAssAAWsAQlsAQmIC5HI0cjYbAJQysjIDwgLiM4sSsBFCstsEEssQgEJUKwABawBCWwBCUgLkcjRyNhILAEI0KwCUMrILBgUFggsEBRWLMCIAMgG7MCJgMaWUJCIyBHsARDsAJiILAAUFiwQGBZZrABY2AgsAErIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbACYiCwAFBYsEBgWWawAWNhsAIlRmE4IyA8IzgbISAgRiNHsAErI2E4IVmxKwEUKy2wQiywNSsusSsBFCstsEMssDYrISMgIDywBCNCIzixKwEUK7AEQy6wKystsEQssAAVIEewACNCsgABARUUEy6wMSotsEUssAAVIEewACNCsgABARUUEy6wMSotsEYssQABFBOwMiotsEcssDQqLbBILLAAFkUjIC4gRoojYTixKwEUKy2wSSywCCNCsEgrLbBKLLIAAEErLbBLLLIAAUErLbBMLLIBAEErLbBNLLIBAUErLbBOLLIAAEIrLbBPLLIAAUIrLbBQLLIBAEIrLbBRLLIBAUIrLbBSLLIAAD4rLbBTLLIAAT4rLbBULLIBAD4rLbBVLLIBAT4rLbBWLLIAAEArLbBXLLIAAUArLbBYLLIBAEArLbBZLLIBAUArLbBaLLIAAEMrLbBbLLIAAUMrLbBcLLIBAEMrLbBdLLIBAUMrLbBeLLIAAD8rLbBfLLIAAT8rLbBgLLIBAD8rLbBhLLIBAT8rLbBiLLA3Ky6xKwEUKy2wYyywNyuwOystsGQssDcrsDwrLbBlLLAAFrA3K7A9Ky2wZiywOCsusSsBFCstsGcssDgrsDsrLbBoLLA4K7A8Ky2waSywOCuwPSstsGossDkrLrErARQrLbBrLLA5K7A7Ky2wbCywOSuwPCstsG0ssDkrsD0rLbBuLLA6Ky6xKwEUKy2wbyywOiuwOystsHAssDorsDwrLbBxLLA6K7A9Ky2wciyzCQQCA0VYIRsjIVlCK7AIZbADJFB4sAEVMC0AS7gAyFJYsQEBjlmwAbkIAAgAY3CxAAVCsgABACqxAAVCswoCAQgqsQAFQrMOAAEIKrEABkK6AsAAAQAJKrEAB0K6AEAAAQAJKrEDAESxJAGIUViwQIhYsQNkRLEmAYhRWLoIgAABBECIY1RYsQMARFlZWVmzDAIBDCq4Af+FsASNsQIARAAA\') format(\'truetype\');\n font-weight: normal;\n font-style: normal;\n}\n\n.mydp .mydpicon {\n font-family: \'mydatepicker\';\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.mydp .icon-mydpright:before {\n content: "\\e800";\n}\n\n.mydp .icon-mydpleft:before {\n content: "\\e801";\n}\n\n.mydp .icon-mydpcalendar:before {\n content: "\\e802";\n}\n\n.mydp .icon-mydpremove:before {\n content: "\\e805";\n}\n'];
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.html b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.html
new file mode 100644
index 00000000..05c91c89
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.html
@@ -0,0 +1,57 @@
+
+
+
0&&opts.showClearDateBtn ? '60px' : '30px'}"
+ (keyup)="userDateInput($event)" [value]="selectionDayTxt" (focus)="opts.editableDateField&&onFocusInput($event)" (blur)="opts.editableDateField&&lostFocusInput($event)" [disabled]="opts.componentDisabled" [readonly]="!opts.editableDateField" [required]="opts.inputValueRequired">
+
+ 0&&opts.showClearDateBtn" (click)="removeBtnClicked()" [ngClass]="{'btnclearenabled': !opts.componentDisabled, 'btncleardisabled': opts.componentDisabled, 'btnleftborder': opts.showInputField}" [disabled]="opts.componentDisabled">
+
+
+ 0&&opts.showClearDateBtn}" [disabled]="opts.componentDisabled">
+
+
+
+
+
+
+
+ # {{d}}
+
+
+ {{w.weekNbr}}
+
+
+ {{d.dateObj.day}}
+
+
+
+
+
+
+
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.spec.ts b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.spec.ts
new file mode 100644
index 00000000..3a9b7407
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.spec.ts
@@ -0,0 +1,2214 @@
+///
+
+import {ComponentFixture, TestBed} from '@angular/core/testing';
+import {By} from '@angular/platform-browser';
+import {DebugElement} from '@angular/core';
+import {MyDatePicker} from './my-date-picker.component';
+import {FocusDirective} from './directives/my-date-picker.focus.directive';
+import {InputAutoFillDirective} from './directives/my-date-picker.input.auto.fill.directive';
+
+let comp: MyDatePicker;
+let fixture: ComponentFixture;
+let de: DebugElement;
+let el: HTMLElement;
+
+let PREVMONTH: string = '.header tr td:first-child div .headerbtncell:first-child .headerbtn';
+let NEXTMONTH: string = '.header tr td:first-child div .headerbtncell:last-child .headerbtn';
+let PREVYEAR: string = '.header tr td:last-child div .headerbtncell:first-child .headerbtn';
+let NEXTYEAR: string = '.header tr td:last-child div .headerbtncell:last-child .headerbtn';
+
+function getDateString(date:any):string {
+ return date.getFullYear() + '-' + ((date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
+}
+
+function getElement(id:string):DebugElement {
+ return de.query(By.css(id));
+}
+
+function getElements(id:string):Array {
+ return de.queryAll(By.css(id));
+}
+
+describe('MyDatePicker', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [MyDatePicker, FocusDirective, InputAutoFillDirective],
+ });
+
+ fixture = TestBed.createComponent(MyDatePicker);
+
+ comp = fixture.componentInstance;
+
+ de = fixture.debugElement.query(By.css('.mydp'));
+ el = de.nativeElement;
+ });
+
+ it('set valid date', () => {
+ comp.selectionDayTxt = '2016-08-22';
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain('2016-08-22');
+ });
+
+ it('open/close selector', () => {
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ let selector = getElement('.selector');
+ expect(selector).toBe(null);
+
+ btnpicker.nativeElement.click();
+ fixture.detectChanges();
+ selector = getElement('.selector');
+ expect(selector).not.toBe(null);
+
+ btnpicker.nativeElement.click();
+ fixture.detectChanges();
+ selector = getElement('.selector');
+ expect(selector).toBe(null);
+ });
+
+ it('select current day from the selector and clear', () => {
+ let date = new Date();
+ comp.selectedMonth = {monthTxt: '', monthNbr: date.getMonth() + 1, year: date.getFullYear()};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ currday.nativeElement.click();
+
+ let dateStr = getDateString(date);
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain(dateStr);
+
+ fixture.detectChanges();
+ let btnclear = getElement('.btnclear');
+ btnclear.nativeElement.click();
+ expect(selection.nativeElement.value).toContain('');
+ });
+
+ it('select/unselect current day from the selector', () => {
+ let date = new Date();
+ comp.selectedMonth = {monthTxt: '', monthNbr: date.getMonth() + 1, year: date.getFullYear()};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ currday.nativeElement.click();
+
+ let dateStr = getDateString(date);
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain(dateStr);
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+
+ fixture.detectChanges();
+ let selectedday = getElement('.selectedday');
+ expect(selectedday).not.toBe(null);
+
+ fixture.detectChanges();
+ currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+ currday.nativeElement.click();
+
+ fixture.detectChanges();
+ selectedday = getElement('.selectedday');
+ expect(selectedday).toBe(null);
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('');
+ });
+
+ it('select today button', () => {
+ let date = new Date();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let today = getElement('.headertodaybtn');
+ expect(today).not.toBe(null);
+
+ today.nativeElement.click();
+
+ let dateStr = getDateString(date);
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain(dateStr);
+
+ fixture.detectChanges();
+ let btnclear = getElement('.btnclear');
+ btnclear.nativeElement.click();
+ expect(selection.nativeElement.value).toContain('');
+ });
+
+ it('select previous month', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let prevmonth = getElement('.header tr td:first-child .headerbtn:first-child');
+ expect(prevmonth).not.toBe(null);
+
+ prevmonth.nativeElement.click();
+
+ expect(comp.visibleMonth.monthTxt).toBe('Apr');
+ expect(comp.visibleMonth.monthNbr).toBe(4);
+ expect(comp.visibleMonth.year).toBe(2016);
+ });
+
+ it('select next month', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ nextmonth.nativeElement.click();
+
+ expect(comp.visibleMonth.monthTxt).toBe('Jun');
+ expect(comp.visibleMonth.monthNbr).toBe(6);
+ expect(comp.visibleMonth.year).toBe(2016);
+ });
+
+ it('select previous month january change year', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let prevmonth = getElement(PREVMONTH);
+ expect(prevmonth).not.toBe(null);
+
+ prevmonth.nativeElement.click();
+
+ expect(comp.visibleMonth.year).toBe(2015);
+ });
+
+ it('select next month december change year', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 12, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ nextmonth.nativeElement.click();
+
+ expect(comp.visibleMonth.year).toBe(2017);
+ });
+
+ it('select previous month from selector', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let prevmonth = getElement(PREVMONTH);
+ expect(prevmonth).not.toBe(null);
+
+ prevmonth.nativeElement.click();
+ expect(comp.visibleMonth.monthNbr).toBe(4);
+ expect(comp.visibleMonth.monthTxt).toBe('Apr');
+
+ prevmonth.nativeElement.click();
+ expect(comp.visibleMonth.monthNbr).toBe(3);
+ expect(comp.visibleMonth.monthTxt).toBe('Mar');
+ });
+
+ it('select next month from selector', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ nextmonth.nativeElement.click();
+ expect(comp.visibleMonth.monthNbr).toBe(6);
+ expect(comp.visibleMonth.monthTxt).toBe('Jun');
+
+ nextmonth.nativeElement.click();
+ expect(comp.visibleMonth.monthNbr).toBe(7);
+ expect(comp.visibleMonth.monthTxt).toBe('Jul');
+ });
+
+ it('select previous year', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let prevyear = getElement(PREVYEAR);
+ expect(prevyear).not.toBe(null);
+
+ prevyear.nativeElement.click();
+ fixture.detectChanges();
+ let yearLabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearLabel).not.toBe(null);
+ expect(yearLabel.nativeElement.textContent).toBe('2015');
+ });
+
+ it('select next year', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let nextyear = getElement(NEXTYEAR);
+ expect(nextyear).not.toBe(null);
+
+ nextyear.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearLabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearLabel).not.toBe(null);
+ expect(yearLabel.nativeElement.textContent).toBe('2017');
+ });
+
+ it('test calendar year 2016 month one by one - next month button', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+
+ comp.options = {firstDayOfWeek: 'mo'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let monthlabel = getElement('.monthlabel');
+ expect(monthlabel).not.toBe(null);
+ expect(monthlabel.nativeElement.textContent.trim()).toBe('Jan');
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.yearlabel');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent.trim()).toBe('2016');
+
+ comp.generateCalendar(1, 2016, true);
+
+ let beginDate: Array = ['28', '1', '29', '28', '25', '30', '27', '1', '29', '26', '31', '28'];
+ let endDate: Array = ['7', '13', '10', '8', '5', '10', '7', '11', '9', '6', '11', '8'];
+
+ let i: number = 0;
+ do {
+ fixture.detectChanges();
+ let currmonth = getElements('.caltable tbody tr td');
+ expect(currmonth).not.toBe(null);
+ expect(currmonth.length).toBe(42);
+
+ expect(currmonth[0]).not.toBe(null);
+ expect(currmonth[0].nativeElement.textContent.trim()).toBe(beginDate[i]);
+
+ expect(currmonth[41]).not.toBe(null);
+ expect(currmonth[41].nativeElement.textContent.trim()).toBe(endDate[i]);
+
+ comp.nextMonth();
+
+ i++;
+ } while (i < 12)
+ });
+
+ it('test calendar year 2016 month one by one - previous month button', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 12, year: 2016};
+
+ comp.options = {firstDayOfWeek: 'mo'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let monthlabel = getElement('.monthlabel');
+ expect(monthlabel).not.toBe(null);
+ expect(monthlabel.nativeElement.textContent.trim()).toBe('Dec');
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.yearlabel');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent.trim()).toBe('2016');
+
+ comp.generateCalendar(12, 2016, true);
+
+ let beginDate: Array = ['28', '1', '29', '28', '25', '30', '27', '1', '29', '26', '31', '28'];
+ let endDate: Array = ['7', '13', '10', '8', '5', '10', '7', '11', '9', '6', '11', '8'];
+
+ let i: number = 11;
+ do {
+ fixture.detectChanges();
+ let currmonth = getElements('.caltable tbody tr td');
+ expect(currmonth).not.toBe(null);
+ expect(currmonth.length).toBe(42);
+
+ expect(currmonth[0]).not.toBe(null);
+ expect(currmonth[0].nativeElement.textContent.trim()).toBe(beginDate[i]);
+
+ expect(currmonth[41]).not.toBe(null);
+ expect(currmonth[41].nativeElement.textContent.trim()).toBe(endDate[i]);
+
+ comp.prevMonth();
+
+ i--;
+ } while (i >= 0)
+ });
+
+ // options
+ it('options - dayLabels', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+ comp.options = {dayLabels: {su: '1', mo: '2', tu: '3', we: '4', th: '5', fr: '6', sa: '7'}, firstDayOfWeek: 'su'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let ths = getElements('.caltable thead tr th');
+ expect(ths.length).toBe(7);
+ for(let i in ths) {
+ let el = ths[i];
+ expect(parseInt(el.nativeElement.textContent)).toBe(parseInt(i) + 1);
+ }
+ });
+
+ it('options - monthLabels', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+ comp.options = {monthLabels: { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12' }};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ for(let i = 1; i <= 12; i++) {
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(parseInt(monthLabel.nativeElement.textContent)).toBe(i);
+ nextmonth.nativeElement.click();
+ }
+ });
+
+ it('options - date format', () => {
+ comp.options = {dateFormat: 'dd.mm.yyyy', indicateInvalidDate: true};
+
+ comp.parseOptions();
+
+ let value = {target:{value:'2016-08-22'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ value = {target:{value:'2016-08-2'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'16.09/2016'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'2016-08-xx'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'16.09.999'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'16.09.19999'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'16.09.2016'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(false);
+
+ comp.options = {dateFormat: 'dd mmm yyyy', indicateInvalidDate: true};
+
+ comp.parseOptions();
+
+ value = {target:{value:'2016-08-22'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(true);
+
+ value = {target:{value:'22 Aug 2016'}};
+ comp.userDateInput(value);
+ expect(comp.invalidDate).toBe(false);
+ });
+
+ it('options - show today button', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {showTodayBtn: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).toBe(null);
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {showTodayBtn: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ });
+
+ it('options - today button text', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+ comp.options = {todayBtnTxt: 'test text'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ expect(headertodaybtn.nativeElement.textContent).toBe('test text');
+ });
+
+ it('options - first day of week', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+ comp.options = {firstDayOfWeek: 'tu'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let first = getElement('.caltable thead tr th:first-child');
+ expect(first).not.toBe(null);
+ expect(first.nativeElement.textContent).toBe('Tue');
+
+ let last = getElement('.caltable thead tr th:last-child');
+ expect(last).not.toBe(null);
+ expect(last.nativeElement.textContent).toBe('Mon');
+ });
+
+ it('options - sunday highlight', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+ comp.options = {sunHighlight: true};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let sunday = getElement('.sunday');
+ expect(sunday).not.toBe(null);
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {sunHighlight: false};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ sunday = getElement('.sunday');
+ expect(sunday).toBe(null);
+ });
+
+ it('options - current day marked', () => {
+ comp.options = {markCurrentDay: true};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {markCurrentDay: false};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ currday = getElement('.currday');
+ expect(currday).toBe(null);
+ });
+
+ it('options - editable month and year', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+ comp.options = {editableMonthAndYear: true};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ montlabel.nativeElement.click();
+
+ fixture.detectChanges();
+ let monthinput = getElement('.monthinput');
+ expect(monthinput).not.toBe(null);
+
+ comp.userMonthInput({target:{value:'jan'}});
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('Jan');
+
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ yearlabel.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearinput = getElement('.yearinput');
+ expect(yearinput).not.toBe(null);
+
+ comp.userYearInput({target:{value:'2019'}});
+
+ fixture.detectChanges();
+ yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent).toBe('2019');
+ });
+
+ it('options - disable header buttons', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 5, year: 2016};
+ comp.options = {
+ disableHeaderButtons: true,
+ disableUntil: {year: 2016, month: 4, day: 10}
+ };
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('May');
+
+ fixture.detectChanges();
+ let prevmonth = getElement(PREVMONTH);
+ expect(prevmonth).not.toBe(null);
+ prevmonth.nativeElement.click();
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('Apr');
+
+ fixture.detectChanges();
+ let headerbtndisabled = getElements('.headerbtndisabled');
+ expect(headerbtndisabled).not.toBe(null);
+ expect(headerbtndisabled.length).toBe(2);
+
+ prevmonth.nativeElement.click();
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('Apr');
+
+ fixture.detectChanges();
+ let prevyear = getElement(PREVYEAR);
+ expect(prevyear).not.toBe(null);
+ prevyear.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent).toBe('2016');
+
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {
+ disableHeaderButtons: true,
+ disableSince: {year: 2016, month: 7, day: 10}
+ };
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('May');
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+ nextmonth.nativeElement.click();
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('Jun');
+
+ fixture.detectChanges();
+ headerbtndisabled = getElements('.headerbtndisabled');
+ expect(headerbtndisabled).not.toBe(null);
+ expect(headerbtndisabled.length).toBe(2);
+
+ prevmonth.nativeElement.click();
+
+ fixture.detectChanges();
+ montlabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(montlabel).not.toBe(null);
+ expect(montlabel.nativeElement.textContent).toBe('Jun');
+
+ fixture.detectChanges();
+ let nextyear = getElement(NEXTYEAR);
+ expect(nextyear).not.toBe(null);
+ nextyear.nativeElement.click();
+
+ fixture.detectChanges();
+ yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent).toBe('2016');
+ });
+
+ it('options - min year', () => {
+ comp.visibleMonth = {monthTxt: 'May', monthNbr: 5, year: 2016};
+ comp.options = {minYear: 2000};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ yearlabel.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearinput = getElement('.yearinput');
+ expect(yearinput).not.toBe(null);
+
+ comp.userYearInput({target:{value:1999}});
+
+ fixture.detectChanges();
+ let invalidyear = getElement('.invalidyear');
+ expect(invalidyear).not.toBe(null);
+
+ comp.userYearInput({target:{value:2000}});
+
+ fixture.detectChanges();
+ yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent).toBe('2000');
+ });
+
+ it('options - max year', () => {
+ comp.visibleMonth = {monthTxt: 'May', monthNbr: 5, year: 2016};
+ comp.options = {maxYear: 2020};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ yearlabel.nativeElement.click();
+
+ fixture.detectChanges();
+ let yearinput = getElement('.yearinput');
+ expect(yearinput).not.toBe(null);
+
+ comp.userYearInput({target:{value:2021}});
+
+ fixture.detectChanges();
+ let invalidyear = getElement('.invalidyear');
+ expect(invalidyear).not.toBe(null);
+
+ comp.userYearInput({target:{value:2020}});
+
+ fixture.detectChanges();
+ yearlabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearlabel).not.toBe(null);
+ expect(yearlabel.nativeElement.textContent).toBe('2020');
+ });
+
+ it('options - disable until', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {disableUntil: {year: 2016, month: 10, day: 5}};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(10);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('26');
+
+ let lastDisabled = disabled[disabled.length - 1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('5');
+
+ fixture.detectChanges();
+ lastDisabled.nativeElement.click();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('');
+
+ fixture.detectChanges();
+ let selectableDays = getElements('.tablesingleday');
+ expect(selectableDays).not.toBe(null);
+ expect(selectableDays.length).toBe(26);
+
+ selectableDays[0].nativeElement.click();
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain('2016-10-06');
+ });
+
+ it('options - disable since', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {disableSince: {year: 2016, month: 10, day: 30}};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(8);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('30');
+
+ let lastDisabled = disabled[disabled.length - 1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('6');
+
+ fixture.detectChanges();
+ lastDisabled.nativeElement.click();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('');
+
+ fixture.detectChanges();
+ let selectableDays = getElements('.tablesingleday');
+ expect(selectableDays).not.toBe(null);
+ expect(selectableDays.length).toBe(29);
+
+ selectableDays[5].nativeElement.click();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain('2016-10-06');
+ });
+
+ it('options - disable days one by one', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {disableDays: [{year: 2016, month: 10, day: 5}, {year: 2016, month: 10, day: 10}]};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(2);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('5');
+
+ let lastDisabled = disabled[1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('10');
+ });
+
+ it('options - enable disabled days one by one', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2017};
+ comp.options = {
+ dateFormat: 'dd.mm.yyyy',
+ disableDateRange: {begin: {year: 2017, month: 1, day: 1}, end: {year: 2017, month: 1, day: 31}},
+ enableDays: [{year: 2017, month: 1, day: 5}, {year: 2017, month: 1, day: 6}, {year: 2017, month: 1, day: 7}, {year: 2017, month: 1, day: 8}]
+ };
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(1, 2017, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(27);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('1');
+
+ let lastDisabled = disabled[disabled.length - 1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('31');
+
+ fixture.detectChanges();
+ let alldates = getElements('.caltable .daycell');
+ expect(alldates).not.toBe(null);
+ expect(alldates.length).toBe(42);
+
+ fixture.detectChanges();
+ let firstEnabled = alldates[10];
+ firstEnabled.nativeElement.click();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.value).toBe('05.01.2017');
+ });
+
+ it('options - disable range', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {disableDateRange: {begin: {year: 2016, month: 10, day: 5}, end: {year: 2016, month: 10, day: 10}}};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(6);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('5');
+
+ let lastDisabled = disabled[disabled.length - 1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('10');
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {disableDateRange: {begin: {}, end: {}}};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(0);
+ });
+
+ it('options - disable today - today button disabled', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+
+ let date = new Date();
+ comp.options = {disableDays: [{year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate()}]};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ expect(headertodaybtn.properties['disabled']).toBe(true);
+
+ fixture.detectChanges();
+ headertodaybtn.nativeElement.click();
+ let selector = getElement('.selector');
+ expect(selector).not.toBe(null);
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {disableDays: []};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker.nativeElement.click();
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ expect(headertodaybtn.properties['disabled']).toBe(false);
+
+ headertodaybtn.nativeElement.click();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.value).toBe(getDateString(date));
+ });
+
+ it('options - disable weekends', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {firstDayOfWeek: 'mo', disableWeekends: true};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.generateCalendar(10, 2016, true);
+
+ fixture.detectChanges();
+ let disabled = getElements('tr .disabled');
+ expect(disabled).not.toBe(null);
+ expect(disabled.length).toBe(12);
+
+ let firstDisabled = disabled[0];
+ expect(firstDisabled.nativeElement.textContent.trim()).toBe('1');
+
+ let secondDisabled = disabled[1];
+ expect(secondDisabled.nativeElement.textContent.trim()).toBe('2');
+
+ let lastDisabled = disabled[disabled.length - 1];
+ expect(lastDisabled.nativeElement.textContent.trim()).toBe('6');
+
+ fixture.detectChanges();
+ firstDisabled.nativeElement.click();
+ let selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('');
+
+ fixture.detectChanges();
+ secondDisabled.nativeElement.click();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('');
+
+ fixture.detectChanges();
+ let selectableDays = getElements('.tablesingleday');
+ expect(selectableDays).not.toBe(null);
+ expect(selectableDays.length).toBe(21);
+
+ selectableDays[0].nativeElement.click();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toContain('2016-10-03');
+ });
+
+ it('options - inline', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {inline: true};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selector = getElement('.selector');
+ expect(selector).not.toBe(null);
+
+ fixture.detectChanges();
+ let selectiongroup = getElement('.selectiongroup');
+ expect(selectiongroup).toBe(null);
+ });
+
+ it('options - show clear date button', () => {
+ let date = new Date();
+ comp.selectedMonth = {monthTxt: '', monthNbr: date.getMonth() + 1, year: date.getFullYear()};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ currday.nativeElement.click();
+
+ fixture.detectChanges();
+ let btnclear = getElement('.btnclear');
+ expect(btnclear).not.toBe(null);
+
+ btnclear.nativeElement.click();
+
+ comp.options = {showClearDateBtn: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ currday.nativeElement.click();
+
+ fixture.detectChanges();
+ btnclear = getElement('.btnclear');
+ expect(btnclear).not.toBe(null);
+ btnclear.nativeElement.click();
+
+ btnclear.nativeElement.click();
+
+
+ comp.options = {showClearDateBtn: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ currday = getElement('.currday');
+ expect(currday).not.toBe(null);
+
+ currday.nativeElement.click();
+
+ fixture.detectChanges();
+ btnclear = getElement('.btnclear');
+ expect(btnclear).toBe(null);
+ });
+
+ it('options - height', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {height: '50px'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.styles['height']).toBe('50px');
+ });
+
+ it('options - width', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {width: '300px'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ expect(de).not.toBe(null);
+ expect(de.styles['width']).toBe('300px');
+
+ comp.options = {width: '20%'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ expect(de).not.toBe(null);
+ expect(de.styles['width']).toBe('20%');
+ });
+
+ it('options - selection text font size', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {selectionTxtFontSize: '10px'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.styles['font-size']).toBe('10px');
+ });
+
+ it('options - align selector right', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {alignSelectorRight: true};
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let alignselectorright = getElement('.alignselectorright');
+ expect(alignselectorright).not.toBe(null);
+
+ comp.options = {alignSelectorRight: false};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ alignselectorright = getElement('.alignselectorright');
+ expect(alignselectorright).toBe(null);
+ });
+
+ it('options - open selector top of input', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {openSelectorTopOfInput: true, height: '30px'};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ let value: string = comp.getSelectorTopPosition();
+ expect(value).not.toBe(null);
+ expect(value).toBe('32px');
+
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {openSelectorTopOfInput: false};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ value = comp.getSelectorTopPosition();
+ expect(value).toBe(undefined);
+
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {};
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ value = comp.getSelectorTopPosition();
+ expect(value).toBe(undefined);
+ });
+
+ it('options - indicate invalid date', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {indicateInvalidDate: true, dateFormat: 'dd.mm.yyyy'};
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'2016-08-22'}});
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'2016-08-xx'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'2016-08-99'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'10.10.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('options - disableUntil input dates validation', ()=> {
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableUntil:{year: 2016, month: 11, day: 4}
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'11.12.2015'}});
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'11.06.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'04.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'05.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableUntil:{year: 0, month: 0, day: 0}
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'11.12.2015'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('options - disableSince input dates validation', ()=> {
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableSince:{year: 2016, month: 11, day: 22}
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'08.12.2017'}});
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'08.12.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'23.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'21.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableSince:{year: 0, month: 0, day: 0}
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'11.12.2015'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('options - disable weekends input date validation', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 11, year: 2016};
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableWeekends: true,
+ firstDayOfWeek: 'mo'
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'05.11.2016'}});
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'06.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'12.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'13.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'19.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'20.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'26.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'27.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'04.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('options - disableDays input date validation', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 11, year: 2016};
+ comp.options = {
+ indicateInvalidDate: true,
+ dateFormat: 'dd.mm.yyyy',
+ disableDays: [
+ {year: 2016, month: 11, day: 1},
+ {year: 2016, month: 11, day: 3},
+ {year: 2016, month: 11, day: 5},
+ {year: 2016, month: 11, day: 7}
+ ],
+ firstDayOfWeek: 'mo'
+ };
+
+ comp.parseOptions();
+
+ comp.userDateInput({target:{value:'01.11.2016'}});
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'03.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'05.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'07.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).not.toBe(null);
+
+ comp.userDateInput({target:{value:'02.11.2016'}});
+ fixture.detectChanges();
+ invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('options - disable component', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {componentDisabled: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+
+ btnpicker.nativeElement.click();
+ fixture.detectChanges();
+
+ let selector = getElement('.selector');
+ expect(selector).toBe(null);
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+
+ selection.nativeElement.value = '2016-11-14';
+
+ fixture.detectChanges();
+ expect(selection.nativeElement.value).toContain('');
+ });
+
+ it('options - editable date field', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {editableDateField: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+
+ selection.nativeElement.value = '2016-11-14';
+
+ fixture.detectChanges();
+ expect(selection.nativeElement.value).toContain('');
+
+ comp.options = {editableDateField: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+
+ selection.nativeElement.value = '2016-11-14';
+
+ fixture.detectChanges();
+ expect(selection.nativeElement.value).toContain('2016-11-14');
+ });
+
+ it('options - click input to open selector', () => {
+
+ let selection: DebugElement,
+ selector: DebugElement;
+
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {editableDateField: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+
+ selection.nativeElement.click();
+
+ fixture.detectChanges();
+ selector = getElement('.selector');
+ expect(selector).toBe(null);
+
+ comp.options = {editableDateField: false, openSelectorOnInputClick: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+
+ selection.nativeElement.click();
+
+ fixture.detectChanges();
+ selector = getElement('.selector');
+ expect(selector).not.toBe(null);
+ });
+
+ it('options - input field value required', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.properties['required']).toBe(false);
+
+ comp.options = {inputValueRequired: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.properties['required']).toBe(true);
+
+ comp.options = {inputValueRequired: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.properties['required']).toBe(false);
+ });
+
+ it('options - show selector arrow', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let selectorarrow = getElement('.selectorarrow');
+ expect(selectorarrow).not.toBe(null);
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {showSelectorArrow: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ selectorarrow = getElement('.selectorarrow');
+ expect(selectorarrow).toBe(null);
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {showSelectorArrow: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ selectorarrow = getElement('.selectorarrow');
+ expect(selectorarrow).not.toBe(null);
+ btnpicker.nativeElement.click();
+ });
+
+ it('options - show input field', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 10, year: 2016};
+ comp.options = {};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+
+
+ comp.options = {showInputField: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).toBe(null);
+
+
+ comp.options = {showInputField: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ });
+
+ it('options - input auto fill', () => {
+ comp.options = {inputAutoFill: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+
+ fixture.detectChanges();
+ selection.nativeElement.value = '2016-2-1';
+ fixture.nativeElement.querySelector('.selection').dispatchEvent(new Event('keyup'));
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('2016-2-1');
+
+
+ comp.options = {inputAutoFill: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ selection.nativeElement.value = '';
+
+ fixture.detectChanges();
+ selection.nativeElement.value = '2016-1-';
+ fixture.nativeElement.querySelector('.selection').dispatchEvent(new Event('keyup'));
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('2016-01-');
+
+ fixture.detectChanges();
+ selection.nativeElement.value = '2016-01-9';
+ fixture.nativeElement.querySelector('.selection').dispatchEvent(new Event('keyup'));
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection.nativeElement.value).toBe('2016-01-09');
+ });
+
+ it('options - show week numbers', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2017};
+ comp.options = {showWeekNumbers: false};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let weekdaytitleweeknbr = getElement('.weekdaytitleweeknbr');
+ expect(weekdaytitleweeknbr).toBe(null);
+
+ fixture.detectChanges();
+ let daycellweeknbr = getElements('.daycellweeknbr');
+ expect(daycellweeknbr.length).toBe(0);
+
+ btnpicker.nativeElement.click();
+
+
+ comp.options = {showWeekNumbers: true};
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ weekdaytitleweeknbr = getElement('.weekdaytitleweeknbr');
+ expect(weekdaytitleweeknbr).not.toBe(null);
+
+ fixture.detectChanges();
+ daycellweeknbr = getElements('.daycellweeknbr');
+ expect(daycellweeknbr.length).toBe(6);
+
+ expect(daycellweeknbr[0].nativeElement.textContent.trim()).toBe('52');
+ expect(daycellweeknbr[1].nativeElement.textContent.trim()).toBe('1');
+ expect(daycellweeknbr[2].nativeElement.textContent.trim()).toBe('2');
+ expect(daycellweeknbr[3].nativeElement.textContent.trim()).toBe('3');
+ expect(daycellweeknbr[4].nativeElement.textContent.trim()).toBe('4');
+ expect(daycellweeknbr[5].nativeElement.textContent.trim()).toBe('5');
+
+ fixture.detectChanges();
+ let prevyear = getElement(PREVYEAR);
+ expect(prevyear).not.toBe(null);
+ prevyear.nativeElement.click();
+
+ fixture.detectChanges();
+ daycellweeknbr = getElements('.daycellweeknbr');
+ expect(daycellweeknbr.length).toBe(6);
+
+ expect(daycellweeknbr[0].nativeElement.textContent.trim()).toBe('53');
+ expect(daycellweeknbr[1].nativeElement.textContent.trim()).toBe('1');
+ expect(daycellweeknbr[2].nativeElement.textContent.trim()).toBe('2');
+ expect(daycellweeknbr[3].nativeElement.textContent.trim()).toBe('3');
+ expect(daycellweeknbr[4].nativeElement.textContent.trim()).toBe('4');
+ expect(daycellweeknbr[5].nativeElement.textContent.trim()).toBe('5');
+
+ prevyear.nativeElement.click();
+
+ fixture.detectChanges();
+ daycellweeknbr = getElements('.daycellweeknbr');
+ expect(daycellweeknbr.length).toBe(6);
+
+ expect(daycellweeknbr[0].nativeElement.textContent.trim()).toBe('1');
+ expect(daycellweeknbr[1].nativeElement.textContent.trim()).toBe('2');
+ expect(daycellweeknbr[2].nativeElement.textContent.trim()).toBe('3');
+ expect(daycellweeknbr[3].nativeElement.textContent.trim()).toBe('4');
+ expect(daycellweeknbr[4].nativeElement.textContent.trim()).toBe('5');
+ expect(daycellweeknbr[5].nativeElement.textContent.trim()).toBe('6');
+ });
+
+ it('options - aria label texts', () => {
+ comp.selectedDate = comp.parseSelectedDate('2017-10-11');
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ expect(btnpicker).not.toBe(null);
+ expect(btnpicker.nativeElement.attributes['aria-label'].textContent).toBe('Open Calendar');
+
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.attributes['aria-label'].textContent).toBe('Date input field');
+
+ fixture.detectChanges();
+ let btnclear = getElement('.btnclear');
+ expect(btnclear).not.toBe(null);
+ expect(btnclear.nativeElement.attributes['aria-label'].textContent).toBe('Clear Date');
+
+
+ fixture.detectChanges();
+ let prevmonth = getElement(PREVMONTH);
+ expect(prevmonth).not.toBe(null);
+ expect(prevmonth.nativeElement.attributes['aria-label'].textContent).toBe('Previous Month');
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+ expect(nextmonth.nativeElement.attributes['aria-label'].textContent).toBe('Next Month');
+
+ fixture.detectChanges();
+ let prevyear = getElement(PREVYEAR);
+ expect(prevyear).not.toBe(null);
+ expect(prevyear.nativeElement.attributes['aria-label'].textContent).toBe('Previous Year');
+
+ fixture.detectChanges();
+ let nextyear = getElement(NEXTYEAR);
+ expect(nextyear).not.toBe(null);
+ expect(nextyear.nativeElement.attributes['aria-label'].textContent).toBe('Next Year');
+
+ btnpicker.nativeElement.click();
+
+ comp.options = {
+ ariaLabelInputField: 'text 1',
+ ariaLabelClearDate: 'text 2',
+ ariaLabelOpenCalendar: 'text 3',
+ ariaLabelPrevMonth: 'text 4',
+ ariaLabelNextMonth: 'text 5',
+ ariaLabelPrevYear: 'text 6',
+ ariaLabelNextYear: 'text 7'
+ };
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ btnpicker = getElement('.btnpicker');
+ expect(btnpicker).not.toBe(null);
+ expect(btnpicker.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelOpenCalendar);
+
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelInputField);
+
+ fixture.detectChanges();
+ btnclear = getElement('.btnclear');
+ expect(btnclear).not.toBe(null);
+ expect(btnclear.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelClearDate);
+
+
+ fixture.detectChanges();
+ prevmonth = getElement(PREVMONTH);
+ expect(prevmonth).not.toBe(null);
+ expect(prevmonth.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelPrevMonth);
+
+ fixture.detectChanges();
+ nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+ expect(nextmonth.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelNextMonth);
+
+ fixture.detectChanges();
+ prevyear = getElement(PREVYEAR);
+ expect(prevyear).not.toBe(null);
+ expect(prevyear.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelPrevYear);
+
+ fixture.detectChanges();
+ nextyear = getElement(NEXTYEAR);
+ expect(nextyear).not.toBe(null);
+ expect(nextyear.nativeElement.attributes['aria-label'].textContent).toBe(comp.options.ariaLabelNextYear);
+ });
+
+ it('locale - use fr locale', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+ comp.locale = 'fr';
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let days = getElements('.caltable thead tr th');
+ expect(days.length).toBe(7);
+ expect(days[0].nativeElement.textContent).toBe('Lun');
+ expect(days[1].nativeElement.textContent).toBe('Mar');
+ expect(days[2].nativeElement.textContent).toBe('Mer');
+ expect(days[3].nativeElement.textContent).toBe('Jeu');
+ expect(days[4].nativeElement.textContent).toBe('Ven');
+ expect(days[5].nativeElement.textContent).toBe('Sam');
+ expect(days[6].nativeElement.textContent).toBe('Dim');
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Jan');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Fév');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Mar');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Avr');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Mai');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Juin');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Juil');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Aoû');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Sep');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Oct');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Nov');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Déc');
+
+ fixture.detectChanges();
+ let headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ expect(headertodaybtn.nativeElement.textContent).toBe('Aujourd\'hui');
+
+ fixture.detectChanges();
+ let firstDayOfWeek = getElement('.caltable thead tr th:first-child');
+ expect(firstDayOfWeek).not.toBe(null);
+ expect(firstDayOfWeek.nativeElement.textContent).toBe('Lun');
+
+ fixture.detectChanges();
+ let sunday = getElement('.sunday');
+ expect(sunday).not.toBe(null);
+
+ comp.userDateInput({target:{value:'10/10/2016'}});
+ expect(comp.invalidDate).toBe(false);
+
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+ it('selDate - initially selected date - string', () => {
+ let date: string = '2017-10-11';
+ comp.selectedDate = comp.parseSelectedDate(date);
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.value).toContain('2017-10-11');
+
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let selectedday = getElement('.selectedday div span');
+ expect(selectedday).not.toBe(null);
+ expect(selectedday.nativeElement.textContent).toContain('11');
+
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel).not.toBe(null);
+ expect(monthLabel.nativeElement.textContent).toBe('Oct');
+
+ fixture.detectChanges();
+ let yearLabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearLabel).not.toBe(null);
+ expect(yearLabel.nativeElement.textContent).toBe('2017');
+ });
+
+ it('selDate - initially selected date - object', () => {
+ let date: Object = {year: 2017, month: 10, day: 11};
+ comp.selectedDate = comp.parseSelectedDate(date);
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.nativeElement.value).toContain('2017-10-11');
+ expect(comp.selectionDayTxt).toContain('2017-10-11');
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let selectedday = getElement('.selectedday div span');
+ expect(selectedday).not.toBe(null);
+ expect(selectedday.nativeElement.textContent).toContain('11');
+
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel).not.toBe(null);
+ expect(monthLabel.nativeElement.textContent).toBe('Oct');
+
+ fixture.detectChanges();
+ let yearLabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearLabel).not.toBe(null);
+ expect(yearLabel.nativeElement.textContent).toBe('2017');
+ });
+
+ it('defaultMonth - initially selected month', () => {
+ comp.selectedMonth = comp.parseSelectedMonth('2019-08');
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel).not.toBe(null);
+ expect(monthLabel.nativeElement.textContent).toBe('Aug');
+
+ fixture.detectChanges();
+ let yearLabel = getElement('.headeryeartxt .headerlabelbtn');
+ expect(yearLabel).not.toBe(null);
+ expect(yearLabel.nativeElement.textContent).toBe('2019');
+ });
+
+ it('placeholder - placeholder text', () => {
+ comp.placeholder = '';
+
+ fixture.detectChanges();
+ let selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.properties['placeholder']).toBe('');
+
+ comp.placeholder = 'Select date';
+
+ fixture.detectChanges();
+ selection = getElement('.selection');
+ expect(selection).not.toBe(null);
+ expect(selection.properties['placeholder']).toBe(comp.placeholder);
+
+
+ });
+
+ it('locale - use id locale', () => {
+ comp.selectedMonth = {monthTxt: '', monthNbr: 1, year: 2016};
+ comp.locale = 'id';
+
+ comp.parseOptions();
+
+ fixture.detectChanges();
+ let btnpicker = getElement('.btnpicker');
+ btnpicker.nativeElement.click();
+
+ fixture.detectChanges();
+ let days = getElements('.caltable thead tr th');
+ expect(days.length).toBe(7);
+ expect(days[0].nativeElement.textContent).toBe('Min');
+ expect(days[1].nativeElement.textContent).toBe('Sen');
+ expect(days[2].nativeElement.textContent).toBe('Sel');
+ expect(days[3].nativeElement.textContent).toBe('Rab');
+ expect(days[4].nativeElement.textContent).toBe('Kam');
+ expect(days[5].nativeElement.textContent).toBe('Jum');
+ expect(days[6].nativeElement.textContent).toBe('Sab');
+
+ fixture.detectChanges();
+ let nextmonth = getElement(NEXTMONTH);
+ expect(nextmonth).not.toBe(null);
+
+ fixture.detectChanges();
+ let monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Jan');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Feb');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Mar');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Apr');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Mei');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Jun');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Jul');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Ags');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Sep');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Okt');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Nov');
+
+ nextmonth.nativeElement.click();
+ fixture.detectChanges();
+ monthLabel = getElement('.headermonthtxt .headerlabelbtn');
+ expect(monthLabel.nativeElement.textContent).toBe('Des');
+
+ fixture.detectChanges();
+ let headertodaybtn = getElement('.headertodaybtn');
+ expect(headertodaybtn).not.toBe(null);
+ expect(headertodaybtn.nativeElement.textContent).toBe('Hari ini');
+
+ fixture.detectChanges();
+ let firstDayOfWeek = getElement('.caltable thead tr th:first-child');
+ expect(firstDayOfWeek).not.toBe(null);
+ expect(firstDayOfWeek.nativeElement.textContent).toBe('Min');
+
+ fixture.detectChanges();
+ let sunday = getElement('.sunday');
+ expect(sunday).not.toBe(null);
+
+ comp.userDateInput({target:{value:'10-10-2016'}});
+ expect(comp.invalidDate).toBe(false);
+
+ fixture.detectChanges();
+ let invaliddate = getElement('.invaliddate');
+ expect(invaliddate).toBe(null);
+ });
+
+});
+
+
+
+
+
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.ts b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.ts
new file mode 100644
index 00000000..389a5be3
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.component.ts
@@ -0,0 +1,677 @@
+import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges, ElementRef, ViewEncapsulation, ChangeDetectorRef, Renderer, forwardRef } from "@angular/core";
+import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
+import { IMyDate, IMyDateRange, IMyMonth, IMyCalendarDay, IMyWeek, IMyDayLabels, IMyMonthLabels, IMyOptions, IMyDateModel, IMyInputAutoFill, IMyInputFieldChanged, IMyCalendarViewChanged, IMyInputFocusBlur } from "./interfaces/index";
+import { LocaleService } from "./services/my-date-picker.locale.service";
+import { UtilService } from "./services/my-date-picker.util.service";
+
+// webpack1_
+declare var require: any;
+// declare var myDpStyles: string = require("./my-date-picker.component.css");
+// declare var myDpTpl: string = require("./my-date-picker.component.html");
+// webpack2_
+
+export const MYDP_VALUE_ACCESSOR: any = {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => MyDatePicker),
+ multi: true
+};
+
+@Component({
+ selector: "my-date-picker",
+ styleUrls: ['my-date-picker.component.css'],
+ templateUrl: 'my-date-picker.component.html',
+ providers: [LocaleService, UtilService, MYDP_VALUE_ACCESSOR],
+ encapsulation: ViewEncapsulation.None
+})
+
+export class MyDatePicker implements OnChanges, ControlValueAccessor {
+ @Input() options: any;
+ @Input() locale: string;
+ @Input() defaultMonth: string;
+ @Input() selDate: string;
+ @Input() placeholder: string;
+ @Input() selector: number;
+ @Output() dateChanged: EventEmitter = new EventEmitter();
+ @Output() inputFieldChanged: EventEmitter = new EventEmitter();
+ @Output() calendarViewChanged: EventEmitter = new EventEmitter();
+ @Output() calendarToggle: EventEmitter = new EventEmitter();
+ @Output() inputFocusBlur: EventEmitter = new EventEmitter();
+
+ onChangeCb: (_: any) => void = () => { };
+ onTouchedCb: () => void = () => { };
+
+ showSelector: boolean = false;
+ visibleMonth: IMyMonth = {monthTxt: "", monthNbr: 0, year: 0};
+ selectedMonth: IMyMonth = {monthTxt: "", monthNbr: 0, year: 0};
+ selectedDate: IMyDate = {year: 0, month: 0, day: 0};
+ weekDays: Array = [];
+ dates: Array = [];
+ selectionDayTxt: string = "";
+ invalidDate: boolean = false;
+ disableTodayBtn: boolean = false;
+ dayIdx: number = 0;
+ weekDayOpts: Array = ["su", "mo", "tu", "we", "th", "fr", "sa"];
+ autoFillOpts: IMyInputAutoFill = {separator: "", formatParts: [], enabled: true};
+
+ editMonth: boolean = false;
+ invalidMonth: boolean = false;
+ editYear: boolean = false;
+ invalidYear: boolean = false;
+
+ prevMonthDisabled: boolean = false;
+ nextMonthDisabled: boolean = false;
+ prevYearDisabled: boolean = false;
+ nextYearDisabled: boolean = false;
+
+ PREV_MONTH: number = 1;
+ CURR_MONTH: number = 2;
+ NEXT_MONTH: number = 3;
+
+ MIN_YEAR: number = 1000;
+ MAX_YEAR: number = 9999;
+
+ // Default options
+ opts: IMyOptions = {
+ dayLabels: {},
+ monthLabels: {},
+ dateFormat: "",
+ showTodayBtn: true,
+ todayBtnTxt: "",
+ firstDayOfWeek: "",
+ sunHighlight: true,
+ markCurrentDay: true,
+ disableUntil: {year: 0, month: 0, day: 0},
+ disableSince: {year: 0, month: 0, day: 0},
+ disableDays: > [],
+ enableDays: > [],
+ disableDateRange: {begin: {year: 0, month: 0, day: 0}, end: {year: 0, month: 0, day: 0}},
+ disableWeekends: false,
+ showWeekNumbers: false,
+ height: "34px",
+ width: "100%",
+ selectionTxtFontSize: "18px",
+ inline: false,
+ showClearDateBtn: true,
+ alignSelectorRight: false,
+ openSelectorTopOfInput: false,
+ indicateInvalidDate: true,
+ editableDateField: true,
+ editableMonthAndYear: true,
+ disableHeaderButtons: true,
+ minYear: this.MIN_YEAR,
+ maxYear: this.MAX_YEAR,
+ componentDisabled: false,
+ inputValueRequired: false,
+ showSelectorArrow: true,
+ showInputField: true,
+ openSelectorOnInputClick: false,
+ inputAutoFill: true,
+ ariaLabelInputField: "Date input field",
+ ariaLabelClearDate: "Clear Date",
+ ariaLabelOpenCalendar: "Open Calendar",
+ ariaLabelPrevMonth: "Previous Month",
+ ariaLabelNextMonth: "Next Month",
+ ariaLabelPrevYear: "Previous Year",
+ ariaLabelNextYear: "Next Year"
+ };
+
+ constructor(public elem: ElementRef, private renderer: Renderer, private cdr: ChangeDetectorRef, private localeService: LocaleService, private utilService: UtilService) {
+ this.setLocaleOptions();
+ renderer.listenGlobal("document", "click", (event: any) => {
+ if (this.showSelector && event.target && this.elem.nativeElement !== event.target && !this.elem.nativeElement.contains(event.target)) {
+ this.showSelector = false;
+ this.calendarToggle.emit(4);
+ }
+ if (this.opts.editableMonthAndYear && event.target && this.elem.nativeElement.contains(event.target)) {
+ this.resetMonthYearEdit();
+ }
+ });
+ }
+
+ setLocaleOptions(): void {
+ let opts: IMyOptions = this.localeService.getLocaleOptions(this.locale);
+ Object.keys(opts).forEach((k) => {
+ (this.opts)[k] = opts[k];
+ });
+ }
+
+ setOptions(): void {
+ if (this.options !== undefined) {
+ Object.keys(this.options).forEach((k) => {
+ (this.opts)[k] = this.options[k];
+ });
+ }
+ if (this.opts.minYear < this.MIN_YEAR) {
+ this.opts.minYear = this.MIN_YEAR;
+ }
+ if (this.opts.maxYear > this.MAX_YEAR) {
+ this.opts.maxYear = this.MAX_YEAR;
+ }
+
+ let separator: string = this.utilService.getDateFormatSeparator(this.opts.dateFormat);
+ this.autoFillOpts = {separator: separator, formatParts: this.opts.dateFormat.split(separator), enabled: this.opts.inputAutoFill};
+ }
+
+ getComponentWidth(): string {
+ if (this.opts.showInputField) {
+ return this.opts.width;
+ }
+ else if (this.selectionDayTxt.length > 0 && this.opts.showClearDateBtn) {
+ return "60px";
+ }
+ else {
+ return "30px";
+ }
+ }
+
+ getSelectorTopPosition(): string {
+ if (this.opts.openSelectorTopOfInput) {
+ return this.elem.nativeElement.children[0].offsetHeight + "px";
+ }
+ }
+
+ resetMonthYearEdit(): void {
+ this.editMonth = false;
+ this.editYear = false;
+ this.invalidMonth = false;
+ this.invalidYear = false;
+ }
+
+ editMonthClicked(event: any): void {
+ event.stopPropagation();
+ if (this.opts.editableMonthAndYear) {
+ this.editMonth = true;
+ }
+ }
+
+ editYearClicked(event: any): void {
+ event.stopPropagation();
+ if (this.opts.editableMonthAndYear) {
+ this.editYear = true;
+ }
+ }
+
+ userDateInput(event: any): void {
+ this.invalidDate = false;
+ if (event.target.value.length === 0) {
+ this.clearDate();
+ }
+ else {
+ let date: IMyDate = this.utilService.isDateValid(event.target.value, this.opts.dateFormat, this.opts.minYear, this.opts.maxYear, this.opts.disableUntil, this.opts.disableSince, this.opts.disableWeekends, this.opts.disableDays, this.opts.disableDateRange, this.opts.monthLabels, this.opts.enableDays);
+ if (date.day !== 0 && date.month !== 0 && date.year !== 0) {
+ this.selectDate(date);
+ }
+ else {
+ this.invalidDate = true;
+ }
+ }
+ if (this.invalidDate) {
+ this.inputFieldChanged.emit({value: event.target.value, dateFormat: this.opts.dateFormat, valid: !(event.target.value.length === 0 || this.invalidDate)});
+ this.onChangeCb("");
+ this.onTouchedCb();
+ }
+ }
+
+ onFocusInput(event: any): void {
+ this.inputFocusBlur.emit({reason: 1, value: event.target.value});
+ }
+
+ lostFocusInput(event: any): void {
+ this.selectionDayTxt = event.target.value;
+ this.onTouchedCb();
+ this.inputFocusBlur.emit({reason: 2, value: event.target.value});
+ }
+
+ userMonthInput(event: any): void {
+ if (event.keyCode === 13 || event.keyCode === 37 || event.keyCode === 39) {
+ return;
+ }
+
+ this.invalidMonth = false;
+
+ let m: number = this.utilService.isMonthLabelValid(event.target.value, this.opts.monthLabels);
+ if (m !== -1) {
+ this.editMonth = false;
+ if (m !== this.visibleMonth.monthNbr) {
+ this.visibleMonth = {monthTxt: this.monthText(m), monthNbr: m, year: this.visibleMonth.year};
+ this.generateCalendar(m, this.visibleMonth.year, true);
+ }
+ }
+ else {
+ this.invalidMonth = true;
+ }
+ }
+
+ userYearInput(event: any): void {
+ if (event.keyCode === 13 || event.keyCode === 37 || event.keyCode === 39) {
+ return;
+ }
+
+ this.invalidYear = false;
+
+ let y: number = this.utilService.isYearLabelValid(Number(event.target.value), this.opts.minYear, this.opts.maxYear);
+ if (y !== -1) {
+ this.editYear = false;
+ if (y !== this.visibleMonth.year) {
+ this.visibleMonth = {monthTxt: this.visibleMonth.monthTxt, monthNbr: this.visibleMonth.monthNbr, year: y};
+ this.generateCalendar(this.visibleMonth.monthNbr, y, true);
+ }
+ }
+ else {
+ this.invalidYear = true;
+ }
+ }
+
+ isTodayDisabled(): void {
+ this.disableTodayBtn = this.utilService.isDisabledDay(this.getToday(), this.opts.disableUntil, this.opts.disableSince, this.opts.disableWeekends, this.opts.disableDays, this.opts.disableDateRange, this.opts.enableDays);
+ }
+
+ parseOptions(): void {
+ if (this.locale) {
+ this.setLocaleOptions();
+ }
+ this.setOptions();
+ this.isTodayDisabled();
+ this.dayIdx = this.weekDayOpts.indexOf(this.opts.firstDayOfWeek);
+ if (this.dayIdx !== -1) {
+ let idx: number = this.dayIdx;
+ for (let i = 0; i < this.weekDayOpts.length; i++) {
+ this.weekDays.push(this.opts.dayLabels[this.weekDayOpts[idx]]);
+ idx = this.weekDayOpts[idx] === "sa" ? 0 : idx + 1;
+ }
+ }
+ }
+
+ writeValue(value: Object): void {
+ if (value && value["date"]) {
+ this.updateDateValue(this.parseSelectedDate(value["date"]), false);
+ }
+ else if (value === "") {
+ this.updateDateValue({year: 0, month: 0, day: 0}, true);
+ }
+ }
+
+ registerOnChange(fn: any): void {
+ this.onChangeCb = fn;
+ }
+
+ registerOnTouched(fn: any): void {
+ this.onTouchedCb = fn;
+ }
+
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes.hasOwnProperty("selector") && changes["selector"].currentValue > 0) {
+ this.openBtnClicked();
+ }
+
+ if (changes.hasOwnProperty("placeholder")) {
+ this.placeholder = changes["placeholder"].currentValue;
+ }
+
+ if (changes.hasOwnProperty("locale")) {
+ this.locale = changes["locale"].currentValue;
+ }
+
+ if (changes.hasOwnProperty("options")) {
+ this.options = changes["options"].currentValue;
+ }
+
+ this.weekDays.length = 0;
+ this.parseOptions();
+
+ if (changes.hasOwnProperty("defaultMonth")) {
+ let dm: string = changes["defaultMonth"].currentValue;
+ if (dm !== null && dm !== undefined && dm !== "") {
+ this.selectedMonth = this.parseSelectedMonth(dm);
+ }
+ else {
+ this.selectedMonth = {monthTxt: "", monthNbr: 0, year: 0};
+ }
+ }
+
+ if (changes.hasOwnProperty("selDate")) {
+ let sd: any = changes["selDate"];
+ if (sd.currentValue !== null && sd.currentValue !== undefined && sd.currentValue !== "" && Object.keys(sd.currentValue).length !== 0) {
+ this.selectedDate = this.parseSelectedDate(sd.currentValue);
+ setTimeout(() => {
+ this.onChangeCb(this.getDateModel(this.selectedDate));
+ });
+ }
+ else {
+ // Do not clear on init
+ if (!sd.isFirstChange()) {
+ this.clearDate();
+ }
+ }
+ }
+ if (this.opts.inline) {
+ this.setVisibleMonth();
+ }
+ else if (this.showSelector) {
+ this.generateCalendar(this.visibleMonth.monthNbr, this.visibleMonth.year, false);
+ }
+ }
+
+ removeBtnClicked(): void {
+ // Remove date button clicked
+ this.clearDate();
+ if (this.showSelector) {
+ this.calendarToggle.emit(3);
+ }
+ this.showSelector = false;
+ }
+
+ openBtnClicked(): void {
+ // Open selector button clicked
+ this.showSelector = !this.showSelector;
+ if (this.showSelector) {
+ this.setVisibleMonth();
+ this.calendarToggle.emit(1);
+ }
+ else {
+ this.calendarToggle.emit(3);
+ }
+ }
+
+ setVisibleMonth(): void {
+ // Sets visible month of calendar
+ let y: number = 0, m: number = 0;
+ if (!this.utilService.isInitializedDate(this.selectedDate)) {
+ if (this.selectedMonth.year === 0 && this.selectedMonth.monthNbr === 0) {
+ let today: IMyDate = this.getToday();
+ y = today.year;
+ m = today.month;
+ } else {
+ y = this.selectedMonth.year;
+ m = this.selectedMonth.monthNbr;
+ }
+ }
+ else {
+ y = this.selectedDate.year;
+ m = this.selectedDate.month;
+ }
+ this.visibleMonth = {monthTxt: this.opts.monthLabels[m], monthNbr: m, year: y};
+
+ // Create current month
+ this.generateCalendar(m, y, true);
+ }
+
+ prevMonth(): void {
+ // Previous month from calendar
+ let d: Date = this.getDate(this.visibleMonth.year, this.visibleMonth.monthNbr, 1);
+ d.setMonth(d.getMonth() - 1);
+
+ let y: number = d.getFullYear();
+ let m: number = d.getMonth() + 1;
+
+ this.visibleMonth = {monthTxt: this.monthText(m), monthNbr: m, year: y};
+ this.generateCalendar(m, y, true);
+ }
+
+ nextMonth(): void {
+ // Next month from calendar
+ let d: Date = this.getDate(this.visibleMonth.year, this.visibleMonth.monthNbr, 1);
+ d.setMonth(d.getMonth() + 1);
+
+ let y: number = d.getFullYear();
+ let m: number = d.getMonth() + 1;
+
+ this.visibleMonth = {monthTxt: this.monthText(m), monthNbr: m, year: y};
+ this.generateCalendar(m, y, true);
+ }
+
+ prevYear(): void {
+ // Previous year from calendar
+ this.visibleMonth.year--;
+ this.generateCalendar(this.visibleMonth.monthNbr, this.visibleMonth.year, true);
+ }
+
+ nextYear(): void {
+ // Next year from calendar
+ this.visibleMonth.year++;
+ this.generateCalendar(this.visibleMonth.monthNbr, this.visibleMonth.year, true);
+ }
+
+ todayClicked(): void {
+ // Today button clicked
+ let today: IMyDate = this.getToday();
+ this.selectDate(today);
+ if (this.opts.inline && today.year !== this.visibleMonth.year || today.month !== this.visibleMonth.monthNbr) {
+ this.visibleMonth = {monthTxt: this.opts.monthLabels[today.month], monthNbr: today.month, year: today.year};
+ this.generateCalendar(today.month, today.year, true);
+ }
+ }
+
+ cellClicked(cell: any): void {
+ // Cell clicked on the calendar
+ if (cell.cmo === this.PREV_MONTH) {
+ // Previous month day
+ this.prevMonth();
+ }
+ else if (cell.cmo === this.CURR_MONTH) {
+ // Current month day - if date is already selected clear it
+ if (cell.dateObj.year === this.selectedDate.year && cell.dateObj.month === this.selectedDate.month && cell.dateObj.day === this.selectedDate.day) {
+ this.clearDate();
+ }
+ else {
+ this.selectDate(cell.dateObj);
+ }
+ }
+ else if (cell.cmo === this.NEXT_MONTH) {
+ // Next month day
+ this.nextMonth();
+ }
+ this.resetMonthYearEdit();
+ }
+
+ cellKeyDown(event: any, cell: any) {
+ // Cell keyboard handling
+ if ((event.keyCode === 13 || event.keyCode === 32) && !cell.disabled) {
+ event.preventDefault();
+ this.cellClicked(cell);
+ }
+ }
+
+ clearDate(): void {
+ // Clears the date and notifies parent using callbacks and value accessor
+ let date: IMyDate = {year: 0, month: 0, day: 0};
+ this.dateChanged.emit({date: date, jsdate: null, formatted: "", epoc: 0});
+ this.onChangeCb("");
+ this.onTouchedCb();
+ this.updateDateValue(date, true);
+ }
+
+ selectDate(date: IMyDate): void {
+ // Date selected, notifies parent using callbacks and value accessor
+ let dateModel: IMyDateModel = this.getDateModel(date);
+ this.dateChanged.emit(dateModel);
+ this.onChangeCb(dateModel);
+ this.onTouchedCb();
+ this.updateDateValue(date, false);
+ if (this.showSelector) {
+ this.calendarToggle.emit(2);
+ }
+ this.showSelector = false;
+ }
+
+ updateDateValue(date: IMyDate, clear: boolean): void {
+ // Updates date values
+ this.selectedDate = date;
+ this.selectionDayTxt = clear ? "" : this.formatDate(date);
+ this.inputFieldChanged.emit({value: this.selectionDayTxt, dateFormat: this.opts.dateFormat, valid: !clear});
+ this.invalidDate = false;
+ }
+
+ getDateModel(date: IMyDate): IMyDateModel {
+ // Creates a date model object from the given parameter
+ return {date: date, jsdate: this.getDate(date.year, date.month, date.day), formatted: this.formatDate(date), epoc: Math.round(this.getTimeInMilliseconds(date) / 1000.0)};
+ }
+
+ preZero(val: string): string {
+ // Prepend zero if smaller than 10
+ return parseInt(val) < 10 ? "0" + val : val;
+ }
+
+ formatDate(val: any): string {
+ // Returns formatted date string, if mmm is part of dateFormat returns month as a string
+ let formatted: string = this.opts.dateFormat.replace("yyyy", val.year).replace("dd", this.preZero(val.day));
+ return this.opts.dateFormat.indexOf("mmm") !== -1 ? formatted.replace("mmm", this.monthText(val.month)) : formatted.replace("mm", this.preZero(val.month));
+ }
+
+ monthText(m: number): string {
+ // Returns month as a text
+ return this.opts.monthLabels[m];
+ }
+
+ monthStartIdx(y: number, m: number): number {
+ // Month start index
+ let d = new Date();
+ d.setDate(1);
+ d.setMonth(m - 1);
+ d.setFullYear(y);
+ let idx = d.getDay() + this.sundayIdx();
+ return idx >= 7 ? idx - 7 : idx;
+ }
+
+ daysInMonth(m: number, y: number): number {
+ // Return number of days of current month
+ return new Date(y, m, 0).getDate();
+ }
+
+ daysInPrevMonth(m: number, y: number): number {
+ // Return number of days of the previous month
+ let d: Date = this.getDate(y, m, 1);
+ d.setMonth(d.getMonth() - 1);
+ return this.daysInMonth(d.getMonth() + 1, d.getFullYear());
+ }
+
+ isCurrDay(d: number, m: number, y: number, cmo: number, today: IMyDate): boolean {
+ // Check is a given date the today
+ return d === today.day && m === today.month && y === today.year && cmo === this.CURR_MONTH;
+ }
+
+ getToday(): IMyDate {
+ let date: Date = new Date();
+ return {year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate()};
+ }
+
+ getTimeInMilliseconds(date: IMyDate): number {
+ return this.getDate(date.year, date.month, date.day).getTime();
+ }
+
+ getDayNumber(date: IMyDate): number {
+ // Get day number: su=0, mo=1, tu=2, we=3 ...
+ let d: Date = this.getDate(date.year, date.month, date.day);
+ return d.getDay();
+ }
+
+ getWeekday(date: IMyDate): string {
+ // Get weekday: su, mo, tu, we ...
+ return this.weekDayOpts[this.getDayNumber(date)];
+ }
+
+ getDate(year: number, month: number, day: number): Date {
+ // Creates a date object from given year, month and day
+ return new Date(year, month - 1, day, 0, 0, 0, 0);
+ }
+
+ sundayIdx(): number {
+ // Index of Sunday day
+ return this.dayIdx > 0 ? 7 - this.dayIdx : 0;
+ }
+
+ generateCalendar(m: number, y: number, notifyChange: boolean): void {
+ this.dates.length = 0;
+ let today: IMyDate = this.getToday();
+ let monthStart: number = this.monthStartIdx(y, m);
+ let dInThisM: number = this.daysInMonth(m, y);
+ let dInPrevM: number = this.daysInPrevMonth(m, y);
+
+ let dayNbr: number = 1;
+ let cmo: number = this.PREV_MONTH;
+ for (let i = 1; i < 7; i++) {
+ let week: Array = [];
+ if (i === 1) {
+ // First week
+ let pm = dInPrevM - monthStart + 1;
+ // Previous month
+ for (let j = pm; j <= dInPrevM; j++) {
+ let date: IMyDate = {year: y, month: m - 1, day: j};
+ week.push({dateObj: date, cmo: cmo, currDay: this.isCurrDay(j, m, y, cmo, today), dayNbr: this.getDayNumber(date), disabled: this.utilService.isDisabledDay(date, this.opts.disableUntil, this.opts.disableSince, this.opts.disableWeekends, this.opts.disableDays, this.opts.disableDateRange, this.opts.enableDays)});
+ }
+
+ cmo = this.CURR_MONTH;
+ // Current month
+ let daysLeft: number = 7 - week.length;
+ for (let j = 0; j < daysLeft; j++) {
+ let date: IMyDate = {year: y, month: m, day: dayNbr};
+ week.push({dateObj: date, cmo: cmo, currDay: this.isCurrDay(dayNbr, m, y, cmo, today), dayNbr: this.getDayNumber(date), disabled: this.utilService.isDisabledDay(date, this.opts.disableUntil, this.opts.disableSince, this.opts.disableWeekends, this.opts.disableDays, this.opts.disableDateRange, this.opts.enableDays)});
+ dayNbr++;
+ }
+ }
+ else {
+ // Rest of the weeks
+ for (let j = 1; j < 8; j++) {
+ if (dayNbr > dInThisM) {
+ // Next month
+ dayNbr = 1;
+ cmo = this.NEXT_MONTH;
+ }
+ let date: IMyDate = {year: y, month: cmo === this.CURR_MONTH ? m : m + 1, day: dayNbr};
+ week.push({dateObj: date, cmo: cmo, currDay: this.isCurrDay(dayNbr, m, y, cmo, today), dayNbr: this.getDayNumber(date), disabled: this.utilService.isDisabledDay(date, this.opts.disableUntil, this.opts.disableSince, this.opts.disableWeekends, this.opts.disableDays, this.opts.disableDateRange, this.opts.enableDays)});
+ dayNbr++;
+ }
+ }
+ let weekNbr: number = this.opts.showWeekNumbers && this.opts.firstDayOfWeek === "mo" ? this.utilService.getWeekNumber(week[0].dateObj) : 0;
+ this.dates.push({week: week, weekNbr: weekNbr});
+ }
+
+ this.setHeaderBtnDisabledState(m, y);
+
+ if (notifyChange) {
+ // Notify parent
+ this.calendarViewChanged.emit({year: y, month: m, first: {number: 1, weekday: this.getWeekday({year: y, month: m, day: 1})}, last: {number: dInThisM, weekday: this.getWeekday({year: y, month: m, day: dInThisM})}});
+ }
+ }
+
+ parseSelectedDate(selDate: any): IMyDate {
+ // Parse selDate value - it can be string or IMyDate object
+ let date: IMyDate = {day: 0, month: 0, year: 0};
+ if (typeof selDate === "string") {
+ let sd: string = selDate;
+ date.day = this.utilService.parseDatePartNumber(this.opts.dateFormat, sd, "dd");
+
+ date.month = this.opts.dateFormat.indexOf("mmm") !== -1
+ ? this.utilService.parseDatePartMonthName(this.opts.dateFormat, sd, "mmm", this.opts.monthLabels)
+ : this.utilService.parseDatePartNumber(this.opts.dateFormat, sd, "mm");
+
+ date.year = this.utilService.parseDatePartNumber(this.opts.dateFormat, sd, "yyyy");
+ }
+ else if (typeof selDate === "object") {
+ date = selDate;
+ }
+ this.selectionDayTxt = this.formatDate(date);
+ return date;
+ }
+
+ parseSelectedMonth(ms: string): IMyMonth {
+ return this.utilService.parseDefaultMonth(ms);
+ }
+
+ setHeaderBtnDisabledState(m: number, y: number): void {
+ let dpm: boolean = false;
+ let dpy: boolean = false;
+ let dnm: boolean = false;
+ let dny: boolean = false;
+ if (this.opts.disableHeaderButtons) {
+ dpm = this.utilService.isMonthDisabledByDisableUntil({year: m === 1 ? y - 1 : y, month: m === 1 ? 12 : m - 1, day: this.daysInMonth(m === 1 ? 12 : m - 1, m === 1 ? y - 1 : y)}, this.opts.disableUntil);
+ dpy = this.utilService.isMonthDisabledByDisableUntil({year: y - 1, month: m, day: this.daysInMonth(m, y - 1)}, this.opts.disableUntil);
+ dnm = this.utilService.isMonthDisabledByDisableSince({year: m === 12 ? y + 1 : y, month: m === 12 ? 1 : m + 1, day: 1}, this.opts.disableSince);
+ dny = this.utilService.isMonthDisabledByDisableSince({year: y + 1, month: m, day: 1}, this.opts.disableSince);
+ }
+ this.prevMonthDisabled = m === 1 && y === this.opts.minYear || dpm;
+ this.prevYearDisabled = y - 1 < this.opts.minYear || dpy;
+ this.nextMonthDisabled = m === 12 && y === this.opts.maxYear || dnm;
+ this.nextYearDisabled = y + 1 > this.opts.maxYear || dny;
+ }
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.module.ts b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.module.ts
new file mode 100644
index 00000000..a638a905
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/my-date-picker.module.ts
@@ -0,0 +1,14 @@
+import { CommonModule } from "@angular/common";
+import { FormsModule } from "@angular/forms";
+import { NgModule } from "@angular/core";
+import { MyDatePicker } from "./my-date-picker.component";
+import { FocusDirective } from "./directives/my-date-picker.focus.directive";
+import { InputAutoFillDirective } from "./directives/my-date-picker.input.auto.fill.directive";
+
+@NgModule({
+ imports: [CommonModule, FormsModule],
+ declarations: [MyDatePicker, FocusDirective, InputAutoFillDirective],
+ exports: [MyDatePicker, FocusDirective, InputAutoFillDirective]
+})
+export class MyDatePickerModule {
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.locale.service.ts b/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.locale.service.ts
new file mode 100644
index 00000000..44c209e9
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.locale.service.ts
@@ -0,0 +1,232 @@
+import { Injectable } from "@angular/core";
+import { IMyLocales, IMyOptions } from "../interfaces/index";
+
+@Injectable()
+export class LocaleService {
+ private locales: IMyLocales = {
+ "en": {
+ dayLabels: {su: "Sun", mo: "Mon", tu: "Tue", we: "Wed", th: "Thu", fr: "Fri", sa: "Sat"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "Today",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "he": {
+ dayLabels: {su: "רא", mo: "שנ", tu: "של", we: "רב", th: "חמ", fr: "שי", sa: "שב"},
+ monthLabels: { 1: "ינו", 2: "פבר", 3: "מרץ", 4: "אפר", 5: "מאי", 6: "יונ", 7: "יול", 8: "אוג", 9: "ספט", 10: "אוק", 11: "נוב", 12: "דצמ" },
+ dateFormat: "dd/mm/yyyy",
+ todayBtnTxt: "היום",
+ firstDayOfWeek: "su",
+ sunHighlight: false
+ },
+ "ja": {
+ dayLabels: {su: "日", mo: "月", tu: "火", we: "水", th: "木", fr: "金", sa: "土"},
+ monthLabels: {1: "1月", 2: "2月", 3: "3月", 4: "4月", 5: "5月", 6: "6月", 7: "7月", 8: "8月", 9: "9月", 10: "10月", 11: "11月", 12: "12月"},
+ dateFormat: "yyyy.mm.dd",
+ todayBtnTxt: "今日",
+ sunHighlight: false
+ },
+ "fr": {
+ dayLabels: {su: "Dim", mo: "Lun", tu: "Mar", we: "Mer", th: "Jeu", fr: "Ven", sa: "Sam"},
+ monthLabels: {1: "Jan", 2: "Fév", 3: "Mar", 4: "Avr", 5: "Mai", 6: "Juin", 7: "Juil", 8: "Aoû", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Déc"},
+ dateFormat: "dd/mm/yyyy",
+ todayBtnTxt: "Aujourd'hui",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "fi": {
+ dayLabels: {su: "Su", mo: "Ma", tu: "Ti", we: "Ke", th: "To", fr: "Pe", sa: "La"},
+ monthLabels: {1: "Tam", 2: "Hel", 3: "Maa", 4: "Huh", 5: "Tou", 6: "Kes", 7: "Hei", 8: "Elo", 9: "Syy", 10: "Lok", 11: "Mar", 12: "Jou"},
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Tänään",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "es": {
+ dayLabels: {su: "Do", mo: "Lu", tu: "Ma", we: "Mi", th: "Ju", fr: "Vi", sa: "Sa"},
+ monthLabels: {1: "Ene", 2: "Feb", 3: "Mar", 4: "Abr", 5: "May", 6: "Jun", 7: "Jul", 8: "Ago", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dic"},
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Hoy",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "hu": {
+ dayLabels: {su: "Vas", mo: "Hét", tu: "Kedd", we: "Sze", th: "Csü", fr: "Pén", sa: "Szo"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Már", 4: "Ápr", 5: "Máj", 6: "Jún", 7: "Júl", 8: "Aug", 9: "Szep", 10: "Okt", 11: "Nov", 12: "Dec" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "Ma",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "sv": {
+ dayLabels: {su: "Sön", mo: "Mån", tu: "Tis", we: "Ons", th: "Tor", fr: "Fre", sa: "Lör"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Maj", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Dec" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "Idag",
+ firstDayOfWeek: "mo",
+ sunHighlight: false
+ },
+ "nl": {
+ dayLabels: {su: "Zon", mo: "Maa", tu: "Din", we: "Woe", th: "Don", fr: "Vri", sa: "Zat"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Mei", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Dec" },
+ dateFormat: "dd-mm-yyyy",
+ todayBtnTxt: "Vandaag",
+ firstDayOfWeek: "mo",
+ sunHighlight: false
+ },
+ "ru": {
+ dayLabels: {su: "Вс", mo: "Пн", tu: "Вт", we: "Ср", th: "Чт", fr: "Пт", sa: "Сб"},
+ monthLabels: { 1: "Янв", 2: "Фев", 3: "Март", 4: "Апр", 5: "Май", 6: "Июнь", 7: "Июль", 8: "Авг", 9: "Сент", 10: "Окт", 11: "Ноя", 12: "Дек" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Сегодня",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "uk": {
+ dayLabels: {su: "Нд", mo: "Пн", tu: "Вт", we: "Ср", th: "Чт", fr: "Пт", sa: "Сб"},
+ monthLabels: { 1: "Січ", 2: "Лют", 3: "Бер", 4: "Кві", 5: "Тра", 6: "Чер", 7: "Лип", 8: "Сер", 9: "Вер", 10: "Жов", 11: "Лис", 12: "Гру" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Сьогодні",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "no": {
+ dayLabels: {su: "Søn", mo: "Man", tu: "Tir", we: "Ons", th: "Tor", fr: "Fre", sa: "Lør"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Mai", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Des" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "I dag",
+ firstDayOfWeek: "mo",
+ sunHighlight: false
+ },
+ "tr": {
+ dayLabels: {su: "Paz", mo: "Pzt", tu: "Sal", we: "Çar", th: "Per", fr: "Cum", sa: "Cmt"},
+ monthLabels: { 1: "Oca", 2: "Şub", 3: "Mar", 4: "Nis", 5: "May", 6: "Haz", 7: "Tem", 8: "Ağu", 9: "Eyl", 10: "Eki", 11: "Kas", 12: "Ara" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Bugün",
+ firstDayOfWeek: "mo",
+ sunHighlight: false
+ },
+ "pt-br": {
+ dayLabels: {su: "Dom", mo: "Seg", tu: "Ter", we: "Qua", th: "Qui", fr: "Sex", sa: "Sab"},
+ monthLabels: { 1: "Jan", 2: "Fev", 3: "Mar", 4: "Abr", 5: "Mai", 6: "Jun", 7: "Jul", 8: "Ago", 9: "Set", 10: "Out", 11: "Nov", 12: "Dez" },
+ dateFormat: "dd/mm/yyyy",
+ todayBtnTxt: "Hoje",
+ firstDayOfWeek: "su",
+ sunHighlight: true
+ },
+ "de": {
+ dayLabels: {su: "So", mo: "Mo", tu: "Di", we: "Mi", th: "Do", fr: "Fr", sa: "Sa"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mär", 4: "Apr", 5: "Mai", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Dez" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Heute",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "it": {
+ dayLabels: { su: "Dom", mo: "Lun", tu: "Mar", we: "Mer", th: "Gio", fr: "Ven", sa: "Sab" },
+ monthLabels: { 1: "Gen", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Mag", 6: "Giu", 7: "Lug", 8: "Ago", 9: "Set", 10: "Ott", 11: "Nov", 12: "Dic" },
+ dateFormat: "dd/mm/yyyy",
+ todayBtnTxt: "Oggi",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "it-ch": {
+ dayLabels: { su: "Dom", mo: "Lun", tu: "Mar", we: "Mer", th: "Gio", fr: "Ven", sa: "Sab" },
+ monthLabels: { 1: "Gen", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Mag", 6: "Giu", 7: "Lug", 8: "Ago", 9: "Set", 10: "Ott", 11: "Nov", 12: "Dic" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Oggi",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "pl": {
+ dayLabels: { su: "Nie", mo: "Pon", tu: "Wto", we: "Śro", th: "Czw", fr: "Pią", sa: "Sob" },
+ monthLabels: { 1: "Sty", 2: "Lut", 3: "Mar", 4: "Kwi", 5: "Maj", 6: "Cze", 7: "Lip", 8: "Sie", 9: "Wrz", 10: "Paź", 11: "Lis", 12: "Gru" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "Dzisiaj",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "my": {
+ dayLabels: {su: "တနင်္ဂနွေ", mo: "တနင်္လာ", tu: "အင်္ဂါ", we: "ဗုဒ္ဓဟူး", th: "ကြသပတေး", fr: "သောကြာ", sa: "စနေ"},
+ monthLabels: { 1: "ဇန်နဝါရီ", 2: "ဖေဖော်ဝါရီ", 3: "မတ်", 4: "ဧပြီ", 5: "မေ", 6: "ဇွန်", 7: "ဇူလိုင်", 8: "ဩဂုတ်", 9: "စက်တင်ဘာ", 10: "အောက်တိုဘာ", 11: "နိုဝင်ဘာ", 12: "ဒီဇင်ဘာ" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "ယနေ့",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "sk": {
+ dayLabels: { su: "Ne", mo: "Po", tu: "Ut", we: "St", th: "Št", fr: "Pi", sa: "So" },
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Máj", 6: "Jún", 7: "Júl", 8: "Aug", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Dec" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Dnes",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "sl": {
+ dayLabels: { su: "Ned", mo: "Pon", tu: "Tor", we: "Sre", th: "Čet", fr: "Pet", sa: "Sob" },
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Maj", 6: "Jun", 7: "Jul", 8: "Avg", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Dec" },
+ dateFormat: "dd. mm. yyyy",
+ todayBtnTxt: "Danes",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "zh-cn": {
+ dayLabels: {su: "日", mo: "一", tu: "二", we: "三", th: "四", fr: "五", sa: "六"},
+ monthLabels: { 1: "1月", 2: "2月", 3: "3月", 4: "4月", 5: "5月", 6: "6月", 7: "7月", 8: "8月", 9: "9月", 10: "10月", 11: "11月", 12: "12月" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "今天",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "ro": {
+ dayLabels: {su: "du", mo: "lu", tu: "ma", we: "mi", th: "jo", fr: "vi", sa: "sa"},
+ monthLabels: { 1: "ian", 2: "feb", 3: "mart", 4: "apr", 5: "mai", 6: "iun", 7: "iul", 8: "aug", 9: "sept", 10: "oct", 11: "nov", 12: "dec" },
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Astăzi",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "ca": {
+ dayLabels: {su: "dg", mo: "dl", tu: "dt", we: "dc", th: "dj", fr: "dv", sa: "ds"},
+ monthLabels: {1: "Gen", 2: "Febr", 3: "Març", 4: "Abr", 5: "Maig", 6: "Juny", 7: "Jul", 8: "Ag", 9: "Set", 10: "Oct", 11: "Nov", 12: "Des"},
+ dateFormat: "dd.mm.yyyy",
+ todayBtnTxt: "Avui",
+ firstDayOfWeek: "mo",
+ sunHighlight: true,
+ },
+ "id": {
+ dayLabels: {su: "Min", mo: "Sen", tu: "Sel", we: "Rab", th: "Kam", fr: "Jum", sa: "Sab"},
+ monthLabels: {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "Mei", 6: "Jun", 7: "Jul", 8: "Ags", 9: "Sep", 10: "Okt", 11: "Nov", 12: "Des"},
+ dateFormat: "dd-mm-yyyy",
+ todayBtnTxt: "Hari ini",
+ firstDayOfWeek: "su",
+ sunHighlight: true
+ },
+ "en-au": {
+ dayLabels: {su: "Sun", mo: "Mon", tu: "Tue", we: "Wed", th: "Thu", fr: "Fri", sa: "Sat"},
+ monthLabels: { 1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec" },
+ dateFormat: "dd/mm/yyyy",
+ todayBtnTxt: "Today",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ },
+ "am-et": {
+ dayLabels: {su: "እሑድ", mo: "ሰኞ", tu: "ማክሰኞ", we: "ረቡዕ", th: "ሐሙስ", fr: "ዓርብ", sa: "ቅዳሜ"},
+ monthLabels: { 1: "ጃንዩ", 2: "ፌብሩ", 3: "ማርች", 4: "ኤፕረ", 5: "ሜይ", 6: "ጁን", 7: "ጁላይ", 8: "ኦገስ", 9: "ሴፕቴ", 10: "ኦክተ", 11: "ኖቬም", 12: "ዲሴም" },
+ dateFormat: "yyyy-mm-dd",
+ todayBtnTxt: "ዛሬ",
+ firstDayOfWeek: "mo",
+ sunHighlight: true
+ }
+ };
+
+ getLocaleOptions(locale: string): IMyOptions {
+ if (locale && this.locales.hasOwnProperty(locale)) {
+ // User given locale
+ return this.locales[locale];
+ }
+ // Default: en
+ return this.locales["en"];
+ }
+}
diff --git a/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.util.service.ts b/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.util.service.ts
new file mode 100644
index 00000000..98b51bca
--- /dev/null
+++ b/workingUIKIT/src/app/utils/my-date-picker/services/my-date-picker.util.service.ts
@@ -0,0 +1,169 @@
+import { Injectable } from "@angular/core";
+import { IMyDate } from "../interfaces/my-date.interface";
+import { IMyDateRange } from "../interfaces/my-date-range.interface";
+import { IMyMonth } from "../interfaces/my-month.interface";
+import { IMyMonthLabels } from "../interfaces/my-month-labels.interface";
+
+@Injectable()
+export class UtilService {
+ isDateValid(dateStr: string, dateFormat: string, minYear: number, maxYear: number, disableUntil: IMyDate, disableSince: IMyDate, disableWeekends: boolean, disableDays: Array, disableDateRange: IMyDateRange, monthLabels: IMyMonthLabels, enableDays: Array): IMyDate {
+ let returnDate: IMyDate = {day: 0, month: 0, year: 0};
+ let daysInMonth: Array = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ let isMonthStr: boolean = this.getDatePartIndex(dateFormat, "mmm") !== -1;
+
+ if (dateStr.length !== dateFormat.length) {
+ return returnDate;
+ }
+
+ let separator: string = this.getDateFormatSeparator(dateFormat);
+
+ let parts: Array = dateStr.split(separator);
+ if (parts.length !== 3) {
+ return returnDate;
+ }
+
+ let day: number = this.parseDatePartNumber(dateFormat, dateStr, "dd");
+ let month: number = isMonthStr ? this.parseDatePartMonthName(dateFormat, dateStr, "mmm", monthLabels) : this.parseDatePartNumber(dateFormat, dateStr, "mm");
+ let year: number = this.parseDatePartNumber(dateFormat, dateStr, "yyyy");
+
+ if (day !== -1 && month !== -1 && year !== -1) {
+ if (year < minYear || year > maxYear || month < 1 || month > 12) {
+ return returnDate;
+ }
+
+ let date: IMyDate = {year: year, month: month, day: day};
+
+ if (this.isDisabledDay(date, disableUntil, disableSince, disableWeekends, disableDays, disableDateRange, enableDays)) {
+ return returnDate;
+ }
+
+ if (year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0)) {
+ daysInMonth[1] = 29;
+ }
+
+ if (day < 1 || day > daysInMonth[month - 1]) {
+ return returnDate;
+ }
+
+ // Valid date
+ return date;
+ }
+ return returnDate;
+ }
+
+ getDateFormatSeparator(dateFormat: string): string {
+ return dateFormat.replace(/[dmy]/g, "")[0];
+ }
+
+ isMonthLabelValid(monthLabel: string, monthLabels: IMyMonthLabels): number {
+ for (let key = 1; key <= 12; key++) {
+ if (monthLabel.toLowerCase() === monthLabels[key].toLowerCase()) {
+ return key;
+ }
+ }
+ return -1;
+ }
+
+ isYearLabelValid(yearLabel: number, minYear: number, maxYear: number): number {
+ if (yearLabel >= minYear && yearLabel <= maxYear) {
+ return yearLabel;
+ }
+ return -1;
+ }
+
+ parseDatePartNumber(dateFormat: string, dateString: string, datePart: string): number {
+ let pos: number = this.getDatePartIndex(dateFormat, datePart);
+ if (pos !== -1) {
+ let value: string = dateString.substring(pos, pos + datePart.length);
+ if (!/^\d+$/.test(value)) {
+ return -1;
+ }
+ return parseInt(value);
+ }
+ return -1;
+ }
+
+ parseDatePartMonthName(dateFormat: string, dateString: string, datePart: string, monthLabels: IMyMonthLabels): number {
+ let pos: number = this.getDatePartIndex(dateFormat, datePart);
+ if (pos !== -1) {
+ return this.isMonthLabelValid(dateString.substring(pos, pos + datePart.length), monthLabels);
+ }
+ return -1;
+ }
+
+ getDatePartIndex(dateFormat: string, datePart: string): number {
+ return dateFormat.indexOf(datePart);
+ }
+
+ parseDefaultMonth(monthString: string): IMyMonth {
+ let month: IMyMonth = {monthTxt: "", monthNbr: 0, year: 0};
+ if (monthString !== "") {
+ let split = monthString.split(monthString.match(/[^0-9]/)[0]);
+ month.monthNbr = split[0].length === 2 ? parseInt(split[0]) : parseInt(split[1]);
+ month.year = split[0].length === 2 ? parseInt(split[1]) : parseInt(split[0]);
+ }
+ return month;
+ }
+
+ isDisabledDay(date: IMyDate, disableUntil: IMyDate, disableSince: IMyDate, disableWeekends: boolean, disableDays: Array, disableDateRange: IMyDateRange, enableDays: Array): boolean {
+ for (let obj of enableDays) {
+ if (obj.year === date.year && obj.month === date.month && obj.day === date.day) {
+ return false;
+ }
+ }
+
+ let dateMs: number = this.getTimeInMilliseconds(date);
+ if (this.isInitializedDate(disableUntil) && dateMs <= this.getTimeInMilliseconds(disableUntil)) {
+ return true;
+ }
+
+ if (this.isInitializedDate(disableSince) && dateMs >= this.getTimeInMilliseconds(disableSince)) {
+ return true;
+ }
+
+ if (disableWeekends) {
+ let dayNbr = this.getDayNumber(date);
+ if (dayNbr === 0 || dayNbr === 6) {
+ return true;
+ }
+ }
+
+ for (let obj of disableDays) {
+ if (obj.year === date.year && obj.month === date.month && obj.day === date.day) {
+ return true;
+ }
+ }
+
+ if (this.isInitializedDate(disableDateRange.begin) && this.isInitializedDate(disableDateRange.end) && dateMs >= this.getTimeInMilliseconds(disableDateRange.begin) && dateMs <= this.getTimeInMilliseconds(disableDateRange.end)) {
+ return true;
+ }
+ return false;
+ }
+
+ getWeekNumber(date: IMyDate): number {
+ let d: Date = new Date(date.year, date.month - 1, date.day, 0, 0, 0, 0);
+ d.setDate(d.getDate() + (d.getDay() === 0 ? -3 : 4 - d.getDay()));
+ return Math.round(((d.getTime() - new Date(d.getFullYear(), 0, 4).getTime()) / 86400000) / 7) + 1;
+ }
+
+ isMonthDisabledByDisableUntil(date: IMyDate, disableUntil: IMyDate): boolean {
+ return this.isInitializedDate(disableUntil) && this.getTimeInMilliseconds(date) <= this.getTimeInMilliseconds(disableUntil);
+ }
+
+ isMonthDisabledByDisableSince(date: IMyDate, disableSince: IMyDate): boolean {
+ return this.isInitializedDate(disableSince) && this.getTimeInMilliseconds(date) >= this.getTimeInMilliseconds(disableSince);
+ }
+
+ isInitializedDate(date: IMyDate): boolean {
+ return date.year !== 0 && date.month !== 0 && date.day !== 0;
+ }
+
+ getTimeInMilliseconds(date: IMyDate): number {
+ return new Date(date.year, date.month - 1, date.day, 0, 0, 0, 0).getTime();
+ }
+
+ getDayNumber(date: IMyDate): number {
+ let d: Date = new Date(date.year, date.month - 1, date.day, 0, 0, 0, 0);
+ return d.getDay();
+ }
+}
\ No newline at end of file
diff --git a/workingUIKIT/src/app/utils/paging.module.ts b/workingUIKIT/src/app/utils/paging.module.ts
new file mode 100644
index 00000000..dbf53c87
--- /dev/null
+++ b/workingUIKIT/src/app/utils/paging.module.ts
@@ -0,0 +1,28 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { RouterModule } from '@angular/router';
+
+import {pagingFormatterNoLoad} from './pagingFormatterNoLoad.component';
+
+import {PagingFormatter} from './pagingFormatter.component';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule, RouterModule
+ ],
+ declarations: [
+ pagingFormatterNoLoad,
+ PagingFormatter,
+
+
+ ],
+ exports: [
+ pagingFormatterNoLoad,
+ PagingFormatter,
+
+
+ ]
+})
+export class PagingModule { }
diff --git a/workingUIKIT/src/app/utils/pagingFormatter.component.ts b/workingUIKIT/src/app/utils/pagingFormatter.component.ts
new file mode 100644
index 00000000..b7594c47
--- /dev/null
+++ b/workingUIKIT/src/app/utils/pagingFormatter.component.ts
@@ -0,0 +1,62 @@
+import {Component, Input} from '@angular/core';
+import {Router} from '@angular/router';
+import {DomSanitizer} from '@angular/platform-browser';
+//Usage Example
+import {RouterHelper} from './routerHelper.class';
+
+@Component({
+ selector: 'paging',
+ template: `
+
+
+
+ `
+})
+
+export class PagingFormatter {
+ @Input() currentPage: number = 1;
+ @Input() size: number=10;
+ @Input() totalResults: number = 10;
+ @Input() baseUrl:string="";
+ @Input() parameterNames:string[];
+ @Input() parameterValues:string[];
+
+ public routerHelper:RouterHelper = new RouterHelper();
+
+ constructor ( private _router: Router, private sanitizer:DomSanitizer) {
+ }
+
+ ngOnInit() {
+
+ }
+ getTotalPages(){
+ var i:number =parseInt(''+(this.totalResults/this.size));
+ return (((this.totalResults/this.size) == i )? i :(i+1)) ;
+ }
+
+ // onPage(pageNum: number){
+ // return this.sanitizer.bypassSecurityTrustUrl( this.baseUrl+((this.baseUrl.indexOf("?") > -1 )?'&':'?')+ "page=" + (pageNum));
+ //
+ // }
+}
diff --git a/workingUIKIT/src/app/utils/pagingFormatterNoLoad.component.ts b/workingUIKIT/src/app/utils/pagingFormatterNoLoad.component.ts
new file mode 100644
index 00000000..1aba4dce
--- /dev/null
+++ b/workingUIKIT/src/app/utils/pagingFormatterNoLoad.component.ts
@@ -0,0 +1,74 @@
+import {Component, Input, Output, EventEmitter} from '@angular/core';
+
+
+//Usage Example
+
+@Component({
+ selector: 'paging-no-load',
+ template: `
+
+
+ `
+})
+
+export class pagingFormatterNoLoad {
+ @Input() public currentPage: number = 1;
+ @Input() public navigateTo: string;
+ @Input() public term: string='';
+ @Input() public size: number=10;
+ @Input() public totalResults: number = 10;
+ @Input() public params;
+
+ @Output() pageChange = new EventEmitter();
+
+ constructor () {
+ }
+
+ ngOnInit() {
+ console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
+ }
+ getTotalPages(){
+ var i= this.totalResults/this.size;
+ var integerI=parseInt(''+i);
+ return parseInt(''+((i==integerI)?i:i+1));
+ }
+ onPrev(){
+ this.currentPage=this.currentPage-1;
+ this.pageChange.emit({
+ value: this.currentPage
+ });
+
+ }
+
+ onNext(){
+
+ this.currentPage=this.currentPage+1;
+ this.pageChange.emit({
+ value: this.currentPage
+ });
+ }
+ onPage(pageNum: number){
+
+ this.currentPage=pageNum;
+ this.pageChange.emit({
+ value: this.currentPage
+ });
+ }
+}
diff --git a/workingUIKIT/src/app/utils/pipes/safeHTML.pipe.ts b/workingUIKIT/src/app/utils/pipes/safeHTML.pipe.ts
new file mode 100644
index 00000000..5912a07c
--- /dev/null
+++ b/workingUIKIT/src/app/utils/pipes/safeHTML.pipe.ts
@@ -0,0 +1,13 @@
+//our root app component
+import { Pipe, PipeTransform} from '@angular/core'
+
+import { DomSanitizer } from '@angular/platform-browser'
+
+
+@Pipe({ name: 'safeHtml'})
+export class SafeHtmlPipe implements PipeTransform {
+ constructor(private sanitized: DomSanitizer) {}
+ transform(value) {
+ return this.sanitized.bypassSecurityTrustHtml(value);
+ }
+}
diff --git a/workingUIKIT/src/app/utils/properties/openaireProperties.ts b/workingUIKIT/src/app/utils/properties/openaireProperties.ts
new file mode 100644
index 00000000..416219eb
--- /dev/null
+++ b/workingUIKIT/src/app/utils/properties/openaireProperties.ts
@@ -0,0 +1,261 @@
+export class OpenaireProperties {
+ //landing Pages
+ private static baseSearchLink="/";
+ private static searchLinkToPublication = "search/publication?articleId=";
+ private static searchLinkToProject = "search/project?projectId=";
+ private static searchLinkToPerson = "search/person?personId=";
+ private static searchLinkToDataProvider = "search/dataprovider?datasourceId=";
+ private static searchLinkToDataset = "search/dataset?datasetId=";
+ private static searchLinkToOrganization = "search/organization?organizationId=";
+ //Search pages
+ private static searchLinkToPublications = "search/find/publications";
+ private static searchLinkToDataProviders = "search/find/dataproviders";
+ private static searchLinkToProjects = "search/find/projects";
+ private static searchLinkToDatasets = "search/find/datasets";
+ private static searchLinkToOrganizations = "search/find/organizations";
+ private static searchLinkToPeople = "search/find/people";
+ public static searchLinkToCompatibleDataProviders = "search/data-providers";
+ public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries";
+ //Advanced Search pages
+ public static searchLinkToAdvancedPublications = "search/advanced/publications";
+ public static searchLinkToAdvancedProjects = "search/advanced/projects";
+ public static searchLinkToAdvancedDatasets = "search/advanced/datasets";
+ public static searchLinkToAdvancedDataProviders = "search/advanced/dataproviders";
+ public static searchLinkToAdvancedOrganizations = "search/advanced/organizations";
+ public static searchLinkToAdvancedPeople = "search/advanced/people";
+
+//http://beta.services.openaire.eu:8480/search/
+//http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT
+ // Services - APIs
+
+ private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/usagestats/";
+ private static framesAPIURL = "http://vatopedi.di.uoa.gr/stats2/";
+
+ private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
+
+ // public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"
+ private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
+
+ // private static searchAPIURL = " https://beta.services.openaire.eu/search/v2/api/";
+ // private searchAPIURL = "http://beta.services.openaire.eu/search/v2.0/api/";
+ private static searchAPIURL = "https://beta.services.openaire.eu/search/v2/api/";
+ //"http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
+
+ // private static searchAPIURLLAst = " https://beta.services.openaire.eu/search/v2/api/";
+ private static searchAPIURLLAst = "https://beta.services.openaire.eu/search/v2/api/";
+ //private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
+ //private static searchAPIURLLAst = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
+
+ // private static searchResourcesAPIURL = " https://beta.services.openaire.eu/search/v2/api/resources";
+ private static searchResourcesAPIURL = "https://beta.services.openaire.eu/search/v2/api/resources";
+
+ //private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
+ private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/rest/";
+ // private static searchServiveURL = "http://services.openaire.eu:8380/search/";
+ // private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/";
+
+ private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
+
+ private static searchCrossrefAPIURL = "http://api.crossref.org/works";
+ private static searchDataciteAPIURL = "https://search.datacite.org/api";
+ private static searchOrcidURL = "https://pub.orcid.org/";
+
+ // Identifiers
+ private static pmidURL = "http://www.ncbi.nlm.nih.gov/pubmed/";
+ private static doiURL = "https://dx.doi.org/";
+ private static cordisURL = "http://cordis.europa.eu/projects/";
+ private static pmcURL = "http://europepmc.org/articles/";
+
+ // Zenodo's url
+ private static zenodo = "https://zenodo.org/";
+ // Open access link
+ private static openAccess = "https://www.openaire.eu/support/faq#article-id-234";
+ // Open access repository link
+ private static openAccessRepo = "https://www.openaire.eu/support/faq#article-id-310";
+ // FP7 link
+ private static fp7Guidlines = "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme";
+ // H2020 link
+ private static h2020Guidlines = "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020";
+ // ERC Guidlines
+ private static ercGuidlines = "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf";
+ // helpdesk link
+ private static helpdesk = "https://www.openaire.eu/support/helpdesk";
+
+
+ //landing Pages' getters
+ public static getsearchLinkToPublication():string{
+ return this.baseSearchLink + this.searchLinkToPublication;
+ }
+ public static getsearchLinkToDataset():string{
+ return this.baseSearchLink + this.searchLinkToDataset;
+ }
+ public static getsearchLinkToProject():string{
+ return this.baseSearchLink + this.searchLinkToProject;
+ }
+ public static getsearchLinkToPerson():string{
+ return this.baseSearchLink + this.searchLinkToPerson;
+ }
+ public static getsearchLinkToOrganization():string{
+ return this.searchLinkToOrganization;
+ }
+ public static getsearchLinkToDataProvider():string{
+ return this.searchLinkToDataProvider;
+ }
+ //searchPages
+ public static getLinkToSearchPublications():string{
+ return this.baseSearchLink + this.searchLinkToPublications;
+ }
+ public static getLinkToSearchProjects():string{
+ return this.baseSearchLink + this.searchLinkToProjects;
+ }
+ public static getLinkToSearchDataProviders():string{
+ return this.baseSearchLink + this.searchLinkToDataProviders;
+ }
+ public static getLinkToSearchCompatibleDataProviders():string{
+ return this.baseSearchLink + this.searchLinkToCompatibleDataProviders;
+ }
+ public static getLinkToSearchEntityRegistries():string{
+ return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders;
+ }
+ public static getLinkToSearchDatasets():string{
+ return this.baseSearchLink + this.searchLinkToDatasets;
+ }
+ public static getLinkToSearchOrganizations():string{
+ return this.baseSearchLink + this.searchLinkToOrganizations;
+ }
+ public static getLinkToSearchPeople():string{
+ return this.baseSearchLink + this.searchLinkToPeople;
+ }
+
+ //Advanced searchPages
+ public static getLinkToAdvancedSearchPublications():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedPublications;
+ }
+ public static getLinkToAdvancedSearchProjects():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedProjects;
+ }
+ public static getLinkToAdvancedSearchDataProviders():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedDataProviders;
+ }
+ public static getLinkToAdvancedSearchDatasets():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedDatasets;
+ }
+ public static getLinkToAdvancedSearchOrganizations():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedOrganizations;
+ }
+ public static getLinkToAdvancedSearchPeople():string{
+ return this.baseSearchLink + this.searchLinkToAdvancedPeople;
+ }
+
+ // Services - APIs' getters
+ // public static getSearchAPIURL():string{
+ // return this.searchAPIURL;
+ // }
+ // Services - APIs' getters
+ public static getCsvAPIURL(): string {
+ return this.csvAPIURL;
+ }
+
+ public static getFramesAPIURL(): string {
+ return this.framesAPIURL;
+ }
+
+ public static getMetricsAPIURL(): string {
+ return this.metricsAPIURL;
+ }
+
+ public static getLoginAPIURL(): string {
+ return this.loginAPIURL;
+ }
+
+ public static getSearchAPIURLLast():string{
+ return this.searchAPIURLLAst;
+ }
+ //query using full query:
+ //
+ public static getSearchResourcesAPIURL():string{
+ return this.searchResourcesAPIURL;
+ }
+ public static getSearchAPIURLForEntity(entityType:string):string{
+ var suffix = "";
+ if(entityType == "project"){
+ suffix="projects/";
+ }else if(entityType == "publication"){
+ suffix="publications/";
+ }else if(entityType == "dataset"){
+ suffix="datasets/";
+ }else if(entityType == "organization"){
+ suffix="organizations/";
+ }else if(entityType == "dataprovider"){
+ suffix="datasources/";
+ }else if(entityType == "person"){
+ suffix="people/";
+ }
+ return this.searchAPIURLLAst + suffix;
+ }
+ public static getSearchServiceURL():string{
+ return this.searchServiveURL;
+ }
+ public static getClaimsAPIURL():string{
+ return this.claimsAPIURL;
+ }
+ public static getSearchCrossrefAPIURL():string{
+ return this.searchCrossrefAPIURL;
+ }
+ public static getSearchDataciteAPIURL():string{
+ return this.searchDataciteAPIURL;
+ }
+ public static getSearchOrcidURL():string{
+ return this.searchOrcidURL;
+ }
+
+ // Identifiers' getters
+ public static getPmidURL():string{
+ return this.pmidURL;
+ }
+ public static getDoiURL():string{
+ return this.doiURL;
+ }
+ public static getCordisURL():string{
+ return this.cordisURL;
+ }
+ public static getPmcURL():string{
+ return this.pmcURL;
+ }
+
+ // Zenodo's getter
+ public static getZenodoURL():string{
+ return this.zenodo;
+ }
+ // Open access getter
+ public static getOpenAccess():string{
+ return this.openAccess;
+ }
+ // Open access repository getter
+ public static getOpenAccessRepo():string{
+ return this.openAccessRepo;
+ }
+ // FP7 link getter
+ public static getFP7Guidlines():string{
+ return this.fp7Guidlines;
+ }
+ // H2020 link getter
+ public static getH2020Guidlines():string{
+ return this.h2020Guidlines;
+ }
+ // ERC Guidlines getter
+ public static getERCGuidlines():string{
+ return this.ercGuidlines;
+ }
+ // helpdesk link getter
+ public static getHelpdesk():string{
+ return this.helpdesk;
+ }
+}
+export class ErrorCodes {
+ public LOADING = 0;
+ public DONE = 1;
+ public NONE = 2;
+ public ERROR = 3;
+ public NOT_AVAILABLE = 4;
+}
diff --git a/workingUIKIT/src/app/utils/properties/searchFields.ts b/workingUIKIT/src/app/utils/properties/searchFields.ts
new file mode 100644
index 00000000..d6ea60be
--- /dev/null
+++ b/workingUIKIT/src/app/utils/properties/searchFields.ts
@@ -0,0 +1,168 @@
+export class SearchFields {
+ //main Entities
+ //RESULTS
+ //Used for datasets and publications
+ //In case Datasets should display different fields, use seperate tables for fields
+ public RESULT_REFINE_FIELDS = [
+ "relfunderid",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "relproject","resultacceptanceyear",
+
+ "resultbestlicense", "instancetypename", "resultlanguagename", "community","collectedfrom"];
+
+ public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypename",
+ "resultlanguagename", "community","relprojectid", "relfunderid",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "resultdateofacceptance","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
+ public RESULT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["relperson"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
+ ["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
+ ["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
+ ["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
+ ["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
+ ["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ // ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ // ["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
+ ["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
+ ["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
+ ["relfunderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", equalityOperator: " exact "},
+ ["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", equalityOperator: " within "},
+ ["resultbestlicense"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
+ // ["resultbestlicenseid"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
+ ["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+ };
+
+ //PROJECT
+
+ public PROJECT_REFINE_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id",
+ "fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
+ public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
+ "funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
+ "projectstartdate","projectenddate","projectecsc39",
+ "projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
+ public PROJECT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
+ ["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
+
+ ["funderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", equalityOperator: " exact "},
+ ["projectendyear"]:{name:"End Year", type:"year", param:"endyear", equalityOperator: " exact "},
+ ["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", equalityOperator: " within "},
+ ["projectenddate"]:{name:"End Date", type:"date", param:"enddate", equalityOperator: " within "},
+ ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
+ ["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ //DATAPROVIDERS
+
+ public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
+ "datasourcecompatibilityname"];
+ public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
+ "datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
+ "datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
+
+ public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
+ ["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
+ ["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
+ ["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
+ ["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
+ ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiname","datasourcecompatibilityname"];
+ public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
+
+ //ORGANIZATION
+
+ public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
+ public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","organizationcountryname"];
+
+ public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
+ ["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
+ ["organizationcountryname"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
+ // ["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
+ };
+ public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
+ public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
+ public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
+ ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
+ public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
+ ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
+ ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
+ ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
+ ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", equalityOperator: " exact "},
+ ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
+
+ };
+
+ //PERSON
+ public PERSON_REFINE_FIELDS:string[] = [];
+ public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
+ public PERSON_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
+ ["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
+ ["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
+ };
+
+
+ public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
+
+ public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funderid",
+ ["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunderid",
+ ["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
+
+
+ public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
+
+ constructor (){
+ }
+ getFieldName(fieldId:string,fieldType:string):string{
+ if(fieldType == "publication" || fieldType == "dataset"){
+ return this.RESULT_FIELDS[fieldId].name;
+ }else if(fieldType == "project"){
+ return this.PROJECT_FIELDS[fieldId].name;
+ }else if(fieldType == "organization"){
+ return this.ORGANIZATION_FIELDS[fieldId].name;
+ }else if(fieldType == "datasource" || fieldType == "dataprovider"){
+ return this.DATASOURCE_FIELDS[fieldId].name;
+ }else{
+ return "UNDEFINED";
+ }
+ }
+}
+class FieldDetails{
+ name:string;
+ type:string;
+ param:string;
+ equalityOperator:string;
+ }
diff --git a/workingUIKIT/src/app/utils/properties/searchFields_new.ts b/workingUIKIT/src/app/utils/properties/searchFields_new.ts
new file mode 100644
index 00000000..9423ee0f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/properties/searchFields_new.ts
@@ -0,0 +1,164 @@
+export class SearchFields {
+ //main Entities
+ //RESULTS
+ //Used for datasets and publications
+ //In case Datasets should display different fields, use seperate tables for fields
+ public RESULT_REFINE_FIELDS = ["instancetypename", "resultlanguagename", "community","relproject", "relfunder",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "resultacceptanceyear","resultbestlicense"];//,"collectedfrom"];
+
+ public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypenameid",
+ "resultlanguageid", "community","relprojectid", "relfunder",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "resultacceptanceyear","resultbestlicenseid","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
+ public RESULT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["relperson"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
+ ["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
+ ["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
+ ["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
+ ["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
+ ["instancetypename"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["resultlanguagename"]:{name:"Language", type:"refine", param:"lang", equalityOperator: " exact "},
+ ["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
+ ["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
+ ["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
+ ["relfunder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["resultacceptanceyear"]:{name:"Year", type:"year", param:"year", equalityOperator: " exact "},
+ ["resultbestlicense"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
+ ["resultbestlicenseid"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
+ ["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+ };
+
+ //PROJECT
+
+ public PROJECT_REFINE_FIELDS:string[] = ["funder","fundinglevel0_id","fundinglevel1_id",
+ "fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
+ public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
+ "funder", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
+ "projectstartyear","projectendyear","projectecsc39",
+ "projectcode","relorganizationid", "collectedfromdatasourceid"];
+ public PROJECT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
+ ["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
+
+ ["funder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", equalityOperator: " exact "},
+ ["projectendyear"]:{name:"End Year", type:"year", param:"endyear", equalityOperator: " exact "},
+
+ ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
+ ["projectcode"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ //DATAPROVIDERS
+
+ public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
+ "datasourcecompatibilityname"];
+ public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
+ "datasourceenglishname","datasourceodsubjects", "datasourcetypeid","datasourceodlanguages",
+ "datasourceodcontenttypes", "datasourcecompatibilityid","relorganizationid", "collectedfromdatasourceid"];
+
+ public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
+ ["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
+ ["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
+ ["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypeid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
+ ["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
+ ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityid"];
+ public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypeid","datasourcecompatibilityid"];
+
+ //ORGANIZATION
+
+ public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
+ public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q",
+ "organizationlegalname","organizationlegalshortname","organizationcountryid"];
+
+ public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
+ ["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
+ ["organizationcountryid"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
+ ["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
+ };
+ public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
+ public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
+ public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
+ ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
+ public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
+ ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
+ ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
+ ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
+ ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", equalityOperator: " exact "},
+ ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
+
+ };
+
+ //PERSON
+ public PERSON_REFINE_FIELDS:string[] = [];
+ public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
+ public PERSON_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
+ ["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
+ ["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
+ };
+
+
+ public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
+ "relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id"];
+
+ public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
+ ["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
+ ["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
+
+
+ public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
+
+ constructor (){
+ }
+ getFieldName(fieldId:string,fieldType:string):string{
+ if(fieldType == "publication" || fieldType == "dataset"){
+ return this.RESULT_FIELDS[fieldId].name;
+ }else if(fieldType == "project"){
+ return this.PROJECT_FIELDS[fieldId].name;
+ }else if(fieldType == "organization"){
+ return this.ORGANIZATION_FIELDS[fieldId].name;
+ }else if(fieldType == "datasource"){
+ return this.DATASOURCE_FIELDS[fieldId].name;
+ }else{
+ return "UNDEFINED";
+ }
+ }
+}
+class FieldDetails{
+ name:string;
+ type:string;
+ param:string;
+ equalityOperator:string;
+ }
diff --git a/workingUIKIT/src/app/utils/properties/searchFields_old.ts b/workingUIKIT/src/app/utils/properties/searchFields_old.ts
new file mode 100644
index 00000000..de6b7f5f
--- /dev/null
+++ b/workingUIKIT/src/app/utils/properties/searchFields_old.ts
@@ -0,0 +1,164 @@
+export class SearchFields {
+ //main Entities
+ //RESULTS
+ //Used for datasets and publications
+ //In case Datasets should display different fields, use seperate tables for fields
+ public RESULT_REFINE_FIELDS = ["instancetypename", "resultlanguagename", "community","relproject", "relfunderid",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "resultacceptanceyear","resultbestlicense"];//,"collectedfrom"];
+
+ public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypenameid",
+ "resultlanguageid", "community","relprojectid", "relfunderid",
+ "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
+ "resultacceptanceyear","resultbestlicenseid","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
+ public RESULT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["relperson"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
+ ["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
+ ["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
+ ["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
+ ["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
+ ["instancetypename"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["resultlanguagename"]:{name:"Language", type:"refine", param:"lang", equalityOperator: " exact "},
+ ["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
+ ["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
+ ["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
+ ["relfunderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["resultacceptanceyear"]:{name:"Year", type:"year", param:"year", equalityOperator: " exact "},
+ ["resultbestlicense"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
+ ["resultbestlicenseid"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
+ ["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+ };
+
+ //PROJECT
+
+ public PROJECT_REFINE_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id",
+ "fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
+ public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
+ "funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
+ "projectstartyear","projectendyear","projectecsc39",
+ "projectcode","relorganizationid", "collectedfromdatasourceid"];
+ public PROJECT_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
+ ["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
+ ["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
+
+ ["funderid"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
+ ["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
+ ["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
+ ["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
+ ["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", equalityOperator: " exact "},
+ ["projectendyear"]:{name:"End Year", type:"year", param:"endyear", equalityOperator: " exact "},
+
+ ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
+ ["projectcode"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ //DATAPROVIDERS
+
+ public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
+ "datasourcecompatibilityname"];
+ public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
+ "datasourceenglishname","datasourceodsubjects", "datasourcetypeid","datasourceodlanguages",
+ "datasourceodcontenttypes", "datasourcecompatibilityid","relorganizationid", "collectedfromdatasourceid"];
+
+ public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
+ ["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
+ ["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
+ ["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
+ ["datasourcetypeid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
+ ["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
+ ["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
+ ["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
+ ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
+ ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
+ ["collectedfromdatasourceid"]:{name:"Collected from Datasource", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
+
+ };
+
+ public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityid"];
+ public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypeid","datasourcecompatibilityid"];
+
+ //ORGANIZATION
+
+ public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
+ public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q",
+ "organizationlegalname","organizationlegalshortname","organizationcountryid"];
+
+ public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
+ ["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
+ ["organizationcountryid"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
+ ["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
+ };
+ public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
+ public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
+ public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
+ ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
+ public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
+ ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
+ ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
+ ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
+ ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", equalityOperator: " exact "},
+ ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
+
+ };
+
+ //PERSON
+ public PERSON_REFINE_FIELDS:string[] = [];
+ public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
+ public PERSON_FIELDS: { [key:string]:FieldDetails}={
+ ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
+ ["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
+ ["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
+ ["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
+ };
+
+
+ public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
+ "relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id"];
+
+ public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funderid",
+ ["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunderid",
+ ["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
+
+
+ public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
+
+ constructor (){
+ }
+ getFieldName(fieldId:string,fieldType:string):string{
+ if(fieldType == "publication" || fieldType == "dataset"){
+ return this.RESULT_FIELDS[fieldId].name;
+ }else if(fieldType == "project"){
+ return this.PROJECT_FIELDS[fieldId].name;
+ }else if(fieldType == "organization"){
+ return this.ORGANIZATION_FIELDS[fieldId].name;
+ }else if(fieldType == "datasource"){
+ return this.DATASOURCE_FIELDS[fieldId].name;
+ }else{
+ return "UNDEFINED";
+ }
+ }
+}
+class FieldDetails{
+ name:string;
+ type:string;
+ param:string;
+ equalityOperator:string;
+ }
diff --git a/workingUIKIT/src/app/utils/routerHelper.class.ts b/workingUIKIT/src/app/utils/routerHelper.class.ts
new file mode 100644
index 00000000..fecaf296
--- /dev/null
+++ b/workingUIKIT/src/app/utils/routerHelper.class.ts
@@ -0,0 +1,34 @@
+
+
+
+export class RouterHelper {
+ //Use this class function to create queryParams Objects in format {key1:value1} or {key1:value1,key2:value2,key3:value3,...} for multiple parameters
+ constructor(){}
+ // Link
+ public createQueryParam(key:string,value:string){
+ var obj ={};
+ obj[key]=value;
+ return obj;
+
+ }
+ public createQueryParamsPaging(keys:string[],values:string[],pageParameter:string,pageValue:number){
+ var obj = this.createQueryParams(keys, values);
+ obj[pageParameter] = ""+pageValue;
+ return obj;
+
+ }
+ public createQueryParams(keys:string[],values:string[]){
+ var obj ={};
+ if(!keys || !values || keys.length != values.length){
+ return obj;
+ }else{
+ for(var i=0; i< keys.length; i++){
+ obj[keys[i]]=values[i];
+ }
+ }
+ return obj;
+
+ }
+
+
+}
diff --git a/workingUIKIT/src/app/utils/showDataProviders.component.ts b/workingUIKIT/src/app/utils/showDataProviders.component.ts
new file mode 100644
index 00000000..b739ed35
--- /dev/null
+++ b/workingUIKIT/src/app/utils/showDataProviders.component.ts
@@ -0,0 +1,61 @@
+import {Component, Input} from '@angular/core';
+
+@Component({
+ selector: 'showDataProviders',
+ template: `
+
+
+ There are no data providers
+
+
+ `
+})
+
+// Possibly should be deleted. Not used anywhere.
+export class ShowDataProvidersComponent {
+@Input() dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
+ "organizations": {"name": string, "url": string}[]}[];
+
+constructor () {
+}
+
+ngOnInit() {}
+}
diff --git a/workingUIKIT/src/app/utils/staticAutoComplete/ISVocabularies.service.ts b/workingUIKIT/src/app/utils/staticAutoComplete/ISVocabularies.service.ts
new file mode 100644
index 00000000..1b2c5394
--- /dev/null
+++ b/workingUIKIT/src/app/utils/staticAutoComplete/ISVocabularies.service.ts
@@ -0,0 +1,117 @@
+import {Injectable} from '@angular/core';
+import {Http, Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {AutoCompleteValue} from '../../searchPages/searchUtils/searchHelperClasses.class';
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/share';
+import { CacheService } from '../../shared/cache.service';
+
+@Injectable()
+export class ISVocabulariesService {
+ // private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
+ // private api = "http://api.openaire.eu/vocabularies/"
+ private api = "http://dev.openaire.research-infrastructures.eu/vocabularies/";
+ constructor(private http: Http, public _cache: CacheService) {}
+
+ getVocabularyByType(field:string,entity:string):any{
+ console.log("getVocabulary field: "+ field + " for entity: "+ entity);
+ var file = "";
+ var vocabulary = "";
+ if( field == "lang"){
+ // file="languages.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:languages.json";
+ return this.getVocabularyFromService(vocabulary);
+ }else if ( field == "type" && (entity == "publication")){
+ // file = "publicationTypes.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:publication_resource.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ }else if ( field == "type" && (entity == "dataset")){
+ // file = "dnet:dataCite_resource.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:dataCite_resource.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ }else if( field == "access" && (entity == "publication" || entity == "dataset")){
+ // file= "accessMode.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:access_modes.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ } else if( (field == "type") && (entity == "dataprovider")){
+ // file = "dataProviderType.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:datasource_typologies.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ } else if( field == "compatibility" && (entity == "dataprovider")){
+ // file = "dataProviderCompatibility.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:datasourceCompatibilityLevel.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ } else if( field == "country" ){
+ // file = "countries.json";
+ // return this.getVocabularyFromFile(file);
+ vocabulary = "dnet:countries.json";
+ return this.getVocabularyFromService(vocabulary);
+
+ }
+ return null;
+
+ }
+ // getVocabularyFromFile (file:string):AutoCompleteValue[] {
+ // var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/'+file)));
+ // return this.parse(lang["terms"]);
+ // }
+ getVocabularyFromService (vocabularyName:string):any {
+ let url = this.api + vocabularyName;
+ console.log(url);
+ let key = url;
+ if (this._cache.has(key)) {
+ return Observable.of(this._cache.get(key));
+ }
+ // return this.http.get(url).toPromise()
+ // .then(request =>
+ // {
+ // request = request.json()['terms'];
+ // var results:AutoCompleteValue[] = this.parse(request);
+ // console.log("Get vocabulary : "+ vocabularyName+ " - get " +results.length+ "results");
+ // return results;
+ // });
+ return this.http.get(url)
+ .do(res => console.log(res))
+ .map(res => res.json())
+ .map(res => res['terms'])
+ .do(res => console.log(res))
+ .map(res => this.parse(res))
+ .do(res => console.log(res))
+ .catch(this.handleError)
+ .do(res => {
+ this._cache.set(key, res);
+ });
+
+ }
+
+ parse (data: any):AutoCompleteValue[] {
+ var array:AutoCompleteValue[] =[]
+ for(var i = 0; i < data.length; i++){
+ var value:AutoCompleteValue = new AutoCompleteValue();
+ value.id = data[i].englishName;//data[i].code;
+ value.label = data[i].englishName;
+ array.push(value);
+ }
+
+ return array;
+
+ }
+private handleError (error: Response) {
+ // in a real world app, we may send the error to some remote logging infrastructure
+ // instead of just logging it to the console
+ console.log(error);
+ return Observable.throw(error || 'Server error');
+ }
+}
diff --git a/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.component.ts b/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.component.ts
new file mode 100644
index 00000000..d26364b5
--- /dev/null
+++ b/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.component.ts
@@ -0,0 +1,298 @@
+import {Component, ElementRef, Input, Output, EventEmitter, OnChanges, SimpleChange} from '@angular/core';
+import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
+import {ISVocabulariesService} from './ISVocabularies.service';
+import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
+//Usage example
+//
+
+@Component({
+ selector: 'static-autocomplete',
+ styleUrls: ['../autoComplete.component.css'],
+ host: {
+ '(document:click)': 'handleClick($event)',
+ },
+ template: `
+
+
+ {{showItem(item)}}
+
+
+
+
+
+
+
+
+ Loading...
+ 0" > {{results}} results found:
+ No results found
+
+
+ {{showItem(item)}}
+
+
+
+
+
+ `
+})
+export class StaticAutoCompleteComponent implements OnChanges{
+ @Input() placeHolderMessage = "Search for entries";
+ @Input() title = "Autocomplete";
+ @Output() addItem = new EventEmitter(); // when selected list changes update parent component
+ @Output() selectedValueChanged = new EventEmitter(); // when changed a method for filtering will be called
+ @Output() listUpdated = new EventEmitter(); // when changed a method for filtering will be called
+ @Input() public list = []; // the entries resulted after filtering function
+ @Input() public filtered = []; // the entries resulted after filtering function
+ @Input() public selected = []; // the entries selected from user
+ @Input() public keywordlimit = 3; // the minimum length of keyword
+ @Input() public showSelected = true; // the minimum length of keyword
+ @Input() public multipleSelections:boolean = true;
+ @Input() public allowDuplicates:boolean = false;
+ @Input() public selectedValue:string = '';
+ @Input() public vocabularyId:string ;
+ @Input() public fieldName:string ;
+ @Input() public entityName:string ;
+ @Input() public fieldId:string ;
+
+ @Input() public keyword = '';
+ @Input() public type = 'search' //search, result, context, project
+ public warningMessage = "";
+ public infoMessage = "";
+ public showLoading:boolean = false;
+ public tries = 0;
+ public showInput = true;
+ public sub;
+ public done = false;
+ public results = 0;
+ public focus:boolean = false;
+ public currentFieldId: string ;
+ constructor ( private _vocabulariesService: ISVocabulariesService,private _refineService: RefineFieldResultsService, private myElement: ElementRef) {
+ this.currentFieldId=this.fieldId;
+
+ }
+ ngOnDestroy(){
+ if(this.sub && this.sub != undefined){
+ this.sub.unsubscribe();
+ }
+ }
+
+ ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
+ if(this.currentFieldId!=this.fieldId){ //this is going to be called when
+ this.currentFieldId=this.fieldId;
+ this.initialize();
+ }
+ }
+ private initialize(){
+
+ this.showInput = true;
+ if(this.list == undefined || this.list.length == 0){
+ this.showLoading = true;
+
+ if(this.vocabularyId){
+ // this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName);
+ // this.afterListFetchedActions();
+ this.sub = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName).subscribe(
+ data => {
+ this.list = data;
+ this.afterListFetchedActions();
+
+ },
+ err => {
+ console.log(err);
+ this.warningMessage = "An Error occured..."
+ }
+ );
+ }else if(this.fieldName && this.entityName){
+ // this.list = this._refineService.getRefineFieldResultsByFieldName(this.fieldName,this.entityName);
+ this.sub = this._refineService.getRefineFieldResultsByFieldName(this.fieldName,this.entityName).subscribe(
+ data => {
+ this.list = data;
+ this.afterListFetchedActions();
+
+ },
+ err => {
+ console.log(err);
+ this.warningMessage = "An Error occured..."
+ }
+ );
+ }else{
+ this.showLoading = false;
+
+ }
+ }else{
+ this.afterListFetchedActions();
+ }
+
+ }
+ public updateList(list){ // used in claim context autocomplete
+ this.list = list;
+ this.afterListFetchedActions()
+ }
+ private afterListFetchedActions(){
+ this.showLoading = false;
+ this.getSelectedNameFromGivenId();
+ this.listUpdated.emit({
+ value: this.list
+ });
+ if(this.list == null || this.list.length == 0 ){
+ this.warningMessage = "There are no results";
+ return;
+ }
+ this.done = true;
+ if(this.keyword != ""){
+ this.filter();
+ }
+
+ }
+ filter() {
+ this.focus = true;
+ if(this.done){
+ this.infoMessage = "";
+ this.filtered = [];
+ if(this.keyword == ""){
+ var cut = 10;
+ if(this.list.length < 5){
+ cut = this.list.length;
+ }
+ this.results = this.list.length;
+ this.filtered =this.list.slice(0, cut);
+ this.tries = 0;
+ this.warningMessage = "";
+ // } else if(this.keyword && this.keyword.length < this.keywordlimit){
+ // this.tries++;
+ // if(this.tries == this.keywordlimit -1 ){
+ // this.warningMessage = "Type at least " + this.keywordlimit + " characters";
+ // this.tries = 0;
+ // }
+ }else{
+ this.tries = 0;
+ this.warningMessage = "";
+ this.filtered = this.list.filter(function(el){
+ return el.label.toLowerCase().indexOf(this.keyword.toLowerCase()) > -1;
+ }.bind(this));
+ var cut = 10;
+ if(this.filtered .length < 5){
+ cut = this.list.length;
+ }
+ this.results = this.filtered.length;
+ this.filtered =this.filtered.slice(0, cut);
+ }
+ }
+ }
+ remove(item:any){
+ var index:number =this.checkIfExists(item,this.selected);
+ if (index > -1) {
+ this.selected.splice(index, 1);
+ }
+ if(!this.multipleSelections && this.selected.length == 0 ){
+ this.showInput = true;
+ this.selectedValue = "";
+ this.selectedValueChanged.emit({
+ value: this.selectedValue
+ });
+
+
+ }
+ }
+ select(item:any){
+ // console.log("select"+this.selected.length + item.id + " "+ item.label);
+
+ if(this.multipleSelections){
+ var index:number =this.checkIfExists(item,this.selected);
+ if (index > -1 && !this.allowDuplicates) {
+ this.keyword = "";
+ this.filtered.splice(0, this.filtered.length);
+ return;
+ }
+ else{
+ this.selected.push(item);
+ this.keyword = "";
+ this.filtered.splice(0, this.filtered.length);
+ this.addItem.emit({
+ value: item
+ });
+ }
+ }else{
+ this.selected.splice(0, this.selected.length);
+ this.selected.push(item);
+ this.filtered.splice(0, this.filtered.length);
+ this.keyword = "";
+ this.showInput = false;
+ this.selectedValue = item.id;
+ this.selectedValueChanged.emit({
+ value: this.selectedValue
+ });
+
+ }
+
+ }
+ private checkIfExists(item:any,list):number{
+
+ if(item.concept && item.concept.id ){
+
+ for (var _i = 0; _i < list.length; _i++) {
+ let itemInList = list[_i];
+ if(item.concept.id == itemInList.concept.id){
+ return _i;
+ }
+ }
+ }else if(item.id){
+ for (var _i = 0; _i < list.length; _i++) {
+ let itemInList = list[_i];
+ if(item.id == itemInList.id){
+ return _i;
+ }
+ }
+ }
+ return -1;
+
+ }
+ showItem(item:any):string{
+
+ if (item.name){ //search
+ return item.name;
+ }else if( item.concept && item.concept.label){ //context
+ return item.concept.label;
+ }else if (item.label){ //simple
+ return item.label;
+ }
+
+ }
+ truncate(str:string, size:number):string{
+ if(str == null){return "";}
+ return (str.length > size)?str.substr(0,size)+'...':str;
+ }
+ private getSelectedNameFromGivenId(){
+ if(this.list == null ){
+ return;
+ }
+ this.showInput = true;
+ for( var i = 0; i < this.list.length; i++){
+ if(this.list[i].id == this.selectedValue){
+ this.selectedValue = this.list[i].label;
+ this.selected.push(this.list[i]);
+ this.showInput = false;
+ return;
+
+ }
+ }
+ }
+
+ handleClick(event){
+ var clickedComponent = event.target;
+ var inside = false;
+ do {
+ if (clickedComponent === this.myElement.nativeElement) {
+ inside = true;
+ }
+ clickedComponent = clickedComponent.parentNode;
+ } while (clickedComponent);
+ if(!inside){
+ this.focus =false;
+ this.filtered.splice(0, this.filtered.length);
+ }
+ }
+
+}
diff --git a/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.module.ts b/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.module.ts
new file mode 100644
index 00000000..1c876a15
--- /dev/null
+++ b/workingUIKIT/src/app/utils/staticAutoComplete/staticAutoComplete.module.ts
@@ -0,0 +1,22 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {StaticAutoCompleteComponent} from './staticAutoComplete.component';
+import {RefineFieldResultsServiceModule} from '../../services/refineFieldResultsService.module';
+import {ISVocabulariesService} from './ISVocabularies.service';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule, RefineFieldResultsServiceModule
+ ],
+ declarations: [
+ StaticAutoCompleteComponent
+ ],
+ exports: [
+ StaticAutoCompleteComponent
+ ],
+ providers:[ ISVocabulariesService]
+})
+export class StaticAutocompleteModule { }
diff --git a/workingUIKIT/src/app/utils/string-utils.class.ts b/workingUIKIT/src/app/utils/string-utils.class.ts
new file mode 100644
index 00000000..74e23629
--- /dev/null
+++ b/workingUIKIT/src/app/utils/string-utils.class.ts
@@ -0,0 +1,122 @@
+export class Dates {
+ public static isValidYear(yearString){
+ // First check for the pattern
+ if(!/^\d{4}$/.test(yearString))
+ return false;
+ var year = parseInt(yearString, 10);
+
+ // Check the ranges of month and year
+ if(year < 1000 || year > 3000 )
+ return false;
+ return true;
+ }
+ //format YYYY-MM-DD
+ public static isValidDate(dateString:string)
+ {
+ // First check for the pattern
+ if(!/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(dateString))
+ return false;
+
+ // Parse the date parts to integers
+ var parts = dateString.split("-");
+ var day = parseInt(parts[2], 10);
+ var month = parseInt(parts[1], 10);
+ var year = parseInt(parts[0], 10);
+ if(!this.isValidYear(parts[0])){
+ return false;
+ }
+
+ // Check the ranges of month and year
+ if( month == 0 || month > 12)
+ return false;
+
+ var monthLength = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
+
+ // Adjust for leap years
+ if(year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
+ monthLength[1] = 29;
+
+ // Check the range of the day
+ return day > 0 && day <= monthLength[month - 1];
+
+ }
+ public static getDateToday():Date{
+ var myDate = new Date();
+ return myDate;
+
+ }
+ public static getDateToString(myDate:Date):string{
+ var date:string = myDate.getFullYear()+ "-" ;
+ date+=((myDate.getMonth() + 1)<10)?"0"+(myDate.getMonth() + 1):(myDate.getMonth() + 1) ;
+ date+="-";
+ date+= (myDate.getDate() <10 )? "0"+myDate.getDate():myDate.getDate() ;
+ return date;
+
+ }
+ public static getDateXMonthsAgo(x:number):Date{
+ var myDate = new Date();
+ myDate.setMonth(myDate.getMonth() - x);
+ return myDate;
+
+ }
+ public static getDateXYearsAgo(x:number):Date{
+ var myDate = new Date();
+ myDate.setFullYear(myDate.getFullYear() - x);
+ return myDate;
+
+ }
+ public static getDateFromString(date:string):Date{
+
+ var myDate = new Date();
+ myDate.setFullYear(+date.substring(0,4));
+ myDate.setMonth(+date.substring(5,7)-1);
+ myDate.setDate(+date.substring(8,11))
+ return myDate;
+
+ }
+
+}
+
+export class DOI{
+
+ public static getDOIsFromString(str:string):string[]{
+ var DOIs:string[] = [];
+ var words:string[] = str.split(" ");
+
+ for(var i=0; i< words.length; i++){
+ if(DOI.isValidDOI(words[i]) && DOIs.indexOf(words[i]) == -1){
+ DOIs.push(words[i]);
+ }
+ }
+ return DOIs;
+ }
+ public static isValidDOI(str:string):boolean{
+
+ var exp1 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g
+ var exp2 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])[[:graph:]])+)\b/g
+ if(str.match(exp1)!=null || str.match(exp2)!=null){
+ // console.log("It's a DOI");
+ return true;
+ }
+ return false;
+
+ }
+}
+export class StringUtils{
+ public static quote(params: string):string {
+ return '"'+params+'"';
+ }
+
+ public static unquote(params: string):string {
+ if(params.length > 2 && (params[0]=='"' && params[params.length-1]=='"') || (params[0]=="'" && params[params.length-1]=="'")){
+ params= params.substring(1, params.length-1);
+ }
+ return params;
+ }
+ public static URIEncode(params: string):string {
+ return encodeURIComponent(params);
+ }
+ public static URIDecode(params: string):string {
+ return decodeURIComponent(params);
+ }
+}
diff --git a/workingUIKIT/src/assets/closedAccess.png b/workingUIKIT/src/assets/closedAccess.png
new file mode 100644
index 00000000..b1d033ce
Binary files /dev/null and b/workingUIKIT/src/assets/closedAccess.png differ
diff --git a/workingUIKIT/src/assets/custom.css b/workingUIKIT/src/assets/custom.css
new file mode 100644
index 00000000..e69de29b
diff --git a/workingUIKIT/src/assets/favicon.ico b/workingUIKIT/src/assets/favicon.ico
new file mode 100644
index 00000000..151eca1b
Binary files /dev/null and b/workingUIKIT/src/assets/favicon.ico differ
diff --git a/workingUIKIT/src/assets/jquery/jquery.min.js b/workingUIKIT/src/assets/jquery/jquery.min.js
new file mode 100644
index 00000000..e8364758
--- /dev/null
+++ b/workingUIKIT/src/assets/jquery/jquery.min.js
@@ -0,0 +1,5 @@
+/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML=" ",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML=" ","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML=" ",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0;
+}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" a ",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,""," "],legend:[1,""," "],area:[1,""," "],param:[1,""," "],thead:[1,""],tr:[2,""],col:[2,""],td:[3,""],_default:l.htmlSerialize?[0,"",""]:[1,"X","
"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|?\w+;/,ha=/r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?""!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h ]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading Universal ...
+
+
+
+
+
+
+
+
+