Add checks when location or document is used.
Get environment from properties file instead of domain

Invite, Subscribe, Manage Buttons: Smaller buttons, smaller icons





git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@54852 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-02-18 15:15:53 +00:00
parent 99e565163b
commit 5f0d09bc83
18 changed files with 76 additions and 67 deletions

View File

@ -68,7 +68,7 @@ export class AppComponent {
var community = null;
this.community = null;
this.showMenu = false;
// var test:MenuItem = new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId});
// var test:MenuItem = new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],this.properties.environment!="development"?{}:{communityId:community.communityId});
// test.
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
@ -76,34 +76,34 @@ export class AppComponent {
for(var com of communities){
if((data['communityId'] && data['communityId']!="" && com.communityId == data['communityId'])
|| (ConnectHelper.getCommunityFromDomain(document.location.hostname) == com.communityId )){
|| (typeof document !== 'undefined' && (ConnectHelper.getCommunityFromDomain(document.location.hostname) == com.communityId ) )){
community = com;
this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
this.menuItems= [
// {rootItem: new MenuItem("dashboard","Dashboard","","/",false,[],[],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
// {rootItem: new MenuItem("dashboard","Dashboard","","/",false,[],[],this.properties.environment!="development"?{}:{communityId:community.communityId}),
// items: []
// },
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
]},
{
rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: []
},
{
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets","/participate/share-zenodo"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets","/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: [
new MenuItem("","Zenodo Communities","","/participate/share-zenodo",false,[],["/participate/share-zenodo"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId})]
new MenuItem("","Zenodo Communities","","/participate/share-zenodo",false,[],["/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId})]
},
{
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: []
}
];
@ -128,15 +128,15 @@ export class AppComponent {
}else{
this.bottomMenuItems = [
new MenuItem("","About","","/about",false,[],["/about"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Organizations","","/organizations",false,[],["/organizations"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId})
new MenuItem("","About","","/about",false,[],["/about"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Organizations","","/organizations",false,[],["/organizations"],this.properties.environment!="development"?{}:{communityId:community.communityId})
];
if(this.properties.showContent){
this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
}
this.userMenuItems =[ new MenuItem("","My profile","","",false,[],[],{}),
new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","Invite users","","/invite",false,[],[],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Invite users","","/invite",false,[],[],this.properties.environment!="development"?{}:{communityId:community.communityId}),
];
}
this.showMenu = true;

View File

@ -17,7 +17,7 @@ export class OpenaireDirectLinkingComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}

View File

@ -18,7 +18,7 @@ export class OpenaireLinkingComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}

View File

@ -163,7 +163,7 @@
</div>
</div>
<div class="uk-container uk-margin-top ">
<div class="uk-child-width-1-3@m uk-text-center uk-grid-match portal-hr " uk-grid >
<div class="uk-child-width-1-3@m uk-child-width-1-2@s uk-child-width-1-1@xs uk-text-center uk-grid-match portal-hr " uk-grid >
<ng-container *ngFor="let item of communitiesToShow; let i = index">
<div *ngIf="showCommunity(item)" class="uk-padding-small">
<div class="uk-card uk-card-default uk-margin-bottom uk-padding-small">

View File

@ -78,11 +78,11 @@ export class CommunitiesComponent {
}
}
isProduction():boolean{
return ConnectHelper.isProduction(document.location.hostname);
return this.properties.environment!="development";
}
getProductionPrefix():string{
return ConnectHelper.getProductionPrefix(document.location.hostname);
return (this.properties.environment =="beta")?"beta.":""
}
showCommunity(community):boolean{
if(community['status'] == "hidden"){

View File

@ -1,4 +1,4 @@
<div class=" uk-section uk-margin-small-top tm-middle uk-container" id="tm-main">
<div class="uk-section uk-margin-top tm-middle uk-container uk-padding-small-top" id="tm-main">
<div class="uk-container uk-margin-bottom uk-grid">
<div class="uk-width-expand uk-padding-remove">

View File

@ -1,4 +1,4 @@
import {Component, Input, Output} from '@angular/core';
import {Component, Input, Output, ElementRef} from '@angular/core';
import {EventEmitter, ViewChild} from '@angular/core';
import {ChangeDetectionStrategy} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
@ -65,6 +65,7 @@ export class CommunityComponent {
public subOrps;
constructor (
private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
private location: Location,
@ -189,6 +190,9 @@ export class CommunityComponent {
);
}
});
// if (typeof document !== 'undefined') {
// this.element.nativeElement.scrollIntoView();
// }
}
public searchPublications() {

View File

@ -24,7 +24,7 @@ export class CommunityWrapperComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if(this.communityId){

View File

@ -51,7 +51,7 @@ export class ShareInZenodoComponent {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}

View File

@ -26,7 +26,7 @@ export class HtmlPageComponent {
this.route.queryParams.subscribe(
params => {
this.communityId = params['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if(!this.communityId){

View File

@ -67,7 +67,7 @@ export class OpenaireSearchDataprovidersComponent {
//this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -67,7 +67,7 @@ export class OpenaireSearchProjectsComponent {
//this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -97,7 +97,7 @@ export class StatisticsComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if(this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')){

View File

@ -9,8 +9,11 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
template: `
<a *ngIf="isManager" [href]="'https://beta.admin.connect.openaire.eu/dashboard?communityId='+communityId" class="uk-button uk-button-default uk-margin-left" target="_blank" >
<span class=" uk-icon"> <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog" ratio="1"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg></span>
<a *ngIf="isManager" [href]="'https://beta.admin.connect.openaire.eu/dashboard?communityId='+communityId" class="uk-button uk-button-default uk-button-small uk-margin-left " target="_blank" >
<span uk-icon="">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog" ratio="0.8"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
</span>
Manage</a>

View File

@ -3,7 +3,7 @@
<div class="uk-container uk-margin-bottom">
<div id="invite" class=" uk-card uk-card-default uk-padding">
<div id="invite" class=" uk-card uk-card-default uk-padding uk-margin-top">
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Invite users to subscribe</div>
<div class="uk-margin-top">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages>
@ -180,9 +180,9 @@
<button class=" uk-button uk-button-primary uk-button-small " (click)="invite()">Invite</button>
<a class=" uk-button uk-button-default uk-button-small " [queryParams]="communityIdParam" routerLinkActive="router-link-active" routerLink="/invite">
<span class="uk-margin-xsmall-left uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog" ratio="1"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path>
</svg>
</span>
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog" ratio="0.8"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
</span>
Customize
</a>
</div>

View File

@ -63,14 +63,7 @@ export class InviteComponent implements OnInit {
private _emailService: EmailService,
private _communityService: CommunityService) {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.communityIdParam = (ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:this.communityId};
});
this.errorCodes = new ErrorCodes();
this.status = this.errorCodes.LOADING;
}
@ -82,25 +75,34 @@ export class InviteComponent implements OnInit {
this.errorMessage = "";
this.missingCommunityId = "";
this.status = this.errorCodes.LOADING;
if (this.communityId != null && this.communityId != '') {
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
this.community = community;
this.fullname = Session.getUserFullName();
//console.log("Fullname from session " + Session.getUserFullName());
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.communityIdParam = (this.properties.environment !="development" )?{}:{communityId:this.communityId};
if (this.communityId != null && this.communityId != '') {
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
this.community = community;
this.fullname = Session.getUserFullName();
//console.log("Fullname from session " + Session.getUserFullName());
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.recipients = "";
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.recipients = "";
this.status = this.errorCodes.DONE;
},
error => this.handleError(error)
);
} else {
this.status = this.errorCodes.DONE;
this.missingCommunityId = "There is no community selected!";
}
this.status = this.errorCodes.DONE;
},
error => this.handleError(error)
);
} else {
this.status = this.errorCodes.DONE;
this.missingCommunityId = "There is no community selected!";
}
});
this.scroll();
});

View File

@ -23,8 +23,8 @@ declare var UIkit: any;
<a class="uk-alert-close" uk-close></a>
<p>Please login first to subscribe</p>
</div>
<a *ngIf="!subscribed" [class]="'uk-button portal-button' + (loading ? ' uk-disabled' : '')" (click)="subscribe()"> Subscribe</a>
<a *ngIf="subscribed" [class]="'uk-button uk-button-danger' + (loading ? ' uk-disabled' : '')" (click)="confirmOpen()"> Unsubscribe</a>
<a *ngIf="!subscribed" [class]="'uk-button portal-button uk-button-small' + (loading ? ' uk-disabled' : '')" (click)="subscribe()"> Subscribe</a>
<a *ngIf="subscribed" [class]="'uk-button uk-button-danger uk-button-small' + (loading ? ' uk-disabled' : '')" (click)="confirmOpen()"> Unsubscribe</a>
</span>
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0" >

View File

@ -1,5 +1,5 @@
{
"environment" : "beta",
"environment" : "development",
"enablePiwikTrack" : false,
"enableHelper" : true,
"useCache" : false,