Project

General

Profile

« Previous | Next » 

Revision 46223

Bug fixed: Lazy routing disabled in datasources tab of dataprovider landing page (parameter lazy=false in searchResults page) | Organization landing page: added publications report (csv) | Organization landing page: query updated (more restricted, using /resources instead of /organizations) | comment onChanges function in tabs component of dataprovider landing page

View differences:

modules/uoa-services-portal/trunk/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
123 123
      this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
124 124
          data => {
125 125
              this.searchUtils.totalResults = data[0];
126
              console.info(this.searchUtils.totalResults + " i think we got results");
127 126

  
128 127
              console.info("search Publications for "+entity+": [Parameters:"+parameters+" ]  [total results:"+this.searchUtils.totalResults+"]");
129 128
              this.results = data[1];
modules/uoa-services-portal/trunk/portal-2/src/app/services/reports.service.ts
19 19
     return this.http.get(url)
20 20
               .map(res => new Blob([res['_body']], { type: 'text/csv' }));
21 21
   }
22
   getCSVResponse(url: string){
23
     var headers = new Headers();
24
     headers.append('responseType', 'arraybuffer');
25
     return this.http.get(url)
26
                .map(res => res['_body']);
27
   }
22 28
   downloadHTMLFile(url: string, info: string){
23 29
     var headers = new Headers();
24 30
     headers.append('responseType', 'arraybuffer');
25
     return this.http.get(url)//.do(res => console.log(res['_body']))
31
     return this.http.get(url)
26 32
                .map(res => this.addInfo(res, info))
27 33
                .map(res => new Blob([res['_body']], { type: 'text/html' }))
28 34
                .do(res => console.log(res))
modules/uoa-services-portal/trunk/portal-2/src/app/services/organization.service.ts
17 17

  
18 18
    getOrganizationInfo (id: string):any {
19 19
        console.info("getOrganizationInfo in service");
20

  
21
        let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
20
        //let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
21
        let url = OpenaireProperties.getSearchAPIURLLast()+'resources?format=json&query=( (oaftype exact organization) 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 ( objIdentifier ='+id+')';
22
        //let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/resources?format=json&query=(%20(oaftype%20exact%20organization)%20and%20(reldatasourcecompatibilityid=driver%20or%20reldatasourcecompatibilityid=driver-openaire2.0%20or%20reldatasourcecompatibilityid=openaire2.0%20or%20reldatasourcecompatibilityid=openaire3.0%20or%20reldatasourcecompatibilityid=openaire2.0_data%20or%20reldatasourcecompatibilityid=hostedBy%20or%20relprojectid=*))%20and%20(%20objIdentifier%20=dedup_wf_001%3A%3Af1e63493def7cedfa5b497cdbea26faa)";
22 23
        let key = url;
23 24
        if (this._cache.has(key)) {
24 25
          return Observable.of(this._cache.get(key)).map(res => this.parseOrganizationInfo(res));
......
26 27

  
27 28
        return this.http.get(url)
28 29
                    .map(res => <any> res.json())
29
                    .map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
30
                    .map(res => [res, res['rels']['rel']])
30
                    .map(res => res['results'][0])
31
                    //.map(res => res[0]['result']['metadata']['oaf:entity']['oaf:organization'])
32
                    //.map(res => [res, res['rels']['rel']])
31 33
                    .do(res => {
32 34
                      this._cache.set(key, res);
33 35
                    })
......
63 65
        console.info("parseOrganizationInfo");
64 66
        this.organizationInfo = new OrganizationInfo();
65 67

  
66
        let mydata;
68
        let organization;
69
        let relations;
67 70

  
68
        if(data[0] != null) {
69
            mydata = data[0];
71
        if(data != null) {
72
            organization = data['result']['metadata']['oaf:entity']['oaf:organization'];
73
            relations = data['result']['metadata']['oaf:entity']['oaf:organization']['rels']['rel'];
74
        } else {
75
            return null;
76
        }
70 77

  
71
            if(mydata.hasOwnProperty("websiteurl")) {
72
                this.organizationInfo.title = {"name": mydata.legalshortname, "url": mydata.websiteurl};
78
        if(organization != null) {
79

  
80
            if(organization.hasOwnProperty("websiteurl")) {
81
                this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
73 82
            } else {
74
                this.organizationInfo.title = {"name": mydata.legalshortname, "url": ''};
83
                this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
75 84
            }
76 85

  
77
            this.organizationInfo.name = mydata.legalname;
86
            this.organizationInfo.name = organization.legalname;
78 87

  
79 88
            if(this.organizationInfo.title.name == '') {
80 89
                this.organizationInfo.title.name = this.organizationInfo.name;
81 90
            }
82 91

  
83
            if(mydata.hasOwnProperty("country")) {
84
                this.organizationInfo.country = mydata['country'].classname;
92
            if(organization.hasOwnProperty("country")) {
93
                this.organizationInfo.country = organization['country'].classname;
85 94
            }
86 95
        }
87 96

  
88
        if(data[1] != null) {
97
        if(relations != null) {
89 98
            let counter;
90
            let length = data[1].length!=undefined ? data[1].length : 1;
99
            let length = relations.length!=undefined ? relations.length : 1;
91 100

  
92 101
            for(let i=0; i<length; i++) {
93
                mydata = data[1].length!=undefined ? data[1][i] : data[1];
94
                if(mydata.hasOwnProperty("to")) {
95
                    if(mydata['to'].class == "isParticipant") {
96
                        if(mydata.hasOwnProperty("funding")) {
97
                            if(mydata['funding'].hasOwnProperty("funder")) {
102
                let relation = relations.length!=undefined ? relations[i] : relations;
103
                if(relation.hasOwnProperty("to")) {
104
                    if(relation['to'].class == "isParticipant") {
105
                        if(relation.hasOwnProperty("funding")) {
106
                            if(relation['funding'].hasOwnProperty("funder")) {
98 107
                                if(this.organizationInfo.projects == undefined) {
99 108
                                    this.organizationInfo.projects = new Map<string,
100 109
                                        { "name": string, "id": string, "code": string,
......
103 112
                                          "sc39": string, "startDate": string, "endDate": string }[]>();
104 113
                                }
105 114

  
106
                                if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) {
107
                                    this.organizationInfo.projects.set(mydata['funding']['funder'].name,
115
                                if(!this.organizationInfo.projects.has(relation['funding']['funder'].name)) {
116
                                    this.organizationInfo.projects.set(relation['funding']['funder'].name,
108 117
                                        new Array<{ "name": string, "id": string, "code": string,
109 118
                                                    "acronym": string, "funder": string, "funderId": string,
110 119
                                                    "fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
111 120
                                                    "sc39": string, "startDate": string, "endDate": string }>());
112 121
                                }
113 122

  
114
                                counter = this.organizationInfo.projects.get(mydata['funding']['funder'].name).length;
115
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter] =
123
                                counter = this.organizationInfo.projects.get(relation['funding']['funder'].name).length;
124
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter] =
116 125
                                    { "name": "", "id": "", "code": "",
117 126
                                      "acronym": "", "funder": "", "funderId": "",
118 127
                                      "fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
119 128
                                      "sc39": "", "startDate": "", "endDate": "" };
120 129

  
121 130
                                //let url = "";
122
                                if(mydata['to'].content != null && mydata['to'].content != "") {
123
                                    this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['id'] = mydata['to'].content;
124
                                    //url = OpenaireProperties.getsearchLinkToProject()+mydata['to'].content;
131
                                if(relation['to'].content != null && relation['to'].content != "") {
132
                                    this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['id'] = relation['to'].content;
133
                                    //url = OpenaireProperties.getsearchLinkToProject()+relation['to'].content;
125 134
                                }
126
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['name'] = mydata.title;
127
                                //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['url'] = url;
128
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['code'] = mydata.code;
129
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['acronym'] = mydata.acronym;
135
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['name'] = relation.title;
136
                                //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['url'] = url;
137
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['code'] = relation.code;
138
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['acronym'] = relation.acronym;
130 139

  
131
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funder'] = mydata['funding']['funder'].shortname;
132
                                this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funderId'] = mydata['funding']['funder'].id;
133
                                if(mydata['funding'].hasOwnProperty("funding_level_0")) {
134
                                    this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingStream'] = mydata['funding']['funding_level_0'].name;
140
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funder'] = relation['funding']['funder'].shortname;
141
                                this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funderId'] = relation['funding']['funder'].id;
142
                                if(relation['funding'].hasOwnProperty("funding_level_0")) {
143
                                    this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingStream'] = relation['funding']['funding_level_0'].name;
135 144
                                }
136
                                if(mydata['funding'].hasOwnProperty("funding_level_1")) {
137
                                    this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel1'] = mydata['funding']['funding_level_1'].name;
145
                                if(relation['funding'].hasOwnProperty("funding_level_1")) {
146
                                    this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel1'] = relation['funding']['funding_level_1'].name;
138 147
                                }
139
                                if(mydata['funding'].hasOwnProperty("funding_level_2")) {
140
                                    this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel2'] = mydata['funding']['funding_level_2'].name;
148
                                if(relation['funding'].hasOwnProperty("funding_level_2")) {
149
                                    this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel2'] = relation['funding']['funding_level_2'].name;
141 150
                                }
142
                                //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['sc39'] =
143
                                //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['startDate'] =
144
                                //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['endDate'] =
151
                                //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['sc39'] =
152
                                //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['startDate'] =
153
                                //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
145 154
                            }
146 155
                        }
147
                    } /*else if(mydata['to'].class == "isProvidedBy") {
156
                    } /*else if(relation['to'].class == "isProvidedBy") {
148 157
                        if(this.organizationInfo.dataProviders == undefined) {
149 158
                            this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
150 159
                        }
......
153 162
                        this.organizationInfo.dataProviders[counter] = { "name": "", "url": "", "type": "", "websiteUrl": "", "organizations": [] }
154 163

  
155 164
                        let url="";
156
                        if(mydata['to'].content != null && mydata['to'].content != "") {
157
                            url = OpenaireProperties.getsearchLinkToDataProvider()+mydata['to'].content;
165
                        if(relation['to'].content != null && relation['to'].content != "") {
166
                            url = OpenaireProperties.getsearchLinkToDataProvider()+relation['to'].content;
158 167
                        }
159
                        this.organizationInfo.dataProviders[counter]['name'] = mydata.officialname;
168
                        this.organizationInfo.dataProviders[counter]['name'] = relation.officialname;
160 169
                        this.organizationInfo.dataProviders[counter]['url'] = url;
161
                        if(mydata.hasOwnProperty("datasourcetype")) {
162
                            this.organizationInfo.dataProviders[counter]['type'] = mydata['datasourcetype'].classname;
170
                        if(relation.hasOwnProperty("datasourcetype")) {
171
                            this.organizationInfo.dataProviders[counter]['type'] = relation['datasourcetype'].classname;
163 172
                        }
164
                        this.organizationInfo.dataProviders[counter]['websiteUrl'] = mydata.websiteurl;
173
                        this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
165 174
                    }*/
166 175
                }
167 176
            }
modules/uoa-services-portal/trunk/portal-2/src/app/services/searchPublications.service.ts
426 426
        }
427 427
        return this.http.get(url)
428 428
                    .map(res => <any> res.json())
429
                    .map(res => res.total).do(res => {
429
                    .map(res => res.total)
430
                    .do(res => {
430 431
                      this._cache.set(key, res);
431 432
                    });
432 433
    }
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts
16 16
            <h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >
17 17
                <!--a href="{{result['title'].url}}"-->
18 18
                <!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
19
                <a *ngIf="lazy" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
19

  
20
                <a *ngIf="lazy=='true'" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
20 21
                    <p *ngIf="result['title'].name != undefined && result['title'].name != ''"
21 22
                        [innerHTML]="result['title'].name">
22 23
                    </p>
......
24 25
                        {{result['title'].url}}
25 26
                    </p>
26 27
                </a>
27
                <a *ngIf="!lazy" href="/search/{{type}}?{{urlParam}}={{result.id}}">
28

  
29
                <a *ngIf="lazy=='false'" href="/search/{{type}}?{{urlParam}}={{result.id}}">
28 30
                    <p *ngIf="result['title'].name != undefined && result['title'].name != ''"
29 31
                        [innerHTML]="result['title'].name">
30 32
                    </p>
......
143 145
    @Input() type: string;
144 146
    @Input() urlParam: string;
145 147
    @Input() showLoading: boolean = false;
146
    @Input() lazy: boolean = true;
148
    @Input() lazy: string = "true";
147 149

  
148 150
    public errorCodes:ErrorCodes = new ErrorCodes();
149 151
    public routerHelper:RouterHelper = new RouterHelper();
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/dataProvider/tabs.component.ts
296 296
    }
297 297

  
298 298
    ngOnInit() {
299

  
300
    }
301

  
302
    ngOnChanges() {
303
        console.info("on changes dataprovider tabs");
304 299
        if(this.tabs != undefined && this.tabs.length > 0) {
305
            /*if(typeof document !== undefined) {
306
                let element = document.getElementById(this.tabs[0].content);
307
                if(element != null) {
308
                    element.className = "uk-active";
309
                    element.setAttribute("aria-expanded", "true");
310
                }
311

  
312
                let element2 = document.getElementById("firstTab-content");
313
                if(element2 != null) {
314
                    element2.className = "uk-active";
315
                    element2.setAttribute("aria-hidden", "false");
316
                }
317
            }*/
318

  
319 300
            this.reloadPublications = true;
320 301
            this.reloadDatasets = true;
321 302
            this.reloadProjects = true;
......
335 316
            this.pubsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
336 317
            this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
337 318
            this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
319

  
338 320
        }
339 321

  
340 322
        if(this.resultsBy == "collectedFrom") {
......
344 326
        }
345 327
    }
346 328

  
329
    // ngOnChanges() {
330
    //     console.info("on changes dataprovider tabs");
331
    //     if(this.tabs != undefined && this.tabs.length > 0) {
332
    //         /*if(typeof document !== undefined) {
333
    //             let element = document.getElementById(this.tabs[0].content);
334
    //             if(element != null) {
335
    //                 element.className = "uk-active";
336
    //                 element.setAttribute("aria-expanded", "true");
337
    //             }
338
    //
339
    //             let element2 = document.getElementById("firstTab-content");
340
    //             if(element2 != null) {
341
    //                 element2.className = "uk-active";
342
    //                 element2.setAttribute("aria-hidden", "false");
343
    //             }
344
    //         }*/
345
    //
346
    //         this.reloadPublications = true;
347
    //         this.reloadDatasets = true;
348
    //         this.reloadProjects = true;
349
    //         this.reloadDataproviders = true;
350
    //     	this.reloadRelatedDatasources = true;
351
    //         this.statsClicked = false;
352
    //
353
    //         this.search(this.tabs[0].content, 1, 10);
354
    //         this.count(1, 0);
355
    //
356
    //         this.metricsClicked = false;
357
    //         this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.id+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.id+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
358
    //         this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.id+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
359
    //
360
    //         this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.id+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250';
361
    //         this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
362
    //         this.pubsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
363
    //         this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
364
    //         this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
365
    //     }
366
    //
367
    //     if(this.resultsBy == "collectedFrom") {
368
    //         this.paramsForSearchLink = "?collectedFrom="+this.id+"&co=and";
369
    //     } else if (this.resultsBy == "hostedBy") {
370
    //         this.paramsForSearchLink = "?hostedBy="+this.id+"&ho=and";
371
    //     }
372
    // }
373

  
347 374
    private count(page: number, size: number) {
348 375
        console.info("number of tabs: "+this.tabs.length);
349 376

  
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/organization/organization.component.html
156 156
                      </dd>
157 157
                  </dl>
158 158
                </li>
159
              </ul>
160
                <ul *ngIf="organizationInfo.projects != undefined" class="uk-list uk-list-striped">
161
                    <li *ngFor="let key of organizationInfo.projects.keys()">
162
                        <!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
163
                            Download projects report (CSV) for {{key}}
164
                        </a-->
165
                        <span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?size='+organizationInfo.projects.get(key).length+'&'+csvProjectParamsHead+organizationInfo.projects.get(key)[0]['funderId']+csvParamsTail)">
166
                            <span aria-hidden="true" class="glyphicon glyphicon-download"></span>
167
                            <span class="uk-icon-download"> Projects report(CSV) for {{key}}</span>
168
                        </span>
169
                    </li>
170 159

  
171
                    <!--li *ngFor="let key of organizationInfo.projects.keys()">
172
                        <a>
173
                            Download publications report (CSV) for {{key}}
174
                        </a>
175
                    </li-->
176
                </ul>
160
                <ng-container *ngIf="organizationInfo.projects != undefined">
161
                        <li *ngFor="let key of organizationInfo.projects.keys()">
162
                            <!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
163
                                Download projects report (CSV) for {{key}}
164
                            </a-->
165
                            <span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?size='+organizationInfo.projects.get(key).length+'&'+csvProjectParamsHead+organizationInfo.projects.get(key)[0]['funderId']+csvParamsTail)">
166
                                <span aria-hidden="true" class="glyphicon glyphicon-download"></span>
167
                                <span class="uk-icon-download"> Projects report(CSV) for {{key}}</span>
168
                            </span>
169
                        </li>
170

  
171
                        <li *ngFor="let key of organizationInfo.projects.keys()">
172
                            <span class="clickable" (click)="downloadPublicationsFile(key)">
173
                                <span aria-hidden="true" class="glyphicon glyphicon-download"></span>
174
                                <span class="uk-icon-download"> Publications report(CSV) for {{key}}</span>
175
                            </span>
176
                        </li>
177
                </ng-container>
178
            </ul>
177 179
        </div>
178 180
    </div>
179 181
</div>
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/organization/organization.component.ts
4 4
import {OrganizationService} from '../../services/organization.service';
5 5
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
6 6
import {ReportsService} from '../../services/reports.service';
7
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
7
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
8
import {SearchPublicationsService} from '../../services/searchPublications.service';
8 9

  
9
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
10
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
10 11

  
11 12
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
12 13

  
......
39 40
    private linkToSearchDataproviders = "";
40 41

  
41 42
    constructor (private _organizationService: OrganizationService,
42
        private  route: ActivatedRoute,
43
        private _searchDataprovidersService: SearchDataprovidersService,
44
        private _reportsService: ReportsService) {
43
                 private  route: ActivatedRoute,
44
                 private _searchDataprovidersService: SearchDataprovidersService,
45
                 private _reportsService: ReportsService,
46
                 private _searchPublicationsService: SearchPublicationsService) {
45 47

  
46 48
            console.info('organization constructor');
47 49
            this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
......
93 95
        this.warningMessage = '';
94 96
        this.errorMessage=""
95 97

  
96
            this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
97
                data => {
98
        this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
99
            data => {
100
                if(data == null) {
101
                    this.errorMessage = 'No organization found';
102
                } else {
98 103
                    this.organizationInfo = data;
99 104

  
100 105
                    let projectsNum = 0;
......
106 111
                        }.bind(this));
107 112
                    }
108 113
                    this.projectsNum = projectsNum;
109
                },
110
                err => {
111
                    console.log(err)
114
                }
115
            },
116
            err => {
117
                console.log(err)
112 118

  
113
                    this.errorMessage = 'No organization found';
114
                }
115
            );
116
        }
119
                this.errorMessage = 'No organization found';
120
            }
121
        );
122
    }
117 123
/*
118
        private getMetrics() {
119
            console.info("getOrganizationMetrics: component");
120
            this._organizationService.getMetrics(this.organizationId).subscribe(
121
             data => {
122
                 this.metrics = data;
123
             },
124
             err => {
125
               console.log(err);
126
             }
127
           );
128
        }
124
    private getMetrics() {
125
        console.info("getOrganizationMetrics: component");
126
        this._organizationService.getMetrics(this.organizationId).subscribe(
127
         data => {
128
             this.metrics = data;
129
         },
130
         err => {
131
           console.log(err);
132
         }
133
       );
134
    }
129 135
*/
130
        private handleClick(funder: string) {
131
             if(this.emptyFundersSet) {
132
                 this.fundersSet.clear();
133
                 this.emptyFundersSet = false;
134
             }
136
    private handleClick(funder: string) {
137
         if(this.emptyFundersSet) {
138
             this.fundersSet.clear();
139
             this.emptyFundersSet = false;
140
         }
135 141

  
136
             if(this.fundersSet.has(funder)) {
137
                 this.fundersSet.delete(funder);
142
         if(this.fundersSet.has(funder)) {
143
             this.fundersSet.delete(funder);
138 144

  
139
                 if(this.fundersSet.size == 0) {
140
                     this.organizationInfo.projects.forEach(function (value, key, map) {
141
                         this.fundersSet.add(key);
142
                     }.bind(this));
143
                     this.emptyFundersSet = true;
144
                 }
145
                 console.info(funder+" funder deleted");
146
             } else {
147
                 this.fundersSet.add(funder);
148
                 console.info(funder+" funder added");
145
             if(this.fundersSet.size == 0) {
146
                 this.organizationInfo.projects.forEach(function (value, key, map) {
147
                     this.fundersSet.add(key);
148
                 }.bind(this));
149
                 this.emptyFundersSet = true;
149 150
             }
151
             console.info(funder+" funder deleted");
152
         } else {
153
             this.fundersSet.add(funder);
154
             console.info(funder+" funder added");
150 155
         }
156
     }
151 157

  
152
         //private getProjectsData(key: string): any {
153
             //return this.projectsData;
154
         //}
158
     //private getProjectsData(key: string): any {
159
         //return this.projectsData;
160
     //}
155 161

  
156
         private searchDataproviders() {
157
           this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10);
158
           this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders() + "?organization=" + this.organizationId + "&or=and";;
162
     private searchDataproviders() {
163
       this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10);
164
       this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders() + "?organization=" + this.organizationId + "&or=and";;
165
     }
166

  
167
     private searchDataprovidersInit() {
168
         if(this.subDataproviders == undefined && this.fetchDataproviders.searchUtils.totalResults > 0) {
169
             this.subDataproviders =  this.route.queryParams.subscribe(params => {
170
                 this.searchDataproviders();
171
             });
159 172
         }
173
     }
160 174

  
161
         private searchDataprovidersInit() {
162
             if(this.subDataproviders == undefined && this.fetchDataproviders.searchUtils.totalResults > 0) {
163
                 this.subDataproviders =  this.route.queryParams.subscribe(params => {
164
                     this.searchDataproviders();
165
                 });
166
             }
167
         }
168
         downloadfile(url:string){
169
           console.log("Downloading file: "+ url);
170
           this._reportsService.downloadCSVFile(url)
171
               .subscribe(data => window.open(window.URL.createObjectURL(data)),
172
                           error => console.log("Error downloading the file."),
173
                           () => console.log('Completed file download.'));
174
           }
175
     downloadfile(url:string){
176
       console.log("Downloading file: "+ url);
177
       this._reportsService.downloadCSVFile(url)
178
           .subscribe(data => window.open(window.URL.createObjectURL(data)),
179
                       error => console.log("Error downloading the file."),
180
                       () => console.log('Completed file download.'));
181
     }
182

  
183
     downloadPublicationsFile(funder: string){
184
       console.log("Downloading publications file");
185
       let response: string[] = [];
186
       let totalResponse: string = "";
187
       let counter: number = this.organizationInfo.projects.get(funder).length;
188

  
189
       for(let project of this.organizationInfo.projects.get(funder)) {
190
            this._searchPublicationsService.numOfEntityPublications(project.id, "projects/").subscribe(
191
                data =>
192
                    {
193
                        let index: number = this.organizationInfo.projects.get(funder).indexOf(project);
194

  
195
                        let url: string;
196
                        if(index == 0) {
197
                            url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv&size="+data;
198
                        } else {
199
                            url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-notitle&size="+data;
200
                        }
201

  
202
                        this._reportsService.getCSVResponse(url).subscribe(
203
                            data =>
204
                                {
205
                                    counter--;
206

  
207
                                    response[index] = data;
208

  
209
                                    if(counter == 0) {
210
                                        for(let i=0; i<this.organizationInfo.projects.get(funder).length; i++) {
211
                                            totalResponse += response[i]+"\n";
212
                                        }
213
                                        window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
214
                                    }
215
                                },
216
                            error => console.log("Error downloading the file."),
217
                            () => console.log('Completed file download.'));
218
                    },
219
                error => console.log("Error getting number of publications for project."));
220
        }//);
221
    }
175 222
}
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/organization/organization.module.ts
11 11
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
12 12
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
13 13
import {ReportsServiceModule} from '../../services/reportsService.module';
14
import {PublicationsServiceModule} from '../../services/publicationsService.module';
14 15

  
15 16
@NgModule({
16 17
  imports: [
......
20 21
    SearchResultsModule,
21 22
    DataProvidersServiceModule,
22 23
    ReportsServiceModule,
23
    OrganizationServiceModule
24
    OrganizationServiceModule,
25
    PublicationsServiceModule
24 26
  ],
25 27
  declarations: [
26 28
  OrganizationComponent
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/project/project.component.html
193 193
                <li>
194 194
                    <div class="clickable" data-uk-toggle="{target:'#datasets_dynamic', animation:'uk-animation-fade'}">Dynamically incorporate research data in your site (HTML)</div>
195 195
                    <div class="uk-vertical-align uk-hidden" id="datasets_dynamic">
196
                        <button class="uk-float-right uk-icon-clipboard uk-button datasets_clipboard_btn" data-clipboard-target="#datasets_clipboard">
196
                        <button class="uk-float-right uk-button datasets_clipboard_btn" data-clipboard-target="#datasets_clipboard">
197 197
                            Copy to clipboard
198
                            <i class="uk-icon-clipboard"></i>
198 199
                        </button>
199 200
                        <pre><code id="datasets_clipboard">{{datasets_dynamic}}</code></pre>
200 201
                    </div>
......
214 215
                    </export-->
215 216
                    <span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)">
216 217
                        <span aria-hidden="true" class="glyphicon glyphicon-download"></span>
217
                        <span class="uk-icon-download">{{projectInfo.funder}} progress report (CSV)</span>
218
                        <i class="uk-icon-download"></i>
219
                        <span>{{projectInfo.funder}} progress report (CSV)</span>
218 220
                    </span>
219 221
                </li>
220 222
                <li>
221
                      <a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[projectId,'project','result'])"   routerLinkActive="router-link-active" routerLink="/linking" > <i class="uk-icon-link"></i>
222
                            Link to research results
223
                        </a>
223
                    <a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[projectId,'project','result'])"   routerLinkActive="router-link-active" routerLink="/linking" > <i class="uk-icon-link"></i>
224
                        Link to research results
225
                    </a>
224 226
                </li>
225 227
                <li>
226
                        <a  href="/deposit-publications">
227
                            Deposit Publications
228
                        </a>
228
                    <a  href="/deposit-publications">
229
                        Deposit Publications
230
                    </a>
229 231
                </li>
230 232
            </ul>
231 233
        </div>
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/project/project.component.ts
121 121
      datasets_clipboard = new Clipboard('.datasets_clipboard_btn');
122 122
  }
123 123

  
124
  console.info(this.fetchPublications.searchUtils.totalResults + " just before csv");
125 124
  this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size=";
126 125
}
127 126

  
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/publication/publication.component.html
194 194
                        </thead>
195 195
                        <tbody *ngFor="let key of publicationInfo.bioentities.keys()">
196 196
                            <tr *ngFor="let keyIn of publicationInfo.bioentities.get(key).keys()">
197
                                <td class="uk-text-center uk-icon-external-link" *ngIf="keyIn != undefined">
198
                                    <a href="{{publicationInfo.bioentities.get(key).get(keyIn)}}"
199
                                        target="_blank">
200
                                        {{keyIn}}
201
                                    </a>
197
                                <td class="uk-text-center" *ngIf="keyIn != undefined">
198
                                    <span class="uk-icon-external-link">
199
                                        <a href="{{publicationInfo.bioentities.get(key).get(keyIn)}}"
200
                                            target="_blank">
201
                                            {{keyIn}}
202
                                        </a>
203
                                    </span>
202 204
                                </td>
203 205
                                <td class="uk-text-center">
204 206
                                    {{key}}
......
220 222
                        </thead>
221 223
                        <tbody>
222 224
                            <tr *ngFor="let item of publicationInfo.software" class="uk-text-center">
223
                                <td class="uk-icon-external-link">
224
                                    <a href="{{item.url}}" target="_blank">
225
                                        {{item.name}}
226
                                    </a>
225
                                <td>
226
                                    <span class="uk-icon-external-link">
227
                                        <a href="{{item.url}}" target="_blank">
228
                                            {{item.name}}
229
                                        </a>
230
                                    </span>
227 231
                                </td>
228 232
                            </tr>
229 233
                        </tbody>

Also available in: Unified diff