Revision 57451
Added by Konstantinos Triantafyllou over 4 years ago
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/contact/contact.component.html | ||
---|---|---|
1 |
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld> |
|
2 |
|
|
3 |
<ng-template #info> |
|
4 |
<helper *ngIf="pageContents && pageContents['right'] && pageContents['right'].length > 0" |
|
5 |
[texts]="pageContents['right']"></helper> |
|
6 |
<!--<div class="uk-margin-auto-top uk-margin-remove-bottom uk-text-bold uk-h4">OpenAIRE gives you the virtual |
|
7 |
environment and services designed for your community to: |
|
8 |
</div> |
|
9 |
<ul class="uk-list uk-list-divider uk-padding uk-padding-remove-left uk-margin-auto-top"> |
|
10 |
<li><h5><span class="uk-text-bold">Create and Manage</span> your |
|
11 |
Community Gateway</h5></li> |
|
12 |
<li><h5><span class="uk-text-bold">Access, share and link</span> together all your research</h5></li> |
|
13 |
<li><h5><span class="uk-text-bold">Monitor and report</span> your community's progress</h5></li> |
|
14 |
</ul>--> |
|
15 |
</ng-template> |
|
16 |
<div class="image-front-topbar" |
|
17 |
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}" |
|
18 |
tm-header-transparent="light" tm-header-transparent-placeholder=""> |
|
19 |
<div |
|
20 |
class="contact-background uk-section-large uk-background-top-center uk-background-norepeat uk-background-cover uk-section-overlap uk-position-relative uk-preserve-color"> |
|
21 |
<div style=" min-height: 350px;" class="uk-section uk-flex uk-flex-middle uk-margin-top uk-padding-remove-top"> |
|
22 |
<div class="uk-align-center"> |
|
23 |
<div *ngIf="showLoading" class="uk-margin-large"> |
|
24 |
<div class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><span |
|
25 |
class="loading-gif uk-align-center"></span></div> |
|
26 |
</div> |
|
27 |
<div *ngIf="!showLoading" class="uk-container uk-container-large"> |
|
28 |
<div class="uk-grid-divider" uk-grid> |
|
29 |
<div class="uk-width-1-1 uk-hidden@m"> |
|
30 |
<ng-container *ngTemplateOutlet="info"></ng-container> |
|
31 |
</div> |
|
32 |
<div class="uk-width-1-2@m uk-width-1-1@s"> |
|
33 |
<div class="uk-margin-auto uk-text-bold uk-h4">Contact us to create your Community Gateway</div> |
|
34 |
<div *ngIf="errorMessage" class="uk-width-1-1 uk-alert uk-alert-danger uk-text-center" |
|
35 |
role="alert">{{errorMessage}}</div> |
|
36 |
<div class="uk-margin-top" uk-grid> |
|
37 |
<div class="uk-margin-small uk-width-1-1 uk-text-danger uk-text-bold uk-margin-remove-bottom">* Required |
|
38 |
fields |
|
39 |
</div> |
|
40 |
<div class="uk-width-1-2@s uk-margin-small-top"> |
|
41 |
<label class="uk-h5 uk-text-bold"> |
|
42 |
Name <span class="uk-text-danger uk-text-bold">*</span> |
|
43 |
</label> |
|
44 |
<div *ngIf="name.invalid && isSubmitted" class=" uk-text-danger uk-text-small style=display:none"> |
|
45 |
Please add a name. |
|
46 |
</div> |
|
47 |
<input class="uk-input" type="text" placeholder="Your Name" [(ngModel)]="contactForm.name" required |
|
48 |
#name="ngModel"> |
|
49 |
</div> |
|
50 |
<div class="uk-width-1-2@s uk-margin-small-top"> |
|
51 |
<label class="uk-h5 uk-text-bold"> |
|
52 |
Surname <span class="uk-text-danger uk-text-bold">*</span> |
|
53 |
</label> |
|
54 |
<div *ngIf="surname.invalid && isSubmitted" class=" uk-text-danger uk-text-small style=display:none"> |
|
55 |
Please add a surname. |
|
56 |
</div> |
|
57 |
<input class="uk-input" type="text" placeholder="Your Surname" [(ngModel)]="contactForm.surname" |
|
58 |
required #surname="ngModel"> |
|
59 |
</div> |
|
60 |
<div class="uk-width-1-2@s uk-margin-small-top"> |
|
61 |
<label class="uk-h5 uk-text-bold"> |
|
62 |
Email <span class="uk-text-danger uk-text-bold">*</span> |
|
63 |
</label> |
|
64 |
<div *ngIf="sender.invalid && isSubmitted" class=" uk-text-danger uk-text-small style=display:none"> |
|
65 |
Please add an email. |
|
66 |
</div> |
|
67 |
<div |
|
68 |
*ngIf="!sender.invalid && isSubmitted && !contactForm.email.match('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$')" |
|
69 |
class=" uk-text-danger uk-text-small style=display:none">Please add a valid email. |
|
70 |
</div> |
|
71 |
<input class="uk-input" type="email" placeholder="Your Email" [(ngModel)]="contactForm.email" required |
|
72 |
#sender="ngModel"> |
|
73 |
</div> |
|
74 |
<div class="uk-width-1-2@s uk-margin-small-top"> |
|
75 |
<label class="uk-h5 uk-text-bold"> |
|
76 |
Affiliation <span class="uk-text-danger uk-text-bold">*</span> |
|
77 |
</label> |
|
78 |
<div *ngIf="affiliation.invalid && isSubmitted" |
|
79 |
class=" uk-text-danger uk-text-small style=display:none"> Please add an affiliation. |
|
80 |
</div> |
|
81 |
<input class="uk-input" type="text" placeholder="Your Affiliation" |
|
82 |
[(ngModel)]="contactForm.affiliation" required #affiliation="ngModel"> |
|
83 |
</div> |
|
84 |
<label class="uk-width-1-1 uk-h5 uk-text-bold"> |
|
85 |
Community Name <span class="uk-text-danger uk-text-bold">*</span> |
|
86 |
</label> |
|
87 |
<div class="uk-width-1-2@s uk-margin-remove-top"> |
|
88 |
<div *ngIf="community.invalid && isSubmitted" |
|
89 |
class=" uk-text-danger uk-text-small style=display:none"> Please add a community name. |
|
90 |
</div> |
|
91 |
<input class="uk-input" type="text" placeholder="Your Community Name" |
|
92 |
[(ngModel)]="contactForm.community" required #community="ngModel"> |
|
93 |
</div> |
|
94 |
<label class="uk-width-1-1 uk-h5 uk-text-bold"> |
|
95 |
Message <span class="uk-text-danger uk-text-bold">*</span> |
|
96 |
</label> |
|
97 |
<div class="uk-width-1-1 uk-margin-remove-top"> |
|
98 |
<div *ngIf="message.invalid && isSubmitted" class=" uk-text-danger uk-text-small style=display:none"> |
|
99 |
Please write us a message. |
|
100 |
</div> |
|
101 |
<textarea rows="4" class="uk-textarea" type="text" placeholder="Your message" |
|
102 |
[(ngModel)]="contactForm.message" required #message="ngModel"></textarea> |
|
103 |
</div> |
|
104 |
<div class="uk-width-1-1"> |
|
105 |
<div *ngIf="!contactForm.recaptcha && isSubmitted" |
|
106 |
class=" uk-text-danger uk-text-small style=display:none"> Please complete reCaptcha challenge. |
|
107 |
</div> |
|
108 |
<re-captcha #recaptcha (resolved)="handleRecaptcha($event)" [(siteKey)]="properties.reCaptchaSiteKey" |
|
109 |
required></re-captcha> |
|
110 |
</div> |
|
111 |
<div class="uk-width-1-1 uk-text-right"> |
|
112 |
<button class="uk-button uk-button-default uk-margin-small-right" (click)="reset()">Reset</button> |
|
113 |
<button class="uk-button portal-button" (click)="send()">Send</button> |
|
114 |
</div> |
|
115 |
</div> |
|
116 |
</div> |
|
117 |
<div class="uk-width-1-2 uk-visible@m"> |
|
118 |
<ng-container *ngTemplateOutlet="info"></ng-container> |
|
119 |
</div> |
|
120 |
</div> |
|
121 |
</div> |
|
122 |
</div> |
|
123 |
</div> |
|
124 |
</div> |
|
125 |
</div> |
|
126 |
<modal-alert #AlertModal (alertOutput)="goToHome($event)"> |
|
127 |
<div class="uk-text-center"> |
|
128 |
Our team will respond to your submission soon.<br> |
|
129 |
Press OK to redirect to OpenAIRE Connect home page. |
|
130 |
</div> |
|
131 |
</modal-alert> |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/contact/contact.component.ts | ||
---|---|---|
1 |
import {Component, OnInit, Input, ElementRef, ViewChild} from '@angular/core'; |
|
2 |
import {FormGroup} from '@angular/forms'; |
|
3 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
4 |
import {EmailService} from "../openaireLibrary/utils/email/email.service"; |
|
5 |
import {Email} from "../openaireLibrary/utils/email/email"; |
|
6 |
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; |
|
7 |
import {ContactForm} from "../openaireLibrary/utils/email/contact-form"; |
|
8 |
import {Composer} from "../openaireLibrary/utils/email/composer"; |
|
9 |
import {Meta, Title} from "@angular/platform-browser"; |
|
10 |
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; |
|
11 |
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; |
|
12 |
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; |
|
13 |
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; |
|
14 |
|
|
15 |
@Component({ |
|
16 |
selector: 'contact', |
|
17 |
templateUrl: './contact.component.html', |
|
18 |
}) |
|
19 |
|
|
20 |
export class ContactComponent implements OnInit { |
|
21 |
public url: string = null; |
|
22 |
public pageTitle: string = "OpenAIRE - Connect | Contact Us"; |
|
23 |
|
|
24 |
@Input('group') |
|
25 |
myForm: FormGroup; |
|
26 |
public piwiksub: any; |
|
27 |
public showLoading = true; |
|
28 |
public errorMessage = ''; |
|
29 |
public isSubmitted = false; |
|
30 |
public email: Email; |
|
31 |
public note = ''; |
|
32 |
public properties: EnvProperties = null; |
|
33 |
public pageContents = null; |
|
34 |
public divContents = null; |
|
35 |
|
|
36 |
public contactForm: ContactForm = new ContactForm(); |
|
37 |
@ViewChild('AlertModal') modal; |
|
38 |
@ViewChild('name') name; |
|
39 |
@ViewChild('surname') surname; |
|
40 |
@ViewChild('sender') sender; |
|
41 |
@ViewChild('affiliation') affiliation; |
|
42 |
@ViewChild('community') community; |
|
43 |
@ViewChild('message') message; |
|
44 |
@ViewChild('recaptcha') recaptcha; |
|
45 |
|
|
46 |
constructor(private route: ActivatedRoute, |
|
47 |
private _router: Router, |
|
48 |
private _emailService: EmailService, |
|
49 |
private _meta: Meta, |
|
50 |
private _title: Title, |
|
51 |
private seoService: SEOService, |
|
52 |
private _piwikService: PiwikService, |
|
53 |
private helper: HelperService) { |
|
54 |
} |
|
55 |
|
|
56 |
ngOnInit() { |
|
57 |
this._title.setTitle('OpenAIRE-Connect | Contact Us'); |
|
58 |
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { |
|
59 |
this.properties = data.envSpecific; |
|
60 |
this.email = {body: '', subject: '', recipients: []}; |
|
61 |
|
|
62 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
63 |
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe(); |
|
64 |
} |
|
65 |
this.url = this.properties.baseLink + this._router.url; |
|
66 |
this.seoService.createLinkForCanonicalURL(this.url); |
|
67 |
this.updateUrl(this.url); |
|
68 |
this.updateTitle(this.pageTitle); |
|
69 |
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); |
|
70 |
|
|
71 |
//this.getDivContents(); |
|
72 |
this.getPageContents(); |
|
73 |
HelperFunctions.scroll(); |
|
74 |
this.showLoading = false; |
|
75 |
}); |
|
76 |
} |
|
77 |
|
|
78 |
private getPageContents() { |
|
79 |
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { |
|
80 |
this.pageContents = contents; |
|
81 |
}) |
|
82 |
} |
|
83 |
|
|
84 |
private getDivContents() { |
|
85 |
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { |
|
86 |
this.divContents = contents; |
|
87 |
}) |
|
88 |
} |
|
89 |
|
|
90 |
public send() { |
|
91 |
HelperFunctions.scroll(); |
|
92 |
if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid && |
|
93 |
this.contactForm.email.match('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$') && |
|
94 |
!this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha != '') { |
|
95 |
this.sendMail(this.properties.admins); |
|
96 |
} |
|
97 |
else { |
|
98 |
this.errorMessage = 'Please fill in all the required fields!' |
|
99 |
this.isSubmitted = true; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
public reset() { |
|
104 |
this.contactForm = new ContactForm(); |
|
105 |
this.isSubmitted = false; |
|
106 |
this.errorMessage = ''; |
|
107 |
this.contactForm.recaptcha = ''; |
|
108 |
} |
|
109 |
|
|
110 |
private sendMail(admins: any) { |
|
111 |
this.showLoading = true; |
|
112 |
this._emailService.contact(this.properties.adminToolsAPIURL + '/contact', |
|
113 |
Composer.composeEmailForNewCommunity(this.contactForm, admins), this.contactForm.recaptcha).subscribe( |
|
114 |
res => { |
|
115 |
if(res) { |
|
116 |
this.reset(); |
|
117 |
this.modalOpen(); |
|
118 |
this.showLoading = false; |
|
119 |
} |
|
120 |
}, |
|
121 |
error => { |
|
122 |
this.handleError('Email sent failed! Please try again.', error); |
|
123 |
this.showLoading = false; |
|
124 |
this.contactForm.recaptcha = ''; |
|
125 |
} |
|
126 |
); |
|
127 |
} |
|
128 |
|
|
129 |
public modalOpen() { |
|
130 |
this.modal.okButton = true; |
|
131 |
this.modal.alertTitle = 'Your request has been successfully submitted'; |
|
132 |
this.modal.alertMessage = false; |
|
133 |
this.modal.cancelButton = false; |
|
134 |
this.modal.okButtonLeft = false; |
|
135 |
this.modal.okButtonText = 'OK'; |
|
136 |
this.modal.open(); |
|
137 |
} |
|
138 |
|
|
139 |
public handleRecaptcha(captchaResponse: string) { |
|
140 |
this.contactForm.recaptcha = captchaResponse; |
|
141 |
} |
|
142 |
|
|
143 |
|
|
144 |
handleError(message: string, error) { |
|
145 |
this.errorMessage = message; |
|
146 |
console.log('Server responded: ' + error); |
|
147 |
|
|
148 |
this.showLoading = false; |
|
149 |
} |
|
150 |
|
|
151 |
public goToHome(data: any) { |
|
152 |
this._router.navigate(['/']); |
|
153 |
} |
|
154 |
|
|
155 |
private updateDescription(description: string) { |
|
156 |
this._meta.updateTag({content: description}, "name='description'"); |
|
157 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
158 |
} |
|
159 |
|
|
160 |
private updateTitle(title: string) { |
|
161 |
var _title = ((title.length > 50) ? title.substring(0, 50) : title); |
|
162 |
this._title.setTitle(_title); |
|
163 |
this._meta.updateTag({content: _title}, "property='og:title'"); |
|
164 |
} |
|
165 |
|
|
166 |
private updateUrl(url: string) { |
|
167 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
168 |
} |
|
169 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/contact/contact.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
|
|
6 |
import {ContactComponent} from './contact.component'; |
|
7 |
import {ContactRoutingModule} from "./contact-routing.module"; |
|
8 |
import {EmailService} from "../openaireLibrary/utils/email/email.service"; |
|
9 |
import {RecaptchaModule} from "ng-recaptcha"; |
|
10 |
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module"; |
|
11 |
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; |
|
12 |
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; |
|
13 |
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; |
|
14 |
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; |
|
15 |
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; |
|
16 |
|
|
17 |
|
|
18 |
@NgModule({ |
|
19 |
imports: [ |
|
20 |
ContactRoutingModule, CommonModule, FormsModule, RouterModule, |
|
21 |
AlertModalModule, RecaptchaModule.forRoot(), HelperModule, |
|
22 |
Schema2jsonldModule, SEOServiceModule |
|
23 |
], |
|
24 |
declarations: [ |
|
25 |
ContactComponent |
|
26 |
], |
|
27 |
providers: [ |
|
28 |
EmailService, PiwikService, IsRouteEnabled |
|
29 |
], |
|
30 |
exports: [ |
|
31 |
ContactComponent |
|
32 |
] |
|
33 |
}) |
|
34 |
|
|
35 |
export class ContactModule { } |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/contact/contact-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import {RouterModule} from '@angular/router'; |
|
3 |
import {ContactComponent} from './contact.component'; |
|
4 |
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; |
|
5 |
|
|
6 |
@NgModule({ |
|
7 |
imports: [ |
|
8 |
RouterModule.forChild([ |
|
9 |
{ path: '', component: ContactComponent, canActivate: [IsRouteEnabled]} |
|
10 |
]) |
|
11 |
] |
|
12 |
}) |
|
13 |
export class ContactRoutingModule { } |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.component.html | ||
---|---|---|
1 |
<schema2jsonld [URL]="properties.baseLink" |
|
2 |
[logoURL]="properties.baseLink+'/assets/common-assets/logo-small-monitor.png'" type="home" |
|
3 |
name="OpenAIRE Monitor"> |
|
4 |
</schema2jsonld> |
|
5 |
<div |
|
6 |
class="image-front-topbar uk-margin-large-top" |
|
7 |
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}" |
|
8 |
tm-header-transparent="light" tm-header-transparent-placeholder=""> |
|
9 |
<helper *ngIf="pageContents && pageContents['left'] && pageContents['left'].length > 0" |
|
10 |
[texts]="pageContents['left']"></helper> |
|
11 |
</div> |
|
12 |
<div class="uk-section-muted" |
|
13 |
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}"> |
|
14 |
<div class="uk-container uk-container-large"> |
|
15 |
<other-portals [properties]="properties" portal="monitor"> </other-portals> |
|
16 |
</div> |
|
17 |
</div> |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.component.ts | ||
---|---|---|
1 |
import {Component} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
4 |
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
|
5 |
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service'; |
|
6 |
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service'; |
|
7 |
import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo'; |
|
8 |
|
|
9 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
|
10 |
import {StringUtils} from '../openaireLibrary/utils/string-utils.class'; |
|
11 |
|
|
12 |
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; |
|
13 |
import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.component'; |
|
14 |
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; |
|
15 |
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; |
|
16 |
|
|
17 |
@Component({ |
|
18 |
selector: 'home', |
|
19 |
templateUrl: 'home.component.html', |
|
20 |
}) |
|
21 |
|
|
22 |
export class HomeComponent { |
|
23 |
public piwiksub: any; |
|
24 |
|
|
25 |
public pageTitle = "OpenAIRE | Monitor"; |
|
26 |
public pageContents = null; |
|
27 |
public divContents = null; |
|
28 |
public status: number; |
|
29 |
public loading: boolean = true; |
|
30 |
public subscriberErrorMessage: string = ""; |
|
31 |
public errorCodes: ErrorCodes; |
|
32 |
private errorMessages: ErrorMessagesComponent; |
|
33 |
|
|
34 |
properties: EnvProperties; |
|
35 |
public keyword: string = ""; |
|
36 |
public type: string = "all"; |
|
37 |
|
|
38 |
constructor( |
|
39 |
private route: ActivatedRoute, |
|
40 |
private _router: Router, |
|
41 |
private _meta: Meta, |
|
42 |
private _title: Title, |
|
43 |
private _piwikService: PiwikService, |
|
44 |
private helper: HelperService, |
|
45 |
private seoService: SEOService) { |
|
46 |
|
|
47 |
var description = "OpenAIRE - Monitor, monitor dashboard, funder, statistics, "; |
|
48 |
var title = "OpenAIRE - Monitor"; |
|
49 |
|
|
50 |
this._meta.updateTag({content: description}, "name='description'"); |
|
51 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
52 |
this._meta.updateTag({content: title}, "property='og:title'"); |
|
53 |
this._title.setTitle(title); |
|
54 |
|
|
55 |
this.errorCodes = new ErrorCodes(); |
|
56 |
this.errorMessages = new ErrorMessagesComponent(); |
|
57 |
this.status = this.errorCodes.LOADING; |
|
58 |
} |
|
59 |
|
|
60 |
public ngOnInit() { |
|
61 |
this.route.data |
|
62 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
63 |
this.properties = data.envSpecific; |
|
64 |
var url = data.envSpecific.baseLink + this._router.url; |
|
65 |
this.seoService.createLinkForCanonicalURL(url, false); |
|
66 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
67 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
68 |
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Monitor", this.properties.piwikSiteId).subscribe(); |
|
69 |
} |
|
70 |
//this.getDivContents(); |
|
71 |
this.getPageContents(); |
|
72 |
}); |
|
73 |
} |
|
74 |
|
|
75 |
private getPageContents() { |
|
76 |
this.helper.getPageHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { |
|
77 |
this.pageContents = contents; |
|
78 |
}) |
|
79 |
} |
|
80 |
|
|
81 |
private getDivContents() { |
|
82 |
this.helper.getDivHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { |
|
83 |
this.divContents = contents; |
|
84 |
}) |
|
85 |
} |
|
86 |
|
|
87 |
public quote(param: string): string { |
|
88 |
return StringUtils.quote(param); |
|
89 |
} |
|
90 |
|
|
91 |
public ngOnDestroy() { |
|
92 |
if (this.piwiksub) { |
|
93 |
this.piwiksub.unsubscribe(); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
private handleError(message: string, error): number { |
|
98 |
var code = ""; |
|
99 |
if (!error.status) { |
|
100 |
var error = error.json(); |
|
101 |
code = error.code; |
|
102 |
} else { |
|
103 |
code = error.status; |
|
104 |
} |
|
105 |
|
|
106 |
console.error("Communities (component): " + message, error); |
|
107 |
|
|
108 |
return this.errorMessages.getErrorCode(code); |
|
109 |
} |
|
110 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
|
|
6 |
import {HomeComponent} from './home.component'; |
|
7 |
|
|
8 |
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; |
|
9 |
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
10 |
|
|
11 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
|
12 |
import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module'; |
|
13 |
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; |
|
14 |
import {OtherPortalsModule} from "../openaireLibrary/sharedComponents/other-portals/other-portals.module"; |
|
15 |
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; |
|
16 |
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; |
|
17 |
import {HomeRoutingModule} from "./home-routing.module"; |
|
18 |
|
|
19 |
@NgModule({ |
|
20 |
imports: [ |
|
21 |
CommonModule, FormsModule, RouterModule, ErrorMessagesModule, OtherPortalsModule, |
|
22 |
HelperModule, Schema2jsonldModule, SEOServiceModule, HomeRoutingModule, |
|
23 |
], |
|
24 |
declarations: [ |
|
25 |
HomeComponent |
|
26 |
], |
|
27 |
providers: [ |
|
28 |
FreeGuard, PreviousRouteRecorder, |
|
29 |
PiwikService |
|
30 |
], |
|
31 |
exports: [ |
|
32 |
HomeComponent |
|
33 |
] |
|
34 |
}) |
|
35 |
export class HomeModule { |
|
36 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/home/home-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{HomeComponent} from './home.component'; |
|
5 |
|
|
6 |
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; |
|
7 |
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: HomeComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } |
|
13 |
|
|
14 |
]) |
|
15 |
] |
|
16 |
}) |
|
17 |
export class HomeRoutingModule { } |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/customization/customization.component.ts | ||
---|---|---|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; |
|
4 |
import {LayoutService} from "../../openaireLibrary/services/layout.service"; |
|
5 |
import {CustomizationOptions} from "../../openaireLibrary/connect/community/CustomizationOptions"; |
|
6 |
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; |
|
7 |
import {PiwikHelper} from "../piwikHelper"; |
|
8 |
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class"; |
|
9 |
|
|
10 |
declare var appendCss: any; |
|
11 |
|
|
12 |
@Component({ |
|
13 |
selector: 'customization', |
|
14 |
template: ` |
|
15 |
|
|
16 |
<!-- <p>This is customizing layout component</p>--> |
|
17 |
` |
|
18 |
}) |
|
19 |
|
|
20 |
export class CustomizationComponent { |
|
21 |
@Input() communityId; |
|
22 |
layout: CustomizationOptions; |
|
23 |
|
|
24 |
constructor(private route: ActivatedRoute, |
|
25 |
private router: Router, private _layoutService: LayoutService |
|
26 |
) { |
|
27 |
} |
|
28 |
|
|
29 |
public ngOnInit() { |
|
30 |
this.route.data |
|
31 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
32 |
this.route.queryParams.subscribe(params => { |
|
33 |
|
|
34 |
if(params['layout']) { |
|
35 |
this.layout = JSON.parse(StringUtils.URIDecode(params['layout'])); |
|
36 |
this.buildCss(); |
|
37 |
}else{ |
|
38 |
// this.properties = data.envSpecific; |
|
39 |
//com.communityId, |
|
40 |
// data.envSpecific.adminToolsAPIURL + '/' |
|
41 |
|
|
42 |
this._layoutService.mockLayout().subscribe( |
|
43 |
layout => { |
|
44 |
this.layout = layout; |
|
45 |
|
|
46 |
this.buildCss(); |
|
47 |
} |
|
48 |
); |
|
49 |
} |
|
50 |
|
|
51 |
}); |
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
}); |
|
56 |
|
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
private buildCss() { |
|
61 |
console.log(this.layout); |
|
62 |
|
|
63 |
document.documentElement.style.setProperty('--portal-main-color', this.layout.mainColor); |
|
64 |
document.documentElement.style.setProperty('--portal-dark-color', this.layout.secondaryColor); |
|
65 |
let css = ` |
|
66 |
/*Panel background*/ |
|
67 |
.communityPanelBackground:not(bottom) { |
|
68 |
border-style: ` + (this.layout.panel.background.borderStyle != null ? this.layout.panel.background.borderStyle : 'solid') + `; |
|
69 |
border-color:` + (this.layout.panel.background.borderColor != null ? this.layout.panel.background.borderColor : 'transparent') + `; |
|
70 |
border-width: ` + (this.layout.panel.background.borderWidth != null ? this.layout.panel.background.borderWidth: '1') + `px;`+` |
|
71 |
|
|
72 |
} |
|
73 |
.communityPanelBackground, .communityPanelBackground .uk-section-primary { |
|
74 |
background-color: ` + (this.layout.panel.background.color?this.layout.panel.background.color:this.layout.mainColor) + `; |
|
75 |
} |
|
76 |
|
|
77 |
/*Panel fonts*/ |
|
78 |
|
|
79 |
.communityPanelBackground { |
|
80 |
color:` + (this.layout.panel.fonts.color != null ? this.layout.panel.fonts.color : 'white') + ` !important;` + |
|
81 |
(this.layout.panel.fonts.family != null ? ('font-family: ' + this.layout.panel.fonts.family + ' !important;') : '') + |
|
82 |
(this.layout.panel.fonts.size != null ? ('font-size: ' + this.layout.panel.fonts.size + 'px !important;') : '') + |
|
83 |
(this.layout.panel.fonts.weight != null ? ('font-weight: ' + this.layout.panel.fonts.weight + '!important;') : '') + |
|
84 |
|
|
85 |
` |
|
86 |
} |
|
87 |
.communityPanelBackground div.uk-modal { |
|
88 |
color:#666 !important; |
|
89 |
} |
|
90 |
|
|
91 |
.communityPanelBackground .uk-h6:not(.ignoreCommunityPanelBackground),.communityPanelBackground .uk-h5:not(.ignoreCommunityPanelBackground),.communityPanelBackground .uk-h4:not(.ignoreCommunityPanelBackground),.communityPanelBackground .uk-h3:not(.ignoreCommunityPanelBackground), .communityPanelBackground .uk-h2:not(.ignoreCommunityPanelBackground),.communityPanelBackground .uk-h1:not(.ignoreCommunityPanelBackground) { |
|
92 |
color: ` + (this.layout.panel.title.color != null ? this.layout.panel.title.color : 'white') + ` !important;` + |
|
93 |
(this.layout.panel.title.weight != null ? ('font-weight: ' + this.layout.panel.title.weight + '!important;') : '') + |
|
94 |
` |
|
95 |
} |
|
96 |
.communityPanelBackground .uk-h5:not(.ignoreCommunityPanelBackground){ |
|
97 |
`+ |
|
98 |
(this.layout.panel.title.family != null ? ('font-family: ' + this.layout.panel.title.family + ' !important;') : '') + |
|
99 |
(this.layout.panel.title.size != null ? ('font-size: ' + this.layout.panel.title.size + 'px !important;') : '') + |
|
100 |
` |
|
101 |
} |
|
102 |
/* Panel links */ |
|
103 |
.communityPanelBackground .uk-link:not(.ignoreCommunityPanelBackground), .communityPanelBackground a:not(.uk-button):not(.uk-button-text):not(.ignoreCommunityPanelBackground), .portal-card a { |
|
104 |
color: ` |
|
105 |
+ (this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.color?this.layout.links.darkBackground.color:'white') :(this.layout.links.lightBackground.color?this.layout.links.lightBackground.color:'var(--portal-main-color)') ) + ` !important;` |
|
106 |
+ (this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.family?('font-family: ' + this.layout.links.darkBackground.family + ' !important;') : '') :'' ) |
|
107 |
+ (this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.size?('font-size: ' + this.layout.links.darkBackground.size + 'px !important;') : '') :'' ) |
|
108 |
+` |
|
109 |
} |
|
110 |
/* Panel links - hover */ |
|
111 |
|
|
112 |
.communityPanelBackground .uk-link:not(.ignoreCommunityPanelBackground):hover, .communityPanelBackground a:not(.uk-button):not(.uk-button-text):not(.ignoreCommunityPanelBackground):hover, .portal-card a:hover { |
|
113 |
color: ` |
|
114 |
+ (this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.onHover.color?this.layout.links.darkBackground.onHover.color:`rgba(255, 255, 255, 0.5)`) :(this.layout.links.lightBackground.onHover.color?this.layout.links.lightBackground.onHover.color:'var(--portal-dark-color)') ) + ` !important;` |
|
115 |
+ ` |
|
116 |
} |
|
117 |
|
|
118 |
.uk-link, a:not(.uk-button), .uk-navbar-dropdown-nav > li > a, .uk-navbar-nav > li > a, .loginLink, |
|
119 |
.uk-tab > .uk-active > a, .uk-tab > * > a:focus, .uk-tab > * > a:hover { |
|
120 |
color:` + (this.layout.links.lightBackground.color != null ? this.layout.links.lightBackground.color : `var(--portal-main-color)`) + ` |
|
121 |
} |
|
122 |
|
|
123 |
.uk-link:hover, a:not(.uk-button):hover, |
|
124 |
.uk-navbar-dropdown-nav > li > a:focus, .uk-navbar-dropdown-nav > li > a:hover, .uk-navbar-nav > li > a:hover, .uk-navbar-nav > li > a:focus, .uk-navbar-nav > li > a:active, .uk-navbar-nav > li:hover > a, |
|
125 |
.uk-navbar-dropdown-nav > li.uk-active > a, .uk-tab > .uk-active > a, .uk-navbar-nav > li.uk-active > a, .uk-navbar-container:not(.uk-navbar-transparent) .uk-navbar-nav > li.uk-active > a { |
|
126 |
color:` + (this.layout.links.lightBackground.onHover.color != null ? this.layout.links.lightBackground.onHover.color : `var(--portal-dark-color)`) + ` |
|
127 |
} |
|
128 |
|
|
129 |
.communityBorder { |
|
130 |
border-color: ` + (this.layout.box.borderColor != null ? this.layout.box.borderColor : `var(--portal-main-color)`) + `; |
|
131 |
border-style: ` + (this.layout.box.borderStyle != null ? this.layout.box.borderStyle : `solid`) + `; |
|
132 |
border-width: ` + (this.layout.box.borderWidth != null ? this.layout.box.borderWidth : `2`) + `px; |
|
133 |
border-radius: ` + (this.layout.box.borderRadius != null ? this.layout.box.borderRadius : `6`) + `px; |
|
134 |
} |
|
135 |
|
|
136 |
/*Panel Elements & cards*/ |
|
137 |
.communityPanelBackground .uk-card:not(.ignoreCommunityPanelBackground), .communityPanelBackground .uk-label:not(.ignoreCommunityPanelBackground) { |
|
138 |
background-color: ` + (this.layout.panel.panelElements.backgroundColor != null ? this.layout.panel.panelElements.backgroundColor : `rgba(255, 255, 255, 0.5)`) + `; |
|
139 |
border-color: ` + (this.layout.panel.panelElements.borderColor != null ? this.layout.panel.panelElements.borderColor : `rgba(255, 255, 255, 0.5)`) + `; |
|
140 |
} |
|
141 |
.communityPanelBackground .uk-label:not(.ignoreCommunityPanelBackground) a{ |
|
142 |
border-color: ` + |
|
143 |
+ (this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.color?this.layout.links.darkBackground.color:'rgba(255, 255, 255, 0.8)') :(this.layout.links.lightBackground.color?this.layout.links.lightBackground.color:'var(--portal-main-color)') ) + |
|
144 |
+ `; |
|
145 |
border-bottom: 1px solid; |
|
146 |
} |
|
147 |
.communityPanelBackground .uk-label:not(.ignoreCommunityPanelBackground) a:hover{ |
|
148 |
border-color: ` + |
|
149 |
(this.layout.panel.onDarkBackground ? (this.layout.links.darkBackground.onHover.color?this.layout.links.darkBackground.onHover.color:'rgba(255, 255, 255, 0.5)') :(this.layout.links.lightBackground.onHover.color?this.layout.links.lightBackground.onHover.color:'var(--portal-dark-color)') )+ |
|
150 |
+ `; |
|
151 |
} |
|
152 |
.communityPanelBackground .uk-card:not(.ignoreCommunityPanelBackground), .communityPanelBackground .uk-label:not(.ignoreCommunityPanelBackground) { |
|
153 |
color: ` + (this.layout.panel.panelElements.color != null ? this.layout.panel.panelElements.color : `rgba(255, 255, 255, 0.5)`) + `; |
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
.uk-button:not(.uk-button-text){ |
|
158 |
border-radius:` + (this.layout.buttons.lightBackground.borderRadius != null ? this.layout.buttons.lightBackground.borderRadius : `4`) + `px; |
|
159 |
} |
|
160 |
.uk-button:not(.uk-button-text):not(.uk-button-default):not(.uk-button-primary), .portal-button { |
|
161 |
background-color:` + (this.layout.buttons.lightBackground.backgroundColor != null ? this.layout.buttons.lightBackground.backgroundColor : `#003052`) + `; |
|
162 |
color: ` + (this.layout.buttons.lightBackground.color != null ? this.layout.buttons.lightBackground.color : `white`) + `; |
|
163 |
border-color: ` + (this.layout.buttons.lightBackground.borderColor != null ? this.layout.buttons.lightBackground.borderColor : `transparent`) + `; |
|
164 |
border-style: ` + (this.layout.buttons.lightBackground.borderStyle != null ? this.layout.buttons.lightBackground.borderStyle : `solid`) + `; |
|
165 |
border-width: ` + (this.layout.buttons.lightBackground.borderWidth != null ? this.layout.buttons.lightBackground.borderWidth : `1`) + `px; |
|
166 |
|
|
167 |
|
|
168 |
} |
|
169 |
|
|
170 |
.uk-button:not(.uk-button-text):not(.uk-button-default):not(.uk-button-primary):hover, .portal-button:hover { |
|
171 |
background-color: ` + (this.layout.buttons.lightBackground.onHover.backgroundColor != null ? this.layout.buttons.lightBackground.onHover.backgroundColor : `#154B71`) + `; |
|
172 |
color: ` + (this.layout.buttons.lightBackground.onHover.color != null ? this.layout.buttons.lightBackground.onHover.color : `white`) + `; |
|
173 |
border-color: ` + (this.layout.buttons.lightBackground.onHover.color != null ? this.layout.buttons.lightBackground.onHover.color : `transparent`) + `; |
|
174 |
} |
|
175 |
|
|
176 |
/*Buttons*/ |
|
177 |
.communityPanelBackground .uk-button:not(.ignoreCommunityPanelBackground) { |
|
178 |
background-color: ` |
|
179 |
+ (this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.backgroundColor?this.layout.buttons.darkBackground.backgroundColor:'white') :(this.layout.buttons.lightBackground.backgroundColor?this.layout.buttons.lightBackground.backgroundColor:'var(--portal-main-color)') ) |
|
180 |
+` !important; |
|
181 |
color: ` |
|
182 |
+ (this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.color?this.layout.buttons.darkBackground.color:'var(--portal-main-color)') :(this.layout.buttons.lightBackground.color?this.layout.buttons.lightBackground.color:'white') ) |
|
183 |
+ ` !important; |
|
184 |
border-color: ` |
|
185 |
+ (this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.borderColor?this.layout.buttons.darkBackground.borderColor:'white') :(this.layout.buttons.lightBackground.borderColor?this.layout.buttons.lightBackground.borderColor:'var(--portal-main-color)') ) |
|
186 |
+ ` !important; |
|
187 |
border-style: ` + |
|
188 |
(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.borderStyle?this.layout.buttons.darkBackground.borderStyle:'solid') :(this.layout.buttons.lightBackground.borderStyle?this.layout.buttons.lightBackground.borderStyle:'solid') ) |
|
189 |
+ ` !important; |
|
190 |
border-width: ` + |
|
191 |
(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.borderWidth?this.layout.buttons.darkBackground.borderWidth:'1px') :(this.layout.buttons.lightBackground.borderWidth?this.layout.buttons.lightBackground.borderWidth:'1px') ) |
|
192 |
+ ` !important; |
|
193 |
border-radius:` + |
|
194 |
(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.borderRadius?this.layout.buttons.darkBackground.borderRadius:'4px') :(this.layout.buttons.lightBackground.borderRadius?this.layout.buttons.lightBackground.borderRadius:'4px') )+ |
|
195 |
+ ` !important; |
|
196 |
font-weight:` |
|
197 |
// (this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.fontWeight?this.layout.buttons.darkBackground.fontWeight:'4px') :(this.layout.buttons.lightBackground.borderRadius?this.layout.buttons.lightBackground.borderRadius:'4px') )+ |
|
198 |
// (this.layout.panel.buttons.fontWeight != null ? this.layout.panel.buttons.fontWeight : `600`) + `; |
|
199 |
+` |
|
200 |
} |
|
201 |
|
|
202 |
.communityPanelBackground .uk-button:not(.ignoreCommunityPanelBackground):hover { |
|
203 |
background-color: ` + |
|
204 |
(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.onHover.backgroundColor?this.layout.buttons.darkBackground.onHover.backgroundColor:' #eeeeee') :(this.layout.buttons.lightBackground.onHover.backgroundColor?this.layout.buttons.lightBackground.onHover.backgroundColor:'var(--portal-dark-color)') ) |
|
205 |
+ ` !important; |
|
206 |
color: ` + |
|
207 |
(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.onHover.color?this.layout.buttons.darkBackground.onHover.color:' var(--portal-main-color) ') :(this.layout.buttons.lightBackground.onHover.color?this.layout.buttons.lightBackground.onHover.color:'white') ) |
|
208 |
+ ` !important; |
|
209 |
border-color:` |
|
210 |
+(this.layout.panel.onDarkBackground ? (this.layout.buttons.darkBackground.onHover.borderColor?this.layout.buttons.darkBackground.onHover.borderColor:' #eeeeee ') :(this.layout.buttons.lightBackground.onHover.borderColor?this.layout.buttons.lightBackground.onHover.borderColor:'var(--portal-dark-color)') ) |
|
211 |
+ ` !important; |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
.uk-navbar-dropdown { |
|
216 |
background-color: white; |
|
217 |
color: #666; |
|
218 |
box-shadow: 0 5px 12px rgba(0, 0, 0, .15); |
|
219 |
/*border:var(--portal-main-color) 1px solid;*/ |
|
220 |
} |
|
221 |
|
|
222 |
.customTabs .uk-tab > .uk-active > a { |
|
223 |
border-color: var(--portal-main-color); |
|
224 |
} |
|
225 |
|
|
226 |
.customTabs .uk-tab > .uk-active > a { |
|
227 |
border-color: var(--portal-main-color); |
|
228 |
} |
|
229 |
|
|
230 |
.uk-tab > * > a:focus, .uk-tab > * > a:hover { |
|
231 |
border-color: var(--portal-dark-color); |
|
232 |
} |
|
233 |
|
|
234 |
|
|
235 |
` |
|
236 |
appendCss(css); |
|
237 |
} |
|
238 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/customization/customization.module.ts | ||
---|---|---|
1 |
import {ModuleWithProviders, NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {RouterModule} from '@angular/router'; |
|
4 |
import {CustomizationComponent} from "./customization.component"; |
|
5 |
import {LayoutService} from "../../openaireLibrary/services/layout.service"; |
|
6 |
|
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
CommonModule, RouterModule |
|
11 |
], |
|
12 |
declarations: [ |
|
13 |
CustomizationComponent |
|
14 |
], |
|
15 |
exports: [ |
|
16 |
CustomizationComponent |
|
17 |
] |
|
18 |
}) |
|
19 |
export class CustomizationModule { |
|
20 |
static forRoot(): ModuleWithProviders { |
|
21 |
return { |
|
22 |
ngModule: CustomizationModule, |
|
23 |
providers: [ |
|
24 |
LayoutService |
|
25 |
] |
|
26 |
} |
|
27 |
} |
|
28 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.component.html | ||
---|---|---|
1 |
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld> |
|
2 |
|
|
3 |
<div *ngIf="longView == true"> |
|
4 |
<div class="uk-section uk-padding-remove-top tm-middle uk-container" id="tm-main"> |
|
5 |
|
|
6 |
<div class="uk-container uk-margin-bottom"> |
|
7 |
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" |
|
8 |
[texts]="pageContents['top']"></helper> |
|
9 |
<div id="invite" class=" uk-card uk-card-default uk-padding uk-margin-top"> |
|
10 |
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Invite users to subscribe</div> |
|
11 |
<div class="uk-margin-top"> |
|
12 |
<errorMessages [status]="[status]" [type]="'community'"></errorMessages> |
|
13 |
</div> |
|
14 |
<div *ngIf="missingCommunityId" class="uk-alert uk-alert-warning" role="alert">{{missingCommunityId}}</div> |
|
15 |
<div *ngIf="successfulSentMessage" class="uk-alert uk-alert-success" |
|
16 |
role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div> |
|
17 |
<div *ngIf="failureSentMessage" class="uk-alert uk-alert-warning" |
|
18 |
role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div> |
|
19 |
<div *ngIf="inviteErrorMessage" class="uk-alert uk-alert-warning" role="alert">{{inviteErrorMessage}}</div> |
|
20 |
<div *ngIf="communityId != null && status == errorCodes.DONE"> |
|
21 |
<table class="uk-table uk-align-center"> |
|
22 |
<tbody> |
|
23 |
<!-- <tr> |
|
24 |
<td> |
|
25 |
</td> |
|
26 |
<td> |
|
27 |
<li>Invite by email</li> |
|
28 |
</td> |
|
29 |
</tr> --> |
|
30 |
<tr> |
|
31 |
<td for="from" class="uk-text-bold uk-width-1-4 uk-text-right">From <span |
|
32 |
class="uk-text-danger uk-text-bold">*</span> : |
|
33 |
</td> |
|
34 |
<td class="uk-text-left uk-width-expand"> |
|
35 |
<input placeholder="Type your name" type="text" (click)="resetMessages()" |
|
36 |
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="body.fromName" |
|
37 |
id="from" required> |
|
38 |
<div *ngIf="!body.fromName" class="uk-width-large uk-text-danger uk-text-small">Please add your name. |
|
39 |
</div> |
|
40 |
</td> |
|
41 |
</tr> |
|
42 |
<tr> |
|
43 |
<td for="recipients" class="uk-text-bold uk-text-right">To <span |
|
44 |
class="uk-text-danger uk-text-bold">*</span> : |
|
45 |
</td> |
|
46 |
<td class="uk-text-left"> |
|
47 |
<input placeholder="email" type="text" (click)="resetMessages(); areValid=true" |
|
48 |
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="recipients" |
|
49 |
id="recipients" |
|
50 |
required> |
|
51 |
<div *ngIf="areValid && !showAddRecipientMessage" class="uk-width-medium uk-text-muted uk-text-small"> |
|
52 |
separate multiple emails with a comma |
|
53 |
</div> |
|
54 |
<div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small">Please add |
|
55 |
valid email/s. |
|
56 |
</div> |
|
57 |
<div *ngIf="isEmpty(recipients) && showAddRecipientMessage" |
|
58 |
class="uk-width-large uk-text-danger uk-text-small">Please add a recipient. |
|
59 |
</div> |
|
60 |
</td> |
|
61 |
</tr> |
|
62 |
</tbody> |
|
63 |
</table> |
|
64 |
<div class="boundary-align uk-panel uk-placeholder"> |
|
65 |
|
|
66 |
<table class="uk-table uk-align-center"> |
|
67 |
<tbody> |
|
68 |
<!-- <tr> |
|
69 |
<td class="uk-text-bold uk-width-1-4@xl uk-width-1-4@m uk-width-1-4@s uk-text-right"></td> |
|
70 |
<td class="uk-text-left"> |
|
71 |
<{{body.salutation}}<br>--> |
|
72 |
<!-- <span *ngIf="body.fromName == ''" class="uk-text-muted"> |
|
73 |
<i>{{body.fromMessage}}...</i> |
|
74 |
</span> |
|
75 |
<span *ngIf="body.fromName !=''"> |
|
76 |
{{body.fromMessage}} |
|
77 |
<b>{{body.fromName}}</b> |
|
78 |
</span> |
|
79 |
</td> |
|
80 |
</tr> --> |
|
81 |
<tr> |
|
82 |
<td for="email.body" class="uk-text-bold uk-text-right">Message:</td> |
|
83 |
<td *ngIf="allowEdit()" class="uk-text-left"> |
|
84 |
<ckeditor (click)="resetMessages()" |
|
85 |
class="form-control" [(ngModel)]="body.paragraphs" id="message" |
|
86 |
debounce="400" |
|
87 |
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]', removeButtons: 'Save,NewPage,DocProps,Preview,Print', |
|
88 |
extraPlugins: 'divarea'}"> |
|
89 |
<!-- <id="contentTag"--> |
|
90 |
<!--(ready)="onReady($event)"--> |
|
91 |
<!--(focus)="onFocus($event)"--> |
|
92 |
<!--[config]="{uiColor: '#99000'}"--> |
|
93 |
<!--(blur)="onBlur($event)"--> |
|
94 |
<!--(change)="onChange($event)"--> |
|
95 |
</ckeditor> |
|
96 |
</td> |
|
97 |
<td *ngIf="!allowEdit()" class="uk-text-left"> |
|
98 |
|
|
99 |
<div [innerHtml]="body.paragraphs"></div> |
|
100 |
</td> |
|
101 |
</tr> |
|
102 |
<tr> |
|
103 |
<td></td> |
|
104 |
<td class="uk-text-left"> |
|
105 |
<!-- {{body.closing}}<br> --> |
|
106 |
{{body.signature}} |
|
107 |
<span *ngIf="body.fromName == ''" class="uk-text-muted"> |
|
108 |
<i>{{body.fromMessage}}...</i> |
|
109 |
</span> |
|
110 |
<span *ngIf="body.fromName !=''"> |
|
111 |
{{body.fromMessage}} |
|
112 |
<b>{{body.fromName}}</b> |
|
113 |
</span> |
|
114 |
<br><a href="https://www.openaire.eu">www.openaire.eu</a> |
|
115 |
</td> |
|
116 |
</tr> |
|
117 |
</tbody> |
|
118 |
</table> |
|
119 |
</div> |
|
120 |
<table class="uk-table uk-align-center"> |
|
121 |
<tbody> |
|
122 |
<tr> |
|
123 |
<td class="uk-text-bold uk-width-3-5@xl uk-width-3-5@m uk-width-3-5@s uk-text-right"></td> |
|
124 |
<td> |
|
125 |
<div class="uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-text-danger uk-text-bold">* |
|
126 |
Required fields |
|
127 |
</div> |
|
128 |
</td> |
|
129 |
</tr> |
|
130 |
<tr> |
|
131 |
<td class="uk-text-right"></td> |
|
132 |
<td> |
|
133 |
<div |
|
134 |
class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom"> |
|
135 |
<button class="uk-button portal-button" (click)="invite()">Invite</button> |
|
136 |
</div> |
|
137 |
</td> |
|
138 |
</tr> |
|
139 |
</tbody> |
|
140 |
</table> |
|
141 |
|
|
142 |
<div class="uk-text-left"> |
|
143 |
<span uk-icon="chevron-left"></span><span class="uk-margin-small-left"> |
|
144 |
<a [queryParams]="communityIdParam" routerLinkActive="router-link-active" |
|
145 |
routerLink="/">Back</a> |
|
146 |
</span> |
|
147 |
</div> |
|
148 |
|
|
149 |
</div> |
|
150 |
</div> |
|
151 |
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" |
|
152 |
[texts]="pageContents['bottom']"></helper> |
|
153 |
</div> |
|
154 |
</div> |
|
155 |
</div> |
|
156 |
<div class="uk-inline"> |
|
157 |
<button *ngIf="!longView" [class]=" ((buttonSizeSmall)?'uk-button-small':'') + ' uk-button uk-button-primary'"> |
|
158 |
Invite users |
|
159 |
</button> |
|
160 |
<div uk-dropdown="mode: click" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage"> |
|
161 |
<div class="uk-margin-top"> |
|
162 |
<errorMessages [status]="[status]" [type]="'community'"></errorMessages> |
|
163 |
</div> |
|
164 |
<div *ngIf="missingCommunityId" class="uk-width-large uk-text-warning uk-text-small uk-margin-top" |
|
165 |
role="alert">{{missingCommunityId}}</div> |
|
166 |
<div *ngIf="successfulSentMessage" class="uk-width-large uk-text-success uk-text-small uk-margin-top" |
|
167 |
role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div> |
|
168 |
<div *ngIf="failureSentMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top" |
|
169 |
role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div> |
|
170 |
<div *ngIf="inviteErrorMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top" |
|
171 |
role="alert">{{inviteErrorMessage}}</div> |
|
172 |
|
|
173 |
<div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add |
|
174 |
valid email/s. |
|
175 |
</div> |
|
176 |
<div *ngIf="isEmpty(recipients) && showAddRecipientMessage" |
|
177 |
class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add a recipient. |
|
178 |
</div> |
|
179 |
<input (click)="resetMessages(); areValid=true" placeholder="Type e-mails" type="text" |
|
180 |
class="form-control uk-input uk-form-small uk-form" [(ngModel)]="recipients" id="recipients" |
|
181 |
required> |
|
182 |
<div class="uk-width-medium uk-text-muted uk-text-small">separate with commas</div> |
|
183 |
<div class="uk-margin-small-top uk-text-center "> |
|
184 |
<button class=" uk-button portal-button ignoreCommunityPanelBackground uk-button-small " (click)="invite()">Invite</button> |
|
185 |
{{" "}} |
|
186 |
<a class=" uk-button uk-button-default uk-button-small ignoreCommunityPanelBackground " [queryParams]="communityIdParam" |
|
187 |
routerLinkActive="router-link-active" routerLink="/invite"> |
|
188 |
<span class="uk-margin-xsmall-left uk-icon"> |
|
189 |
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog" |
|
190 |
ratio="0.8"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path |
|
191 |
fill="none" stroke="#000" |
|
192 |
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> |
|
193 |
|
|
194 |
</span> |
|
195 |
Customize |
|
196 |
</a> |
|
197 |
</div> |
|
198 |
</div> |
|
199 |
</div> |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.component.ts | ||
---|---|---|
1 |
import {Component, Input, OnInit} from '@angular/core'; |
|
2 |
import {FormBuilder} from "@angular/forms"; |
|
3 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
4 |
|
|
5 |
import {ConnectHelper} from '../../../openaireLibrary/connect/connectHelper'; |
|
6 |
|
|
7 |
import {Email} from '../../../openaireLibrary/utils/email/email'; |
|
8 |
import {Body} from '../../../openaireLibrary/utils/email/body'; |
|
9 |
import {Validator} from '../../../openaireLibrary/utils/email/validator'; |
|
10 |
import {Composer} from '../../../openaireLibrary/utils/email/composer'; |
|
11 |
|
|
12 |
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; |
|
13 |
import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; |
|
14 |
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service"; |
|
15 |
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; |
|
16 |
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component'; |
|
17 |
import {Session, User} from '../../../openaireLibrary/login/utils/helper.class'; |
|
18 |
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class"; |
|
19 |
import {HelperService} from "../../../openaireLibrary/utils/helper/helper.service"; |
|
20 |
import {Meta, Title} from "@angular/platform-browser"; |
|
21 |
import {SEOService} from "../../../openaireLibrary/sharedComponents/SEO/SEO.service"; |
|
22 |
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service"; |
|
23 |
import {PiwikHelper} from "../../piwikHelper"; |
|
24 |
import {UserManagementService} from "../../../openaireLibrary/services/user-management.service"; |
|
25 |
|
|
26 |
@Component({ |
|
27 |
selector: 'invite', |
|
28 |
templateUrl: './invite.component.html', |
|
29 |
}) |
|
30 |
|
|
31 |
export class InviteComponent implements OnInit { |
|
32 |
|
|
33 |
@Input() longView: boolean = true; |
|
34 |
@Input() communityId = null; |
|
35 |
@Input() buttonSizeSmall = true; |
|
36 |
|
|
37 |
private properties: EnvProperties = null; |
|
38 |
|
|
39 |
public community = null; |
|
40 |
//public showLoading: boolean = true; |
|
41 |
public errorMessage: string = ''; |
|
42 |
public successfulSentMessage: string = ''; |
|
43 |
public successfulSentRecipients: string[] = []; |
|
44 |
public failureSentMessage: string = ''; |
|
45 |
public failureSentRecipients: string[] = []; |
|
46 |
public inviteErrorMessage: string = ''; |
|
47 |
public missingCommunityId: string = ''; |
|
48 |
public showAddRecipientMessage: boolean = false; |
|
49 |
public showAddNameMessage: boolean = false; |
|
50 |
|
|
51 |
public email: Email; |
|
52 |
public body: Body; |
|
53 |
public recipients: string; |
|
54 |
public fullname: string; |
|
55 |
|
|
56 |
public areValid: boolean = true; |
|
57 |
|
|
58 |
private ckeditorContent: string; |
|
59 |
|
|
60 |
// public defaultBody =''; |
|
61 |
|
|
62 |
public communityIdParam = {}; |
|
63 |
public status: number = 1; |
|
64 |
public errorCodes: ErrorCodes; |
|
65 |
private errorMessages: ErrorMessagesComponent; |
|
66 |
public pageContents = null; |
|
67 |
public divContents = null; |
|
68 |
|
|
69 |
public url: string = null; |
|
70 |
public pageTitle: string = "Invite"; |
|
71 |
piwiksub: any; |
|
72 |
private user: User; |
|
73 |
|
|
74 |
constructor( |
|
75 |
private route: ActivatedRoute, |
|
76 |
private _router: Router, |
|
77 |
public _fb: FormBuilder, |
|
78 |
private _emailService: EmailService, |
|
79 |
private _communityService: CommunityService, |
|
80 |
private helper: HelperService, |
|
81 |
private _meta: Meta, |
|
82 |
private _title: Title, |
|
83 |
private seoService: SEOService, |
|
84 |
private _piwikService: PiwikService, |
|
85 |
private userManageService: UserManagementService) { |
|
86 |
|
|
87 |
this.errorCodes = new ErrorCodes(); |
|
88 |
this.errorMessages = new ErrorMessagesComponent(); |
|
89 |
this.status = this.errorCodes.LOADING; |
|
90 |
} |
|
91 |
|
|
92 |
public ngOnInit() { |
|
93 |
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { |
|
94 |
this.properties = data.envSpecific; |
|
95 |
this.errorMessage = ""; |
|
96 |
this.missingCommunityId = ""; |
|
97 |
this.status = this.errorCodes.LOADING; |
|
98 |
this.userManageService.getUserInfo(this.properties.userInfoUrl).subscribe(user => { |
|
99 |
this.user = user; |
|
100 |
this.route.queryParams.subscribe( |
|
101 |
communityId => { |
|
102 |
//if(!this.communityId && typeof document !== 'undefined'){ |
|
103 |
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); |
|
104 |
if (!this.communityId) { |
|
105 |
this.communityId = communityId['communityId']; |
|
106 |
} |
|
107 |
|
|
108 |
if (this.longView) { |
|
109 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
110 |
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe(); |
|
111 |
} |
|
112 |
this.url = this.properties.baseLink + this._router.url; |
|
113 |
this.seoService.createLinkForCanonicalURL(this.url); |
|
114 |
this.updateUrl(this.url); |
|
115 |
this.updateTitle(this.pageTitle); |
|
116 |
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community, invite"); |
|
117 |
} |
|
118 |
this.communityIdParam = (this.properties.environment != "development") ? {} : {communityId: this.communityId}; |
|
119 |
if (this.communityId != null && this.communityId != '') { |
|
120 |
//this.getDivContents(); |
|
121 |
this.getPageContents(); |
|
122 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe( |
|
123 |
community => { |
|
124 |
this.community = community; |
|
125 |
this.fullname = this.user.fullname; |
|
126 |
//console.log("Fullname from session " + Session.getUserFullName()); |
|
127 |
|
|
128 |
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname); |
|
129 |
this.email = Composer.initializeInvitationsEmail(community.title); |
|
130 |
this.recipients = ""; |
|
131 |
|
|
132 |
this.status = this.errorCodes.DONE; |
|
133 |
}, |
|
134 |
error => { |
|
135 |
//this.handleError(error) |
|
136 |
this.handleError("Error getting community with id: " + this.communityId, error); |
|
137 |
this.status = this.errorMessages.getErrorCode(error.status); |
|
138 |
} |
|
139 |
); |
|
140 |
} else { |
|
141 |
this.status = this.errorCodes.DONE; |
|
142 |
this.missingCommunityId = "There is no community selected!"; |
|
143 |
} |
|
144 |
|
|
145 |
}); |
|
146 |
|
|
147 |
HelperFunctions.scroll(); |
|
148 |
}); |
|
149 |
}); |
|
150 |
} |
|
151 |
|
|
152 |
ngOnDestroy() { |
|
153 |
if (this.piwiksub) { |
|
154 |
this.piwiksub.unsubscribe(); |
|
155 |
} |
|
156 |
} |
|
157 |
|
|
158 |
private getPageContents() { |
|
159 |
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
160 |
this.pageContents = contents; |
|
161 |
}) |
|
162 |
} |
|
163 |
|
|
164 |
private getDivContents() { |
|
165 |
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
166 |
this.divContents = contents; |
|
167 |
}) |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
public invite() { |
|
172 |
this.successfulSentMessage = ""; |
|
173 |
this.failureSentMessage = ""; |
|
174 |
this.inviteErrorMessage = ""; |
|
175 |
this.status = this.errorCodes.LOADING; |
|
176 |
HelperFunctions.scroll(); |
|
177 |
if (!this.isEmpty(this.recipients) && this.body.fromName != "") { |
|
178 |
if (this.validateEmails()) { |
|
179 |
this.composeEmail(); |
|
180 |
|
|
181 |
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", this.email).subscribe( |
|
182 |
res => { |
|
183 |
this.status = this.errorCodes.DONE; |
|
184 |
//console.log("Emails Sent: ",res); |
|
185 |
/*if(res == 0) { |
|
186 |
|
|
187 |
} else if(res > 1) { |
|
188 |
this.successfulSentMessage = res + " emails sent successfully!"; |
|
189 |
} else { |
|
190 |
this.successfulSentMessage = res + " email sent successfully!"; |
|
191 |
}*/ |
|
192 |
|
|
193 |
if (res['success']) { |
|
194 |
this.successfulSentMessage = "Email sent successfully to: "; |
|
195 |
this.successfulSentRecipients = res['success']; |
|
196 |
} |
|
197 |
if (res['failure']) { |
|
198 |
this.failureSentMessage = "There was an error sending email to: "; |
|
199 |
this.failureSentRecipients = res['failure']; |
|
200 |
} |
|
201 |
|
|
202 |
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname); |
|
203 |
this.email = Composer.initializeInvitationsEmail(this.community.title); |
|
204 |
this.recipients = ""; |
|
205 |
}, |
|
206 |
error => { |
|
207 |
//console.log(error); |
|
208 |
this.handleError("Error inviting emails: " + JSON.stringify(this.recipients) + " to community with id: " + this.communityId + " by: " + this.fullname, error); |
|
209 |
this.status = this.errorCodes.DONE; |
|
210 |
this.inviteErrorMessage = "There was an error sending emails. Please try again."; |
|
211 |
} |
|
212 |
); |
|
213 |
} else { |
|
214 |
this.email.recipients = []; |
|
215 |
this.status = this.errorCodes.DONE; |
|
216 |
} |
|
217 |
} else { |
|
218 |
this.showAddRecipientMessage = true; |
|
219 |
this.status = this.errorCodes.DONE; |
|
220 |
} |
|
221 |
} |
|
222 |
|
|
223 |
public isEmpty(data: string): boolean { |
|
224 |
if (data != undefined && !data.replace(/\s/g, '').length) |
|
225 |
return true; |
|
226 |
else |
|
227 |
return false; |
|
228 |
} |
|
229 |
|
|
230 |
public resetMessages() { |
|
231 |
this.errorMessage = ""; |
|
232 |
this.successfulSentMessage = ""; |
|
233 |
this.failureSentMessage = ""; |
|
234 |
this.inviteErrorMessage = ""; |
|
235 |
} |
|
236 |
|
|
237 |
public validateEmails(): boolean { |
|
238 |
if (this.parseEmails()) { |
|
239 |
if (Validator.hasValidEmails(this.email.recipients)) { |
|
240 |
return this.areValid; |
|
241 |
} |
|
242 |
} |
|
243 |
this.areValid = false; |
|
244 |
return this.areValid; |
|
245 |
} |
|
246 |
|
|
247 |
public parseEmails(): boolean { |
|
248 |
let email = new Array<string>(); |
|
249 |
|
|
250 |
// remove spaces |
|
251 |
this.recipients = this.recipients.replace(/\s/g, ''); |
|
252 |
|
|
253 |
// remove commas |
|
254 |
email = this.recipients.split(","); |
|
255 |
|
|
256 |
// remove empty fields |
|
257 |
for (let i = 0; i < email.length; i++) { |
|
258 |
if (!(email[i] == "")) { |
|
259 |
this.email.recipients.push(email[i]); |
|
260 |
} |
|
261 |
} |
|
262 |
return true; |
|
263 |
} |
|
264 |
|
|
265 |
public composeEmail() { |
|
266 |
this.email.body = Composer.formatEmailBodyForInvitation(this.body); |
|
267 |
} |
|
268 |
|
|
269 |
/* |
|
270 |
public handleError(error) { |
|
271 |
if(error.status == '401') { |
|
272 |
this.status = this.errorCodes.FORBIDDEN; |
|
273 |
} else if(error.status == '403') { |
|
274 |
this.status = this.errorCodes.FORBIDDEN; |
|
275 |
} else if(error.status == '404') { |
|
276 |
this.status = this.errorCodes.NOT_FOUND; |
|
277 |
} else if(error.status == '500') { |
|
278 |
this.status = this.errorCodes.ERROR; |
|
279 |
} else { |
|
280 |
this.status = this.errorCodes.NOT_AVAILABLE; |
|
281 |
} |
|
282 |
console.log('Server responded: ' + error); |
|
283 |
} |
|
284 |
*/ |
|
285 |
allowEdit() { |
|
286 |
if (!this.user) { |
|
287 |
return false; |
|
288 |
} |
|
289 |
var email = this.user.email; |
|
290 |
var index = -1; |
|
291 |
if (email && this.community != null && this.community.managers != null) { |
|
292 |
index = this.community.managers.indexOf(email); |
|
293 |
} |
|
294 |
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1; |
|
295 |
} |
|
296 |
|
|
297 |
private handleError(message: string, error) { |
|
298 |
console.error("Invite Page (or component): " + message, error); |
|
299 |
} |
|
300 |
|
|
301 |
private updateDescription(description: string) { |
|
302 |
this._meta.updateTag({content: description}, "name='description'"); |
|
303 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
304 |
} |
|
305 |
|
|
306 |
private updateTitle(title: string) { |
|
307 |
var _title = ((title.length > 50) ? title.substring(0, 50) : title); |
|
308 |
this._title.setTitle(_title); |
|
309 |
this._meta.updateTag({content: _title}, "property='og:title'"); |
|
310 |
} |
|
311 |
|
|
312 |
private updateUrl(url: string) { |
|
313 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
314 |
} |
|
315 |
} |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
import {CKEditorModule} from 'ng2-ckeditor'; |
|
6 |
|
|
7 |
import {InviteComponent} from './invite.component'; |
|
8 |
import {InviteRoutingModule} from './invite-routing.module'; |
|
9 |
|
|
10 |
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
11 |
|
|
12 |
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard'; |
|
13 |
import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; |
|
14 |
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service'; |
|
15 |
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module'; |
|
16 |
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard"; |
|
17 |
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module"; |
|
18 |
import {Schema2jsonldModule} from "../../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; |
|
19 |
import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module"; |
|
20 |
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service"; |
|
21 |
|
|
22 |
@NgModule({ |
|
23 |
imports: [ |
|
24 |
CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule, |
|
25 |
HelperModule, Schema2jsonldModule, SEOServiceModule |
|
26 |
], |
|
27 |
declarations: [ |
|
28 |
InviteComponent |
|
29 |
], |
|
30 |
providers: [ |
|
31 |
LoginGuard, PreviousRouteRecorder, |
|
32 |
EmailService, CommunityService, IsRouteEnabled, |
|
33 |
PiwikService |
|
34 |
], |
|
35 |
exports: [ |
|
36 |
InviteComponent |
|
37 |
] |
|
38 |
}) |
|
39 |
|
|
40 |
export class InviteModule { } |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite-routing.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {RouterModule} from '@angular/router'; |
|
3 |
|
|
4 |
import {InviteComponent} from './invite.component'; |
|
5 |
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
7 |
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard"; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: InviteComponent, canActivate: [LoginGuard, /*IsRouteEnabled*/], canDeactivate: [PreviousRouteRecorder] } |
|
13 |
|
|
14 |
]) |
|
15 |
] |
|
16 |
}) |
|
17 |
export class InviteRoutingModule { } |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/assets/manager.svg | ||
---|---|---|
1 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 82.278 58.7"><defs><style>.a{fill:#fff;}.a,.b{stroke:#ebb13e;stroke-miterlimit:10;stroke-width:3px;}.b{fill:none;}</style></defs><g transform="translate(1 2)"><g transform="translate(-9.464 -954.4)"><path class="a" d="M60,979.6a12.864,12.864,0,0,0,1.9-2.1.91.91,0,0,0,0-1.2c-.9-1.1-1.5-1.9-1.9-2.5.2-.5.4-1,.6-1.4l3.3-.5a.9.9,0,0,0,.8-1l-.1-4.2a1.063,1.063,0,0,0-.9-1l-3.2-.5a11.111,11.111,0,0,0-.7-1.6c.1-.1.2-.3.4-.4a5.548,5.548,0,0,0,.6-.8l.3-.4a6.783,6.783,0,0,0,.6-.9,1.083,1.083,0,0,0,0-1.1,19.927,19.927,0,0,0-3.2-3.3,1.059,1.059,0,0,0-1.3-.1l-2.6,2c-.5-.2-.9-.4-1.4-.6l-.5-3.3a.974.974,0,0,0-1-.8H47.5a.974.974,0,0,0-1,.8c-.2,1.1-.4,2.2-.5,3.4l-1.5.6-2.4-1.9c-.1-.1-.2-.1-.3-.2-.6-.3-1.1,0-2.4,1.3a17.966,17.966,0,0,0-1.9,2,.91.91,0,0,0,0,1.2l.2.2a22.13,22.13,0,0,1,1.7,2.3,4.714,4.714,0,0,0-.6,1.5l-3.4.6a.9.9,0,0,0-.8,1l.1,4.2a1.063,1.063,0,0,0,.9,1l3.3.5a11.111,11.111,0,0,0,.7,1.6c-.2.3-.6.7-.9,1.2l-.3.4a6.783,6.783,0,0,0-.6.9,1.083,1.083,0,0,0,0,1.1,32.6,32.6,0,0,0,3.1,3.3,1.23,1.23,0,0,0,1.3.1l2.6-2a11.209,11.209,0,0,0,1.3.5l.5,3.3a.974.974,0,0,0,1,.8h4.2a1.077,1.077,0,0,0,1-.8v-.1a30.679,30.679,0,0,0,.4-3.1l1.5-.6,3,2.5Z"/><path class="a" d="M50.1,965.6a2.9,2.9,0,1,1-2.9,2.9A3.039,3.039,0,0,1,50.1,965.6Z"/></g><circle class="a" cx="7.435" cy="7.435" r="7.435" transform="translate(61.335 13.246)"/><circle class="a" cx="7.435" cy="7.435" r="7.435" transform="translate(4.169 13.246)"/><path class="b" d="M63.951,58.112h0A16.5,16.5,0,0,0,47.438,41.6H34.112A16.5,16.5,0,0,0,17.6,58.112h0" transform="translate(-0.588 -1.412)"/><path class="b" d="M65.5,41.6h0A16.567,16.567,0,0,1,82.012,58.112h0" transform="translate(-2.234 -1.412)"/><path class="b" d="M17.012,41.6h0A16.567,16.567,0,0,0,.5,58.112h0" transform="translate(0 -1.412)"/></g></svg> |
Also available in: Unified diff
[Monitor-Dashboard]: Add new dashboard theme and make monitor page base on it.