[Trunk|Connect]: 1. Add filter name Role with value Manager on Search of communities. 2. Finish contact form.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55289 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
ebd7d8efaa
commit
18cef75b2e
|
@ -6,10 +6,11 @@
|
||||||
<div class="uk-margin-top uk-align-center">
|
<div class="uk-margin-top uk-align-center">
|
||||||
<div class="uk-section uk-section-large">
|
<div class="uk-section uk-section-large">
|
||||||
<div class="uk-container uk-container-large">
|
<div class="uk-container uk-container-large">
|
||||||
<div uk-grid>
|
<div class="uk-grid-divider" uk-grid>
|
||||||
<div class="uk-width-1-2@m uk-width-1-1@s">
|
<div class="uk-width-1-2@m uk-width-1-1@s">
|
||||||
<h4 class="uk-margin-auto uk-h4 uk-text-bold">Contact us and create your community profile</h4>
|
<h4 class="uk-margin-auto uk-h4 uk-text-bold">Contact us and create your community profile</h4>
|
||||||
<div class="uk-margin uk-padding-small uk-padding-remove-left" uk-grid>
|
<div *ngIf="errorMessage" class="uk-width-1-1 uk-alert uk-alert-danger uk-text-center" role="alert">{{errorMessage}}</div>
|
||||||
|
<div class="uk-margin uk-padding uk-padding-remove-left" uk-grid>
|
||||||
<label class="uk-width-1-2 uk-h5 uk-text-bold">
|
<label class="uk-width-1-2 uk-h5 uk-text-bold">
|
||||||
Name <span class="uk-text-danger uk-text-bold">*</span>
|
Name <span class="uk-text-danger uk-text-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
|
@ -60,20 +61,26 @@
|
||||||
<re-captcha #recaptcha (resolved)="handleRecaptcha($event)" [(siteKey)]="properties.reCaptchaSiteKey" required></re-captcha>
|
<re-captcha #recaptcha (resolved)="handleRecaptcha($event)" [(siteKey)]="properties.reCaptchaSiteKey" required></re-captcha>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2 uk-text-danger uk-text-bold uk-text-right">* Required fields</div>
|
<div class="uk-width-1-2 uk-text-danger uk-text-bold uk-text-right">* Required fields</div>
|
||||||
<div class="uk-width-1-1">
|
<div class="uk-width-1-1 uk-text-right">
|
||||||
<button class="uk-button portal-button" (click)="send()">Send</button>
|
|
||||||
<button class="uk-button uk-button-default uk-margin-auto-top" (click)="reset()">Reset</button>
|
<button class="uk-button uk-button-default uk-margin-auto-top" (click)="reset()">Reset</button>
|
||||||
|
<button class="uk-button portal-button" (click)="send()">Send</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-2@m uk-width-1-1@s">
|
<div class="uk-width-1-2@m uk-width-1-1@s">
|
||||||
<h5 class="uk-margin-auto-top uk-margin-remove-bottom uk-h5 uk-text-bold">OpenAIRE gives you the virtual environment and services designed for your community to:</h5>
|
<h5 class="uk-margin-auto-top uk-margin-remove-bottom uk-h5 uk-text-bold">OpenAIRE gives you the virtual environment and services designed for your community to:</h5>
|
||||||
<ul class="uk-list uk-list-divider uk-padding-small uk-padding-remove-left uk-margin-auto-top">
|
<ul class="uk-list uk-list-divider uk-padding uk-padding-remove-left uk-margin-auto-top">
|
||||||
<li><h5 class="uk-h5"><b>Create</b> and <b>Manage</b> your community</h5></li>
|
<li><h5 class="uk-h5"><b>Create</b> and <b>Manage</b> your community</h5></li>
|
||||||
<li><h5 class="uk-h5"><b>Access, share </b>and<b> link</b> together all your research</h5></li>
|
<li><h5 class="uk-h5"><b>Access, share </b>and<b> link</b> together all your research</h5></li>
|
||||||
<li><h5 class="uk-h5"><b>Monitor</b> and <b>report</b> your community's progress</h5></li>
|
<li><h5 class="uk-h5"><b>Monitor</b> and <b>report</b> your community's progress</h5></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<modal-alert #AlertModal (alertOutput)="goToHome($event)">
|
||||||
|
<div class="uk-text-center">
|
||||||
|
Our team will response to your submission soon.<br>
|
||||||
|
You will be redirected to OpenAIRE Connect home page
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component, OnInit, Input, ElementRef, ViewChild} from '@angular/core';
|
import {Component, OnInit, Input, ElementRef, ViewChild} from '@angular/core';
|
||||||
import {FormGroup, FormBuilder, Validators} from '@angular/forms';
|
import {FormGroup} from '@angular/forms';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||||
import {Email} from "../openaireLibrary/utils/email/email";
|
import {Email} from "../openaireLibrary/utils/email/email";
|
||||||
|
@ -19,15 +19,13 @@ export class ContactComponent implements OnInit {
|
||||||
|
|
||||||
public showLoading = true;
|
public showLoading = true;
|
||||||
public errorMessage = '';
|
public errorMessage = '';
|
||||||
|
|
||||||
public successfulSaveMessage = '';
|
|
||||||
|
|
||||||
public isSubmitted = false;
|
public isSubmitted = false;
|
||||||
public email: Email;
|
public email: Email;
|
||||||
public note = '';
|
public note = '';
|
||||||
public properties: EnvProperties = null;
|
public properties: EnvProperties = null;
|
||||||
|
|
||||||
public contactForm: ContactForm = new ContactForm();
|
public contactForm: ContactForm = new ContactForm();
|
||||||
|
@ViewChild('AlertModal') modal;
|
||||||
@ViewChild('name') name;
|
@ViewChild('name') name;
|
||||||
@ViewChild('surname') surname;
|
@ViewChild('surname') surname;
|
||||||
@ViewChild('sender') sender;
|
@ViewChild('sender') sender;
|
||||||
|
@ -61,26 +59,50 @@ export class ContactComponent implements OnInit {
|
||||||
public send() {
|
public send() {
|
||||||
this.isSubmitted = true;
|
this.isSubmitted = true;
|
||||||
if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid &&
|
if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid &&
|
||||||
!this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha) {
|
!this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha != '') {
|
||||||
this.sendMail(this.properties.admins);
|
this.sendMail(this.properties.admins);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.errorMessage = 'Please fill all the required fields!'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
this.contactForm = new ContactForm();
|
this.contactForm = new ContactForm();
|
||||||
this.recaptcha.reset();
|
this.recaptcha.reset();
|
||||||
|
this.isSubmitted = false;
|
||||||
|
this.errorMessage = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendMail(admins: any) {
|
private sendMail(admins: any) {
|
||||||
this._emailService.contact(this.properties.adminToolsAPIURL + '/contact',
|
this._emailService.contact(this.properties.adminToolsAPIURL + '/contact',
|
||||||
Composer.composeEmailForNewCommunity(this.contactForm, admins), this.contactForm.recaptcha).subscribe(
|
Composer.composeEmailForNewCommunity(this.contactForm, admins), this.contactForm.recaptcha).subscribe(
|
||||||
res => {
|
res => {
|
||||||
console.log(res)
|
if(res != null) {
|
||||||
|
this.modalOpen();
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.handleError('Token has expired. Please complete the reCaptcha challenge again! ', null);
|
||||||
|
this.recaptcha.reset();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error => console.log(error)
|
error => {
|
||||||
|
this.handleError('Email sent failed! Please try again.', error);
|
||||||
|
this.recaptcha.reset();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public modalOpen() {
|
||||||
|
this.modal.okButton = true;
|
||||||
|
this.modal.alertTitle = 'Your request has been successfully submitted';
|
||||||
|
this.modal.alertMessage = false;
|
||||||
|
this.modal.cancelButton = false;
|
||||||
|
this.modal.okButtonLeft = false;
|
||||||
|
this.modal.okButtonText = 'Ok';
|
||||||
|
this.modal.open();
|
||||||
|
}
|
||||||
|
|
||||||
public handleRecaptcha(captchaResponse: string) {
|
public handleRecaptcha(captchaResponse: string) {
|
||||||
this.contactForm.recaptcha = captchaResponse;
|
this.contactForm.recaptcha = captchaResponse;
|
||||||
|
@ -94,4 +116,21 @@ export class ContactComponent implements OnInit {
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getProductionPrefix():string{
|
||||||
|
return (this.properties.environment == "beta")?"beta.":""
|
||||||
|
}
|
||||||
|
|
||||||
|
isProduction():boolean{
|
||||||
|
return this.properties.environment!="development";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToHome(data: any) {
|
||||||
|
if(this.isProduction()) {
|
||||||
|
window.location.hostname = 'https://'+ this.getProductionPrefix() + 'connect.openaire.eu';
|
||||||
|
} else {
|
||||||
|
this._router.navigate(['/']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ import {ContactComponent} from './contact.component';
|
||||||
import {ContactRoutingModule} from "./contact-routing.module";
|
import {ContactRoutingModule} from "./contact-routing.module";
|
||||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||||
import {RecaptchaModule} from "ng-recaptcha";
|
import {RecaptchaModule} from "ng-recaptcha";
|
||||||
|
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
ContactRoutingModule, CommonModule, FormsModule, RouterModule,
|
ContactRoutingModule, CommonModule, FormsModule, RouterModule,
|
||||||
RecaptchaModule.forRoot()
|
AlertModalModule, RecaptchaModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ContactComponent
|
ContactComponent
|
||||||
|
|
|
@ -215,14 +215,19 @@ export class SearchCommunitiesComponent {
|
||||||
private checkFilters(params: Map<string, string>) {
|
private checkFilters(params: Map<string, string>) {
|
||||||
let typeResults: SearchResult[] = [];
|
let typeResults: SearchResult[] = [];
|
||||||
let statusResults: SearchResult[] = [];
|
let statusResults: SearchResult[] = [];
|
||||||
|
let roleResults: SearchResult[] = [];
|
||||||
let types: string[] = [];
|
let types: string[] = [];
|
||||||
let statuses: string[] = [];
|
let statuses: string[] = [];
|
||||||
|
let roles: string[] = [];
|
||||||
if(params.get('type') != undefined) {
|
if(params.get('type') != undefined) {
|
||||||
types = (StringUtils.URIDecode(params.get('type'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
types = (StringUtils.URIDecode(params.get('type'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||||
}
|
}
|
||||||
if(params.get('status') != undefined) {
|
if(params.get('status') != undefined) {
|
||||||
statuses = (StringUtils.URIDecode(params.get('status'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
statuses = (StringUtils.URIDecode(params.get('status'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||||
}
|
}
|
||||||
|
if(params.get('role') != undefined) {
|
||||||
|
roles = (StringUtils.URIDecode(params.get('role'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||||
|
}
|
||||||
for(let i = 0; i < this.results.length; i++) {
|
for(let i = 0; i < this.results.length; i++) {
|
||||||
if (types.length == 0) {
|
if (types.length == 0) {
|
||||||
typeResults.push(this.results[i]);
|
typeResults.push(this.results[i]);
|
||||||
|
@ -235,8 +240,6 @@ export class SearchCommunitiesComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.resetFilterNumbers('status');
|
|
||||||
this.updateFilterNumbers(typeResults, 'status');
|
|
||||||
for(let i = 0; i < this.results.length; i++) {
|
for(let i = 0; i < this.results.length; i++) {
|
||||||
if( statuses.length == 0) {
|
if( statuses.length == 0) {
|
||||||
statusResults.push(this.results[i]);
|
statusResults.push(this.results[i]);
|
||||||
|
@ -261,10 +264,37 @@ export class SearchCommunitiesComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(let i = 0; i < this.results.length; i++) {
|
||||||
|
if (roles.length == 0) {
|
||||||
|
roleResults.push(this.results[i]);
|
||||||
|
} else {
|
||||||
|
for (let role of roles) {
|
||||||
|
if(role.replace(/["']/g, "") == 'manager') {
|
||||||
|
if (this.results[i].isManager) {
|
||||||
|
roleResults.push(this.results[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.resetFilterNumbers('status');
|
||||||
|
this.updateFilterNumbers(typeResults.filter(value => {
|
||||||
|
return roleResults.includes(value);
|
||||||
|
}), 'status');
|
||||||
this.resetFilterNumbers('type');
|
this.resetFilterNumbers('type');
|
||||||
this.updateFilterNumbers(statusResults, 'type');
|
this.updateFilterNumbers(statusResults.filter(value => {
|
||||||
|
return roleResults.includes(value);
|
||||||
|
}), 'type');
|
||||||
|
this.resetFilterNumbers('role');
|
||||||
|
this.updateFilterNumbers(statusResults.filter(value => {
|
||||||
|
return typeResults.includes(value);
|
||||||
|
}), 'role');
|
||||||
this.results = statusResults.filter(value => {
|
this.results = statusResults.filter(value => {
|
||||||
return typeResults.includes(value);
|
return typeResults.includes(value);
|
||||||
|
})
|
||||||
|
this.results = this.results.filter(value => {
|
||||||
|
return roleResults.includes(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,8 +338,10 @@ export class SearchCommunitiesComponent {
|
||||||
} else {
|
} else {
|
||||||
this.filters[i].values[1].number++;
|
this.filters[i].values[1].number++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (this.filters[i].filterId == 'role') {
|
||||||
if (results[k].isManager) {
|
if (results[k].isManager) {
|
||||||
this.filters[i].values[2].number++;
|
this.filters[i].values[0].number++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -382,8 +414,12 @@ export class SearchCommunitiesComponent {
|
||||||
if(Session.isLoggedIn()) {
|
if(Session.isLoggedIn()) {
|
||||||
filter_names[1] = "Status";
|
filter_names[1] = "Status";
|
||||||
filter_ids[1] = "status";
|
filter_ids[1] = "status";
|
||||||
value_names[1] = [ "Subscribed", "Non-subscribed", "Managing" ];
|
value_names[1] = [ "Subscribed", "Non-subscribed"];
|
||||||
value_original_ids[1] = ["subscribed", "nonsubscribed", "managing"];
|
value_original_ids[1] = ["subscribed", "nonsubscribed"];
|
||||||
|
filter_names[2] = "Role";
|
||||||
|
filter_ids[2] = "role";
|
||||||
|
value_names[2] = [ "Manager" ];
|
||||||
|
value_original_ids[2] = ["manager"];
|
||||||
}
|
}
|
||||||
let filters: Filter[] = [];
|
let filters: Filter[] = [];
|
||||||
for(let i =0 ; i < filter_names.length; i++){
|
for(let i =0 ; i < filter_names.length; i++){
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
||||||
|
|
||||||
"adminToolsAPIURL" :"http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools",
|
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools",
|
||||||
|
|
||||||
"adminToolsCommunity" :"openaire",
|
"adminToolsCommunity" :"openaire",
|
||||||
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",
|
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",
|
||||||
|
|
Loading…
Reference in New Issue