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

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46223 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-03-10 16:13:00 +00:00
parent 7b42fc135b
commit 9afdb70b52
12 changed files with 275 additions and 175 deletions

View File

@ -296,26 +296,7 @@ private nativeElement : Node;
}
ngOnInit() {
}
ngOnChanges() {
console.info("on changes dataprovider tabs");
if(this.tabs != undefined && this.tabs.length > 0) {
/*if(typeof document !== undefined) {
let element = document.getElementById(this.tabs[0].content);
if(element != null) {
element.className = "uk-active";
element.setAttribute("aria-expanded", "true");
}
let element2 = document.getElementById("firstTab-content");
if(element2 != null) {
element2.className = "uk-active";
element2.setAttribute("aria-hidden", "false");
}
}*/
this.reloadPublications = true;
this.reloadDatasets = true;
this.reloadProjects = true;
@ -335,6 +316,7 @@ private nativeElement : Node;
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';
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';
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';
}
if(this.resultsBy == "collectedFrom") {
@ -344,6 +326,51 @@ private nativeElement : Node;
}
}
// ngOnChanges() {
// console.info("on changes dataprovider tabs");
// if(this.tabs != undefined && this.tabs.length > 0) {
// /*if(typeof document !== undefined) {
// let element = document.getElementById(this.tabs[0].content);
// if(element != null) {
// element.className = "uk-active";
// element.setAttribute("aria-expanded", "true");
// }
//
// let element2 = document.getElementById("firstTab-content");
// if(element2 != null) {
// element2.className = "uk-active";
// element2.setAttribute("aria-hidden", "false");
// }
// }*/
//
// this.reloadPublications = true;
// this.reloadDatasets = true;
// this.reloadProjects = true;
// this.reloadDataproviders = true;
// this.reloadRelatedDatasources = true;
// this.statsClicked = false;
//
// this.search(this.tabs[0].content, 1, 10);
// this.count(1, 0);
//
// this.metricsClicked = false;
// 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';
// 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';
//
// 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';
// 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';
// 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';
// 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';
// 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';
// }
//
// if(this.resultsBy == "collectedFrom") {
// this.paramsForSearchLink = "?collectedFrom="+this.id+"&co=and";
// } else if (this.resultsBy == "hostedBy") {
// this.paramsForSearchLink = "?hostedBy="+this.id+"&ho=and";
// }
// }
private count(page: number, size: number) {
console.info("number of tabs: "+this.tabs.length);

View File

@ -156,8 +156,8 @@
</dd>
</dl>
</li>
</ul>
<ul *ngIf="organizationInfo.projects != undefined" class="uk-list uk-list-striped">
<ng-container *ngIf="organizationInfo.projects != undefined">
<li *ngFor="let key of organizationInfo.projects.keys()">
<!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
Download projects report (CSV) for {{key}}
@ -168,11 +168,13 @@
</span>
</li>
<!--li *ngFor="let key of organizationInfo.projects.keys()">
<a>
Download publications report (CSV) for {{key}}
</a>
</li-->
<li *ngFor="let key of organizationInfo.projects.keys()">
<span class="clickable" (click)="downloadPublicationsFile(key)">
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon-download"> Publications report(CSV) for {{key}}</span>
</span>
</li>
</ng-container>
</ul>
</div>
</div>

View File

@ -4,9 +4,10 @@ import {ActivatedRoute} from '@angular/router';
import {OrganizationService} from '../../services/organization.service';
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
import {ReportsService} from '../../services/reports.service';
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@ -41,7 +42,8 @@ export class OrganizationComponent {
constructor (private _organizationService: OrganizationService,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
private _reportsService: ReportsService) {
private _reportsService: ReportsService,
private _searchPublicationsService: SearchPublicationsService) {
console.info('organization constructor');
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -95,6 +97,9 @@ export class OrganizationComponent {
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
data => {
if(data == null) {
this.errorMessage = 'No organization found';
} else {
this.organizationInfo = data;
let projectsNum = 0;
@ -106,6 +111,7 @@ export class OrganizationComponent {
}.bind(this));
}
this.projectsNum = projectsNum;
}
},
err => {
console.log(err)
@ -165,6 +171,7 @@ export class OrganizationComponent {
});
}
}
downloadfile(url:string){
console.log("Downloading file: "+ url);
this._reportsService.downloadCSVFile(url)
@ -172,4 +179,44 @@ export class OrganizationComponent {
error => console.log("Error downloading the file."),
() => console.log('Completed file download.'));
}
downloadPublicationsFile(funder: string){
console.log("Downloading publications file");
let response: string[] = [];
let totalResponse: string = "";
let counter: number = this.organizationInfo.projects.get(funder).length;
for(let project of this.organizationInfo.projects.get(funder)) {
this._searchPublicationsService.numOfEntityPublications(project.id, "projects/").subscribe(
data =>
{
let index: number = this.organizationInfo.projects.get(funder).indexOf(project);
let url: string;
if(index == 0) {
url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv&size="+data;
} else {
url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-notitle&size="+data;
}
this._reportsService.getCSVResponse(url).subscribe(
data =>
{
counter--;
response[index] = data;
if(counter == 0) {
for(let i=0; i<this.organizationInfo.projects.get(funder).length; i++) {
totalResponse += response[i]+"\n";
}
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
}
},
error => console.log("Error downloading the file."),
() => console.log('Completed file download.'));
},
error => console.log("Error getting number of publications for project."));
}//);
}
}

View File

@ -11,6 +11,7 @@ import { LandingModule } from '../landing.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
@NgModule({
imports: [
@ -20,7 +21,8 @@ import {ReportsServiceModule} from '../../services/reportsService.module';
SearchResultsModule,
DataProvidersServiceModule,
ReportsServiceModule,
OrganizationServiceModule
OrganizationServiceModule,
PublicationsServiceModule
],
declarations: [
OrganizationComponent

View File

@ -193,8 +193,9 @@
<li>
<div class="clickable" data-uk-toggle="{target:'#datasets_dynamic', animation:'uk-animation-fade'}">Dynamically incorporate research data in your site (HTML)</div>
<div class="uk-vertical-align uk-hidden" id="datasets_dynamic">
<button class="uk-float-right uk-icon-clipboard uk-button datasets_clipboard_btn" data-clipboard-target="#datasets_clipboard">
<button class="uk-float-right uk-button datasets_clipboard_btn" data-clipboard-target="#datasets_clipboard">
Copy to clipboard
<i class="uk-icon-clipboard"></i>
</button>
<pre><code id="datasets_clipboard">{{datasets_dynamic}}</code></pre>
</div>
@ -214,7 +215,8 @@
</export-->
<span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)">
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon-download">{{projectInfo.funder}} progress report (CSV)</span>
<i class="uk-icon-download"></i>
<span>{{projectInfo.funder}} progress report (CSV)</span>
</span>
</li>
<li>

View File

@ -121,7 +121,6 @@ export class ProjectComponent{
datasets_clipboard = new Clipboard('.datasets_clipboard_btn');
}
console.info(this.fetchPublications.searchUtils.totalResults + " just before csv");
this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size=";
}

View File

@ -194,11 +194,13 @@
</thead>
<tbody *ngFor="let key of publicationInfo.bioentities.keys()">
<tr *ngFor="let keyIn of publicationInfo.bioentities.get(key).keys()">
<td class="uk-text-center uk-icon-external-link" *ngIf="keyIn != undefined">
<td class="uk-text-center" *ngIf="keyIn != undefined">
<span class="uk-icon-external-link">
<a href="{{publicationInfo.bioentities.get(key).get(keyIn)}}"
target="_blank">
{{keyIn}}
</a>
</span>
</td>
<td class="uk-text-center">
{{key}}
@ -220,10 +222,12 @@
</thead>
<tbody>
<tr *ngFor="let item of publicationInfo.software" class="uk-text-center">
<td class="uk-icon-external-link">
<td>
<span class="uk-icon-external-link">
<a href="{{item.url}}" target="_blank">
{{item.name}}
</a>
</span>
</td>
</tr>
</tbody>

View File

@ -16,7 +16,8 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >
<!--a href="{{result['title'].url}}"-->
<!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
<a *ngIf="lazy" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<a *ngIf="lazy=='true'" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
@ -24,7 +25,8 @@ import {RouterHelper} from '../../utils/routerHelper.class';
{{result['title'].url}}
</p>
</a>
<a *ngIf="!lazy" href="/search/{{type}}?{{urlParam}}={{result.id}}">
<a *ngIf="lazy=='false'" href="/search/{{type}}?{{urlParam}}={{result.id}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
@ -143,7 +145,7 @@ export class SearchResultComponent {
@Input() type: string;
@Input() urlParam: string;
@Input() showLoading: boolean = false;
@Input() lazy: boolean = true;
@Input() lazy: string = "true";
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();

View File

@ -17,8 +17,9 @@ export class OrganizationService {
getOrganizationInfo (id: string):any {
console.info("getOrganizationInfo in service");
let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
//let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
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+')';
//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)";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parseOrganizationInfo(res));
@ -26,8 +27,9 @@ export class OrganizationService {
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
.map(res => [res, res['rels']['rel']])
.map(res => res['results'][0])
//.map(res => res[0]['result']['metadata']['oaf:entity']['oaf:organization'])
//.map(res => [res, res['rels']['rel']])
.do(res => {
this._cache.set(key, res);
})
@ -63,38 +65,45 @@ export class OrganizationService {
console.info("parseOrganizationInfo");
this.organizationInfo = new OrganizationInfo();
let mydata;
let organization;
let relations;
if(data[0] != null) {
mydata = data[0];
if(mydata.hasOwnProperty("websiteurl")) {
this.organizationInfo.title = {"name": mydata.legalshortname, "url": mydata.websiteurl};
if(data != null) {
organization = data['result']['metadata']['oaf:entity']['oaf:organization'];
relations = data['result']['metadata']['oaf:entity']['oaf:organization']['rels']['rel'];
} else {
this.organizationInfo.title = {"name": mydata.legalshortname, "url": ''};
return null;
}
this.organizationInfo.name = mydata.legalname;
if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) {
this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
}
this.organizationInfo.name = organization.legalname;
if(this.organizationInfo.title.name == '') {
this.organizationInfo.title.name = this.organizationInfo.name;
}
if(mydata.hasOwnProperty("country")) {
this.organizationInfo.country = mydata['country'].classname;
if(organization.hasOwnProperty("country")) {
this.organizationInfo.country = organization['country'].classname;
}
}
if(data[1] != null) {
if(relations != null) {
let counter;
let length = data[1].length!=undefined ? data[1].length : 1;
let length = relations.length!=undefined ? relations.length : 1;
for(let i=0; i<length; i++) {
mydata = data[1].length!=undefined ? data[1][i] : data[1];
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class == "isParticipant") {
if(mydata.hasOwnProperty("funding")) {
if(mydata['funding'].hasOwnProperty("funder")) {
let relation = relations.length!=undefined ? relations[i] : relations;
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isParticipant") {
if(relation.hasOwnProperty("funding")) {
if(relation['funding'].hasOwnProperty("funder")) {
if(this.organizationInfo.projects == undefined) {
this.organizationInfo.projects = new Map<string,
{ "name": string, "id": string, "code": string,
@ -103,48 +112,48 @@ export class OrganizationService {
"sc39": string, "startDate": string, "endDate": string }[]>();
}
if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) {
this.organizationInfo.projects.set(mydata['funding']['funder'].name,
if(!this.organizationInfo.projects.has(relation['funding']['funder'].name)) {
this.organizationInfo.projects.set(relation['funding']['funder'].name,
new Array<{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }>());
}
counter = this.organizationInfo.projects.get(mydata['funding']['funder'].name).length;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter] =
counter = this.organizationInfo.projects.get(relation['funding']['funder'].name).length;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter] =
{ "name": "", "id": "", "code": "",
"acronym": "", "funder": "", "funderId": "",
"fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
"sc39": "", "startDate": "", "endDate": "" };
//let url = "";
if(mydata['to'].content != null && mydata['to'].content != "") {
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['id'] = mydata['to'].content;
//url = OpenaireProperties.getsearchLinkToProject()+mydata['to'].content;
if(relation['to'].content != null && relation['to'].content != "") {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['id'] = relation['to'].content;
//url = OpenaireProperties.getsearchLinkToProject()+relation['to'].content;
}
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['name'] = mydata.title;
//this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['url'] = url;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['code'] = mydata.code;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['acronym'] = mydata.acronym;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['name'] = relation.title;
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['url'] = url;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['code'] = relation.code;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['acronym'] = relation.acronym;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funder'] = mydata['funding']['funder'].shortname;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funderId'] = mydata['funding']['funder'].id;
if(mydata['funding'].hasOwnProperty("funding_level_0")) {
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingStream'] = mydata['funding']['funding_level_0'].name;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funder'] = relation['funding']['funder'].shortname;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funderId'] = relation['funding']['funder'].id;
if(relation['funding'].hasOwnProperty("funding_level_0")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingStream'] = relation['funding']['funding_level_0'].name;
}
if(mydata['funding'].hasOwnProperty("funding_level_1")) {
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel1'] = mydata['funding']['funding_level_1'].name;
if(relation['funding'].hasOwnProperty("funding_level_1")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel1'] = relation['funding']['funding_level_1'].name;
}
if(mydata['funding'].hasOwnProperty("funding_level_2")) {
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel2'] = mydata['funding']['funding_level_2'].name;
if(relation['funding'].hasOwnProperty("funding_level_2")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel2'] = relation['funding']['funding_level_2'].name;
}
//this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['sc39'] =
//this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['startDate'] =
//this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['endDate'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['sc39'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['startDate'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
}
}
} /*else if(mydata['to'].class == "isProvidedBy") {
} /*else if(relation['to'].class == "isProvidedBy") {
if(this.organizationInfo.dataProviders == undefined) {
this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
}
@ -153,15 +162,15 @@ export class OrganizationService {
this.organizationInfo.dataProviders[counter] = { "name": "", "url": "", "type": "", "websiteUrl": "", "organizations": [] }
let url="";
if(mydata['to'].content != null && mydata['to'].content != "") {
url = OpenaireProperties.getsearchLinkToDataProvider()+mydata['to'].content;
if(relation['to'].content != null && relation['to'].content != "") {
url = OpenaireProperties.getsearchLinkToDataProvider()+relation['to'].content;
}
this.organizationInfo.dataProviders[counter]['name'] = mydata.officialname;
this.organizationInfo.dataProviders[counter]['name'] = relation.officialname;
this.organizationInfo.dataProviders[counter]['url'] = url;
if(mydata.hasOwnProperty("datasourcetype")) {
this.organizationInfo.dataProviders[counter]['type'] = mydata['datasourcetype'].classname;
if(relation.hasOwnProperty("datasourcetype")) {
this.organizationInfo.dataProviders[counter]['type'] = relation['datasourcetype'].classname;
}
this.organizationInfo.dataProviders[counter]['websiteUrl'] = mydata.websiteurl;
this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
}*/
}
}

View File

@ -19,10 +19,16 @@ export class ReportsService {
return this.http.get(url)
.map(res => new Blob([res['_body']], { type: 'text/csv' }));
}
getCSVResponse(url: string){
var headers = new Headers();
headers.append('responseType', 'arraybuffer');
return this.http.get(url)
.map(res => res['_body']);
}
downloadHTMLFile(url: string, info: string){
var headers = new Headers();
headers.append('responseType', 'arraybuffer');
return this.http.get(url)//.do(res => console.log(res['_body']))
return this.http.get(url)
.map(res => this.addInfo(res, info))
.map(res => new Blob([res['_body']], { type: 'text/html' }))
.do(res => console.log(res))

View File

@ -426,7 +426,8 @@ export class SearchPublicationsService {
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res.total).do(res => {
.map(res => res.total)
.do(res => {
this._cache.set(key, res);
});
}

View File

@ -123,7 +123,6 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info(this.searchUtils.totalResults + " i think we got results");
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];