1 |
61065
|
k.triantaf
|
import {Component, ViewChild} from '@angular/core';
|
2 |
|
|
import {Subscription} from 'rxjs';
|
3 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
4 |
|
|
import {Location} from '@angular/common';
|
5 |
|
|
import {Meta, Title} from '@angular/platform-browser';
|
6 |
|
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
7 |
|
|
import {SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
|
8 |
|
|
import {SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
|
9 |
|
|
import {SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
|
10 |
|
|
import {RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
|
11 |
|
|
import {SearchFields} from '../openaireLibrary/utils/properties/searchFields';
|
12 |
|
|
|
13 |
|
|
import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
|
14 |
|
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
15 |
|
|
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
|
16 |
|
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
17 |
|
|
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
|
18 |
|
|
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
|
19 |
|
|
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
|
20 |
|
|
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
|
21 |
|
|
import {properties} from "../../environments/environment";
|
22 |
|
|
import {Numbers, NumbersComponent} from "../openaireLibrary/sharedComponents/numbers/numbers.component";
|
23 |
|
|
|
24 |
|
|
@Component({
|
25 |
|
|
selector: 'home',
|
26 |
|
|
templateUrl: 'home.component.html',
|
27 |
|
|
})
|
28 |
|
|
export class HomeComponent {
|
29 |
|
|
// MAX 12 logos in every slide
|
30 |
|
|
public logos = {
|
31 |
|
|
"publication": [
|
32 |
|
|
[
|
33 |
|
|
"logo-pubmed.png",
|
34 |
|
|
"logo-arxiv.png",
|
35 |
|
|
"logo-base.png",
|
36 |
|
|
"logo-scielo.png",
|
37 |
|
|
"logo-la-referencia.png",
|
38 |
|
|
"logo-soar.png",
|
39 |
|
|
"logo-repec.png",
|
40 |
|
|
"logo-core.png",
|
41 |
|
|
"logo-zenodo.png",
|
42 |
|
|
"logo-narcis.png"
|
43 |
|
|
],
|
44 |
|
|
[
|
45 |
|
|
"logo-crossref.png",
|
46 |
|
|
"logo-unpaywall.png",
|
47 |
|
|
"logo-elsevier.png",
|
48 |
|
|
"logo-spring-nature.png",
|
49 |
|
|
"logo-frontiers.png",
|
50 |
|
|
"logo-opencitations.png",
|
51 |
|
|
"logo-doaj.png",
|
52 |
|
|
"logo-microsoft.png",
|
53 |
|
|
"logo-plos.png",
|
54 |
|
|
"logo-f1000.png",
|
55 |
|
|
"logo-copernicus.png"
|
56 |
|
|
]
|
57 |
|
|
],
|
58 |
|
|
"software": [
|
59 |
|
|
[
|
60 |
|
|
"logo-software-heritage.png",
|
61 |
|
|
"logo-github.png",
|
62 |
|
|
"logo-doecode.png",
|
63 |
|
|
"logo-bitbucket.png",
|
64 |
|
|
"logo-elixir-bio-tools.png",
|
65 |
|
|
"logo-google-code.png",
|
66 |
|
|
"logo-sourceforge.png",
|
67 |
|
|
"logo-zenodo.png"
|
68 |
|
|
]
|
69 |
|
|
],
|
70 |
|
|
"dataset": [
|
71 |
|
|
[
|
72 |
|
|
"logo-scholexplorer.png",
|
73 |
|
|
"logo-zenodo.png",
|
74 |
|
|
"logo-datacite.png",
|
75 |
|
|
"logo-pangea.png",
|
76 |
|
|
"logo-figshare.png",
|
77 |
|
|
"logo-protocols.png",
|
78 |
|
|
"logo-opentrials.png",
|
79 |
|
|
"logo-kaggle.png",
|
80 |
|
|
"logo-reactome.png",
|
81 |
|
|
"logo-easy.png",
|
82 |
|
|
"logo-dryad.png"
|
83 |
|
|
]
|
84 |
|
|
],
|
85 |
|
|
//"other": [],
|
86 |
|
|
"persistent": [
|
87 |
|
|
[
|
88 |
|
|
"logo-re3data.png",
|
89 |
|
|
"logo-orcid.png",
|
90 |
|
|
"logo-opendoar.png",
|
91 |
|
|
"logo-grid.png"
|
92 |
|
|
]
|
93 |
|
|
],
|
94 |
|
|
"funder": [
|
95 |
|
|
[
|
96 |
|
|
"logo-european-commision.png",
|
97 |
|
|
"logo-nsf.png",
|
98 |
|
|
"logo-nhmrc.png",
|
99 |
|
|
"logo-sfi.png",
|
100 |
|
|
"logo-nwo.png",
|
101 |
|
|
"logo-welcome-trust.png",
|
102 |
|
|
"logo-fct.png",
|
103 |
|
|
"logo-gsrt.png",
|
104 |
|
|
"logo-fnsnf.png"
|
105 |
|
|
]
|
106 |
|
|
]
|
107 |
|
|
};
|
108 |
|
|
|
109 |
|
|
public pageTitle = "OpenAIRE";
|
110 |
|
|
public keyword: string = "";
|
111 |
|
|
|
112 |
|
|
public searchFields: SearchFields = new SearchFields();
|
113 |
|
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
114 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
115 |
|
|
public numbers: Numbers;
|
116 |
|
|
showPublications: boolean = false;
|
117 |
|
|
showDatasets: boolean = false;
|
118 |
|
|
showSoftware: boolean = false;
|
119 |
|
|
showOrp: boolean = false;
|
120 |
|
|
showProjects: boolean = false;
|
121 |
|
|
showDataProviders: boolean = false;
|
122 |
|
|
showOrganizations: boolean = false;
|
123 |
|
|
properties: EnvProperties = properties;
|
124 |
|
|
public readMore: boolean = false;
|
125 |
|
|
|
126 |
|
|
subs: Subscription[] = [];
|
127 |
|
|
|
128 |
|
|
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
|
129 |
|
|
filter: null,
|
130 |
|
|
selected: true,
|
131 |
|
|
filterId: "resultbestaccessright",
|
132 |
|
|
value: "Open Access"
|
133 |
|
|
};
|
134 |
|
|
selectedEntity = "all";
|
135 |
|
|
selectedEntitySimpleUrl;
|
136 |
|
|
selectedEntityAdvancedUrl;
|
137 |
|
|
resultTypes: Filter = {
|
138 |
|
|
values: [],
|
139 |
|
|
filterId: "type",
|
140 |
|
|
countSelectedValues: 0,
|
141 |
|
|
filterType: 'checkbox',
|
142 |
|
|
originalFilterId: "",
|
143 |
|
|
valueIsExact: true,
|
144 |
|
|
title: "Result Types",
|
145 |
|
|
filterOperator: "or"
|
146 |
|
|
};
|
147 |
|
|
public pageContents = null;
|
148 |
61071
|
k.triantaf
|
@ViewChild("numbersComponent", { static: true }) numbersComponent: NumbersComponent;
|
149 |
61065
|
k.triantaf
|
|
150 |
|
|
constructor(
|
151 |
|
|
private route: ActivatedRoute,
|
152 |
|
|
private _router: Router,
|
153 |
|
|
private _searchResearchResultsService: SearchResearchResultsService,
|
154 |
|
|
private _searchDataprovidersService: SearchDataprovidersService,
|
155 |
|
|
private _searchProjectsService: SearchProjectsService,
|
156 |
|
|
private _searchOrganizationsService: SearchOrganizationsService,
|
157 |
|
|
private _refineFieldResultsService: RefineFieldResultsService,
|
158 |
|
|
private location: Location, private _piwikService: PiwikService,
|
159 |
|
|
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
|
160 |
|
|
private helper: HelperService
|
161 |
|
|
) {
|
162 |
|
|
let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
|
163 |
|
|
let title = "OpenAIRE | Find and Share research";
|
164 |
|
|
this._title.setTitle(title);
|
165 |
|
|
this._meta.updateTag({content: description}, "name='description'");
|
166 |
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
167 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
private getPageContents() {
|
171 |
|
|
this.subs.push(this.helper.getPageHelpContents(this.properties, 'openaire', this._router.url).subscribe(contents => {
|
172 |
|
|
this.pageContents = contents;
|
173 |
|
|
}));
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
public getKeys(obj: {}) {
|
177 |
|
|
return Object.keys(obj);
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
createRange(number) {
|
181 |
|
|
var items: number[] = [];
|
182 |
|
|
for (var i = 1; i <= number; i++) {
|
183 |
|
|
items.push(i);
|
184 |
|
|
}
|
185 |
|
|
return items;
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
public ceil(num: number) {
|
189 |
|
|
return Math.ceil(num);
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
public ngOnInit() {
|
193 |
|
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url, false);
|
194 |
|
|
this.getPageContents();
|
195 |
|
|
if (this.properties != null) {
|
196 |
|
|
var url = this.properties.domain + this.properties.baseLink + this._router.url;
|
197 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
198 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
199 |
|
|
this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
|
200 |
|
|
}
|
201 |
|
|
//this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity ).subscribe(data => {
|
202 |
|
|
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
203 |
|
|
if (data) {
|
204 |
|
|
var showEntity = {};
|
205 |
|
|
for (var i = 0; i < data['entities'].length; i++) {
|
206 |
|
|
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
|
207 |
|
|
}
|
208 |
|
|
this.showPublications = !!showEntity["publication"];
|
209 |
|
|
this.showDatasets = !!showEntity["dataset"];
|
210 |
|
|
this.showSoftware = !!showEntity["software"];
|
211 |
|
|
this.showOrp = !!showEntity["orp"];
|
212 |
|
|
this.showProjects = !!showEntity["project"];
|
213 |
|
|
this.showDataProviders = !!showEntity["datasource"];
|
214 |
|
|
this.showOrganizations = !!showEntity["organization"];
|
215 |
|
|
if (this.showPublications) {
|
216 |
|
|
this.resultTypes.values.push({name: "Publications", id: "publications", selected: true, number: 0});
|
217 |
|
|
}
|
218 |
|
|
if (this.showDatasets) {
|
219 |
|
|
this.resultTypes.values.push({name: "Research data", id: "datasets", selected: true, number: 0});
|
220 |
|
|
}
|
221 |
|
|
if (this.showSoftware) {
|
222 |
|
|
this.resultTypes.values.push({name: "Software", id: "software", selected: true, number: 0});
|
223 |
|
|
}
|
224 |
|
|
if (this.showOrp) {
|
225 |
|
|
this.resultTypes.values.push({name: "Other research products", id: "other", selected: true, number: 0});
|
226 |
|
|
}
|
227 |
|
|
this.numbersComponent.init(this.showDatasets, this.showSoftware, this.showPublications, this.showDatasets, this.showSoftware, this.showOrp, this.showProjects, this.showDataProviders);
|
228 |
|
|
}
|
229 |
|
|
},
|
230 |
|
|
error => {
|
231 |
|
|
this.handleError("Error getting community information", error);
|
232 |
|
|
}
|
233 |
|
|
));
|
234 |
|
|
}
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
public ngOnDestroy() {
|
238 |
|
|
for (let sub of this.subs) {
|
239 |
|
|
sub.unsubscribe();
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
private handleError(message: string, error) {
|
244 |
|
|
console.error("Home Page: " + message, error);
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
entityChanged($event) {
|
248 |
|
|
this.selectedEntity = $event.entity;
|
249 |
|
|
this.selectedEntitySimpleUrl = $event.simpleUrl;
|
250 |
|
|
this.selectedEntityAdvancedUrl = $event.advancedUrl;
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
goTo(simple: boolean) {
|
254 |
|
|
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
|
255 |
|
|
let parameterNames = [];
|
256 |
|
|
let parameterValues = [];
|
257 |
|
|
if (this.selectedEntity == "result") {
|
258 |
|
|
if (this.resultTypes) {
|
259 |
|
|
let values = [];
|
260 |
|
|
for (let value of this.resultTypes.values) {
|
261 |
|
|
if (value.selected) {
|
262 |
|
|
values.push(value.id);
|
263 |
|
|
}
|
264 |
|
|
}
|
265 |
|
|
if (values.length > 0 && values.length != 4) {
|
266 |
|
|
parameterNames.push("type");
|
267 |
|
|
parameterValues.push(values.join(","));
|
268 |
|
|
}
|
269 |
|
|
if (this.resultsQuickFilter && this.resultsQuickFilter.selected) {
|
270 |
|
|
parameterNames.push(this.resultsQuickFilter.filterId);
|
271 |
|
|
parameterValues.push('"'+ encodeURIComponent(this.resultsQuickFilter.value)+'"');
|
272 |
|
|
}
|
273 |
|
|
}
|
274 |
|
|
} else if (this.selectedEntity == "all") {
|
275 |
|
|
if (this.resultsQuickFilter && this.resultsQuickFilter.selected) {
|
276 |
|
|
parameterNames.push(this.resultsQuickFilter.filterId);
|
277 |
|
|
parameterValues.push('"'+ encodeURIComponent(this.resultsQuickFilter.value)+'"');
|
278 |
|
|
}
|
279 |
|
|
}
|
280 |
|
|
if (this.keyword.length > 0) {
|
281 |
|
|
parameterNames.push("fv0");
|
282 |
|
|
parameterValues.push(this.keyword);
|
283 |
|
|
parameterNames.push("f0");
|
284 |
|
|
parameterValues.push("q");
|
285 |
|
|
}
|
286 |
|
|
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
|
287 |
|
|
}
|
288 |
|
|
}
|