Domain change:
	Update server.ts to be able to read domain from request
	Update functions that needed  domain 
	use the domain as read from properties

Update home page urls to dashboards- use environment property




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@54949 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-03-01 11:34:19 +00:00
parent 050348b780
commit b2b969c30d
37 changed files with 344 additions and 209 deletions

View File

@ -8,17 +8,11 @@
# cp beta-properties.json ../src/assets/env-properties.json;
## uncommect from here-->
# echo -n 'Check properties service to have the url for the deployment environment!!';
# echo -n "Press key:";
# read -n1 ans
# echo -n "Pressed";
# pico ../src/app/openaireLibrary/utils/properties/environment-specific.service.ts;
# rm -rf ../src/assets/common-assets/.svn/;
# rm -rf ../src/app/openaireLibrary/.svn/;
# cd ..; npm run build:dynamic; cd deploy;
# rm -rf ../src ../node_modules ../.idea/ ../installOpenaireLib.sh;
# rm -rf ../src ../node_modules ../.idea/ ../installOpenaireLib.sh; cd ../; rm -rf deploy;
# echo 'Now copy to the server!'
#echo 'remove this deploy folder'
##<-- to here

View File

@ -28,12 +28,24 @@ import { ngExpressEngine } from '@nguniversal/express-engine';
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
provideModuleMap(LAZY_MODULE_MAP)
]
}));
// app.engine('html', ngExpressEngine({
// bootstrap: AppServerModuleNgFactory,
// providers: [
// { provide: 'request', useFactory: () => options.req, deps: [] },
// provideModuleMap(LAZY_MODULE_MAP)
// ]
// }));
app.engine('html', (_, options, callback) => {
let engine = ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
{ provide: 'request', useFactory: () => options.req, deps: [] },
provideModuleMap(LAZY_MODULE_MAP)
]
});
engine(_, options, callback);
});
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));

View File

@ -1,4 +1,4 @@
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation, Injector } from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute} from '@angular/router';
@ -55,28 +55,25 @@ export class AppComponent {
showMenu:boolean = false;
communities = null;
// community: {id:string, name:string, logoUrl:string};
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService, private _communitiesService:CommunitiesService ) {
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService, private _communitiesService:CommunitiesService, private injector: Injector) {
}
ngOnInit() {
this.propertiesService.loadEnvironment()
.then(es => {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
this.route.queryParams.subscribe(data => {
var community = null;
this.community = null;
this.showMenu = false;
// var test:MenuItem = new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],this.properties.environment!="development"?{}:{communityId:community.communityId});
// test.
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
communities => {
for(var com of communities){
if((data['communityId'] && data['communityId']!="" && com.communityId == data['communityId'])
|| (typeof document !== 'undefined' && (ConnectHelper.getCommunityFromDomain(document.location.hostname) == com.communityId ) )){
|| (ConnectHelper.getCommunityFromDomain(this.properties.domain) == com.communityId ) ){
community = com;
this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
this.menuItems= [

View File

@ -14,14 +14,17 @@ export class OpenaireDirectLinkingComponent {
private _router: Router
) {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
}
});
});
});
}
}

View File

@ -15,14 +15,17 @@ export class OpenaireLinkingComponent {
private _router: Router
) {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
}
});
});
});
}
}

View File

@ -236,7 +236,7 @@
Explore all OA research results. Link all your research. Build your profile
</div>
<p>
<a target="_blank" href="https://explore.openaire.eu" class="el-link uk-button uk-button-default">
<a target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'explore.openaire.eu'" class="el-link uk-button uk-button-default">
OpenAIRE.EXPLORE
</a>
</p>
@ -251,7 +251,7 @@
Join OpenAIRE, use our tools and make your content more visible around the world.
</div>
<p>
<a target="_blank" href="https://provide.openaire.eu" class="el-link uk-button uk-button-default">
<a target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'provide.openaire.eu'" class="el-link uk-button uk-button-default">
OpenAIRE.PROVIDE
</a>
</p>
@ -281,7 +281,7 @@
Use our monitoring services and easily track all relevant research results.
</div>
<p>
<a target="_blank" href="https://monitor.openaire.eu" class="el-link uk-button uk-button-default">
<a target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.openaire.eu/moniotr':'monitor.openaire.eu')" class="el-link uk-button uk-button-default">
OpenAIRE.MONITOR
</a>
</p>

View File

@ -41,7 +41,7 @@ export class CommunityComponent {
public contentProviderTotal = null;
public organizationTotal = null;
params: any;
params: any ={};
properties:EnvProperties;
public publicationResults = null;
@ -98,7 +98,9 @@ export class CommunityComponent {
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
this.community = community;
this.params = {communityId: community.communityId};
if(this.properties.environment == "development"){
this.params = {communityId: community.communityId};
}
this._meta.updateTag({content:community.description},"name='description'");
this._meta.updateTag({content:community.description},"property='og:description'");
this._meta.updateTag({content:community.title},"property='og:title'");

View File

@ -21,19 +21,23 @@ export class CommunityWrapperComponent {
private _router: Router
) {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if(this.communityId){
this.dashboard = true;
}else{
this.dashboard = false;
}
});
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
}
if(this.communityId){
this.dashboard = true;
}else{
this.dashboard = false;
}
});
});
}
public ngOnInit() {

View File

@ -38,8 +38,8 @@ export class OpenaireDepositBySubjectResultComponent {
this.route.queryParams.subscribe(params => {
var communityId = params['communityId'];
if(!communityId){
communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId) {

View File

@ -40,8 +40,8 @@ export class OpenaireDepositDatasetsComponent {
this.route.queryParams.subscribe(params => {
var communityId = params['communityId'];
if(!communityId){
communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId) {

View File

@ -39,8 +39,8 @@ export class OpenaireDepositDatasetsResultComponent {
this.route.queryParams.subscribe(params => {
var communityId = params['communityId'];
if(!communityId){
communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId) {

View File

@ -29,8 +29,6 @@ export class OpenaireDepositPublicationsComponent {
constructor ( private route: ActivatedRoute,
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
//var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
//this.piwikSiteId = PiwikHelper.siteIDs[communityId];
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
}
@ -42,8 +40,8 @@ export class OpenaireDepositPublicationsComponent {
this.route.queryParams.subscribe(params => {
var communityId = params['communityId'];
if(!communityId){
communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId) {

View File

@ -39,8 +39,8 @@ export class OpenaireDepositPublicationsResultComponent {
this.route.queryParams.subscribe(params => {
var communityId = params['communityId'];
if(!communityId){
communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId) {

View File

@ -51,8 +51,8 @@ export class ShareInZenodoComponent {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
if(this.communityId) {

View File

@ -26,8 +26,8 @@ export class HtmlPageComponent {
this.route.queryParams.subscribe(
params => {
this.communityId = params['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
if(!this.communityId){
this.communityId = this.properties.adminToolsCommunity;

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@ -8,9 +9,13 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireDataProviderComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,9 +8,13 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireDatasetComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,11 +8,16 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireHtmlProjectReportComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {
}

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,11 +8,16 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireOrganizationComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {
}

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@ -9,11 +10,16 @@ import {ConnectHelper} from '../../openaireLibrary/connect/co
export class OpenaireOrpComponent {
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {
}

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,9 +8,13 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireProjectComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,11 +8,16 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenairePublicationComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {
}

View File

@ -1,4 +1,5 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
@ -7,11 +8,16 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireSoftwareComponent{
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
}
ngOnInit() {
}

View File

@ -20,17 +20,23 @@ export class OpenaireAdvancedSearchDatasetsComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
this.route.data
.subscribe((data: { envSpecific: any }) => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
}
});
}
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -17,18 +17,24 @@ export class OpenaireAdvancedSearchOrpsComponent {
piwikSiteId = null;
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
}
});
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
}
});
}
});
}
}

View File

@ -18,17 +18,23 @@ export class OpenaireAdvancedSearchPublicationsComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
this.route.data
.subscribe((data: { envSpecific: any }) => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
}
});
}
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -18,17 +18,23 @@ export class OpenaireAdvancedSearchSoftwareComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
this.route.data
.subscribe((data: { envSpecific: any }) => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
}
});
}
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -15,18 +15,24 @@ export class OpenaireSearchComponent{
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
if(communityId){
this.connectCommunityId = communityId
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}

View File

@ -57,8 +57,7 @@ export class OpenaireSearchDataprovidersComponent {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
}
public ngOnInit() {
@ -69,9 +68,10 @@ export class OpenaireSearchDataprovidersComponent {
//this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);

View File

@ -21,17 +21,24 @@ export class OpenaireSearchDatasetsComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -1,4 +1,6 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@ -14,9 +16,26 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
})
export class OpenaireSearchOrganizationsComponent {
piwikSiteId = null;
constructor ( ) {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
constructor (private route: ActivatedRoute ) {
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(communityId){
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
communityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
}
});
}
});
}
}

View File

@ -23,17 +23,24 @@ export class OpenaireSearchOrpsComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -57,8 +57,6 @@ export class OpenaireSearchProjectsComponent {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
}
public ngOnInit() {
@ -70,8 +68,9 @@ export class OpenaireSearchProjectsComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);

View File

@ -23,17 +23,24 @@ export class OpenaireSearchPublicationsComponent {
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -20,18 +20,26 @@ export class OpenaireSearchSoftwareComponent {
piwikSiteId = null;
constructor ( private route: ActivatedRoute) {
}
ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(communityId){
this.connectCommunityId = communityId
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}else{
this.route.queryParams.subscribe(data => {
if(data['communityId'] && data['communityId']!=""){
this.connectCommunityId = data['communityId'];
this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
}
});
}
});
}
}

View File

@ -97,8 +97,8 @@ export class StatisticsComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
if(this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Monitor "+ this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe();

View File

@ -82,7 +82,7 @@ export class InviteComponent implements OnInit {
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
}
this.communityIdParam = (this.properties.environment !="development" )?{}:{communityId:this.communityId};
if (this.communityId != null && this.communityId != '') {