diff --git a/cache-interceptor.service.ts b/cache-interceptor.service.ts
index 14e0f648..6a84c38a 100644
--- a/cache-interceptor.service.ts
+++ b/cache-interceptor.service.ts
@@ -8,29 +8,39 @@ import { properties } from "../../environments/environment";
export class CacheInterceptorService implements HttpInterceptor {
cachingRequests = [
// Remove 2 following lines when bug with hidden refine filters is solved.
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&fields=country&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
"/resources2/?format=json&refine=true&fields=funder&fields=fundinglevel0_id&fields=projectstartyear&fields=projectendyear&fields=projectoamandatepublications&&type=projects&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=results&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&fields=country&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=results&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=publications&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=datasets&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=software&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=other&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=publications&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=datasets&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=software&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=other&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
- "/resources2/?format=json&refine=true&fields=funder&fields=projectstartyear&fields=projectendyear&fields=projectoamandatepublications&&type=projects&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=funder&fields=projectoamandatepublications&fields=projectstartyear&fields=projectendyear&&type=projects&page=0&size=0",
"/resources2/?format=json&refine=true&fields=eoscdatasourcetype&fields=datasourceodlanguages&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=country&fields=collectedfromname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0",
- "/resources2/?format=json&query= ( (reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*) ) &refine=true&fields=country&&type=organizations&page=0&size=0",
+ // "/resources2/?format=json&query= ( (reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*) ) &refine=true&fields=country&&type=organizations&page=0&size=0",
+ "/resources2/?format=json&refine=true&fields=country&&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)&page=0&size=0&minRef=true",
- "/projects/?format=json&refine=true&page=1&size=0&fields=funder",
+ "/resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)",
+
+ // "/projects/?format=json&refine=true&page=1&size=0&fields=funder",
+ "/projects/?fields=funder&sf=funder&format=json&size=0",
+ "/results/?fields=relfunder&sf=relfunder&format=json&size=0",
"/resources/?format=json&query=( oaftype exact datasource and (eoscdatasourcetype exact \"Journal Archive\" or eoscdatasourcetype exact \"Repository\"))&refine=true&fields=datasourcetypename&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0",
"/search/v2/api/datasources/count?format=json", "/search/v2/api/publications/count?format=json", "/search/v2/api/datasets/count?format=json", "/search/v2/api/software/count?format=json", "/search/v2/api/other/count?format=json",
- "relresulttype%3Dpublication"
+ "relresulttype%3Dpublication",
+
+ "/resources2/?format=json&size=0&type=projects",
+ "/resources2/?format=json&size=0&type=datasources",
+ "/resources2/?format=json&size=0&type=results",
+ "/resources2/?format=json&size=0&type=results&fq=resultbestaccessright%20exact%20%22Open%20Access%22"
];
@@ -53,7 +63,8 @@ export class CacheInterceptorService implements HttpInterceptor {
if (!properties.useLongCache) {
return false;
}
- if(url.indexOf("refine=true") !== -1 || url.indexOf("/count?format=json") !== -1 || url.indexOf("relresulttype%3Dpublication") !== -1) {
+ if(url.indexOf("sf=") !== -1 || url.indexOf("refine=true") !== -1 || url.indexOf("/count?format=json") !== -1 || url.indexOf("relresulttype%3Dpublication") !== -1 ||
+ (url.indexOf("?format=json&size=0&type=") !== -1 && url.indexOf("query=") == -1)) {
return this.cachingRequests.some(partUrl => (url.indexOf(partUrl) !== -1));
}
return false;
diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html
index b2e66b11..fe0ab300 100644
--- a/claims/claim-utils/claimResultSearchForm.component.html
+++ b/claims/claim-utils/claimResultSearchForm.component.html
@@ -1,14 +1,16 @@
-
0" class="uk-width-xlarge@l uk-width-large" [ngClass]="centerAlign ? 'uk-align-center':''">
-
-
-
-
-
-
-
+
+
0" class="uk-width-xlarge@l uk-width-large" [ngClass]="centerAlign ? 'uk-align-center':''">
+
+
+
+
+
+
diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html
index 2c5dd4eb..bdcc74b3 100644
--- a/claims/claim-utils/displayClaims/displayClaims.component.html
+++ b/claims/claim-utils/displayClaims/displayClaims.component.html
@@ -63,7 +63,7 @@
+ [externalPortalUrl]=externalPortalUrl [source]="true" [linkAvailable]="isClaimAvailable(claim)">
Link to:
+ path="/search/result" [externalPortalUrl]=externalPortalUrl [linkAvailable]="linkAvailable">
{{entity.title?entity.title:"[No title available]"}}
- {{entity.title?entity.title:"[No title available]"}}
+ [routerLink]="path" class="uk-link uk-link-heading" [class.uk-disabled]="!linkAvailable">{{entity.title?entity.title:"[No title available]"}}
+ {{entity.title?entity.title:"[No title available]"}}
@@ -23,5 +23,6 @@ export class PublicationTitleFormatter {
@Input() path: string;
@Input() entity: any;
@Input() externalPortalUrl: string = null;
+ @Input() linkAvailable: boolean = true;
public routerHelper: RouterHelper = new RouterHelper();
}
diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html
index 7f394dd2..16cb04bf 100644
--- a/claims/linking/linkingGeneric.component.html
+++ b/claims/linking/linkingGeneric.component.html
@@ -73,11 +73,11 @@
-
+
-
+
-
+
Link source to
-
+
-
+
Source
@@ -145,7 +145,7 @@
-
+
0"
[results]="sources"
@@ -173,7 +173,7 @@
-
diff --git a/connect/userEmailPreferences/mailPrefs.component.html b/connect/userEmailPreferences/mailPrefs.component.html
deleted file mode 100644
index 4bbe55a2..00000000
--- a/connect/userEmailPreferences/mailPrefs.component.html
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
- User Email Preferences for Claims Notifications
-
-
-
0" class = "uk-alert uk-alert-danger uk-animation-fade" role="alert">
- {{userValidMessage}}
-
-
0" class="uk-alert uk-alert-success uk-animation-fade" role="alert">
- {{savedMessage}}
-
-
-
-
-
-
-
-
-
-
diff --git a/connect/userEmailPreferences/mailPrefs.component.ts b/connect/userEmailPreferences/mailPrefs.component.ts
deleted file mode 100644
index 6243387f..00000000
--- a/connect/userEmailPreferences/mailPrefs.component.ts
+++ /dev/null
@@ -1,259 +0,0 @@
-import {Component, Input} from '@angular/core';
-import {Location} from '@angular/common';
-import {ActivatedRoute, Router} from '@angular/router';
-import {Session} from '../../login/utils/helper.class';
-import {EnvProperties} from '../../utils/properties/env-properties';
-import {MailPrefsService} from './mailPrefs.service';
-import {ConnectHelper} from '../connectHelper';
-import {ErrorCodes} from '../../utils/properties/errorCodes';
-import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
-import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
-import {properties} from "../../../../environments/environment";
-import {Subscriber} from "rxjs";
-
-declare var UIkit: any;
-
-@Component({
- selector: 'mailPrefs',
- templateUrl: 'mailPrefs.component.html',
- providers:[MailPrefsService]
-
-})
-export class MailPrefsComponent {
- properties:EnvProperties;
- subscriptions = [];
- @Input() communityId: string;
- public preferencesFor: string = "community";
- public status: number;
-
- public notifications = [];
- public initialNotifications = [];
- public prefsChanged = {};
- public hidden: boolean = true;
-
- //public showForbiddenMessage:boolean = false;
- public userValidMessage:string = "";
- public savedMessage: string = "";
-
- private errorCodes: ErrorCodes;
- private errorMessages: ErrorMessagesComponent;
-
- @Input() showSaveResetButtons: boolean = true;
-
- constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
- this.errorCodes = new ErrorCodes();
- this.errorMessages = new ErrorMessagesComponent();
- this.status = this.errorCodes.LOADING;
- }
-
- ngOnInit() {
- this.properties = properties;
- this.subscriptions.push(this.route.params.subscribe(params => {
- this.hidden = true;
- console.debug(this.communityId);
- if(!this.communityId){
- this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
- }
- if(!this.communityId) {
- this.communityId = params['community'];
- }
- console.debug(this.communityId, params)
- this.getEmailPreferences();
- }));
-
-
- }
-
- getEmailPreferences() {
- if(!Session.isLoggedIn()){
- //this.userValidMessage = "User session has expired. Please login again.";
- if(this.showSaveResetButtons) {
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- }
- } else {
- this.status = this.errorCodes.LOADING;
- this.savedMessage = "";
-
- if(this.communityId && this.communityId != "openaire") {
- this.preferencesFor = "community";
- this.subscriptions.push(this._mailPrefsService.getUserEmailPreferencesForCommunity(this.communityId, this.properties.claimsAPIURL).subscribe(
- data => {
- if(data.code == "204") {
- this.status = this.errorCodes.NONE;
- this.initialNotifications = [{notify: true, frequency:24, openaireId: this.communityId}];
- } else {
- this.initialNotifications = data.data;
- }
- this.notifications = JSON.parse(JSON.stringify( this.initialNotifications ));
-
- this.status = this.errorCodes.DONE;
- this.hidden = false;
-
- },
- err => {
- this.hidden = false;
- this.handleErrors(err);
- this.handleError("Error getting user email preferences for community with id: "+this.communityId, err);
- }
- ));
- } else {
- this.preferencesFor = "project";
- this.subscriptions.push(this._mailPrefsService.getUserEmailPreferencesForOpenaire(this.properties.claimsAPIURL).subscribe(
- data => {
-
- if(data.code == "204") {
- this.status = this.errorCodes.NONE;
- } else {
-
- this.initialNotifications = data.data;
- this.notifications = JSON.parse(JSON.stringify( this.initialNotifications ));
- //this.notifications = this.initialNotifications.map(x => Object.assign({}, x));
- //this.notifications = this.initialNotifications;
-
- this.status = this.errorCodes.DONE;
- }
- },
- err => {
- //console.info(err);
- this.handleErrors(err);
- this.handleError("Error getting user email preferences for openaire", err);
- }
- ));
- }
- }
- }
-
- changeNotify(notification: any, checked: boolean, index: number) {
- if(!Session.isLoggedIn()){
- //this.userValidMessage = "User session has expired. Please login again.";
- if(this.showSaveResetButtons) {
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- }
- } else {
- this.savedMessage = "";
- this.status = this.errorCodes.DONE;
- notification.notify = checked;
- this.prefsChanged[index] = true;
- }
- }
-
- changeFrequency(index: number) {
- if(!Session.isLoggedIn()){
- //this.userValidMessage = "User session has expired. Please login again.";
- if(this.showSaveResetButtons) {
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- }
- } else {
- this.savedMessage = "";
- this.status = this.errorCodes.DONE;
- if(this.initialNotifications[index].frequency != this.notifications[index].frequency) {
- this.prefsChanged[index] = true;
- }
- }
- }
-
- saveNotification(index: number) {
- if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
- if(!Session.isLoggedIn()){
- //this.userValidMessage = "User session has expired. Please login again.";
- if(this.showSaveResetButtons) {
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- }
- } else {
- if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
-
- this.status = this.errorCodes.LOADING;
- this.savedMessage = "";
-
- this.subscriptions.push(this._mailPrefsService.saveUserEmailPreferences(this.notifications[index], this.properties.claimsAPIURL).subscribe(
- data => {
- this.initialNotifications[index] = JSON.parse(JSON.stringify( this.notifications[index] ));
-
- this.status = this.errorCodes.DONE;
-
- /*UIkit.notification({
- message : '
Your email preferences for '+this.notifications[index].openaireName+' have been successfully changed',
- status : 'success',
- timeout : 3000,
- pos : 'top-center'
- });*/
- this.savedMessage = "Notification settings for claims saved!";
- },
- err => {
- //console.log(err);
- this.handleError("Error saving user email preferences: "+JSON.stringify(this.notifications[index]), err);
- this.status = this.errorCodes.NOT_SAVED;
- }
- ));
- }
- else {
- /*UIkit.notification({
- message : 'No changes selected for '+this.notifications[index].openaireName+' email preferences',
- status : 'primary',
- timeout : 3000,
- pos : 'top-center'
- });*/
- this.savedMessage = "Notification settings for claims saved!";
- }
- }
- }
- }
-
- restoreNotification(index: number) {
- if(!Session.isLoggedIn()){
- //this.userValidMessage = "User session has expired. Please login again.";
- if(this.showSaveResetButtons) {
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- }
- } else {
- if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
- this.status = this.errorCodes.LOADING;
- this.savedMessage = "";
- this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
- this.status = this.errorCodes.DONE;
- this.prefsChanged[index] = false;
- }
- }
- }
- /*
- prefsChanged(index: number) : boolean {
- if(this.notifications.length > 0 && this.initialNotifications.length > 0) {
- if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) {
- return true;
- }
- }
- return false;
- }
- */
- ngOnDestroy() {
- this.subscriptions.forEach(subscription => {
- if (subscription instanceof Subscriber) {
- subscription.unsubscribe();
- }
- });
- }
-
-
- handleErrors(err){
- //this.showErrorMessage = true;
- //try{
- var code = "";
- if(!err.status) {
- var error = err.json();
- code = error.code;
- } else {
- code = err.status;
- }
- this.status = this.errorMessages.getErrorCode(code);
- }
-
- private handleError(message: string, error) {
- console.error("User mail notification preferences Page (for claims): "+message, error);
- }
-
-
- //}catch (e) {
- //console.log("Couldn't parse answer as json")
- //this.showErrorMessage = true;
- //}
-}
diff --git a/connect/userEmailPreferences/mailsPrefs.module.ts b/connect/userEmailPreferences/mailsPrefs.module.ts
deleted file mode 100644
index f670212e..00000000
--- a/connect/userEmailPreferences/mailsPrefs.module.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { NgModule} from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { RouterModule } from '@angular/router';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-
-import { MailPrefsComponent } from './mailPrefs.component';
-import { MailPrefsService } from './mailPrefs.service';
-import {ErrorMessagesModule} from '../../utils/errorMessages.module';
-import { MatSlideToggleModule } from '@angular/material/slide-toggle';
-
-@NgModule({
- imports: [
- CommonModule, RouterModule, FormsModule, ReactiveFormsModule, ErrorMessagesModule, MatSlideToggleModule
- ],
- declarations: [
- MailPrefsComponent
- ],
- providers:[MailPrefsService],
- exports: [
- MailPrefsComponent
- ]
-})
-export class MailPrefsModule { }
diff --git a/fos/fos.component.html b/fos/fos.component.html
index d4c076cf..5121aa2f 100644
--- a/fos/fos.component.html
+++ b/fos/fos.component.html
@@ -7,9 +7,9 @@
-
- Beta
-
+
+
+
@@ -139,7 +139,7 @@
diff --git a/fos/fos.component.ts b/fos/fos.component.ts
index 043e7bd5..3065b2c0 100644
--- a/fos/fos.component.ts
+++ b/fos/fos.component.ts
@@ -15,6 +15,7 @@ import {PiwikService} from "../utils/piwik/piwik.service";
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
import Timeout = NodeJS.Timeout;
import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service";
+import {SearchFields} from "../utils/properties/searchFields";
declare var UIkit;
@@ -46,6 +47,7 @@ export class FosComponent implements OnInit, OnDestroy {
private timeout: Timeout;
@ViewChild('tabs') tabs: ElementRef;
public sliderInit: boolean = false;
+ private searchFieldsHelper: SearchFields = new SearchFields();
constructor(
private vocabulariesService: ISVocabulariesService,
@@ -217,6 +219,6 @@ export class FosComponent implements OnInit, OnDestroy {
public buildFosQueryParam(fos) {
// return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)};
- return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)}));
+ return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)}));
}
}
diff --git a/landingPages/annotation/annotation.component.ts b/landingPages/annotation/annotation.component.ts
deleted file mode 100644
index 90a26f9c..00000000
--- a/landingPages/annotation/annotation.component.ts
+++ /dev/null
@@ -1,225 +0,0 @@
-import {
- Component,
- ElementRef,
- EventEmitter,
- HostListener,
- Input,
- OnDestroy,
- OnInit,
- Output,
- ViewChild
-} from "@angular/core";
-import {Annotation, AnnotationService} from "./annotation.service";
-import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo";
-import {EnvProperties} from "../../utils/properties/env-properties";
-import {properties} from "../../../../environments/environment";
-import {UserManagementService} from "../../services/user-management.service";
-import {COOKIE, Session, User} from "../../login/utils/helper.class";
-import {Subscriber} from "rxjs";
-
-@Component({
- selector: 'b2note',
- template: `
-
0" class="sideInfoTitle uk-margin-small-bottom">Annotations
-
-
-
-
- -
-
{{annotation.type}}
- {{annotation.text}}
-
-
-
-
-
-
-
-
`,
- styleUrls: ['annotation.css']
-})
-export class AnnotationComponent implements OnInit, OnDestroy {
-
- @Input()
- public landingInfo: ResultLandingInfo = null;
- @Input()
- public id: string = null;
- public properties: EnvProperties = properties;
- public url: string = null;
- public pid: string = null;
- public keywords: string[] = [];
- public visible: boolean = false;
- public annotations: Annotation[] = [];
- public annotationSize: number = 10;
- public isLoggedIn: boolean = Session.isLoggedIn();
- public visibleAnnotations: number;
- public loading: boolean = false;
- public submitted: boolean = false;
- @Output()
- public pidEmitter: EventEmitter
= new EventEmitter();
- @ViewChild('iframe') iframe: ElementRef;
- @ViewChild('form') form: ElementRef;
- private subscriptions: any[] = [];
-
- constructor(private annotationService: AnnotationService) {
- }
-
- @HostListener('window:message', ['$event'])
- public onChange(event) {
- if (this.properties.b2noteAPIURL.includes(event.origin)) {
- if (event.data === "B2NOTE loaded") {
- let token = COOKIE.getCookie('AccessToken');
- this.iframe.nativeElement.contentWindow.postMessage({token: token}, this.properties.b2noteAPIURL);
- } else {
- this.getAnnotations();
- }
- }
- }
-
- ngOnInit(): void {
- this.visibleAnnotations = this.annotationSize;
- if (typeof window !== "undefined") {
- let id = this.id;
- this.url = window.location.href;
- if (this.landingInfo.deletedByInferenceIds) {
- id = this.landingInfo.deletedByInferenceIds[0];
- this.url = this.url.replace(this.id, id);
- }
- if (this.landingInfo.identifiers && this.landingInfo.identifiers.size > 0) {
- if (this.landingInfo.identifiers.get('doi')) {
- this.pid = this.landingInfo.identifiers.get('doi')[0];
- } else {
- const key: string = this.landingInfo.identifiers.keys().next().value;
- if (key) {
- this.pid = this.landingInfo.identifiers.get(key)[0];
- }
- }
- }
- if (this.pid) {
- this.getAnnotations();
- }
- this.pidEmitter.emit(this.pid);
- }
- }
-
- public get enabled(): boolean {
- return this.pid && this.isLoggedIn;
- }
-
- private clearSubscriptions() {
- this.subscriptions.forEach(subscription => {
- if (subscription instanceof Subscriber) {
- subscription.unsubscribe();
- }
- });
- this.subscriptions = [];
- }
-
- private getAnnotations() {
- if (!this.annotations || this.annotations.length === 0) {
- this.loading = true;
- }
- this.subscriptions.push(this.annotationService.getAllAnnotations(this.pid).subscribe(annotations => {
- this.annotations.forEach((annotation, index) => {
- if (!annotations.find(element => element.type === annotation.type && element.text === annotation.text)) {
- this.annotations.splice(index, 1);
- }
- });
- annotations.forEach(annotation => {
- if (!this.annotations.find(element => element.type === annotation.type && element.text === annotation.text)) {
- annotation.targetSize = 3;
- this.annotationService.getAnnotationTargets(annotation.text, annotation.type).subscribe(targets => {
- annotation.targets = targets.filter(target => target.id !== this.pid);
- });
- this.annotations.push(annotation);
- }
- });
- this.annotations = this.sort(this.annotations);
- this.loading = false;
- }, error => {
- this.loading = false;
- }));
- }
-
- public sort(annotations: Annotation[]): Annotation[] {
- return annotations.sort((a, b) => {
- if (a.type === b.type) {
- return 1;
- } else if (a.type === 'semantic') {
- return -1;
- } else if (b.type === 'semantic') {
- return 1;
- } else if (a.type === 'keyword') {
- return -1;
- } else if (b.type === 'keyword') {
- return 1;
- }
- });
- }
-
- public searchPid(pid: string): { [k: string]: any; } {
- return {
- pid: pid
- }
- }
-
- ngOnDestroy() {
- this.clearSubscriptions();
- }
-
- toggleAnnotation(event) {
- if (this.visible) {
- event.preventDefault();
- } else if(!this.submitted) {
- this.form.nativeElement.submit();
- this.submitted = true;
- }
- this.visible = !this.visible;
- }
-
- open(i: number) {
- this.annotations.forEach((annotation, index) => {
- if (index != i) {
- annotation.targetSize = 3;
- } else {
- annotation.targetSize = annotation.targets.length
- }
- });
- }
-}
diff --git a/landingPages/annotation/annotation.css b/landingPages/annotation/annotation.css
deleted file mode 100644
index 4a2961d3..00000000
--- a/landingPages/annotation/annotation.css
+++ /dev/null
@@ -1,41 +0,0 @@
-.widget-container {
- position: fixed;
- left: 50%;
- top: 50%;
- z-index: 1000;
- padding: 19px;
- margin-left: -167px;
- margin-top: -311px;
- box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
- 0 2px 2px 0 rgba(0, 0, 0, 0.14),
- 0 1px 5px 0 rgba(0, 0, 0, 0.12);
- border: 1px solid #e3e3e3;
- border-radius: 4px;
- outline: 0;
- min-height: 20px;
- background-color: #f5f5f5;
- cursor: move;
-}
-
-.widget-container:hover, .widget-container:active{
- box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
- 0 8px 10px 1px rgba(0, 0, 0, 0.14),
- 0 3px 14px 2px rgba(0, 0, 0, 0.12);
-}
-
-.close {
- float: right;
- padding: 0;
- cursor: pointer;
- background: transparent;
- border: 0;
- font-size: 21px;
- font-weight: bold;
- opacity: 0.2;
-}
-
-.b2note-iframe {
- width: 100%;
- height: 600px;
- border: 1px solid #dddddd;
-}
diff --git a/landingPages/annotation/annotation.module.ts b/landingPages/annotation/annotation.module.ts
deleted file mode 100644
index cca05c28..00000000
--- a/landingPages/annotation/annotation.module.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import {NgModule} from "@angular/core";
-import {AnnotationComponent} from "./annotation.component";
-import {CommonModule} from "@angular/common";
-import {DragDropModule} from "@angular/cdk/drag-drop";
-import {RouterModule} from "@angular/router";
-import {LoadingModule} from "../../utils/loading/loading.module";
-
-@NgModule({
- imports: [CommonModule, DragDropModule, RouterModule, LoadingModule],
- declarations: [AnnotationComponent],
- exports: [AnnotationComponent]
-})
-export class AnnotationModule {}
diff --git a/landingPages/annotation/annotation.service.ts b/landingPages/annotation/annotation.service.ts
deleted file mode 100644
index 992f9044..00000000
--- a/landingPages/annotation/annotation.service.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import {Injectable} from "@angular/core";
-import {HttpClient} from "@angular/common/http";
-import {Observable} from "rxjs";
-import {EnvProperties} from "../../utils/properties/env-properties";
-import {map} from "rxjs/operators";
-import {properties} from "../../../../environments/environment";
-
-export interface AnnotationTarget {
- id: string;
- url: string;
-}
-
-export interface Annotation {
- text: string;
- type: 'semantic' | 'keyword' | 'comment';
- targets?: AnnotationTarget[];
- targetSize?: number;
-}
-
-@Injectable({
- providedIn: "root"
-})
-export class AnnotationService {
-
- api = 'api/';
-
- constructor(private http: HttpClient) {
- }
-
- getAllAnnotations(source: string): Observable {
- let url = properties.b2noteAPIURL + this.api + 'annotations?target-id[]=' + encodeURIComponent(source);
- return this.http.get(url).pipe(map((response: any[]) => {
- return this.parseAnnotations(response);
- }));
- }
-
- getAnnotationTargets(value: string, type: 'semantic' | 'keyword' | 'comment'): Observable {
- let url = properties.b2noteAPIURL + this.api + 'annotations?value=' + encodeURIComponent(value) + '&type[]=' + type;
- return this.http.get(url).pipe(map((response: any[]) => {
- return this.parseAnnotationTargets(response);
- }));
- }
-
- private parseAnnotations(response: any[]): Annotation[] {
- let annotations: Annotation[] = [];
- if (response && response.length > 0) {
- response.forEach(value => {
- if (value.visibility === 'public') {
- let body = value.body;
- if (body.type === 'TextualBody') {
- if (body.purpose === 'tagging') {
- annotations.push({
- text: body.value,
- type: "keyword"
- });
- } else {
- annotations.push({
- text: body.value,
- type: "comment"
- });
- }
- } else {
- let items = body.items;
- let text: string = null;
- items.forEach(item => {
- if (item.type === 'TextualBody') {
- text = item.value;
- }
- });
- annotations.push({
- text: text,
- type: "semantic"
- });
- }
- }
- });
- }
- return annotations;
- }
-
- private parseAnnotationTargets(response: any[]): AnnotationTarget[] {
- let targets: AnnotationTarget[] = [];
- if (response && response.length > 0) {
- response.forEach(value => {
- if (value.visibility === 'public') {
- targets.push({
- id: value.target.id,
- url: value.target.source
- });
- }
- });
- }
- return targets;
- }
-}
diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html
index 569bc81f..59528c96 100644
--- a/landingPages/dataProvider/dataProvider.component.html
+++ b/landingPages/dataProvider/dataProvider.component.html
@@ -188,7 +188,7 @@
-
+
diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts
deleted file mode 100644
index b17c82c5..00000000
--- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts
+++ /dev/null
@@ -1,302 +0,0 @@
-import {Component, Input} from '@angular/core';
-import {ActivatedRoute, Router} from '@angular/router';
-import {Meta, Title} from '@angular/platform-browser';
-
-import {EnvProperties} from '../../utils/properties/env-properties';
-
-import {HtmlProjectReportService} from './htmlProjectReport.service';
-import {ProjectService} from '../project/project.service';
-import {PiwikService} from '../../utils/piwik/piwik.service';
-import {SEOService} from '../../sharedComponents/SEO/SEO.service';
-import {HelperService} from "../../utils/helper/helper.service";
-import {Subscriber} from "rxjs";
-import {properties} from "../../../../environments/environment";
-
-declare var UIkit: any;
-
-@Component({
- selector: 'htmlProjectReport',
- template: `
-
-
-
-
0"
- [texts]="pageContents['top']" styleName="uk-width-1-1">
-
-
{{warningMessage}}
-
-
-
-
{{header1}}
-
{{header2}}
-
-
-
-
-
-
-
-
{{errorMessage}}
-
-
-
0"
- [texts]="pageContents['bottom']" styleName="uk-width-1-1">
-
-
-
-
- `
-})
-export class HtmlProjectReportComponent {
- @Input() communityId = null;
- private projectId: string;
- private totalResults: number = 10;
- private resultsType: string = "publication";
-
- public header1: string = "";
- public header2: string = "";
- public htmlResult: string = "";
-
- subscriptions = [];
-
- public warningMessage: string = "";
- public errorMessage: string = "";
- public showLoading: boolean = true;
- properties: EnvProperties;
- public pageContents = null;
- public divContents = null;
-
- constructor(private route: ActivatedRoute,
- private htmlService: HtmlProjectReportService,
- private _piwikService: PiwikService,
- private _projectService: ProjectService,
- private _meta: Meta,
- private _title: Title,
- private _router: Router,
- private helper: HelperService,
- private seoService: SEOService) {
- }
-
- ngOnInit() {
-
- this.properties = properties;
- //this.getDivContents();
- this.getPageContents();
- this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
- this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url);
-
-
- this.subscriptions.push(this.route.queryParams.subscribe(params => {
- this.projectId = params['projectId'];
-
- if (params['size'] == parseInt(params['size'], 10)) {
- this.totalResults = params['size'];
- } else {
- this.showLoading = false;
- this.warningMessage = "Requested size is not an integer";
- }
-
- if (params['type'] && (params['type'] == "publication" || params['type'] == "dataset" || params['type'] == "software" || params['type'] == "other")) {
- if (params['type'] == "publication") {
- this.resultsType = 'publication';
- } else if (params['type'] == "dataset") {
- this.resultsType = 'research data';
- } else if (params['type'] == "software") {
- this.resultsType = 'software';
- } else if (params['type'] == "other") {
- this.resultsType = "other research product";
- }
-
- var title = "Project's " + this.resultsType + " report";
- var description = "project, project " + this.resultsType + " report, funding, open access, publications, research data, software, other research products";
- this.updateTitle(title);
- this.updateDescription(description);
-
-
- } else {
- this.showLoading = false;
- this.warningMessage = "Requested type should be publication or research data or software or other research product";
- }
-
- //showLoading is true if no warnings
- if (this.showLoading) {
- if (this.projectId) {
- this.createHeaders();
- } else {
- this.showLoading = false;
- this.warningMessage = "No valid project id";
- }
- }
- }));
- }
-
- private getPageContents() {
- if(this.communityId) {
- this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
- this.pageContents = contents;
- }));
- }
- }
-
- private getDivContents() {
- if(this.communityId) {
- this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
- this.divContents = contents;
- }));
- }
- }
-
- ngOnDestroy() {
- this.subscriptions.forEach(subscription => {
- if (subscription instanceof Subscriber) {
- subscription.unsubscribe();
- }
- });
- }
-
- private createHeaders() {
- this.subscriptions.push(this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe(
- data => {
- this.createHeader1(data);
- if (data.acronym) {
- this.updateTitle(data.acronym + " " + this.resultsType + " report");
- } else if (data.title) {
- this.updateTitle(data.title + " " + this.resultsType + " report");
- }
- this.subscriptions.push(this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report").subscribe());
- },
- err => {
- this.handleError("Error getting html information for project id: " + this.projectId, err);
- //console.log(err);
- this.createClipboard();
- }
- ));
-
- if (this.resultsType == "publication") {
- this.header2 += this.totalResults.toLocaleString('en-US') + " publications";
- } else if (this.resultsType == "research data") {
- this.header2 += this.totalResults.toLocaleString('en-US') + " research data";
- } else if (this.resultsType == "software") {
- this.header2 += this.totalResults.toLocaleString('en-US') + " software";
- } else if (this.resultsType == "other research product") {
- this.header2 += this.totalResults.toLocaleString('en-US') + " other";
- }
- }
-
- private createClipboard() {
- let intro: string = '';
- intro += '';
- intro += '';
- intro += '' + this.header1 + ''
- intro += '';
-
- if (typeof window !== 'undefined') {
- this.subscriptions.push(this.htmlService.getHTML(this.projectId, this.resultsType, this.properties.csvAPIURL).subscribe(
- data => {
- //let body: string = intro+''+this.header1+'
'+this.header2+'
'+data+'';
- let body: string = intro + '' + this.header1 + '
' + this.header2 + '
';
- body += " Title | Authors | Publication Year | DOI | Permanent Identifier | Publication type | Journal | Project Name (GA Number) | Access Mode |
" + data + "
";
- body += '