2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input, ViewChild} from '@angular/core';
|
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
import {Meta, Title} from '@angular/platform-browser';
|
|
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
|
|
import {ClaimEntity, ShowOptions} from '../claim-utils/claimHelper.class';
|
|
|
|
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
|
|
|
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
|
|
|
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
|
|
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
|
|
|
import {AlertModal} from "../../utils/modal/alert";
|
|
|
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
2018-02-05 14:14:59 +01:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
declare var UIkit:any;
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'linking-generic',
|
|
|
|
templateUrl: 'linkingGeneric.component.html'
|
|
|
|
|
|
|
|
})
|
|
|
|
export class LinkingGenericComponent {
|
2018-07-06 15:35:03 +02:00
|
|
|
@Input() communityId:string= null;
|
2017-12-19 13:53:46 +01:00
|
|
|
sourceType:string;
|
|
|
|
targetType:string;
|
|
|
|
step:number = 1;
|
2019-07-23 14:23:12 +02:00
|
|
|
@Input() results:ClaimEntity[] = [];
|
|
|
|
@Input() inlineEntity:ClaimEntity = null;
|
|
|
|
|
|
|
|
@Input() showOptions:ShowOptions = new ShowOptions();
|
|
|
|
//show values: source, result, project, context, claim
|
|
|
|
// linkTo /values: result, project, context
|
|
|
|
// show linkToEntities /values: result, project, context
|
|
|
|
|
|
|
|
@Input() sources:ClaimEntity[] =[];
|
2017-12-19 13:53:46 +01:00
|
|
|
sub:any =null;
|
2018-02-05 14:14:59 +01:00
|
|
|
properties:EnvProperties;
|
2019-07-23 14:23:12 +02:00
|
|
|
@Input() localStoragePrefix:string = "linking_";
|
2018-11-14 11:38:53 +01:00
|
|
|
url=null;
|
2019-07-23 14:23:12 +02:00
|
|
|
@ViewChild(AlertModal) alert;
|
|
|
|
|
|
|
|
|
2018-02-05 14:14:59 +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
|
|
|
constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
|
|
|
|
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService,
|
2018-11-14 11:38:53 +01:00
|
|
|
private _meta: Meta, private _title: Title,
|
|
|
|
private seoService: SEOService ) {
|
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
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
let title = "OpenAIRE | Linking";
|
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._meta.updateTag({content:title},"property='og:title'");
|
|
|
|
this._title.setTitle(title);
|
2018-11-14 11:38:53 +01:00
|
|
|
|
2018-07-25 15:56:02 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
ngOnInit() {
|
2019-07-23 14:23:12 +02:00
|
|
|
this.showOptions.show = 'source';
|
|
|
|
if(this.inlineEntity){
|
|
|
|
this.showOptions.basketShowSources = false;
|
|
|
|
this.showOptions.basketShowLinksTo = true;
|
|
|
|
this.showOptions.show = this.showOptions.linkTo;
|
|
|
|
}
|
2018-02-05 14:14:59 +01:00
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
|
|
this.properties = data.envSpecific;
|
2018-11-14 11:38:53 +01:00
|
|
|
this.url = data.envSpecific.baseLink+this._router.url;
|
2019-02-11 16:03:38 +01:00
|
|
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url, false);
|
2018-02-05 14:14:59 +01:00
|
|
|
|
|
|
|
});
|
2017-12-19 13:53:46 +01:00
|
|
|
if( typeof localStorage !== 'undefined') {
|
2019-07-23 14:23:12 +02:00
|
|
|
this.localStoragePrefix +=(this.communityId?this.communityId+"_":"");
|
2018-07-25 15:56:02 +02:00
|
|
|
if(localStorage.getItem(this.localStoragePrefix + "results")){
|
|
|
|
this.results = JSON.parse(localStorage.getItem(this.localStoragePrefix + "results"));
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
if(localStorage.getItem(this.localStoragePrefix + "sources")){
|
|
|
|
this.sources = JSON.parse(localStorage.getItem(this.localStoragePrefix + "sources"));
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
openSelectionModal() {
|
|
|
|
this.alert.cancelButton = false;
|
|
|
|
this.alert.okButton = false;
|
|
|
|
this.alert.alertTitle = "Select the type of Entity to Link to your sources";
|
|
|
|
// this.alert.message = "<div>All the links you provided will be published in the OpenAIRE platform. " +
|
|
|
|
// "<br>Make sure you have checked all the information you provided. In some cases some links take more time to be published. " +
|
|
|
|
// "<br>For more information please check the linking status in My-Links page. " +
|
|
|
|
// "<br><br>Do you confirm the information you provide are valid?</div>";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
this.alert.open();
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
2019-07-23 14:23:12 +02:00
|
|
|
closeSelectionModal(show:string=null) {
|
|
|
|
if(show){
|
|
|
|
this.showOptions.show = show;
|
|
|
|
this.showOptions.basketShowSources=false;
|
|
|
|
this.showOptions.basketShowLinksTo=true;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2019-07-23 14:23:12 +02:00
|
|
|
this.alert.cancel();
|
|
|
|
this.scrollUp();
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|
2019-07-23 14:23:12 +02:00
|
|
|
scrollUp(){
|
|
|
|
HelperFunctions.scroll();
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|