diff --git a/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts index 39b68e76..6996c8e5 100644 --- a/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -1,35 +1,48 @@ import {Component} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Params} from '@angular/router'; +import {ActivatedRoute, Params, Router} from '@angular/router'; import {isBrowser, isNode} from 'angular2-universal'; import {HtmlProjectReportService} from './htmlProjectReport.service'; import {ProjectService} from '../project/project.service'; +import {OpenaireProperties} from '../../utils/properties/openaireProperties'; +import { Meta} from '../../../angular2-meta'; @Component({ selector: 'htmlProjectReport', template: ` -
- +
+ + + +
-
-

Raw html is copied. Please paste it on an html file.

+ -

{{header1}}

-

{{header2}}

-
-
+

{{header1}}

+

{{header2}}

+ +
+ +
+ +
+ + +
+
` }) export class HtmlProjectReportComponent{ public projectId: string; - public totalResults: number; + public totalResults: number = 10; public resultsType: string = "publication"; - public header1: string; - public header2: string; + public header1: string = ""; + public header2: string = ""; public htmlResult: string = ""; public sub; @@ -37,22 +50,46 @@ export class HtmlProjectReportComponent{ public subHTMLInfo; public copied: boolean = false; + public warningMessage: string = ""; + public errorMessage: string = ""; + public showLoading: boolean = true; constructor ( private route: ActivatedRoute, - private htmlService: HtmlProjectReportService, - private _projectService: ProjectService) { + private htmlService: HtmlProjectReportService, + private _projectService: ProjectService, + private _meta: Meta, private _router: Router) { + this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { this.sub = this.route.queryParams.subscribe(params => { this.projectId = params['projectId']; - this.totalResults = params['size']; - if(params['type'] && (params['type'] == "dataset" || params['type'] == "publication")){ - this.resultsType = params['type']; + + if (params['size'] == parseInt(params['size'], 10)) { + this.totalResults = params['size']; + } else { + this.showLoading = false; + this.warningMessage="Requested size is not an integer"; } - this.createHeaders(); - this.createClipboard(); + if(params['type'] && (params['type'] == "dataset" || params['type'] == "publication")){ + this.resultsType = params['type']; + this.updateTitle("Project's "+this.resultsType+" report"); + this.updateDescription("project, funding, open access, publications, datasets, "); + } else { + this.showLoading = false; + this.warningMessage="Requested type should be publication or dataset"; + } + + //showLoading is true if no warnings + if(this.showLoading) { + if(this.projectId) { + this.createHeaders(); + } else { + this.showLoading = false; + this.warningMessage="No valid project id"; + } + } }); } @@ -65,6 +102,7 @@ export class HtmlProjectReportComponent{ }, err => { console.log(err); + this.createClipboard(); } ); @@ -77,19 +115,17 @@ export class HtmlProjectReportComponent{ intro += ''; intro += ''+this.header1+'' intro += ''; - intro += ''; if (typeof window !== 'undefined') { this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType).subscribe( data => { let body: string = intro+'

'+this.header1+'

'+this.header2+'

'+data+''; - this.htmlResult = data; let clipboard; let Clipboard; Clipboard = require('clipboard'); - clipboard = new Clipboard('.btn', { + clipboard = new Clipboard('.clipBtn', { /*target: function(trigger) { return document.getElementById("clipboard"); }*/ @@ -97,16 +133,19 @@ export class HtmlProjectReportComponent{ return body;//document.getElementById("clipboard").getAttribute('innerHTML');//"aaaa"+tmp+"oo"; } }); + + this.showLoading = false; }, err => { console.log(err); + this.errorMessage = 'Service not available'; + this.showLoading = false; } ); } } createHeader1(data: {"title": string, "acronym": string, "callIdentifier": string}) { - console.info(data); this.header1 = ((this.resultsType == "publication")?"Publications":"Datasets") + " of Project "; if(data != undefined) { @@ -130,5 +169,21 @@ export class HtmlProjectReportComponent{ this.header1 += ")"; } } + + this.createClipboard(); + } + + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateProperty("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateProperty("og:title",_title); + } + updateUrl(url:string){ + this._meta.updateProperty("og:url", url); } } diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html index 8cdef239..c46dfbcf 100644 --- a/portal-2/src/app/landingPages/project/project.component.html +++ b/portal-2/src/app/landingPages/project/project.component.html @@ -264,7 +264,7 @@
  • View {{projectInfo.funder}} progress report (HTML) for + href="/project-report?projectId={{projectId}}&size={{fetchPublications.searchUtils.totalResults}}&type=publication"> publications / diff --git a/portal-2/src/app/landingPages/publication/publication.service.ts b/portal-2/src/app/landingPages/publication/publication.service.ts index 81bfcb16..f030368e 100644 --- a/portal-2/src/app/landingPages/publication/publication.service.ts +++ b/portal-2/src/app/landingPages/publication/publication.service.ts @@ -701,6 +701,12 @@ export class PublicationService { } } + if(data[12] != null && data[12] == "under curation") { + this.publicationInfo.underCurationMessage = true; + } else { + this.publicationInfo.underCurationMessage = false; + } + return this.publicationInfo; } } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts index a250bbab..dff150cf 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts @@ -97,14 +97,16 @@ export class AdvancedSearchDataProvidersComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts index 11e5b81a..528b8510 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts @@ -102,14 +102,16 @@ export class AdvancedSearchDatasetsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts index 342e3bcd..84f02cf6 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -100,14 +100,16 @@ public resourcesQuery = "(oaftype exact organization)"; //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts index a282ce41..771439a8 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts @@ -100,14 +100,16 @@ export class AdvancedSearchProjectsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts index ca819ee9..64505073 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts @@ -101,14 +101,16 @@ export class AdvancedSearchPublicationsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts index ea6d1707..ec11df85 100644 --- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts @@ -265,14 +265,16 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts index b8a8e04e..4ede7ee6 100644 --- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts @@ -198,14 +198,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts index 5bcaf046..710e3b74 100644 --- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts @@ -117,14 +117,16 @@ export class SearchOrganizationsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/simple/searchProjects.component.ts b/portal-2/src/app/searchPages/simple/searchProjects.component.ts index a9028c15..f74f4ba2 100644 --- a/portal-2/src/app/searchPages/simple/searchProjects.component.ts +++ b/portal-2/src/app/searchPages/simple/searchProjects.component.ts @@ -122,14 +122,16 @@ export class SearchProjectsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index e718b3d5..23c9caa1 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -210,14 +210,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number //this.searchPage.closeLoading(); this.disableForms = false; - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = errorCodes.OUT_OF_BOUND; + if(this.searchUtils.status == errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = errorCodes.OUT_OF_BOUND; + } } }, err => { diff --git a/portal-2/src/assets/custom.css b/portal-2/src/assets/custom.css index 87aaa96c..d058189f 100644 --- a/portal-2/src/assets/custom.css +++ b/portal-2/src/assets/custom.css @@ -120,6 +120,10 @@ min-height: 600px; } +.custom-html-table-height { + height: 500px; +} + .filterItem span { display: inline-flex; }