[Connect | Trunk]: 1. Add new roles functionllities (subscribe - role-verification). 2. Comment customization. 3. Refactor getting community logic

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60454 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-02-19 17:52:12 +00:00
parent 25e8dde7d5
commit 57cd810c3e
27 changed files with 725 additions and 1098 deletions

View File

@ -18,7 +18,6 @@ const routes: Routes = [
{ path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'contact-us', loadChildren: './contact/contact.module#ContactModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'verify/:id', loadChildren: './verification-manager/verification-manager.module#VerificationManagerModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},

View File

@ -7,7 +7,6 @@ import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/env
import {CommunitiesService} from "./openaireLibrary/connect/communities/communities.service";
import {Session, User} from './openaireLibrary/login/utils/helper.class';
import {ConnectHelper} from './openaireLibrary/connect/connectHelper';
import {SubscribeService} from './openaireLibrary/utils/subscribe/subscribe.service';
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
@ -15,6 +14,7 @@ import {properties} from '../environments/environment';
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
import {Subscriber} from "rxjs";
import {CommunityService} from "./openaireLibrary/connect/community/community.service";
import {CommunityInfo} from "./openaireLibrary/connect/community/communityInfo";
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@ -35,15 +35,17 @@ import {CommunityService} from "./openaireLibrary/connect/community/community.se
[showHomeMenuItem]="false"></navbar>
<customization *ngIf="properties && communityId && communityId.length > 0" [properties]="properties"
[communityId]="communityId"></customization>
<schema2jsonld *ngIf="properties && showMenu && !community" [URL]="properties.domain + properties.baseLink"
[logoURL]="properties.domain + properties.baseLink+'/assets/common-assets/logo-small-connect.png'" type="home"
<schema2jsonld *ngIf="properties && showMenu && !community" [URL]="properties.domain + properties.baseLink"
[logoURL]="properties.domain + properties.baseLink+'/assets/common-assets/logo-small-connect.png'"
type="home"
[searchActionRoute]="properties.searchLinkToCommunities" [searchAction]="true"
name="OpenAIRE Connect"
description="Build a Gateway for your Community: Turn Open Science into Practice. It takes your open and linked research outcomes.">
</schema2jsonld>
<schema2jsonld *ngIf="properties && showMenu && communityId && communityId.length > 0 && community" [URL]="properties.domain + properties.baseLink"
<schema2jsonld *ngIf="properties && showMenu && communityId && communityId.length > 0 && community"
[URL]="properties.domain + properties.baseLink"
[logoURL]="community.logoUrl" type="home" [searchActionRoute]="properties.searchLinkToResults"
[name]="community.name" [description]="community.description" >
[name]="community.name" [description]="community.description">
</schema2jsonld>
<div class="custom-main-content">
<main>
@ -52,7 +54,7 @@ import {CommunityService} from "./openaireLibrary/connect/community/community.se
</div>
<div id="subscribeAndInviteBtn" *ngIf="isClient && properties && community">
<subscribe [communityId]="community.id" [properties]="properties"></subscribe>
<invite *ngIf="managerOfCommunities" [longView]=false [buttonSizeSmall]=false [properties]="properties"></invite>
<invite *ngIf="isManager" [longView]=false [buttonSizeSmall]=false [properties]="properties"></invite>
</div>
<!--feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackQuestionaire]=properties.feedbackQuestionaire></feedback-->
<cookie-law *ngIf="isClient" position="bottom">
@ -60,7 +62,7 @@ import {CommunityService} from "./openaireLibrary/connect/community/community.se
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing
experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right"
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03"
points="7 4 13 10 7 16"></polyline></svg>
@ -72,6 +74,8 @@ import {CommunityService} from "./openaireLibrary/connect/community/community.se
[showSocialButtons]="true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true"
[communityId]="community.id" [menuItems]=bottomMenuItems [properties]="properties"
[darkBackground]="true" [centered]="true"></bottom>
<role-verification *ngIf="community" service="connect"
[id]="community.id" [name]="community.name" [type]="'community'"></role-verification>
</div>
`
@ -89,7 +93,6 @@ export class AppComponent {
showMenu: boolean = false;
communities = null;
subscriberOfCommunities = false;
managerOfCommunities = false;
user: User;
communityId: string = "";
header: Header;
@ -97,7 +100,7 @@ export class AppComponent {
subscriptions = [];
// community: {id:string, name:string, logoUrl:string};
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService,
private _communitiesService: CommunitiesService,
private router: Router, private userManagementService: UserManagementService,
private configurationService: ConfigurationService, private _communityService: CommunityService) {
this.subscriptions.push(router.events.forEach((event) => {
@ -106,6 +109,7 @@ export class AppComponent {
}
}));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
@ -115,7 +119,6 @@ export class AppComponent {
this._communitiesService.clearSubscriptions();
this.userManagementService.clearSubscriptions();
this.configurationService.clearSubscriptions();
this._subscribeService.clearSubscriptions();
this._communityService.clearSubscriptions();
}
@ -135,6 +138,11 @@ export class AppComponent {
}
get isManager() {
return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user))
}
private init() {
let communityId: string = "";
if (this.properties.environment == "development") {
@ -160,37 +168,10 @@ export class AppComponent {
}
public buildMenu(communityId: string) {
let community = null;
this.community = null;
this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communities => {
if (!communities || communities.length == 0 && communityId !== null && communityId !== '') {
return;
}
for (var com of communities) {
if ((communityId && communityId != "" && com.communityId == communityId
&& community != null) ||
(
!(communityId && communityId != "" && com.communityId == communityId)
&&
this.managerOfCommunities && this.subscriberOfCommunities)) {
break;
}
if (this.user && com['status'] != "hidden") {
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) ||(this.communityId && Session.isManager('community', this.communityId, this.user))) {
this.managerOfCommunities = true;
} else if (com.managers.indexOf(this.user.email) != -1) {
this.managerOfCommunities = true;
}
}
if (communityId && communityId != "" && com.communityId == communityId) {
community = com;
let isCommunityManager: boolean = false;
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user))) {
isCommunityManager = true;
} else if (this.user && com.managers.indexOf(this.user.email) != -1) {
isCommunityManager = true;
}
if(communityId) {
if (!this.community || this.community.communityId !== communityId) {
this.subscriptions.push(this._communityService.getCommunityNew(communityId).subscribe(community => {
if (community && community.status !== 'hidden') {
this.community = {
id: community.communityId,
name: (community.shortTitle) ? community.shortTitle : community.title,
@ -240,80 +221,86 @@ export class AppComponent {
new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], this.properties.environment != "development" ? {} : {communityId: community.communityId}),
]
});
if (isCommunityManager) {
if (this.isManager) {
this.menuItems.push(
{
rootItem: new MenuItem("manage", "Manage", this.properties.adminPortalURL +'/dashboard?communityId=' + community.communityId, "", false, [], [], {}),
items: []
});
}
}
}
if (community == null) {
this.header = {
route: "/",
url: null,
title: 'connect',
logoUrl: this.logoPath + 'logo-large-connect.png',
logoSmallUrl:this.logoPath + 'logo-small-connect.png',
position:'left',
badge:true
};
this.menuItems = [];
this.menuItems.push({
rootItem: new MenuItem("about", "About", "", "/about/learn-how", false, [], ["/about/learn-how"], {}),
items: [
new MenuItem("", "Learn the process", "", "/about/learn-how", false, [], ["/about/learn-in-depth"], {}),
new MenuItem("", "Publications", "", "/publications", false, [], ["/publications"], {}),
new MenuItem("", "Roadmap", "https://trello.com/b/yfzUz0kp/openaire-connect-dashboard", "", false, [], [], {}),
new MenuItem("", "FAQs", "", "/about/faq", false, [], ["/about/faq"], {})
]
});
this.menuItems.push({
rootItem: new MenuItem("communities", "Communities", "", "/search/find/communities", false, [], ['/search/find/communities'], {}),
items: []
});
this.menuItems.push({
rootItem: new MenuItem("contact-us", "Contact us", "", "/contact-us", false, [], ['/contact-us'], {}),
items: []
});
this.bottomMenuItems = [
new MenuItem("", "About", "https://beta.openaire.eu/project-factsheets", "", false, [], [], {}),
new MenuItem("", "News - Events", "https://beta.openaire.eu/news-events", "", false, [], [], {}),
new MenuItem("", "Blog", "https://blogs.openaire.eu/", "", false, [], [], {}),
new MenuItem("", "Contact us", "https://beta.openaire.eu/contact-us", "", false, [], [], {})
];
this.userMenuItems = [];
if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage Helptexts",
((this.properties.environment == "production") ? "https://admin.explore.openaire.eu" : "https://beta.admin.connect.openaire.eu") + "/dashboard?communityId=connect",
"", false, [], [], {}))
}
if (this.user) {
this.userMenuItems.push(new MenuItem("my-communities", "My Communities", "",
"/myCommunities", false, [], [], {}));
}
} else {
this.bottomMenuItems = [
new MenuItem("", "Supporting organizations", "", "/organizations", false, [], ["/organizations"], this.properties.environment != "development" ? {} : {communityId: community.communityId})
];
if (this.properties.showContent) {
this.bottomMenuItems.push(new MenuItem("", "Sources and methodology", "", "/content", false, [], [], {}));
}
if(this.user) {
this.userMenuItems = [ /*new MenuItem("","My profile","","",false,[],[],{}),*/
new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], this.properties.environment != "development" ? {} : {communityId: community.communityId}),
new MenuItem("", "Invite users", "", "/invite", false, [], [], this.properties.environment != "development" ? {} : {communityId: community.communityId}),
this.bottomMenuItems = [
new MenuItem("", "Supporting organizations", "", "/organizations", false, [], ["/organizations"], this.properties.environment != "development" ? {} : {communityId: community.communityId})
];
if (this.managerOfCommunities) {
this.userMenuItems.push(new MenuItem("", "Support", "https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611", "", false, [], [], {}))
if (this.properties.showContent) {
this.bottomMenuItems.push(new MenuItem("", "Sources and methodology", "", "/content", false, [], [], {}));
}
if(this.user) {
this.userMenuItems = [ /*new MenuItem("","My profile","","",false,[],[],{}),*/
new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], this.properties.environment != "development" ? {} : {communityId: community.communityId}),
new MenuItem("", "Invite users", "", "/invite", false, [], [], this.properties.environment != "development" ? {} : {communityId: community.communityId}),
];
if (this.isManager) {
this.userMenuItems.push(new MenuItem("", "Support", "https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611", "", false, [], [], {}))
}
}
this.showMenu = true;
} else {
this.navigateToError();
}
}
}));
} else {
this.showMenu = true;
}));
}
} else {
this.header = {
route: "/",
url: null,
title: 'connect',
logoUrl: this.logoPath + 'logo-large-connect.png',
logoSmallUrl:this.logoPath + 'logo-small-connect.png',
position:'left',
badge:true
};
this.menuItems = [];
this.menuItems.push({
rootItem: new MenuItem("about", "About", "", "/about/learn-how", false, [], ["/about/learn-how"], {}),
items: [
new MenuItem("", "Learn the process", "", "/about/learn-how", false, [], ["/about/learn-in-depth"], {}),
new MenuItem("", "Publications", "", "/publications", false, [], ["/publications"], {}),
new MenuItem("", "Roadmap", "https://trello.com/b/yfzUz0kp/openaire-connect-dashboard", "", false, [], [], {}),
new MenuItem("", "FAQs", "", "/about/faq", false, [], ["/about/faq"], {})
]
});
this.menuItems.push({
rootItem: new MenuItem("communities", "Communities", "", "/search/find/communities", false, [], ['/search/find/communities'], {}),
items: []
});
this.menuItems.push({
rootItem: new MenuItem("contact-us", "Contact us", "", "/contact-us", false, [], ['/contact-us'], {}),
items: []
});
this.bottomMenuItems = [
new MenuItem("", "About", "https://beta.openaire.eu/project-factsheets", "", false, [], [], {}),
new MenuItem("", "News - Events", "https://beta.openaire.eu/news-events", "", false, [], [], {}),
new MenuItem("", "Blog", "https://blogs.openaire.eu/", "", false, [], [], {}),
new MenuItem("", "Contact us", "https://beta.openaire.eu/contact-us", "", false, [], [], {})
];
this.userMenuItems = [];
if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage Helptexts",
((this.properties.environment == "production") ? "https://admin.explore.openaire.eu" : "https://beta.admin.connect.openaire.eu") + "/dashboard?communityId=connect",
"", false, [], [], {}))
}
if (this.user) {
this.userMenuItems.push(new MenuItem("my-communities", "My Communities", "",
"/myCommunities", false, [], [], {}));
}
this.showMenu = true;
}
}
private navigateToError() {
this.router.navigate(['/error'], {queryParams: {'page': this.properties.baseLink + this.router.url}});
}
}

View File

@ -23,12 +23,13 @@ import {SubscribeModule} from './utils/subscribe/subscribe.module';
import {CustomizationModule} from "./utils/customization/customization.module";
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service";
import {InviteBasicModule} from "./utils/subscribe/invite/inviteBasic.module";
import {SubscribeService} from "./openaireLibrary/utils/subscribe/subscribe.service";
import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module";
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
import {SubscribeService} from "./openaireLibrary/utils/subscribe/subscribe.service";
import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-verification.module";
@NgModule({
@ -47,12 +48,12 @@ import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.
AppRoutingModule,
BrowserTransferStateModule,
BrowserAnimationsModule,
PageURLResolverModule, Schema2jsonldModule
PageURLResolverModule, Schema2jsonldModule, RoleVerificationModule
],
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],
providers:[
EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService, IsCommunity,
EnvironmentSpecificResolver, CommunitiesService, LayoutService, IsCommunity, SubscribeService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,

View File

@ -3,7 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -47,7 +46,6 @@ export class CommunitiesComponent {
private _title: Title,
private _piwikService: PiwikService,
private _communitiesService: CommunitiesService,
private _subscribeService: SubscribeService,
private helper: HelperService,
private seoService: SEOService) {

View File

@ -275,8 +275,8 @@
</div>
</div>
<div *ngIf="isRouteEnabled('/curators')" [class]="community.managers ? 'uk-margin-small-bottom' : ''">
<curators [longView]="false" [managers]="community.managers" [communityId]="communityId"></curators>
<div *ngIf="isRouteEnabled('/curators')" class="uk-margin-small-bottom">
<curators [longView]="false"></curators>
</div>
<div [class]="community.date || subscribers ? 'uk-margin-small-bottom' : ''">
<span *ngIf="community.date" class="uk-margin-right">

View File

@ -43,7 +43,7 @@ export class CommunityComponent {
public contentProvidersCalculated: boolean = false;
params: any = {};
properties: EnvProperties;
properties: EnvProperties = properties;
public errorCodes: ErrorCodes = new ErrorCodes();
// Request results of each tab only the one time (first time tab is clicked)
@ -79,7 +79,7 @@ export class CommunityComponent {
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
public activeTab = "summary";
public show: string = 'overview';
public analyticsActiveTab:string = "";
public analyticsActiveTab: string = "";
public analyticsChecked: boolean = false;
searchLinkToResults: string = null;
@ -96,9 +96,9 @@ export class CommunityComponent {
selectedEntity;
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
keyword:string ="";
keyword: string = "";
customFilter;
placeholderText="Search by title, author, abstract, DOI, orcid... ";
placeholderText = "Search by title, author, abstract, DOI, orcid... ";
constructor(
private element: ElementRef,
@ -132,27 +132,26 @@ export class CommunityComponent {
}
public ngOnInit() {
this.properties = properties;
this.searchLinkToResults = this.properties.searchLinkToResults;
this.searchLinkToProjects = this.properties.searchLinkToProjects;
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
this.shareInZenodoPage = this.properties.shareInZenodoPage;
this.url =properties.domain + properties.baseLink + this._router.url;
this.url = properties.domain + properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url, false);
this._meta.updateTag({content: this.url}, "property='og:url'");
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
}));
if (this.communityId != null && this.communityId != '') {
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
if(community) {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
this.community = community;
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
this.thresholdDescription = community.description.length;
}
@ -184,49 +183,47 @@ export class CommunityComponent {
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
}
));
//console.log(community);
}));
this.countResearchResults("publication");
this.countResearchResults("dataset");
this.countResearchResults("software");
this.countResearchResults("other");
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
projectTotal => {
this.projectTotal = projectTotal;
},
error => {
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
},
() => {
this.projectsCalculated = true;
}
));
}));
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
//console.log(contentProviderTotal);
},
error => {
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
},
() => {
this.contentProvidersCalculated = true;
}
));
this.subs.push(this.config.communityInformationState.subscribe(
res => {
this.communityInfo = res;
},
error => {
//console.log(error)
this.handleError("Error getting community with id: " + this.communityId, error);
}
));
}
this.countResearchResults("publication");
this.countResearchResults("dataset");
this.countResearchResults("software");
this.countResearchResults("other");
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
projectTotal => {
this.projectTotal = projectTotal;
},
error => {
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
},
() => {
this.projectsCalculated = true;
}
));
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
//console.log(contentProviderTotal);
},
error => {
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
},
() => {
this.contentProvidersCalculated = true;
}
));
this.subs.push(this.config.communityInformationState.subscribe(
res => {
this.communityInfo = res;
},
error => {
//console.log(error)
this.handleError("Error getting community with id: " + this.communityId, error);
}
));
}
private searchPublications(page: number, size: number) {
@ -377,7 +374,7 @@ export class CommunityComponent {
}
public getParamsForSearchLink(type: string = "") {
if(type) {
if (type) {
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
} else {
return {};
@ -399,14 +396,14 @@ export class CommunityComponent {
public buildProjectsAndContentProvidesTooltip(): string {
let tooltipContent: string = "<div class='uk-margin'>";
if(this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
tooltipContent += "<span class='uk-text-bold'>Projects</span>";
}
if(this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)
&& (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders))) {
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)
&& (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders))) {
tooltipContent += " and ";
}
if(this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
tooltipContent += "<span class='uk-text-bold'>Content Providers</span>";
}
@ -425,26 +422,26 @@ export class CommunityComponent {
return tooltipContent;
}
entityChanged($event){
entityChanged($event) {
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl;
if(this.selectedEntity == 'result'){
this.placeholderText ="Search by title, author, abstract, DOI, orcid... ";
}else if(this.selectedEntity == 'project') {
if (this.selectedEntity == 'result') {
this.placeholderText = "Search by title, author, abstract, DOI, orcid... ";
} else if (this.selectedEntity == 'project') {
this.placeholderText = "Search by project title, grant id, funder...";
}else if(this.selectedEntity == 'dataprovider') {
} else if (this.selectedEntity == 'dataprovider') {
this.placeholderText = "Search by name...";
}else{
} else {
this.placeholderText = "Search community content";
}
}
goTo(simple:boolean){
let url = (simple)?this.selectedEntitySimpleUrl:this.selectedEntityAdvancedUrl;
goTo(simple: boolean) {
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
let parameterNames = [];
let parameterValues = [];
if(this.keyword.length > 0) {
if (this.keyword.length > 0) {
parameterNames.push("fv0");
parameterValues.push(this.keyword);
parameterNames.push("f0");
@ -453,7 +450,7 @@ export class CommunityComponent {
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
}
public countSubscribersEvent($event){
public countSubscribersEvent($event) {
this.subscribers = $event.value;
}
@ -474,14 +471,14 @@ export class CommunityComponent {
}
public initializeAnalyticsActiveTab() {
if(!this.analyticsChecked) {
if(this.checkStatistics("publication")) {
if (!this.analyticsChecked) {
if (this.checkStatistics("publication")) {
this.analyticsActiveTab = "publication";
} else if(this.checkStatistics("dataset")) {
} else if (this.checkStatistics("dataset")) {
this.analyticsActiveTab = "dataset";
} else if(this.checkStatistics("software")) {
} else if (this.checkStatistics("software")) {
this.analyticsActiveTab = "software";
} else if(this.checkStatistics("orp")) {
} else if (this.checkStatistics("orp")) {
this.analyticsActiveTab = "orp";
}
}
@ -493,7 +490,7 @@ export class CommunityComponent {
}
public onSelectActiveTab(activeTabId) {
if(this.activeTab != "activaTabId") { // tab really changed
if (this.activeTab != "activaTabId") { // tab really changed
if (activeTabId == 'summary') {
this.activeTab = 'summary';
} else if (activeTabId == 'publications') {
@ -506,7 +503,7 @@ export class CommunityComponent {
this.show = 'overview';
this.searchSoftware(1, this.searchNumber);
} else if (activeTabId == 'other') {
this.show='overview';
this.show = 'overview';
this.searchOrps(1, this.searchNumber);
} else if (activeTabId == 'analytics') {
this.show = 'analysis';

View File

@ -24,13 +24,13 @@ import {UserRegistryService} from "../openaireLibrary/services/user-registry.ser
})
export class CuratorsComponent {
@Input() managers: string[];
@Input() communityId = null;
@Input() longView = true;
managers: string[];
communityId = null;
public downloadUrl = null;
public showLoading = true;
public curators: Curator[];
public curators: Curator[] = [];
public curatorsLimit: number = 5;
public numberOfCurators: number = 5;
@ -64,19 +64,45 @@ export class CuratorsComponent {
ngOnInit() {
this.showLoading = true;
this.properties = properties;
if (this.longView) {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
}
this.downloadUrl = this.properties.utilsService + '/download/';
//if (properties.environment !== 'development') {
if (!this.longView) {
if (!this.longView) {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if (community) {
this.communityId = community.communityId;
this.getCurators();
}
}));
} else {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if(community) {
this.communityId = community.communityId;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
//this.getDivContents();
this.getPageContents();
this.getCurators();
}
}));
}
}
ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
private getCurators() {
this.subs.push(this.userRegistryService.getActiveEmail('community', this.communityId).subscribe(managers => {
this.managers = managers.map(manager => manager.email);
if(this.managers.length > 0) {
let emails = this.managers.join();
this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
this.curators = curators;
@ -86,58 +112,8 @@ export class CuratorsComponent {
this.showLoading = false;
HelperFunctions.scroll();
}));
} else {
this.subs.push(this.route.queryParams.subscribe(data => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!this.communityId) {
this.communityId = data['communityId'];
}
//this.getDivContents();
this.getPageContents();
this.subs.push(this.communityService.getCommunityByState(this.properties,
this.properties.communityAPI + this.communityId).subscribe(community => {
this.managers = community.managers;
let emails = this.managers.join();
this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
this.curators = curators;
for (let i = 0; i < this.curators.length; i++) {
this.showMore[i] = false;
}
this.showLoading = false;
HelperFunctions.scroll();
}));
}));
}));
}
// } else {
// this.subs.push(this.route.queryParams.subscribe(data => {
// this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
// if (!this.communityId) {
// this.communityId = data['communityId'];
// }
// if(this.longView) {
// //this.getDivContents();
// this.getPageContents();
// }
// this.subs.push(this.userRegistryService.getManagersEmail('community', this.communityId).subscribe(managers => {
// let emails = managers.map(manager => manager.email).join();
// this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
// this.curators = curators;
// for (let i = 0; i < this.curators.length; i++) {
// this.showMore[i] = false;
// }
// this.showLoading = false;
// HelperFunctions.scroll();
// }));
// }));
// }));
// }
}
ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}));
}
private getPageContents() {

View File

@ -17,11 +17,11 @@ import {properties} from "../../environments/environment";
template: `
<deposit-first-page [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation"
[communityId]="communityId"></deposit-first-page>
`
`
})
export class OpenaireDepositComponent {
properties:EnvProperties;
properties: EnvProperties = properties;
piwikSiteId = null;
public pageContents = null;
public divContents = null;
@ -32,52 +32,39 @@ export class OpenaireDepositComponent {
subs: Subscription[] = [];
constructor ( private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
}
public ngOnInit() {
this.properties = properties;
this.subs.push(this.route.queryParams.subscribe(params => {
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!communityId) {
communityId = params['communityId'];
}
if (communityId != null && communityId != '') {
this.communityId = communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + communityId).subscribe(
community => {
let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else {
this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo";
}
},
error => {
this.handleError("Error getting community with id: " + communityId, error);
}
));
}
if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo;
}
if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
}));
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
if(community) {
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, this.properties.environment);
this.communityId = community.communityId
let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else {
this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo";
}
}
}));
if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo;
}
if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
}
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
if (sub instanceof Subscriber) {
sub.unsubscribe();
}
}
@ -85,6 +72,6 @@ export class OpenaireDepositComponent {
}
private handleError(message: string, error) {
console.error("Deposit First Page: "+message, error);
console.error("Deposit First Page: " + message, error);
}
}

View File

@ -17,13 +17,14 @@ import {properties} from "../../environments/environment";
@Component({
selector: 'openaire-search-deposit',
template: `
<deposit-search-dataproviders [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation" [communityId]="communityId"></deposit-search-dataproviders>
`
<deposit-search-dataproviders [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation"
[communityId]="communityId"></deposit-search-dataproviders>
`
})
export class OpenaireSearchDataprovidersToDepositComponent {
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
properties:EnvProperties;
properties: EnvProperties = properties;
fetchZenodoInformation: FetchZenodoInformation;
piwikSiteId = null;
@ -31,54 +32,40 @@ export class OpenaireSearchDataprovidersToDepositComponent {
subs: Subscription[] = [];
constructor ( private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
}
public ngOnInit() {
this.properties = properties;
this.subs.push(this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
if(this.communityId) {
if (this.communityId != '') {
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else {
this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo";
} },
error => {
this.handleError("Error getting community with id: "+this.communityId, error);
}
));
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
if(community) {
this.communityId = community.communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, this.properties.environment);
let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else {
this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo";
}
}
}
));
if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo;
}
if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
}));
if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo;
}
if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
}
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
if (sub instanceof Subscriber) {
sub.unsubscribe();
}
}
@ -86,6 +73,6 @@ export class OpenaireSearchDataprovidersToDepositComponent {
}
private handleError(message: string, error) {
console.error("Deposit Publications Page: "+message, error);
console.error("Deposit Publications Page: " + message, error);
}
}

View File

@ -30,7 +30,7 @@ export class ShareInZenodoComponent {
public piwikSiteId = null;
properties: EnvProperties;
properties: EnvProperties = properties;
communityId: string = null;
private community: CommunityInfo = null;
public pageContents = null;
@ -52,8 +52,8 @@ export class ShareInZenodoComponent {
errorCodes: ErrorCodes = new ErrorCodes();
depositLink = "https://zenodo.org/deposit/new?c=";
depositLearnHowPage: string = null;
public routerHelper:RouterHelper = new RouterHelper();
breadcrumbs:Breadcrumb[] = [];
public routerHelper: RouterHelper = new RouterHelper();
breadcrumbs: Breadcrumb[] = [];
subs: Subscription[] = [];
@ -65,91 +65,74 @@ export class ShareInZenodoComponent {
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
private helper: HelperService,
private _piwikService:PiwikService,
private _piwikService: PiwikService,
private seoService: SEOService) {
}
public ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.url = properties.domain + properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url, false);
this.updateUrl(this.url);
this.updateTitle(this.title);
this.updateDescription("Zenodo, repository, deposit, share");
this.properties = properties;
this.subs.push(this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.subs.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
}
this.depositLearnHowPage = this.properties.depositLearnHowPage;
this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: this.depositLearnHowPage},{name:"Deposit in zenodo",route:null});
//this.getDivContents();
this.getPageContents();
if (this.communityId && this.communityId != '') {
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
if (this.masterZenodoCommunityId) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
result => {
this.masterZenodoCommunity = result;
},
error => {
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error);
}
));
}
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
this.depositLearnHowPage = this.properties.depositLearnHowPage;
this.breadcrumbs.push({name: 'home', route: '/'}, {
name: "Deposit",
route: this.depositLearnHowPage
}, {name: "Deposit in zenodo", route: null});
//this.getDivContents();
this.getPageContents();
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
if (community) {
this.communityId = community.communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, this.properties.environment);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
}
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
if (this.masterZenodoCommunityId) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
result => {
this.communityIds = result;
this.zenodoSearchUtils.totalResults = this.communityIds.length;
if (this.communityIds.length == 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
this.getCommunities()
this.masterZenodoCommunity = result;
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
));
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error);
},
error => {
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
}
));
}
));
}
}));
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
result => {
this.communityIds = result;
this.zenodoSearchUtils.totalResults = this.communityIds.length;
if (this.communityIds.length == 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
this.getCommunities()
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
));
}
}));
}
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
if (sub instanceof Subscriber) {
sub.unsubscribe();
}
}
@ -213,10 +196,11 @@ export class ShareInZenodoComponent {
private handleError(message: string, error) {
console.error("Share in Zenodo Page: " + message, error);
}
public getCommunities($event = {value:1}) {
public getCommunities($event = {value: 1}) {
this.page = $event.value;
for (let i = (this.page - 1 ) * this.size; i < this.communityIds.length && i< this.page * this.size; i++) {
if(!this.communities[this.communityIds[i]["zenodoid"]]) {
for (let i = (this.page - 1) * this.size; i < this.communityIds.length && i < this.page * this.size; i++) {
if (!this.communities[this.communityIds[i]["zenodoid"]]) {
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]);
}
}

View File

@ -2,7 +2,6 @@ import {Component, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {UserComponent} from '../openaireLibrary/login/user.component';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {Session} from '../openaireLibrary/login/utils/helper.class';
@ -54,8 +53,7 @@ export class OpenaireUserComponent {
public server: boolean = true;
loggedIn: boolean = false;
sub;
constructor(private _subscribeService: SubscribeService,
private _emailService: EmailService, private route: ActivatedRoute) {
constructor(private _emailService: EmailService, private route: ActivatedRoute) {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {

View File

@ -3,7 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -42,6 +41,7 @@ export class MyCommunitiesComponent {
properties: EnvProperties;
private user: User;
subscriptions = [];
constructor(
private route: ActivatedRoute,
private _router: Router,
@ -49,7 +49,6 @@ export class MyCommunitiesComponent {
private _title: Title,
private _piwikService: PiwikService,
private _communitiesService: CommunitiesService,
private _subscribeService: SubscribeService,
private helper: HelperService,
private seoService: SEOService,
private userManagementService: UserManagementService) {
@ -78,7 +77,7 @@ export class MyCommunitiesComponent {
}
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if(this.user) {
if (this.user) {
this.getCommunities();
}
//this.getDivContents();
@ -117,71 +116,35 @@ export class MyCommunitiesComponent {
this.status = this.errorCodes.DONE;
return;
}
;
this.sort(communitiesResults);
var subscribedLoading = communitiesResults.length;
var mail = this.user.email;
communitiesResults.forEach((community, index) => {
let showCommunity: boolean = true;
let isManager: boolean = false;
let isSubscriber: boolean = false;
community.isManager = Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', community.communityId, this.user);
if (community['status'] == "hidden") {
showCommunity = false;
} else {
if (mail == null && community['status'] == "manager") { // no user
showCommunity = false;
} else if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user)) {
isManager = true;
} else if (community.managers.indexOf(mail) != -1) {
isManager = true;
} else if (community['status'] == "manager") {
if(!community.isManager && community['status'] == "manager") {
showCommunity = false;
}
}
if (showCommunity) {
this.researchCommunities.push(community);
if (isManager) {
community.isManager = true;
if (community.isManager) {
this.managerOfCommunities.push(community);
}
}
this.status = this.errorCodes.DONE;
if (mail != null && showCommunity) {
this.subscriptions.push(this._subscribeService.isSubscribedToCommunity(this.properties, community.communityId).subscribe(
res => {
isSubscriber = res;
if (isSubscriber) {
community.isSubscribed = true;
if (isManager) {
this.subscriberOfCommunities.push(community);
} else {
this.subscriberOfCommunities.unshift(community);
}
}
subscribedLoading--;
if (subscribedLoading == 0) {
this.loading = false;
}
},
error => {
this.handleError("Error getting response if email: " + mail + " is subscribed to community with id: " + community.communityId, error);
subscribedLoading--;
if (subscribedLoading == 0) {
this.loading = false;
}
}));
} else {
subscribedLoading--;
if (subscribedLoading == 0) {
this.loading = false;
if (this.user && showCommunity) {
community.isSubscribed = Session.isSubscribedTo('community', community.communityId, this.user);
if(community.isSubscribed) {
if (community.isManager) {
this.subscriberOfCommunities.push(community);
} else {
this.subscriberOfCommunities.unshift(community);
}
}
}
this.loading = false;
});
},
error => {

View File

@ -1,59 +1,48 @@
import {Component} from '@angular/core';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment";
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
@Component({
selector: 'openaire-search-results',
template: `
<search-research-results resultType="result" [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true"
[openaireLink]="'https://' + (properties.environment == 'production'?'':'beta.') + 'explore.openaire.eu/search/advanced/research-outcomes'"
></search-research-results>
`
selector: 'openaire-search-results',
template: `
<search-research-results resultType="result" [simpleView]="false" [customFilter]=customFilter
[piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true"
[openaireLink]="'https://' + (properties.environment == 'production'?'':'beta.') + 'explore.openaire.eu/search/advanced/research-outcomes'"
></search-research-results>
`
})
export class OpenaireSearchResearchResultsComponent {
connectCommunityId:string;
piwikSiteId = null;
customFilter: SearchCustomFilter = null;
properties:EnvProperties;
export class OpenaireSearchResearchResultsComponent implements OnInit, OnDestroy {
connectCommunityId: string;
piwikSiteId = null;
customFilter: SearchCustomFilter = null;
properties: EnvProperties = properties;
sub;
constructor(private route: ActivatedRoute, private _communityService: CommunityService) {
}
sub;
ngOnInit() {
this.setCommunity();
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.properties = properties;
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (communityId) {
this.connectCommunityId = communityId;
this.setCommunity();
} else {
this.route.queryParams.subscribe(params => {
if (params['communityId'] && params['communityId'] != "") {
this.connectCommunityId = params['communityId'];
this.setCommunity();
}
});
}
}
setCommunity(){
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.sub = this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.connectCommunityId).subscribe(community =>{
if(community != null){
this.customFilter.valueName = community.shortTitle;
setCommunity() {
this.sub = this._communityService.getCommunityAsObservable().subscribe(community => {
if (community != null) {
this.connectCommunityId = community.communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, community.shortTitle);
}
});
}

View File

@ -9,7 +9,6 @@ import {SearchFields} from "../../openaireLibrary/utils/properties/searchFields"
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
import {Session, User} from "../../openaireLibrary/login/utils/helper.class";
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {SubscribeService} from "../../openaireLibrary/utils/subscribe/subscribe.service";
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
@ -72,7 +71,6 @@ export class SearchCommunitiesComponent {
constructor(private route: ActivatedRoute,
private _communitiesService: CommunitiesService,
private _subscribeService: SubscribeService,
private userManagementService: UserManagementService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -142,17 +140,11 @@ export class SearchCommunitiesComponent {
this.totalResults[i].isSubscribed = false;
if (this.user) {
this.totalResults[i].isManager = this.isCommunityManager(this.totalResults[i]);
this.totalResults[i].isSubscribed = Session.isSubscribedTo('community', this.totalResults[i].communityId, this.user);
}
}
if (this.user) {
this.subscriptions.push(this._subscribeService.getCommunitiesSubscribedTo(this.properties/*, this.user.email*/).subscribe(
res => {
for (let i = 0; i < this.totalResults.length; i++) {
this.totalResults[i].isSubscribed = (res.indexOf(this.totalResults[i].communityId) != -1);
}
this._getResults(params);
}
));
this._getResults(params);
} else {
this._getResults(params);
}
@ -450,7 +442,7 @@ export class SearchCommunitiesComponent {
private isCommunityManager(community: CommunityInfo): boolean {
return Session.isCommunityCurator(this.user) || community.managers.indexOf(this.user.email) != -1;
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isManager('community', community.communityId, this.user);
}
/**

View File

@ -44,7 +44,7 @@ export class OpenaireSearchDataprovidersComponent {
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = [];// = this.searchFields.JOURNAL_FIELDS;
properties:EnvProperties;
properties:EnvProperties= properties;
public disableForms: boolean = false;
public enableSearchView: boolean = true;
@ -63,31 +63,26 @@ export class OpenaireSearchDataprovidersComponent {
}
public ngOnInit() {
this.properties = properties;
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = params['communityId'];
}
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subscriptions.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(community =>{
if(community != null){
this.customFilter.valueName = community.shortTitle;
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(community =>{
if(community != null) {
this.communityId = community.communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, community.shortTitle);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this.searchUtils.keyword = (params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
if(this.initialLoad) {
this.initialLoad = false;
console.log("Init get results")
this._getResults(params);
} else {
// this.searchPage.transform(this.results);
this.searchPage.goTo(1);
console.log("Init transfrm " + this.searchUtils.keyword)
}
}
}));
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this.searchUtils.keyword = (params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
if(this.initialLoad) {
this.initialLoad = false;
console.log("Init get results")
this._getResults(params);
}else{
// this.searchPage.transform(this.results);
this.searchPage.goTo(1);
console.log("Init transfrm " + this.searchUtils.keyword)
}
}));
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
@ -7,38 +7,37 @@ import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment";
@Component({
selector: 'openaire-search-organizations',
template: `
selector: 'openaire-search-organizations',
template: `
<search-organizations>
</search-organizations>
`
`
})
export class OpenaireSearchOrganizationsComponent {
export class OpenaireSearchOrganizationsComponent implements OnInit, OnDestroy {
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
}
sub;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (communityId) {
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
} else {
this.sub = this.route.queryParams.subscribe(params => {
if (params['communityId'] && params['communityId'] != "") {
communityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
}
});
}
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if(communityId){
this.piwikSiteId = PiwikHelper.getSiteId(communityId,properties.environment);
}else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
communityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(communityId,properties.environment);
}
});
}
}
}

View File

@ -48,7 +48,7 @@ export class OpenaireSearchProjectsComponent {
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = [];// = this.searchFields.JOURNAL_FIELDS;
properties:EnvProperties;
properties:EnvProperties = properties;
public disableForms: boolean = false;
public enableSearchView: boolean = true;
@ -66,28 +66,21 @@ export class OpenaireSearchProjectsComponent {
}
public ngOnInit() {
this.properties = properties;
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = params['communityId'];
}
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subscriptions.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(community =>{
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(community =>{
if(community != null){
this.customFilter.valueName = community.shortTitle;
this.communityId = community.communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, community.shortTitle);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this.searchUtils.keyword = (params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
if(this.initialLoad) {
this.initialLoad = false;
this._getResults(params);
}else{
this.searchPage.goTo(1);
}
}
}));
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this.searchUtils.keyword = (params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
if(this.initialLoad) {
this.initialLoad = false;
this._getResults(params);
}else{
this.searchPage.goTo(1);
}
}));
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import {ActivatedRoute} from "@angular/router";
@ -18,44 +18,33 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
`
})
export class OpenaireSearchResearchResultsComponent {
export class OpenaireSearchResearchResultsComponent implements OnInit, OnDestroy {
connectCommunityId: string;
piwikSiteId = null;
customFilter: SearchCustomFilter = null;
properties:EnvProperties;
properties:EnvProperties = properties;
sub;
constructor(private route: ActivatedRoute, private _communityService: CommunityService) {
}
sub;
ngOnInit() {
this.setCommunity();
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.properties = properties;
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (communityId) {
this.connectCommunityId = communityId;
this.setCommunity();
} else {
this.route.queryParams.subscribe(params => {
if (params['communityId'] && params['communityId'] != "") {
this.connectCommunityId = params['communityId'];
this.setCommunity();
}
});
}
}
setCommunity(){
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.sub = this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.connectCommunityId).subscribe(community =>{
this.sub = this._communityService.getCommunityAsObservable().subscribe(community =>{
if(community != null){
this.customFilter.valueName = community.shortTitle;
this.connectCommunityId = community.communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, community.shortTitle);
}
});
}

View File

@ -29,7 +29,7 @@ import {properties} from "../../environments/environment";
export class StatisticsComponent {
public pageTitle = "OpenAIRE";
properties: EnvProperties;
properties: EnvProperties = properties;
@Input() communityId = null;
@Input() currentMode = 'showInMonitor';
communityInfo: any = null;
@ -86,32 +86,22 @@ export class StatisticsComponent {
this._meta.updateTag({content: description}, "property='og:description'");
this._meta.updateTag({content: title}, "property='og:title'");
}
this.properties = properties;
var url = properties.domain + properties.baseLink + this._router.url;
this._meta.updateTag({content: url}, "property='og:url'");
this.subs.push(this.route.queryParams.subscribe(
communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = communityId['communityId'];
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe());
if(community) {
this.communityId = community.communityId;
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe());
}
this.communityName = community.shortTitle;
this.createChartUrlMap();
this.createStatisticsObjects();
}
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
this.communityName = community.shortTitle;
this.createChartUrlMap();
this.createStatisticsObjects();
}));
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
}));
}
@ -133,13 +123,13 @@ export class StatisticsComponent {
this.status = this.errorCodes.LOADING;
this.subs.push(this._statisticsService.getCommunityStatistics(this.properties, this.communityId).subscribe(
res => {
if(res) {
if (res) {
this.statisticsSum = res;
if (res["other"]) { //hack because in stats API the entity name is "other" while in admin API is "orp". This component uses also "orp" name
this.statisticsSum["orp"] = res["other"];
}
this.getDisplayOptions();
}else{
} else {
console.error("Error getting community statistics for community with id: " + this.communityId);
this.status = this.errorCodes.ERROR;
}

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ActivatedRoute, Router} from "@angular/router";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
@ -18,52 +18,47 @@ import {Subscriber, Subscription} from "rxjs";
selector: 'subjects',
template: `
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
<div style=" min-height: 650px;" class="">
<div class="uk-section uk-padding-remove-top uk-padding-remove-bottom">
<breadcrumbs addClass="uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top" [breadcrumbs]="breadcrumbs"></breadcrumbs>
<!-- <div *ngIf="communityId != null && communityId != ''" -->
<!-- class="uk-container uk-container-large uk-margin-top white-box-with-border">-->
<breadcrumbs addClass="uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top"
[breadcrumbs]="breadcrumbs"></breadcrumbs>
<div class="uk-container uk-container-large">
<div *ngIf="showLoading">
<div class="uk-animation-fade uk-width-1-1" role="alert"><span
class="loading-gif uk-align-center"></span></div>
</div>
<div *ngIf="!showLoading">
<h4 class="uk-margin-bottom uk-margin-medium-top">
<span>Subjects</span>
</h4>
<div class="uk-container uk-container-large">
<div *ngIf="showLoading">
<div class="uk-animation-fade uk-width-1-1" role="alert"><span
class="loading-gif uk-align-center"></span></div>
</div>
<div *ngIf="!showLoading">
<h4 class="uk-margin-bottom uk-margin-medium-top">
<span>Subjects</span>
</h4>
<div style=" min-height: 250px;" class="white-box-with-border uk-padding uk-list">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<div style=" min-height: 250px;" class="white-box-with-border uk-padding uk-list">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<span *ngFor="let subject of subjects let i=index">
<span *ngFor="let subject of subjects let i=index">
<span *ngIf="subject != ''">
<a class="portal-link"
[queryParams]="{f0:'resultsubject',fv0:createParams(subject)}"
routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults" >
routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults">
<span>{{subject}}</span>
</a>
<span *ngIf="i < subjects.length-1">, </span>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
`
})
export class SubjectsComponent {
public subjects: string[];
@Input() communityId = null;
public communityId = null;
public showLoading = true;
public properties: EnvProperties;
public properties: EnvProperties = properties;
public pageContents = null;
public divContents = null;
@ -74,45 +69,36 @@ export class SubjectsComponent {
subs: Subscription[] = [];
constructor (private route: ActivatedRoute,
private communityService: CommunityService,
private _router: Router,
private helper: HelperService,
private _meta: Meta,
private _title: Title,
private seoService: SEOService,
private _piwikService: PiwikService) {}
constructor(private route: ActivatedRoute,
private communityService: CommunityService,
private _router: Router,
private helper: HelperService,
private _meta: Meta,
private _title: Title,
private seoService: SEOService,
private _piwikService: PiwikService) {
}
ngOnInit() {
this.showLoading = true;
this.properties = properties;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
this.subs.push(this.route.queryParams.subscribe(data => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = data['communityId'];
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if (community) {
this.communityId = community.communityId;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
//this.getDivContents();
this.getPageContents();
this.subs.push(this.communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(community => {
this.subjects = community.subjects;
this.showLoading = false;
HelperFunctions.scroll();
},
error => {
console.error("Subjects Component: Error getting subjects for community with id: " + this.communityId, error);
this.showLoading = false;
} ));
}));
this.subjects = community.subjects;
this.showLoading = false;
HelperFunctions.scroll();
}
}));
}
createParams(param) {

View File

@ -104,7 +104,7 @@ export class CustomizationComponent {
}
}
private buildCss() {
/*private buildCss() {
if(typeof document === 'undefined') {
return;
}
@ -182,7 +182,7 @@ export class CustomizationComponent {
css = css.concat(' border-radius: ' + (this.layout.box.borderRadius != null ? this.layout.box.borderRadius : '6') + 'px;');
css = css.concat(' }');
/*Panel Elements & cards*/
/!*Panel Elements & cards*!/
css = css.concat(' .communityPanelBackground .uk-card:not(.ignoreCommunityPanelBackground), .communityPanelBackground .uk-label:not(.ignoreCommunityPanelBackground) {');
css = css.concat(' background-color: ' + (this.layout.panel.panelElements.backgroundColor != null ? this.layout.panel.panelElements.backgroundColor : 'rgba(255, 255, 255, 0.5)') + ';');
css = css.concat( 'border-color: ' + (this.layout.panel.panelElements.borderColor != null ? this.layout.panel.panelElements.borderColor : 'rgba(255, 255, 255, 0.5)') + ';');
@ -222,7 +222,7 @@ export class CustomizationComponent {
css = css.concat(' color: '+ (this.layout.buttons.lightBackground.onHover.color != null ? this.layout.buttons.lightBackground.onHover.color : 'white') + ';');
css = css.concat(' border-color: ' + (this.layout.buttons.lightBackground.onHover.color != null ? this.layout.buttons.lightBackground.onHover.color : 'transparent') + ';');
css = css.concat(' }');
/*Buttons*/
/!*Buttons*!/
css = css.concat(' .communityPanelBackground .uk-button:not(.ignoreCommunityPanelBackground) {');
css = css.concat( 'background-color: ' +
(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)') )
@ -264,7 +264,7 @@ export class CustomizationComponent {
background-color: white;
color: #666;
box-shadow: 0 5px 12px rgba(0, 0, 0, .15);
/*border:var(--portal-main-color) 1px solid;*/
/!*border:var(--portal-main-color) 1px solid;*!/
}
.customTabs .uk-tab > .uk-active > a {
@ -284,5 +284,5 @@ export class CustomizationComponent {
css = css.concat(css1);
console.log(css);
appendCss(css);
}
}*/
}

View File

@ -147,7 +147,7 @@ export class InviteComponent implements OnInit {
if (this.communityId != null && this.communityId != '') {
//this.getDivContents();
this.getPageContents();
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
this.fullname = (this.user) ? this.user.fullname : null;

View File

@ -4,9 +4,8 @@ import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properti
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
import {User} from '../../openaireLibrary/login/utils/helper.class';
import {Session, User} from '../../openaireLibrary/login/utils/helper.class';
import {Email} from "../../openaireLibrary/utils/email/email";
import {Composer} from "../../openaireLibrary/utils/email/composer";
@ -15,20 +14,22 @@ import {UserManagementService} from "../../openaireLibrary/services/user-managem
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../../environments/environment";
import {UserRegistryService} from "../../openaireLibrary/services/user-registry.service";
import {SubscribeService} from "../../openaireLibrary/utils/subscribe/subscribe.service";
declare var UIkit: any;
@Component({
selector: 'subscribe',
template: `
<span *ngIf="subscribed != null && !showNumbers && showTemplate">
<div *ngIf="!subscribed && showLoginAlert" class="uk-alert-warning uk-animation-slide-bottom" uk-alert="">
<a class="uk-alert-close" uk-close></a>
<p>Please login first to subscribe</p>
</div>
<button *ngIf="!subscribed"
[class]="'uk-button portal-button uk-button-small uk-width-1-1 ' + (loading ? ' uk-disabled' : '')"
<button *ngIf="loading" class="uk-button portal-button-reverse uk-button-small uk-width-1-1">
<span class="uk-icon"><loading [top_margin]="false" [size]="'small'" [color]="null"></loading></span>
</button>
<button *ngIf="!subscribed && !loading" class="uk-button portal-button uk-button-small uk-width-1-1"
(click)="subscribe()">
<span class="uk-icon uk-flex uk-flex-middle">
<svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@ -39,8 +40,7 @@ declare var UIkit: any;
<span class="space">Subscribe</span>
</span>
</button>
<button *ngIf="subscribed"
[class]="'subscribed-button uk-button uk-button-small uk-width-1-1 ' + (loading ? ' uk-disabled' : '')"
<button *ngIf="subscribed && !loading" class="subscribed-button uk-button uk-button-small uk-width-1-1"
(click)="confirmOpen()">
<span class="uk-icon uk-flex uk-flex-middle">
<svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@ -52,15 +52,13 @@ declare var UIkit: any;
</span>
</button>
</span>
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0 && showTemplate" class="uk-display-inline-block">
<span class="lowOpacityColor uk-text-muted">Members: </span> {{subscribers}}
<span *ngIf="showNumbers && members > 0 && showTemplate" class="uk-display-inline-block">
<span class="lowOpacityColor uk-text-muted">Members: </span> {{members}}
</span>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`
})
export class SubscribeComponent {
// @Input() showSubscribe:boolean = true;
@Input() showNumbers: boolean;
@ -73,8 +71,8 @@ export class SubscribeComponent {
loading: boolean = false;
subscribed: boolean = null;
@Input() properties: EnvProperties;
subscribers: number = null;
@Input() properties: EnvProperties = properties;
members: number = 0;
@Output() countSubscribersEvent = new EventEmitter();
showLoginAlert: Boolean = false;
@ViewChild(AlertModal) alert;
@ -83,19 +81,24 @@ export class SubscribeComponent {
subs: Subscription[] = [];
constructor(private route: ActivatedRoute,
private _subscribeService: SubscribeService,
private _emailService: EmailService,
private _communityService: CommunityService,
private router: Router,
private subscribeService: SubscribeService,
private userManagementService: UserManagementService,
private userRegistryService: UserRegistryService
) {
private userRegistryService: UserRegistryService) {
}
public ngOnInit() {
if (!this.properties) {
this.properties = properties;
}
this.subs.push(this.subscribeService.getLoading().subscribe(loading => {
this.loading = loading;
}));
this.subs.push(this.subscribeService.getMembers().subscribe(members => {
this.members = members;
this.countSubscribersEvent.emit({
value: this.members
});
}));
if (!this.showNumbers) {
this.subs.push(this.userManagementService.getUserInfo().subscribe(
user => {
@ -106,7 +109,6 @@ export class SubscribeComponent {
} else {
this.init();
}
//this.init();
}
public ngOnDestroy() {
@ -118,25 +120,7 @@ export class SubscribeComponent {
}
private isSubscribed() {
// this.subscribed = Session.isSubscribedTo('community', this.communityId, this.user);
// if (!this.subscribed) {
this.subs.push(this._subscribeService.isSubscribed.subscribe(
res => {
this.subscribed = res;
if (this.subscribed) {
this.subscribeEvent.emit({
value: "ok"
});
}
}
));
// } else {
// if (this.subscribed) {
// this.subscribeEvent.emit({
// value: "ok"
// });
// }
// }
this.subscribed = Session.isSubscribedTo('community', this.communityId, this.user);
}
private init() {
@ -146,40 +130,24 @@ export class SubscribeComponent {
this.subscribed = false;
} else {
if (this.communityId) {
this._subscribeService.initIsSubscribedToCommunity(this.properties, this.communityId);
this.isSubscribed();
}
}
} else {
if (this.communityId) {
//if (properties.environment !== 'development') {
this.subs.push(this._subscribeService.getNumberOfCommunitySubscribers(this.properties, this.communityId).subscribe(
res => {
this.subscribers = (res && res.value) ? res.value : 0;//(res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0;
this.countSubscribersEvent.emit({
value: this.subscribers
});
},
error => {
this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
}));
// } else {
// this.subs.push(this.userRegistryService.getSubscribersCount('community', this.communityId).subscribe(res => {
// this.subscribers = (res && res.response) ? res.response : 0;
// this.countSubscribersEvent.emit({
// value: this.subscribers
// });
// },
// error => {
// this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
// }));
// }
this.subscribeService.setLoading(true);
this.subs.push(this.userRegistryService.getMembersCount('community', this.communityId).subscribe(res => {
this.subscribeService.setMembers((res && res.response) ? res.response : 0);
this.subscribeService.setLoading(false);
},
error => {
this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
}));
}
}
if (this.communityId) {
this.emailToInformManagers = {body: "", subject: "", recipients: []};
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
},
@ -211,8 +179,7 @@ export class SubscribeComponent {
}
subscribe() {
var email = (this.user) ? this.user.email : null;
if (email == null) {
if (!this.user) {
this.subscribed = false;
// this.showLoginAlert = true;
this.router.navigate(['/user-info'], {
@ -222,56 +189,24 @@ export class SubscribeComponent {
}
});
} else {
this.loading = true;
// this.showLoginAlert = false;
// if(properties.environment === 'development') {
// this.subs.push(this.userRegistryService.subscribeTo('community', this.communityId).subscribe(res => {
// this.userManagementService.updateUserInfo();
// this.loading = false;
// this.successfulSubscribe(email);
// },error => {
// this.loading = false;
// UIkit.notification({
// message: '<strong>An error occurred. Please try again!<strong>',
// status: 'warning',
// timeout: 3000,
// pos: 'top-center'
// });
// //console.log(error)
// this.handleError("Error subscribing email: " + email + " from community with id: " + this.communityId, error);
// }));
// }
this.subs.push(this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
res => {
this.loading = false;
if (res.status && res.status != 200) {
this.subscribeEvent.emit({
value: "error"
});
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
} else {
this.successfulSubscribe(email);
}
},
error => {
this.loading = false;
this.subscribeEvent.emit({
value: "error"
});
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
//console.log(error)
this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error);
}));
this.subscribeService.setLoading(true);
this.showLoginAlert = false;
this.subs.push(this.userRegistryService.subscribeTo('community', this.communityId).subscribe(res => {
this.userManagementService.updateUserInfo();
this.subscribeService.setMembers(this.members + 1);
this.subscribeService.setLoading(false);
this.successfulSubscribe(this.user.email);
}, error => {
this.subscribeService.setLoading(false);
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
//console.log(error)
this.handleError("Error subscribing email: " + this.user.email + " from community with id: " + this.communityId, error);
}));
}
}
@ -280,52 +215,23 @@ export class SubscribeComponent {
if (email == null) {
this.subscribed = false;
} else {
this.loading = true;
// if(properties.environment === 'development') {
// this.subs.push(this.userRegistryService.unsubscribeFrom('community', this.communityId).subscribe(res => {
// this.userManagementService.updateUserInfo();
// this.loading = false;
// this.subscribed = false;
// },error => {
// this.loading = false;
// UIkit.notification({
// message: '<strong>An error occurred. Please try again!<strong>',
// status: 'warning',
// timeout: 3000,
// pos: 'top-center'
// });
// //console.log(error)
// this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
// }));
// }
this.subs.push(this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
res => {
this.loading = false;
if (res.status && res.status != 200) {
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
} else {
//console.log(res);
if (this.subscribed) {
this.subscribed = false;
}
}
},
error => {
this.loading = false;
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
//console.log(error)
this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
}));
this.subscribeService.setLoading(true);
this.subs.push(this.userRegistryService.unsubscribeFrom('community', this.communityId).subscribe(res => {
this.userManagementService.updateUserInfo();
this.subscribeService.setMembers(this.members - 1);
this.subscribeService.setLoading(false);
this.subscribed = false;
}, error => {
this.subscribeService.setLoading(false);
UIkit.notification({
message: '<strong>An error occurred. Please try again!<strong>',
status: 'warning',
timeout: 3000,
pos: 'top-center'
});
//console.log(error)
this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
}));
}
}

View File

@ -5,10 +5,11 @@ import {RouterModule} from '@angular/router';
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
import {SubscribeComponent} from './subscribe.component';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
@NgModule({
imports: [
CommonModule, RouterModule, AlertModalModule
CommonModule, RouterModule, AlertModalModule, LoadingModule
],
declarations: [
SubscribeComponent

View File

@ -1,15 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {VerificationGuard} from "../openaireLibrary/login/verification.guard";
import {VerificationManagerComponent} from "./verification-manager.component";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: VerificationManagerComponent, canActivate: [VerificationGuard], canDeactivate: [PreviousRouteRecorder]}
])
]
})
export class VerificationManagerRoutingModule {
}

View File

@ -1,61 +0,0 @@
import {Component, OnDestroy, OnInit} from "@angular/core";
import {UserRegistryService} from "../openaireLibrary/services/user-registry.service";
import {ActivatedRoute} from "@angular/router";
import {Subscriber, Subscription} from "rxjs";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {properties} from "../../environments/environment";
@Component({
selector: 'verification-manager',
template: `
<div class="uk-section uk-container">
<div class="uk-card uk-card-default uk-card-body">
<div *ngIf="loading" class="loading-gif"></div>
<div *ngIf="!loading && invitation">
<verification [name]="name" [invitation]="invitation"></verification>
</div>
</div>
</div>
`
})
export class VerificationManagerComponent implements OnInit, OnDestroy {
private subscriptions: any[] = [];
public loading = true;
public invitation;
public name;
constructor(private userRegistryService: UserRegistryService,
private communityService: CommunityService,
private route: ActivatedRoute) {
}
ngOnInit() {
this.subscriptions.push(this.route.params.subscribe(params => {
if (params && params['id']) {
this.subscriptions.push(this.userRegistryService.getInvitation(params['id']).subscribe(invitation => {
this.invitation = invitation;
this.subscriptions.push(this.communityService.
getCommunityByState(properties, properties.communityAPI + invitation.entity).subscribe(community => {
this.name = community.title;
this.loading = false;
}));
}, error => {
this.loading = false;
console.error(error);
}));
}
}));
}
ngOnDestroy() {
this.subscriptions.forEach(sub => {
if (sub instanceof Subscription) {
if (sub instanceof Subscriber) {
sub.unsubscribe();
}
}
});
}
}

View File

@ -1,14 +0,0 @@
import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {VerificationManagerComponent} from "./verification-manager.component";
import {VerificationModule} from "../openaireLibrary/verification/verification.module";
import {VerificationGuard} from "../openaireLibrary/login/verification.guard";
import {VerificationManagerRoutingModule} from "./verification-manager-routing.module";
@NgModule({
imports: [CommonModule, VerificationModule, VerificationManagerRoutingModule],
declarations: [VerificationManagerComponent],
exports: [VerificationManagerComponent],
providers: [VerificationGuard]
})
export class VerificationManagerModule {}