diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index cbec079..1d911d7 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -84,6 +84,8 @@ export class AppComponent implements OnInit, OnDestroy {
this.stakeholderService.setStakeholder(stakeholder);
this.layoutService.setOpen(true);
this.stakeHolder = stakeholder;
+ }, error => {
+ this.navigateToError();
});
}
} else {
@@ -109,6 +111,10 @@ export class AppComponent implements OnInit, OnDestroy {
}
});
}
+
+ private navigateToError() {
+ this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
+ }
public get open() {
return this.layoutService.open;
diff --git a/src/app/manageStakeholders/manageStakeholders.component.html b/src/app/manageStakeholders/manageStakeholders.component.html
index c571647..d5b5dbe 100644
--- a/src/app/manageStakeholders/manageStakeholders.component.html
+++ b/src/app/manageStakeholders/manageStakeholders.component.html
@@ -142,10 +142,10 @@
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit
- {{stakeholder.isActive ? 'Deactivate' : 'Activate'}}
+ {{stakeholder.isActive ? 'Inactive' : 'Active'}}
- {{stakeholder.isPublic ? 'Unpublish' : 'Publish'}}
+ {{stakeholder.isPublic ? 'Private' : 'Public'}}
();
this.chartsActiveType = new Map();
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
- // let stakeholder: Stakeholder = null;
- // if (params['stakeholder'] == "fwf") {
- // stakeholder = new Stakeholder(null, "funder", "fwf_________::FWF", "Austrian Science Fund (FWF)", "FWF",
- // "fwf", true, true, null);
- // stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
- // stakeholder.logoUrl = "./assets/fwf.png";
- // } else if (params['stakeholder'] == "arc") {
- // stakeholder = new Stakeholder(null, "funder", "arc_________::ARC",
- // "Australian Research Council (ARC)", "ARC", "arc", true, true, null);
- // stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
- // stakeholder.logoUrl = "./assets/arc1.gif";
- // } else if (params['stakeholder'] == "ec") {
- // stakeholder = new Stakeholder(null, "funder", "ec__________::EC",
- // "European Commission", "EC",
- // "ec", true, true, null);
- // stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile(stakeholder).topics);
- // stakeholder.logoUrl = "./assets/ec.png";
- // }
if (stakeholder) {
this.stakeholder = stakeholder;
- console.info(this.stakeholder);
-
- this.seoService.createLinkForCanonicalURL(url, false);
- this._meta.updateTag({content: url}, "property='og:url'");
- var description = "Monitor Dashboard | " + this.stakeholder.index_name;
- var title = "Monitor Dashboard | " + this.stakeholder.index_shortName;
- 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);
- if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
- this.piwiksub = this._piwikService.trackView(this.properties, title, this.properties.piwikSiteId).subscribe();
+ if(stakeholder.isActive && (stakeholder.isPublic || this.isAdmin())) {
+ this.seoService.createLinkForCanonicalURL(url, false);
+ this._meta.updateTag({content: url}, "property='og:url'");
+ var description = "Monitor Dashboard | " + this.stakeholder.index_name;
+ var title = "Monitor Dashboard | " + this.stakeholder.index_shortName;
+ 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);
+ if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
+ this.piwiksub = this._piwikService.trackView(this.properties, title, this.properties.piwikSiteId).subscribe();
+ }
+ //this.getDivContents();
+ this.getPageContents();
+ this.status = this.errorCodes.DONE;
+ this.setView(params);
+ this.layoutService.setOpen(true);
+ } else {
+ this.navigateToError();
+ subscription.unsubscribe();
}
- //this.getDivContents();
- this.getPageContents();
- this.status = this.errorCodes.DONE;
- this.setView(params);
- this.layoutService.setOpen(true);
}
- }, error => {
- this.navigateToError();
});
this.subscriptions.push(subscription);
} else {
this.setView(params);
}
- // this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
- // this.user = user;
- // this.buildMenu();
- // }, error => {
- // console.log("App couldn't fetch properties");
- // console.log(error);
- // }));
});
}));
});
diff --git a/src/app/stakeholder/stakeholder.component.ts b/src/app/stakeholder/stakeholder.component.ts
index 0ca19cd..52a3810 100644
--- a/src/app/stakeholder/stakeholder.component.ts
+++ b/src/app/stakeholder/stakeholder.component.ts
@@ -57,15 +57,7 @@ export class StakeholderComponent implements OnInit, OnDestroy, IDeactivateCompo
this.form = null;
this.title.setTitle(stakeholder.index_name);
}
- },
- err => {
- console.error("Error getting stakeholder: ", err);
- if(err.status == 404) {
- //{queryParams: {"page": this.location.path(true), "page_type": "dataprovider"}}
- this.router.navigate(['/error'], );
- }
-
- }));
+ }));
});
}
diff --git a/src/app/topic/indicators.component.ts b/src/app/topic/indicators.component.ts
index 4d9d276..92c2f3d 100644
--- a/src/app/topic/indicators.component.ts
+++ b/src/app/topic/indicators.component.ts
@@ -125,11 +125,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.filterCharts();
this.filterNumbers();
}
- if (this.topicIndex && this.categoryIndex && this.subcategoryIndex) {
- this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
- '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
- '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
- }
+ this.preview = '/' + this.stakeholder.alias + '/' + this.stakeholder.topics[this.topicIndex].alias +
+ '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].alias +
+ '/' + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].alias;
}
initReorder() {