Use openaire AAI, update properties | add manage component - button| open communities in new tab| remove manage links from user menu

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51642 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-04-03 12:38:28 +00:00
parent 23972db27d
commit 985fa06e99
12 changed files with 107 additions and 39 deletions

View File

@ -32,7 +32,7 @@
"piwikBaseUrl" :" https://analytics.openaire.eu/piwik.php?idsite=6",
"loginUrl" :"https://beta.services.openaire.eu/connect-user-management/openid_connect_login",
"logoutUrl" :"https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"logoutOpenaireUrl" :"http://dl067.madgik.di.uoa.gr/idp/profile/Logout",
@ -48,8 +48,8 @@
"adminToolsCommunity" :"openaire",
"communityAPI": "https://dev-openaire.d4science.org/openaire/community/",
"communitiesAPI": "https://dev-openaire.d4science.org/openaire/community/communities",
"communityAPI": "https://beta.services.openaire.eu/openaire/community/",
"communitiesAPI": "https://beta.services.openaire.eu/openaire/community/communities",
"csvLimit": 2000,
"pagingLimit": 20,

View File

@ -19,7 +19,7 @@ import {ConnectHelper} from './openaireLibrary/connect/connectHelper';
<navbar *ngIf= "properties && showMenu && !community" portal="connect" onlyTop=false [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [showMenu]=showMenu></navbar>
<navbar *ngIf= "properties && community" portal="connect" onlyTop=false [(communityId)]="community.id" [userMenuItems]=userMenuItems [menuItems]=menuItems
<navbar *ngIf= "properties && showMenu && community" portal="connect" onlyTop=false [(communityId)]="community.id" [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [(community)]=community [showMenu]=showMenu></navbar>
<div class="custom-main-content" >
@ -35,7 +35,8 @@ import {ConnectHelper} from './openaireLibrary/connect/connectHelper';
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf= "isClient"></bottom>
<bottom *ngIf= "isClient && showMenu && !community"></bottom>
<bottom *ngIf= "isClient && community" [showSocialButton] = "false" [showMenu]=false [showDnet] =false showOpenaire=true></bottom>
`
@ -68,29 +69,15 @@ export class AppComponent {
this.showMenu = false;
this._communitiesService.getCommunities(this.properties.communityAPI+"communities").subscribe (
communities => {
// this.community = community;
this.userMenuItems =[ new MenuItem("","My profile","","",false,[],[],{}),
new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}),
];
for(var com of communities){
if(Session.isCommunityCurator()||Session.isPortalAdministrator()){
this.userMenuItems.push(new MenuItem("","Manage "+((com.shortTitle)?com.shortTitle:com.title),"https://admin.demo.openaire.eu?communityId="+com.communityId,"",false,[],[],{}));
}else{
for(var manager of com.managers){
if(manager== Session.getUserEmail()){
this.userMenuItems.push(new MenuItem("","Manage "+((com.shortTitle)?com.shortTitle:com.title),"https://admin.demo.openaire.eu?communityId="+com.communityId,"",false,[],[],{}));
}
}
}
if((data['communityId'] && data['communityId']!="" && com.communityId == data['communityId'])
|| (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("home","Home",(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?'https://beta.connect.openaire.eu':'',(typeof document === 'undefined' || !ConnectHelper.isProduction(document.location.hostname))?'/':'',false,[],[],{}),
items: []},
{rootItem: new MenuItem("dashboard","Dashboard","","/",false,[],[],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
items: []
},
@ -121,10 +108,7 @@ export class AppComponent {
}
if(community == null){
this.menuItems= [
{rootItem: new MenuItem("communities","Communities","","/",false,[],[],{}),
items: []}
];
this.menuItems= [];
}
this.showMenu = true;

View File

@ -19,7 +19,7 @@ import {NavigationBarModule} from './openaireLibrary/sharedComponent
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import {CommunityService} from './openaireLibrary/connect/community/community.service';
// import {CommunityService} from './openaireLibrary/connect/community/community.service';
import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service';
//import { LibSearchProjectsModule } from './searchPages/simple/searchProjects.module';
@ -38,7 +38,7 @@ import {CommunitiesService} from './openaireLibrary/connect/communi
],
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],
providers:[EnvironmentSpecificResolver, CommunityService, CommunitiesService ],
providers:[EnvironmentSpecificResolver, CommunitiesService ],
bootstrap: [AppComponent]
})
//

View File

@ -22,20 +22,20 @@
</div>
<div *ngIf= "communitiesResults != null && communitiesResults.length > 0">
<div class="uk-container uk-margin-top uk-margin-bottom">
<div class="uk-child-width-1-3@m uk-text-center " uk-grid>
<div class="uk-child-width-1-3@m uk-text-center uk-grid-match " uk-grid >
<div *ngFor="let item of communitiesResults; let i = index">
<div class="uk-card uk-card-default uk-margin-bottom">
<span *ngIf= "item.logoUrl != null">
<div class="uk-card-media-top">
<img src="{{item.logoUrl}}" alt="A logo goes here" class="uk-height-small uk-responsive-height ">
<img src="{{item.logoUrl}}" alt="{{(item.title)?item.title:item.shortTitle}} logo" class="uk-height-small uk-responsive-height ">
</div>
</span>
<div class="uk-card-body">
<div>
<h3 class="uk-card-title">
<a *ngIf="!isProduction()" [queryParams]="{communityId: item.communityId}" routerLinkActive="router-link-active" routerLink="/">
<a *ngIf="!isProduction()" [queryParams]="{communityId: item.communityId}" routerLinkActive="router-link-active" routerLink="/" target="_blank">
{{(item.title)?item.title:item.shortTitle}}</a>
<a *ngIf="isProduction()" href="{{'https://'+getProductionPrefix()+item.communityId+'.openaire.eu'}}">
<a *ngIf="isProduction()" href="{{'https://'+getProductionPrefix()+item.communityId+'.openaire.eu'}}" target="_blank">
{{(item.title)?item.title:item.shortTitle}}</a>
</h3>
</div>
@ -50,6 +50,7 @@
</div-->
<p *ngIf="item.description != null" >{{item.description}}</p>
<subscribe [communityId]="item.communityId"></subscribe>
<manage [communityId]="item.communityId"></manage>
</div>
</div>
</div>

View File

@ -4,8 +4,8 @@ import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
// import {CommunitiesRoutingModule} from './communities-routing.module';
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {ManageModule} from '../utils/manage/manage.module';
import {CommunitiesComponent} from './communities.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
@ -19,8 +19,8 @@ import {CommunitiesService} from '../openaireLibrary/connect/communities/c
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
// CommunitiesRoutingModule,
SubscribeModule
// CommunitiesRoutingModule,
SubscribeModule, ManageModule
],
declarations: [
CommunitiesComponent

View File

@ -6,7 +6,9 @@
<div *ngIf="communityId == null || communityId == ''" class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-alert uk-alert-primary">
No community chosen
</div>
<subscribe *ngIf="communityId != null && communityId != ''" [communityId]="communityId" class=" uk-align-right"></subscribe>
<manage *ngIf="communityId != null && communityId != ''" [communityId]="communityId" class=" uk-float-right"></manage>
<subscribe *ngIf="communityId != null && communityId != ''" [communityId]="communityId" class=" uk-float-right"></subscribe>
<div *ngIf="communityId != null && communityId != '' && community != null">
<blockquote>
<div *ngIf="community.title != null">

View File

@ -16,13 +16,15 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {ManageModule} from '../utils/manage/manage.module';
import {StatisticsModule} from "../statistics/statistics.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
// CommunityRoutingModule,
SubscribeModule, StatisticsModule
SubscribeModule, StatisticsModule, ManageModule
],
declarations: [
CommunityComponent, ResultsComponent

View File

@ -0,0 +1,51 @@
import { Component, Input, ViewChild } from '@angular/core';
import { Location } from '@angular/common';
import {ActivatedRoute} from '@angular/router';
import { EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
@Component({
selector: 'manage',
template: `
<a *ngIf="isManager" [href]="'https://admin.demo.openaire.eu/dashboard?communityId='+communityId" class="uk-button uk-button-default uk-margin-left" target="_blank" >
<span class="uk-margin-small-right uk-icon" uk-icon="cog"> </span>Manage</a>
`
})
export class ManageComponent {
@Input() communityId:string;
isManager:boolean = false;
properties:EnvProperties;
constructor (private route: ActivatedRoute,
private _communityService: CommunityService
) {
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if(Session.isLoggedIn()){
if(Session.isPortalAdministrator()||Session.isCommunityCurator()){
this.isManager = true;
}else if(Session.isLoggedIn()){
var email = Session.getUserEmail();
this._communityService.iscommunityManager(this.properties.communityAPI+ this.communityId, email).subscribe (
res => {
this.isManager = res;
});
}
}
});
}
}

View File

@ -0,0 +1,23 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {ManageComponent} from './manage.component';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
@NgModule({
imports: [
CommonModule, RouterModule, AlertModalModule
],
declarations: [
ManageComponent
],
providers:[
CommunityService
],
exports: [
ManageComponent
]
})
export class ManageModule { }

View File

@ -10,14 +10,14 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
selector: 'subscribe',
template: `
<div *ngIf="subscribed != null && !showNumbers">
<span *ngIf="subscribed != null && !showNumbers">
<div *ngIf="!subscribed && showLoginAlert" class="uk-alert-warning uk-animation-slide-bottom" uk-alert="" >
<a class="uk-alert-close" uk-close></a>
<p>Please login first to subscribe</p>
</div>
<a *ngIf="!subscribed" class="uk-button uk-button-primary" (click)="subscribe()"> Subscribe</a>
<a *ngIf="subscribed" class="uk-button uk-button-danger" (click)="confirmOpen()"> Unsubscribe</a>
</div>
</span>
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0" >
Members: {{subscribers}}

View File

@ -19,3 +19,8 @@
bottom:0;
left:0;
}
.uk-button-default:hover,.uk-button-default:focus,.btn:hover,.btn:focus {
background-color:#fff !important;
color:#5b5b5b !important;
box-shadow:0 6px 50px rgba(0,0,0,0.05)
}

View File

@ -42,9 +42,9 @@
"piwikBaseUrl" :" https://analytics.openaire.eu/piwik.php?idsite=6",
"loginUrl" :"http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login",
"loginUrl" :"http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login",
"logoutUrl" :"https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"logoutOpenaireUrl" :"http://dl067.madgik.di.uoa.gr/idp/profile/Logout",