[Connect | Trunk]: Delete properties resolver. Delete query param community id

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60772 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-01 14:25:15 +00:00
parent 1f78864788
commit 9ee09f1f3a
18 changed files with 434 additions and 566 deletions

View File

@ -1,99 +1,211 @@
import { NgModule } from '@angular/core'; import {NgModule} from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import {OpenaireErrorPageComponent} from './error/errorPage.component';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import { OpenaireErrorPageComponent } from './error/errorPage.component';
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component"; import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard"; import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
const routes: Routes = [ const routes: Routes = [
// Other Pages /** Other Pages */
{ path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule'}, {path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule'},
{path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'},
{ path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'}, {path: 'about/learn-how', loadChildren: './learn-how/learn-how.module#LearnHowModule'},
{ path: 'about/learn-how', loadChildren: './learn-how/learn-how.module#LearnHowModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'about/learn-in-depth', loadChildren: './learn-how/learnInDepth/learn-in-depth.module#LearnInDepthModule'},
{ path: 'about/learn-in-depth', loadChildren: './learn-how/learnInDepth/learn-in-depth.module#LearnInDepthModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule'},
{ path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'contact-us', loadChildren: './contact/contact.module#ContactModule'},
{ path: 'contact-us', loadChildren: './contact/contact.module#ContactModule'}, {path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule'},
{ path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule'}, {path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', canActivate: [IsCommunity]},
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', canActivate:[IsCommunity]}, {
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', canActivate:[IsCommunity]}, path: 'organizations',
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', canActivate:[IsCommunity]}, loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule',
{ path: 'projects', loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'national-bulletins', loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule', canActivate:[IsCommunity]}, },
{ path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', canActivate:[IsCommunity]}, {
{ path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', canActivate:[IsCommunity]}, path: 'publications',
loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule',
{ path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule'}, canActivate: [IsCommunity]
},
// Testing Page for help contents {
{ path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule'}, path: 'projects',
loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule',
// Landing Pages canActivate: [IsCommunity]
{ path: 'search/result', loadChildren: './landingPages/result/libResult.module#LibResultModule', canActivate:[IsCommunity]}, },
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', canActivate:[IsCommunity]}, {
{ path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule', canActivate:[IsCommunity]}, path: 'national-bulletins',
{ path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule', canActivate:[IsCommunity]}, loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule',
{ path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule', canActivate:[IsCommunity]}, },
{ path: 'search/dataprovider', loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule', canActivate:[IsCommunity]}, {path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', canActivate: [IsCommunity]},
{ path: 'search/organization', loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule', canActivate:[IsCommunity]}, {path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', canActivate: [IsCommunity]},
{path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule'},
{ path: 'project-report', loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'}, /** Testing Page for help contents */
{path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule'},
// Search Pages /** Landing Pages */
{ path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'}, {
path: 'search/result',
{ path: 'search/find/communities', loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule'}, loadChildren: './landingPages/result/libResult.module#LibResultModule',
{ path: 'search/find/research-outcomes', loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/find/publications', component: PageURLResolverComponent, canActivate:[IsCommunity]}, },
{ path: 'search/find/datasets', component: PageURLResolverComponent, canActivate:[IsCommunity]}, {
{ path: 'search/find/software', component: PageURLResolverComponent, canActivate:[IsCommunity]}, path: 'search/publication',
{ path: 'search/find/other', component: PageURLResolverComponent, canActivate:[IsCommunity]}, loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule',
{ path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/find/dataproviders', loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule', canActivate:[IsCommunity]}, },
{
// Advanced Search Pages path: 'search/dataset',
{ path: 'search/advanced/research-outcomes', loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule', canActivate:[IsCommunity]}, loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule',
{ path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate:[IsCommunity]}, },
{ path: 'search/advanced/software', component: PageURLResolverComponent, canActivate:[IsCommunity]}, {
{ path: 'search/advanced/other', component: PageURLResolverComponent, canActivate:[IsCommunity]}, path: 'search/software',
{ path: 'search/advanced/organizations', loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule', canActivate:[IsCommunity]}, loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule',
{ path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule', canActivate:[IsCommunity]}, },
{path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', canActivate: [IsCommunity]},
// Deposit Pages {
{ path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, path: 'search/project',
{ path: 'participate/deposit-datasets-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, loadChildren: './landingPages/project/libProject.module#LibProjectModule',
{ path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, },
{ path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, {
{ path: 'participate/share-zenodo', redirectTo: '/participate/deposit/zenodo', pathMatch: 'full', canActivate:[IsCommunity]}, path: 'search/dataprovider',
loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule',
{ path: 'participate/deposit/learn-how', loadChildren: './deposit/deposit.module#LibDepositModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'participate/deposit/search', loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule', canActivate:[IsCommunity]}, },
{ path: 'participate/deposit/zenodo', loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule', canActivate:[IsCommunity]}, {
path: 'search/organization',
// Linking Pages loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule',
{ path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule', canActivate:[IsCommunity]}, },
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule', canActivate:[IsCommunity]}, {
path: 'project-report',
loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'
// help pages - do not exist in Admin portal/api/db },
{ path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule'}, /** Search Pages */
{ path: 'user-info', loadChildren: './login/libUser.module#LibUserModule'}, {path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'},
{ path: 'error', component: OpenaireErrorPageComponent},
{ path: 'theme', loadChildren: './openaireLibrary/utils/theme/theme.module#ThemeModule'}, {
{ path: '**',pathMatch: 'full',component: OpenaireErrorPageComponent} path: 'search/find/communities',
loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule'
},
{
path: 'search/find/research-outcomes',
loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule',
canActivate: [IsCommunity]
},
{path: 'search/find/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/software', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{
path: 'search/find/projects',
loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule',
canActivate: [IsCommunity]
},
{
path: 'search/find/dataproviders',
loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule',
canActivate: [IsCommunity]
},
/** Advanced Search Pages */
{
path: 'search/advanced/research-outcomes',
loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule',
canActivate: [IsCommunity]
},
{path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/software', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{
path: 'search/advanced/organizations',
loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule',
canActivate: [IsCommunity]
},
{
path: 'search/advanced/dataproviders',
loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule',
canActivate: [IsCommunity]
},
{
path: 'search/advanced/projects',
loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule',
canActivate: [IsCommunity]
},
/** Deposit Pages */
{
path: 'participate/deposit-datasets',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-datasets-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-subject-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-publications',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-publications-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/share-zenodo',
redirectTo: '/participate/deposit/zenodo',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/learn-how',
loadChildren: './deposit/deposit.module#LibDepositModule',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/search',
loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/zenodo',
loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule',
canActivate: [IsCommunity]
},
/** Linking Pages */
{path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', canActivate: [IsCommunity]},
{
path: 'participate/claim',
loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule',
canActivate: [IsCommunity]
},
{
path: 'participate/direct-claim',
loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule',
canActivate: [IsCommunity]
},
/** help pages - do not exist in Admin portal/api/db */
{path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule'},
{path: 'user-info', loadChildren: './login/libUser.module#LibUserModule'},
{path: 'error', component: OpenaireErrorPageComponent},
{path: 'theme', loadChildren: './openaireLibrary/utils/theme/theme.module#ThemeModule'},
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
exports: [RouterModule], exports: [RouterModule]
providers: [EnvironmentSpecificResolver, EnvironmentSpecificService]
}) })
export class AppRoutingModule { } export class AppRoutingModule {
}

View File

@ -16,6 +16,7 @@ import {Subscriber} from "rxjs";
import {CommunityService} from "./openaireLibrary/connect/community/community.service"; import {CommunityService} from "./openaireLibrary/connect/community/community.service";
import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; import {StringUtils} from "./openaireLibrary/utils/string-utils.class";
import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class"; import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class";
@Component({ @Component({
//changeDetection: ChangeDetectionStrategy.Default, //changeDetection: ChangeDetectionStrategy.Default,
//encapsulation: ViewEncapsulation.Emulated, //encapsulation: ViewEncapsulation.Emulated,
@ -78,14 +79,14 @@ import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class";
[id]="community.id" [name]="community.name" [type]="'community'"></role-verification> [id]="community.id" [name]="community.name" [type]="'community'"></role-verification>
</div> </div>
` `
}) })
export class AppComponent { export class AppComponent {
isClient: boolean = false; isClient: boolean = false;
userMenuItems: MenuItem[] = []; userMenuItems: MenuItem[] = [];
menuItems: RootMenuItem [] = []; menuItems: RootMenuItem [] = [];
bottomMenuItems: MenuItem[] = []; bottomMenuItems: MenuItem[] = [];
public community = null; public community = null;
@ -97,6 +98,7 @@ export class AppComponent {
header: Header; header: Header;
logoPath: string = 'assets/common-assets/'; logoPath: string = 'assets/common-assets/';
subscriptions = []; subscriptions = [];
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private _communitiesService: CommunitiesService, private _communitiesService: CommunitiesService,
private router: Router, private userManagementService: UserManagementService, private router: Router, private userManagementService: UserManagementService,
@ -119,7 +121,7 @@ export class AppComponent {
this.configurationService.clearSubscriptions(); this.configurationService.clearSubscriptions();
this._communityService.clearSubscriptions(); this._communityService.clearSubscriptions();
} }
ngOnInit() { ngOnInit() {
this.properties = properties; this.properties = properties;
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI); this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
@ -132,43 +134,45 @@ export class AppComponent {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
this.init(); this.init();
},error => this.init())); }, error => this.init()));
} }
get isManager() { get isManager() {
return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user)) return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user))
} }
private init() { private init() {
let communityId: string = ConnectHelper.getCommunityFromDomain(this.properties.domain); let communityId: string = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.showMenu = false; this.showMenu = false;
this.initAdminToolCommunity(communityId); this.initAdminToolCommunity(communityId);
this.buildMenu(communityId); this.buildMenu(communityId);
this.communityId = communityId; this.communityId = communityId;
if(this.communityId === null) { if (this.communityId === null) {
this.userManagementService.fixRedirectURL = properties.afterLoginRedirectLink; this.userManagementService.fixRedirectURL = properties.afterLoginRedirectLink;
} else { } else {
this.userManagementService.fixRedirectURL = null; this.userManagementService.fixRedirectURL = null;
} }
} }
initAdminToolCommunity(communityId){
if(communityId) { initAdminToolCommunity(communityId) {
if (communityId) {
this.properties.adminToolsPortalType = "community"; this.properties.adminToolsPortalType = "community";
} }
this.configurationService.initCommunityInformation(this.properties, (communityId)?communityId:this.properties.adminToolsPortalType); this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType);
} }
public buildMenu(communityId: string) { public buildMenu(communityId: string) {
if(communityId) { if (communityId) {
if (!this.community || this.community.communityId !== communityId) { if (!this.community || this.community.communityId !== communityId) {
this.subscriptions.push(this._communityService.getCommunity(communityId).subscribe(community => { this.subscriptions.push(this._communityService.getCommunity(communityId).subscribe(community => {
if (community && !this.isPrivate(community)) { if (community && !this.isPrivate(community)) {
this.community = { this.community = {
id: community.communityId, id: community.communityId,
name: (community.shortTitle) ? community.shortTitle : community.title, name: (community.shortTitle) ? community.shortTitle : community.title,
logoUrl: (community.isUpload) ? (properties.utilsService + '/download/' + community.logoUrl):(StringUtils.urlPrefix(community.logoUrl) + community.logoUrl), logoUrl: (community.isUpload) ? (properties.utilsService + '/download/' + community.logoUrl) : (StringUtils.urlPrefix(community.logoUrl) + community.logoUrl),
description:community.description description: community.description
}; };
this.header = { this.header = {
// url: 'https://' + (this.properties.environment == 'beta' ? 'beta.' : '') + this.community.id + '.openaire.eu', // url: 'https://' + (this.properties.environment == 'beta' ? 'beta.' : '') + this.community.id + '.openaire.eu',
@ -216,7 +220,7 @@ export class AppComponent {
if (this.isManager) { if (this.isManager) {
this.menuItems.push( this.menuItems.push(
{ {
rootItem: new MenuItem("manage", "Manage", this.properties.adminPortalURL + '/' + community.communityId, "", false, [], [], {}), rootItem: new MenuItem("manage", "Manage", this.properties.adminPortalURL + '/' + community.communityId, "", false, [], [], {}),
items: [] items: []
}); });
} }
@ -226,7 +230,7 @@ export class AppComponent {
if (this.properties.showContent) { if (this.properties.showContent) {
this.bottomMenuItems.push(new MenuItem("", "Sources and methodology", "", "/content", false, [], [], {})); this.bottomMenuItems.push(new MenuItem("", "Sources and methodology", "", "/content", false, [], [], {}));
} }
if(this.user) { if (this.user) {
this.userMenuItems = [ /*new MenuItem("","My profile","","",false,[],[],{}),*/ this.userMenuItems = [ /*new MenuItem("","My profile","","",false,[],[],{}),*/
new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {}), new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {}),
new MenuItem("", "Invite users", "", "/invite", false, [], [], {}), new MenuItem("", "Invite users", "", "/invite", false, [], [], {}),
@ -237,62 +241,65 @@ export class AppComponent {
} }
this.showMenu = true; this.showMenu = true;
} else { } else {
this.showPrivateOrNoCommunity(community?community.status:null); this.showPrivateOrNoCommunity(community ? community.status : null);
} }
})); }));
} else { } else {
this.showMenu = true; this.showMenu = true;
} }
} else { } else {
this.buildConnectMenu(); this.buildConnectMenu();
} }
} }
isPrivate(community){
return community && ( community.status == "hidden" || (community.status == "manager" && !(Session.isCommunityCurator(this.user) || Session.isManager("community",community.communityId,this.user)))) isPrivate(community) {
return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isCommunityCurator(this.user) || Session.isManager("community", community.communityId, this.user))))
} }
showPrivateOrNoCommunity(restrictedData:string){
showPrivateOrNoCommunity(restrictedData: string) {
this.communityId = null; this.communityId = null;
this.community = null; this.community = null;
this.properties.adminToolsPortalType = "connect"; this.properties.adminToolsPortalType = "connect";
this.configurationService.initCommunityInformation(this.properties,"connect"); this.configurationService.initCommunityInformation(this.properties, "connect");
this.initAdminToolCommunity(null); this.initAdminToolCommunity(null);
this.buildConnectMenu(true); this.buildConnectMenu(true);
if(restrictedData == "manager") { if (restrictedData == "manager") {
if(!this.user) { if (!this.user) {
this.router.navigate(['/user-info'], { this.router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": LoginErrorCodes.NOT_LOGIN, "errorCode": LoginErrorCodes.NOT_LOGIN,
"redirectUrl": this.router.url "redirectUrl": this.router.url
} }
}); });
}else{ } else {
this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {}); this.router.navigate(['/error'], {queryParams: {'page': -1}});
} }
}else { } else {
this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {}); this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {});
} }
} }
buildConnectMenu(restrictedData:boolean=false){
let url = "https://" + (properties.environment !="production" ? "beta." : "") + "connect.openaire.eu"; buildConnectMenu(restrictedData: boolean = false) {
let url = "https://" + (properties.environment != "production" ? "beta." : "") + "connect.openaire.eu";
this.header = { this.header = {
route: restrictedData ? "" : "/", route: restrictedData ? "" : "/",
url: restrictedData ? url: "", url: restrictedData ? url : "",
title: 'connect', title: 'connect',
logoUrl: this.logoPath + 'logo-large-connect.png', logoUrl: this.logoPath + 'logo-large-connect.png',
logoSmallUrl:this.logoPath + 'logo-small-connect.png', logoSmallUrl: this.logoPath + 'logo-small-connect.png',
position:'left', position: 'left',
badge:true badge: true
}; };
this.menuItems = []; this.menuItems = [];
this.menuItems.push({ this.menuItems.push({
rootItem: new MenuItem("about", "About", restrictedData ? url + "/about/learn-how": "", restrictedData ? "" : "/about/learn-how", false, [], ["/about/learn-how"], {}), rootItem: new MenuItem("about", "About", restrictedData ? url + "/about/learn-how" : "", restrictedData ? "" : "/about/learn-how", false, [], ["/about/learn-how"], {}),
items: [ items: [
new MenuItem("", "Learn the process", restrictedData ? url + "/about/learn-how" : "", restrictedData ? "" : "/about/learn-how", false, [], ["/about/learn-in-depth"], {}), new MenuItem("", "Learn the process", restrictedData ? url + "/about/learn-how" : "", restrictedData ? "" : "/about/learn-how", false, [], ["/about/learn-in-depth"], {}),
new MenuItem("", "Publications", restrictedData ? url +"/publications":"", restrictedData ? "" : "/publications", false, [], ["/publications"], {}), new MenuItem("", "Publications", restrictedData ? url + "/publications" : "", restrictedData ? "" : "/publications", false, [], ["/publications"], {}),
new MenuItem("", "Roadmap", "https://trello.com/b/yfzUz0kp/openaire-connect-dashboard", "", false, [], [], {}), new MenuItem("", "Roadmap", "https://trello.com/b/yfzUz0kp/openaire-connect-dashboard", "", false, [], [], {}),
new MenuItem("", "FAQs", restrictedData ? url + "/about/faq" : "", restrictedData ? "" : "/about/faq", false, [], ["/about/faq"], {}) new MenuItem("", "FAQs", restrictedData ? url + "/about/faq" : "", restrictedData ? "" : "/about/faq", false, [], ["/about/faq"], {})
] ]
}); });
this.menuItems.push({ this.menuItems.push({
rootItem: new MenuItem("communities", "Communities", restrictedData ? url + "/about/faq" : "", restrictedData ? "" : "/search/find/communities", false, [], ['/search/find/communities'], {}), rootItem: new MenuItem("communities", "Communities", restrictedData ? url + "/about/faq" : "", restrictedData ? "" : "/search/find/communities", false, [], ['/search/find/communities'], {}),
@ -306,12 +313,12 @@ export class AppComponent {
new MenuItem("", "About", "https://openaire.eu/project-factsheets", "", false, [], [], {}), new MenuItem("", "About", "https://openaire.eu/project-factsheets", "", false, [], [], {}),
new MenuItem("", "News - Events", "https://openaire.eu/news-events", "", false, [], [], {}), new MenuItem("", "News - Events", "https://openaire.eu/news-events", "", false, [], [], {}),
new MenuItem("", "Blog", "https://blogs.openaire.eu/", "", false, [], [], {}), new MenuItem("", "Blog", "https://blogs.openaire.eu/", "", false, [], [], {}),
new MenuItem("", "Contact us", restrictedData ? url + "/contact-us" : "", restrictedData ? "" : "/contact-us", false, [], [], {}) new MenuItem("", "Contact us", restrictedData ? url + "/contact-us" : "", restrictedData ? "" : "/contact-us", false, [], [], {})
]; ];
this.userMenuItems = []; this.userMenuItems = [];
if (Session.isPortalAdministrator(this.user)) { if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage Helptexts", this.userMenuItems.push(new MenuItem("", "Manage Helptexts",
properties.adminPortalURL + "/connect/pages","", false, [], [], {})) properties.adminPortalURL + "/connect/pages", "", false, [], [], {}))
} }
if (this.user) { if (this.user) {
this.userMenuItems.push(new MenuItem("my-communities", "My Communities", restrictedData ? url + "/myCommunities" : "", this.userMenuItems.push(new MenuItem("my-communities", "My Communities", restrictedData ? url + "/myCommunities" : "",

View File

@ -14,9 +14,6 @@ import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/coo
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module'; import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
import {ErrorModule} from './openaireLibrary/error/error.module'; import {ErrorModule} from './openaireLibrary/error/error.module';
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module'; import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service';
import {LayoutService} from "./openaireLibrary/services/layout.service"; import {LayoutService} from "./openaireLibrary/services/layout.service";
import {SubscribeModule} from './utils/subscribe/subscribe.module'; import {SubscribeModule} from './utils/subscribe/subscribe.module';
@ -50,10 +47,10 @@ import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-v
BrowserAnimationsModule, BrowserAnimationsModule,
PageURLResolverModule, Schema2jsonldModule, RoleVerificationModule PageURLResolverModule, Schema2jsonldModule, RoleVerificationModule
], ],
declarations: [ AppComponent, OpenaireErrorPageComponent], declarations: [AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ], exports: [AppComponent],
providers:[ providers: [
EnvironmentSpecificResolver, CommunitiesService, LayoutService, IsCommunity, SubscribeService, CommunitiesService, LayoutService, IsCommunity, SubscribeService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService, useClass: HttpInterceptorService,
@ -64,10 +61,11 @@ import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-v
useClass: ErrorInterceptorService, useClass: ErrorInterceptorService,
multi: true multi: true
}, },
[{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }], [{provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true}],
[{ provide: DEFAULT_TIMEOUT, useValue: 30000 }] [{provide: DEFAULT_TIMEOUT, useValue: 30000}]
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule {} export class AppModule {
}

View File

@ -14,41 +14,34 @@ import {properties} from "../../environments/environment";
selector: 'html-page', selector: 'html-page',
template: ` template: `
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other" [description]="description"></schema2jsonld> <schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other" [description]="description"></schema2jsonld>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper> <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
` [texts]="pageContents['top']"></helper>
`
}) })
export class HtmlPageComponent { export class HtmlPageComponent {
properties: EnvProperties = properties;
properties: EnvProperties;
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
@Input() url: string = null; @Input() url: string = null;
@Input() pageTitle: string; @Input() pageTitle: string;
@Input() description: string; @Input() description: string;
private subscriptions = []; private subscriptions = [];
communityId; communityId;
constructor(private route: ActivatedRoute, private _router: Router, constructor(private route: ActivatedRoute, private _router: Router,
private _meta: Meta, private _meta: Meta,
private _title: Title, private _title: Title,
private seoService: SEOService, private seoService: SEOService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private helper: HelperService) {} private helper: HelperService) {
}
public ngOnInit() { public ngOnInit() {
this.properties = properties;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
} }
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (this.properties.environment == "development") {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain);
}));
}
//TODO set the proper URL //TODO set the proper URL
this.url = this.properties.domain + this._router.url; this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);
@ -56,9 +49,9 @@ export class HtmlPageComponent {
this.updateTitle(this.pageTitle); this.updateTitle(this.pageTitle);
this.updateDescription(this.description); this.updateDescription(this.description);
this.getPageContents(); this.getPageContents();
} }
ngOnDestroy() { ngOnDestroy() {
this.subscriptions.forEach(subscription => { this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) { if (subscription instanceof Subscriber) {
@ -66,25 +59,25 @@ export class HtmlPageComponent {
} }
}); });
} }
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");
} }
private updateTitle(title: string) { private updateTitle(title: string) {
var _title = ((title.length > 50) ? title.substring(0, 50) : title); var _title = ((title.length > 50) ? title.substring(0, 50) : title);
this._title.setTitle(_title); this._title.setTitle(_title);
this._meta.updateTag({content: _title}, "property='og:title'"); this._meta.updateTag({content: _title}, "property='og:title'");
} }
private updateUrl(url: string) { private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
} }
private getPageContents() { private getPageContents() {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId?this.communityId:"connect", this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId ? this.communityId : "connect", this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
})); }));
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -10,28 +8,15 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<dataprovider [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataprovider>`, <dataprovider [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataprovider>`,
}) })
export class OpenaireDataProviderComponent { export class OpenaireDataProviderComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) { constructor() {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,29 +9,15 @@ import {properties} from "../../../environments/environment";
<result-landing type="dataset" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing> <result-landing type="dataset" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>
`, `,
}) })
export class OpenaireDatasetComponent { export class OpenaireDatasetComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) { constructor() {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,38 +1,22 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-htmlProjectReport', selector: 'openaire-htmlProjectReport',
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`, template: `
}) <htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
export class OpenaireHtmlProjectReportComponent{ })
piwikSiteId = null; export class OpenaireHtmlProjectReportComponent {
communityId = null; piwikSiteId;
private sub; communityId;
constructor(private route: ActivatedRoute) { constructor() {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,27 +9,14 @@ import {properties} from "../../../environments/environment";
<organization [piwikSiteId]=piwikSiteId [communityId]="communityId"></organization>`, <organization [piwikSiteId]=piwikSiteId [communityId]="communityId"></organization>`,
}) })
export class OpenaireOrganizationComponent { export class OpenaireOrganizationComponent {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor() {
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
} }
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
} }

View File

@ -1,40 +1,25 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-orp', selector: 'openaire-orp',
template: ` template: `
<result-landing type="orp" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing> <result-landing type="orp" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>
`, `,
}) })
export class OpenaireOrpComponent { export class OpenaireOrpComponent implements OnInit {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor() {}
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
ngOnInit() {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -10,28 +8,15 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<project [piwikSiteId]=piwikSiteId [communityId]="communityId"></project>`, <project [piwikSiteId]=piwikSiteId [communityId]="communityId"></project>`,
}) })
export class OpenaireProjectComponent { export class OpenaireProjectComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -14,25 +12,11 @@ import {properties} from "../../../environments/environment";
export class OpenairePublicationComponent { export class OpenairePublicationComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
constructor() {}
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,37 +1,21 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-publication', selector: 'openaire-publication',
template: `<result-landing type="result" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>`, template: `
}) <result-landing type="result" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>`,
export class OpenaireResultComponent{ })
piwikSiteId = null; export class OpenaireResultComponent implements OnInit{
communityId = null; piwikSiteId;
private sub; communityId;
constructor(private route: ActivatedRoute) { constructor() {}
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,30 +9,15 @@ import {properties} from "../../../environments/environment";
<result-landing type="software" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing> <result-landing type="software" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>
`, `,
}) })
export class OpenaireSoftwareComponent { export class OpenaireSoftwareComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub =
this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,55 +1,32 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-advanced-search-dataprovider', selector: 'openaire-advanced-search-dataprovider',
template: ` template: `
<search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId"
[hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-dataproviders> </search-dataproviders>
`
` })
}) export class OpenaireAdvancedSearchDataProvidersComponent implements OnInit {
communityId: string;
export class OpenaireAdvancedSearchDataProvidersComponent {
connectCommunityId:string;
piwikSiteId = null; piwikSiteId = null;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
constructor() {
} }
sub;
ngOnDestroy() { ngOnInit() {
if (this.sub instanceof Subscriber) { let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.sub.unsubscribe(); if (communityId) {
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
this.communityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.customFilter.isHiddenFilter = false;
} }
} }
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if(communityId){
this.connectCommunityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
} else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
}
});
}
}
} }

View File

@ -1,4 +1,4 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
@ -12,47 +12,23 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<search-organizations [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-organizations [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-organizations> </search-organizations>
` `
}) })
export class OpenaireAdvancedSearchOrganizationsComponent implements OnInit {
export class OpenaireAdvancedSearchOrganizationsComponent { communityId:string;
connectCommunityId:string; piwikSiteId;
piwikSiteId = null; customFilter: SearchCustomFilter;
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) { constructor () {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if(communityId){ if(communityId){
this.connectCommunityId = communityId; this.communityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.customFilter.isHiddenFilter = false; this.customFilter.isHiddenFilter = false;
} else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
}
});
} }
} }
} }

View File

@ -1,53 +1,34 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-advanced-search-projects', selector: 'openaire-advanced-search-projects',
template: ` template: `
<search-projects [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-projects [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false"
</search-projects> [showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-projects>
`
})
` export class OpenaireAdvancedSearchProjectsComponent implements OnInit {
}) communityId: string;
piwikSiteId;
export class OpenaireAdvancedSearchProjectsComponent {
connectCommunityId:string;
piwikSiteId = null;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
constructor() {
} }
sub;
ngOnDestroy() { ngOnInit() {
if (this.sub instanceof Subscriber) { let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.sub.unsubscribe(); if (communityId) {
this.communityId = communityId;
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.customFilter.isHiddenFilter = false;
} }
} }
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if(communityId){
this.connectCommunityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
} else{
this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
}
});
}
}
} }

View File

@ -1,49 +1,32 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties"; import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-search-find', selector: 'openaire-search-find',
template: ` template: `
<search-all logoURL = "/assets/common-assets/logo-small-explore.png" name="OpenAIRE Connect" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" ></search-all> <search-all logoURL="/assets/common-assets/logo-small-explore.png" name="OpenAIRE Connect"
`, [customFilter]=customFilter [piwikSiteId]="piwikSiteId"></search-all>
}) `,
export class OpenaireSearchComponent{ })
connectCommunityId:string; export class OpenaireSearchComponent {
communityId: string;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
piwikSiteId = null; piwikSiteId = null;
properties:EnvProperties; properties: EnvProperties = properties;
constructor ( private route: ActivatedRoute) {
} constructor() {
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
this.properties = properties; let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); if (communityId) {
this.piwikSiteId = PiwikHelper.getSiteId(communityId,this.properties.environment); this.communityId = communityId;
if(communityId){ this.piwikSiteId = PiwikHelper.getSiteId(communityId, this.properties.environment);
this.connectCommunityId = communityId; this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
}else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,this.properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
}
});
} }
} }
} }

View File

@ -1,43 +1,25 @@
import {Component, OnDestroy, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-search-organizations', selector: 'openaire-search-organizations',
template: ` template: `
<search-organizations> <search-organizations></search-organizations>
</search-organizations>
` `
}) })
export class OpenaireSearchOrganizationsComponent implements OnInit, OnDestroy { export class OpenaireSearchOrganizationsComponent implements OnInit {
piwikSiteId = null; piwikSiteId = null;
sub;
constructor(private route: ActivatedRoute) { constructor() {
} }
ngOnInit() { ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain); let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (communityId) { if (communityId) {
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); 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();
} }
} }
} }