CSV download publications in project landing page functionality added | CSV download projects in organization landing page functionality added | funder id info added in organizationInfo class (useful for CSV download) | Temporatily remove html links from project landing page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45514 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-01-20 13:08:17 +00:00
parent 041a158edf
commit fbec1a8185
6 changed files with 54 additions and 99 deletions

View File

@ -148,11 +148,15 @@
<li></li> <li></li>
<div *ngIf="organizationInfo.projects != undefined"> <div *ngIf="organizationInfo.projects != undefined">
<li *ngFor="let key of organizationInfo.projects.keys()"> <li *ngFor="let key of organizationInfo.projects.keys()">
<a (click)="exportProjects(key)">Download projects report (CSV) for {{key}}</a> <a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
Download projects report (CSV) for {{key}}
</a>
</li> </li>
<li *ngFor="let key of organizationInfo.projects.keys()"> <li *ngFor="let key of organizationInfo.projects.keys()">
<a (click)="exportPublications(key)">Download publications report (CSV) for {{key}}</a> <a>
Download publications report (CSV) for {{key}}
</a>
</li> </li>
</div> </div>
</ul> </ul>

View File

@ -28,7 +28,11 @@ export class OrganizationComponent {
private emptyFundersSet: boolean = true; private emptyFundersSet: boolean = true;
public warningMessage = ""; public warningMessage = "";
public errorMessage = ""; public errorMessage = "";
private csvData: any = {};
public downloadURLAPI: string;
public csvProjectParamsHead: string;
public csvPublicationParamsHead: string;
public csvParamsTail: string;
sub: any; sub: any;
subDataproviders: any; subDataproviders: any;
@ -59,6 +63,10 @@ export class OrganizationComponent {
} }
}); });
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL();
this.csvProjectParamsHead = 'format=csv&type=projects&page=0&query=( (oaftype exact project)and (funderid exact "';
this.csvParamsTail = '" and relorganizationid exact "'+this.organizationId+'" ))';
//this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact ';
/* /*
this.subDataprovidersCount = this.route.queryParams.subscribe(params => { this.subDataprovidersCount = this.route.queryParams.subscribe(params => {
this._searchDataprovidersService.numOfDataproviders("organizations/"+this.organizationId+"/datasources/count").subscribe( this._searchDataprovidersService.numOfDataproviders("organizations/"+this.organizationId+"/datasources/count").subscribe(
@ -145,74 +153,6 @@ export class OrganizationComponent {
} }
} }
private exportProjects(key: string) {
let projectsData : any = { "columnNames": [], "export":[] };
let projectName = "Projects"+key;
if(!(projectName in this.csvData)) {
projectsData.columnNames = ['Project title', 'Project Acronym', 'Project ID',
'Funder', 'Funding Stream',
'Funding Substream level 1', 'Funding Substream level 2',
'SC39', 'Start Date', 'End Date'];
for(let project of this.organizationInfo.projects.get(key)) {
projectsData.export[projectsData.export.length] =
/*{
'Project title': this.quote(project.name),
'Project Acronym': this.quote(project.acronym),
'Project ID': this.quote(project.code),
'Funder': this.quote(project.funder),
'Funding Stream':this.quote(project.fundingStream),
'Funding Substream level 1': this.quote(project.fundingLevel1),
'Funding Substream level 2': this.quote(project.fundingLevel2),
'SC39': this.quote(project.sc39),
'Start Date': this.quote(project.startDate),
'End Date': this.quote(project.endDate)
};
*/
[
this.quote(project.name),
this.quote(project.acronym),
this.quote(project.code),
this.quote(project.funder),
this.quote(project.fundingStream),
this.quote(project.fundingLevel1),
this.quote(project.fundingLevel2),
this.quote(project.sc39),
this.quote(project.startDate),
this.quote(project.endDate)
];
}
this.csvData[projectName] = projectsData;
}
ExportCSVComponent.downloadCSV(this.csvData[projectName], "projects "+key+".csv");
}
private exportPublications(key: string) {
let publicationsData : any = { "columnNames": [], "export":[] };
let publicationName = "Publications"+key;
if(!(publicationName in this.csvData)) {
publicationsData.columnNames = ['Title', 'Authors', 'Publication Year',
'DOI', 'Download From', 'Publication type',
'Journal', 'Funder', 'Project Name (GA Number)', 'Access'];
for(let project of this.organizationInfo.projects.get(key)) {
let result = this.searchPublicationsComponent.getCSVResultsForEntity("project", project.id);
//publicationsData.export.concat(["aaaa", "ooo"], ["iiii", "eeee"]]);
result.every(function(item) {publicationsData.export.push(item);});
//console.info("publications export: "+publicationsData.export);
//console.info("publications export: "+result);
}
this.csvData[publicationName] = publicationsData;
}
ExportCSVComponent.downloadCSV(this.csvData[publicationName], "publications "+key+".csv");
}
private quote(word: string): string {
return '"'+word+'"';
}
//private getProjectsData(key: string): any { //private getProjectsData(key: string): any {
//return this.projectsData; //return this.projectsData;
//} //}

View File

@ -155,7 +155,7 @@
View all Project Publications View all Project Publications
</a> </a>
</li> </li>
<li> <!--li>
<a href=""> <a href="">
Dynamically incorporate publications in your site (HTML) Dynamically incorporate publications in your site (HTML)
</a> </a>
@ -165,12 +165,16 @@
<a href=""> <a href="">
View {{projectInfo.funder}} progress report (HTML) View {{projectInfo.funder}} progress report (HTML)
</a> </a>
</li> </li-->
<li> <li>
<export <!--export
[linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'" [linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'"
[filename]="'publications.csv'"> [filename]="'publications.csv'">
</export> </export-->
<a href="{{downloadURLAPI}}resources?{{csvParams}}">
<span class="glyphicon glyphicon-download" aria-hidden="true"></span>
Download {{projectInfo.funder}} progress report (CSV)
</a>
</li> </li>
<li> <li>

View File

@ -18,18 +18,22 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
export class ProjectComponent{ export class ProjectComponent{
private projectId : string ; public projectId : string ;
public projectInfo: ProjectInfo; public projectInfo: ProjectInfo;
private projectName: string; public projectName: string;
private metricsClicked: boolean; public metricsClicked: boolean;
private viewsFrameUrl: string; public viewsFrameUrl: string;
private downloadsFrameUrl: string; public downloadsFrameUrl: string;
private statsClicked: boolean; public statsClicked: boolean;
private chartScientificResultsUrl: string; public chartScientificResultsUrl: string;
private chartAccessModeUrl: string; public chartAccessModeUrl: string;
private chartDatasourcesUrl: string; public chartDatasourcesUrl: string;
public project ;
public downloadURLAPI: string;
public csvParams: string;
private project ;
public warningMessage = ""; public warningMessage = "";
public errorMessage = ""; public errorMessage = "";
@ -38,10 +42,10 @@ export class ProjectComponent{
subDatasets: any; subDatasets: any;
subDatasetsCount: any; subDatasetsCount: any;
private searchPublicationsComponent : SearchPublicationsComponent; public searchPublicationsComponent : SearchPublicationsComponent;
private linkToSearchPublications = ""; public linkToSearchPublications = "";
private searchDatasetsComponent : SearchDatasetsComponent; public searchDatasetsComponent : SearchDatasetsComponent;
private linkToSearchDatasets = ""; public linkToSearchDatasets = "";
constructor (private _projectService: ProjectService, constructor (private _projectService: ProjectService,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -77,6 +81,9 @@ export class ProjectComponent{
this.warningMessage="No valid project id"; this.warningMessage="No valid project id";
} }
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL();
this.csvParams = "format=csv-special&page=0&size="+this.searchPublicationsComponent.searchUtils.totalResults+"&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))";
}); });
} }
@ -99,7 +106,7 @@ export class ProjectComponent{
private searchDatasetsInit() { private searchDatasetsInit() {
if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) { if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) {
this.searchDatasets(); this.searchDatasets();
} }
} }
@ -126,5 +133,4 @@ export class ProjectComponent{
); );
} }
} }

View File

@ -97,24 +97,24 @@ export class OrganizationService {
if(this.organizationInfo.projects == undefined) { if(this.organizationInfo.projects == undefined) {
this.organizationInfo.projects = new Map<string, this.organizationInfo.projects = new Map<string,
{ "name": string, "id": string, "url": string, "code": string, { "name": string, "id": string, "url": string, "code": string,
"acronym": string, "funder": string, "fundingStream": string, "acronym": string, "funder": string, "funderId": string,
"fundingLevel1": string, "fundingLevel2": string, "fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }[]>(); "sc39": string, "startDate": string, "endDate": string }[]>();
} }
if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) { if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) {
this.organizationInfo.projects.set(mydata['funding']['funder'].name, this.organizationInfo.projects.set(mydata['funding']['funder'].name,
new Array<{ "name": string, "id": string, "url": string, "code": string, new Array<{ "name": string, "id": string, "url": string, "code": string,
"acronym": string, "funder": string, "fundingStream": string, "acronym": string, "funder": string, "funderId": string,
"fundingLevel1": string, "fundingLevel2": string, "fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }>()); "sc39": string, "startDate": string, "endDate": string }>());
} }
counter = this.organizationInfo.projects.get(mydata['funding']['funder'].name).length; counter = this.organizationInfo.projects.get(mydata['funding']['funder'].name).length;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter] = this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter] =
{ "name": "", "id": "", "url": "", "code": "", { "name": "", "id": "", "url": "", "code": "",
"acronym": "", "funder": "", "fundingStream": "", "acronym": "", "funder": "", "funderId": "",
"fundingLevel1": "", "fundingLevel2": "", "fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
"sc39": "", "startDate": "", "endDate": "" }; "sc39": "", "startDate": "", "endDate": "" };
let url = ""; let url = "";
@ -128,6 +128,7 @@ export class OrganizationService {
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['acronym'] = mydata.acronym; this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['acronym'] = mydata.acronym;
this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funder'] = mydata['funding']['funder'].shortname; 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")) { 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(mydata['funding']['funder'].name)[counter]['fundingStream'] = mydata['funding']['funding_level_0'].name;
} }

View File

@ -4,8 +4,8 @@ export class OrganizationInfo {
country: string; country: string;
projects: Map<string, { "name": string, "id":string, "url": string, "code": string, projects: Map<string, { "name": string, "id":string, "url": string, "code": string,
"acronym": string, "funder": string, "fundingStream": string, "acronym": string, "funder": string, "funderId": string,
"fundingLevel1": string, "fundingLevel2": string, "fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }[]>; "sc39": string, "startDate": string, "endDate": string }[]>;
//dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string, //dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
// "organizations": {"name": string, "url": string}[]}[]; // "organizations": {"name": string, "url": string}[]}[];