Revision 56695
Added by Argiro Kokogiannaki almost 5 years ago
project.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild} from '@angular/core'; |
|
2 |
import {Input} from '@angular/core'; |
|
3 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
4 |
import {Params} from '@angular/router'; |
|
5 |
import {Title, Meta} from '@angular/platform-browser'; |
|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
6 | 4 |
|
7 |
import {Observable} from 'rxjs'; |
|
5 |
import {ProjectService} from './project.service'; |
|
6 |
import {ProjectInfo} from '../../utils/entities/projectInfo'; |
|
7 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
8 | 8 |
|
9 |
import {ProjectService} from './project.service'; |
|
10 |
import {ProjectInfo} from '../../utils/entities/projectInfo'; |
|
11 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
9 |
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; |
|
10 |
import {SearchPublicationsService} from '../../services/searchPublications.service'; |
|
11 |
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; |
|
12 |
import {SearchDatasetsService} from '../../services/searchDatasets.service'; |
|
13 |
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; |
|
14 |
import {SearchSoftwareService} from '../../services/searchSoftware.service'; |
|
15 |
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; |
|
16 |
import {SearchOrpsService} from '../../services/searchOrps.service'; |
|
12 | 17 |
|
13 |
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; |
|
14 |
import {SearchPublicationsService} from '../../services/searchPublications.service'; |
|
15 |
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; |
|
16 |
import {SearchDatasetsService} from '../../services/searchDatasets.service'; |
|
17 |
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; |
|
18 |
import {SearchSoftwareService} from '../../services/searchSoftware.service'; |
|
19 |
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; |
|
20 |
import {SearchOrpsService} from '../../services/searchOrps.service'; |
|
18 |
import {ModalLoading} from '../../utils/modal/loading.component'; |
|
21 | 19 |
|
22 |
import {ModalLoading} from '../../utils/modal/loading.component'; |
|
20 |
import {ReportsService} from '../../services/reports.service'; |
|
21 |
import {ErrorCodes} from '../../utils/properties/errorCodes' |
|
23 | 22 |
|
24 |
import {ReportsService} from '../../services/reports.service'; |
|
25 |
import {ErrorCodes} from '../../utils/properties/errorCodes' |
|
26 |
|
|
27 |
import {PiwikService} from '../../utils/piwik/piwik.service'; |
|
28 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
|
29 |
import { SEOService } from '../../sharedComponents/SEO/SEO.service'; |
|
23 |
import {PiwikService} from '../../utils/piwik/piwik.service'; |
|
24 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
|
25 |
import {SEOService} from '../../sharedComponents/SEO/SEO.service'; |
|
30 | 26 |
import {HelperFunctions} from "../../utils/HelperFunctions.class"; |
27 |
import {HelperService} from "../../utils/helper/helper.service"; |
|
31 | 28 |
|
32 | 29 |
@Component({ |
33 |
selector: 'project',
|
|
34 |
templateUrl: 'project.component.html',
|
|
35 |
})
|
|
30 |
selector: 'project', |
|
31 |
templateUrl: 'project.component.html', |
|
32 |
}) |
|
36 | 33 |
|
37 |
export class ProjectComponent{ |
|
34 |
export class ProjectComponent {
|
|
38 | 35 |
@Input() piwikSiteId = null; |
36 |
@Input() communityId = null; |
|
39 | 37 |
public projectInfo: ProjectInfo; |
40 |
public projectId : string ;
|
|
38 |
public projectId: string;
|
|
41 | 39 |
public projectName: string; |
42 | 40 |
|
43 | 41 |
// Metrics tab variables |
... | ... | |
60 | 58 |
public software_dynamic: string; |
61 | 59 |
public orps_dynamic: string; |
62 | 60 |
|
63 |
public project ;
|
|
61 |
public project; |
|
64 | 62 |
|
65 | 63 |
// CSV variables |
66 | 64 |
public downloadURLAPI: string; |
... | ... | |
84 | 82 |
private reloadOrps: boolean = true; |
85 | 83 |
|
86 | 84 |
// Variables for publications, research data, software tabs |
87 |
public fetchPublications : FetchPublications;
|
|
85 |
public fetchPublications: FetchPublications; |
|
88 | 86 |
public linkToSearchPublications = ""; |
89 |
public fetchDatasets : FetchDatasets;
|
|
87 |
public fetchDatasets: FetchDatasets; |
|
90 | 88 |
public linkToSearchDatasets = ""; |
91 | 89 |
public fetchSoftware: FetchSoftware; |
92 | 90 |
public linkToSearchSoftware = ""; |
93 | 91 |
public fetchOrps: FetchOrps; |
94 | 92 |
public linkToSearchOrps = ""; |
95 | 93 |
|
96 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
97 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
|
94 |
public routerHelper: RouterHelper = new RouterHelper(); |
|
95 |
public errorCodes: ErrorCodes = new ErrorCodes(); |
|
96 |
public pageContents = null; |
|
97 |
public divContents = null; |
|
98 | 98 |
|
99 |
@ViewChild (ModalLoading) loading : ModalLoading ;
|
|
99 |
@ViewChild(ModalLoading) loading: ModalLoading;
|
|
100 | 100 |
// Alert box when something is wrong with CSV requests |
101 | 101 |
@ViewChild('AlertModalCsvError') alertCsvError; |
102 | 102 |
|
103 |
sub: any; piwiksub: any; infoSub: any; downloadFilePiwikSub: any; |
|
104 |
properties:EnvProperties; |
|
105 |
constructor ( private _projectService: ProjectService, |
|
106 |
private _piwikService:PiwikService, |
|
107 |
private route: ActivatedRoute, |
|
108 |
private router: Router, |
|
109 |
private _searchPublicationsService: SearchPublicationsService, |
|
110 |
private _searchDatasetsService: SearchDatasetsService, |
|
111 |
private _searchSoftwareService: SearchSoftwareService, |
|
112 |
private _searchOrpsService: SearchOrpsService, |
|
113 |
private _reportsService: ReportsService, |
|
114 |
private _meta: Meta, |
|
115 |
private _title: Title, |
|
116 |
private _router: Router, |
|
103 |
sub: any; |
|
104 |
piwiksub: any; |
|
105 |
infoSub: any; |
|
106 |
downloadFilePiwikSub: any; |
|
107 |
properties: EnvProperties; |
|
108 |
|
|
109 |
constructor(private _projectService: ProjectService, |
|
110 |
private _piwikService: PiwikService, |
|
111 |
private route: ActivatedRoute, |
|
112 |
private router: Router, |
|
113 |
private _searchPublicationsService: SearchPublicationsService, |
|
114 |
private _searchDatasetsService: SearchDatasetsService, |
|
115 |
private _searchSoftwareService: SearchSoftwareService, |
|
116 |
private _searchOrpsService: SearchOrpsService, |
|
117 |
private _reportsService: ReportsService, |
|
118 |
private _meta: Meta, |
|
119 |
private _title: Title, |
|
120 |
private _router: Router, |
|
121 |
private helper: HelperService, |
|
117 | 122 |
private seoService: SEOService) { |
118 | 123 |
} |
119 | 124 |
|
120 | 125 |
ngOnInit() { |
121 | 126 |
this.route.data |
122 | 127 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
123 |
this.properties = data.envSpecific; |
|
124 |
this.updateUrl(data.envSpecific.baseLink+this._router.url); |
|
128 |
this.properties = data.envSpecific; |
|
129 |
//this.getDivContents(); |
|
130 |
this.getPageContents(); |
|
131 |
this.updateUrl(data.envSpecific.baseLink + this._router.url); |
|
125 | 132 |
|
126 | 133 |
}); |
127 |
this.sub = this.route.queryParams.subscribe(params => {
|
|
128 |
this.metricsClicked = false;
|
|
129 |
this.statsClicked = false;
|
|
130 |
this.fetchPublications = new FetchPublications( this._searchPublicationsService);
|
|
131 |
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
|
|
132 |
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
|
|
133 |
this.fetchOrps = new FetchOrps(this._searchOrpsService);
|
|
134 |
this.sub = this.route.queryParams.subscribe(params => { |
|
135 |
this.metricsClicked = false; |
|
136 |
this.statsClicked = false; |
|
137 |
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
|
|
138 |
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); |
|
139 |
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); |
|
140 |
this.fetchOrps = new FetchOrps(this._searchOrpsService); |
|
134 | 141 |
|
135 |
var title = "Project";
|
|
136 |
var description = "";
|
|
142 |
var title = "Project"; |
|
143 |
var description = ""; |
|
137 | 144 |
|
138 |
this.updateTitle(title);
|
|
139 |
this.updateDescription(description);
|
|
145 |
this.updateTitle(title); |
|
146 |
this.updateDescription(description); |
|
140 | 147 |
this.projectId = params['projectId']; |
141 | 148 |
var grantId = params['grantId']; |
142 | 149 |
var funder = params['funder']; |
143 | 150 |
|
144 | 151 |
|
145 |
if(this.projectId){
|
|
146 |
this.getProjectInfo(this.projectId);
|
|
147 |
this.actionsAfterLoadId();
|
|
148 |
}else if(grantId && funder){
|
|
149 |
this.getProjectInfoByGrantId(grantId,funder); |
|
150 |
}else{
|
|
152 |
if (this.projectId) {
|
|
153 |
this.getProjectInfo(this.projectId); |
|
154 |
this.actionsAfterLoadId(); |
|
155 |
} else if (grantId && funder) {
|
|
156 |
this.getProjectInfoByGrantId(grantId, funder);
|
|
157 |
} else {
|
|
151 | 158 |
|
152 |
this.showLoading = false;
|
|
153 |
this.warningMessage="No valid project id";
|
|
159 |
this.showLoading = false; |
|
160 |
this.warningMessage = "No valid project id";
|
|
154 | 161 |
} |
155 | 162 |
|
156 | 163 |
this.downloadURLAPI = this.properties.csvAPIURL; |
157 | 164 |
|
158 | 165 |
this.createClipboard(); |
159 |
this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \""+this.projectId+"\"))";
|
|
160 |
this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \""+this.projectId+"\"))";
|
|
161 |
this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \""+this.projectId+"\"))";
|
|
162 |
this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \""+this.projectId+"\"))";
|
|
166 |
this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + this.projectId + "\"))";
|
|
167 |
this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \"" + this.projectId + "\"))";
|
|
168 |
this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \"" + this.projectId + "\"))";
|
|
169 |
this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \"" + this.projectId + "\"))";
|
|
163 | 170 |
|
164 | 171 |
HelperFunctions.scroll(); |
165 |
}); |
|
166 |
} |
|
172 |
});
|
|
173 |
}
|
|
167 | 174 |
|
168 |
actionsAfterLoadId(){ |
|
169 |
this.publications_dynamic = |
|
170 |
"<script type=\"text/javascript\">" |
|
171 |
+ "\n<!--" |
|
172 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
173 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
174 |
+ " src=\""+this.properties.widgetLink |
|
175 |
+ this.projectId + "&type=publication\"></script>');" |
|
176 |
+ "\n-->" |
|
177 |
+ "\n</script>"; |
|
175 |
private getPageContents() { |
|
176 |
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
177 |
this.pageContents = contents; |
|
178 |
}) |
|
179 |
} |
|
178 | 180 |
|
179 |
this.datasets_dynamic = |
|
180 |
"<script type=\"text/javascript\">" |
|
181 |
+ "\n<!--" |
|
182 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
183 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
184 |
+ " src=\""+this.properties.widgetLink |
|
185 |
+ this.projectId + "&type=dataset\"></script>');" |
|
186 |
+ "\n-->" |
|
187 |
+ "\n</script>"; |
|
181 |
private getDivContents() { |
|
182 |
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
183 |
this.divContents = contents; |
|
184 |
}) |
|
185 |
} |
|
188 | 186 |
|
189 |
this.software_dynamic = |
|
190 |
"<script type=\"text/javascript\">" |
|
191 |
+ "\n<!--" |
|
192 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
193 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
194 |
+ "\nsrc=\""+this.properties.widgetLink |
|
195 |
+ this.projectId + "&type=software\"></script>');" |
|
196 |
+ "\n-->" |
|
197 |
+ "\n</script>"; |
|
187 |
actionsAfterLoadId() { |
|
188 |
this.publications_dynamic = |
|
189 |
"<script type=\"text/javascript\">" |
|
190 |
+ "\n<!--" |
|
191 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
192 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
193 |
+ " src=\"" + this.properties.widgetLink |
|
194 |
+ this.projectId + "&type=publication\"></script>');" |
|
195 |
+ "\n-->" |
|
196 |
+ "\n</script>"; |
|
198 | 197 |
|
199 |
this.orps_dynamic =
|
|
200 |
"<script type=\"text/javascript\">"
|
|
201 |
+ "\n<!--"
|
|
202 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');"
|
|
203 |
+ "\ndocument.write('<script type=\"text/javascript\""
|
|
204 |
+ "\nsrc=\""+this.properties.widgetLink
|
|
205 |
+ this.projectId + "&type=other\"></script>');"
|
|
206 |
+ "\n-->"
|
|
207 |
+ "\n</script>";
|
|
198 |
this.datasets_dynamic =
|
|
199 |
"<script type=\"text/javascript\">" |
|
200 |
+ "\n<!--" |
|
201 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
202 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
203 |
+ " src=\"" + this.properties.widgetLink
|
|
204 |
+ this.projectId + "&type=dataset\"></script>');"
|
|
205 |
+ "\n-->" |
|
206 |
+ "\n</script>"; |
|
208 | 207 |
|
209 |
this.getProjectInfo(this.projectId); |
|
210 |
//this.searchPublications(); |
|
211 |
this.fetchPublications.getNumForEntity("project", this.projectId, this.properties); |
|
212 |
this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); |
|
213 |
this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); |
|
214 |
this.fetchOrps.getNumForEntity("project", this.projectId, this.properties); |
|
215 |
} |
|
208 |
this.software_dynamic = |
|
209 |
"<script type=\"text/javascript\">" |
|
210 |
+ "\n<!--" |
|
211 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
212 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
213 |
+ "\nsrc=\"" + this.properties.widgetLink |
|
214 |
+ this.projectId + "&type=software\"></script>');" |
|
215 |
+ "\n-->" |
|
216 |
+ "\n</script>"; |
|
217 |
|
|
218 |
this.orps_dynamic = |
|
219 |
"<script type=\"text/javascript\">" |
|
220 |
+ "\n<!--" |
|
221 |
+ "\ndocument.write('<div id=\"oa_widget\"></div>');" |
|
222 |
+ "\ndocument.write('<script type=\"text/javascript\"" |
|
223 |
+ "\nsrc=\"" + this.properties.widgetLink |
|
224 |
+ this.projectId + "&type=other\"></script>');" |
|
225 |
+ "\n-->" |
|
226 |
+ "\n</script>"; |
|
227 |
|
|
228 |
this.getProjectInfo(this.projectId); |
|
229 |
//this.searchPublications(); |
|
230 |
this.fetchPublications.getNumForEntity("project", this.projectId, this.properties); |
|
231 |
this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); |
|
232 |
this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); |
|
233 |
this.fetchOrps.getNumForEntity("project", this.projectId, this.properties); |
|
234 |
} |
|
235 |
|
|
216 | 236 |
ngOnDestroy() { |
217 |
if(this.sub){
|
|
237 |
if (this.sub) {
|
|
218 | 238 |
this.sub.unsubscribe(); |
219 | 239 |
} |
220 |
if(this.piwiksub){
|
|
240 |
if (this.piwiksub) {
|
|
221 | 241 |
this.piwiksub.unsubscribe(); |
222 | 242 |
} |
223 |
if(this.infoSub) { |
|
243 |
if (this.infoSub) {
|
|
224 | 244 |
this.infoSub.unsubscribe(); |
225 | 245 |
} |
226 |
if(this.downloadFilePiwikSub) { |
|
246 |
if (this.downloadFilePiwikSub) {
|
|
227 | 247 |
this.downloadFilePiwikSub.unsubscribe(); |
228 | 248 |
} |
229 | 249 |
} |
230 | 250 |
|
231 | 251 |
private createClipboard() { |
232 |
if(typeof window !== 'undefined') {
|
|
252 |
if (typeof window !== 'undefined') {
|
|
233 | 253 |
|
234 |
let publ_clipboard, datasets_clipboard, software_clipboard, orps_clipboard;
|
|
235 |
let Clipboard;
|
|
236 |
Clipboard = require('clipboard');
|
|
237 |
publ_clipboard = new Clipboard('.publ_clipboard_btn');
|
|
238 |
datasets_clipboard = new Clipboard('.datasets_clipboard_btn');
|
|
239 |
software_clipboard = new Clipboard('.software_clipboard_btn');
|
|
240 |
orps_clipboard = new Clipboard('.orps_clipboard_btn');
|
|
241 |
}
|
|
254 |
let publ_clipboard, datasets_clipboard, software_clipboard, orps_clipboard; |
|
255 |
let Clipboard; |
|
256 |
Clipboard = require('clipboard'); |
|
257 |
publ_clipboard = new Clipboard('.publ_clipboard_btn'); |
|
258 |
datasets_clipboard = new Clipboard('.datasets_clipboard_btn'); |
|
259 |
software_clipboard = new Clipboard('.software_clipboard_btn'); |
|
260 |
orps_clipboard = new Clipboard('.orps_clipboard_btn'); |
|
261 |
} |
|
242 | 262 |
} |
243 | 263 |
|
244 | 264 |
private searchPublications() { |
245 | 265 |
this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10, this.properties); |
246 | 266 |
this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and"; |
247 | 267 |
//if(this.fetchPublications.searchUtils.totalResults > 0) { |
248 |
//this.activeTab = "Publications";
|
|
268 |
//this.activeTab = "Publications"; |
|
249 | 269 |
//} else { |
250 |
//this.searchDatasetsInit();
|
|
270 |
//this.searchDatasetsInit(); |
|
251 | 271 |
//} |
252 | 272 |
this.reloadPublications = false; |
253 | 273 |
} |
254 | 274 |
|
255 | 275 |
private searchDatasets() { |
256 |
this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
|
|
257 |
this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and";
|
|
276 |
this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties); |
|
277 |
this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and"; |
|
258 | 278 |
|
259 |
this.reloadDatasets = false;
|
|
260 |
//this.activeTab = "Research Data";
|
|
279 |
this.reloadDatasets = false; |
|
280 |
//this.activeTab = "Research Data"; |
|
261 | 281 |
} |
262 | 282 |
|
263 | 283 |
private searchSoftware() { |
264 |
this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
|
|
265 |
this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware;
|
|
266 |
this.reloadSoftware = false;
|
|
284 |
this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties); |
|
285 |
this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware; |
|
286 |
this.reloadSoftware = false; |
|
267 | 287 |
} |
268 | 288 |
|
269 | 289 |
private searchOrps() { |
270 |
this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
|
|
271 |
this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps;
|
|
272 |
this.reloadOrps = false;
|
|
290 |
this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties); |
|
291 |
this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps; |
|
292 |
this.reloadOrps = false; |
|
273 | 293 |
} |
274 | 294 |
|
275 | 295 |
public searchPublicationsInit() { |
276 |
if(this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) {
|
|
277 |
this.searchPublications();
|
|
278 |
} else if(this.fetchPublications.searchUtils.totalResults == 0) {
|
|
279 |
//this.statsClicked=true;
|
|
280 |
//this.activeTab = "Statistics";
|
|
281 |
}
|
|
296 |
if (this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) {
|
|
297 |
this.searchPublications(); |
|
298 |
} else if (this.fetchPublications.searchUtils.totalResults == 0) {
|
|
299 |
//this.statsClicked=true; |
|
300 |
//this.activeTab = "Statistics"; |
|
301 |
} |
|
282 | 302 |
} |
283 | 303 |
|
284 | 304 |
public searchDatasetsInit() { |
285 |
if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) {
|
|
286 |
this.searchDatasets();
|
|
287 |
} else if(this.fetchDatasets.searchUtils.totalResults == 0) {
|
|
288 |
//this.statsClicked=true;
|
|
289 |
//this.activeTab = "Statistics";
|
|
290 |
}
|
|
305 |
if (this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) {
|
|
306 |
this.searchDatasets(); |
|
307 |
} else if (this.fetchDatasets.searchUtils.totalResults == 0) {
|
|
308 |
//this.statsClicked=true; |
|
309 |
//this.activeTab = "Statistics"; |
|
310 |
} |
|
291 | 311 |
} |
292 | 312 |
|
293 | 313 |
public searchSoftwareInit() { |
294 |
if(this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) {
|
|
295 |
this.searchSoftware();
|
|
296 |
}
|
|
314 |
if (this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) {
|
|
315 |
this.searchSoftware(); |
|
316 |
} |
|
297 | 317 |
} |
298 | 318 |
|
299 | 319 |
public searchOrpsInit() { |
300 |
if(this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) {
|
|
301 |
this.searchOrps();
|
|
302 |
}
|
|
320 |
if (this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) {
|
|
321 |
this.searchOrps(); |
|
322 |
} |
|
303 | 323 |
} |
304 | 324 |
|
305 |
private getProjectInfo (id:string) {
|
|
306 |
this.warningMessage = '';
|
|
307 |
this.errorMessage=""
|
|
325 |
private getProjectInfo(id: string) {
|
|
326 |
this.warningMessage = '';
|
|
327 |
this.errorMessage = ""
|
|
308 | 328 |
this.showLoading = true; |
309 | 329 |
|
310 | 330 |
this.projectInfo = null; |
311 | 331 |
|
312 | 332 |
this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe( |
313 | 333 |
data => { |
314 |
this.projectInfo = data;
|
|
334 |
this.projectInfo = data; |
|
315 | 335 |
|
316 |
this.actionsAfterGettingProjectInfo();
|
|
336 |
this.actionsAfterGettingProjectInfo(); |
|
317 | 337 |
}, |
318 | 338 |
err => { |
319 |
//console.log(err);
|
|
320 |
this.handleError("Error getting project for id: "+this.projectId, err);
|
|
339 |
//console.log(err);
|
|
340 |
this.handleError("Error getting project for id: " + this.projectId, err);
|
|
321 | 341 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); |
322 |
this.errorMessage = 'No project found';
|
|
323 |
this.showLoading = false;
|
|
324 |
}
|
|
342 |
this.errorMessage = 'No project found';
|
|
343 |
this.showLoading = false; |
|
344 |
}
|
|
325 | 345 |
); |
326 |
} |
|
327 |
private getProjectInfoByGrantId (grantId:string, funder:string) { |
|
328 |
this.warningMessage = ''; |
|
329 |
this.errorMessage="" |
|
330 |
this.showLoading = true; |
|
346 |
} |
|
331 | 347 |
|
332 |
this.projectInfo = null; |
|
348 |
private getProjectInfoByGrantId(grantId: string, funder: string) { |
|
349 |
this.warningMessage = ''; |
|
350 |
this.errorMessage = "" |
|
351 |
this.showLoading = true; |
|
333 | 352 |
|
334 |
this._projectService.getProjectInfoByGrantId(grantId,funder,this.properties).subscribe( |
|
335 |
data =>{ |
|
353 |
this.projectInfo = null; |
|
336 | 354 |
|
337 |
this.projectInfo = data; |
|
355 |
this._projectService.getProjectInfoByGrantId(grantId, funder, this.properties).subscribe( |
|
356 |
data => { |
|
338 | 357 |
|
339 |
this.actionsAfterGettingProjectInfo(); |
|
340 |
this.projectId = this.projectInfo.id; |
|
341 |
this.actionsAfterLoadId(); |
|
342 |
}, |
|
343 |
err => { |
|
344 |
//console.log(err); |
|
345 |
this.handleError("Error getting project for grant id: "+grantId+" and funder: "+funder, err); |
|
346 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); |
|
347 |
this.errorMessage = 'No project found'; |
|
348 |
this.showLoading = false; |
|
349 |
} |
|
350 |
); |
|
351 |
} |
|
352 |
actionsAfterGettingProjectInfo(){ |
|
353 |
this.projectName = this.projectInfo.acronym; |
|
354 |
if(this.projectName == undefined || this.projectName == '') { |
|
355 |
this.projectName = this.projectInfo.title; |
|
358 |
this.projectInfo = data; |
|
359 |
|
|
360 |
this.actionsAfterGettingProjectInfo(); |
|
361 |
this.projectId = this.projectInfo.id; |
|
362 |
this.actionsAfterLoadId(); |
|
363 |
}, |
|
364 |
err => { |
|
365 |
//console.log(err); |
|
366 |
this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err); |
|
367 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); |
|
368 |
this.errorMessage = 'No project found'; |
|
369 |
this.showLoading = false; |
|
370 |
} |
|
371 |
); |
|
356 | 372 |
} |
357 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url); |
|
358 |
this.updateTitle(this.projectName); |
|
359 |
this.updateDescription("project, "+this.projectName+ ","+this.projectInfo.funder+","+this.projectInfo.acronym); |
|
360 |
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ |
|
361 |
this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe(); |
|
362 |
} |
|
363 | 373 |
|
364 |
this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; |
|
374 |
actionsAfterGettingProjectInfo() { |
|
375 |
this.projectName = this.projectInfo.acronym; |
|
376 |
if (this.projectName == undefined || this.projectName == '') { |
|
377 |
this.projectName = this.projectInfo.title; |
|
378 |
} |
|
379 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url); |
|
380 |
this.updateTitle(this.projectName); |
|
381 |
this.updateDescription("project, " + this.projectName + "," + this.projectInfo.funder + "," + this.projectInfo.acronym); |
|
382 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
383 |
this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe(); |
|
384 |
} |
|
365 | 385 |
|
366 |
this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; |
|
386 |
this.project = { |
|
387 |
funderId: "", |
|
388 |
funderName: this.projectInfo.funder, |
|
389 |
projectId: this.projectId, |
|
390 |
projectName: this.projectInfo.title, |
|
391 |
projectAcronym: this.projectInfo.acronym, |
|
392 |
startDate: this.projectInfo.startDate, |
|
393 |
endDate: this.projectInfo.endDate |
|
394 |
}; |
|
367 | 395 |
|
368 |
this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
|
|
396 |
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"' + this.projectId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
|
|
369 | 397 |
|
370 |
//stats tab charts |
|
371 |
this.chartScientificResultsUrl=this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
372 |
this.chartAccessModeUrl=this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
373 |
this.chartDatasourcesUrl= this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
398 |
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"' + this.projectId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; |
|
374 | 399 |
|
375 |
this.showLoading = false; |
|
376 |
} |
|
377 |
public downloadfile(url:string, filename: string){ |
|
378 |
this.openLoading(); |
|
379 |
this.setMessageLoading("Downloading CSV file"); |
|
400 |
//stats tab charts |
|
401 |
this.chartScientificResultsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
402 |
this.chartAccessModeUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
403 |
this.chartDatasourcesUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; |
|
380 | 404 |
|
381 |
this._reportsService.downloadCSVFile(url).subscribe( |
|
382 |
data => { |
|
383 |
this.closeLoading(); |
|
405 |
this.showLoading = false; |
|
406 |
} |
|
384 | 407 |
|
385 |
var url = window.URL.createObjectURL(data); |
|
386 |
var a = window.document.createElement('a'); |
|
387 |
window.document.body.appendChild(a); |
|
388 |
a.setAttribute('style', 'display: none'); |
|
389 |
a.href = url; |
|
390 |
a.download = filename+".csv"; |
|
391 |
a.click(); |
|
392 |
window.URL.revokeObjectURL(url); |
|
393 |
a.remove(); // remove the element |
|
408 |
public downloadfile(url: string, filename: string) { |
|
409 |
this.openLoading(); |
|
410 |
this.setMessageLoading("Downloading CSV file"); |
|
394 | 411 |
|
395 |
//window.open(window.URL.createObjectURL(data)); |
|
396 |
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ |
|
397 |
this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); |
|
398 |
} |
|
399 |
}, |
|
400 |
error => { |
|
401 |
//console.log("Error downloading the file."); |
|
402 |
this.handleError("Error downloading file: "+filename, error); |
|
412 |
this._reportsService.downloadCSVFile(url).subscribe( |
|
413 |
data => { |
|
414 |
this.closeLoading(); |
|
403 | 415 |
|
404 |
this.closeLoading(); |
|
405 |
this.confirmOpenCsvError(); |
|
406 |
}/*, |
|
416 |
var url = window.URL.createObjectURL(data); |
|
417 |
var a = window.document.createElement('a'); |
|
418 |
window.document.body.appendChild(a); |
|
419 |
a.setAttribute('style', 'display: none'); |
|
420 |
a.href = url; |
|
421 |
a.download = filename + ".csv"; |
|
422 |
a.click(); |
|
423 |
window.URL.revokeObjectURL(url); |
|
424 |
a.remove(); // remove the element |
|
425 |
|
|
426 |
//window.open(window.URL.createObjectURL(data)); |
|
427 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
428 |
this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); |
|
429 |
} |
|
430 |
}, |
|
431 |
error => { |
|
432 |
//console.log("Error downloading the file."); |
|
433 |
this.handleError("Error downloading file: " + filename, error); |
|
434 |
|
|
435 |
this.closeLoading(); |
|
436 |
this.confirmOpenCsvError(); |
|
437 |
}/*, |
|
407 | 438 |
() => console.log('Completed file download.')*/ |
408 |
);
|
|
409 |
}
|
|
439 |
); |
|
440 |
} |
|
410 | 441 |
|
411 |
/* |
|
412 |
showHTML(){ |
|
413 |
let info:string = "<h1>Publications of Project "; |
|
442 |
/*
|
|
443 |
showHTML(){
|
|
444 |
let info:string = "<h1>Publications of Project ";
|
|
414 | 445 |
|
415 |
if(this.projectInfo.title != undefined && this.projectInfo.title != "") { |
|
416 |
info += this.projectInfo.title; |
|
417 |
} |
|
418 |
if((this.projectInfo.title != undefined && this.projectInfo.title != "") && |
|
419 |
((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || |
|
420 |
(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { |
|
421 |
info += "("; |
|
422 |
} |
|
423 |
if(this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") { |
|
424 |
info += this.projectInfo.acronym + " - "; |
|
425 |
} |
|
426 |
if(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != "") { |
|
427 |
info += this.projectInfo.callIdentifier; |
|
428 |
} |
|
429 |
if((this.projectInfo.title != undefined && this.projectInfo.title != "") && |
|
430 |
((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || |
|
431 |
(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { |
|
432 |
info += ")"; |
|
433 |
} |
|
434 |
info +="</h1>"; |
|
435 |
info += "<h3>"+this.fetchPublications.searchUtils.totalResults+" publications</h3>"; |
|
446 |
if(this.projectInfo.title != undefined && this.projectInfo.title != "") {
|
|
447 |
info += this.projectInfo.title;
|
|
448 |
}
|
|
449 |
if((this.projectInfo.title != undefined && this.projectInfo.title != "") &&
|
|
450 |
((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") ||
|
|
451 |
(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) {
|
|
452 |
info += "(";
|
|
453 |
}
|
|
454 |
if(this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") {
|
|
455 |
info += this.projectInfo.acronym + " - ";
|
|
456 |
}
|
|
457 |
if(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != "") {
|
|
458 |
info += this.projectInfo.callIdentifier;
|
|
459 |
}
|
|
460 |
if((this.projectInfo.title != undefined && this.projectInfo.title != "") &&
|
|
461 |
((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") ||
|
|
462 |
(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) {
|
|
463 |
info += ")";
|
|
464 |
}
|
|
465 |
info +="</h1>";
|
|
466 |
info += "<h3>"+this.fetchPublications.searchUtils.totalResults+" publications</h3>";
|
|
436 | 467 |
|
437 |
let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))'; |
|
438 |
this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info) |
|
439 |
.subscribe(data => this.funct(data), |
|
440 |
error => console.log("Error downloading the file."), |
|
441 |
() => console.log('Completed file download.')); |
|
442 |
} |
|
468 |
let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))';
|
|
469 |
this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info)
|
|
470 |
.subscribe(data => this.funct(data),
|
|
471 |
error => console.log("Error downloading the file."),
|
|
472 |
() => console.log('Completed file download.'));
|
|
473 |
}
|
|
443 | 474 |
|
444 |
funct(data) { |
|
445 |
var win = window.open(window.URL.createObjectURL(data)); |
|
446 |
} |
|
447 |
*/ |
|
448 |
public metricsResults($event) {
|
|
449 |
this.totalViews = $event.totalViews;
|
|
450 |
this.totalDownloads = $event.totalDownloads;
|
|
451 |
this.pageViews = $event.pageViews;
|
|
452 |
}
|
|
475 |
funct(data) {
|
|
476 |
var win = window.open(window.URL.createObjectURL(data));
|
|
477 |
}
|
|
478 |
*/
|
|
479 |
public metricsResults($event) { |
|
480 |
this.totalViews = $event.totalViews; |
|
481 |
this.totalDownloads = $event.totalDownloads; |
|
482 |
this.pageViews = $event.pageViews; |
|
483 |
} |
|
453 | 484 |
|
454 |
private updateDescription(description:string) { |
|
455 |
this._meta.updateTag({content:description},"name='description'"); |
|
456 |
this._meta.updateTag({content:description},"property='og:description'"); |
|
485 |
private updateDescription(description: string) { |
|
486 |
this._meta.updateTag({content: description}, "name='description'"); |
|
487 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
488 |
} |
|
489 |
|
|
490 |
private updateTitle(title: string) { |
|
491 |
var _prefix = "OpenAIRE | "; |
|
492 |
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); |
|
493 |
this._title.setTitle(_title); |
|
494 |
this._meta.updateTag({content: _title}, "property='og:title'"); |
|
495 |
} |
|
496 |
|
|
497 |
private updateUrl(url: string) { |
|
498 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
499 |
} |
|
500 |
|
|
501 |
private openLoading() { |
|
502 |
if (this.loading) { |
|
503 |
this.loading.open(); |
|
457 | 504 |
} |
458 |
private updateTitle(title:string) { |
|
459 |
var _prefix ="OpenAIRE | "; |
|
460 |
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); |
|
461 |
this._title.setTitle(_title); |
|
462 |
this._meta.updateTag({content:_title},"property='og:title'"); |
|
463 |
} |
|
464 |
private updateUrl(url:string) { |
|
465 |
this._meta.updateTag({content:url},"property='og:url'"); |
|
466 |
} |
|
505 |
} |
|
467 | 506 |
|
468 |
private openLoading(){ |
|
469 |
if(this.loading){ |
|
470 |
this.loading.open(); |
|
471 |
} |
|
507 |
private closeLoading() { |
|
508 |
if (this.loading) { |
|
509 |
this.loading.close(); |
|
472 | 510 |
} |
473 |
private closeLoading(){ |
|
474 |
if(this.loading){ |
|
475 |
this.loading.close(); |
|
476 |
} |
|
477 |
} |
|
478 |
private setMessageLoading(message: string){ |
|
479 |
if(this.loading){ |
|
480 |
this.loading.message = message; |
|
481 |
} |
|
482 |
} |
|
511 |
} |
|
483 | 512 |
|
484 |
public confirmOpenCsvError(){ |
|
485 |
this.alertCsvError.cancelButton = false; |
|
486 |
this.alertCsvError.okButton = true; |
|
487 |
this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; |
|
488 |
this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; |
|
489 |
this.alertCsvError.okButtonText = "OK"; |
|
490 |
this.alertCsvError.open(); |
|
513 |
private setMessageLoading(message: string) { |
|
514 |
if (this.loading) { |
|
515 |
this.loading.message = message; |
|
491 | 516 |
} |
517 |
} |
|
492 | 518 |
|
493 |
private handleError(message: string, error) { |
|
494 |
console.error("Project Landing Page: "+message, error); |
|
495 |
} |
|
496 |
isRouteAvailable(routeToCheck:string){ |
|
519 |
public confirmOpenCsvError() { |
|
520 |
this.alertCsvError.cancelButton = false; |
|
521 |
this.alertCsvError.okButton = true; |
|
522 |
this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; |
|
523 |
this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; |
|
524 |
this.alertCsvError.okButtonText = "OK"; |
|
525 |
this.alertCsvError.open(); |
|
526 |
} |
|
527 |
|
|
528 |
private handleError(message: string, error) { |
|
529 |
console.error("Project Landing Page: " + message, error); |
|
530 |
} |
|
531 |
|
|
532 |
isRouteAvailable(routeToCheck: string) { |
|
497 | 533 |
for (let i = 0; i < this.router.config.length; i++) { |
498 |
let routePath:string = this.router.config[i].path; |
|
499 |
if(routePath == routeToCheck){
|
|
534 |
let routePath: string = this.router.config[i].path;
|
|
535 |
if (routePath == routeToCheck) {
|
|
500 | 536 |
return true; |
501 | 537 |
} |
502 | 538 |
} |
Also available in: Unified diff
[Library|newlinking]
Merge trunk to Branch rev 56554:56686