diff --git a/claims/claim-utils/claimEntities.class.ts b/claims/claim-utils/claimEntities.class.ts index 03ce92f0..659d4a12 100644 --- a/claims/claim-utils/claimEntities.class.ts +++ b/claims/claim-utils/claimEntities.class.ts @@ -7,7 +7,7 @@ export class ClaimResult{ public url: string; public result: any; public accessRights: string = "OPEN"; - public embargoEndDate: string; + public embargoEndDate: string =""; public date: string; public authors: string[] =[]; public publisher: string; @@ -16,7 +16,7 @@ export class ClaimResult{ DOI: string; editors=[]; journal: string; - + } export class ClaimProject{ public funderId: string; diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html index 3c5fd828..6a5e9cac 100644 --- a/claims/claim-utils/claimResultSearchForm.component.html +++ b/claims/claim-utils/claimResultSearchForm.component.html @@ -2,7 +2,7 @@
-
Search for research results :
+
Search for research results
Research Data - + + diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 87671778..9db9f5d3 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -92,6 +92,7 @@ export class DisplayClaimsComponent { publicationCB = false; datasetCB = false; softwareCB = false; + otherCB = false; contextCB = false; projectCB = false; entityTypes : string[] =[] ; @@ -246,6 +247,7 @@ handleErrors(err){ this.projectCB = false; this.datasetCB = false; this.softwareCB = false; + this.otherCB = false; this.contextCB = false; this.entityTypes = []; this.goTo(); @@ -306,6 +308,9 @@ handleErrors(err){ if(this.softwareCB){ this.entityTypes.push('software'); } + if(this.otherCB){ + this.entityTypes.push('other'); + } if(this.projectCB){ this.entityTypes.push('project'); } @@ -333,6 +338,10 @@ handleErrors(err){ this.softwareCB = true; this.entityTypes.push("software"); } + if(types.indexOf("other")!=-1){ + this.otherCB = true; + this.entityTypes.push("other"); + } if(types.indexOf("project")!=-1){ this.projectCB = true; this.entityTypes.push("project"); @@ -342,7 +351,7 @@ handleErrors(err){ this.entityTypes.push("context"); } } - if(this.publicationCB && this.datasetCB && this.softwareCB && this.contextCB && this.projectCB){ + if(this.publicationCB && this.datasetCB && this.softwareCB && this.otherCB && this.contextCB && this.projectCB){ this.entityTypes=[]; } } diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts index 66f8d6de..d97ee83b 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts @@ -21,6 +21,12 @@ import{EnvProperties} from '../../../utils/properties/env-properties';
+
+ + + + +
diff --git a/claims/claim-utils/startOver.component.ts b/claims/claim-utils/startOver.component.ts index eb0acb2e..13a06ce4 100644 --- a/claims/claim-utils/startOver.component.ts +++ b/claims/claim-utils/startOver.component.ts @@ -6,7 +6,13 @@ import {AlertModal} from '../../utils/modal/alert'; @Component({ selector: 'start-over', template: ` - + + + `, @@ -14,13 +20,10 @@ import {AlertModal} from '../../utils/modal/alert'; }) export class StartOverComponent { constructor () { - - } ngOnInit() { -} - + } // @Input() public inlineEntity = null; @Input() public type:string; @@ -30,12 +33,16 @@ export class StartOverComponent { @Input() public contexts; @ViewChild(AlertModal) alertApplyAll; + @Input() localStoragePrefix:string = ""; confirmOpen(){ + if(this.projects.length + this.results.length + this.contexts.length == 0 ){ + return; + } this.alertApplyAll.cancelButton = true; this.alertApplyAll.okButton = true; this.alertApplyAll.alertTitle = "Remove selected"; - this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?"; + this.alertApplyAll.message = "Do you want to remove selected entities (projects, communities, research results)?"; this.alertApplyAll.okButtonText = "Yes"; this.alertApplyAll.cancelButtonText = "No"; this.alertApplyAll.open(); @@ -59,6 +66,9 @@ export class StartOverComponent { this.projects.splice(0, this.projects.length); this.contexts.splice(0, this.contexts.length); } + localStorage.removeItem(this.localStoragePrefix + "projects"); + localStorage.removeItem(this.localStoragePrefix + "contexts"); + localStorage.removeItem(this.localStoragePrefix + "results"); console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length ); } diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index a382d7cf..7661610f 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -18,9 +18,10 @@
  • - {{(projects.length + contexts.length + results.length) | number}} + {{(projects.length + contexts.length + results.length - ((type =="project")?1:0)) | number}}

    + @@ -33,16 +34,17 @@
    - Link your {{type}} + Link your {{((type=='orp')?'research product':type)}}
    -
    +
    - {{displayedResult.title}} - {{displayedResult.title}} + {{((displayedResult.title == undefined || displayedResult.title == '')?'[no title available]':displayedResult.title)}} + + {{((displayedResult.title == undefined || displayedResult.title == '')?'[no title available]':displayedResult.title)}}
    diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index bd1dc555..e9dd3948 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -11,6 +11,7 @@ import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/ent import {SearchPublicationsService} from '../../services/searchPublications.service'; import {SearchDatasetsService} from '../../services/searchDatasets.service'; import {SearchSoftwareService} from '../../services/searchSoftware.service'; +import {SearchOrpsService} from '../../services/searchOrps.service'; @Component({ @@ -29,7 +30,7 @@ export class DirectLinkingComponent { type:string = null; // entity type (publication or dataset) linkTo:string = null; // entity type (project or context or result) - entityTypes=["dataset", "publication","software", "project","context"]; + entityTypes=["dataset", "publication","software","orp", "project","context"]; inlineResult:ClaimResult =null; displayedResult:ClaimResult =null; sub:any =null; @@ -41,7 +42,8 @@ export class DirectLinkingComponent { constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, - private softwareSearch:SearchSoftwareService, private _meta: Meta, private _title: Title) { + private softwareSearch:SearchSoftwareService,private ORPSearch:SearchOrpsService, + private _meta: Meta, private _title: Title) { var title = "OpenAIRE | Direct Linking"; @@ -65,7 +67,7 @@ export class DirectLinkingComponent { this.show = (this.linkTo != "result")?"claim":"result"; this.linkType = this.linkTo; var isInlineResult:boolean = false; // is a link result - result - if((this.type == "publication" || this.type == "dataset" || this.type == "software") && ((this.linkTo == "publication" || this.linkTo == "dataset" || this.linkTo == "software") || this.linkTo == "result" )){ + if((this.type == "publication" || this.type == "dataset" || this.type == "software") && ((this.linkTo == "publication" || this.linkTo == "dataset" || this.linkTo == "software" || this.linkTo == "orp") || this.linkTo == "result" )){ isInlineResult = true; } this.localStoragePrefix = this.type.substr(0,3)+"_"+this.linkTo.substr(0,3)+"_"; @@ -79,6 +81,7 @@ export class DirectLinkingComponent { if(localStorage.getItem(this.localStoragePrefix + "results")){ this.results = JSON.parse(localStorage.getItem(this.localStoragePrefix + "results")); } + console.log("\n\nGetting inline entity "+this.type+"\n\n"); if(this.type == "project"){ this.linkType = "project"; this.getProjectById(this.id); @@ -88,6 +91,8 @@ export class DirectLinkingComponent { this.getDatasetById(this.id,true); }else if(this.type == "software"){ this.getSoftwareById(this.id,true); + }else if(this.type == "orp"){ + this.getOrpById(this.id,true); }else{ this.validInput = this.isValidInput(null); } @@ -104,9 +109,9 @@ export class DirectLinkingComponent { return false; }else if(this.type == "project" && this.linkTo != "result"){ return false; - }else if(["dataset","publication","software"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){ + }else if(["dataset","publication","software", "orp"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){ return false; - }else if(["project","dataset","publication","software"].indexOf(this.type) == -1){ + }else if(["project","dataset","publication","software","orp"].indexOf(this.type) == -1){ return false; }else{ return true; @@ -177,6 +182,7 @@ export class DirectLinkingComponent { result.url= item['title'].url; result.result = item; result.accessRights = item['title'].accessMode; + result.embargoEndDate =""; result.date = item.year; this.displayedResult = result; if(isInlineResult){ @@ -203,6 +209,7 @@ export class DirectLinkingComponent { result.url= item['title'].url; result.result = item; result.accessRights = item['title'].accessMode; + result.embargoEndDate =""; result.date = item.year; this.displayedResult = result; if(isInlineResult){ @@ -217,4 +224,33 @@ export class DirectLinkingComponent { console.log("An error occured") }); } +getOrpById(id:string, isInlineResult:boolean){ + this.sub = this.ORPSearch.searchOrpById(id,this.properties).subscribe( + data => { + console.log(data) + var item =data[0]; + var result: ClaimResult = new ClaimResult(); + result.id=id; + result.type="other"; + result.source="openaire"; + result.title = item['title'].name; + result.url= item['title'].url; + result.result = item; + result.accessRights = item['title'].accessMode; + result.embargoEndDate =""; + result.date = item.year; + this.displayedResult = result; + console.log(item) + if(isInlineResult){ + this.inlineResult = result; + }else{ + this.results.push( result); + } + this.validInput = this.isValidInput(result); + }, + err => { + this.validInput = this.isValidInput(null); + console.log("An error occured") + }); +} } diff --git a/claims/directLinking/directLinking.module.ts b/claims/directLinking/directLinking.module.ts index 4a295642..5c07c92d 100644 --- a/claims/directLinking/directLinking.module.ts +++ b/claims/directLinking/directLinking.module.ts @@ -20,6 +20,7 @@ import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchFor import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module'; import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; +import {OrpsServiceModule} from '../../services/orpsService.module'; @NgModule({ @@ -27,7 +28,7 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; SharedModule, SelectedProjectsModule, SelectedContextsModule, SelectedPublicationsModule, InsertClaimsModule, EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, StartOverModule, HelperModule, - ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, ClaimResultSearchFormModule + ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, ClaimResultSearchFormModule, OrpsServiceModule ], diff --git a/claims/linking/bulkClaim/bulkClaim.component.ts b/claims/linking/bulkClaim/bulkClaim.component.ts index d289566d..76f46f93 100644 --- a/claims/linking/bulkClaim/bulkClaim.component.ts +++ b/claims/linking/bulkClaim/bulkClaim.component.ts @@ -17,7 +17,7 @@ import{EnvProperties} from '../../../utils/properties/env-properties';
    -
    Upload a DOI csv file :
    +
    Upload a DOI csv file
    diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index e6ac98ee..6906074e 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -317,7 +317,7 @@ private createClaim(inlineResult:any, result:any, user:any){ } private createContextClaim(result:any, context:any, user:any){ - var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)}; + var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)}; return claim; } private createProjectClaim(result:any, project:any, user:any){ @@ -327,7 +327,7 @@ private createClaim(inlineResult:any, result:any, user:any){ return claim; } private createResultClaim(inlineResult:any, result:any, user:any){ - var claim = { claimedBy : user, sourceId : result.id, sourceType : result.type, sourceCollectedFrom: result.source, sourceAccessRights: result.accessRights, sourceEmbargoEndDate: result.embargoEndDate, targetId : inlineResult.id , targetType : inlineResult.type, targetCollectedFrom: inlineResult.source, targetAccessRights: inlineResult.accessRights, targetEmbargoEndDate: (inlineResult.embargoEndDate == null?"":inlineResult.embargoEndDate)}; + var claim = { claimedBy : user, sourceId : result.id, sourceType : result.type, sourceCollectedFrom: result.source, sourceAccessRights: result.accessRights, sourceEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate), targetId : inlineResult.id , targetType : inlineResult.type, targetCollectedFrom: inlineResult.source, targetAccessRights: inlineResult.accessRights, targetEmbargoEndDate: (inlineResult.embargoEndDate == null?"":inlineResult.embargoEndDate)}; return claim; } createDirectClaim(result, projects, contexts){ @@ -363,6 +363,8 @@ createDirectClaim(result, projects, contexts){ entity["resourceType"]="0021"; }else if(result.type =="software"){ entity["resourceType"]="0029"; + }else if(result.type =="other"){ + entity["resourceType"]="0020"; } entity["url"]=result.url; entity["hostedById"]="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"; diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html index dbe32488..27ddeb93 100644 --- a/claims/linking/linkingGeneric.component.html +++ b/claims/linking/linkingGeneric.component.html @@ -64,6 +64,7 @@ {{(projects.length + contexts.length + results.length) | number}}
    + diff --git a/claims/linking/linkingGeneric.module.ts b/claims/linking/linkingGeneric.module.ts index 4fb048fd..86b70d8f 100644 --- a/claims/linking/linkingGeneric.module.ts +++ b/claims/linking/linkingGeneric.module.ts @@ -6,9 +6,6 @@ import {SelectedContextsModule} from './selected/selectedContexts.module'; import {SelectedPublicationsModule} from './selected/selectedResults.module'; import {InsertClaimsModule} from './insertClaim/insertClaim.module'; import {LinkingGenericComponent} from './linkingGeneric.component'; -import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module'; -import {PublicationsServiceModule} from '../../services/publicationsService.module'; -import {DatasetsServiceModule} from '../../services/datasetsService.module'; import {StartOverModule} from '../claim-utils/startOver.module'; import {LoginGuard} from'../../login/loginGuard.guard'; import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; @@ -23,8 +20,7 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; imports: [ SharedModule, SelectedProjectsModule, SelectedContextsModule, SelectedPublicationsModule, - InsertClaimsModule, - EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, StartOverModule, + InsertClaimsModule, StartOverModule, ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, HelperModule ], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], diff --git a/claims/linking/selected/selectedResults.component.ts b/claims/linking/selected/selectedResults.component.ts index 818e1c25..31e3aa66 100644 --- a/claims/linking/selected/selectedResults.component.ts +++ b/claims/linking/selected/selectedResults.component.ts @@ -55,8 +55,9 @@ import {Dates} from '../../../utils/string-utils.class';