Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {Router} from '@angular/router';
|
|
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
import {Title, Meta} from '@angular/platform-browser';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
import {Observable} from 'rxjs/Observable';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
|
|
|
|
|
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
|
|
|
|
|
|
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
|
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
|
|
|
|
|
|
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
|
|
|
import {OrganizationService} from '../../services/organization.service';
|
|
|
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
2018-11-14 11:38:53 +01:00
|
|
|
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2018-11-26 16:44:32 +01:00
|
|
|
import {ZenodoInformationClass} from '../utils/zenodoInformation.class';
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'deposit-by-subject-result',
|
|
|
|
templateUrl: 'depositBySubjectResult.component.html'
|
|
|
|
})
|
|
|
|
|
|
|
|
export class DepositBySubjectResultComponent {
|
|
|
|
@Input() compatibility: string = '';
|
|
|
|
|
|
|
|
// Type of entity: Publication or Research Data
|
|
|
|
@Input() requestFor: string = "Research Data";
|
|
|
|
@Input() subject: string = "";
|
2018-04-11 10:59:01 +02:00
|
|
|
@Input() piwikSiteId = null;
|
2017-12-19 13:53:46 +01:00
|
|
|
public newSubject: string= "";
|
|
|
|
|
|
|
|
public fetchDataproviders : FetchDataproviders;
|
|
|
|
public linkToSearchDataproviders = "";
|
|
|
|
|
|
|
|
// url of Zenodo
|
|
|
|
public zenodo: string;
|
|
|
|
|
|
|
|
public page: number = 1;
|
|
|
|
|
|
|
|
public status: number;
|
|
|
|
|
|
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
|
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
|
|
|
|
sub: any;
|
|
|
|
piwiksub: any;
|
2018-02-05 14:14:59 +01:00
|
|
|
properties:EnvProperties;
|
2018-11-14 11:38:53 +01:00
|
|
|
url=null;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2018-11-26 16:44:32 +01:00
|
|
|
@Input() zenodoInformation: ZenodoInformationClass;
|
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
constructor (private _router: Router,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private _searchDataprovidersService: SearchDataprovidersService,
|
|
|
|
private _meta: Meta,
|
|
|
|
private _title: Title,
|
2018-11-14 11:38:53 +01:00
|
|
|
private _piwikService:PiwikService,
|
|
|
|
private seoService: SEOService) {
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
|
|
|
|
|
|
|
this.status = this.errorCodes.LOADING;
|
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor;
|
|
|
|
var title = "Deposit "+this.requestFor;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
this.updateTitle(title);
|
|
|
|
this.updateDescription(description);
|
2019-02-11 16:03:38 +01:00
|
|
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url, false);
|
2018-11-14 11:38:53 +01:00
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
2018-02-05 14:14:59 +01:00
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
|
|
this.properties = data.envSpecific;
|
|
|
|
this.updateUrl(data.envSpecific.baseLink+this._router.url);
|
|
|
|
this.zenodo = this.properties.zenodo;
|
2018-11-14 11:38:53 +01:00
|
|
|
this.url = data.envSpecific.baseLink+this._router.url;
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
2018-04-11 10:59:01 +02:00
|
|
|
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
|
2018-02-05 14:14:59 +01:00
|
|
|
}
|
|
|
|
|
2018-11-26 16:44:32 +01:00
|
|
|
if(!this.zenodoInformation.url) {
|
|
|
|
this.zenodoInformation.url = this.properties.zenodo;
|
|
|
|
}
|
|
|
|
if(!this.zenodoInformation.name) {
|
|
|
|
this.zenodoInformation.name = "Zenodo";
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
});
|
2017-12-19 13:53:46 +01:00
|
|
|
console.info('depositResult init');
|
|
|
|
|
|
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
2018-02-05 14:14:59 +01:00
|
|
|
this.subject = params['subject'];
|
2017-12-19 13:53:46 +01:00
|
|
|
this.newSubject = this.subject;
|
|
|
|
this.searchDataproviders();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// ngDoCheck() {
|
|
|
|
// if(this.organizationId == "" || this.organizationId == undefined) {
|
|
|
|
// this.organizationId = "";
|
|
|
|
// this.status = this.errorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
if(this.piwiksub){
|
|
|
|
this.piwiksub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public totalPages(): number {
|
|
|
|
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
|
|
|
|
if(!(Number.isInteger(totalPages))) {
|
|
|
|
totalPages = (parseInt(totalPages, 10) + 1);
|
|
|
|
}
|
|
|
|
return totalPages;
|
|
|
|
}
|
|
|
|
|
|
|
|
public searchDataproviders() {
|
|
|
|
this.subject = this.newSubject;
|
2018-02-05 14:14:59 +01:00
|
|
|
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10, this.properties);
|
|
|
|
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public goToDeposit() {
|
|
|
|
if(this.requestFor == "Publications") {
|
|
|
|
this._router.navigate( ['participate/deposit-publications'] );
|
|
|
|
} else if(this.requestFor == "Research Data") {
|
|
|
|
this._router.navigate( ['participate/deposit-datasets'] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public pageChange($event) {
|
|
|
|
this.page = +$event.value;
|
|
|
|
this.searchDataproviders();
|
|
|
|
}
|
|
|
|
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
private updateDescription(description:string) {
|
|
|
|
this._meta.updateTag({content:description},"name='description'");
|
|
|
|
this._meta.updateTag({content:description},"property='og:description'");
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
private updateTitle(title:string) {
|
2017-12-19 13:53:46 +01:00
|
|
|
var _prefix ="OpenAIRE | ";
|
|
|
|
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
|
|
|
|
this._title.setTitle(_title);
|
|
|
|
this._meta.updateTag({content:_title},"property='og:title'");
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3
2018-04-17 15:00:23 +02:00
|
|
|
private updateUrl(url:string) {
|
|
|
|
this._meta.updateTag({content:url},"property='og:url'");
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|