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:
parent
041a158edf
commit
fbec1a8185
|
@ -148,11 +148,15 @@
|
|||
<li></li>
|
||||
<div *ngIf="organizationInfo.projects != undefined">
|
||||
<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 *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>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
|
@ -28,7 +28,11 @@ export class OrganizationComponent {
|
|||
private emptyFundersSet: boolean = true;
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
private csvData: any = {};
|
||||
|
||||
public downloadURLAPI: string;
|
||||
public csvProjectParamsHead: string;
|
||||
public csvPublicationParamsHead: string;
|
||||
public csvParamsTail: string;
|
||||
|
||||
sub: 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._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 {
|
||||
//return this.projectsData;
|
||||
//}
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
View all Project Publications
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<!--li>
|
||||
<a href="">
|
||||
Dynamically incorporate publications in your site (HTML)
|
||||
</a>
|
||||
|
@ -165,12 +165,16 @@
|
|||
<a href="">
|
||||
View {{projectInfo.funder}} progress report (HTML)
|
||||
</a>
|
||||
</li>
|
||||
</li-->
|
||||
<li>
|
||||
<export
|
||||
<!--export
|
||||
[linkname]="'Download '+ projectInfo.funder +' progress report (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>
|
||||
|
|
|
@ -18,18 +18,22 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
|||
export class ProjectComponent{
|
||||
|
||||
|
||||
private projectId : string ;
|
||||
public projectId : string ;
|
||||
public projectInfo: ProjectInfo;
|
||||
private projectName: string;
|
||||
private metricsClicked: boolean;
|
||||
private viewsFrameUrl: string;
|
||||
private downloadsFrameUrl: string;
|
||||
private statsClicked: boolean;
|
||||
private chartScientificResultsUrl: string;
|
||||
private chartAccessModeUrl: string;
|
||||
private chartDatasourcesUrl: string;
|
||||
public projectName: string;
|
||||
public metricsClicked: boolean;
|
||||
public viewsFrameUrl: string;
|
||||
public downloadsFrameUrl: string;
|
||||
public statsClicked: boolean;
|
||||
public chartScientificResultsUrl: string;
|
||||
public chartAccessModeUrl: string;
|
||||
public chartDatasourcesUrl: string;
|
||||
|
||||
public project ;
|
||||
|
||||
public downloadURLAPI: string;
|
||||
public csvParams: string;
|
||||
|
||||
private project ;
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
|
||||
|
@ -38,10 +42,10 @@ export class ProjectComponent{
|
|||
subDatasets: any;
|
||||
subDatasetsCount: any;
|
||||
|
||||
private searchPublicationsComponent : SearchPublicationsComponent;
|
||||
private linkToSearchPublications = "";
|
||||
private searchDatasetsComponent : SearchDatasetsComponent;
|
||||
private linkToSearchDatasets = "";
|
||||
public searchPublicationsComponent : SearchPublicationsComponent;
|
||||
public linkToSearchPublications = "";
|
||||
public searchDatasetsComponent : SearchDatasetsComponent;
|
||||
public linkToSearchDatasets = "";
|
||||
|
||||
constructor (private _projectService: ProjectService,
|
||||
private route: ActivatedRoute,
|
||||
|
@ -77,6 +81,9 @@ export class ProjectComponent{
|
|||
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() {
|
||||
if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) {
|
||||
this.searchDatasets();
|
||||
this.searchDatasets();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,5 +133,4 @@ export class ProjectComponent{
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -97,24 +97,24 @@ export class OrganizationService {
|
|||
if(this.organizationInfo.projects == undefined) {
|
||||
this.organizationInfo.projects = new Map<string,
|
||||
{ "name": string, "id": string, "url": string, "code": string,
|
||||
"acronym": string, "funder": string, "fundingStream": string,
|
||||
"fundingLevel1": string, "fundingLevel2": string,
|
||||
"acronym": string, "funder": string, "funderId": string,
|
||||
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
|
||||
"sc39": string, "startDate": string, "endDate": string }[]>();
|
||||
}
|
||||
|
||||
if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) {
|
||||
this.organizationInfo.projects.set(mydata['funding']['funder'].name,
|
||||
new Array<{ "name": string, "id": string, "url": string, "code": string,
|
||||
"acronym": string, "funder": string, "fundingStream": string,
|
||||
"fundingLevel1": string, "fundingLevel2": 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] =
|
||||
{ "name": "", "id": "", "url": "", "code": "",
|
||||
"acronym": "", "funder": "", "fundingStream": "",
|
||||
"fundingLevel1": "", "fundingLevel2": "",
|
||||
"acronym": "", "funder": "", "funderId": "",
|
||||
"fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
|
||||
"sc39": "", "startDate": "", "endDate": "" };
|
||||
|
||||
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]['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;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ export class OrganizationInfo {
|
|||
country: string;
|
||||
|
||||
projects: Map<string, { "name": string, "id":string, "url": string, "code": string,
|
||||
"acronym": string, "funder": string, "fundingStream": string,
|
||||
"fundingLevel1": string, "fundingLevel2": string,
|
||||
"acronym": string, "funder": string, "funderId": string,
|
||||
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
|
||||
"sc39": string, "startDate": string, "endDate": string }[]>;
|
||||
//dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
|
||||
// "organizations": {"name": string, "url": string}[]}[];
|
||||
|
|
Loading…
Reference in New Issue