diff --git a/orcid/my-orcid-links/myOrcidLinks.component.ts b/orcid/my-orcid-links/myOrcidLinks.component.ts index 0276ebe6..628650cd 100644 --- a/orcid/my-orcid-links/myOrcidLinks.component.ts +++ b/orcid/my-orcid-links/myOrcidLinks.component.ts @@ -10,11 +10,8 @@ import {properties} from "../../../../environments/environment"; import {OrcidService} from "../orcid.service"; import {Identifier, StringUtils} from "../../utils/string-utils.class"; import {SearchResearchResultsService} from "../../services/searchResearchResults.service"; -import {Session} from "../../login/utils/helper.class"; -import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {SearchResult} from "../../utils/entities/searchResult"; import {ResultPreview} from "../../utils/result-preview/result-preview"; -import {HttpClient} from "@angular/common/http"; import {Meta, Title} from "@angular/platform-browser"; import {UserManagementService} from "../../services/user-management.service"; import {PiwikService} from "../../utils/piwik/piwik.service"; @@ -24,117 +21,80 @@ declare var UIkit: any; @Component({ selector: 'my-orcid-links', template: ` - - - - - - - - -
-
-
- My ORCID links -
+ +
+
- - -
-
-
- This is a private page, only for users that have connected their ORCID iD with OpenAIRE. - Please grant OpenAIRE to access and update your ORCID works. +
+
+ My ORCID links
- - + +
+ + Did you link a result with your ORCID + but the green icon is missing? +
+ No worries! It will appear, as soon as we synchronize again with ORCID data. + + Read more + +
+
+ + + +
+
+
+ This is a private page, only for users that have connected their ORCID iD with OpenAIRE. + Please grant OpenAIRE to access and update your ORCID works. +
+ +
+ +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
- - - -
- ` + `, + styles: ['.orcid-color { color: #a6ce39; }'] }) export class MyOrcidLinksComponent { public resultType: string = "result"; @@ -159,9 +119,7 @@ export class MyOrcidLinksComponent { @Input() public communityId: string = null; - depositLearnHowPage: string = null; public routerHelper:RouterHelper = new RouterHelper(); - // breadcrumbs:Breadcrumb[] = []; parameters = {}; keyword = ""; @@ -192,7 +150,6 @@ export class MyOrcidLinksComponent { private _searchResearchResultsService: SearchResearchResultsService, private userManagementService: UserManagementService, private _meta: Meta, private _title: Title - // ,private http: HttpClient/*ATHENA CODE*/ ) { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); @@ -211,45 +168,8 @@ export class MyOrcidLinksComponent { public ngOnInit() { this.properties = properties; - this.depositLearnHowPage = this.properties.depositLearnHowPage; - this.baseUrl = this.properties.depositSearchPage; + this.baseUrl = this.properties.myOrcidLinksPage; this.pagingLimit = this.properties.pagingLimit; - // this.breadcrumbs.push({name: 'home', route: '/'}, { - // name: "Deposit", - // route: this.depositLearnHowPage - // }, {name: "Browse repositories", route: null}); - - // this.subscriptions.push(this.route.queryParams.subscribe( - // params => { - // this.searchUtils.page = params['page'] ? params['page']-1 : 1; - // this.searchUtils.size = params['size'] ? params['size'] : 5; - - // let page = (params['page'] === undefined) ? 1 : +params['page']; - // this.searchUtils.page = (page <= 0) ? 1 : page; - // let size = (params['size'] === undefined) ? 5 : +params['size']; - // this.searchUtils.size = (size <= 0) ? 1 : size; - // - // if (params["type"]) { - // let types = params["type"]; - // types = Array.isArray(types) ? types.join(',').split(","):types.split(","); - // types.map( function (t) { - // return StringUtils.unquote(StringUtils.URIDecode(t)); - // } ); - // - // if(types.indexOf("publications")!=-1 && types.indexOf("datasets")!=-1 && types.indexOf("software")!=-1 && types.indexOf("other")!=-1 ){ - // this.typeQuery += "&type=results"; - // }else{ - // for (let type of types) { - // this.typeQuery += "&type=" + StringUtils.unquote(StringUtils.URIDecode(type)); - // } - // } - // }else{ - // this.typeQuery += "&type=results"; - // } - - // this.typeQuery = "&type=results"; - // this.getLocalWorks(this.currentPage, this.resultsPerPage); - // })); var description = "Openaire, ORCID linking, publication, research data, software, other research product"; this.updateTitle("My ORCID Links"); this.updateDescription(description); @@ -363,8 +283,6 @@ export class MyOrcidLinksComponent { for(let pid of work['pids']) { let identifier: Identifier = Identifier.getIdentifierFromString(pid); this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pidclassid exact "'+identifier.class+'" and pid="'+StringUtils.URIEncode(identifier.id)+'")'); - //this.orcidQuery = '(pidclassid exact "doi" and pid="10.1007/978-3-030-55814-7_16")'; - // console.debug(this.orcidQuery); } } this.showLoading = false; @@ -383,25 +301,12 @@ export class MyOrcidLinksComponent { //this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery) .subscribe( data => { - // this is for testing purposes only! - // let newRes = JSON.parse(JSON.stringify(data[1][0])); - // newRes.identifiers = new Map(); - // newRes.identifiers.set("doi", [data[1][0].identifiers.get("doi")[1]]); - // data[1].push(newRes); - // console.log(data[1][data[0]]); - // - // data[1][0].identifiers.set("doi", [data[1][0].identifiers.get("doi")[0]]); - // console.log(data[1][0]); - // - // data[0] += 1; - let totalResults = data[0]; let results = data[1]; this.resultsReturned(results, totalResults, works); }, err => { - // this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err); console.error("Error getting " + this.getEntityName(this.resultType, true, true)); this.showLoading = false; this.searchUtils.status = this.errorMessages.getErrorCode(err.status); @@ -444,65 +349,6 @@ export class MyOrcidLinksComponent { }) } - // /////////////////////// ATHENA CODE /////////////////////// - // // console.log(data[1]); - // let dois = encodeURIComponent(results.map((result) => result.DOIs).join(",")); - // console.log(dois); - // console.log(this.properties.impactFactorsAPIURL); - // if(dois.length > 0 && (this.properties.impactFactorsAPIURL && this.properties.impactFactorsAPIURL.length > 0) ) { - // let url = this.properties.impactFactorsAPIURL + dois; - // this.http.get((this.properties.useCache?(this.properties.cacheUrl+(encodeURIComponent(url))):url)).subscribe((data_received:any[]) => { - // let impact =[]; - // data_received.forEach(function (result) { - // if(result.doi && result.doi.length > 0 && result.pop_class!=null && result.inf_class!=null) - // impact[result.doi]=result; - // }); - // this.currentResults.forEach(function (result) { - // if(result.identifiers) { - // result.identifiers.get("doi").forEach(function (doi) { - // if (impact[doi]) { - // result.DOI = doi; - // } - // - // }) - // } - // }); - // for (let i = 0; i < this.currentResults.length; i++) { - // if (this.currentResults[i].DOI) { - // this.currentResults[i].pop_inf = new Array(); - // this.currentResults[i].pop_inf.push(impact[this.currentResults[i].DOI].pop_class, impact[this.currentResults[i].DOI].inf_class); - // if(this.currentResults[i].pop_inf[0]=="A"){ - // // this.previewResults[i].pop_inf.push("High"); - // this.currentResults[i].pop_inf.push("Exceptional"); - // }else if(this.currentResults[i].pop_inf[0]=="B"){ - // // this.previewResults[i].pop_inf.push("Average"); - // this.currentResults[i].pop_inf.push("Substantial"); - // }else{ - // // this.previewResults[i].pop_inf.push("low"); - // this.currentResults[i].pop_inf.push("Average"); - // } - // if(this.currentResults[i].pop_inf[1]=="A"){ - // // this.previewResults[i].pop_inf.push("Strong"); - // this.currentResults[i].pop_inf.push("Exceptional"); - // }else if(this.currentResults[i].pop_inf[1]=="B"){ - // // this.previewResults[i].pop_inf.push("Average"); - // this.currentResults[i].pop_inf.push("Substantial"); - // }else{ - // // this.previewResults[i].pop_inf.push("Weak"); - // this.currentResults[i].pop_inf.push("Average"); - // } - // } - // } - // - // }, error1 => { - // console.error("Failed to get Impact factors for elixir-gr") - // }); - // // console.log(researchResults[1]); - // - // } - // /////////////////////// ATHENA CODE /////////////////////// - - this.results[this.currentPage-1] = this.currentResults; this.searchUtils.status = this.errorCodes.DONE; @@ -539,18 +385,10 @@ export class MyOrcidLinksComponent { if(work['updateDate']) { this.currentResults[this.currentResults.length - 1].orcidUpdateDates.push(work['updateDate']); } - - // this.currentResults[this.currentResults.length - 1].orcidPutCodes.push(work['putCode']); - // this.currentResults[this.currentResults.length - 1].orcidCreationDates.push(work['creationDate']); - // this.currentResults[this.currentResults.length - 1].orcidUpdateDates.push(work['creationDate']); }); } this.results[this.currentPage-1] = this.currentResults; - // if(!refine) { - // this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); - // } - this.searchUtils.status = this.errorCodes.DONE; if (this.searchUtils.totalResults == 0) { this.searchUtils.status = this.errorCodes.NONE; @@ -563,18 +401,6 @@ export class MyOrcidLinksComponent { return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.resultType); } - // private handleError(message: string, error) { - // if(error && error.status == "401") { - // this.requestGrant = true; - // this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works. "; - // // + "If you have already granted OpenAIRE, you just need to login again to ORCID!"; - // } else if(error && error.status == "403") { - // this.requestGrant = true; - // this.requestGrantMessage = "Please login again to ORCID." - // } - // console.error("My ORCID links Page: "+message, error); - // } - public getEntityName(entityType: string, plural: boolean, full: boolean): string { if (entityType == "publication") { return "publication" + (plural ? "s" : ""); @@ -592,7 +418,6 @@ export class MyOrcidLinksComponent { public pageChanged($event) { this.currentPage = $event.value; this.prepareOrcidQuery(); - // this.getLocalWorks(this.currentPage, this.resultsPerPage); } handleError(error, errorMsg: string) { @@ -600,23 +425,11 @@ export class MyOrcidLinksComponent { this.requestGrant = true; } else { this.showErrorMessage = true; - - // UIkit.notification({ - // message: errorMsg, - // status: 'warning', - // timeout: 6000, - // pos: 'bottom-right' - // }); } this.showLoading = false; } private updateTitle(title: string) { - var _prefix = ""; - // if(!this.communityId) { - // _prefix = "OpenAIRE | "; - // } - // var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); this._title.setTitle(title); this._meta.updateTag({content: title}, "property='og:title'"); } diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index d2deb5e3..142106af 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -161,7 +161,8 @@ declare var UIkit: any; + : ('Update this work to your ORCID record' + ((properties.environment == 'beta') ? '. The action will affect your real ORCID iD.' : '') + + showUpdateDatesInTooltip())"> @@ -386,6 +387,23 @@ export class OrcidWorkComponent { }); } + public showUpdateDatesInTooltip() { + const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + let response: string = ""; + if(this.updateDates != null && this.updateDates.length > 0) { + response += "

Last update in ORCID
"; + for(let i=0; i { let identifiersMap: Map = new Map(); for(let identifier of identifiers) { @@ -508,7 +526,12 @@ export class OrcidWorkComponent { // message: 'You have successfully added work with pids: '+this.pids+' in your ORCID record!', UIkit.notification({ - message: 'You have successfully added work "'+this.resultTitle+'" in your ORCID record!', + message: 'You have successfully added work "'+this.resultTitle+'" in your ORCID record!' + // + + // '

Manager your ORCID links' + , + // '

Manager your ORCID links', + // '

Manager your ORCID links', status: 'success', timeout: 6000, pos: 'bottom-right' @@ -524,6 +547,10 @@ export class OrcidWorkComponent { )); } + goToOrcidLinksPage() { + this._router.navigate([this.properties.myOrcidLinksPage]); + } + private updateWorkPreparation() { if(!Session.isLoggedIn()){ this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); @@ -553,7 +580,10 @@ export class OrcidWorkComponent { // message: 'You have successfully updated work with pids: ' + this.pids + ' in your ORCID record!', UIkit.notification({ - message: 'You have successfully updated work "' + this.resultTitle + '" in your ORCID record!', + message: 'You have successfully updated work "' + this.resultTitle + '" in your ORCID record!' + // + + // '

Manager your ORCID links' + , status: 'success', timeout: 6000, pos: 'bottom-right' @@ -653,7 +683,10 @@ export class OrcidWorkComponent { // message: 'You have successfully deleted work with pids: ' + this.pids + ' from your ORCID record!', UIkit.notification({ - message: 'You have successfully deleted work "' + this.resultTitle + '" from your ORCID record!', + message: 'You have successfully deleted work "' + this.resultTitle + '" from your ORCID record!' + // + + // '

Manager your ORCID links' + , status: 'success', timeout: 6000, pos: 'bottom-right' diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index 47c3c4e3..93f03d20 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -41,7 +41,8 @@ export class SearchResultComponent implements OnInit, OnChanges { this.previewResults.push(this.getResultPreview(result)); } - if(properties.adminToolsPortalType == "explore" && Session.isLoggedIn() && this.results && this.results.length > 0) { + if((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community") + && Session.isLoggedIn() && this.results && this.results.length > 0) { this.orcidService.getPutCodes(this.previewResults.map( previewResult => { if(previewResult.identifiers) { diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index d3f2472c..9ac9bca1 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -133,4 +133,5 @@ export interface EnvProperties { adminPortalURL?: string; sushiliteURL?: string; notificationsAPIURL?: string; + myOrcidLinksPage?: string; } diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index b6e614fb..6b8d2510 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -298,7 +298,7 @@
0) || result.orcidCreationDates?.length > 0))" class="result-preview-bottom"> @@ -385,7 +385,7 @@ [putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers"> - Added in ORCID: @@ -394,16 +394,16 @@ & - - {{' . '}} - - - Last update in ORCID: - - {{date | date: 'dd MMM yyyy'}} - & - - + + + + + + + + + +