Project

General

Profile

« Previous | Next » 

Revision 50169

Commiting first draft of openaire library for angular portals

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/exportCSV.class.ts
1

  
2

  
3

  
4
export class ExportCSVComponent {
5
    stockData : any =
6
        {
7
            "columnNames":
8
                ["Symbol", "Company", "Price"],
9
            "export":
10
/*
11
                [
12
                    {
13
                        Symbol: "AAPL",
14
                        Company: "Apple Inc.",
15
                        Price: "132.54"
16
                    },
17
                    {
18
                        Symbol: "INTC",
19
                        Company: "Intel Corporation",
20
                        Price: "33.45"
21
                    },
22
                    {
23
                        Symbol: "GOOG",
24
                        Company: "Google Inc",
25
                        Price: "554.52"
26
                    },
27
                ],
28
*/
29

  
30
                [
31
                    [
32
                        "AAPL",
33
                        "Apple Inc.",
34
                        "132.54"
35
                    ],
36
                    [
37
                        "INTC",
38
                        "Intel Corporation",
39
                        "33.45"
40
                    ],
41
                    [
42
                        "GOOG",
43
                        "Google Inc",
44
                        "554.52"
45
                    ],
46
                ],
47

  
48

  
49
            "columnDelimiter": ',',
50
            "lineDelimiter": '\n'
51
        };
52

  
53
     data: any = this.stockData;
54
     filename: string;
55
     linkname: string = "Download CSV";
56

  
57
    constructor () {
58
    }
59

  
60
    ngOnInit() {
61
    }
62

  
63
    public static convertArrayOfObjectsToCSV(args) {
64
        console.info("convertArrayOfObjectsToCSV");
65

  
66
        var result, ctr, keys, columnDelimiter, lineDelimiter, data;
67

  
68
        data = args.export || null;
69

  
70
        if (data == null || !data.length) {
71
            return null;
72
        }
73

  
74
        columnDelimiter = args.columnDelimiter || ',';
75
        lineDelimiter = args.lineDelimiter || '\n';
76

  
77
        //keys = Object.keys(data[0]);
78
        keys = args.columnNames;
79

  
80
        result = '';
81
        result += keys.join(columnDelimiter);
82
        result += lineDelimiter;
83
/*
84
        data.forEach(function(item) {
85
            ctr = 0;
86
            keys.forEach(function(key) {
87
                if (ctr > 0) result += columnDelimiter;
88
                result += item[key];
89
                ctr++;
90
            });
91
            result += lineDelimiter;
92
        });
93
*/
94

  
95
        for(let line of data) {
96
            ctr = 0;
97
            for(let column of line) {
98
                if (ctr > 0) result += columnDelimiter;
99
                result += column;
100
                ctr++;
101
            }
102
            result += lineDelimiter;
103
        }
104

  
105
        return result;
106
    }
107

  
108
    public static downloadCSV(data: any, filenameArg: string) {
109
        console.info("downloadCSV");
110

  
111
        var encodedData, filename, link;
112

  
113
        var csv = this.convertArrayOfObjectsToCSV(data);
114
        if (csv == null) return;
115

  
116
        filename = filenameArg || 'export.csv';
117

  
118
        if (!csv.match(/^data:text\/csv/i)) {
119
            csv = 'data:text/csv;charset=utf-8,' + csv;
120
        }
121
        encodedData = encodeURI(csv);
122

  
123
        //link = document.createElement('a');
124
        link = document.getElementsByTagName('a');
125
        link[0].setAttribute('href', encodedData);
126
        link[0].setAttribute('download', filename);
127
        //document.body.appendChild(link);
128
        link[0].click();
129
        //document.body.removeChild(link);
130
    }
131
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/errorMessages.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
import {ErrorMessagesComponent} from './errorMessages.component';
6

  
7

  
8
@NgModule({
9
  imports: [
10
    CommonModule, FormsModule
11
  ],
12
  declarations: [
13
     ErrorMessagesComponent
14
  ],
15
  exports: [
16
      ErrorMessagesComponent
17
    ]
18
})
19
export class ErrorMessagesModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/organizationInfo.ts
1
export class OrganizationInfo {
2
    title: { "name": string, "url": string };
3
    name: string;
4
    country: string;
5

  
6
    projects: Map<string, { "name": string, "id":string, "code": string,
7
                            "acronym": string, "funder": string, "funderId": string,
8
                            "fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
9
                            "sc39": string, "startDate": string, "endDate": string }[]>;
10
    //dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
11
    //                    "organizations": {"name": string, "url": string}[]}[];
12
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/properties/openaireProperties.ts
1
export class OpenaireProperties {
2
    private static productionMode:boolean = false;
3
    private static enablePiwikTrack:boolean = false;
4
    private static enableHelper:boolean = false;
5
    private static useCache:boolean = true;
6

  
7
    //base url
8
    private static baseLink = "https://demo.openaire.eu";
9

  
10
    //landing Pages
11
    private static baseSearchLink="/";
12
    private static searchLinkToPublication = "search/publication?articleId=";
13
    private static searchLinkToProject = "search/project?projectId=";
14
    private static searchLinkToDataProvider = "search/dataprovider?datasourceId=";
15
    private static searchLinkToDataset = "search/dataset?datasetId=";
16
    private static searchLinkToOrganization = "search/organization?organizationId=";
17
    //Search pages
18
    private static searchLinkToPublications = "search/find/publications";
19
    private static searchLinkToDataProviders = "search/find/dataproviders";
20
    private static searchLinkToProjects = "search/find/projects";
21
    private static searchLinkToDatasets = "search/find/datasets";
22
    private static searchLinkToSoftware = "search/find/software";
23
    private static searchLinkToOrganizations = "search/find/organizations";
24
    private static searchLinkToPeople = "search/find/people";
25
    public static searchLinkToCompatibleDataProviders = "search/content-providers";
26
    public static searchLinkToCompatibleDataProvidersTable = "search/content-providers-table";
27
    public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries";
28
    public static searchLinkToEntityRegistriesDataProvidersTable = "search/entity-registries-table";
29
    public static searchLinkToJournals = "search/journals";
30
    public static searchLinkToJournalsTable = "search/journals-table";
31

  
32
    //Advanced Search for pages
33
    public static searchLinkToAdvancedPublications = "search/advanced/publications";
34
    public static searchLinkToAdvancedProjects = "search/advanced/projects";
35
    public static searchLinkToAdvancedDatasets = "search/advanced/datasets";
36
    public static searchLinkToAdvancedSoftware = "search/advanced/software";
37
    public static searchLinkToAdvancedDataProviders = "search/advanced/dataproviders";
38
    public static searchLinkToAdvancedOrganizations = "search/advanced/organizations";
39
    public static searchLinkToAdvancedPeople = "search/advanced/people";
40

  
41

  
42
    private static metricsAPIURL = "https://beta.services.openaire.eu/usagestats/";
43
    private static framesAPIURL = "https://beta.openaire.eu/stats3/";
44

  
45
    private static loginAPIURL = "http://rudie.di.uoa.gr:8080/dnet%2Dopenaire%2Dusers%2D1.0.0%2DSNAPSHOT/api/users/authenticates"
46
    //"http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
47
    private static loginAPIURL_pm = "https://beta.services.openaire.eu/uoa-user-management/api/users/authenticates";
48

  
49
    private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/";
50
    private static claimsAPIURL_pm = "https://beta.services.openaire.eu/claims/rest/claimsService/";
51

  
52
     private static searchAPIURLLAst_pm     = "https://beta.services.openaire.eu/search/v2/api/";
53
     private static searchAPIURLLAst     = "https://beta.services.openaire.eu/search/v2/api/";
54
//    private static searchAPIURLLAst     = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
55

  
56
    private static searchResourcesAPIURL_pm     = "https://beta.services.openaire.eu/search/v2/api/resources";
57
    private static searchResourcesAPIURL     = "https://beta.services.openaire.eu/search/v2/api/resources";
58
    // private static searchResourcesAPIURL     = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
59

  
60

  
61
    private static csvAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
62
    // private static csvAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv
63

  
64
   private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
65

  
66
    private static searchCrossrefAPIURL = "https://api.crossref.org/works";
67
    // private static searchDataciteAPIURL = "https://search.datacite.org/api";
68
    private static searchDataciteAPIURL = "https://api.datacite.org/works";
69

  
70
    private static searchOrcidURL    = "https://pub.orcid.org/";
71

  
72
    // Identifiers
73
    private static pmidURL    = "http://www.ncbi.nlm.nih.gov/pubmed/";
74
    private static doiURL     = "https://dx.doi.org/";
75
    private static cordisURL  = "http://cordis.europa.eu/projects/";
76
    private static pmcURL     = "http://europepmc.org/articles/";
77
    private static handleURL  = "http://hdl.handle.net/";
78

  
79
    // Zenodo's url
80
    private static zenodo   = "https://zenodo.org/";
81
    // Open access link
82
    private static openAccess = "https://www.openaire.eu/support/faq#article-id-234";
83
    // Open access repository link
84
    private static openAccessRepo = "https://www.openaire.eu/support/faq#article-id-310";
85
    // FP7 link
86
    private static fp7Guidlines = "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme";
87
    // H2020 link
88
    private static h2020Guidlines = "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020";
89
    // ERC Guidlines
90
    private static ercGuidlines = "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf";
91
    // helpdesk link
92
    private static helpdesk = "https://www.openaire.eu/support/helpdesk";
93

  
94
    private static uploadService_pm = "https://demo.openaire.eu/upload";
95
    private static uploadService = "http://scoobydoo.di.uoa.gr:8000/upload";
96

  
97
    private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
98

  
99
    private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6";
100

  
101

  
102
    private static loginUrl ="http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login";
103
    private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
104

  
105
    private static logoutUrl ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
106
    private static logoutUrl_pm ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
107

  
108
    private static logoutOpenaireUrl ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
109
    private static logoutOpenaireUrl_pm ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
110

  
111

  
112

  
113
    private static cookieDomain =".di.uoa.gr";
114
    private static cookieDomain_pm =".openaire.eu";
115

  
116
    private static feedbackmail ="openaire.test@gmail.com";
117

  
118
    private static helperPageUrl ="http://scoobydoo.di.uoa.gr:16000/api/page/route";
119

  
120
    private static cache ="http://scoobydoo.di.uoa.gr:3000/get?url=";
121
    private static cache_pm ="https://demo.openaire.eu/cache/get?url=";
122

  
123

  
124

  
125
    public static getBaseLink():string{
126
      return this.baseLink;
127
    }
128

  
129
    //landing Pages' getters
130
    public static getsearchLinkToPublication():string{
131
      return this.baseSearchLink + this.searchLinkToPublication;
132
    }
133
    public static getsearchLinkToDataset():string{
134
      return this.baseSearchLink + this.searchLinkToDataset;
135
    }
136
    public static getsearchLinkToProject():string{
137
      return this.baseSearchLink + this.searchLinkToProject;
138
    }
139

  
140
    public static getsearchLinkToOrganization():string{
141
      return  this.searchLinkToOrganization;
142
    }
143
    public static getsearchLinkToDataProvider():string{
144
      return  this.searchLinkToDataProvider;
145
    }
146
    //searchPages
147
    public static getLinkToSearchPublications():string{
148
      return this.baseSearchLink + this.searchLinkToPublications;
149
    }
150
    public static getLinkToSearchProjects():string{
151
      return this.baseSearchLink + this.searchLinkToProjects;
152
    }
153
    public static getLinkToSearchDataProviders():string{
154
      return this.baseSearchLink + this.searchLinkToDataProviders;
155
    }
156
    public static getLinkToSearchCompatibleDataProviders():string{
157
      return this.baseSearchLink + this.searchLinkToCompatibleDataProviders;
158
    }
159
    public static getLinkToSearchCompatibleDataProvidersTable():string{
160
      return this.baseSearchLink + this.searchLinkToCompatibleDataProvidersTable;
161
    }
162
    public static getLinkToSearchEntityRegistries():string{
163
      return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders;
164
    }
165
    public static getLinkToSearchEntityRegistriesTable():string{
166
      return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProvidersTable;
167
    }
168
    public static getLinkToSearchJournals():string{
169
      return this.baseSearchLink + this.searchLinkToJournals;
170
    }
171
    public static getLinkToSearchJournalsTable():string{
172
      return this.baseSearchLink + this.searchLinkToJournalsTable;
173
    }
174
    public static getLinkToSearchDatasets():string{
175
      return this.baseSearchLink + this.searchLinkToDatasets;
176
    }
177
    public static getLinkToSearchSoftware():string{
178
      return this.baseSearchLink + this.searchLinkToSoftware;
179
    }
180
    public static getLinkToSearchOrganizations():string{
181
      return this.baseSearchLink + this.searchLinkToOrganizations;
182
    }
183
    public static getLinkToSearchPeople():string{
184
        return this.baseSearchLink + this.searchLinkToPeople;
185
    }
186

  
187
    //Advanced searchPages
188
    public static getLinkToAdvancedSearchPublications():string{
189
      return this.baseSearchLink + this.searchLinkToAdvancedPublications;
190
    }
191
    public static getLinkToAdvancedSearchProjects():string{
192
      return this.baseSearchLink + this.searchLinkToAdvancedProjects;
193
    }
194
    public static getLinkToAdvancedSearchDataProviders():string{
195
      return this.baseSearchLink + this.searchLinkToAdvancedDataProviders;
196
    }
197
    public static getLinkToAdvancedSearchDatasets():string{
198
      return this.baseSearchLink + this.searchLinkToAdvancedDatasets;
199
    }
200
    public static getLinkToAdvancedSearchSoftware():string{
201
      return this.baseSearchLink + this.searchLinkToAdvancedSoftware;
202
    }
203
    public static getLinkToAdvancedSearchOrganizations():string{
204
      return this.baseSearchLink + this.searchLinkToAdvancedOrganizations;
205
    }
206
    public static getLinkToAdvancedSearchPeople():string{
207
        return this.baseSearchLink + this.searchLinkToAdvancedPeople;
208
    }
209

  
210
    // Services - APIs' getters
211
    // public static getSearchAPIURL():string{
212
    //   return this.searchAPIURL;
213
    // }
214
    // Services - APIs' getters
215
    public static getCsvAPIURL(): string {
216
      if(this.productionMode){
217
        return this.csvAPIURL_pm;
218
      }else{
219
        return this.csvAPIURL;
220
      }
221
        // return this.csvAPIURL;
222
    }
223

  
224
    public static getFramesAPIURL(): string {
225
        return this.framesAPIURL;
226
    }
227

  
228
    public static getMetricsAPIURL(): string {
229
        return this.metricsAPIURL;
230
    }
231

  
232
    public static getLoginAPIURL(): string {
233
      if(this.productionMode){
234
        return this.loginAPIURL_pm;
235
      }else{
236
        return this.loginAPIURL;
237
      }
238
        // return this.loginAPIURL;
239
    }
240

  
241
    public static getSearchAPIURLLast():string{
242
      if(this.productionMode){
243
        return this.searchAPIURLLAst_pm;
244
      }else{
245
        return this.searchAPIURLLAst;
246
      }
247
      // return this.searchAPIURLLAst;
248
    }
249
    //query using full query:
250
    //
251
    public static getSearchResourcesAPIURL():string{
252
      if(this.productionMode){
253
        return this.searchResourcesAPIURL_pm;
254
      }else{
255
        return this.searchResourcesAPIURL;
256
      }
257
      // return this.searchResourcesAPIURL;
258
    }
259
    public static getSearchAPIURLForEntity(entityType:string):string{
260
      var suffix = "";
261
      if(entityType == "project"){
262
        suffix="projects/";
263
      }else if(entityType == "publication"){
264
        suffix="publications/";
265
      }else if(entityType == "dataset"){
266
        suffix="datasets/";
267
      } else if(entityType == "software"){
268
        suffix="software/";
269
      }else if(entityType == "organization"){
270
        suffix="organizations/";
271
      }else if(entityType == "dataprovider"){
272
        suffix="datasources/";
273
      }else if(entityType == "person"){
274
        suffix="people/";
275
      }
276
      return (this.productionMode?this.searchAPIURLLAst_pm:this.searchAPIURLLAst) + suffix;
277
    }
278

  
279
    public static getClaimsAPIURL():string{
280
      if(this.productionMode){
281
        return this.claimsAPIURL_pm;
282
      }else{
283
        return this.claimsAPIURL;
284
      }
285
    }
286
    public static getSearchCrossrefAPIURL():string{
287
        return this.searchCrossrefAPIURL;
288
    }
289
    public static getSearchDataciteAPIURL():string{
290
        return this.searchDataciteAPIURL;
291
    }
292
    public static getSearchOrcidURL():string{
293
        return this.searchOrcidURL;
294
    }
295

  
296
    // Identifiers' getters
297
    public static getPmidURL():string{
298
        return this.pmidURL;
299
    }
300
    public static getDoiURL():string{
301
        return this.doiURL;
302
    }
303
    public static getCordisURL():string{
304
        return this.cordisURL;
305
    }
306
    public static getPmcURL():string{
307
        return this.pmcURL;
308
    }
309
    public static getHandleURL():string{
310
        return this.handleURL;
311
    }
312

  
313
    // Zenodo's getter
314
    public static getZenodoURL():string{
315
        return this.zenodo;
316
    }
317
    // Open access getter
318
    public static getOpenAccess():string{
319
        return this.openAccess;
320
    }
321
    // Open access repository getter
322
    public static getOpenAccessRepo():string{
323
        return this.openAccessRepo;
324
    }
325
    // FP7 link getter
326
    public static getFP7Guidlines():string{
327
        return this.fp7Guidlines;
328
    }
329
    // H2020 link getter
330
    public static getH2020Guidlines():string{
331
        return this.h2020Guidlines;
332
    }
333
    // ERC Guidlines getter
334
    public static getERCGuidlines():string{
335
        return this.ercGuidlines;
336
    }
337
    // helpdesk link getter
338
    public static getHelpdesk():string{
339
        return this.helpdesk;
340
    }
341

  
342

  
343
    //upload service for bulk claim - upload csv file
344
    public static getUploadServiceUrl():string{
345
      if(this.productionMode){
346
        return this.uploadService_pm;
347
      }else{
348
        return this.uploadService;
349
      }
350
    }
351
    //vocabularies API
352
    public static getVocabulariesAPI():string{
353
        return this.vocabulariesAPI;
354
    }
355
    public static getPiwikBaseURL():string{
356
        return this.piwikBaseUrl;
357
    }
358
    public static isPiwikTrackEnabled():boolean{
359
        return this.enablePiwikTrack;
360
    }
361
    public static getLoginURL():string{
362
      if(this.productionMode){
363
        return this.loginUrl_pm;
364
      }else{
365
        return this.loginUrl;
366
      }
367
    }
368
    public static getLogoutURL():string{
369
      if(this.productionMode){
370
        return this.logoutUrl_pm;
371
      }else{
372
        return this.logoutUrl;
373
      }
374
    }
375
    public static getLogoutOpenaireURL():string{
376
      if(this.productionMode){
377
        return this.logoutOpenaireUrl_pm;
378
      }else{
379
        return this.logoutOpenaireUrl;
380
      }
381
    }
382
    public static getCookieDomain():string{
383
      if(this.productionMode){
384
        return this.cookieDomain_pm;
385
      }else{
386
        return this.cookieDomain;
387
      }
388
    }
389
    public static getFeedbackMail():string{
390
      return this.feedbackmail;
391
  }
392
  public static getHelperPageUrl():string{
393
    return this.helperPageUrl;
394
  }
395
  public static isHelperEnabled():boolean{
396
    return this.enableHelper;
397
  }
398
  public static getCacheUrl():string{
399
    if(this.productionMode){
400
      return this.cache_pm;
401
    }else{
402
      return this.cache;
403
    }
404
  }
405
  public static isCacheEnabled():boolean{
406
    return this.useCache;
407
  }
408
}
409
export class ErrorCodes {
410
  public LOADING = 0;
411
  public DONE = 1;
412
  public NONE = 2;
413
  public ERROR = 3;
414
  public NOT_AVAILABLE = 4;
415
  public OUT_OF_BOUND = 5;
416
  public NOT_FOUND = 6;
417
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/loading.component.ts
1
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
2

  
3
@Component({
4
  selector: 'modal-loading',
5
  template: `
6
  <!--uk-modal="center:true"-->
7
  <div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'"   [open]="!isOpen"    tabindex="-1" role="dialog" >
8
    <div class="uk-modal-dialog" role="">
9
      <!--div class="modal-content"-->
10

  
11
        <div class="uk-modal-body">
12
          <div >
13
          <h3 class="text-center" >{{message}}</h3>
14
          <div class="uk-modal-spinner"></div>
15
          </div>
16
        </div>
17

  
18
      </div>
19
    <!--/div-->
20
  </div>
21
  <!--div   class="uk-modal uk-open" aria-hidden="false" style="display: block; overflow-y: scroll;">
22
                            <div class="uk-modal-dialog" tabindex="">
23
                                <div class="uk-modal-spinner"></div>
24
                            </div>
25
                        </div-->
26
  `,
27
  encapsulation: ViewEncapsulation.None,
28
})
29
/**
30
  * API to an open alert window.
31
  */
32
export class ModalLoading{
33

  
34
@Input() public message:string ="Loading";
35

  
36
  /**
37
    * if the value is true alert will be visible or else it will be hidden.
38
    */
39
  public isOpen:boolean=false;
40
  /**
41
    * Emitted when a ok button was clicked
42
    * or when Ok method is called.
43
    */
44
  @Output() public alertOutput:EventEmitter<any> = new EventEmitter();
45
  constructor( public _elementRef: ElementRef){}
46
  /**
47
       * Opens a alert window creating backdrop.
48
       */
49
  open(){
50
    this.isOpen= true;
51
  }
52

  
53
  close(){
54
    this.isOpen = false;
55
  }
56
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/projectInfo.ts
1
export class ProjectInfo {
2
    acronym: string;
3
    title: string;
4
    callIdentifier: string;
5
    funder: string;
6
    funding: string;
7
    contractNum: string;
8
    startDate: string;
9
    endDate: string;
10
    openAccessMandate: string;
11
    specialClause39: string;
12
    organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>;
13
    url: string;
14
    urlInfo: string;
15

  
16
    //publications: any;
17
    researchData: any;
18
    statistics: any;
19

  
20
    totalPublications: number;
21
    totalDatasets: number;
22
    publicationsStatus: any;
23
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/publicationInfo.ts
1
export class PublicationInfo {
2
    underCurationMessage: boolean;
3
    title: { "name": string, "url": string, "accessMode": string};
4
    authors: string[];
5
    date: string;
6
    dateofacceptance: string;
7
    embargoEndDate: string;
8
    types: string[];
9
    //downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>;   //key is name
10
    //publishedIn: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>;    //key is name
11

  
12
    hostedBy_collectedFrom: {"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}[];
13

  
14
    identifiers: Map<string, string[]>;     //key is the classname
15
    publisher: string;
16
    journal: {"journal": string, "issn": string, "lissn": string};
17
    languages: string[];
18
    subjects: string[];
19
    otherSubjects: Map<string, string[]>;
20
    classifiedSubjects: Map<string, string[]>;          //<class of subject, subjects>
21
    description: string;
22
    //bestaccessright: string;
23
    //collectedFrom: { "name": string, "id": string}[];
24
    projectsProvenanceVocabulary: { "sysimport:crosswalk:repository": string,
25
                                    "sysimport:crosswalk:entityregistry": string,
26
                                    "sysimport:crosswalk:datasetarchive": string,
27
                                    "iis": string,
28
                                    "sysimport:mining:repository": string,
29
                                    "user:claim:pid": string,
30
                                    "user:claim:search": string,
31
                                    "user:claim:datacite": string
32
                                  } = {
33
                                    "sysimport:crosswalk:repository": "Repository",
34
                                    "sysimport:crosswalk:entityregistry": "Repository",
35
                                    "sysimport:crosswalk:datasetarchive": "Repository",
36
                                    "iis": "OpenAIRE",
37
                                    "sysimport:mining:repository": "OpenAIRE",
38
                                    "user:claim:pid": "User",
39
                                    "user:claim:search": "User",
40
                                    "user:claim:datacite": "User"
41
                                  };
42
    fundedByProjects: { "id": string, "acronym": string, "title": string,
43
                        "funderShortname": string, "funderName": string,
44
                        "funding": string, "code": string, "provenanceAction": string,
45
                        "inline": boolean}[];
46
    bioentities: Map<string, Map<string, string>>;      //<site name, <>>
47
    software: { "name": string, "url": string}[];      //<site name, <>>
48
    //relatedPublications: { "name": string, "url": string, "date": string, "trust": number}[];
49
    //relatedResearchData: { "name": string, "url": string, "date": string, "trust": number}[];
50
    //similarPublications: {"name": string, "url": string, "date": string, "trust": number}[];
51
    //similarDatasets: {"name": string, "url": string, "date": string, "trust": number}[];
52
    researchResultsProvenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
53
    relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "trust": number, "class": string}[]>;
54
    similarResearchResults: { "name": string, "id": string, "date": string, "trust": number, "class": string}[];
55
    references: { "name": string, "url": string}[];
56
    contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
57
    organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[];
58
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/metrics.ts
1
export class Metrics {
2
    totalDownloads: string;
3
    totalViews: string;
4
    totalOpenaireViews: string;
5
    totalOpenaireDownloads: string;
6
    pageViews: string;
7
    infos: Map<string, {"name": string, "url": string, "numOfDownloads": string, "numOfViews": string, "openaireDownloads": string, "openaireViews": string}>;
8
}
modules/uoa-services-library/trunk/ng-openaire-library/webpack.server.config.js
1
// Work around for https://github.com/angular/angular-cli/issues/7200
2

  
3
const path = require('path');
4
const webpack = require('webpack');
5

  
6
module.exports = {
7
  entry: {
8
    // This is our Express server for Dynamic universal
9
    server: './server.ts',
10
    // This is an example of Static prerendering (generative)
11
    prerender: './prerender.ts'
12
  },
13
  target: 'node',
14
  resolve: { extensions: ['.ts', '.js'] },
15
  // Make sure we include all node_modules etc
16
  externals: [/(node_modules|main\..*\.js)/,],
17
  output: {
18
    // Puts the output at the root of the dist folder
19
    path: path.join(__dirname, 'dist'),
20
    filename: '[name].js'
21
  },
22
  module: {
23
    rules: [
24
      { test: /\.ts$/, loader: 'ts-loader' }
25
    ]
26
  },
27
  plugins: [
28
    new webpack.ContextReplacementPlugin(
29
      // fixes WARNING Critical dependency: the request of a dependency is an expression
30
      /(.+)?angular(\\|\/)core(.+)?/,
31
      path.join(__dirname, 'src'), // location of your src
32
      {} // a map of your routes
33
    ),
34
    new webpack.ContextReplacementPlugin(
35
      // fixes WARNING Critical dependency: the request of a dependency is an expression
36
      /(.+)?express(\\|\/)(.+)?/,
37
      path.join(__dirname, 'src'),
38
      {}
39
    )
40
  ]
41
}
42
  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/selectModal.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
 import {ModalSelect} from './selectModal.component';
6
import {ModalModule} from './modal.module';
7

  
8
//helpers
9

  
10
@NgModule({
11
  imports: [ CommonModule, FormsModule,ModalModule  ],
12
  declarations: [
13
    ModalSelect
14
  ],
15
  exports: [
16
   ModalSelect
17
  ]
18
})
19
export class SelectModalModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/publication.ts
1
export class Publication {
2
  title: string;
3
  publisher: string;
4
  DOI: string;
5
  source: string;
6
  type: string;
7
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/alertModal.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
import {AlertModal} from './alert';
6
import {ModalModule} from './modal.module';
7

  
8
@NgModule({
9
  imports: [ CommonModule, FormsModule, ModalModule ],
10
  declarations: [
11
    AlertModal
12
  ],
13
  exports: [
14
    AlertModal
15
  ]
16
})
17
export class AlertModalModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/autoComplete.component.css
1
.auto-complete-box{
2
}
3
.custom-autocomplete{
4
  vertical-align: top;
5
}
6
.custom-autocomplete .suggestions,.custom-autocomplete  .messages{
7
  position:absolute;
8
  z-index: 1000;
9
  top: 25px;
10
}
11
.auto-complete-choice .remove {
12
  cursor: pointer;
13
}
14
.auto-complete-choice{
15
  background: white none repeat scroll 0 0;
16
  border-color: gray;
17
  border-radius: 5px;
18
  border-style: solid;
19
  border-width: thin;
20
  color: grey;
21
  margin: 3px;
22
  padding: 7px;
23
}
24
.auto-complete-input {
25
  border-radius:0;
26
  border-color: white;
27
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
28
  margin-left: 5px;
29
}
30
.form-control .auto-complete-input {
31
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
32
}
33
.auto-complete-box .suggestions .list-group-item, .custom-autocomplete .suggestions .list-group-item {
34
    padding: 5px 10px;
35
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/metaTags/openaireMetaTags.class.ts
1
import {Meta} from '../../../angular2-meta';
2

  
3
export class OpenaireMetaTags{
4

  
5
  constructor (private _meta: Meta ) {
6
  }
7

  
8
  updateDescription(description:string){
9
    this._meta.updateMeta("description", description);
10
    this._meta.updateProperty("og:description", description);
11
  }
12
  updateTitle(title:string){
13
    var _prefix ="OpenAIRE | ";
14
    var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
15
    this._meta.setTitle(_title );
16
    this._meta.updateProperty("og:title",_title);
17
  }
18
  updateUrl(url:string){
19
    this._meta.updateProperty("og:url", url);
20
  }
21
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
import {EntitiesAutocompleteComponent} from './entitiesAutoComplete.component';
6
import {EntitySearchServiceModule} from './entitySearchService.module';
7

  
8

  
9
@NgModule({
10
  imports: [
11
    CommonModule, FormsModule, EntitySearchServiceModule
12
  ],
13
  declarations: [
14
     EntitiesAutocompleteComponent
15
  ],
16
  exports: [
17
      EntitiesAutocompleteComponent
18
    ],
19
    providers:[ ]
20
})
21
export class EntitiesAutocompleteModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/properties/searchFields.ts
1
export class SearchFields {
2
    //main Entities
3
    //RESULTS
4
    //Used for datasets and publications
5
    //In case Datasets should display  different fields, use seperate tables for fields
6
    public RESULT_REFINE_FIELDS = [
7
      "relfunder",
8
    "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
9
    "relproject","resultacceptanceyear",
10
   "resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource"];
11

  
12
     public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","resultauthor","resultpublisher","instancetypename",
13
     "resultlanguagename", "community","relprojectid", "relfunder",
14
     "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
15
     "resultdateofacceptance","resultbestaccessright","pid","resulthostingdatasourceid","collectedfromdatasourceid", "relorganizationid"];
16
          public RESULT_FIELDS: { [key:string]:FieldDetails}={
17
           ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
18
         ["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
19
         ["resultauthor"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
20
         ["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
21
         ["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
22
         ["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
23
         ["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", equalityOperator: " exact "},
24
         ["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
25
        //  ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
26
         ["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
27
        //  ["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
28
         ["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
29
         ["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
30
         ["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
31
         ["relfunder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
32
         ["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
33
         ["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
34
         ["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
35
         ["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", equalityOperator: " exact "},
36
         ["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", equalityOperator: " within "},
37
         ["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
38
        //  ["resultbestaccessright"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
39
         ["collectedfrom"]:{name:"Content Provider", type:"refine", param:"datasource", equalityOperator: " exact "},
40
         ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
41
         ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
42
                };
43

  
44
      //PROJECT
45

  
46
      public PROJECT_REFINE_FIELDS:string[] =  ["funder","fundinglevel0_id","fundinglevel1_id",
47
      "fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
48
    public PROJECT_ADVANCED_FIELDS:string[] =  ["q","projectacronym","projecttitle","projectkeywords",
49
    "funder",  "fundinglevel0_id","fundinglevel1_id",  "fundinglevel2_id",
50
    "projectstartdate","projectenddate","projectecsc39",
51
    "projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
52
    public PROJECT_FIELDS: { [key:string]:FieldDetails}={
53
       ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
54
       ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
55
       ["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
56
       ["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
57

  
58
       ["funder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
59
       ["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
60
       ["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
61
       ["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
62
       ["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", equalityOperator: " exact "},
63
       ["projectendyear"]:{name:"End Year", type:"year", param:"endyear", equalityOperator: " exact "},
64
       ["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", equalityOperator: " within "},
65
       ["projectenddate"]:{name:"End Date", type:"date", param:"enddate", equalityOperator: " within "},
66
       ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
67
       ["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
68
       ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
69
       ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
70

  
71
     };
72

  
73
       //DATAPROVIDERS
74

  
75
       public DATASOURCE_REFINE_FIELDS:string[] =  ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
76
         "datasourcecompatibilityname"];
77
         public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
78
         "datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
79
         "datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
80

  
81
         public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
82
              ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
83
              ["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
84
              ["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
85
              ["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
86
              ["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
87
              ["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
88
              ["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
89
              ["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
90
              ["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
91
              ["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
92
              ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
93
              ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
94
              ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
95
            };
96

  
97
          public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
98
          public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
99
          public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
100

  
101
         //ORGANIZATION
102

  
103
         public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
104
     public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","organizationcountryname"];
105

  
106
     public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
107
                ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
108
                ["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
109
                ["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
110
                ["organizationcountryname"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
111
              //  ["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
112
              };
113
         public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
114
        public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
115
           public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
116
            ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
117
          public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
118
          ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
119
          ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
120
          ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
121
          ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", equalityOperator: " exact "},
122
          ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
123

  
124
          };
125

  
126

  
127

  
128
     public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
129
     "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
130

  
131
     public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
132
     ["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
133
     ["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
134

  
135

  
136
      public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
137

  
138
     constructor (){
139
     }
140
     getFieldName(fieldId:string,fieldType:string):string{
141
       if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software"){
142
         return this.RESULT_FIELDS[fieldId].name;
143
       }else if(fieldType == "project"){
144
         return this.PROJECT_FIELDS[fieldId].name;
145
       }else if(fieldType == "organization"){
146
         return this.ORGANIZATION_FIELDS[fieldId].name;
147
       }else if(fieldType == "datasource" || fieldType == "dataprovider"){
148
         return this.DATASOURCE_FIELDS[fieldId].name;
149
       }else{
150
         return "UNDEFINED";
151
       }
152
     }
153
}
154
export class FieldDetails{
155
   name:string;
156
     type:string;
157
      param:string;
158
       equalityOperator:string;
159
 }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/selectModal.component.ts
1
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
2

  
3
@Component({
4
  selector: 'modal-select',
5
  template: `
6
  <div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'"   [open]="!isOpen"  uk-modal="center:true" tabindex="-1" role="dialog" >
7
    <div class="uk-modal-dialog" role="">
8
      <div class="modal-content">
9

  
10
        <div class="modal-body">
11
          <div >
12
          <h3 class="text-center" >{{message}}</h3>
13
          <!--div class="uk-button-default -select uk-active" data--select="">
14
            <span class=""></span>
15
            <i class="uk-icon-caret-down"></i>
16
            <select (change)="selected=$event.target.value">
17
                <option *ngFor="let option of options" value="option">aa</option>
18
            </select>
19
          </div-->
20

  
21
          <div class="-select" data--select>
22
            <span></span>
23
            <select (change)="selected=$event.target.value">
24
                <option *ngFor="let option of options let i=index" value="{{option}}">{{option}}</option>
25
            </select>
26
          </div>
27

  
28
          <div class="uk-modal-footer uk-text-right">
29
            <button class=" uk-button uk-button-default" (click)="close()">Proceed</button>
30
          </div>
31
        </div>
32

  
33
      </div>
34
    </div>
35
  </div>
36
  <!--div   class="uk-modal uk-open" aria-hidden="false" style="display: block; overflow-y: scroll;">
37
                            <div class="uk-modal-dialog" tabindex="">
38
                                <div class="uk-modal-spinner"></div>
39
                            </div>
40
                        </div-->
41
  `,
42
  encapsulation: ViewEncapsulation.None,
43
})
44
/**
45
  * API to an open alert window.
46
  */
47
export class ModalSelect{
48

  
49
@Input() public message:string ="Loading";
50
@Input() public options:string[] = [];
51

  
52
public selected: string;
53

  
54
  /**
55
    * if the value is true alert will be visible or else it will be hidden.
56
    */
57
  public isOpen:boolean=false;
58
  /**
59
    * Emitted when a ok button was clicked
60
    * or when Ok method is called.
61
    */
62
  @Output() public alertOutput:EventEmitter<any> = new EventEmitter();
63
  constructor( public _elementRef: ElementRef){}
64
  /**
65
       * Opens a alert window creating backdrop.
66
       */
67
  open(){
68
    this.isOpen= true;
69
  }
70

  
71
  close(){
72
    this.isOpen = false;
73
    if(!this.selected) {
74
      this.selected = this.options[0];
75
    }
76
    this.alertOutput.emit(this.selected);
77
  }
78

  
79
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/modal.module.ts
1
/*  common components of modal components */
2
import { NgModule } from '@angular/core';
3
import {Open} from './open.component';
4
@NgModule({
5
  imports: [  ],
6
  declarations: [
7
      Open
8
  ],
9
  exports: [
10
    Open
11
  ]
12
})
13
export class ModalModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entitiesAutoComplete/entitySearchService.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
 import {EntitiesSearchService} from './entitySearch.service';
6

  
7

  
8
@NgModule({
9
  imports: [
10
    CommonModule, FormsModule
11
  ],
12
  declarations: [
13
   ],
14
  exports: [
15
     ],
16
    providers:[ EntitiesSearchService]
17
})
18
export class EntitySearchServiceModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/configuration/configurationService.module.ts
1
import { NgModule}            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4
import { SharedModule } from '../../shared/shared.module';
5
import { RouterModule } from '@angular/router';
6
import { ConfigurationService } from './configuration.service';
7

  
8

  
9
@NgModule({
10
  imports: [
11
    SharedModule,
12
     CommonModule
13

  
14
    ],
15
  providers:[ ConfigurationService]
16

  
17
})
18
export class ConfigurationServiceModule {
19
  static forRoot() {
20
    return {
21
      ngModule: ConfigurationServiceModule,
22
      providers: [ ConfigurationService ]
23
    }
24
  }
25
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/alert.ts
1
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
2
// import { DynamicComponentLoader} from '@angular/core';
3

  
4
import {Open} from './open.component';
5

  
6
@Component({
7
  selector: 'modal-alert',
8
  template: `
9
  <div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" uk-modal  [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
10
    <div class="uk-modal-dialog  uk-modal-body" role="">
11
         <div class="uk-modal-title" [hidden]=!alertHeader>
12
        <a href="" class="uk-modal-close uk-close uk-float-right" (click)='cancel()' ></a>
13
           <h4 class="modal-title text-center" id="myModalLabel">{{alertTitle}}</h4>
14
        </div>
15
        <div class="uk-margin  ">
16
          <div [hidden]=!alertMessage>
17
          {{message}}
18
          </div>
19
        </div>
20
        <div class="  uk-text-right" [hidden]=!alertFooter>
21
        <span [hidden]=!okButton >
22
          <button class=" uk-button uk-button-default  " (click)="ok()">{{okButtonText}}</button>
23
          </span>
24
          <span [hidden]=!cancelButton>
25
          <button class=" uk-button uk-button-default" (click)="cancel()">{{cancelButtonText}}</button>
26
          </span>
27
        </div>
28

  
29
    </div>
30
  </div>
31

  
32

  
33
  `,
34
  encapsulation: ViewEncapsulation.None,
35
})
36
/**
37
  * API to an open alert window.
38
  */
39
export class AlertModal{
40
  /**
41
     * Caption for the title.
42
     */
43
  public alertTitle:string;
44
  /**
45
     * Describes if the alert contains Ok Button.
46
     * The default Ok button will close the alert and emit the callback.
47
     * Defaults to true.
48
     */
49
  public okButton:boolean = true;
50
  /**
51
     * Caption for the OK button.
52
     * Default: Ok
53
     */
54
  public okButtonText:string= 'Ok';
55
  /**
56
     * Describes if the alert contains cancel Button.
57
     * The default Cancelbutton will close the alert.
58
     * Defaults to true.
59
     */
60
  public cancelButton:boolean = true;
61
  /**
62
     * Caption for the Cancel button.
63
     * Default: Cancel
64
     */
65
  public cancelButtonText:string = 'Cancel';
66
  /**
67
     * if the alertMessage is true it will show the contentString inside alert body.
68
     */
69
  public alertMessage:boolean = true;
70
  /**
71
     * Some message/content can be set in message which will be shown in alert body.
72
     */
73
  public message:string;
74
  /**
75
    * if the value is true alert footer will be visible or else it will be hidden.
76
    */
77
  public alertFooter:boolean= true;
78
  /**
79
    * shows alert header if the value is true.
80
    */
81
  public alertHeader:boolean = true;
82
  /**
83
    * if the value is true alert will be visible or else it will be hidden.
84
    */
85
  public isOpen:boolean=false;
86
  /**
87
    * Emitted when a ok button was clicked
88
    * or when Ok method is called.
89
    */
90
  @Output() public alertOutput:EventEmitter<any> = new EventEmitter();
91
  constructor( public _elementRef: ElementRef){}
92
  /**
93
       * Opens a alert window creating backdrop.
94
       */
95
  open(){
96
    this.isOpen= true;
97
  }
98
  /**
99
     *  ok method closes the modal and emits modalOutput.
100
     */
101
  ok(){
102
    this.isOpen = false;
103
    this.alertOutput.emit(true);
104
  }
105
  /**
106
     *  cancel method closes the moda.
107
     */
108
  cancel(){
109
    this.isOpen = false;
110
  }
111
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/string-utils.class.ts
1
export class Dates {
2
  public static isValidYear(yearString){
3
    // First check for the pattern
4
    if(!/^\d{4}$/.test(yearString))
5
        return false;
6
        var year = parseInt(yearString, 10);
7

  
8
        // Check the ranges of month and year
9
        if(year < 1000 || year > 3000 )
10
            return false;
11
        return true;
12
  }
13
  //format YYYY-MM-DD
14
  public static isValidDate(dateString:string)
15
  {
16
      // First check for the pattern
17
      if(!/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(dateString))
18
          return false;
19

  
20
      // Parse the date parts to integers
21
      var parts = dateString.split("-");
22
      var day = parseInt(parts[2], 10);
23
      var month = parseInt(parts[1], 10);
24
       var year = parseInt(parts[0], 10);
25
      if(!this.isValidYear(parts[0])){
26
        return false;
27
      }
28

  
29
      // Check the ranges of month and year
30
      if( month == 0 || month > 12)
31
          return false;
32

  
33
      var monthLength = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
34

  
35
      // Adjust for leap years
36
      if(year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
37
          monthLength[1] = 29;
38

  
39
      // Check the range of the day
40
      return day > 0 && day <= monthLength[month - 1];
41

  
42
  }
43
  public static getDateToday():Date{
44
    var myDate = new Date();
45
    return myDate;
46

  
47
  }
48
  public static getDateToString(myDate:Date):string{
49
    var date:string = myDate.getFullYear()+ "-" ;
50
     date+=((myDate.getMonth() + 1)<10)?"0"+(myDate.getMonth() + 1):(myDate.getMonth() + 1) ;
51
     date+="-";
52
     date+=  (myDate.getDate() <10 )? "0"+myDate.getDate():myDate.getDate() ;
53
     return date;
54

  
55
  }
56
  public static getDateXMonthsAgo(x:number):Date{
57
    var myDate = new Date();
58
    myDate.setMonth(myDate.getMonth() - x);
59
    return myDate;
60

  
61
  }
62
  public static getDateXYearsAgo(x:number):Date{
63
    var myDate = new Date();
64
    myDate.setFullYear(myDate.getFullYear() - x);
65
    return myDate;
66

  
67
  }
68
  public static getDateFromString(date:string):Date{
69

  
70
    var myDate = new Date();
71
    myDate.setFullYear(+date.substring(0,4));
72
    myDate.setMonth(+date.substring(5,7)-1);
73
    myDate.setDate(+date.substring(8,11))
74
    return myDate;
75

  
76
  }
77

  
78
}
79

  
80
export class DOI{
81

  
82
  public static getDOIsFromString(str:string):string[]{
83
    var DOIs:string[] = [];
84
    var words:string[] = str.split(" ");
85

  
86
    for(var i=0; i< words.length; i++){
87
        if(DOI.isValidDOI(words[i]) && DOIs.indexOf(words[i]) == -1){
88
          DOIs.push(words[i]);
89
        }
90
    }
91
    return DOIs;
92
  }
93
  public static isValidDOI(str:string):boolean{
94

  
95
      var exp1 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g
96
      var exp2 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])[[:graph:]])+)\b/g
97
      if(str.match(exp1)!=null || str.match(exp2)!=null){
98
        // console.log("It's a DOI");
99
        return true;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff