[Trunk|Connect]: 1. SearchCommunities: change getSubscribe method. 2. replace scroll with new helper function. 3. SubscribeModule: add forRoot for service
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55417 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
e92220bd31
commit
6b5c935300
|
@ -333,10 +333,6 @@ export class AppComponent {
|
||||||
console.error("Error fetching your subscribed communities")
|
console.error("Error fetching your subscribed communities")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if(this.subscriberOfCommunities){
|
|
||||||
// myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.menuItems.push({rootItem: new MenuItem("communities","Communities","","/search/find/communities",false,[],null,{}), items: []});
|
this.menuItems.push({rootItem: new MenuItem("communities","Communities","","/search/find/communities",false,[],null,{}), items: []});
|
||||||
if(this.managerOfCommunities || this.subscriberOfCommunities){
|
if(this.managerOfCommunities || this.subscriberOfCommunities){
|
||||||
this.menuItems.push({rootItem: new MenuItem("myCommunities","My Communities","","",false,[],[],{}), items: myCommunities});
|
this.menuItems.push({rootItem: new MenuItem("myCommunities","My Communities","","",false,[],[],{}), items: myCommunities});
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {APP_BASE_HREF, CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {HttpModule} from '@angular/http';
|
import {HttpModule} from '@angular/http';
|
||||||
import {RouterModule} from '@angular/router';
|
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
|
@ -15,7 +14,6 @@ import {AppRoutingModule} from './app-routing.module';
|
||||||
import {SharedModule} from './shared/shared.module';
|
import {SharedModule} from './shared/shared.module';
|
||||||
import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module';
|
import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module';
|
||||||
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
|
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
|
||||||
import {FeedbackModule} from './openaireLibrary/sharedComponents/feedback/feedback.module';
|
|
||||||
import {ErrorModule} from './openaireLibrary/error/error.module';
|
import {ErrorModule} from './openaireLibrary/error/error.module';
|
||||||
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
|
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
|
||||||
|
|
||||||
|
@ -35,10 +33,10 @@ import {SubscribeModule} from './utils/subscribe/subscribe.module';
|
||||||
ErrorModule,
|
ErrorModule,
|
||||||
CKEditorModule,
|
CKEditorModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
NavigationBarModule, //FeedbackModule,
|
NavigationBarModule,
|
||||||
BottomModule,
|
BottomModule,
|
||||||
CookieLawModule,
|
CookieLawModule,
|
||||||
SubscribeModule,
|
SubscribeModule.forRoot(),
|
||||||
BrowserModule.withServerTransition({appId: 'my-app'}),
|
BrowserModule.withServerTransition({appId: 'my-app'}),
|
||||||
AppRoutingModule
|
AppRoutingModule
|
||||||
],
|
],
|
||||||
|
|
|
@ -2,7 +2,6 @@ import {NgModule} from '@angular/core';
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {RouterModule} from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
|
|
||||||
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
|
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
|
||||||
|
|
||||||
import {CommunitiesComponent} from './communities.component';
|
import {CommunitiesComponent} from './communities.component';
|
||||||
|
@ -19,14 +18,14 @@ import {BrowseCommunityModule} from './browseCommunity/browse-community.modul
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, RouterModule,
|
CommonModule, FormsModule, RouterModule,
|
||||||
SubscribeModule, ManageModule, ErrorMessagesModule,
|
ManageModule, ErrorMessagesModule,
|
||||||
SearchFormModule, BrowseCommunityModule
|
SearchFormModule, BrowseCommunityModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
CommunitiesComponent
|
CommunitiesComponent
|
||||||
],
|
],
|
||||||
providers:[
|
providers:[
|
||||||
FreeGuard, PreviousRouteRecorder, ConfigurationService,
|
FreeGuard, PreviousRouteRecorder,
|
||||||
PiwikService
|
PiwikService
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
import {Component, Input, Output, ElementRef} from '@angular/core';
|
import {Component, ElementRef, Input, ViewChild} from '@angular/core';
|
||||||
import {EventEmitter, ViewChild} from '@angular/core';
|
|
||||||
import {ChangeDetectionStrategy} from '@angular/core';
|
|
||||||
import {ViewEncapsulation} from '@angular/core';
|
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Location} from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
import {Title, Meta} from '@angular/platform-browser';
|
import {Meta, Title} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
|
|
||||||
import "rxjs/add/observable/zip";
|
import "rxjs/add/observable/zip";
|
||||||
|
|
||||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||||
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
|
|
||||||
|
|
||||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||||
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
||||||
|
@ -24,6 +18,8 @@ import {StatisticsForDashboardComponent} from '../statistics/statistics.componen
|
||||||
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
||||||
|
|
||||||
import {PiwikHelper} from '../utils/piwikHelper';
|
import {PiwikHelper} from '../utils/piwikHelper';
|
||||||
|
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'community',
|
selector: 'community',
|
||||||
templateUrl: 'community.component.html',
|
templateUrl: 'community.component.html',
|
||||||
|
@ -66,6 +62,7 @@ export class CommunityComponent {
|
||||||
public subOrps;
|
public subOrps;
|
||||||
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
|
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
|
||||||
public activeTab = "publication";
|
public activeTab = "publication";
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private element: ElementRef,
|
private element: ElementRef,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -100,7 +97,7 @@ public activeTab = "publication";
|
||||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||||
community => {
|
community => {
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
this.element.nativeElement.scrollIntoView();
|
HelperFunctions.scroll();
|
||||||
}
|
}
|
||||||
this.community = community;
|
this.community = community;
|
||||||
if (this.properties.environment == "development") {
|
if (this.properties.environment == "development") {
|
||||||
|
@ -135,7 +132,6 @@ public activeTab = "publication";
|
||||||
this.zenodoCommunityIdS = result;
|
this.zenodoCommunityIdS = result;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
//console.error("list of zenodo communities couldn't be loaded");
|
//console.error("list of zenodo communities couldn't be loaded");
|
||||||
|
@ -147,7 +143,6 @@ public activeTab = "publication";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst + 'publications/count?format=json&fq=communityid=' + this.communityId).subscribe(
|
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst + 'publications/count?format=json&fq=communityid=' + this.communityId).subscribe(
|
||||||
publicationTotal => {
|
publicationTotal => {
|
||||||
this.publicationTotal = publicationTotal;
|
this.publicationTotal = publicationTotal;
|
||||||
|
@ -297,9 +292,11 @@ public activeTab = "publication";
|
||||||
isEntityEnabled(entity: string) {
|
isEntityEnabled(entity: string) {
|
||||||
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
|
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
|
||||||
}
|
}
|
||||||
|
|
||||||
isRouteEnabled(route: string) {
|
isRouteEnabled(route: string) {
|
||||||
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
|
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
|
||||||
}
|
}
|
||||||
|
|
||||||
showInvite() {
|
showInvite() {
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,6 +345,7 @@ countOtherGraphs(){
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
createParams(param) {
|
createParams(param) {
|
||||||
return StringUtils.quote(StringUtils.URIEncode(param));
|
return StringUtils.quote(StringUtils.URIEncode(param));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import {SearchFormModule} from '../openaireLibrary/searchPages/searchUti
|
||||||
CommunityComponent, ResultsComponent
|
CommunityComponent, ResultsComponent
|
||||||
],
|
],
|
||||||
providers:[
|
providers:[
|
||||||
FreeGuard, PreviousRouteRecorder, ConfigurationService,
|
FreeGuard, PreviousRouteRecorder,
|
||||||
PiwikService, CommunityService, SearchEntriesService
|
PiwikService, CommunityService, SearchEntriesService
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {ContactForm} from "../openaireLibrary/utils/email/contact-form";
|
||||||
import {Composer} from "../openaireLibrary/utils/email/composer";
|
import {Composer} from "../openaireLibrary/utils/email/composer";
|
||||||
import {Title} from "@angular/platform-browser";
|
import {Title} from "@angular/platform-browser";
|
||||||
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
||||||
|
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'contact',
|
selector: 'contact',
|
||||||
|
@ -36,8 +37,7 @@ export class ContactComponent implements OnInit {
|
||||||
@ViewChild('message') message;
|
@ViewChild('message') message;
|
||||||
@ViewChild('recaptcha') recaptcha;
|
@ViewChild('recaptcha') recaptcha;
|
||||||
|
|
||||||
constructor(private element: ElementRef,
|
constructor(private route: ActivatedRoute,
|
||||||
private route: ActivatedRoute,
|
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _emailService: EmailService,
|
private _emailService: EmailService,
|
||||||
private _title: Title,
|
private _title: Title,
|
||||||
|
@ -53,19 +53,13 @@ export class ContactComponent implements OnInit {
|
||||||
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
||||||
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Connect|Contact Us", this.properties.piwikSiteId).subscribe();
|
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Connect|Contact Us", this.properties.piwikSiteId).subscribe();
|
||||||
}
|
}
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public scroll() {
|
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
this.element.nativeElement.scrollIntoView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public send() {
|
public send() {
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid &&
|
if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid &&
|
||||||
this.contactForm.email.match('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$') &&
|
this.contactForm.email.match('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$') &&
|
||||||
!this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha != '') {
|
!this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha != '') {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {Title, Meta} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||||
import {AppElementService} from "../appElementService.service";
|
|
||||||
|
|
||||||
declare var UIkit: any;
|
declare var UIkit: any;
|
||||||
|
|
||||||
|
@ -277,8 +276,7 @@ export class CommunityCreationInstructionsComponent {
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _title: Title,
|
private _title: Title,
|
||||||
private _piwikService:PiwikService,
|
private _piwikService:PiwikService) {
|
||||||
private appElementsService: AppElementService) {
|
|
||||||
|
|
||||||
var description = "OpenAIRE - Connect, Community Dashboard, research community";
|
var description = "OpenAIRE - Connect, Community Dashboard, research community";
|
||||||
var title = "OpenAIRE - Connect | Create and manage your community page";
|
var title = "OpenAIRE - Connect | Create and manage your community page";
|
||||||
|
@ -345,7 +343,7 @@ export class CommunityCreationInstructionsComponent {
|
||||||
*/
|
*/
|
||||||
/*UIkit.util.on('#logo', 'beforehide', function () {
|
/*UIkit.util.on('#logo', 'beforehide', function () {
|
||||||
// do something
|
// do something
|
||||||
if(this.hide == false) {
|
if(this.hide =http://www.equp4.wf/= false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Title, Meta} from '@angular/platform-browser';
|
import {Meta, Title} from '@angular/platform-browser';
|
||||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||||
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||||
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
||||||
|
@ -9,9 +8,9 @@ import {CommunityService} from '../../openaireLibrary/connect/community/communit
|
||||||
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
||||||
|
|
||||||
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
||||||
import {ZenodoCommunityInfo} from '../../openaireLibrary/connect/zenodoCommunities/zenodoCommunityInfo';
|
|
||||||
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
|
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
|
||||||
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
|
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
|
||||||
|
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'share-in-zenodo',
|
selector: 'share-in-zenodo',
|
||||||
|
@ -34,15 +33,17 @@ export class ShareInZenodoComponent {
|
||||||
|
|
||||||
zenodocommunitiesloadedCount = 0;
|
zenodocommunitiesloadedCount = 0;
|
||||||
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass();
|
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass();
|
||||||
errorCodes: ErrorCodes = new ErrorCodes();;
|
errorCodes: ErrorCodes = new ErrorCodes();
|
||||||
depositLink = "https://zenodo.org/deposit/new?c=";
|
depositLink = "https://zenodo.org/deposit/new?c=";
|
||||||
|
|
||||||
|
|
||||||
constructor (private element: ElementRef, private route: ActivatedRoute, private _router: Router,
|
constructor(private route: ActivatedRoute, private _router: Router,
|
||||||
private _meta: Meta, private _title: Title, private _ΖenodoCommunitieService: ZenodoCommunitiesService,private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {}
|
private _meta: Meta, private _title: Title, private _ΖenodoCommunitieService: ZenodoCommunitiesService, private _communityService: CommunityService, private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
|
||||||
|
}
|
||||||
|
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
|
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||||
|
;
|
||||||
this.route.data
|
this.route.data
|
||||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
this.updateUrl(data.envSpecific.baseLink + this._router.url);
|
this.updateUrl(data.envSpecific.baseLink + this._router.url);
|
||||||
|
@ -64,7 +65,7 @@ export class ShareInZenodoComponent {
|
||||||
this.community = community;
|
this.community = community;
|
||||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
this.element.nativeElement.scrollIntoView();
|
HelperFunctions.scroll();
|
||||||
}
|
}
|
||||||
if (this.masterZenodoCommunityId) {
|
if (this.masterZenodoCommunityId) {
|
||||||
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
||||||
|
@ -83,7 +84,8 @@ export class ShareInZenodoComponent {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
|
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||||
|
;
|
||||||
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||||
result => {
|
result => {
|
||||||
this.CommunityIds = result;
|
this.CommunityIds = result;
|
||||||
|
@ -125,15 +127,18 @@ export class ShareInZenodoComponent {
|
||||||
this._meta.updateTag({content: description}, "name='description'");
|
this._meta.updateTag({content: description}, "name='description'");
|
||||||
this._meta.updateTag({content: description}, "property='og:description'");
|
this._meta.updateTag({content: description}, "property='og:description'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle(title: string) {
|
private updateTitle(title: string) {
|
||||||
var _prefix = "OpenAIRE | ";
|
var _prefix = "OpenAIRE | ";
|
||||||
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
|
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
|
||||||
this._title.setTitle(_title);
|
this._title.setTitle(_title);
|
||||||
this._meta.updateTag({content: _title}, "property='og:title'");
|
this._meta.updateTag({content: _title}, "property='og:title'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateUrl(url: string) {
|
private updateUrl(url: string) {
|
||||||
this._meta.updateTag({content: url}, "property='og:url'");
|
this._meta.updateTag({content: url}, "property='og:url'");
|
||||||
}
|
}
|
||||||
|
|
||||||
getZenodoCommunityById(zenodoid, openaireId) {
|
getZenodoCommunityById(zenodoid, openaireId) {
|
||||||
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
||||||
result => {
|
result => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, ElementRef, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from "@angular/core";
|
||||||
import {SearchUtilsClass} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
import {SearchUtilsClass} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||||
import {ErrorMessagesComponent} from "../../openaireLibrary/utils/errorMessages.component";
|
import {ErrorMessagesComponent} from "../../openaireLibrary/utils/errorMessages.component";
|
||||||
import {ErrorCodes} from "../../openaireLibrary/utils/properties/errorCodes";
|
import {ErrorCodes} from "../../openaireLibrary/utils/properties/errorCodes";
|
||||||
|
@ -11,11 +11,9 @@ import {CommunitiesService} from "../../openaireLibrary/connect/communities/comm
|
||||||
import {Session} from "../../openaireLibrary/login/utils/helper.class";
|
import {Session} from "../../openaireLibrary/login/utils/helper.class";
|
||||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||||
import {SubscribeService} from "../../openaireLibrary/utils/subscribe/subscribe.service";
|
import {SubscribeService} from "../../openaireLibrary/utils/subscribe/subscribe.service";
|
||||||
import {Observable} from "rxjs";
|
|
||||||
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
||||||
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
||||||
import {catchError} from "rxjs/operators";
|
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||||
import {of} from "rxjs/observable/of";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-communities',
|
selector: 'search-communities',
|
||||||
|
@ -51,7 +49,6 @@ export class SearchCommunitiesComponent {
|
||||||
constructor (private route: ActivatedRoute,
|
constructor (private route: ActivatedRoute,
|
||||||
private _communitiesService: CommunitiesService,
|
private _communitiesService: CommunitiesService,
|
||||||
private _subscribeService: SubscribeService,
|
private _subscribeService: SubscribeService,
|
||||||
private element: ElementRef,
|
|
||||||
private _piwikService: PiwikService) {
|
private _piwikService: PiwikService) {
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.errorMessages = new ErrorMessagesComponent();
|
this.errorMessages = new ErrorMessagesComponent();
|
||||||
|
@ -104,7 +101,6 @@ export class SearchCommunitiesComponent {
|
||||||
private initCommunities(params: Map<string, string>) {
|
private initCommunities(params: Map<string, string>) {
|
||||||
this.subResults = this._communitiesService.getCommunitiesState().subscribe(
|
this.subResults = this._communitiesService.getCommunitiesState().subscribe(
|
||||||
data => {
|
data => {
|
||||||
let observables: Observable<boolean>[] = [];
|
|
||||||
for(let i = 0; i < data.length; i++) {
|
for(let i = 0; i < data.length; i++) {
|
||||||
this.totalResults[i] = data[i];
|
this.totalResults[i] = data[i];
|
||||||
this.totalResults[i].isManager = false;
|
this.totalResults[i].isManager = false;
|
||||||
|
@ -113,18 +109,14 @@ export class SearchCommunitiesComponent {
|
||||||
//this.results[i].description = "EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation."
|
//this.results[i].description = "EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation."
|
||||||
//this.results[i].date = new Date(new Date(2012, 0, 1).getTime() + Math.random() * (new Date().getTime() - new Date(2012, 0, 1).getTime()));
|
//this.results[i].date = new Date(new Date(2012, 0, 1).getTime() + Math.random() * (new Date().getTime() - new Date(2012, 0, 1).getTime()));
|
||||||
if(Session.isLoggedIn()) {
|
if(Session.isLoggedIn()) {
|
||||||
let observable: Observable<boolean> = this._subscribeService.isSubscribedToCommunity(this.totalResults[i].communityId, Session.getUserEmail(), this.properties["adminToolsAPIURL"]);
|
|
||||||
observables.push(observable.pipe(catchError(err => {
|
|
||||||
return of(false);
|
|
||||||
})));
|
|
||||||
this.totalResults[i].isManager = this.isCommunityManager(this.totalResults[i]);
|
this.totalResults[i].isManager = this.isCommunityManager(this.totalResults[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (observables.length > 0) {
|
if(Session.isLoggedIn()) {
|
||||||
Observable.forkJoin(observables).subscribe(
|
this._subscribeService.getCommunitiesSubscribedTo(Session.getUserEmail(), this.properties["adminToolsAPIURL"]).subscribe(
|
||||||
res => {
|
res => {
|
||||||
for (let i = 0; i < res.length; i++) {
|
for (let i = 0; i < this.totalResults.length; i++) {
|
||||||
this.totalResults[i].isSubscribed = res[i];
|
this.totalResults[i].isSubscribed = (res.indexOf(this.totalResults[i].communityId) != -1);
|
||||||
}
|
}
|
||||||
this._getResults(params);
|
this._getResults(params);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +130,7 @@ export class SearchCommunitiesComponent {
|
||||||
this.handleError('Error getting communities', err);
|
this.handleError('Error getting communities', err);
|
||||||
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -217,7 +209,7 @@ export class SearchCommunitiesComponent {
|
||||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,9 +473,4 @@ export class SearchCommunitiesComponent {
|
||||||
console.error('Communities Search Page: ' + message, error);
|
console.error('Communities Search Page: ' + message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public scroll() {
|
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
this.element.nativeElement.scrollIntoView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ import {FormsModule} from "@angular/forms";
|
||||||
import {SearchCommunitiesComponent} from "./searchCommunities.component";
|
import {SearchCommunitiesComponent} from "./searchCommunities.component";
|
||||||
import {SearchPageModule} from "../../openaireLibrary/searchPages/searchUtils/searchPage.module";
|
import {SearchPageModule} from "../../openaireLibrary/searchPages/searchUtils/searchPage.module";
|
||||||
import {SearchFormModule} from "../../openaireLibrary/searchPages/searchUtils/searchForm.module";
|
import {SearchFormModule} from "../../openaireLibrary/searchPages/searchUtils/searchForm.module";
|
||||||
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
|
|
||||||
import {SearchCommunitiesRoutingModule} from "./searchCommunities-routing.module";
|
import {SearchCommunitiesRoutingModule} from "./searchCommunities-routing.module";
|
||||||
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
|
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
|
||||||
import {SubscribeService} from "../../openaireLibrary/utils/subscribe/subscribe.service";
|
|
||||||
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -19,7 +17,7 @@ import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
||||||
declarations: [
|
declarations: [
|
||||||
SearchCommunitiesComponent
|
SearchCommunitiesComponent
|
||||||
],
|
],
|
||||||
providers:[ SubscribeService, PreviousRouteRecorder, PiwikService],
|
providers:[ PreviousRouteRecorder, PiwikService],
|
||||||
exports: [
|
exports: [
|
||||||
SearchCommunitiesComponent
|
SearchCommunitiesComponent
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {CommunityService} from "../../../openaire
|
||||||
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
|
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
|
||||||
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
|
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
|
||||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||||
|
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'invite',
|
selector: 'invite',
|
||||||
|
@ -59,7 +60,6 @@ export class InviteComponent implements OnInit {
|
||||||
private errorMessages: ErrorMessagesComponent;
|
private errorMessages: ErrorMessagesComponent;
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private element: ElementRef,
|
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
public _fb: FormBuilder,
|
public _fb: FormBuilder,
|
||||||
|
@ -112,22 +112,17 @@ export class InviteComponent implements OnInit {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public scroll() {
|
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
this.element.nativeElement.scrollIntoView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public invite() {
|
public invite() {
|
||||||
this.successfulSentMessage = "";
|
this.successfulSentMessage = "";
|
||||||
this.failureSentMessage = "";
|
this.failureSentMessage = "";
|
||||||
this.inviteErrorMessage = "";
|
this.inviteErrorMessage = "";
|
||||||
this.status = this.errorCodes.LOADING;
|
this.status = this.errorCodes.LOADING;
|
||||||
this.scroll();
|
HelperFunctions.scroll();
|
||||||
if (!this.isEmpty(this.recipients) && this.body.fromName != "") {
|
if (!this.isEmpty(this.recipients) && this.body.fromName != "") {
|
||||||
if (this.validateEmails()) {
|
if (this.validateEmails()) {
|
||||||
this.composeEmail();
|
this.composeEmail();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { NgModule} from '@angular/core';
|
import {ModuleWithProviders, NgModule} from '@angular/core';
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {RouterModule} from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
|
@ -16,11 +16,17 @@ import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.mod
|
||||||
declarations: [
|
declarations: [
|
||||||
SubscribeComponent
|
SubscribeComponent
|
||||||
],
|
],
|
||||||
providers:[
|
|
||||||
SubscribeService, EmailService, CommunityService
|
|
||||||
],
|
|
||||||
exports: [
|
exports: [
|
||||||
SubscribeComponent
|
SubscribeComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SubscribeModule { }
|
export class SubscribeModule {
|
||||||
|
static forRoot(): ModuleWithProviders {
|
||||||
|
return {
|
||||||
|
ngModule: SubscribeModule,
|
||||||
|
providers: [
|
||||||
|
SubscribeService, EmailService, CommunityService
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue