1 |
55417
|
k.triantaf
|
import {Component, ElementRef, Input, ViewChild} from '@angular/core';
|
2 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
3 |
|
|
import {Location} from '@angular/common';
|
4 |
|
|
import {Meta, Title} from '@angular/platform-browser';
|
5 |
|
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
6 |
51750
|
sofia.balt
|
|
7 |
55417
|
k.triantaf
|
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
8 |
|
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
9 |
|
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
10 |
53968
|
argiro.kok
|
import {SearchZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
11 |
|
|
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
12 |
57061
|
k.triantaf
|
import {Session, User} from '../openaireLibrary/login/utils/helper.class';
|
13 |
55271
|
argiro.kok
|
import {StatisticsForDashboardComponent} from '../statistics/statistics.component';
|
14 |
55417
|
k.triantaf
|
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
15 |
51750
|
sofia.balt
|
|
16 |
51749
|
argiro.kok
|
import {PiwikHelper} from '../utils/piwikHelper';
|
17 |
55417
|
k.triantaf
|
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
18 |
55996
|
argiro.kok
|
import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service";
|
19 |
|
|
import {SearchCommunityProjectsService} from "../openaireLibrary/connect/projects/searchProjects.service";
|
20 |
|
|
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
|
21 |
56817
|
konstantin
|
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
|
22 |
56841
|
konstantin
|
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
|
23 |
57061
|
k.triantaf
|
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
24 |
58574
|
konstantin
|
import {SubscribeComponent} from "../utils/subscribe/subscribe.component";
|
25 |
58626
|
argiro.kok
|
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
26 |
55417
|
k.triantaf
|
|
27 |
50428
|
argiro.kok
|
@Component({
|
28 |
55417
|
k.triantaf
|
selector: 'community',
|
29 |
|
|
templateUrl: 'community.component.html',
|
30 |
50428
|
argiro.kok
|
})
|
31 |
51164
|
sofia.balt
|
|
32 |
50428
|
argiro.kok
|
export class CommunityComponent {
|
33 |
56841
|
konstantin
|
public url: string = null;
|
34 |
|
|
|
35 |
53477
|
sofia.balt
|
public sub: any;
|
36 |
50428
|
argiro.kok
|
public piwiksub: any;
|
37 |
|
|
public subfunders: any;
|
38 |
|
|
|
39 |
50822
|
sofia.balt
|
public publicationTotal = null;
|
40 |
|
|
public researchDataTotal = null;
|
41 |
|
|
public softwareTotal = null;
|
42 |
52831
|
sofia.balt
|
public orpTotal = null;
|
43 |
50980
|
sofia.balt
|
public projectTotal = null;
|
44 |
|
|
public contentProviderTotal = null;
|
45 |
|
|
public organizationTotal = null;
|
46 |
50822
|
sofia.balt
|
|
47 |
58549
|
konstantin
|
public projectsCalculated: boolean = false;
|
48 |
|
|
public contentProvidersCalculated: boolean = false;
|
49 |
|
|
|
50 |
55417
|
k.triantaf
|
params: any = {};
|
51 |
|
|
properties: EnvProperties;
|
52 |
50428
|
argiro.kok
|
|
53 |
50822
|
sofia.balt
|
public publicationResults = null;
|
54 |
|
|
public researchDataResults = null;
|
55 |
|
|
public softwareResults = null;
|
56 |
52831
|
sofia.balt
|
public orpResults = null;
|
57 |
50568
|
sofia.balt
|
|
58 |
51407
|
argiro.kok
|
@Input() communityId = null;
|
59 |
50974
|
sofia.balt
|
public community = null;
|
60 |
50949
|
sofia.balt
|
|
61 |
51847
|
myrto.kouk
|
public communityInfo = null;
|
62 |
|
|
|
63 |
53479
|
sofia.balt
|
public showLoading: boolean = true;
|
64 |
53968
|
argiro.kok
|
masterZenodoCommunity = null;
|
65 |
|
|
zenodoCommunityIdS = [];
|
66 |
56518
|
argiro.kok
|
showAllSubjects = false;
|
67 |
|
|
showAllDescription = false;
|
68 |
58653
|
konstantin
|
public thresholdDescription: number = 500;
|
69 |
|
|
public descriptionDiff: number = 100;
|
70 |
58616
|
konstantin
|
|
71 |
|
|
subscribers: number = 0;
|
72 |
|
|
|
73 |
53477
|
sofia.balt
|
// TODO Unsubscribe
|
74 |
|
|
public subPublications;
|
75 |
|
|
public subResearchData;
|
76 |
|
|
public subSoftware;
|
77 |
|
|
public subOrps;
|
78 |
55417
|
k.triantaf
|
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
|
79 |
58549
|
konstantin
|
public activeTab = "summary";
|
80 |
56138
|
argiro.kok
|
public show: string = 'overview';
|
81 |
55417
|
k.triantaf
|
|
82 |
58392
|
argiro.kok
|
searchLinkToResults: string = null;
|
83 |
|
|
|
84 |
56817
|
konstantin
|
searchLinkToProjects: string = null;
|
85 |
|
|
searchLinkToDataProviders: string = null;
|
86 |
58392
|
argiro.kok
|
searchLinkToAdvancedResults: string = null;
|
87 |
56817
|
konstantin
|
shareInZenodoPage: string = null;
|
88 |
57548
|
k.triantaf
|
public routerHelper: RouterHelper = new RouterHelper();
|
89 |
57061
|
k.triantaf
|
private user: User;
|
90 |
56817
|
konstantin
|
|
91 |
58574
|
konstantin
|
@ViewChild(SubscribeComponent) subscribeComponent: SubscribeComponent = null;
|
92 |
58626
|
argiro.kok
|
//Search Form
|
93 |
|
|
selectedEntity;
|
94 |
|
|
selectedEntitySimpleUrl;
|
95 |
|
|
selectedEntityAdvancedUrl;
|
96 |
|
|
keyword:string ="";
|
97 |
|
|
customFilter;
|
98 |
58629
|
argiro.kok
|
placeholderText="Search by title, author, abstract, DOI, orcid... ";
|
99 |
58574
|
konstantin
|
|
100 |
55417
|
k.triantaf
|
constructor(
|
101 |
54852
|
argiro.kok
|
private element: ElementRef,
|
102 |
55417
|
k.triantaf
|
private route: ActivatedRoute,
|
103 |
|
|
private _router: Router,
|
104 |
|
|
private location: Location,
|
105 |
|
|
private _meta: Meta,
|
106 |
|
|
private _title: Title,
|
107 |
|
|
private _piwikService: PiwikService,
|
108 |
|
|
private config: ConfigurationService,
|
109 |
|
|
private _communityService: CommunityService,
|
110 |
57548
|
k.triantaf
|
private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
|
111 |
55996
|
argiro.kok
|
private _searchCommunityProjectsService: SearchCommunityProjectsService,
|
112 |
|
|
private _searchResearchResultsService: SearchResearchResultsService,
|
113 |
55417
|
k.triantaf
|
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
|
114 |
56841
|
konstantin
|
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
|
115 |
57061
|
k.triantaf
|
private seoService: SEOService,
|
116 |
|
|
private userManagementService: UserManagementService) {
|
117 |
51164
|
sofia.balt
|
|
118 |
55417
|
k.triantaf
|
var description = "OpenAIRE - Connect, Community Dashboard, research community";
|
119 |
|
|
var title = "OpenAIRE - Connect";
|
120 |
|
|
this._meta.updateTag({content: description}, "name='description'");
|
121 |
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
122 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
123 |
|
|
this._title.setTitle(title);
|
124 |
50428
|
argiro.kok
|
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
public ngOnInit() {
|
128 |
50681
|
argiro.kok
|
this.route.data
|
129 |
55417
|
k.triantaf
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
130 |
|
|
this.properties = data.envSpecific;
|
131 |
58392
|
argiro.kok
|
this.searchLinkToResults = this.properties.searchLinkToResults;
|
132 |
56817
|
konstantin
|
this.searchLinkToProjects = this.properties.searchLinkToProjects;
|
133 |
|
|
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
|
134 |
58392
|
argiro.kok
|
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
|
135 |
56817
|
konstantin
|
this.shareInZenodoPage = this.properties.shareInZenodoPage;
|
136 |
56841
|
konstantin
|
this.url = data.envSpecific.baseLink + this._router.url;
|
137 |
|
|
this.seoService.createLinkForCanonicalURL(this.url, false);
|
138 |
|
|
this._meta.updateTag({content: this.url}, "property='og:url'");
|
139 |
57944
|
k.triantaf
|
this.userManagementService.getUserInfo().subscribe(user => {
|
140 |
57548
|
k.triantaf
|
this.user = user;
|
141 |
|
|
});
|
142 |
55417
|
k.triantaf
|
if (this.communityId != null && this.communityId != '') {
|
143 |
58626
|
argiro.kok
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
|
144 |
55417
|
k.triantaf
|
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
145 |
|
|
community => {
|
146 |
|
|
if (typeof document !== 'undefined') {
|
147 |
|
|
HelperFunctions.scroll();
|
148 |
|
|
}
|
149 |
|
|
this.community = community;
|
150 |
58653
|
konstantin
|
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
151 |
|
|
this.thresholdDescription = community.description.length;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
55417
|
k.triantaf
|
if (this.properties.environment == "development") {
|
155 |
|
|
this.params = {communityId: community.communityId};
|
156 |
|
|
}
|
157 |
|
|
this._meta.updateTag({content: community.description}, "name='description'");
|
158 |
|
|
this._meta.updateTag({content: community.description}, "property='og:description'");
|
159 |
|
|
this._meta.updateTag({content: community.title}, "property='og:title'");
|
160 |
|
|
this._title.setTitle(community.title);
|
161 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
162 |
57548
|
k.triantaf
|
this.piwiksub = this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe();
|
163 |
55417
|
k.triantaf
|
}
|
164 |
|
|
if (this.community.zenodoCommunity) {
|
165 |
|
|
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
166 |
|
|
result => {
|
167 |
|
|
this.masterZenodoCommunity = result;
|
168 |
51621
|
argiro.kok
|
|
169 |
55417
|
k.triantaf
|
},
|
170 |
|
|
error => {
|
171 |
|
|
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
172 |
|
|
// emptyCommunity.id = this.masterZenodoCommunityId;
|
173 |
|
|
// emptyCommunity.title = this.masterZenodoCommunityId;
|
174 |
|
|
// this.masterZenodoCommunity = emptyCommunity;
|
175 |
|
|
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded");
|
176 |
|
|
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunityId, error);
|
177 |
53968
|
argiro.kok
|
|
178 |
55417
|
k.triantaf
|
}
|
179 |
|
|
);
|
180 |
|
|
}
|
181 |
|
|
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
182 |
|
|
result => {
|
183 |
|
|
this.zenodoCommunityIdS = result;
|
184 |
53968
|
argiro.kok
|
|
185 |
|
|
|
186 |
55417
|
k.triantaf
|
},
|
187 |
|
|
error => {
|
188 |
|
|
//console.error("list of zenodo communities couldn't be loaded");
|
189 |
|
|
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
190 |
|
|
} //this.handleError('System error retrieving community profile', error)
|
191 |
|
|
);
|
192 |
53968
|
argiro.kok
|
|
193 |
55417
|
k.triantaf
|
//console.log(community);
|
194 |
|
|
});
|
195 |
53968
|
argiro.kok
|
|
196 |
57548
|
k.triantaf
|
this.countResearchResults("publication");
|
197 |
|
|
this.countResearchResults("dataset");
|
198 |
|
|
this.countResearchResults("software");
|
199 |
|
|
this.countResearchResults("other");
|
200 |
50980
|
sofia.balt
|
|
201 |
57548
|
k.triantaf
|
this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
|
202 |
|
|
projectTotal => {
|
203 |
|
|
this.projectTotal = projectTotal;
|
204 |
|
|
//console.log(projectTotal);
|
205 |
|
|
},
|
206 |
|
|
error => {
|
207 |
|
|
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
|
208 |
58549
|
konstantin
|
},
|
209 |
|
|
() => {
|
210 |
|
|
this.projectsCalculated = true;
|
211 |
57548
|
k.triantaf
|
}
|
212 |
|
|
);
|
213 |
51238
|
sofia.balt
|
|
214 |
57548
|
k.triantaf
|
this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
|
215 |
|
|
contentProviderTotal => {
|
216 |
|
|
this.contentProviderTotal = contentProviderTotal;
|
217 |
|
|
//console.log(contentProviderTotal);
|
218 |
|
|
},
|
219 |
|
|
error => {
|
220 |
|
|
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
|
221 |
58549
|
konstantin
|
},
|
222 |
|
|
() => {
|
223 |
|
|
this.contentProvidersCalculated = true;
|
224 |
57548
|
k.triantaf
|
}
|
225 |
55417
|
k.triantaf
|
);
|
226 |
53968
|
argiro.kok
|
|
227 |
55417
|
k.triantaf
|
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
|
228 |
|
|
// organizationTotal => {
|
229 |
|
|
// this.organizationTotal = organizationTotal;
|
230 |
|
|
// console.log(organizationTotal);
|
231 |
|
|
// });
|
232 |
50518
|
sofia.balt
|
|
233 |
50980
|
sofia.balt
|
|
234 |
55417
|
k.triantaf
|
/**/
|
235 |
55996
|
argiro.kok
|
this.config.getCommunityInformation(this.properties, this.communityId).subscribe(
|
236 |
55417
|
k.triantaf
|
res => {
|
237 |
|
|
this.communityInfo = res;
|
238 |
|
|
},
|
239 |
|
|
error => {
|
240 |
|
|
//console.log(error)
|
241 |
|
|
this.handleError("Error getting community with id: " + this.communityId, error);
|
242 |
|
|
}
|
243 |
|
|
);
|
244 |
|
|
}
|
245 |
|
|
});
|
246 |
50428
|
argiro.kok
|
}
|
247 |
50941
|
sofia.balt
|
|
248 |
57085
|
konstantin
|
public countResearchResults(resultType: string) {
|
249 |
57548
|
k.triantaf
|
this._searchResearchResultsService.countTotalResults(resultType, this.properties, "&fq=communityid=" + this.communityId).subscribe(
|
250 |
57085
|
konstantin
|
researchResultsTotal => {
|
251 |
|
|
this.setTotal(resultType, researchResultsTotal);
|
252 |
57548
|
k.triantaf
|
if (resultType == "publication") {
|
253 |
58549
|
konstantin
|
//this.searchResearchResults(resultType, this.publicationTotal, this.publicationResults);
|
254 |
54863
|
konstantin
|
}
|
255 |
57085
|
konstantin
|
},
|
256 |
|
|
error => {
|
257 |
57548
|
k.triantaf
|
this.handleError("Error getting number of " + this.getEntityName(resultType, true, true) + " for community with id: " + this.communityId, error);
|
258 |
57085
|
konstantin
|
}
|
259 |
|
|
);
|
260 |
53477
|
sofia.balt
|
}
|
261 |
|
|
|
262 |
57085
|
konstantin
|
public searchResearchResults(resultType: string, resultsTotal: number, results: Array<any>) {
|
263 |
|
|
this.setActiveTab(resultType);
|
264 |
53477
|
sofia.balt
|
|
265 |
57085
|
konstantin
|
if (resultsTotal > 0 && results == null) {
|
266 |
|
|
this.showLoading = true;
|
267 |
53477
|
sofia.balt
|
|
268 |
57085
|
konstantin
|
this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + this.communityId, 1, 5, "resultdateofacceptance,descending", [], this.properties).subscribe(
|
269 |
|
|
researchResults => {
|
270 |
|
|
this.setResults(resultType, researchResults[1]);
|
271 |
55417
|
k.triantaf
|
this.showLoading = false;
|
272 |
54863
|
konstantin
|
},
|
273 |
|
|
error => {
|
274 |
57548
|
k.triantaf
|
this.handleError("Error getting " + this.getEntityName(resultType, true, true) + " for community with id: " + this.communityId, error);
|
275 |
54863
|
konstantin
|
}
|
276 |
|
|
);
|
277 |
53477
|
sofia.balt
|
}
|
278 |
|
|
}
|
279 |
|
|
|
280 |
50428
|
argiro.kok
|
public ngOnDestroy() {
|
281 |
55417
|
k.triantaf
|
if (this.piwiksub) {
|
282 |
50428
|
argiro.kok
|
this.piwiksub.unsubscribe();
|
283 |
|
|
}
|
284 |
|
|
}
|
285 |
51847
|
myrto.kouk
|
|
286 |
55271
|
argiro.kok
|
isEntityEnabled(entity: string) {
|
287 |
55417
|
k.triantaf
|
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
|
288 |
51847
|
myrto.kouk
|
}
|
289 |
55417
|
k.triantaf
|
|
290 |
55271
|
argiro.kok
|
isRouteEnabled(route: string) {
|
291 |
55417
|
k.triantaf
|
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
|
292 |
53968
|
argiro.kok
|
}
|
293 |
55302
|
argiro.kok
|
|
294 |
55417
|
k.triantaf
|
showInvite() {
|
295 |
57944
|
k.triantaf
|
return this.isManager();
|
296 |
55302
|
argiro.kok
|
}
|
297 |
|
|
|
298 |
55417
|
k.triantaf
|
isManager() {
|
299 |
57548
|
k.triantaf
|
if (!this.user) {
|
300 |
57061
|
k.triantaf
|
return false;
|
301 |
|
|
}
|
302 |
|
|
var email = this.user.email;
|
303 |
55417
|
k.triantaf
|
var index = -1;
|
304 |
|
|
if (email && this.community != null && this.community.managers != null) {
|
305 |
|
|
index = this.community.managers.indexOf(email);
|
306 |
54047
|
argiro.kok
|
}
|
307 |
57061
|
k.triantaf
|
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
|
308 |
54047
|
argiro.kok
|
}
|
309 |
54863
|
konstantin
|
|
310 |
|
|
private handleError(message: string, error) {
|
311 |
55417
|
k.triantaf
|
console.error("Community (component): " + message, error);
|
312 |
54863
|
konstantin
|
}
|
313 |
55271
|
argiro.kok
|
|
314 |
55417
|
k.triantaf
|
getSearchPlaceHolder() {
|
315 |
55271
|
argiro.kok
|
var entities = [];
|
316 |
55417
|
k.triantaf
|
if (this.isEntityEnabled("publication")) {
|
317 |
55271
|
argiro.kok
|
entities.push("publications");
|
318 |
|
|
}
|
319 |
55417
|
k.triantaf
|
if (this.isEntityEnabled("dataset")) {
|
320 |
55271
|
argiro.kok
|
entities.push("research data");
|
321 |
|
|
}
|
322 |
55417
|
k.triantaf
|
if (this.isEntityEnabled("software")) {
|
323 |
55271
|
argiro.kok
|
entities.push("software");
|
324 |
|
|
}
|
325 |
55417
|
k.triantaf
|
if (this.isEntityEnabled("orp")) {
|
326 |
55271
|
argiro.kok
|
entities.push("other research products");
|
327 |
|
|
}
|
328 |
55417
|
k.triantaf
|
return "Search" + ((entities.length > 0) ? (" for " + entities.join(', ') + "...") : "");
|
329 |
55283
|
argiro.kok
|
}
|
330 |
55271
|
argiro.kok
|
|
331 |
55417
|
k.triantaf
|
countOtherGraphs() {
|
332 |
|
|
var count = 0;
|
333 |
|
|
if (this.statistics && this.statistics.allowedEntities) {
|
334 |
|
|
for (var entity of this.statistics.allowedEntities) {
|
335 |
|
|
if (this.statistics.statisticsSum[entity].total > 0 && this.statistics.allowedCharts[entity].length > 0 && this.activeTab != entity) {
|
336 |
|
|
count += this.statistics.allowedCharts[entity].length;
|
337 |
|
|
}
|
338 |
55283
|
argiro.kok
|
}
|
339 |
|
|
}
|
340 |
55417
|
k.triantaf
|
return count;
|
341 |
55271
|
argiro.kok
|
}
|
342 |
55417
|
k.triantaf
|
|
343 |
|
|
createParams(param) {
|
344 |
55366
|
argiro.kok
|
return StringUtils.quote(StringUtils.URIEncode(param));
|
345 |
55417
|
k.triantaf
|
}
|
346 |
55283
|
argiro.kok
|
|
347 |
57085
|
konstantin
|
private setActiveTab(entityType: string) {
|
348 |
57548
|
k.triantaf
|
if (entityType == "other") {
|
349 |
57085
|
konstantin
|
this.activeTab = "orp";
|
350 |
|
|
} else {
|
351 |
|
|
this.activeTab = entityType;
|
352 |
|
|
}
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
private setResults(entityType: string, results: Array<any>) {
|
356 |
57548
|
k.triantaf
|
if (entityType == "publication") {
|
357 |
57085
|
konstantin
|
this.publicationResults = results;
|
358 |
57548
|
k.triantaf
|
} else if (entityType == "dataset") {
|
359 |
57085
|
konstantin
|
this.researchDataResults = results;
|
360 |
57548
|
k.triantaf
|
} else if (entityType == "software") {
|
361 |
57085
|
konstantin
|
this.softwareResults = results;
|
362 |
57548
|
k.triantaf
|
} else if (entityType == "other") {
|
363 |
57085
|
konstantin
|
this.orpResults = results;
|
364 |
|
|
}
|
365 |
|
|
}
|
366 |
|
|
|
367 |
|
|
private setTotal(entityType: string, total: number) {
|
368 |
57548
|
k.triantaf
|
if (entityType == "publication") {
|
369 |
57085
|
konstantin
|
this.publicationTotal = total;
|
370 |
57548
|
k.triantaf
|
} else if (entityType == "dataset") {
|
371 |
57085
|
konstantin
|
this.researchDataTotal = total;
|
372 |
57548
|
k.triantaf
|
} else if (entityType == "software") {
|
373 |
57085
|
konstantin
|
this.softwareTotal = total;
|
374 |
57548
|
k.triantaf
|
} else if (entityType == "other") {
|
375 |
57085
|
konstantin
|
this.orpTotal = total;
|
376 |
|
|
}
|
377 |
|
|
}
|
378 |
|
|
|
379 |
57548
|
k.triantaf
|
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
380 |
|
|
if (entityType == "publication") {
|
381 |
57085
|
konstantin
|
return "publication" + (plural ? "s" : "");
|
382 |
57548
|
k.triantaf
|
} else if (entityType == "dataset") {
|
383 |
57085
|
konstantin
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
384 |
57548
|
k.triantaf
|
} else if (entityType == "software") {
|
385 |
57085
|
konstantin
|
return "software";
|
386 |
57548
|
k.triantaf
|
} else if (entityType == "other") {
|
387 |
57085
|
konstantin
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
388 |
|
|
}
|
389 |
|
|
}
|
390 |
58549
|
konstantin
|
|
391 |
|
|
public buildProjectsAndContentProvidesTooltip(): string {
|
392 |
|
|
let tooltipContent: string = "<div class='uk-margin'>";
|
393 |
|
|
|
394 |
|
|
if(this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
|
395 |
|
|
tooltipContent += "<span class='uk-text-bold'>Projects</span>";
|
396 |
|
|
}
|
397 |
|
|
if(this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)
|
398 |
|
|
&& (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders))) {
|
399 |
|
|
tooltipContent += " and ";
|
400 |
|
|
}
|
401 |
|
|
if(this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
|
402 |
|
|
tooltipContent += "<span class='uk-text-bold'>Content Providers</span>";
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
|
406 |
|
|
tooltipContent += "</div>";
|
407 |
|
|
|
408 |
|
|
return tooltipContent;
|
409 |
|
|
}
|
410 |
|
|
|
411 |
|
|
public buildZenodoCommunitiesTooltip(): string {
|
412 |
|
|
let tooltipContent: string = "<div class='uk-margin'>";
|
413 |
|
|
|
414 |
|
|
tooltipContent += "<span class='uk-text-bold'>Zenodo</span> is a catch-all repository for OpenAIRE.";
|
415 |
|
|
tooltipContent += "<div class='uk-margin-small-top'>A <span class='uk-text-bold'>Zenodo Community</span> is created and curated by Zenodo users.</div>";
|
416 |
|
|
tooltipContent += "</div>";
|
417 |
|
|
return tooltipContent;
|
418 |
|
|
}
|
419 |
58616
|
konstantin
|
|
420 |
58626
|
argiro.kok
|
entityChanged($event){
|
421 |
|
|
this.selectedEntity = $event.entity;
|
422 |
|
|
this.selectedEntitySimpleUrl = $event.simpleUrl;
|
423 |
|
|
this.selectedEntityAdvancedUrl = $event.advancedUrl;
|
424 |
58629
|
argiro.kok
|
if(this.selectedEntity == 'result'){
|
425 |
|
|
this.placeholderText ="Search by title, author, abstract, DOI, orcid... ";
|
426 |
|
|
}else if(this.selectedEntity == 'project') {
|
427 |
|
|
this.placeholderText = "Search by project title, grant id, funder...";
|
428 |
|
|
}else if(this.selectedEntity == 'dataprovider') {
|
429 |
|
|
this.placeholderText = "Search by name...";
|
430 |
|
|
}else{
|
431 |
|
|
this.placeholderText = "Search community content";
|
432 |
|
|
}
|
433 |
58626
|
argiro.kok
|
}
|
434 |
58629
|
argiro.kok
|
|
435 |
58626
|
argiro.kok
|
goTo(simple:boolean){
|
436 |
|
|
let url = (simple)?this.selectedEntitySimpleUrl:this.selectedEntityAdvancedUrl;
|
437 |
|
|
let parameterNames = [];
|
438 |
|
|
let parameterValues = [];
|
439 |
|
|
if (this.selectedEntity == "result") {
|
440 |
|
|
/* if (this.resultTypes) {
|
441 |
|
|
let values = [];
|
442 |
|
|
if (this.resultTypes.publication) {
|
443 |
|
|
values.push("publications");
|
444 |
|
|
}
|
445 |
|
|
if (this.resultTypes.dataset) {
|
446 |
|
|
values.push("datasets");
|
447 |
|
|
}
|
448 |
|
|
if (this.resultTypes.software) {
|
449 |
|
|
values.push("software");
|
450 |
|
|
}
|
451 |
|
|
if (this.resultTypes.other) {
|
452 |
|
|
values.push("other");
|
453 |
|
|
}
|
454 |
|
|
if (values.length > 0) {
|
455 |
|
|
parameterNames.push("type");
|
456 |
|
|
parameterValues.push(values.join(","));
|
457 |
|
|
}
|
458 |
|
|
if (this.resultsQuickFilter) {
|
459 |
|
|
parameterNames.push("qf");
|
460 |
|
|
parameterValues.push("" + this.resultsQuickFilter.selected);
|
461 |
|
|
}
|
462 |
|
|
}*/
|
463 |
|
|
}
|
464 |
|
|
if(this.keyword.length > 0) {
|
465 |
|
|
parameterNames.push("q");
|
466 |
|
|
parameterValues.push(this.keyword);
|
467 |
|
|
parameterNames.push("op");
|
468 |
|
|
parameterValues.push("and");
|
469 |
|
|
}
|
470 |
|
|
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
|
471 |
|
|
}
|
472 |
|
|
|
473 |
58616
|
konstantin
|
public countSubscribersEvent($event){
|
474 |
|
|
this.subscribers = $event.value;
|
475 |
|
|
}
|
476 |
55283
|
argiro.kok
|
}
|