[Trunk|Connect]
Menus: add technical support link Community Page: show statistic boxes when results > 0 Add links to advanced search from subjects Layout changes to iframes scrollInto view after API response Add z-index in community toolbar ZenodoCommunities: scrollInto view after API response User component: add here all connect specific errors use subscribe component as @ViewChild use library user component as @ViewChild use subscribe and login functions in this component Subscibe: add event Emitter and send event after a user subscribes when a user is not logged in, redirect to user-info page Search PAges: remove background from community pages git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55366 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
1e887a0197
commit
fd0c6fe53d
|
@ -185,6 +185,9 @@ export class AppComponent {
|
|||
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}),
|
||||
];
|
||||
if(this.managerOfCommunities.length > 0 ){
|
||||
this.userMenuItems.push(new MenuItem("","Technical support","https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611","",false,[],[],{}))
|
||||
}
|
||||
}
|
||||
this.showMenu = true;
|
||||
});
|
||||
|
|
|
@ -6,11 +6,11 @@ import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
|
|||
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
||||
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
|
||||
|
||||
//LoginGuard
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard, ConnectSubscriberGuard], data: {
|
||||
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, ConnectSubscriberGuard ], data: {
|
||||
redirect: '/error'
|
||||
}, canDeactivate: [PreviousRouteRecorder]},
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="stickhere">
|
||||
</div>
|
||||
<div *ngIf="communityInfo" class="uk-section uk-margin-top uk-padding-remove-bottom uk-visible@m " uk-sticky="top: #stickhere">
|
||||
<div *ngIf="communityInfo" class="uk-section uk-margin-top uk-padding-remove-bottom uk-visible@m communityToolBarSection" uk-sticky="top: #stickhere">
|
||||
<div class="communityToolBar uk-padding-small uk-margin-small-top">
|
||||
<div class="uk-container uk-text-center uk-margin-small-top uk-margin-small-bottom">
|
||||
<manage *ngIf="communityId != null && communityId != '' && isManager()" [communityId]="communityId" class=" " [buttonSizeSmall]=false></manage>
|
||||
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="communityInfo" class="uk-section uk-margin-top uk-padding-remove-bottom uk-hidden@m" >
|
||||
<div *ngIf="communityInfo" class="uk-section uk-margin-top uk-padding-remove-bottom uk-hidden@m communityToolBarSection" >
|
||||
<div class="communityToolBar uk-padding-small">
|
||||
<div class="uk-container uk-text-center uk-margin-small-top uk-margin-small-bottom">
|
||||
<manage *ngIf="communityId != null && communityId != ''" [communityId]="communityId" class=" " [buttonSizeSmall]=false></manage>
|
||||
|
@ -51,9 +51,10 @@
|
|||
<div class="uk-width-2-3@m uk-width-1-1@s">
|
||||
<div>
|
||||
<div class=" uk-text-large uk-margin-bottom">Statistics</div>
|
||||
<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-grid uk-margin-remove">
|
||||
<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-grid uk-margin-remove"
|
||||
uk-scrollspy="cls: uk-animation-fade; target: > div > .uk-card; delay: 450; repeat: false">
|
||||
|
||||
<div *ngIf="publicationTotal != null && isEntityEnabled('publication') && isRouteEnabled('/search/find/publications')" class="uk-padding-remove-left">
|
||||
<div *ngIf="publicationTotal != null && publicationTotal > 0 && isEntityEnabled('publication') && isRouteEnabled('/search/find/publications')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom ">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><span class="uk-text-bold">{{publicationTotal|number}}</span>
|
||||
|
@ -62,7 +63,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="researchDataTotal != null && isEntityEnabled('dataset') && isRouteEnabled('/search/find/datasets')" class="uk-padding-remove-left">
|
||||
<div *ngIf="researchDataTotal != null && researchDataTotal > 0 && isEntityEnabled('dataset') && isRouteEnabled('/search/find/datasets')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><span class="uk-text-bold">{{researchDataTotal|number}}</span>
|
||||
|
@ -70,7 +71,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="softwareTotal != null && isEntityEnabled('software') && isRouteEnabled('/search/find/software')" class="uk-padding-remove-left">
|
||||
<div *ngIf="softwareTotal != null && softwareTotal > 0 && isEntityEnabled('software') && isRouteEnabled('/search/find/software')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom ">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><span class="uk-text-bold">{{softwareTotal|number}}</span>
|
||||
|
@ -79,7 +80,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="orpTotal != null && isEntityEnabled('orp') && isRouteEnabled('/search/find/other')" class="uk-padding-remove-left">
|
||||
<div *ngIf="orpTotal != null && orpTotal > 0 && isEntityEnabled('orp') && isRouteEnabled('/search/find/other')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom ">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/other"><span class="uk-text-bold">{{orpTotal|number}}</span>
|
||||
|
@ -89,7 +90,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div *ngIf="projectTotal != null && isEntityEnabled('project') && isRouteEnabled('/search/find/projects')" class="uk-padding-remove-left">
|
||||
<div *ngIf="projectTotal != null && projectTotal > 0 && isEntityEnabled('project') && isRouteEnabled('/search/find/projects')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom ">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/projects"><span class="uk-text-bold">{{projectTotal|number}}</span>
|
||||
|
@ -98,7 +99,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="contentProviderTotal != null && isEntityEnabled('datasource') && isRouteEnabled('/search/find/dataproviders')" class="uk-padding-remove-left">
|
||||
<div *ngIf="contentProviderTotal != null && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled('/search/find/dataproviders')" class="uk-padding-remove-left">
|
||||
<div class="uk-card uk-card-default uk-card-body uk-padding-remove uk-margin-small-right uk-height-1-1 uk-margin-bottom ">
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<a class="uk-margin-auto-vertical uk-margin-auto" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/dataproviders"><span class="uk-text-bold">{{contentProviderTotal|number}}</span>
|
||||
|
@ -111,11 +112,20 @@
|
|||
<div *ngIf="community.subjects != null && community.subjects.length > 0" class=" uk-text-large uk-margin-bottom uk-margin-top">Subjects related to community</div>
|
||||
<div *ngIf="community.subjects != null">
|
||||
<span *ngFor="let subject of community.subjects.slice(0,10) let i=index">
|
||||
<span *ngIf="subject != ''" class="uk-label uk-margin-small-bottom">{{subject}}</span>
|
||||
<span *ngIf="subject != ''" class="uk-label uk-margin-small-bottom">
|
||||
<a [queryParams]="{subject:createParams(subject), sb: 'and'}" routerLinkActive="router-link-active" routerLink="/search/advanced/publications">
|
||||
{{subject}}
|
||||
</a>
|
||||
</span>
|
||||
<!-- http://scoobydoo.di.uoa.gr:4200/search/advanced/publications?&subject=%22ocean%22&sb=and -->
|
||||
</span>
|
||||
<span *ngIf="showAll">
|
||||
<span *ngFor="let subject of community.subjects.slice(10) let i=index">
|
||||
<span *ngIf="subject != ''" class="uk-label uk-margin-small-bottom">{{subject}}</span>
|
||||
<span *ngIf="subject != ''" class="uk-label uk-margin-small-bottom">
|
||||
<a [queryParams]="{subject:createParams(subject), sb: 'and'}" routerLinkActive="router-link-active" routerLink="/search/advanced/publications">
|
||||
{{subject}}
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span *ngIf="!showAll && community.subjects.length > 10">
|
||||
|
@ -147,12 +157,12 @@
|
|||
|
||||
|
||||
<div *ngIf="isRouteEnabled('/search/find')" class="uk-margin-large-top">
|
||||
<div class="uk-text-large">Search research results</div>
|
||||
<div class="uk-text-large uk-text-bold">Search research results</div>
|
||||
<search-form [setFormCentered]=false [placeholderText]="getSearchPlaceHolder()" link="/search/find"></search-form>
|
||||
</div>
|
||||
|
||||
<div class="uk-margin-large-top">
|
||||
<div class="uk-text-large">
|
||||
<div class="uk-text-large uk-text-bold">
|
||||
Recent research results
|
||||
</div>
|
||||
|
||||
|
@ -169,7 +179,9 @@
|
|||
<results-comp [(results)]=publicationResults [(total)]=publicationTotal resultType="publication" [community]=community [params]=params class="uk-width-expand"></results-comp>
|
||||
<div *ngIf=" activeTab == 'publication' && statistics !=null && statistics.allowedEntities && statistics.statisticsSum && statistics.allowedCharts && statistics.statisticsSum['publication'] && statistics.allowedCharts['publication'] && statistics.statisticsSum['publication'].total>0 && statistics.allowedCharts['publication'].length>0" class="uk-width-1-2@m uk-width-1-1@s">
|
||||
<div *ngFor="let chart of statistics.allowedCharts['publication']" class=" uk-first-column">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] width="750" height="450" scrolling="no"></iframe>
|
||||
<div class="iframeContainer">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -180,8 +192,10 @@
|
|||
<div *ngIf="activeTab == 'dataset' && statistics !=null && statistics.allowedEntities && statistics.statisticsSum && statistics.allowedCharts &&
|
||||
statistics.statisticsSum['dataset'] && statistics.allowedCharts['dataset'] && statistics.statisticsSum['dataset'].total>0 && statistics.allowedCharts['dataset'].length>0"
|
||||
class="uk-width-1-2@m uk-width-1-1@s">
|
||||
<div *ngFor="let chart of statistics.allowedCharts['dataset']" class="uk-width-1-2@l uk-width-1-1@m uk-first-column">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] width="750" height="450" scrolling="no"></iframe>
|
||||
<div *ngFor="let chart of statistics.allowedCharts['dataset']" class=" uk-first-column">
|
||||
<div class="iframeContainer">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -190,8 +204,10 @@
|
|||
<div class="uk-grid">
|
||||
<results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params class="uk-width-expand"></results-comp>
|
||||
<div *ngIf="statistics !=null && statistics.allowedEntities && statistics.statisticsSum && statistics.allowedCharts && statistics.statisticsSum['software'] && statistics.allowedCharts['software'] && statistics.statisticsSum['software'].total>0 && statistics.allowedCharts['software'].length>0" class="uk-width-1-2@m uk-width-1-1@s">
|
||||
<div *ngFor="let chart of statistics.allowedCharts['software']" class="uk-width-1-2@l uk-width-1-1@m uk-first-column">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] width="750" height="450" scrolling="no"></iframe>
|
||||
<div *ngFor="let chart of statistics.allowedCharts['software']" class=" uk-first-column">
|
||||
<div class="iframeContainer">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -200,8 +216,10 @@
|
|||
<div class="uk-grid">
|
||||
<results-comp [(results)]=orpResults [(total)]=orpTotal resultType="other" [community]=community [params]=params class="uk-width-expand"></results-comp>
|
||||
<div *ngIf=" activeTab == 'orp' && statistics !=null && statistics.allowedEntities && statistics.statisticsSum && statistics.allowedCharts && statistics.statisticsSum['orp'] && statistics.allowedCharts['orp'] && statistics.statisticsSum['orp'].total>0 && statistics.allowedCharts['orp'].length>0" class="uk-width-1-2@m uk-width-1-1@s">
|
||||
<div *ngFor="let chart of statistics.allowedCharts['orp']" class="uk-width-1-2@l uk-width-1-1@m uk-first-column">
|
||||
<div *ngFor="let chart of statistics.allowedCharts['orp']" class=" uk-first-column">
|
||||
<div class="iframeContainer">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] width="750" height="450" scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -219,7 +237,9 @@
|
|||
|
||||
<ng-container *ngIf="statistics.allowedCharts[entity] " >
|
||||
<div *ngFor="let chart of statistics.allowedCharts[entity]" class="uk-width-1-2@m uk-first-column">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] width="750" height="450" scrolling="no"></iframe>
|
||||
<div class="iframeContainer">
|
||||
<iframe [src]=statistics.chartsUrlMap[chart] scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
@ -228,7 +248,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,7 @@ import {SearchZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoC
|
|||
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||
import {Session} from '../openaireLibrary/login/utils/helper.class';
|
||||
import {StatisticsForDashboardComponent} from '../statistics/statistics.component';
|
||||
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
||||
|
||||
import {PiwikHelper} from '../utils/piwikHelper';
|
||||
@Component({
|
||||
|
@ -98,6 +99,9 @@ public activeTab = "publication";
|
|||
if (this.communityId != null && this.communityId != '') {
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
||||
community => {
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
this.community = community;
|
||||
if(this.properties.environment == "development"){
|
||||
this.params = {communityId: community.communityId};
|
||||
|
@ -221,9 +225,6 @@ public activeTab = "publication";
|
|||
);
|
||||
}
|
||||
});
|
||||
// if (typeof document !== 'undefined') {
|
||||
// this.element.nativeElement.scrollIntoView();
|
||||
// }
|
||||
}
|
||||
|
||||
public searchPublications() {
|
||||
|
@ -347,6 +348,8 @@ countOtherGraphs(){
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
createParams(param){
|
||||
return StringUtils.quote(StringUtils.URIEncode(param));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export class ShareInZenodoComponent {
|
|||
depositLink = "https://zenodo.org/deposit/new?c=";
|
||||
|
||||
|
||||
constructor ( private route: ActivatedRoute, private _router: Router,
|
||||
constructor (private element: ElementRef, private route: ActivatedRoute, private _router: Router,
|
||||
private _meta: Meta, private _title: Title, private _ΖenodoCommunitieService: ZenodoCommunitiesService,private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {}
|
||||
|
||||
public ngOnInit() {
|
||||
|
@ -63,6 +63,9 @@ export class ShareInZenodoComponent {
|
|||
community => {
|
||||
this.community = community;
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
if(this.masterZenodoCommunityId){
|
||||
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities+this.masterZenodoCommunityId, null).subscribe(
|
||||
result => {
|
||||
|
|
|
@ -7,14 +7,16 @@ import { UserRoutingModule } from './user-routing.module';
|
|||
import { UserModule} from '../openaireLibrary/login/user.module';
|
||||
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import { SubscribeService } from '../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
UserRoutingModule, UserModule
|
||||
|
||||
UserRoutingModule, UserModule, SubscribeModule
|
||||
],
|
||||
providers:[PreviousRouteRecorder],
|
||||
providers:[PreviousRouteRecorder, SubscribeService, EmailService],
|
||||
declarations: [
|
||||
OpenaireUserComponent
|
||||
|
||||
|
|
|
@ -1,11 +1,101 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Component, ElementRef, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
import {UserComponent} from '../openaireLibrary/login/user.component';
|
||||
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||
import {Email} from "../openaireLibrary/utils/email/email";
|
||||
|
||||
import {Session} from '../openaireLibrary/login/utils/helper.class';
|
||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
|
||||
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-user',
|
||||
template: `<user></user>`
|
||||
template: `
|
||||
<div id="tm-main" class="uk-section uk-margin-small-top tm-middle">
|
||||
|
||||
<user [mainComponent]=false></user>
|
||||
<div *ngIf="!server" class=" uk-container uk-container-small uk-position-relative">
|
||||
|
||||
<div *ngIf="usercomponent.errorCode == '6'" class="uk-alert uk-alert-warning">
|
||||
|
||||
<span *ngIf="!isSubscribed">For this action you have to login and subscribe to research community.
|
||||
<span *ngIf="subscribe && !subscribeLoading ">Login and Subscribe here <a [class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()" > here</a>.</span>
|
||||
</span>
|
||||
<span *ngIf="subscribeLoading ">Subscribing to community....</span>
|
||||
<span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span>
|
||||
|
||||
</div>
|
||||
<div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning">
|
||||
This action requires authentication.
|
||||
<span *ngIf="!loggedIn">
|
||||
Please <a class="" (click)="login()" > sign in</a> to continue.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
|
||||
`
|
||||
})
|
||||
|
||||
export class OpenaireUserComponent {
|
||||
@ViewChild(UserComponent) usercomponent:UserComponent;
|
||||
@ViewChild(SubscribeComponent) subscribe:SubscribeComponent;
|
||||
properties:EnvProperties;
|
||||
communityId = null;
|
||||
subscribeLoading:boolean = false;
|
||||
subscribeError:boolean = false;
|
||||
isSubscribed:boolean = false;
|
||||
|
||||
constructor(private _subscribeService: SubscribeService,
|
||||
private _emailService: EmailService, private route: ActivatedRoute){}
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: any }) => {
|
||||
this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = communityId['communityId'];
|
||||
if(!this.communityId){
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
login(){
|
||||
this.usercomponent.logIn();
|
||||
|
||||
}
|
||||
subscribeTo(){
|
||||
if(this.subscribe && this.communityId){
|
||||
this.subscribeLoading = true;
|
||||
this.subscribe.subscribe();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
afterSubscibeEvent($event){
|
||||
var res = $event.value;
|
||||
this.subscribeLoading = false;
|
||||
if(res == "ok"){
|
||||
this.isSubscribed = true;
|
||||
this.usercomponent.redirect();
|
||||
}else{
|
||||
this.subscribeError = true;
|
||||
}
|
||||
|
||||
}
|
||||
loginAndsubscribe(){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { Component, Input, Output, ViewChild, EventEmitter } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import { EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
|
||||
|
||||
|
@ -11,6 +11,7 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
|||
|
||||
import {Email} from "../../openaireLibrary/utils/email/email";
|
||||
import {Composer} from "../../openaireLibrary/utils/email/composer";
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -18,17 +19,17 @@ declare var UIkit: any;
|
|||
selector: 'subscribe',
|
||||
template: `
|
||||
|
||||
<span *ngIf="subscribed != null && !showNumbers">
|
||||
<span *ngIf="subscribed != null && !showNumbers && showTemplate">
|
||||
<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 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 uk-button-primary' + (loading ? ' uk-disabled' : '')" (click)="subscribe()"> Subscribe</a>
|
||||
<a *ngIf="subscribed" [class]="'uk-button uk-button-primary' + (loading ? ' uk-disabled' : '')" (click)="confirmOpen()"> Unsubscribe</a>
|
||||
</span>
|
||||
|
||||
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0" >
|
||||
Members: <span class="uk-text-muted">{{subscribers}}</span>
|
||||
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0 && showTemplate" >
|
||||
<span class="uk-text-bold"> Members:</span> {{subscribers}}
|
||||
</span>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
|
@ -39,6 +40,8 @@ export class SubscribeComponent {
|
|||
// @Input() showSubscribe:boolean = true;
|
||||
@Input() showNumbers:boolean;
|
||||
@Input() communityId:string;
|
||||
@Input() showTemplate:boolean = true;
|
||||
@Output() subscribeEvent = new EventEmitter();
|
||||
|
||||
public community = null;
|
||||
public emailToInformManagers: Email;
|
||||
|
@ -52,7 +55,7 @@ export class SubscribeComponent {
|
|||
constructor (private route: ActivatedRoute,
|
||||
private _subscribeService: SubscribeService,
|
||||
private _emailService: EmailService,
|
||||
private _communityService: CommunityService
|
||||
private _communityService: CommunityService, private router: Router
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -65,35 +68,40 @@ export class SubscribeComponent {
|
|||
if(email == null){
|
||||
this.subscribed = false;
|
||||
}else{
|
||||
this._subscribeService.isSubscribedToCommunity(this.communityId, email,this.properties.adminToolsAPIURL).subscribe (
|
||||
res => {
|
||||
this.subscribed = res;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting response if email: "+email+" is subscribed to community with id: "+this.communityId, error);
|
||||
});
|
||||
if(this.communityId){
|
||||
this._subscribeService.isSubscribedToCommunity(this.communityId, email,this.properties.adminToolsAPIURL).subscribe (
|
||||
res => {
|
||||
this.subscribed = res;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting response if email: "+email+" is subscribed to community with id: "+this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this._subscribeService.getCommunitySubscribers(this.communityId, this.properties.adminToolsAPIURL).subscribe (
|
||||
res => {
|
||||
this.subscribers = (res && res.subscribers && res.subscribers.length )?res.subscribers.length:0;
|
||||
if(this.communityId){
|
||||
this._subscribeService.getCommunitySubscribers(this.communityId, this.properties.adminToolsAPIURL).subscribe (
|
||||
res => {
|
||||
this.subscribers = (res && res.subscribers && res.subscribers.length )?res.subscribers.length:0;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting community subscribers for community with id: "+this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
if(this.communityId){
|
||||
this.emailToInformManagers = {body: "", subject: "", recipients: []};
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
||||
community => {
|
||||
this.community = community;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting community subscribers for community with id: "+this.communityId, error);
|
||||
});
|
||||
//console.log('System error retrieving community profile', error)
|
||||
this.handleError("Error getting community with id: "+this.communityId, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.emailToInformManagers = {body: "", subject: "", recipients: []};
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
||||
community => {
|
||||
this.community = community;
|
||||
},
|
||||
error => {
|
||||
//console.log('System error retrieving community profile', error)
|
||||
this.handleError("Error getting community with id: "+this.communityId, error);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
@ -103,7 +111,8 @@ export class SubscribeComponent {
|
|||
var email = Session.getUserEmail();
|
||||
if(email == null){
|
||||
this.subscribed = false;
|
||||
this.showLoginAlert = true;
|
||||
// this.showLoginAlert = true;
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.ACTION_REQUIRES_LOGIN, "redirectUrl": this.router.url } });
|
||||
}else{
|
||||
this.loading = true;
|
||||
this.showLoginAlert = false;
|
||||
|
@ -111,6 +120,9 @@ export class SubscribeComponent {
|
|||
res => {
|
||||
this.loading = false;
|
||||
if(res.status && res.status != 200) {
|
||||
this.subscribeEvent.emit({
|
||||
value: "error"
|
||||
});
|
||||
UIkit.notification({
|
||||
message : '<strong>An error occured. Please try again!<strong>',
|
||||
status : 'warning',
|
||||
|
@ -120,6 +132,9 @@ export class SubscribeComponent {
|
|||
} else {
|
||||
if(!this.subscribed){
|
||||
this.subscribed = true;
|
||||
this.subscribeEvent.emit({
|
||||
value: "ok"
|
||||
});
|
||||
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, email)).subscribe(
|
||||
res => {
|
||||
//console.log("The email has been sent successfully!")
|
||||
|
@ -134,6 +149,9 @@ export class SubscribeComponent {
|
|||
},
|
||||
error => {
|
||||
this.loading = false;
|
||||
this.subscribeEvent.emit({
|
||||
value: "error"
|
||||
});
|
||||
UIkit.notification({
|
||||
message : '<strong>An error occured. Please try again!<strong>',
|
||||
status : 'warning',
|
||||
|
|
|
@ -54,7 +54,12 @@
|
|||
}
|
||||
|
||||
|
||||
.searchForm, .generalSearchForm,
|
||||
.searchForm{
|
||||
|
||||
background: url('./home.jpg') !important;
|
||||
|
||||
}
|
||||
.generalSearchForm,
|
||||
.publicationsSearchForm,
|
||||
.projectsSearchForm, .projectsTableSearchForm,
|
||||
.organizationsSearchForm,
|
||||
|
@ -65,10 +70,33 @@
|
|||
.journalsSearchForm, .journalsTableSearchForm,
|
||||
.entityRegistriesSearchForm, .entityRegistriesTableSearchForm {
|
||||
|
||||
background: url('./home.jpg') !important;
|
||||
background: url('') !important;
|
||||
|
||||
}
|
||||
|
||||
.communityToolBar{
|
||||
background-color:#dedede;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
|
||||
.communityToolBarSection{
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.iframeContainer{
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
padding-top:56.25%;
|
||||
padding-bottom:35%;
|
||||
|
||||
}
|
||||
|
||||
.iframeContainer iframe{
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:120%;
|
||||
height:100%;
|
||||
border:0;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
||||
|
||||
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools",
|
||||
"adminToolsAPIURL" :"http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools",
|
||||
|
||||
"adminToolsCommunity" :"openaire",
|
||||
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",
|
||||
|
|
Loading…
Reference in New Issue