Project

General

Profile

« Previous | Next » 

Revision 57449

[Monitor_Dashboard|Trunk]

Initial commit

View differences:

modules/uoa-monitor-portal/trunk/monitor_dashboard/webpack.server.config.js
1
// Work around for https://github.com/angular/angular-cli/issues/7200
2

  
3
const path = require('path');
4
const webpack = require('webpack');
5

  
6
module.exports = {
7
  //mode: 'none',
8
  entry: {
9
    // This is our Express server for Dynamic universal
10
    server: './server.ts',
11
    // This is an example of Static prerendering (generative)
12
    prerender: './prerender.ts'
13
  },
14
  target: 'node',
15
  resolve: { extensions: ['.ts', '.js'] },
16
  // Make sure we include all node_modules etc
17
  externals: [/(node_modules|main\..*\.js)/,],
18
  optimization: {
19
    minimize: false
20
  },
21
  output: {
22
    // Puts the output at the root of the dist folder
23
    path: path.join(__dirname, 'dist'),
24
    filename: '[name].js'
25
  },
26
  module: {
27
    rules: [
28
      { test: /\.ts$/, loader: 'ts-loader' }
29
      ,{
30
        // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
31
        // Removing this will cause deprecation warnings to appear.
32
        test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/,
33
        parser: { system: true },
34
      },
35
    ]
36
  },
37
  plugins: [
38
    new webpack.ContextReplacementPlugin(
39
      // fixes WARNING Critical dependency: the request of a dependency is an expression
40
      /(.+)?angular(\\|\/)core(.+)?/,
41
      path.join(__dirname, 'src'), // location of your src
42
      {} // a map of your routes
43
    ),
44
    new webpack.ContextReplacementPlugin(
45
      // fixes WARNING Critical dependency: the request of a dependency is an expression
46
      /(.+)?express(\\|\/)(.+)?/,
47
      path.join(__dirname, 'src'),
48
      {}
49
    )
50
  ]
51
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/angular.json
1
{
2
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
3
  "version": 1,
4
  "newProjectRoot": "projects",
5
  "projects": {
6
    "ng-universal-demo": {
7
      "root": "",
8
      "sourceRoot": "src",
9
      "projectType": "application",
10
      "architect": {
11
        "build": {
12
          "builder": "@angular-devkit/build-angular:browser",
13
          "options": {
14
            "outputPath": "dist/browser",
15
            "index": "src/index.html",
16
            "main": "src/main.ts",
17
            "tsConfig": "src/tsconfig.app.json",
18
            "polyfills": "src/polyfills.ts",
19
            "assets": [
20
              "src/assets",
21
              "src/robots.txt"
22
            ],
23
            "styles": [
24
              "src/styles.css",
25
              "node_modules/datatables.net-dt/css/jquery.dataTables.css"
26
            ],
27
            "scripts": [
28
              "node_modules/jquery/dist/jquery.js",
29
              "node_modules/datatables.net/js/jquery.dataTables.js"
30
            ]
31
          },
32
          "configurations": {
33
            "production": {
34
              "optimization": true,
35
              "outputHashing": "all",
36
              "sourceMap": false,
37
              "extractCss": true,
38
              "namedChunks": false,
39
              "aot": true,
40
              "extractLicenses": true,
41
              "vendorChunk": false,
42
              "buildOptimizer": true,
43
              "fileReplacements": [
44
                {
45
                  "replace": "src/environments/environment.ts",
46
                  "with": "src/environments/environment.prod.ts"
47
                }
48
              ]
49
            }
50
          }
51
        },
52
        "serve": {
53
          "builder": "@angular-devkit/build-angular:dev-server",
54
          "options": {
55
            "browserTarget": "ng-universal-demo:build"
56
          },
57
          "configurations": {
58
            "production": {
59
              "browserTarget": "ng-universal-demo:build:production"
60
            }
61
          }
62
        },
63
        "extract-i18n": {
64
          "builder": "@angular-devkit/build-angular:extract-i18n",
65
          "options": {
66
            "browserTarget": "ng-universal-demo:build"
67
          }
68
        },
69
        "test": {
70
          "builder": "@angular-devkit/build-angular:karma",
71
          "options": {
72
            "main": "src/test.ts",
73
            "karmaConfig": "./karma.conf.js",
74
            "polyfills": "src/polyfills.ts",
75
            "tsConfig": "src/tsconfig.spec.json",
76
            "scripts": [
77
              "node_modules/jquery/dist/jquery.js",
78
              "node_modules/datatables.net/js/jquery.dataTables.js"
79
            ],
80
            "styles": [
81
              "src/styles.css",
82
              "node_modules/datatables.net-dt/css/jquery.dataTables.css"
83
            ],
84
            "assets": [
85
              "src/assets",
86
              "src/robots.txt"
87
            ]
88
          }
89
        },
90
        "lint": {
91
          "builder": "@angular-devkit/build-angular:tslint",
92
          "options": {
93
            "tsConfig": [
94
              "src/tsconfig.app.json",
95
              "src/tsconfig.spec.json"
96
            ],
97
            "exclude": [
98
              "**/node_modules/**"
99
            ]
100
          }
101
        },
102
        "server": {
103
          "builder": "@angular-devkit/build-angular:server",
104
          "options": {
105
            "outputPath": "dist/server",
106
            "main": "src/main.server.ts",
107
            "tsConfig": "src/tsconfig.server.json"
108
          },
109
          "configurations": {
110
            "production": {
111
              "fileReplacements": [
112
                {
113
                  "replace": "src/environments/environment.ts",
114
                  "with": "src/environments/environment.prod.ts"
115
                }
116
              ]
117
            }
118
          }
119
        }
120
      }
121
    },
122
    "ng-universal-demo-e2e": {
123
      "root": "e2e",
124
      "sourceRoot": "e2e",
125
      "projectType": "application",
126
      "architect": {
127
        "e2e": {
128
          "builder": "@angular-devkit/build-angular:protractor",
129
          "options": {
130
            "protractorConfig": "./protractor.conf.js",
131
            "devServerTarget": "ng-universal-demo:serve"
132
          }
133
        },
134
        "lint": {
135
          "builder": "@angular-devkit/build-angular:tslint",
136
          "options": {
137
            "tsConfig": [
138
              "e2e/tsconfig.e2e.json"
139
            ],
140
            "exclude": [
141
              "**/node_modules/**"
142
            ]
143
          }
144
        }
145
      }
146
    }
147
  },
148
  "defaultProject": "ng-universal-demo",
149
  "schematics": {
150
    "@schematics/angular:class": {
151
      "spec": false
152
    },
153
    "@schematics/angular:component": {
154
      "spec": false,
155
      "inlineStyle": true,
156
      "inlineTemplate": true,
157
      "prefix": "app",
158
      "styleext": "css"
159
    },
160
    "@schematics/angular:directive": {
161
      "spec": false,
162
      "prefix": "app"
163
    },
164
    "@schematics/angular:guard": {
165
      "spec": false
166
    },
167
    "@schematics/angular:module": {
168
      "spec": false
169
    },
170
    "@schematics/angular:pipe": {
171
      "spec": false
172
    },
173
    "@schematics/angular:service": {
174
      "spec": false
175
    }
176
  }
177
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/package.json
1
{
2
  "name": "openaire-monitor",
3
  "version": "1.0.0",
4
  "license": "Openaire",
5
  "contributors": [
6
    "Argiro Kokogiannaki <argirok@di.uoa.gr>",
7
    "Konstantina Galouni <kgalouni@di.uoa.gr>"
8
  ],
9
  "scripts": {
10
    "ng": "ng",
11
    "start": " ng serve --port 4600 --disable-host-check --host 0.0.0.0",
12
    "start:ssr": "npm run build:ssr && npm run serve:ssr",
13
    "start:prerender": "npm run build:prerender && npm run serve:prerender",
14
    "build": "ng build",
15
    "build:client-and-server-bundles": "ng build --prod --sourceMap --stats-json=true && ng run ng-universal-demo:server:production",
16
    "build:prerender": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:prerender",
17
    "build:ssr": "npm run build:client-and-server-bundles  && npm run webpack:server",
18
    "generate:prerender": "cd dist && node prerender",
19
    "webpack:server": "webpack --config webpack.server.config.js --progress --colors",
20
    "serve:prerender": "cd dist/browser && http-server",
21
    "serve:ssr": "node dist/server"
22
  },
23
  "private": true,
24
  "dependencies": {
25
    "@angular/animations": "^7.2.14",
26
    "@angular/cdk": "^7.3.7",
27
    "@angular/common": "7.2.14",
28
    "@angular/compiler": "7.2.14",
29
    "@angular/core": "7.2.14",
30
    "@angular/forms": "7.2.14",
31
    "@angular/http": "7.2.14",
32
    "@angular/material": "^7.3.7",
33
    "@angular/platform-browser": "7.2.14",
34
    "@angular/platform-browser-dynamic": "7.2.14",
35
    "@angular/platform-server": "7.2.14",
36
    "@angular/router": "7.2.14",
37
    "@nguniversal/express-engine": "^6.0.0",
38
    "@nguniversal/module-map-ngfactory-loader": "^6.0.0",
39
    "@types/express": "^4.16.1",
40
    "angular-datatables": "^4.4.1",
41
    "citation-js": "^0.3.4",
42
    "clipboard": "^1.5.16",
43
    "core-js": "^2.4.1",
44
    "datatables.net": "^1.10.19",
45
    "datatables.net-dt": "^1.10.19",
46
    "jquery": "^3.4.1",
47
    "ngx-json-ld": "0.1.6",
48
    "prom-client": "^11.3.0",
49
    "ts-md5": "^1.2.0",
50
    "tslib": "^1.9.0",
51
    "wikidata-sdk": "^5.2.9",
52
    "zone.js": "^0.8.26",
53
    "ng-recaptcha": "^3.0.5",
54
    "ng2-ckeditor": "1.1.9"
55
  },
56
  "devDependencies": {
57
    "@angular-devkit/build-angular": "~0.13.0",
58
    "@angular/cli": "^7.3.9",
59
    "@angular/compiler-cli": "7.2.14",
60
    "@angular/language-service": "7.2.14",
61
    "@types/datatables.net": "^1.10.17",
62
    "@types/jquery": "^3.3.29",
63
    "@types/node": "^8.0.30",
64
    "cpy-cli": "^1.0.1",
65
    "http-server": "^0.10.0",
66
    "reflect-metadata": "^0.1.10",
67
    "rxjs": "6.5.1",
68
    "rxjs-compat": "^6.5.1",
69
    "ts-loader": "^4.2.0",
70
    "typescript": "3.2.4",
71
    "webpack-cli": "^3.3.2"
72
  }
73
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/tsconfig.json
1
{
2
  "compileOnSave": false,
3
  "compilerOptions": {
4
    "importHelpers": true,
5
    "outDir": "./dist/out-tsc",
6
    "sourceMap": true,
7
    "declaration": false,
8
    "moduleResolution": "node",
9
    "emitDecoratorMetadata": true,
10
    "experimentalDecorators": true,
11
    "target": "es5",
12
    "typeRoots": [
13
      "node_modules/@types"
14
    ],
15
    "lib": [
16
      "es2017",
17
      "dom"
18
    ],
19
    "module": "es2015",
20
    "baseUrl": "./"
21
  }
22
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/subscribe.component.ts
1
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
2
import {ActivatedRoute, Router} from '@angular/router';
3
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
4
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
5

  
6
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
7
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
8
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
9
import {Session, User} from '../../openaireLibrary/login/utils/helper.class';
10

  
11
import {Email} from "../../openaireLibrary/utils/email/email";
12
import {Composer} from "../../openaireLibrary/utils/email/composer";
13
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
14
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
15

  
16
declare var UIkit: any;
17

  
18
@Component({
19
  selector: 'subscribe',
20
  template: `
21

  
22
    <span *ngIf="subscribed != null && !showNumbers && showTemplate">
23
      <div *ngIf="!subscribed && showLoginAlert" class="uk-alert-warning uk-animation-slide-bottom" uk-alert="">
24
      <a class="uk-alert-close" uk-close></a>
25
      <p>Please login first to subscribe</p>
26
      </div>
27
      <button *ngIf="!subscribed" [class]="'uk-button uk-button-primary' + (loading ? ' uk-disabled' : '')"
28
              (click)="subscribe()"> Subscribe</button>
29
      <button *ngIf="subscribed" [class]="'uk-button uk-button-primary' + (loading ? ' uk-disabled' : '')"
30
              (click)="confirmOpen()"> Unsubscribe</button>
31
    </span>
32

  
33
    <span *ngIf="showNumbers && subscribers !=null && subscribers > 0  && showTemplate">
34
      <span class="lowOpacityColor">  Members</span> {{subscribers}}
35
    </span>
36
    <modal-alert (alertOutput)="confirmClose($event)">
37
    </modal-alert>
38
  `
39
})
40

  
41
export class SubscribeComponent {
42
  // @Input() showSubscribe:boolean = true;
43
  @Input() showNumbers: boolean;
44
  @Input() communityId: string;
45
  @Input() showTemplate: boolean = true;
46
  @Output() subscribeEvent = new EventEmitter();
47

  
48
  public community = null;
49
  public emailToInformManagers: Email;
50

  
51
  loading: boolean = false;
52
  subscribed: boolean = null;
53
  properties: EnvProperties;
54
  subscribers: number = null;
55
  showLoginAlert: Boolean = false;
56
  @ViewChild(AlertModal) alert;
57
  private user: User;
58

  
59
  constructor(private route: ActivatedRoute,
60
              private _subscribeService: SubscribeService,
61
              private _emailService: EmailService,
62
              private _communityService: CommunityService,
63
              private router: Router,
64
              private userManagementService: UserManagementService
65
  ) {
66
  }
67

  
68
  public ngOnInit() {
69
    this.route.data
70
      .subscribe((data: { envSpecific: EnvProperties }) => {
71
        this.properties = data.envSpecific;
72
        this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe( user => {
73
          this.user = user;
74
          if (!this.showNumbers) {
75
            let email = (this.user)?this.user.email:null;
76
            if (email == null) {
77
              this.subscribed = false;
78
            } else {
79
              if (this.communityId) {
80
                this._subscribeService.isSubscribedToCommunity(this.properties, this.communityId, email).subscribe(
81
                  res => {
82
                    this.subscribed = res;
83
                    if (this.subscribed) {
84
                      this.subscribeEvent.emit({
85
                        value: "ok"
86
                      });
87
                    }
88
                  },
89
                  error => {
90
                    this.handleError("Error getting response if email: " + email + " is subscribed to community with id: " + this.communityId, error);
91
                  });
92
              }
93
            }
94
          } else {
95
            if (this.communityId) {
96
              this._subscribeService.getCommunitySubscribers(this.properties, this.communityId).subscribe(
97
                res => {
98
                  this.subscribers = (res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0;
99
                },
100
                error => {
101
                  this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
102
                });
103
            }
104
          }
105
          if (this.communityId) {
106
            this.emailToInformManagers = {body: "", subject: "", recipients: []};
107

  
108
            this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
109
              community => {
110
                this.community = community;
111
              },
112
              error => {
113
                //console.log('System error retrieving community profile', error)
114
                this.handleError("Error getting community with id: " + this.communityId, error);
115
              }
116
            );
117
          }
118
        });
119
      });
120
  }
121

  
122
  subscribe() {
123
    var email = (this.user)?this.user.email:null;
124
    if (email == null) {
125
      this.subscribed = false;
126
      // this.showLoginAlert = true;
127
      this.router.navigate(['/user-info'], {
128
        queryParams: {
129
          "errorCode": LoginErrorCodes.ACTION_REQUIRES_LOGIN,
130
          "redirectUrl": this.router.url
131
        }
132
      });
133
    } else {
134
      this.loading = true;
135
      this.showLoginAlert = false;
136
      this._subscribeService.subscribeToCommunity(this.communityId, email, this.properties.adminToolsAPIURL).subscribe(
137
        res => {
138
          this.loading = false;
139
          if (res.status && res.status != 200) {
140
            this.subscribeEvent.emit({
141
              value: "error"
142
            });
143
            UIkit.notification({
144
              message: '<strong>An error occured. Please try again!<strong>',
145
              status: 'warning',
146
              timeout: 3000,
147
              pos: 'top-center'
148
            });
149
          } else {
150
            if (!this.subscribed) {
151
              this.subscribed = true;
152
              this.subscribeEvent.emit({
153
                value: "ok"
154
              });
155
              this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, email)).subscribe(
156
                res => {
157
                  //console.log("The email has been sent successfully!")
158
                },
159
                error => {
160
                  //console.log(error)
161
                  this.handleError("Error notifying managers about new subscribers for community with id: " + this.communityId, error);
162
                }
163
              );
164
            }
165
          }
166
        },
167
        error => {
168
          this.loading = false;
169
          this.subscribeEvent.emit({
170
            value: "error"
171
          });
172
          UIkit.notification({
173
            message: '<strong>An error occured. Please try again!<strong>',
174
            status: 'warning',
175
            timeout: 3000,
176
            pos: 'top-center'
177
          });
178
          //console.log(error)
179
          this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error);
180
        });
181
    }
182
  }
183

  
184
  unsubscribe() {
185
    var email = (this.user)?this.user.email:null;
186
    if (email == null) {
187
      this.subscribed = false;
188
    } else {
189
      this.loading = true;
190
      //this.properties.adminToolsAPIURL
191
      this._subscribeService.unSubscribeToCommunity(this.communityId, email, this.properties.adminToolsAPIURL).subscribe(
192
        res => {
193
          this.loading = false;
194
          if (res.status && res.status != 200) {
195
            UIkit.notification({
196
              message: '<strong>An error occured. Please try again!<strong>',
197
              status: 'warning',
198
              timeout: 3000,
199
              pos: 'top-center'
200
            });
201
          } else {
202
            //console.log(res);
203
            if (this.subscribed) {
204
              console.log('here')
205
              this.subscribed = false;
206
            }
207
          }
208
        },
209
        error => {
210
          this.loading = false;
211
          UIkit.notification({
212
            message: '<strong>An error occured. Please try again!<strong>',
213
            status: 'warning',
214
            timeout: 3000,
215
            pos: 'top-center'
216
          });
217
          //console.log(error)
218
          this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
219
        });
220
    }
221
  }
222

  
223
  confirmOpen() {
224

  
225
    this.alert.cancelButton = true;
226
    this.alert.okButton = true;
227
    this.alert.alertTitle = "Unsubscribe community ";
228
    this.alert.message = "Do you want to proceed? ";
229
    this.alert.okButtonText = "Yes";
230
    this.alert.cancelButtonText = "No";
231
    this.alert.open();
232
  }
233

  
234
  confirmClose(data) {
235
    this.unsubscribe();
236
  }
237

  
238
  private handleError(message: string, error) {
239
    console.error("Subscribe (component): " + message, error);
240
  }
241
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/subscribe.module.ts
1
import {ModuleWithProviders, NgModule} from '@angular/core';
2
import {CommonModule} from '@angular/common';
3
import {RouterModule} from '@angular/router';
4

  
5
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
6
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
7

  
8
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
9
import {SubscribeComponent} from './subscribe.component';
10
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
11

  
12
@NgModule({
13
  imports: [
14
    CommonModule, RouterModule, AlertModalModule
15
  ],
16
  declarations: [
17
    SubscribeComponent
18
  ],
19
  exports: [
20
    SubscribeComponent
21
  ]
22
})
23
export class SubscribeModule {
24
  static forRoot(): ModuleWithProviders {
25
    return {
26
      ngModule: SubscribeModule,
27
      providers: [
28
        SubscribeService, EmailService, CommunityService
29
      ]
30
    }
31
  }
32
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.component.html
1
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
2

  
3
<div *ngIf="longView == true">
4
  <div class="uk-section uk-padding-remove-top tm-middle uk-container" id="tm-main">
5

  
6
    <div class="uk-container  uk-margin-bottom">
7
      <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
8
              [texts]="pageContents['top']"></helper>
9
      <div id="invite" class=" uk-card uk-card-default uk-padding uk-margin-top">
10
        <div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Invite users to subscribe</div>
11
        <div class="uk-margin-top">
12
          <errorMessages [status]="[status]" [type]="'community'"></errorMessages>
13
        </div>
14
        <div *ngIf="missingCommunityId" class="uk-alert uk-alert-warning" role="alert">{{missingCommunityId}}</div>
15
        <div *ngIf="successfulSentMessage" class="uk-alert uk-alert-success"
16
             role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div>
17
        <div *ngIf="failureSentMessage" class="uk-alert uk-alert-warning"
18
             role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div>
19
        <div *ngIf="inviteErrorMessage" class="uk-alert uk-alert-warning" role="alert">{{inviteErrorMessage}}</div>
20
        <div *ngIf="communityId != null && status == errorCodes.DONE">
21
          <table class="uk-table uk-align-center">
22
            <tbody>
23
            <!-- <tr>
24
                <td>
25
                </td>
26
                <td>
27
                    <li>Invite by email</li>
28
                </td>
29
            </tr> -->
30
            <tr>
31
              <td for="from" class="uk-text-bold uk-width-1-4 uk-text-right">From <span
32
                class="uk-text-danger uk-text-bold">*</span> :
33
              </td>
34
              <td class="uk-text-left uk-width-expand">
35
                <input placeholder="Type your name" type="text" (click)="resetMessages()"
36
                       class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="body.fromName"
37
                       id="from" required>
38
                <div *ngIf="!body.fromName" class="uk-width-large uk-text-danger uk-text-small">Please add your name.
39
                </div>
40
              </td>
41
            </tr>
42
            <tr>
43
              <td for="recipients" class="uk-text-bold uk-text-right">To <span
44
                class="uk-text-danger uk-text-bold">*</span> :
45
              </td>
46
              <td class="uk-text-left">
47
                <input placeholder="email" type="text" (click)="resetMessages(); areValid=true"
48
                       class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="recipients"
49
                       id="recipients"
50
                       required>
51
                <div *ngIf="areValid && !showAddRecipientMessage" class="uk-width-medium uk-text-muted uk-text-small">
52
                  separate multiple emails with a comma
53
                </div>
54
                <div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small">Please add
55
                  valid email/s.
56
                </div>
57
                <div *ngIf="isEmpty(recipients) && showAddRecipientMessage"
58
                     class="uk-width-large uk-text-danger uk-text-small">Please add a recipient.
59
                </div>
60
              </td>
61
            </tr>
62
            </tbody>
63
          </table>
64
          <div class="boundary-align uk-panel uk-placeholder">
65

  
66
            <table class="uk-table uk-align-center">
67
              <tbody>
68
              <!-- <tr>
69
                 <td class="uk-text-bold uk-width-1-4@xl uk-width-1-4@m uk-width-1-4@s uk-text-right"></td>
70
                 <td class="uk-text-left">
71
                      <{{body.salutation}}<br>-->
72
              <!-- <span *ngIf="body.fromName == ''" class="uk-text-muted">
73
                      <i>{{body.fromMessage}}...</i>
74
              </span>
75
              <span *ngIf="body.fromName !=''">
76
                      {{body.fromMessage}}
77
                      <b>{{body.fromName}}</b>
78
              </span>
79
         </td>
80
      </tr> -->
81
              <tr>
82
                <td for="email.body" class="uk-text-bold uk-text-right">Message:</td>
83
                <td *ngIf="allowEdit()" class="uk-text-left">
84
                  <ckeditor (click)="resetMessages()"
85
                            class="form-control" [(ngModel)]="body.paragraphs" id="message"
86
                            debounce="400"
87
                            [config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]', removeButtons: 'Save,NewPage,DocProps,Preview,Print',
88
                                                                   extraPlugins: 'divarea'}">
89
                    <!-- <id="contentTag"-->
90
                    <!--(ready)="onReady($event)"-->
91
                    <!--(focus)="onFocus($event)"-->
92
                    <!--[config]="{uiColor: '#99000'}"-->
93
                    <!--(blur)="onBlur($event)"-->
94
                    <!--(change)="onChange($event)"-->
95
                  </ckeditor>
96
                </td>
97
                <td *ngIf="!allowEdit()" class="uk-text-left">
98

  
99
                  <div [innerHtml]="body.paragraphs"></div>
100
                </td>
101
              </tr>
102
              <tr>
103
                <td></td>
104
                <td class="uk-text-left">
105
                  <!-- {{body.closing}}<br> -->
106
                  {{body.signature}}
107
                  <span *ngIf="body.fromName == ''" class="uk-text-muted">
108
                                                        <i>{{body.fromMessage}}...</i>
109
                                                </span>
110
                  <span *ngIf="body.fromName !=''">
111
                                                        {{body.fromMessage}}
112
                    <b>{{body.fromName}}</b>
113
                                                </span>
114
                  <br><a href="https://www.openaire.eu">www.openaire.eu</a>
115
                </td>
116
              </tr>
117
              </tbody>
118
            </table>
119
          </div>
120
          <table class="uk-table uk-align-center">
121
            <tbody>
122
            <tr>
123
              <td class="uk-text-bold uk-width-3-5@xl uk-width-3-5@m uk-width-3-5@s uk-text-right"></td>
124
              <td>
125
                <div class="uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-text-danger uk-text-bold">*
126
                  Required fields
127
                </div>
128
              </td>
129
            </tr>
130
            <tr>
131
              <td class="uk-text-right"></td>
132
              <td>
133
                <div
134
                  class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom">
135
                  <button class="uk-button portal-button" (click)="invite()">Invite</button>
136
                </div>
137
              </td>
138
            </tr>
139
            </tbody>
140
          </table>
141

  
142
          <div class="uk-text-left">
143
            <span uk-icon="chevron-left"></span><span class="uk-margin-small-left">
144
                                        <a [queryParams]="communityIdParam" routerLinkActive="router-link-active"
145
                                           routerLink="/">Back</a>
146
                                </span>
147
          </div>
148

  
149
        </div>
150
      </div>
151
      <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
152
              [texts]="pageContents['bottom']"></helper>
153
    </div>
154
  </div>
155
</div>
156
<div class="uk-inline">
157
  <button *ngIf="!longView" [class]=" ((buttonSizeSmall)?'uk-button-small':'') + ' uk-button  uk-button-primary'">
158
    Invite users
159
  </button>
160
  <div uk-dropdown="mode: click" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage">
161
    <div class="uk-margin-top">
162
      <errorMessages [status]="[status]" [type]="'community'"></errorMessages>
163
    </div>
164
    <div *ngIf="missingCommunityId" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
165
         role="alert">{{missingCommunityId}}</div>
166
    <div *ngIf="successfulSentMessage" class="uk-width-large uk-text-success uk-text-small uk-margin-top"
167
         role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div>
168
    <div *ngIf="failureSentMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
169
         role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div>
170
    <div *ngIf="inviteErrorMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
171
         role="alert">{{inviteErrorMessage}}</div>
172

  
173
    <div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add
174
      valid email/s.
175
    </div>
176
    <div *ngIf="isEmpty(recipients) && showAddRecipientMessage"
177
         class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add a recipient.
178
    </div>
179
    <input (click)="resetMessages(); areValid=true" placeholder="Type e-mails" type="text"
180
           class="form-control uk-input uk-form-small uk-form" [(ngModel)]="recipients" id="recipients"
181
           required>
182
    <div class="uk-width-medium uk-text-muted uk-text-small">separate with commas</div>
183
    <div class="uk-margin-small-top uk-text-center ">
184
      <button class=" uk-button portal-button ignoreCommunityPanelBackground uk-button-small " (click)="invite()">Invite</button>
185
      {{" "}}
186
      <a class=" uk-button uk-button-default uk-button-small ignoreCommunityPanelBackground " [queryParams]="communityIdParam"
187
         routerLinkActive="router-link-active" routerLink="/invite">
188
                        <span class="uk-margin-xsmall-left uk-icon">
189
                            <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="cog"
190
                                 ratio="0.8"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path
191
                              fill="none" stroke="#000"
192
                              d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
193

  
194
                          </span>
195
        Customize
196
      </a>
197
    </div>
198
  </div>
199
</div>
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.component.ts
1
import {Component, Input, OnInit} from '@angular/core';
2
import {FormBuilder} from "@angular/forms";
3
import {ActivatedRoute, Router} from '@angular/router';
4

  
5
import {ConnectHelper} from '../../../openaireLibrary/connect/connectHelper';
6

  
7
import {Email} from '../../../openaireLibrary/utils/email/email';
8
import {Body} from '../../../openaireLibrary/utils/email/body';
9
import {Validator} from '../../../openaireLibrary/utils/email/validator';
10
import {Composer} from '../../../openaireLibrary/utils/email/composer';
11

  
12
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
13
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
14
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
15
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
16
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
17
import {Session, User} from '../../../openaireLibrary/login/utils/helper.class';
18
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
19
import {HelperService} from "../../../openaireLibrary/utils/helper/helper.service";
20
import {Meta, Title} from "@angular/platform-browser";
21
import {SEOService} from "../../../openaireLibrary/sharedComponents/SEO/SEO.service";
22
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
23
import {PiwikHelper} from "../../piwikHelper";
24
import {UserManagementService} from "../../../openaireLibrary/services/user-management.service";
25

  
26
@Component({
27
  selector: 'invite',
28
  templateUrl: './invite.component.html',
29
})
30

  
31
export class InviteComponent implements OnInit {
32

  
33
  @Input() longView: boolean = true;
34
  @Input() communityId = null;
35
  @Input() buttonSizeSmall = true;
36

  
37
  private properties: EnvProperties = null;
38

  
39
  public community = null;
40
  //public showLoading: boolean = true;
41
  public errorMessage: string = '';
42
  public successfulSentMessage: string = '';
43
  public successfulSentRecipients: string[] = [];
44
  public failureSentMessage: string = '';
45
  public failureSentRecipients: string[] = [];
46
  public inviteErrorMessage: string = '';
47
  public missingCommunityId: string = '';
48
  public showAddRecipientMessage: boolean = false;
49
  public showAddNameMessage: boolean = false;
50

  
51
  public email: Email;
52
  public body: Body;
53
  public recipients: string;
54
  public fullname: string;
55

  
56
  public areValid: boolean = true;
57

  
58
  private ckeditorContent: string;
59

  
60
  // public defaultBody ='';
61

  
62
  public communityIdParam = {};
63
  public status: number = 1;
64
  public errorCodes: ErrorCodes;
65
  private errorMessages: ErrorMessagesComponent;
66
  public pageContents = null;
67
  public divContents = null;
68

  
69
  public url: string = null;
70
  public pageTitle: string = "Invite";
71
  piwiksub: any;
72
  private user: User;
73

  
74
  constructor(
75
    private route: ActivatedRoute,
76
    private _router: Router,
77
    public _fb: FormBuilder,
78
    private _emailService: EmailService,
79
    private _communityService: CommunityService,
80
    private helper: HelperService,
81
    private _meta: Meta,
82
    private _title: Title,
83
    private seoService: SEOService,
84
    private _piwikService: PiwikService,
85
    private userManageService: UserManagementService) {
86

  
87
    this.errorCodes = new ErrorCodes();
88
    this.errorMessages = new ErrorMessagesComponent();
89
    this.status = this.errorCodes.LOADING;
90
  }
91

  
92
  public ngOnInit() {
93
    this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
94
      this.properties = data.envSpecific;
95
      this.errorMessage = "";
96
      this.missingCommunityId = "";
97
      this.status = this.errorCodes.LOADING;
98
      this.userManageService.getUserInfo(this.properties.userInfoUrl).subscribe(user => {
99
        this.user = user;
100
        this.route.queryParams.subscribe(
101
          communityId => {
102
            //if(!this.communityId && typeof document !== 'undefined'){
103
            this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
104
            if (!this.communityId) {
105
              this.communityId = communityId['communityId'];
106
            }
107

  
108
            if (this.longView) {
109
              if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
110
                this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe();
111
              }
112
              this.url = this.properties.baseLink + this._router.url;
113
              this.seoService.createLinkForCanonicalURL(this.url);
114
              this.updateUrl(this.url);
115
              this.updateTitle(this.pageTitle);
116
              this.updateDescription("OpenAIRE - Connect, Community Gateway, research community, invite");
117
            }
118
            this.communityIdParam = (this.properties.environment != "development") ? {} : {communityId: this.communityId};
119
            if (this.communityId != null && this.communityId != '') {
120
              //this.getDivContents();
121
              this.getPageContents();
122
              this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
123
                community => {
124
                  this.community = community;
125
                  this.fullname = this.user.fullname;
126
                  //console.log("Fullname from session " + Session.getUserFullName());
127

  
128
                  this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
129
                  this.email = Composer.initializeInvitationsEmail(community.title);
130
                  this.recipients = "";
131

  
132
                  this.status = this.errorCodes.DONE;
133
                },
134
                error => {
135
                  //this.handleError(error)
136
                  this.handleError("Error getting community with id: " + this.communityId, error);
137
                  this.status = this.errorMessages.getErrorCode(error.status);
138
                }
139
              );
140
            } else {
141
              this.status = this.errorCodes.DONE;
142
              this.missingCommunityId = "There is no community selected!";
143
            }
144

  
145
          });
146

  
147
        HelperFunctions.scroll();
148
      });
149
    });
150
  }
151

  
152
  ngOnDestroy() {
153
    if (this.piwiksub) {
154
      this.piwiksub.unsubscribe();
155
    }
156
  }
157

  
158
  private getPageContents() {
159
    this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
160
      this.pageContents = contents;
161
    })
162
  }
163

  
164
  private getDivContents() {
165
    this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
166
      this.divContents = contents;
167
    })
168
  }
169

  
170

  
171
  public invite() {
172
    this.successfulSentMessage = "";
173
    this.failureSentMessage = "";
174
    this.inviteErrorMessage = "";
175
    this.status = this.errorCodes.LOADING;
176
    HelperFunctions.scroll();
177
    if (!this.isEmpty(this.recipients) && this.body.fromName != "") {
178
      if (this.validateEmails()) {
179
        this.composeEmail();
180

  
181
        this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", this.email).subscribe(
182
          res => {
183
            this.status = this.errorCodes.DONE;
184
            //console.log("Emails Sent: ",res);
185
            /*if(res == 0) {
186

  
187
            } else if(res > 1) {
188
              this.successfulSentMessage = res + " emails sent successfully!";
189
            } else {
190
              this.successfulSentMessage = res + " email sent successfully!";
191
            }*/
192

  
193
            if (res['success']) {
194
              this.successfulSentMessage = "Email sent successfully to: ";
195
              this.successfulSentRecipients = res['success'];
196
            }
197
            if (res['failure']) {
198
              this.failureSentMessage = "There was an error sending email to: ";
199
              this.failureSentRecipients = res['failure'];
200
            }
201

  
202
            this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
203
            this.email = Composer.initializeInvitationsEmail(this.community.title);
204
            this.recipients = "";
205
          },
206
          error => {
207
            //console.log(error);
208
            this.handleError("Error inviting emails: " + JSON.stringify(this.recipients) + " to community with id: " + this.communityId + " by: " + this.fullname, error);
209
            this.status = this.errorCodes.DONE;
210
            this.inviteErrorMessage = "There was an error sending emails. Please try again.";
211
          }
212
        );
213
      } else {
214
        this.email.recipients = [];
215
        this.status = this.errorCodes.DONE;
216
      }
217
    } else {
218
      this.showAddRecipientMessage = true;
219
      this.status = this.errorCodes.DONE;
220
    }
221
  }
222

  
223
  public isEmpty(data: string): boolean {
224
    if (data != undefined && !data.replace(/\s/g, '').length)
225
      return true;
226
    else
227
      return false;
228
  }
229

  
230
  public resetMessages() {
231
    this.errorMessage = "";
232
    this.successfulSentMessage = "";
233
    this.failureSentMessage = "";
234
    this.inviteErrorMessage = "";
235
  }
236

  
237
  public validateEmails(): boolean {
238
    if (this.parseEmails()) {
239
      if (Validator.hasValidEmails(this.email.recipients)) {
240
        return this.areValid;
241
      }
242
    }
243
    this.areValid = false;
244
    return this.areValid;
245
  }
246

  
247
  public parseEmails(): boolean {
248
    let email = new Array<string>();
249

  
250
    // remove spaces
251
    this.recipients = this.recipients.replace(/\s/g, '');
252

  
253
    // remove commas
254
    email = this.recipients.split(",");
255

  
256
    // remove empty fields
257
    for (let i = 0; i < email.length; i++) {
258
      if (!(email[i] == "")) {
259
        this.email.recipients.push(email[i]);
260
      }
261
    }
262
    return true;
263
  }
264

  
265
  public composeEmail() {
266
    this.email.body = Composer.formatEmailBodyForInvitation(this.body);
267
  }
268

  
269
  /*
270
    public handleError(error) {
271
      if(error.status == '401') {
272
        this.status = this.errorCodes.FORBIDDEN;
273
      } else if(error.status == '403') {
274
        this.status = this.errorCodes.FORBIDDEN;
275
      } else if(error.status == '404') {
276
        this.status = this.errorCodes.NOT_FOUND;
277
      } else if(error.status == '500') {
278
        this.status = this.errorCodes.ERROR;
279
      } else {
280
        this.status = this.errorCodes.NOT_AVAILABLE;
281
      }
282
        console.log('Server responded: ' + error);
283
    }
284
  */
285
  allowEdit() {
286
    if (!this.user) {
287
      return false;
288
    }
289
    var email = this.user.email;
290
    var index = -1;
291
    if (email && this.community != null && this.community.managers != null) {
292
      index = this.community.managers.indexOf(email);
293
    }
294
    return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
295
  }
296

  
297
  private handleError(message: string, error) {
298
    console.error("Invite Page (or component): " + message, error);
299
  }
300

  
301
  private updateDescription(description: string) {
302
    this._meta.updateTag({content: description}, "name='description'");
303
    this._meta.updateTag({content: description}, "property='og:description'");
304
  }
305

  
306
  private updateTitle(title: string) {
307
    var _title = ((title.length > 50) ? title.substring(0, 50) : title);
308
    this._title.setTitle(_title);
309
    this._meta.updateTag({content: _title}, "property='og:title'");
310
  }
311

  
312
  private updateUrl(url: string) {
313
    this._meta.updateTag({content: url}, "property='og:url'");
314
  }
315
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite.module.ts
1
import {NgModule}                   from '@angular/core';
2
import {CommonModule}               from '@angular/common';
3
import {FormsModule}                from '@angular/forms';
4
import {RouterModule}               from '@angular/router';
5
import {CKEditorModule}             from 'ng2-ckeditor';
6

  
7
import {InviteComponent}            from './invite.component';
8
import {InviteRoutingModule}        from './invite-routing.module';
9

  
10
import {PreviousRouteRecorder}      from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
11

  
12
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard';
13
import {EmailService}               from '../../../openaireLibrary/utils/email/email.service';
14
import {CommunityService}           from '../../../openaireLibrary/connect/community/community.service';
15
import {ErrorMessagesModule}        from '../../../openaireLibrary/utils/errorMessages.module';
16
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
17
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
18
import {Schema2jsonldModule} from "../../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
19
import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module";
20
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
21

  
22
@NgModule({
23
  imports: [
24
    CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule,
25
    HelperModule, Schema2jsonldModule, SEOServiceModule
26
  ],
27
  declarations: [
28
    InviteComponent
29
  ],
30
  providers: [
31
    LoginGuard, PreviousRouteRecorder,
32
    EmailService, CommunityService, IsRouteEnabled,
33
    PiwikService
34
  ],
35
  exports: [
36
    InviteComponent
37
  ]
38
})
39

  
40
export class InviteModule { }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/subscribe/invite/invite-routing.module.ts
1
import {NgModule} from '@angular/core';
2
import {RouterModule} from '@angular/router';
3

  
4
import {InviteComponent} from './invite.component';
5
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard';
6
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
7
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
8

  
9
@NgModule({
10
  imports: [
11
    RouterModule.forChild([
12
     	{ path: '', component: InviteComponent, canActivate: [LoginGuard, /*IsRouteEnabled*/], canDeactivate: [PreviousRouteRecorder] }
13

  
14
    ])
15
  ]
16
})
17
export class InviteRoutingModule { }
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/services/statistics.service.ts
1
import {Injectable} from '@angular/core';
2
import {HttpClient} from "@angular/common/http";
3
import {EnvironmentSpecificService} from "../../openaireLibrary/utils/properties/environment-specific.service";
4
import {Observable} from "rxjs";
5

  
6

  
7
@Injectable()
8
export class StatisticsService {
9

  
10
    numberSources: Map<string, string> = new Map<string, string>();
11
    chartSources: Map<string, string> = new Map<string, string>();
12

  
13
    constructor(private http:HttpClient, private environmentSpecificService: EnvironmentSpecificService) {
14
        this.environmentSpecificService.subscribeEnvironment().subscribe(properties => {
15
            this.numberSources.set('statistics', properties.statisticsAPIURL);
16
            this.numberSources.set('search', properties.searchAPIURLLAst);
17
            this.numberSources.set('metrics', properties.metricsAPIURL);
18
            this.chartSources.set('stats-tool', properties.statisticsFrameNewAPIURL);
19
            this.chartSources.set('old', properties.statisticsFrameAPIURL);
20
            this.chartSources.set('metrics', properties.metricsAPIURL);
21
            this.chartSources.set('fake', '');
22
        })
23
    }
24

  
25
    getNumbers(source: string, url: string): Observable<any> {
26
        return this.http.get<any>(this.numberSources.get(source) + url);
27
    }
28

  
29
    getChartUrl(source: string, url: string): string {
30
        return this.chartSources.get(source) + url;
31
    }
32
}
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/utils/entities/stakeholder.ts
1
export class Stakeholder {
2
  id: string;
3
  type: string;
4
  index_id;
5
  index_name: string;
6
  index_shortName:string;
7
  alias: string;
8
  isDefaultProfile: boolean;
9
  isActive: boolean;
10
  isPublic: boolean;
11
  creationDate: string;
12
  updateDate: string;
13
  managers: string[];
14
  topics:Topic[];
15
  constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
16
    this.id = id;
17
    this.type = type;
18
    this.index_id = index_id;
19
    this.index_name = index_name;
20
    this.index_shortName = index_shortName;
21
    this.isDefaultProfile = isDefaultProfile;
22
    this.alias = alias;
23
    this.isActive = isActive;
24
    this.isPublic = isPublic;
25
    this.topics =[];
26
    this.managers =[];
27
  }
28
  static createECStakeholder():Stakeholder{
29
    let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
30
    //  new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
31
    ec.topics.push(ec.createOSTopic(ec));
32
    ec.topics.push(ec.createImpactTopic());
33
    ec.topics.push(ec.createCollaborationTopic());
34
    return ec;
35
  }
36
  createOSTopic(stakeholder:Stakeholder):Topic{
37
    let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
38

  
39
/*    let overview:Category =  new Category("Overview","","overview",true,true);
40
    topic.categories.push(overview);
41
    let overviewDefSub = new SubCategory(null, null,null,true, true);
42
    overview.subCategories.push(overviewDefSub);*/
43

  
44

  
45

  
46
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
47
    topic.categories.push(pubCategory);
48
    let pubDefSub = new SubCategory(null, null,null,true, true);
49
    pubCategory.subCategories.push(pubDefSub);
50
/*    let pubOpenSub = new SubCategory("Openess","","openness",true,true);
51
    pubCategory.subCategories.push(pubOpenSub);
52
    let pubFundingSub = new SubCategory("Funding","","funding",true,true);
53
    pubCategory.subCategories.push(pubFundingSub);
54
    let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
55
    pubCategory.subCategories.push(pubDatasourceSub);
56
    let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
57
    pubCategory.subCategories.push(pubDocTypeSub);
58
    let pubFindSub = new SubCategory("Findability","","dindability",true,true);
59
    pubCategory.subCategories.push(pubFindSub);*/
60

  
61

  
62
    let dataCategory:Category =  new Category("Research data","","data",true,true);
63
    topic.categories.push(dataCategory);
64
    let dataDefSub = new SubCategory(null, null,null,true, true);
65
    dataCategory.subCategories.push(dataDefSub);
66

  
67
    let softwareCategory:Category =  new Category("Software","","software",true,true);
68
    topic.categories.push(softwareCategory);
69
    let softDefSub = new SubCategory(null, null,null,true, true);
70
    softwareCategory.subCategories.push(softDefSub);
71

  
72
    let otherCategory:Category =  new Category("Other research products","","other",true,true);
73
    topic.categories.push(otherCategory);
74
    let otherDefSub = new SubCategory(null, null,null,true, true);
75
    otherCategory.subCategories.push(otherDefSub);
76

  
77
/*    let datasourceCategory:Category =  new Category("Content Providers","","content-providers",true,true);
78
    topic.categories.push(datasourceCategory);
79
    let datasourceDefSub = new SubCategory(null, null,null,true, true);
80
    datasourceCategory.subCategories.push(datasourceDefSub);*/
81

  
82
    let projectCategory:Category =  new Category("Projects","","projects",true,true);
83
    topic.categories.push(projectCategory);
84
    let projectDefSub = new SubCategory(null, null,null,true, true);
85
    projectCategory.subCategories.push(projectDefSub);
86

  
87
    //Numbers
88

  
89
    let n_total_pubs = new Indicator("Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","publications"])]);
90
    let n_open_pubs = new Indicator("OA Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","open_access"])]);
91
    let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","total_projects"])]);
92
    let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search",
93
      "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]);
94
    let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search",
95
      "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]);
96
    let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search",
97
      "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]);
98

  
99
    /*overviewDefSub.numbers.push(n_total_pubs);
100
    overviewDefSub.numbers.push(n_open_pubs);
101
    overviewDefSub.numbers.push(n_total_projects);
102
    overviewDefSub.numbers.push(n_total_data);
103
    overviewDefSub.numbers.push(n_total_soft);
104
    overviewDefSub.numbers.push(n_total_other);*/
105

  
106
    pubDefSub.numbers.push(n_total_pubs);
107
    pubDefSub.numbers.push(n_open_pubs);
108
    softDefSub.numbers.push(n_total_soft);
109
    dataDefSub.numbers.push(n_total_data);
110
    otherDefSub.numbers.push(n_total_other);
111

  
112
    projectDefSub.numbers.push(n_total_projects);
113

  
114
    //Charts
115

  
116
    let c_pubs_per_project = new Indicator("Which are the top "+stakeholder.index_shortName+" projects?",null, "chart","large",true, true, [
117
      new IndicatorPath("bar", "old","chart.php?com=query&data="+encodeURIComponent('{"table":"result","fields":[{"fld":"number","agg":"count","type":"bar","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["'+stakeholder.index_name+'"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"Publications per project (top 30)","subtitle":"","xaxistitle":"project","order":"d"}'), null)]);
118
    pubDefSub.charts.push(c_pubs_per_project);
119
//TO check
120
    let c_pubs_per_datasource = new Indicator("Which are the top repositories containing "+stakeholder.index_shortName+" research outputs?",null, "chart","small",false,
121
      true, [new IndicatorPath("column", "old", "chart.php?com=query&data="+encodeURIComponent('{"table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"result_datasources-datasource-name","agg":"avg"},"group":"","color":"","type":"chart","size":"20","sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funder","values":["'+stakeholder.index_name+'"],"to":"-1"},{"name":"result_datasources-datasource-type","exvalues":["Publication Catalogue"]}],"having":[],"xStyle":{"r":-90,"s":"-","l":"-","ft":10,"wt":"-"},"title":"Publications by content provider (top 20)","subtitle":"","xaxistitle":"content providers","order":"d"}'), null)]);
122
    pubDefSub.charts.push(c_pubs_per_datasource);
123

  
124
    let c_pubs_per_doc_type = new Indicator("In what type of documents do your researchers used to publish?",null, "chart","small",true, true,
125
      [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Data","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.classification","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"publications"},"subtitle":{"text":"per document type"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Document Type"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
126
    pubDefSub.charts.push(c_pubs_per_doc_type);
127

  
128
    let c_pubs_funding_scheme = new Indicator("What is the percentage publications by funding scheme / programme?",null, "chart","small",true,
129
      true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Total","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
130
    pubDefSub.charts.push(c_pubs_funding_scheme);
131

  
132
/*    //TODO check why doesn't load
133
      let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
134
      true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
135
    //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
136
*/
137

  
138
    let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
139
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Open Access Publications"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
140
    pubDefSub.charts.push(c_pubs_open);
141

  
142
    let c_pubs_access_modes = new Indicator("How your Open Access publications are shaped over the years?",null, "chart","medium",true, true,
143
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null},{"field":"publication.access mode","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by Access Mode"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
144
    pubDefSub.charts.push(c_pubs_access_modes);
145

  
146
    // let c_pubs_av_embargo = new Indicator("Average period of embargoed publications",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
147
    // pubDefSub.charts.push(c_pubs_av_embargo);
148

  
149
    let c_pubs_OA_journals = new Indicator("Publications in OA Journals over time",null, "chart","medium",true, true,
150
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by OA Journals"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
151
    pubDefSub.charts.push(c_pubs_OA_journals);
152

  
153
    //from monitor
154
    let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
155
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"contains","values":["repo"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by OA Journals"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
156
    pubDefSub.charts.push(c_pubs_repo);
157
    //
158
    // let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
159
    //   [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('), null)]);
160
    // pubDefSub.charts.push(c_pubs_repo);
161

  
162
    // let c_pubs_green_year = new Indicator("How many OA publications have been submitted to repos per year?",null, "chart","medium",true, true,[new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png",  null)]);
163
    // pubDefSub.charts.push(c_pubs_green_year);
164

  
165
    let c_pubs_datasource_country = new Indicator("What is the percentage of OA pubs by repositories over the years?",null, "chart","medium",true, true,
166
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Gold OA","type":"column","color":"#b8c91fff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Green OA","type":"column","color":"#0d9637ff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"starts_with","values":["Institu"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false},"stacking":"percent"}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
167
    pubDefSub.charts.push(c_pubs_datasource_country);
168

  
169
    let c_pubs_funding_country = new Indicator("What is the percentage of OA pubs by projects over the years?",null, "chart","medium",true, true,
170
      [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Gold OA","type":"column","color":"#b8c91fff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Green OA","type":"column","color":"#0d9637ff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"starts_with","values":["Institu"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+stakeholder.index_name+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false},"stacking":"percent"}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
171
    pubDefSub.charts.push(c_pubs_funding_country);
172

  
173
    let c_data_year = new Indicator("How your Open research data are shaped over the years?",null, "chart","medium",true, true,
174
      [new IndicatorPath("column", "stats-tool",'/chart?json='+
175
        encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Data","type":"column","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+stakeholder.index_name+'"]},{"field":"result.type","type":"=","values":["dataset"]},{"field":"result.year","type":">=","values":["2014"]},{"field":"result.year","type":"<=","values":["2019"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+stakeholder.index_shortName+' research data over time"},"subtitle":{},"yAxis":{"title":{"text":"Research data"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
176
    dataDefSub.charts.push(c_data_year);
177

  
178
    // let c_other_year = new Indicator("How your Open research data are shaped over the years?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
179
    // otherDefSub.charts.push(c_other_year);
180
    //
181
    // let c_datasources_access_modes = new Indicator("What is the number of research data repositories by access mode?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
182
    // pubDefSub.charts.push(c_datasources_access_modes);
183
    //
184
    // let c_pub_nometa_year = new Indicator("How many publications lack of abstract per year?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
185
    // pubDefSub.charts.push(c_pub_nometa_year);
186
    //
187
    // let c_pub_meta_linked_year = new Indicator("??",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
188
    // pubDefSub.charts.push(c_pub_meta_linked_year);
189
    //
190
    // let c_pub_colocated_year = new Indicator("How many publications are submitted to more than one repos per year?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
191
    // pubDefSub.charts.push(c_pub_colocated_year);
192

  
193
    // let c_pub_pids = new Indicator("What is the most common PIDs by year?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
194
    // pubDefSub.charts.push(c_pub_pids);
195
    //
196
    // let c_oai_pmh_datasources = new Indicator("What is the most common PIDs by year?",null, "chart","medium",true, true, [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null)]);
197
    // pubDefSub.charts.push(c_oai_pmh_datasources);
198

  
199
    return topic;
200
  }
201
  createImpactTopic():Topic{
202
    let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
203

  
204
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
205
    topic.categories.push(pubCategory);
206
    let pubDefSub = new SubCategory(null, null,null,true, true);
207
    pubCategory.subCategories.push(pubDefSub);
208

  
209
    let dataCategory:Category =  new Category("Research data","","data",true,true);
210
    topic.categories.push(dataCategory);
211
    let dataDefSub = new SubCategory(null, null,null,true, true);
212
    dataCategory.subCategories.push(dataDefSub);
213

  
214
    let softwareCategory:Category =  new Category("Software","","software",true,true);
215
    topic.categories.push(softwareCategory);
216
    let softDefSub = new SubCategory(null, null,null,true, true);
217
    softwareCategory.subCategories.push(softDefSub);
218

  
219
  /*  let otherCategory:Category =  new Category("Other research products","","other",true,true);
220
    topic.categories.push(otherCategory);
221
    let otherDefSub = new SubCategory(null, null,null,true, true);
222
    otherCategory.subCategories.push(otherDefSub);*/
223

  
224

  
225
    return topic;
226
  }
227
  createCollaborationTopic():Topic{
228
    let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
229

  
230
    let category1:Category =  new Category("Category 1","This is ","cat",true,true);
231
    topic.categories.push(category1);
232

  
233

  
234
    let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
235
    category1.subCategories.push(subCat1);
236

  
237

  
238
    let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
239
    category1.subCategories.push(subCat2);
240

  
241

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff