[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:
parent
25e8dde7d5
commit
57cd810c3e
|
@ -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]},
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -134,6 +137,11 @@ export class AppComponent {
|
|||
},error => this.init()));
|
||||
|
||||
}
|
||||
|
||||
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 = "";
|
||||
|
@ -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}});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,15 +23,16 @@ 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({
|
||||
|
||||
|
||||
imports: [
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -38,68 +38,68 @@ export class CommunityComponent {
|
|||
|
||||
public projectTotal = null;
|
||||
public contentProviderTotal = null;
|
||||
|
||||
|
||||
public projectsCalculated: boolean = false;
|
||||
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)
|
||||
private reloadPublications: boolean = true;
|
||||
private reloadDatasets: boolean = true;
|
||||
private reloadSoftware: boolean = true;
|
||||
private reloadOrps: boolean = true;
|
||||
|
||||
|
||||
// Variables for publications, research data, projects, content providers, related content providers tabs
|
||||
public fetchPublications: FetchResearchResults;
|
||||
public fetchDatasets: FetchResearchResults;
|
||||
public fetchSoftware: FetchResearchResults;
|
||||
public fetchOrps: FetchResearchResults;
|
||||
public searchNumber: number = 5;
|
||||
|
||||
|
||||
@Input() communityId = null;
|
||||
public community = null;
|
||||
|
||||
|
||||
public communityInfo = null;
|
||||
|
||||
|
||||
public showLoading: boolean = true;
|
||||
masterZenodoCommunity = null;
|
||||
zenodoCommunityIdS = [];
|
||||
showAllDescription = false;
|
||||
public thresholdDescription: number = 500;
|
||||
public descriptionDiff: number = 100;
|
||||
|
||||
|
||||
subscribers: number = 0;
|
||||
|
||||
|
||||
// TODO Unsubscribe
|
||||
subs: Subscription[] = [];
|
||||
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
searchLinkToProjects: string = null;
|
||||
searchLinkToDataProviders: string = null;
|
||||
searchLinkToAdvancedResults: string = null;
|
||||
shareInZenodoPage: string = null;
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
private user: User;
|
||||
|
||||
|
||||
@ViewChild(SubscribeComponent) subscribeComponent: SubscribeComponent = null;
|
||||
//Search Form
|
||||
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,
|
||||
private route: ActivatedRoute,
|
||||
|
@ -117,45 +117,44 @@ export class CommunityComponent {
|
|||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private seoService: SEOService,
|
||||
private userManagementService: UserManagementService) {
|
||||
|
||||
|
||||
var description = "OpenAIRE - Connect, Community Dashboard, research community";
|
||||
var title = "OpenAIRE - Connect";
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
this._title.setTitle(title);
|
||||
|
||||
|
||||
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
if (this.properties.environment == "development") {
|
||||
this.params = {communityId: community.communityId};
|
||||
}
|
||||
|
@ -184,54 +183,52 @@ 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) {
|
||||
this.setActiveTab("publication");
|
||||
|
||||
|
||||
if (this.reloadPublications &&
|
||||
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
|
||||
(this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0)
|
||||
|
@ -241,10 +238,10 @@ export class CommunityComponent {
|
|||
}
|
||||
this.reloadPublications = false;
|
||||
}
|
||||
|
||||
|
||||
private searchDatasets(page: number, size: number) {
|
||||
this.setActiveTab("dataset");
|
||||
|
||||
|
||||
if (this.reloadDatasets &&
|
||||
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
||||
(this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0)
|
||||
|
@ -254,10 +251,10 @@ export class CommunityComponent {
|
|||
}
|
||||
this.reloadDatasets = false;
|
||||
}
|
||||
|
||||
|
||||
private searchSoftware(page: number, size: number) {
|
||||
this.setActiveTab("software");
|
||||
|
||||
|
||||
if (this.reloadSoftware &&
|
||||
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
||||
(this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0)
|
||||
|
@ -267,10 +264,10 @@ export class CommunityComponent {
|
|||
}
|
||||
this.reloadSoftware = false;
|
||||
}
|
||||
|
||||
|
||||
private searchOrps(page: number, size: number) {
|
||||
this.setActiveTab("other");
|
||||
|
||||
|
||||
if (this.reloadOrps &&
|
||||
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
|
||||
(this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0)
|
||||
|
@ -280,10 +277,10 @@ export class CommunityComponent {
|
|||
}
|
||||
this.reloadOrps = false;
|
||||
}
|
||||
|
||||
|
||||
private countResearchResults(resultType: string) {
|
||||
let fetch: FetchResearchResults;
|
||||
|
||||
|
||||
if (resultType == "publication") {
|
||||
fetch = this.fetchPublications;
|
||||
} else if (resultType == "dataset") {
|
||||
|
@ -293,7 +290,7 @@ export class CommunityComponent {
|
|||
} else if (resultType == "other") {
|
||||
fetch = this.fetchOrps;
|
||||
}
|
||||
|
||||
|
||||
fetch.getNumForCommunity(resultType, this.communityId, this.properties);
|
||||
}
|
||||
|
||||
|
@ -306,19 +303,19 @@ export class CommunityComponent {
|
|||
this.fetchOrps.clearSubscriptions();
|
||||
this.fetchSoftware.clearSubscriptions();
|
||||
}
|
||||
|
||||
|
||||
isEntityEnabled(entity: string) {
|
||||
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
|
||||
}
|
||||
|
||||
|
||||
isRouteEnabled(route: string) {
|
||||
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
|
||||
}
|
||||
|
||||
|
||||
showInvite() {
|
||||
return this.isManager();
|
||||
}
|
||||
|
||||
|
||||
isManager() {
|
||||
if (!this.user) {
|
||||
return false;
|
||||
|
@ -330,11 +327,11 @@ export class CommunityComponent {
|
|||
}
|
||||
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
|
||||
}
|
||||
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Community (component): " + message, error);
|
||||
}
|
||||
|
||||
|
||||
getSearchPlaceHolder() {
|
||||
var entities = [];
|
||||
if (this.isEntityEnabled("publication")) {
|
||||
|
@ -351,7 +348,7 @@ export class CommunityComponent {
|
|||
}
|
||||
return "Search" + ((entities.length > 0) ? (" for " + entities.join(', ') + "...") : "");
|
||||
}
|
||||
|
||||
|
||||
countOtherGraphs() {
|
||||
var count = 0;
|
||||
if (this.statistics && this.statistics.allowedEntities) {
|
||||
|
@ -363,11 +360,11 @@ export class CommunityComponent {
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
createParams(param) {
|
||||
return StringUtils.quote(StringUtils.URIEncode(param));
|
||||
}
|
||||
|
||||
|
||||
private setActiveTab(entityType: string) {
|
||||
if (entityType == "other") {
|
||||
this.activeTab = "orp";
|
||||
|
@ -375,15 +372,15 @@ export class CommunityComponent {
|
|||
this.activeTab = entityType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public getParamsForSearchLink(type: string = "") {
|
||||
if(type) {
|
||||
if (type) {
|
||||
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
||||
if (entityType == "publication") {
|
||||
return "publication" + (plural ? "s" : "");
|
||||
|
@ -395,56 +392,56 @@ export class CommunityComponent {
|
|||
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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>";
|
||||
}
|
||||
|
||||
|
||||
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
|
||||
tooltipContent += "</div>";
|
||||
|
||||
|
||||
return tooltipContent;
|
||||
}
|
||||
|
||||
|
||||
public buildZenodoCommunitiesTooltip(): string {
|
||||
let tooltipContent: string = "<div class='uk-margin'>";
|
||||
|
||||
|
||||
tooltipContent += "<span class='uk-text-bold'>Zenodo</span> is a catch-all repository for OpenAIRE.";
|
||||
tooltipContent += "<div class='uk-margin-small-top'>A <span class='uk-text-bold'>Zenodo Community</span> is created and curated by Zenodo users.</div>";
|
||||
tooltipContent += "</div>";
|
||||
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");
|
||||
|
@ -452,11 +449,11 @@ export class CommunityComponent {
|
|||
}
|
||||
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
|
||||
}
|
||||
|
||||
public countSubscribersEvent($event){
|
||||
|
||||
public countSubscribersEvent($event) {
|
||||
this.subscribers = $event.value;
|
||||
}
|
||||
|
||||
|
||||
public checkStatistics(type: string) {
|
||||
return !!(this.isEntityEnabled(type)
|
||||
&& this.statistics && this.statistics.statisticsDisplay && this.statistics.statisticsDisplay.isActive
|
||||
|
@ -472,28 +469,28 @@ export class CommunityComponent {
|
|||
&& this.statistics.allowedChartsMode['showInMonitor'][type]
|
||||
&& this.statistics.allowedChartsMode['showInMonitor'][type].length > 0)));
|
||||
}
|
||||
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public showAnalyticsTab() {
|
||||
this.initializeAnalyticsActiveTab();
|
||||
return this.analyticsActiveTab;
|
||||
}
|
||||
|
||||
|
||||
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';
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -14,77 +14,64 @@ import {properties} from "../../environments/environment";
|
|||
|
||||
@Component({
|
||||
selector: 'openaire-deposit',
|
||||
template: `
|
||||
<deposit-first-page [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation"
|
||||
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;
|
||||
public communityId = null;
|
||||
|
||||
|
||||
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||
fetchZenodoInformation: FetchZenodoInformation;
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
this.fetchZenodoInformation.clearSubscriptions();
|
||||
}
|
||||
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Deposit First Page: "+message, error);
|
||||
console.error("Deposit First Page: " + message, error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,75 +17,62 @@ 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;
|
||||
communityId: string = null;
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
this.fetchZenodoInformation.clearSubscriptions();
|
||||
}
|
||||
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Deposit Publications Page: "+message, error);
|
||||
console.error("Deposit Publications Page: " + message, error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,22 +27,22 @@ import {Subscriber, Subscription} from "rxjs";
|
|||
export class ShareInZenodoComponent {
|
||||
public url: string = null;
|
||||
public title: string = "Share in Zenodo";
|
||||
|
||||
|
||||
public piwikSiteId = null;
|
||||
|
||||
properties: EnvProperties;
|
||||
|
||||
properties: EnvProperties = properties;
|
||||
communityId: string = null;
|
||||
private community: CommunityInfo = null;
|
||||
public pageContents = null;
|
||||
public divContents = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// public warningMessage = "";
|
||||
// public infoMessage = "";
|
||||
|
||||
|
||||
masterZenodoCommunityId = null;
|
||||
masterZenodoCommunity = null;
|
||||
|
||||
|
||||
communityIds = null;
|
||||
communities = [];
|
||||
page = 1;
|
||||
|
@ -52,11 +52,11 @@ 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[] = [];
|
||||
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private _meta: Meta,
|
||||
|
@ -65,123 +65,106 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private updateDescription(description: string) {
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
}
|
||||
|
||||
|
||||
private updateTitle(title: string) {
|
||||
var _title = ((title.length > 50) ? title.substring(0, 50) : title);
|
||||
this._title.setTitle(_title);
|
||||
this._meta.updateTag({content: _title}, "property='og:title'");
|
||||
}
|
||||
|
||||
|
||||
private updateUrl(url: string) {
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
}
|
||||
|
||||
|
||||
private getPageContents() {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private getDivContents() {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
getZenodoCommunityById(zenodoid, openaireId) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
||||
result => {
|
||||
|
@ -190,8 +173,8 @@ export class ShareInZenodoComponent {
|
|||
if (this.zenodoCommunitiesLoadedCount >= this.communityIds.length || this.page * this.size) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
error => {
|
||||
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||
|
@ -205,21 +188,22 @@ export class ShareInZenodoComponent {
|
|||
}
|
||||
//console.error("Zenodo community'"+zenodoid+"' couldn't be loaded");
|
||||
this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error);
|
||||
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
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"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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';
|
||||
|
@ -38,10 +37,11 @@ export class MyCommunitiesComponent {
|
|||
public errorCodes: ErrorCodes;
|
||||
private errorMessages: ErrorMessagesComponent;
|
||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'my Communities'}];
|
||||
|
||||
|
||||
properties: EnvProperties;
|
||||
private user: User;
|
||||
subscriptions = [];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -49,25 +49,24 @@ export class MyCommunitiesComponent {
|
|||
private _title: Title,
|
||||
private _piwikService: PiwikService,
|
||||
private _communitiesService: CommunitiesService,
|
||||
private _subscribeService: SubscribeService,
|
||||
private helper: HelperService,
|
||||
private seoService: SEOService,
|
||||
private userManagementService: UserManagementService) {
|
||||
|
||||
|
||||
var description = "OpenAIRE - Connect, Community Dashboard, research community " +
|
||||
"| My managing and subscribed to Communities";
|
||||
var title = "OpenAIRE - Connect | My Communities";
|
||||
|
||||
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
this._title.setTitle(title);
|
||||
|
||||
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.errorMessages = new ErrorMessagesComponent();
|
||||
this.status = this.errorCodes.LOADING;
|
||||
}
|
||||
|
||||
|
||||
public ngOnInit() {
|
||||
this.properties = properties;
|
||||
var url = this.properties.domain + this.properties.baseLink + this._router.url;
|
||||
|
@ -78,36 +77,36 @@ export class MyCommunitiesComponent {
|
|||
}
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
if(this.user) {
|
||||
if (this.user) {
|
||||
this.getCommunities();
|
||||
}
|
||||
//this.getDivContents();
|
||||
//this.getPageContents();
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private getPageContents() {
|
||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private getDivContents() {
|
||||
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
public getCommunities() {
|
||||
this.loading = true;
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.subscriberErrorMessage = "";
|
||||
|
||||
|
||||
this.subscriberOfCommunities = [];
|
||||
this.managerOfCommunities = [];
|
||||
this.researchCommunities = [];
|
||||
|
||||
|
||||
this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
|
||||
communitiesResults => {
|
||||
if (!communitiesResults) {
|
||||
|
@ -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 => {
|
||||
|
@ -190,7 +153,7 @@ export class MyCommunitiesComponent {
|
|||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
private sort(results: CommunityInfo[]) {
|
||||
results.sort((left, right): number => {
|
||||
if (!right.date || left.date > right.date) {
|
||||
|
@ -208,11 +171,11 @@ export class MyCommunitiesComponent {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
public quote(param: string): string {
|
||||
return StringUtils.quote(param);
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
|
@ -220,7 +183,7 @@ export class MyCommunitiesComponent {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private handleError(message: string, error): number {
|
||||
var code = "";
|
||||
if (!error.status) {
|
||||
|
@ -228,9 +191,9 @@ export class MyCommunitiesComponent {
|
|||
} else {
|
||||
code = error.status;
|
||||
}
|
||||
|
||||
|
||||
console.error("Communities (component): " + message, error);
|
||||
|
||||
|
||||
return this.errorMessages.getErrorCode(code);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
@ -84,7 +82,7 @@ export class SearchCommunitiesComponent {
|
|||
this.properties = properties;
|
||||
this.piwikSiteId = this.properties.piwikSiteId;
|
||||
this.baseUrl = this.properties.searchLinkToCommunities;
|
||||
|
||||
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||
this.searchPage.resultsPerPage = 10;
|
||||
this.keyword = (params['fv0'] ? params['fv0'] : '');
|
||||
|
@ -116,7 +114,7 @@ export class SearchCommunitiesComponent {
|
|||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -42,12 +42,12 @@ export class StatisticsComponent {
|
|||
//allowedChartsMode = {showInMonitor: {}/, showInDashboard: {}};
|
||||
allowedChartsMode = {showInMonitor: new Map<string, string[]>(), showInDashboard: new Map<string, string[]>()};
|
||||
allowedEntitiesMode = {showInMonitor: [], showInDashboard: []};
|
||||
|
||||
|
||||
statisticsSum: StatisticsSummary = null;
|
||||
statisticsDisplay: StatisticsDisplay = null;
|
||||
chartTitlesMode = {showInMonitor: {}, showInDashboard: {}};
|
||||
chartsInfoMap: {};
|
||||
|
||||
|
||||
displayedTimeline: string;
|
||||
displayedTimelineUrl: string;
|
||||
displayedGraph: string;
|
||||
|
@ -58,9 +58,9 @@ export class StatisticsComponent {
|
|||
public errorCodes: ErrorCodes = new ErrorCodes();
|
||||
status = null;
|
||||
communityName = null;
|
||||
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -73,49 +73,39 @@ export class StatisticsComponent {
|
|||
private titleCase: TitleCasePipe,
|
||||
private _communityService: CommunityService,
|
||||
private sanitizer: DomSanitizer) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ngOnInit() {
|
||||
if (this.currentMode == "showInMonitor") {
|
||||
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
|
||||
var title = "Monitor";
|
||||
|
||||
|
||||
this._title.setTitle(title);
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
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);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
if (sub instanceof Subscriber) {
|
||||
|
@ -123,23 +113,23 @@ export class StatisticsComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getCamelCaseString(inputString: string) {
|
||||
return this.titleCase.transform(inputString);
|
||||
}
|
||||
|
||||
|
||||
createStatisticsObjects() {
|
||||
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
|
||||
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;
|
||||
}
|
||||
|
@ -150,16 +140,16 @@ export class StatisticsComponent {
|
|||
this.status = this.errorCodes.ERROR;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
getDisplayOptions() {
|
||||
this.subs.push(this._statisticsService.getCommunityAdminStatisticsChoices(this.properties, this.communityId)
|
||||
.subscribe(
|
||||
res => {
|
||||
this.statisticsDisplay = res;
|
||||
|
||||
|
||||
this.getCommunityInfo();
|
||||
this.status = this.errorCodes.DONE;
|
||||
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.log(error);
|
||||
|
@ -168,8 +158,8 @@ export class StatisticsComponent {
|
|||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
getCommunityInfo() {
|
||||
// console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
|
||||
this.subs.push(this._configService.communityInformationState.subscribe(
|
||||
|
@ -191,11 +181,11 @@ export class StatisticsComponent {
|
|||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
initializeDisplayedCharts() {
|
||||
let firstEntity: string;
|
||||
this.entitiesList = Array.from(this.entitiesMap.keys());
|
||||
|
||||
|
||||
this.allowedChartsMode[this.currentMode] = this.allowedCharts;
|
||||
this.allowedEntitiesMode[this.currentMode] = this.allowedEntities;
|
||||
let titles = [];
|
||||
|
@ -217,7 +207,7 @@ export class StatisticsComponent {
|
|||
} else {
|
||||
this.chartTitlesMode.showInDashboard[entity + this.getCamelCaseString(chart)] = false;
|
||||
}
|
||||
|
||||
|
||||
// console.log(`added ${entity} - ${chart} to allowedCharts`);
|
||||
}
|
||||
if (this.statisticsSum[entity].total &&
|
||||
|
@ -232,7 +222,7 @@ export class StatisticsComponent {
|
|||
this.chartTitlesMode.showInMonitor[entity + this.getCamelCaseString(chart)] = false;
|
||||
}
|
||||
// console.log(`added ${entity} - ${chart} to allowedCharts`);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (this.allowedChartsMode.showInMonitor[entity].length) {
|
||||
|
@ -253,24 +243,24 @@ export class StatisticsComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
createChartUrlMap() {
|
||||
|
||||
|
||||
let communityCharts: CommunityCharts = new CommunityCharts(this.sanitizer);
|
||||
this.chartsInfoMap = communityCharts.getChartsForCommunity(this.communityId, this.communityName, this.properties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onChangeEntity(entity: string) {
|
||||
this.displayedEntity = entity;
|
||||
// console.log(`displayed entity is ${entity}`);
|
||||
// console.log(`statisticsSum[${entity}].total is ${this.statisticsSum[entity].total}`);
|
||||
|
||||
|
||||
if (this.statisticsSum[entity].total &&
|
||||
this.allowedEntities.filter(x => x == entity).length) {
|
||||
|
||||
|
||||
// console.log(`found ${entity} in allowedEntities`);
|
||||
this.displayedTimeline = `${entity}Timeline`;
|
||||
this.displayedTimelineUrl = this.chartsInfoMap[this.displayedTimeline].url;
|
||||
|
@ -297,13 +287,13 @@ export class StatisticsComponent {
|
|||
// console.log(`displayed Graph is: ${this.displayedGraph}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
changeDisplayedProjectChart(chartName: string) {
|
||||
this.displayedProjectChart = chartName;
|
||||
this.displayedProjectChartUrl = this.chartsInfoMap[this.displayedProjectChart].url;
|
||||
// console.log(`displayed ProjectChart is: ${this.displayedProjectChart}`);
|
||||
}
|
||||
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Statistics (Monitor) Page: " + message, error);
|
||||
}
|
||||
|
@ -320,5 +310,5 @@ export class StatisticsForDashboardComponent extends StatisticsComponent {
|
|||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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,107 +18,93 @@ 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;
|
||||
|
||||
|
||||
public url: string = null;
|
||||
public pageTitle: string = "Subjects";
|
||||
|
||||
|
||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - subjects'}];
|
||||
|
||||
|
||||
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) {
|
||||
return StringUtils.quote(StringUtils.URIEncode(param));
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
if (sub instanceof Subscriber) {
|
||||
|
@ -126,30 +112,30 @@ export class SubjectsComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private getPageContents() {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private getDivContents() {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private updateDescription(description: string) {
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
}
|
||||
|
||||
|
||||
private updateTitle(title: string) {
|
||||
var _title = ((title.length > 50) ? title.substring(0, 50) : title);
|
||||
this._title.setTitle(_title);
|
||||
this._meta.updateTag({content: _title}, "property='og:title'");
|
||||
}
|
||||
|
||||
|
||||
private updateUrl(url: string) {
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -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 {}
|
Loading…
Reference in New Issue