Revision 56644
Added by Konstantinos Triantafyllou almost 5 years ago
software.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild} from '@angular/core'; |
|
2 |
import {Input} from '@angular/core'; |
|
3 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
4 |
import {Title, Meta} from '@angular/platform-browser'; |
|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
5 | 4 |
|
6 |
import {Observable} from 'rxjs'; |
|
5 |
import {SoftwareService} from './software.service'; |
|
6 |
import {SoftwareInfo} from '../../utils/entities/softwareInfo'; |
|
7 | 7 |
|
8 |
import {SoftwareService} from './software.service'; |
|
9 |
import {SoftwareInfo} from '../../utils/entities/softwareInfo'; |
|
10 |
|
|
11 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
12 |
import {PiwikService} from '../../utils/piwik/piwik.service'; |
|
13 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
|
14 |
import { SEOService } from '../../sharedComponents/SEO/SEO.service'; |
|
8 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
9 |
import {PiwikService} from '../../utils/piwik/piwik.service'; |
|
10 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
|
11 |
import {SEOService} from '../../sharedComponents/SEO/SEO.service'; |
|
15 | 12 |
import {HelperFunctions} from "../../utils/HelperFunctions.class"; |
13 |
import {HelperService} from "../../utils/helper/helper.service"; |
|
16 | 14 |
|
17 | 15 |
@Component({ |
18 |
selector: 'software',
|
|
19 |
templateUrl: 'software.component.html',
|
|
16 |
selector: 'software', |
|
17 |
templateUrl: 'software.component.html', |
|
20 | 18 |
}) |
21 | 19 |
|
22 | 20 |
export class SoftwareComponent { |
23 | 21 |
@Input() piwikSiteId = null; |
24 |
public softwareInfo: SoftwareInfo; |
|
25 |
public softwareId : string ; |
|
22 |
@Input() communityId = null; |
|
23 |
public softwareInfo: SoftwareInfo; |
|
24 |
public softwareId: string; |
|
26 | 25 |
|
27 |
// APP BOX variables
|
|
28 |
public showAllCollectedFrom: boolean = false;
|
|
29 |
public showAllDownloadFrom: boolean = false;
|
|
30 |
public showAllPublishedIn: boolean = false;
|
|
26 |
// APP BOX variables |
|
27 |
public showAllCollectedFrom: boolean = false; |
|
28 |
public showAllDownloadFrom: boolean = false; |
|
29 |
public showAllPublishedIn: boolean = false; |
|
31 | 30 |
|
32 |
public thresholdDescription: number = 270;
|
|
33 |
public showNumDescription: number = 270;
|
|
31 |
public thresholdDescription: number = 270; |
|
32 |
public showNumDescription: number = 270; |
|
34 | 33 |
|
35 |
// Metrics tab variables
|
|
36 |
public metricsClicked: boolean;
|
|
37 |
public viewsFrameUrl: string;
|
|
38 |
public downloadsFrameUrl: string;
|
|
39 |
public totalViews: number;
|
|
40 |
public totalDownloads: number;
|
|
41 |
public pageViews: number;
|
|
34 |
// Metrics tab variables |
|
35 |
public metricsClicked: boolean; |
|
36 |
public viewsFrameUrl: string; |
|
37 |
public downloadsFrameUrl: string; |
|
38 |
public totalViews: number; |
|
39 |
public totalDownloads: number; |
|
40 |
public pageViews: number; |
|
42 | 41 |
|
43 |
// Active tab variable for responsiveness
|
|
44 |
public activeTab: string = "Related Research Results";
|
|
42 |
// Active tab variable for responsiveness |
|
43 |
public activeTab: string = "Related Research Results"; |
|
45 | 44 |
|
46 |
// Map counting variable
|
|
47 |
public relatedResearchResultsNum: number = 0;
|
|
45 |
// Map counting variable |
|
46 |
public relatedResearchResultsNum: number = 0; |
|
48 | 47 |
|
49 |
// Message variables
|
|
50 |
public warningMessage = "";
|
|
51 |
public errorMessage = "";
|
|
52 |
public showLoading: boolean = true;
|
|
48 |
// Message variables |
|
49 |
public warningMessage = ""; |
|
50 |
public errorMessage = ""; |
|
51 |
public showLoading: boolean = true; |
|
53 | 52 |
|
54 |
public routerHelper:RouterHelper = new RouterHelper();
|
|
53 |
public routerHelper: RouterHelper = new RouterHelper();
|
|
55 | 54 |
|
56 |
private result ; |
|
57 |
sub: any; piwiksub: any; infoSub: any; |
|
58 |
properties:EnvProperties; |
|
55 |
private result; |
|
56 |
sub: any; |
|
57 |
piwiksub: any; |
|
58 |
infoSub: any; |
|
59 |
properties: EnvProperties; |
|
60 |
public pageContents = null; |
|
61 |
public divContents = null; |
|
59 | 62 |
|
60 |
constructor (private _softwareService: SoftwareService, |
|
61 |
private _piwikService:PiwikService, |
|
62 |
private route: ActivatedRoute, |
|
63 |
private router: Router, |
|
64 |
private _meta: Meta, |
|
65 |
private _title: Title, |
|
66 |
private _router: Router, |
|
67 |
private seoService: SEOService) { |
|
68 |
} |
|
63 |
constructor(private _softwareService: SoftwareService, |
|
64 |
private _piwikService: PiwikService, |
|
65 |
private route: ActivatedRoute, |
|
66 |
private router: Router, |
|
67 |
private _meta: Meta, |
|
68 |
private _title: Title, |
|
69 |
private _router: Router, |
|
70 |
private helper: HelperService, |
|
71 |
private seoService: SEOService) { |
|
72 |
} |
|
69 | 73 |
|
70 |
ngOnInit() { |
|
71 |
this.route.data |
|
72 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
73 |
this.properties = data.envSpecific; |
|
74 |
this.updateUrl(data.envSpecific.baseLink+this._router.url); |
|
74 |
ngOnInit() { |
|
75 |
this.route.data |
|
76 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
77 |
this.properties = data.envSpecific; |
|
78 |
//this.getDivContents(); |
|
79 |
this.getPageContents(); |
|
80 |
this.updateUrl(data.envSpecific.baseLink + this._router.url); |
|
75 | 81 |
|
76 |
});
|
|
77 |
this.sub = this.route.queryParams.subscribe(params => {
|
|
78 |
this.softwareInfo = null;
|
|
79 |
this.updateTitle("Software");
|
|
80 |
this.updateDescription("Software, search, open access");
|
|
82 |
}); |
|
83 |
this.sub = this.route.queryParams.subscribe(params => {
|
|
84 |
this.softwareInfo = null; |
|
85 |
this.updateTitle("Software"); |
|
86 |
this.updateDescription("Software, search, open access"); |
|
81 | 87 |
|
82 |
this.softwareId = params['softwareId'];
|
|
88 |
this.softwareId = params['softwareId']; |
|
83 | 89 |
|
84 |
if(this.softwareId){
|
|
85 |
this.getSoftwareInfo(this.softwareId);
|
|
86 |
}else{
|
|
87 |
this.showLoading = false;
|
|
88 |
this.warningMessage="No valid software id";
|
|
89 |
}
|
|
90 |
if (this.softwareId) {
|
|
91 |
this.getSoftwareInfo(this.softwareId); |
|
92 |
} else {
|
|
93 |
this.showLoading = false; |
|
94 |
this.warningMessage = "No valid software id";
|
|
95 |
} |
|
90 | 96 |
|
91 |
this.metricsClicked = false;
|
|
97 |
this.metricsClicked = false; |
|
92 | 98 |
|
93 |
this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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';
|
|
94 |
/*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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';
|
|
95 |
*/
|
|
99 |
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.softwareId + '", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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';
|
|
100 |
/*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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'; |
|
101 |
*/ |
|
96 | 102 |
|
97 |
this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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';
|
|
98 |
/*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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';
|
|
99 |
*/
|
|
100 |
this.scroll();
|
|
101 |
});
|
|
103 |
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.softwareId + '", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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';
|
|
104 |
/*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; |
|
105 |
*/ |
|
106 |
this.scroll(); |
|
107 |
}); |
|
102 | 108 |
|
103 |
}
|
|
109 |
} |
|
104 | 110 |
|
105 |
ngOnDestroy() { |
|
106 |
if(this.sub){ |
|
107 |
this.sub.unsubscribe(); |
|
108 |
} |
|
109 |
if(this.piwiksub){ |
|
110 |
this.piwiksub.unsubscribe(); |
|
111 |
} |
|
112 |
if(this.infoSub) { |
|
113 |
this.infoSub.unsubscribe(); |
|
114 |
} |
|
111 |
private getPageContents() { |
|
112 |
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
113 |
this.pageContents = contents; |
|
114 |
}) |
|
115 |
} |
|
116 |
|
|
117 |
private getDivContents() { |
|
118 |
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
119 |
this.divContents = contents; |
|
120 |
}) |
|
121 |
} |
|
122 |
|
|
123 |
ngOnDestroy() { |
|
124 |
if (this.sub) { |
|
125 |
this.sub.unsubscribe(); |
|
115 | 126 |
} |
127 |
if (this.piwiksub) { |
|
128 |
this.piwiksub.unsubscribe(); |
|
129 |
} |
|
130 |
if (this.infoSub) { |
|
131 |
this.infoSub.unsubscribe(); |
|
132 |
} |
|
133 |
} |
|
116 | 134 |
|
117 |
private getSoftwareInfo(id:string) {
|
|
118 |
this.warningMessage = '';
|
|
119 |
this.errorMessage=""
|
|
120 |
this.showLoading = true;
|
|
135 |
private getSoftwareInfo(id: string) {
|
|
136 |
this.warningMessage = ''; |
|
137 |
this.errorMessage = ""
|
|
138 |
this.showLoading = true; |
|
121 | 139 |
|
122 |
this.softwareInfo = null;
|
|
140 |
this.softwareInfo = null; |
|
123 | 141 |
|
124 |
this.infoSub = this._softwareService.getSoftwareInfo(id, this.properties).subscribe(
|
|
125 |
data => {
|
|
126 |
this.softwareInfo = data;
|
|
127 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftwareLanding + this.softwareInfo.record["result"]["header"]["dri:objIdentifier"]);
|
|
128 |
/*if(this.softwareInfo.title.name != undefined && this.softwareInfo.title.name!= ''){
|
|
129 |
this.updateTitle(this.softwareInfo.title.name);
|
|
130 |
this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name);
|
|
131 |
}*/
|
|
132 |
if(this.softwareInfo.title){
|
|
133 |
this.updateTitle(this.softwareInfo.title);
|
|
134 |
this.updateDescription("Software, "+this.softwareInfo.title);
|
|
135 |
}
|
|
136 |
if( this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
|
137 |
this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title/*.name*/, this.piwikSiteId).subscribe();
|
|
138 |
}
|
|
142 |
this.infoSub = this._softwareService.getSoftwareInfo(id, this.properties).subscribe( |
|
143 |
data => { |
|
144 |
this.softwareInfo = data; |
|
145 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftwareLanding + this.softwareInfo.record["result"]["header"]["dri:objIdentifier"]); |
|
146 |
/*if(this.softwareInfo.title.name != undefined && this.softwareInfo.title.name!= ''){ |
|
147 |
this.updateTitle(this.softwareInfo.title.name); |
|
148 |
this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); |
|
149 |
}*/ |
|
150 |
if (this.softwareInfo.title) {
|
|
151 |
this.updateTitle(this.softwareInfo.title); |
|
152 |
this.updateDescription("Software, " + this.softwareInfo.title);
|
|
153 |
} |
|
154 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
|
155 |
this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title/*.name*/, this.piwikSiteId).subscribe(); |
|
156 |
} |
|
139 | 157 |
|
140 |
this.result = [] |
|
141 |
this.result = {id: id, type :"software", source : "openaire", title: this.softwareInfo.title,url: '', result: '', accessRights: /*this.softwareInfo.title.accessMode*/this.softwareInfo.accessMode, embargoEndDate: ''}; |
|
158 |
this.result = [] |
|
159 |
this.result = { |
|
160 |
id: id, |
|
161 |
type: "software", |
|
162 |
source: "openaire", |
|
163 |
title: this.softwareInfo.title, |
|
164 |
url: '', |
|
165 |
result: '', |
|
166 |
accessRights: /*this.softwareInfo.title.accessMode*/this.softwareInfo.accessMode, |
|
167 |
embargoEndDate: '' |
|
168 |
}; |
|
142 | 169 |
|
143 |
let relatedResearchResultsNum = 0;
|
|
144 |
if(this.softwareInfo.relatedResearchResults != undefined) {
|
|
145 |
this.softwareInfo.relatedResearchResults.forEach(function (value, key, map) {
|
|
146 |
relatedResearchResultsNum += value.length;
|
|
147 |
});
|
|
148 |
}
|
|
149 |
this.relatedResearchResultsNum = relatedResearchResultsNum;
|
|
170 |
let relatedResearchResultsNum = 0; |
|
171 |
if (this.softwareInfo.relatedResearchResults != undefined) {
|
|
172 |
this.softwareInfo.relatedResearchResults.forEach(function (value, key, map) { |
|
173 |
relatedResearchResultsNum += value.length; |
|
174 |
}); |
|
175 |
} |
|
176 |
this.relatedResearchResultsNum = relatedResearchResultsNum; |
|
150 | 177 |
|
151 |
this.showLoading = false;
|
|
152 |
},
|
|
153 |
err => {
|
|
154 |
//console.log(err)
|
|
155 |
this.handleError("Error getting software for id: "+this.softwareId, err);
|
|
156 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftware);
|
|
157 |
this.errorMessage = 'No software found';
|
|
158 |
this.showLoading = false;
|
|
159 |
}
|
|
160 |
);
|
|
161 |
}
|
|
178 |
this.showLoading = false; |
|
179 |
}, |
|
180 |
err => { |
|
181 |
//console.log(err) |
|
182 |
this.handleError("Error getting software for id: " + this.softwareId, err);
|
|
183 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftware); |
|
184 |
this.errorMessage = 'No software found'; |
|
185 |
this.showLoading = false; |
|
186 |
} |
|
187 |
); |
|
188 |
} |
|
162 | 189 |
|
163 |
// showChange($event) {
|
|
164 |
// this.showAllReferences=$event.value;
|
|
165 |
// }
|
|
190 |
// showChange($event) { |
|
191 |
// this.showAllReferences=$event.value; |
|
192 |
// } |
|
166 | 193 |
|
167 |
public metricsResults($event) {
|
|
168 |
this.totalViews = $event.totalViews;
|
|
169 |
this.totalDownloads = $event.totalDownloads;
|
|
170 |
this.pageViews = $event.pageViews;
|
|
171 |
}
|
|
194 |
public metricsResults($event) { |
|
195 |
this.totalViews = $event.totalViews; |
|
196 |
this.totalDownloads = $event.totalDownloads; |
|
197 |
this.pageViews = $event.pageViews; |
|
198 |
} |
|
172 | 199 |
|
173 |
private updateDescription(description:string) { |
|
174 |
this._meta.updateTag({content:description},"name='description'"); |
|
175 |
this._meta.updateTag({content:description},"property='og:description'"); |
|
176 |
} |
|
177 |
private updateTitle(title:string) { |
|
178 |
var _prefix ="OpenAIRE | "; |
|
179 |
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); |
|
180 |
this._title.setTitle(_title); |
|
181 |
this._meta.updateTag({content:_title},"property='og:title'"); |
|
182 |
} |
|
183 |
private updateUrl(url:string) { |
|
184 |
this._meta.updateTag({content:url},"property='og:url'"); |
|
185 |
} |
|
200 |
private updateDescription(description: string) { |
|
201 |
this._meta.updateTag({content: description}, "name='description'"); |
|
202 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
203 |
} |
|
186 | 204 |
|
187 |
public buildCurationTooltip() { |
|
188 |
let tooltipContent: string = "<div class='uk-padding-small uk-light'>"; |
|
205 |
private updateTitle(title: string) { |
|
206 |
var _prefix = "OpenAIRE | "; |
|
207 |
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); |
|
208 |
this._title.setTitle(_title); |
|
209 |
this._meta.updateTag({content: _title}, "property='og:title'"); |
|
210 |
} |
|
189 | 211 |
|
190 |
tooltipContent += "<h4>Record in preview</h4>"; |
|
191 |
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>"; |
|
212 |
private updateUrl(url: string) { |
|
213 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
214 |
} |
|
192 | 215 |
|
193 |
return tooltipContent; |
|
194 |
} |
|
195 |
public getKeys( map) { |
|
196 |
return Array.from(map.keys()); |
|
197 |
} |
|
216 |
public buildCurationTooltip() { |
|
217 |
let tooltipContent: string = "<div class='uk-padding-small uk-light'>"; |
|
198 | 218 |
|
199 |
public scroll() { |
|
200 |
HelperFunctions.scroll(); |
|
201 |
} |
|
219 |
tooltipContent += "<h4>Record in preview</h4>"; |
|
220 |
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>"; |
|
202 | 221 |
|
203 |
private handleError(message: string, error) { |
|
204 |
console.error("Software Landing Page: "+message, error); |
|
205 |
} |
|
206 |
isRouteAvailable(routeToCheck:string){ |
|
222 |
return tooltipContent; |
|
223 |
} |
|
224 |
|
|
225 |
public getKeys(map) { |
|
226 |
return Array.from(map.keys()); |
|
227 |
} |
|
228 |
|
|
229 |
public scroll() { |
|
230 |
HelperFunctions.scroll(); |
|
231 |
} |
|
232 |
|
|
233 |
private handleError(message: string, error) { |
|
234 |
console.error("Software Landing Page: " + message, error); |
|
235 |
} |
|
236 |
|
|
237 |
isRouteAvailable(routeToCheck: string) { |
|
207 | 238 |
for (let i = 0; i < this.router.config.length; i++) { |
208 |
let routePath:string = this.router.config[i].path; |
|
209 |
if(routePath == routeToCheck){
|
|
239 |
let routePath: string = this.router.config[i].path;
|
|
240 |
if (routePath == routeToCheck) {
|
|
210 | 241 |
return true; |
211 | 242 |
} |
212 | 243 |
} |
Also available in: Unified diff
[Trunk|Library]: Add Helper on search Page, landings and deposit first page.