Revision 49484
Added by Konstantina Galouni over 6 years ago
modules/uoa-services-portal/trunk/portal-2/src/app/services/softwareService.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import {SearchSoftwareService} from './searchSoftware.service'; |
|
6 |
|
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
CommonModule, FormsModule |
|
11 |
], |
|
12 |
declarations: [ |
|
13 |
], |
|
14 |
providers:[ |
|
15 |
SearchSoftwareService |
|
16 |
], |
|
17 |
exports: [ |
|
18 |
] |
|
19 |
}) |
|
20 |
export class SoftwareServiceModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/services/searchSoftware.service.ts | ||
---|---|---|
1 |
import {Injectable} from '@angular/core'; |
|
2 |
import {Http, Response} from '@angular/http'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 |
import {OpenaireProperties} from '../utils/properties/openaireProperties'; |
|
5 |
import {SearchResult} from '../utils/entities/searchResult'; |
|
6 |
import {RefineResultsUtils} from './servicesUtils/refineResults.class'; |
|
7 |
import 'rxjs/add/observable/of'; |
|
8 |
import 'rxjs/add/operator/do'; |
|
9 |
import 'rxjs/add/operator/share'; |
|
10 |
import { CacheService } from '../shared/cache.service'; |
|
11 |
@Injectable() |
|
12 |
export class SearchSoftwareService { |
|
13 |
private sizeOfDescription: number = 270; |
|
14 |
|
|
15 |
constructor(private http: Http, public _cache: CacheService) {} |
|
16 |
|
|
17 |
searchSoftware (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any { |
|
18 |
|
|
19 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
20 |
|
|
21 |
let url = link+"?"; |
|
22 |
if(params!= null && params != '' ) { |
|
23 |
url += params; |
|
24 |
} |
|
25 |
if(refineParams!= null && refineParams != '' ) { |
|
26 |
url += refineParams; |
|
27 |
} |
|
28 |
url += "&page="+ (page-1) +"&size="+size+"&format=json"; |
|
29 |
|
|
30 |
let key = url; |
|
31 |
if (this._cache.has(key)) { |
|
32 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
33 |
} |
|
34 |
return this.http.get(url) |
|
35 |
.map(res => <any> res.json()) |
|
36 |
//.do(res => console.info(res)) |
|
37 |
.do(res => { |
|
38 |
this._cache.set(key, res); |
|
39 |
}) |
|
40 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
41 |
} |
|
42 |
searchSoftwareById (id: string ):any { |
|
43 |
|
|
44 |
let url = OpenaireProperties.getSearchAPIURLLast()+"software/"+id+"?format=json"; |
|
45 |
let key = url+"-searchById"; |
|
46 |
if (this._cache.has(key)) { |
|
47 |
return Observable.of(this._cache.get(key)).map(res => this.parseResults(res)); |
|
48 |
} |
|
49 |
|
|
50 |
return this.http.get(url) |
|
51 |
.map(res => <any> res.json()) |
|
52 |
.do(res => { |
|
53 |
this._cache.set(key, res); |
|
54 |
}) |
|
55 |
.map(res => this.parseResults(res)); |
|
56 |
} |
|
57 |
|
|
58 |
searchAggregators (id: string, params: string, refineParams:string, page: number, size: number ):any { |
|
59 |
|
|
60 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
61 |
|
|
62 |
let url = link+"?"+"&format=json"; |
|
63 |
if(params!= null && params != '' ) { |
|
64 |
url += params; |
|
65 |
} |
|
66 |
if(refineParams!= null && refineParams != '' ) { |
|
67 |
url += refineParams; |
|
68 |
} |
|
69 |
url += "&page="+(page-1)+"&size="+size; |
|
70 |
|
|
71 |
let key = url; |
|
72 |
if (this._cache.has(key)) { |
|
73 |
return Observable.of(this._cache.get(key)).map(res => this.parseRefineResults(id, res['refineResults'])); |
|
74 |
} |
|
75 |
|
|
76 |
return this.http.get(url) |
|
77 |
.map(res => <any> res.json()) |
|
78 |
.do(res => { |
|
79 |
this._cache.set(key, res); |
|
80 |
}) |
|
81 |
.map(res => this.parseRefineResults(id, res['refineResults'])) |
|
82 |
} |
|
83 |
|
|
84 |
searchSoftwareByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any { |
|
85 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
86 |
let url = link+"?"; |
|
87 |
var doisParams = ""; |
|
88 |
|
|
89 |
for(var i =0 ;i < DOIs.length; i++){ |
|
90 |
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"'; |
|
91 |
} |
|
92 |
if(doisParams.length > 0){ |
|
93 |
url += "&"+doisParams; |
|
94 |
|
|
95 |
} |
|
96 |
if(refineParams!= null && refineParams != '' ) { |
|
97 |
url += refineParams; |
|
98 |
} |
|
99 |
url += "&page="+ (page-1) +"&size="+size+"&format=json"; |
|
100 |
|
|
101 |
let key = url; |
|
102 |
if (this._cache.has(key)) { |
|
103 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
104 |
} |
|
105 |
return this.http.get(url) |
|
106 |
.map(res => <any> res.json()) |
|
107 |
//.do(res => console.info(res)) |
|
108 |
.do(res => { |
|
109 |
this._cache.set(key, res); |
|
110 |
}) |
|
111 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
112 |
} |
|
113 |
advancedSearchSoftware (params: string, page: number, size: number ):any { |
|
114 |
let url = OpenaireProperties.getSearchResourcesAPIURL(); |
|
115 |
var basicQuery = "(oaftype exact result) and (resulttypeid exact software) " |
|
116 |
url += "?query="; |
|
117 |
if(params!= null && params != '' ) { |
|
118 |
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; |
|
119 |
}else{ |
|
120 |
url +=" ( "+basicQuery+ " ) "; |
|
121 |
} |
|
122 |
|
|
123 |
url += "&page="+(page-1)+"&size="+size; |
|
124 |
url += "&format=json"; |
|
125 |
let key = url; |
|
126 |
if (this._cache.has(key)) { |
|
127 |
return Observable.of(this._cache.get(key)); |
|
128 |
} |
|
129 |
return this.http.get(url) |
|
130 |
.map(res => <any> res.json()) |
|
131 |
//.do(res => console.info(res)) |
|
132 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]) |
|
133 |
.do(res => { |
|
134 |
this._cache.set(key, res); |
|
135 |
}); |
|
136 |
} |
|
137 |
searchSoftwareForEntity (params: string, page: number, size: number):any { |
|
138 |
let link = OpenaireProperties.getSearchAPIURLLast(); |
|
139 |
let url = link+params+"/software"+"?format=json"; |
|
140 |
let key = url; |
|
141 |
if (this._cache.has(key)) { |
|
142 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
143 |
} |
|
144 |
return this.http.get(url) |
|
145 |
.map(res => <any> res.json()) |
|
146 |
.do(res => { |
|
147 |
this._cache.set(key, res); |
|
148 |
}) |
|
149 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
150 |
} |
|
151 |
|
|
152 |
searchSoftwareForDataproviders(params: string, page: number, size: number):any { |
|
153 |
let link = OpenaireProperties.getSearchAPIURLLast(); |
|
154 |
let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json"; |
|
155 |
let key = url; |
|
156 |
if (this._cache.has(key)) { |
|
157 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
158 |
} |
|
159 |
return this.http.get(url) |
|
160 |
.map(res => <any> res.json()) |
|
161 |
.do(res => { |
|
162 |
this._cache.set(key, res); |
|
163 |
}) |
|
164 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
165 |
} |
|
166 |
|
|
167 |
parseResults(data: any): SearchResult[] { |
|
168 |
let results: SearchResult[] = []; |
|
169 |
|
|
170 |
let length = Array.isArray(data) ? data.length : 1; |
|
171 |
|
|
172 |
for(let i=0; i<length; i++) { |
|
173 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; |
|
174 |
|
|
175 |
var result: SearchResult = new SearchResult(); |
|
176 |
|
|
177 |
result['title'] = {"name": '', "accessMode": '', "sc39": ''}; |
|
178 |
|
|
179 |
if(Array.isArray(resData['title'])) { |
|
180 |
result['title'].name = resData['title'][0].content; |
|
181 |
} else { |
|
182 |
result['title'].name = resData['title'].content; |
|
183 |
} |
|
184 |
|
|
185 |
//result['title'].url = OpenaireProperties.getsearchLinkToSoftware(); |
|
186 |
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
187 |
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
188 |
if(resData['bestlicense'].hasOwnProperty("classid")) { |
|
189 |
result['title'].accessMode = resData['bestlicense'].classid; |
|
190 |
} |
|
191 |
|
|
192 |
if(resData['rels'].hasOwnProperty("rel")) { |
|
193 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; |
|
194 |
|
|
195 |
for(let j=0; j<relLength; j++) { |
|
196 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; |
|
197 |
|
|
198 |
if(relation.hasOwnProperty("to")) { |
|
199 |
if(relation['to'].class == "hasAuthor") { |
|
200 |
if(result['authors'] == undefined) { |
|
201 |
result['authors'] = new Array<{"name": string, "id": string}>(); |
|
202 |
} |
|
203 |
|
|
204 |
result['authors'].push({"name": relation.fullname, "id": relation['to'].content}); |
|
205 |
} else if(relation['to'].class == "isProducedBy") { |
|
206 |
result['projects'] = this.parseProjects(result['projects'], relation); |
|
207 |
} |
|
208 |
} |
|
209 |
} |
|
210 |
} |
|
211 |
|
|
212 |
var date:string = (resData.dateofacceptance)+""; // transform to string in case it is an integer |
|
213 |
result.year = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date; |
|
214 |
if(!Array.isArray(resData.description)) { |
|
215 |
result.description = resData.description; |
|
216 |
} else { |
|
217 |
result.description = resData.description[0]; |
|
218 |
} |
|
219 |
if(result.description.length > this.sizeOfDescription) { |
|
220 |
result.description = result.description.substring(0, this.sizeOfDescription)+"..."; |
|
221 |
} |
|
222 |
|
|
223 |
result.embargoEndDate = resData.embargoenddate; |
|
224 |
|
|
225 |
if(!Array.isArray(resData.publisher)) { |
|
226 |
result.publisher = resData.publisher; |
|
227 |
} else { |
|
228 |
for(let i=0; i<resData.publisher.length; i++) { |
|
229 |
if(result.publisher != undefined){ |
|
230 |
result.publisher += ', '+resData['publisher'][i]; |
|
231 |
} else { |
|
232 |
result.publisher = resData['publisher'][i]; |
|
233 |
} |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
results.push(result); |
|
238 |
} |
|
239 |
|
|
240 |
return results; |
|
241 |
} |
|
242 |
|
|
243 |
parseProjects(projects: { "id": string, "acronym": string, "title": string, |
|
244 |
"funderShortname": string, "funderName": string, |
|
245 |
"code": string }[], relation: any ) : { |
|
246 |
"id": string, "acronym": string, "title": string, |
|
247 |
"funderShortname": string, "funderName": string, |
|
248 |
"code": string }[] { |
|
249 |
if(projects == undefined) { |
|
250 |
projects = new Array< |
|
251 |
{ "id": string, "acronym": string, "title": string, |
|
252 |
"funderShortname": string, "funderName": string, |
|
253 |
"code": string |
|
254 |
}>(); |
|
255 |
} |
|
256 |
|
|
257 |
let countProjects = projects.length; |
|
258 |
|
|
259 |
projects[countProjects] = { |
|
260 |
"id": "", "acronym": "", "title": "", |
|
261 |
"funderShortname": "", "funderName": "", |
|
262 |
"code": "" |
|
263 |
} |
|
264 |
|
|
265 |
if(relation.title != 'unidentified') { |
|
266 |
projects[countProjects]['id'] = |
|
267 |
/*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; |
|
268 |
projects[countProjects]['acronym'] = relation.acronym; |
|
269 |
projects[countProjects]['title'] = relation.title; |
|
270 |
projects[countProjects]['code'] = relation.code; |
|
271 |
} else { |
|
272 |
projects[countProjects]['id'] = ""; |
|
273 |
projects[countProjects]['acronym'] = ""; |
|
274 |
projects[countProjects]['title'] = ""; |
|
275 |
projects[countProjects]['code'] = ""; |
|
276 |
} |
|
277 |
|
|
278 |
if(relation.hasOwnProperty("funding")) { |
|
279 |
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; |
|
280 |
|
|
281 |
for(let z=0; z<fundingLength; z++) { |
|
282 |
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; |
|
283 |
|
|
284 |
if(fundingData.hasOwnProperty("funder")) { |
|
285 |
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname; |
|
286 |
projects[countProjects]['funderName'] = fundingData['funder'].name; |
|
287 |
} |
|
288 |
} |
|
289 |
} |
|
290 |
|
|
291 |
return projects; |
|
292 |
} |
|
293 |
|
|
294 |
parseRefineResults(id: string, data: any): any { |
|
295 |
var results:any = []; |
|
296 |
if(data.hasOwnProperty("resulthostingdatasource")) { |
|
297 |
let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1; |
|
298 |
|
|
299 |
for(let i=0; i<length; i++) { |
|
300 |
let datasource = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'][i] : data['resulthostingdatasource']; |
|
301 |
|
|
302 |
let result: {"name": string, "id": string, "count": number} = {"name": "", "id": "", "count": 0}; |
|
303 |
result['name'] = datasource.name; |
|
304 |
result['id'] = datasource.id.split("||")[0]; |
|
305 |
//result['url'] = OpenaireProperties.getsearchLinkToDataProvider()+result['id']; |
|
306 |
result['count'] = datasource.count; |
|
307 |
|
|
308 |
if(result['id'] != id && result['name'] != "Unknown Repository") { |
|
309 |
results.push(result); |
|
310 |
} |
|
311 |
} |
|
312 |
} |
|
313 |
return results; |
|
314 |
} |
|
315 |
|
|
316 |
numOfSoftware(url: string):any { |
|
317 |
let key = url; |
|
318 |
if (this._cache.has(key)) { |
|
319 |
return Observable.of(this._cache.get(key)); |
|
320 |
} |
|
321 |
return this.http.get(url) |
|
322 |
.map(res => <any> res.json()) |
|
323 |
.map(res => res.total) |
|
324 |
.do(res => { |
|
325 |
this._cache.set(key, res); |
|
326 |
}); |
|
327 |
} |
|
328 |
|
|
329 |
numOfEntitySoftware(id: string, entity: string):any { |
|
330 |
var parameters = ""; |
|
331 |
|
|
332 |
if(entity == "project") { |
|
333 |
parameters = "projects/"+id+"/software/count"; |
|
334 |
} |
|
335 |
|
|
336 |
let url = OpenaireProperties.getSearchAPIURLLast()+parameters+"?format=json"; |
|
337 |
return this.numOfSoftware(url); |
|
338 |
} |
|
339 |
|
|
340 |
numOfSearchSoftware(params: string):any { |
|
341 |
let url = OpenaireProperties.getSearchAPIURLLast()+"software/count?format=json"; |
|
342 |
if(params != "") { |
|
343 |
url += "&q=" + params; |
|
344 |
} |
|
345 |
return this.numOfSoftware(url); |
|
346 |
} |
|
347 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchSoftware.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ AdvancedSearchSoftwareRoutingModule} from './advancedSearchSoftware-routing.module'; |
|
6 |
import{AdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component'; |
|
7 |
|
|
8 |
|
|
9 |
import {SoftwareServiceModule} from '../../services/softwareService.module'; |
|
10 |
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module'; |
|
11 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
12 |
|
|
13 |
@NgModule({ |
|
14 |
imports: [ |
|
15 |
CommonModule, FormsModule, |
|
16 |
SoftwareServiceModule, |
|
17 |
AdvancedSearchSoftwareRoutingModule, AdvancedSearchPageModule |
|
18 |
|
|
19 |
], |
|
20 |
declarations: [ |
|
21 |
AdvancedSearchSoftwareComponent |
|
22 |
], |
|
23 |
providers:[FreeGuard |
|
24 |
], |
|
25 |
exports: [ |
|
26 |
AdvancedSearchSoftwareComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
export class AdvancedSearchSoftwareModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchSoftware.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import {Observable} from 'rxjs/Observable'; |
|
3 |
import { Router, ActivatedRoute} from '@angular/router'; |
|
4 |
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; |
|
5 |
import {SearchSoftwareService} from '../../services/searchSoftware.service'; |
|
6 |
import {SearchResult} from '../../utils/entities/searchResult'; |
|
7 |
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
8 |
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; |
|
9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
10 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
|
11 |
|
|
12 |
|
|
13 |
@Component({ |
|
14 |
selector: 'advanced-search-software', |
|
15 |
template: ` |
|
16 |
<advanced-search-page pageTitle="Advanced Search for Software" entityType="software" |
|
17 |
type = "software" |
|
18 |
[(results)] = "results" |
|
19 |
[(searchUtils)] = "searchUtils" |
|
20 |
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" |
|
21 |
(queryChange)="queryChanged($event)" |
|
22 |
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/software" |
|
23 |
[disableForms]="disableForms" |
|
24 |
[loadPaging]="loadPaging" |
|
25 |
[oldTotalResults]="oldTotalResults"> |
|
26 |
</advanced-search-page> |
|
27 |
|
|
28 |
` |
|
29 |
}) |
|
30 |
|
|
31 |
export class AdvancedSearchSoftwareComponent { |
|
32 |
private errorCodes: ErrorCodes; |
|
33 |
|
|
34 |
public results =[]; |
|
35 |
public filters =[]; |
|
36 |
|
|
37 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
38 |
public searchFields:SearchFields = new SearchFields(); |
|
39 |
|
|
40 |
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS; |
|
41 |
public fieldIdsMap= this.searchFields.RESULT_FIELDS; |
|
42 |
public selectedFields:AdvancedField[] = []; |
|
43 |
|
|
44 |
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; |
|
45 |
public resourcesQuery = "( (oaftype exact result) and (resulttypeid exact software) )"; |
|
46 |
public csvParams: string; |
|
47 |
public disableForms: boolean = false; |
|
48 |
public loadPaging: boolean = true; |
|
49 |
public oldTotalResults: number = 0; |
|
50 |
|
|
51 |
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) { |
|
52 |
this.results =[]; |
|
53 |
this.errorCodes = new ErrorCodes(); |
|
54 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
55 |
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedSoftware; |
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
} |
|
60 |
ngOnInit() { |
|
61 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
62 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
63 |
this.sub = this.route.queryParams.subscribe(params => { |
|
64 |
if(params['page'] && this.searchUtils.page != params['page']) { |
|
65 |
this.loadPaging = false; |
|
66 |
this.oldTotalResults = this.searchUtils.totalResults; |
|
67 |
} |
|
68 |
|
|
69 |
let page = (params['page']=== undefined)?1:+params['page']; |
|
70 |
this.searchUtils.page = ( page <= 0 ) ? 1 : page; |
|
71 |
this.searchPage.fieldIds = this.fieldIds; |
|
72 |
this.selectedFields =[]; |
|
73 |
this.searchPage.selectedFields = this.selectedFields; |
|
74 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
75 |
this.searchPage.getSelectedFiltersFromUrl(params); |
|
76 |
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); |
|
77 |
|
|
78 |
}); |
|
79 |
} |
|
80 |
ngOnDestroy() { |
|
81 |
this.sub.unsubscribe(); |
|
82 |
} |
|
83 |
sub: any; |
|
84 |
public getResults(parameters:string, page: number, size: number){ |
|
85 |
if(parameters!= null && parameters != '' ) { |
|
86 |
this.csvParams ="&type=software&query=( "+this.resourcesQuery + "and (" + parameters + "))"; |
|
87 |
}else{ |
|
88 |
this.csvParams ="&type=software&query="+this.resourcesQuery; |
|
89 |
} |
|
90 |
|
|
91 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
92 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
93 |
//this.searchPage.openLoading(); |
|
94 |
this.disableForms = true; |
|
95 |
this.results = []; |
|
96 |
this.searchUtils.totalResults = 0; |
|
97 |
|
|
98 |
console.info("Advanced Search for Software: Execute search query "+parameters); |
|
99 |
this._searchSoftwareService.advancedSearchSoftware(parameters, page, size).subscribe( |
|
100 |
data => { |
|
101 |
this.searchUtils.totalResults = data[0]; |
|
102 |
console.info("search Software total="+this.searchUtils.totalResults); |
|
103 |
this.results = data[1]; |
|
104 |
this.searchPage.updateBaseUrlWithParameters(); |
|
105 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
106 |
this.searchUtils.status = this.errorCodes.DONE; |
|
107 |
if(this.searchUtils.totalResults == 0 ){ |
|
108 |
this.searchUtils.status = this.errorCodes.NONE; |
|
109 |
} |
|
110 |
//this.searchPage.closeLoading(); |
|
111 |
this.disableForms = false; |
|
112 |
|
|
113 |
if(this.searchUtils.status == this.errorCodes.DONE) { |
|
114 |
// Page out of limit!!! |
|
115 |
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); |
|
116 |
if(!(Number.isInteger(totalPages))) { |
|
117 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
118 |
} |
|
119 |
if(totalPages < page) { |
|
120 |
this.searchUtils.totalResults = 0; |
|
121 |
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
122 |
} |
|
123 |
} |
|
124 |
}, |
|
125 |
err => { |
|
126 |
console.log(err); |
|
127 |
console.info("error"); |
|
128 |
//TODO check erros (service not available, bad request) |
|
129 |
// if( ){ |
|
130 |
// this.searchUtils.status = errorCodes.ERROR; |
|
131 |
// } |
|
132 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
133 |
//this.searchUtils.status = errorCodes.NOT_AVAILABLE; |
|
134 |
if(err.status == '404') { |
|
135 |
this.searchUtils.status = this.errorCodes.NOT_FOUND; |
|
136 |
} else if(err.status == '500') { |
|
137 |
this.searchUtils.status = this.errorCodes.ERROR; |
|
138 |
} else { |
|
139 |
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
140 |
} |
|
141 |
|
|
142 |
//this.searchPage.closeLoading(); |
|
143 |
this.disableForms = false; |
|
144 |
} |
|
145 |
); |
|
146 |
} |
|
147 |
private setFilters(){ |
|
148 |
//TODO set filters from |
|
149 |
} |
|
150 |
|
|
151 |
public queryChanged($event) { |
|
152 |
this.loadPaging = true; |
|
153 |
|
|
154 |
var parameters = $event.value; |
|
155 |
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); |
|
156 |
console.info("queryChanged: Execute search query "+parameters); |
|
157 |
|
|
158 |
} |
|
159 |
|
|
160 |
|
|
161 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchSoftware-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{AdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
RouterModule.forChild([ |
|
11 |
{ path: '', component: AdvancedSearchSoftwareComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] } |
|
12 |
|
|
13 |
]) |
|
14 |
] |
|
15 |
}) |
|
16 |
export class AdvancedSearchSoftwareRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchSoftware.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ SearchSoftwareRoutingModule} from './searchSoftware-routing.module'; |
|
6 |
import{SearchSoftwareComponent} from './searchSoftware.component'; |
|
7 |
|
|
8 |
import {SearchResultsModule } from '../searchUtils/searchResults.module'; |
|
9 |
|
|
10 |
import {SoftwareServiceModule} from '../../services/softwareService.module'; |
|
11 |
import {SearchFormModule} from '../searchUtils/searchForm.module'; |
|
12 |
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; |
|
13 |
import {SearchPageModule} from '../searchUtils/searchPage.module'; |
|
14 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
15 |
|
|
16 |
@NgModule({ |
|
17 |
imports: [ |
|
18 |
CommonModule, FormsModule, |
|
19 |
|
|
20 |
SoftwareServiceModule, |
|
21 |
SearchFormModule, SearchResultsModule, SearchSoftwareRoutingModule, SearchPageModule |
|
22 |
|
|
23 |
], |
|
24 |
declarations: [ |
|
25 |
SearchSoftwareComponent |
|
26 |
], |
|
27 |
providers:[FreeGuard |
|
28 |
], |
|
29 |
exports: [ |
|
30 |
SearchSoftwareComponent |
|
31 |
] |
|
32 |
}) |
|
33 |
export class SearchSoftwareModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchSoftware.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import { ActivatedRoute} from '@angular/router'; |
|
3 |
import {Location} from '@angular/common'; |
|
4 |
import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; |
|
5 |
|
|
6 |
import {SearchSoftwareService} from '../../services/searchSoftware.service'; |
|
7 |
import {SearchResult} from '../../utils/entities/searchResult'; |
|
8 |
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
10 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
|
11 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
|
12 |
import {DOI} from '../../utils/string-utils.class'; |
|
13 |
|
|
14 |
@Component({ |
|
15 |
selector: 'search-software', |
|
16 |
template: ` |
|
17 |
|
|
18 |
<search-page pageTitle="Search Software" |
|
19 |
formPlaceholderText = "Search for Software" |
|
20 |
type="software" entityType="software" [(filters)] = "filters" |
|
21 |
[(results)] = "results" [(searchUtils)] = "searchUtils" |
|
22 |
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" |
|
23 |
[csvParams]="csvParams" csvPath="software" advancedSearchLink="/search/advanced/software" |
|
24 |
[disableForms]="disableForms" |
|
25 |
[loadPaging]="loadPaging" |
|
26 |
[oldTotalResults]="oldTotalResults" |
|
27 |
searchFormClass="softwareSearchForm"> |
|
28 |
</search-page> |
|
29 |
` |
|
30 |
}) |
|
31 |
|
|
32 |
export class SearchSoftwareComponent { |
|
33 |
private errorCodes: ErrorCodes; |
|
34 |
|
|
35 |
public results =[]; |
|
36 |
public filters: Filter[] =[]; |
|
37 |
// public totalResults:number = 0 ; |
|
38 |
public baseUrl:string; |
|
39 |
|
|
40 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
41 |
private sub: any; |
|
42 |
private subResults: any; |
|
43 |
private searchFields:SearchFields = new SearchFields(); |
|
44 |
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS; |
|
45 |
public fieldIdsMap=this.searchFields.RESULT_FIELDS; |
|
46 |
private urlParams : Map<string, string>; |
|
47 |
private _location:Location; |
|
48 |
public csvParams: string; |
|
49 |
public disableForms: boolean = false; |
|
50 |
public loadPaging: boolean = true; |
|
51 |
public oldTotalResults: number = 0; |
|
52 |
|
|
53 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
|
54 |
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) { |
|
55 |
|
|
56 |
this.errorCodes = new ErrorCodes(); |
|
57 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
58 |
this.searchUtils.page =1; |
|
59 |
this.baseUrl = OpenaireProperties.getLinkToSearchSoftware(); |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
public ngOnInit() { |
|
64 |
this.searchPage.refineFields = this.refineFields; |
|
65 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
66 |
this.searchPage.type = "software"; |
|
67 |
var firstLoad =true; |
|
68 |
this.sub = this.route.queryParams.subscribe(params => { |
|
69 |
if(params['page'] && this.searchUtils.page != params['page']) { |
|
70 |
this.loadPaging = false; |
|
71 |
this.oldTotalResults = this.searchUtils.totalResults; |
|
72 |
} |
|
73 |
|
|
74 |
this.searchUtils.keyword = (params['keyword']?params['keyword']:''); |
|
75 |
var refine = true; |
|
76 |
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){ |
|
77 |
refine = false; |
|
78 |
} |
|
79 |
firstLoad = false; |
|
80 |
this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; |
|
81 |
|
|
82 |
var queryParameters = this.searchPage.getQueryParametersFromUrl(params); |
|
83 |
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size); |
|
84 |
|
|
85 |
}); |
|
86 |
} |
|
87 |
|
|
88 |
public ngOnDestroy() { |
|
89 |
if(this.sub){ |
|
90 |
this.sub.unsubscribe(); |
|
91 |
} |
|
92 |
if(this.subResults){ |
|
93 |
this.subResults.unsubscribe(); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
|
|
98 |
public getResultsForEntity(entity:string, id:string, page: number, size: number){ |
|
99 |
var parameters = ""; |
|
100 |
|
|
101 |
if(entity == "project") { |
|
102 |
parameters = "projects/"+id; |
|
103 |
} |
|
104 |
|
|
105 |
if(parameters != "") { |
|
106 |
|
|
107 |
this._searchSoftwareService.searchSoftwareForEntity(parameters, page, size).subscribe( |
|
108 |
data => { |
|
109 |
this.searchUtils.totalResults = data[0]; |
|
110 |
console.info("search Software for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); |
|
111 |
this.results = data[1]; |
|
112 |
|
|
113 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
114 |
this.searchUtils.status = this.errorCodes.DONE; |
|
115 |
if(this.searchUtils.totalResults == 0 ){ |
|
116 |
this.searchUtils.status = this.errorCodes.NONE; |
|
117 |
} |
|
118 |
}, |
|
119 |
err => { |
|
120 |
console.log(err); |
|
121 |
//TODO check erros (service not available, bad request) |
|
122 |
// if( ){ |
|
123 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
124 |
// } |
|
125 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
126 |
//this.searchUtils.status = errorCodes.ERROR; |
|
127 |
if(err.status == '404') { |
|
128 |
this.searchUtils.status = this.errorCodes.NOT_FOUND; |
|
129 |
} else if(err.status == '500') { |
|
130 |
this.searchUtils.status = this.errorCodes.ERROR; |
|
131 |
} else { |
|
132 |
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
133 |
} |
|
134 |
} |
|
135 |
); |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){ |
|
140 |
var parameters; |
|
141 |
if(resultsFrom == "collectedFrom") { |
|
142 |
parameters = "software?fq=collectedfromdatasourceid exact "+'"'+id+'"'; |
|
143 |
} else if(resultsFrom == "hostedBy") { |
|
144 |
parameters = "software?fq=resulthostingdatasourceid exact "+'"'+id+'"'; |
|
145 |
} |
|
146 |
|
|
147 |
if(parameters != "") { |
|
148 |
|
|
149 |
this._searchSoftwareService.searchSoftwareForDataproviders(parameters, page, size).subscribe( |
|
150 |
data => { |
|
151 |
this.searchUtils.totalResults = data[0]; |
|
152 |
console.info("search Software for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); |
|
153 |
this.results = data[1]; |
|
154 |
|
|
155 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
156 |
this.searchUtils.status = this.errorCodes.DONE; |
|
157 |
if(this.searchUtils.totalResults == 0 ){ |
|
158 |
this.searchUtils.status = this.errorCodes.NONE; |
|
159 |
} |
|
160 |
}, |
|
161 |
err => { |
|
162 |
console.log(err); |
|
163 |
//TODO check erros (service not available, bad request) |
|
164 |
// if( ){ |
|
165 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
166 |
// } |
|
167 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
168 |
//this.searchUtils.status = errorCodes.ERROR; |
|
169 |
if(err.status == '404') { |
|
170 |
this.searchUtils.status = this.errorCodes.NOT_FOUND; |
|
171 |
} else if(err.status == '500') { |
|
172 |
this.searchUtils.status = this.errorCodes.ERROR; |
|
173 |
} else { |
|
174 |
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
175 |
} |
|
176 |
} |
|
177 |
); |
|
178 |
} |
|
179 |
} |
|
180 |
|
|
181 |
public getResults(keyword:string,refine:boolean, page: number, size: number){ |
|
182 |
var parameters = ""; |
|
183 |
if(keyword.length > 0){ |
|
184 |
var DOIs:string[] = DOI.getDOIsFromString(keyword); |
|
185 |
var doisParams = ""; |
|
186 |
for(var i =0 ;i < DOIs.length; i++){ |
|
187 |
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"'; |
|
188 |
} |
|
189 |
if(doisParams.length > 0){ |
|
190 |
parameters += "&"+doisParams; |
|
191 |
}else{ |
|
192 |
parameters = "q=" + keyword; |
|
193 |
} |
|
194 |
} |
|
195 |
this._getResults(parameters,refine,page,size); |
|
196 |
} |
|
197 |
private _getResults(parameters:string,refine:boolean, page: number, size: number){ |
|
198 |
this.csvParams = parameters; |
|
199 |
|
|
200 |
// if(!refine && !this.searchPage){ |
|
201 |
// this.searchPage = new SearchPageComponent(this._location); |
|
202 |
// } |
|
203 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
204 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
205 |
//this.searchPage.openLoading(); |
|
206 |
this.disableForms = true; |
|
207 |
this.results = []; |
|
208 |
this.searchUtils.totalResults = 0; |
|
209 |
|
|
210 |
this.subResults = this._searchSoftwareService.searchSoftware(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( |
|
211 |
data => { |
|
212 |
this.searchUtils.totalResults = data[0]; |
|
213 |
console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); |
|
214 |
this.results = data[1]; |
|
215 |
if(refine){ |
|
216 |
this.filters = data[2]; |
|
217 |
} |
|
218 |
this.searchPage.checkSelectedFilters(this.filters); |
|
219 |
this.searchPage.updateBaseUrlWithParameters(this.filters); |
|
220 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
221 |
this.searchUtils.status = this.errorCodes.DONE; |
|
222 |
if(this.searchUtils.totalResults == 0 ){ |
|
223 |
this.searchUtils.status = this.errorCodes.NONE; |
|
224 |
} |
|
225 |
//this.searchPage.closeLoading(); |
|
226 |
this.disableForms = false; |
|
227 |
|
|
228 |
if(this.searchUtils.status == this.errorCodes.DONE) { |
|
229 |
// Page out of limit!!! |
|
230 |
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); |
|
231 |
if(!(Number.isInteger(totalPages))) { |
|
232 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
233 |
} |
|
234 |
if(totalPages < page) { |
|
235 |
this.searchUtils.totalResults = 0; |
|
236 |
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
237 |
} |
|
238 |
} |
|
239 |
}, |
|
240 |
err => { |
|
241 |
console.log(err); |
|
242 |
//TODO check erros (service not available, bad request) |
|
243 |
// if( ){ |
|
244 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
245 |
// } |
|
246 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
247 |
//this.searchUtils.status = errorCodes.ERROR; |
|
248 |
if(err.status == '404') { |
|
249 |
this.searchUtils.status = this.errorCodes.NOT_FOUND; |
|
250 |
} else if(err.status == '500') { |
|
251 |
this.searchUtils.status = this.errorCodes.ERROR; |
|
252 |
} else { |
|
253 |
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
254 |
} |
|
255 |
|
|
256 |
//this.searchPage.closeLoading(); |
|
257 |
this.disableForms = false; |
|
258 |
} |
|
259 |
); |
|
260 |
} |
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
private setFilters(){ |
|
265 |
//TODO set filters from |
|
266 |
} |
|
267 |
|
|
268 |
public queryChanged($event) { |
|
269 |
this.loadPaging = true; |
|
270 |
|
|
271 |
var parameters = $event.value; |
|
272 |
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage"); |
|
273 |
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size); |
|
274 |
} |
|
275 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchSoftware-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import {SearchSoftwareComponent} from './searchSoftware.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', component: SearchSoftwareComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } |
|
11 |
|
|
12 |
]) |
|
13 |
] |
|
14 |
}) |
|
15 |
export class SearchSoftwareRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/software/software.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild, ElementRef} from '@angular/core'; |
|
2 |
import {Observable} from 'rxjs/Observable'; |
|
3 |
import {SoftwareService} from './software.service'; |
|
4 |
import {SoftwareInfo} from '../../utils/entities/softwareInfo'; |
|
5 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
6 |
import {OpenaireProperties} from '../../utils/properties/openaireProperties' |
|
7 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
8 |
import { Meta} from '../../../angular2-meta'; |
|
9 |
import {PiwikService} from '../../utils/piwik/piwik.service'; |
|
10 |
|
|
11 |
@Component({ |
|
12 |
selector: 'software', |
|
13 |
templateUrl: 'software.component.html', |
|
14 |
}) |
|
15 |
|
|
16 |
export class SoftwareComponent { |
|
17 |
public softwareInfo: SoftwareInfo; |
|
18 |
public softwareId : string ; |
|
19 |
|
|
20 |
// APP BOX variables |
|
21 |
public showAllCollectedFrom: boolean = false; |
|
22 |
public showAllDownloadFrom: boolean = false; |
|
23 |
public showAllPublishedIn: boolean = false; |
|
24 |
public showAllFundedBy: boolean = false; |
|
25 |
|
|
26 |
// Metrics tab variables |
|
27 |
public metricsClicked: boolean; |
|
28 |
public viewsFrameUrl: string; |
|
29 |
public downloadsFrameUrl: string; |
|
30 |
public totalViews: number; |
|
31 |
public totalDownloads: number; |
|
32 |
public pageViews: number; |
|
33 |
|
|
34 |
// Active tab variable for responsiveness |
|
35 |
public activeTab: string = "Related Research Results"; |
|
36 |
|
|
37 |
// Map counting variable |
|
38 |
public relatedResearchResultsNum: number = 0; |
|
39 |
|
|
40 |
// Message variables |
|
41 |
public warningMessage = ""; |
|
42 |
public errorMessage = ""; |
|
43 |
public showLoading: boolean = true; |
|
44 |
|
|
45 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
46 |
|
|
47 |
private result ; |
|
48 |
sub: any; piwiksub: any; infoSub: any; |
|
49 |
|
|
50 |
constructor (private element: ElementRef, |
|
51 |
private _softwareService: SoftwareService, |
|
52 |
private _piwikService:PiwikService, |
|
53 |
private route: ActivatedRoute, |
|
54 |
private _meta: Meta, |
|
55 |
private _router: Router) { |
|
56 |
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); |
|
57 |
} |
|
58 |
|
|
59 |
ngOnInit() { |
|
60 |
this.sub = this.route.queryParams.subscribe(params => { |
|
61 |
this.softwareInfo = null; |
|
62 |
this.updateTitle("Software"); |
|
63 |
this.updateDescription("Software, search, open access"); |
|
64 |
|
|
65 |
this.softwareId = params['softwareId']; |
|
66 |
console.info("Id is :"+this.softwareId); |
|
67 |
|
|
68 |
if(this.softwareId){ |
|
69 |
this.getSoftwareInfo(this.softwareId); |
|
70 |
}else{ |
|
71 |
this.showLoading = false; |
|
72 |
this.warningMessage="No valid software id"; |
|
73 |
} |
|
74 |
|
|
75 |
this.metricsClicked = false; |
|
76 |
|
|
77 |
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'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'; |
|
78 |
/*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'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'; |
|
79 |
*/ |
|
80 |
|
|
81 |
this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'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'; |
|
82 |
/*this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'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'; |
|
83 |
*/ |
|
84 |
if (typeof document !== 'undefined') { |
|
85 |
this.element.nativeElement.scrollIntoView(); |
|
86 |
} |
|
87 |
}); |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
ngOnDestroy() { |
|
92 |
this.sub.unsubscribe(); |
|
93 |
if(this.piwiksub){ |
|
94 |
this.piwiksub.unsubscribe(); |
|
95 |
} |
|
96 |
if(this.infoSub) { |
|
97 |
this.infoSub.unsubscribe(); |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
private getSoftwareInfo(id:string) { |
|
102 |
this.warningMessage = ''; |
|
103 |
this.errorMessage="" |
|
104 |
this.showLoading = true; |
|
105 |
|
|
106 |
this.infoSub = this._softwareService.getSoftwareInfo(id).subscribe( |
|
107 |
data => { |
|
108 |
this.softwareInfo = data; |
|
109 |
this.updateTitle(this.softwareInfo.title.name); |
|
110 |
this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); |
|
111 |
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ |
|
112 |
this.piwiksub = this._piwikService.trackView(this.softwareInfo.title.name).subscribe(); |
|
113 |
} |
|
114 |
|
|
115 |
this.result = [] |
|
116 |
this.result = {id: id, type :"software", source : "openaire", title: this.softwareInfo.title,url: '', result: '', accessRights: this.softwareInfo.title.accessMode, embargoEndDate: ''}; |
|
117 |
|
|
118 |
let relatedResearchResultsNum = 0; |
|
119 |
if(this.softwareInfo.relatedResearchResults != undefined) { |
|
120 |
this.softwareInfo.relatedResearchResults.forEach(function (value, key, map) { |
|
121 |
relatedResearchResultsNum += value.length; |
|
122 |
}); |
|
123 |
} |
|
124 |
this.relatedResearchResultsNum = relatedResearchResultsNum; |
|
125 |
|
|
126 |
this.showLoading = false; |
|
127 |
}, |
|
128 |
err => { |
|
129 |
console.log(err) |
|
130 |
console.info("error"); |
|
131 |
|
|
132 |
this.errorMessage = 'No software found'; |
|
133 |
this.showLoading = false; |
|
134 |
} |
|
135 |
); |
|
136 |
} |
|
137 |
|
|
138 |
// showChange($event) { |
|
139 |
// this.showAllReferences=$event.value; |
|
140 |
// } |
|
141 |
|
|
142 |
public metricsResults($event) { |
|
143 |
this.totalViews = $event.totalViews; |
|
144 |
this.totalDownloads = $event.totalDownloads; |
|
145 |
this.pageViews = $event.pageViews; |
|
146 |
} |
|
147 |
|
|
148 |
private updateDescription(description:string){ |
|
149 |
this._meta.updateMeta("description", description); |
|
150 |
this._meta.updateProperty("og:description", description); |
|
151 |
} |
|
152 |
private updateTitle(title:string){ |
|
153 |
var _prefix ="OpenAIRE | "; |
|
154 |
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); |
|
155 |
this._meta.setTitle(_title ); |
|
156 |
this._meta.updateProperty("og:title",_title); |
|
157 |
} |
|
158 |
private updateUrl(url:string){ |
|
159 |
this._meta.updateProperty("og:url", url); |
|
160 |
} |
|
161 |
|
|
162 |
public buildCurationTooltip() { |
|
163 |
let tooltipContent: string = "<div class='uk-padding-small uk-light'>"; |
|
164 |
|
|
165 |
tooltipContent += "<h4>Record in preview</h4>"; |
|
166 |
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>"; |
|
167 |
|
|
168 |
return tooltipContent; |
|
169 |
} |
|
170 |
|
|
171 |
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string, |
|
172 |
"funderShortname": string, "funderName": string, |
|
173 |
"funding": string, "code": string, "provenanceAction":string, "inline": boolean}) { |
|
174 |
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-light uk-padding-small'>"; |
|
175 |
|
|
176 |
if(item.title) { |
|
177 |
tooltipContent += "<h5>"+item.title+"</h5>"; |
|
178 |
} |
|
179 |
|
|
180 |
if(item.code || item.funderName || item.funderShortname || item.funding) { |
|
181 |
tooltipContent += "<p>"; |
|
182 |
} |
|
183 |
|
|
184 |
if(item.code) { |
|
185 |
tooltipContent += "<div>Project Code: "+item.code + "</div>"; |
|
186 |
} |
|
187 |
|
|
188 |
if(item.funderName || item.funderShortname) { |
|
189 |
tooltipContent += "<div>Funder: "; |
|
190 |
if(item.funderName && item.funderShortname) { |
|
191 |
tooltipContent += item.funderName + " ("+ item.funderShortname +")"; |
|
192 |
} else if(item.funderName) { |
|
193 |
tooltipContent += item.funderName; |
|
194 |
} else { |
|
195 |
tooltipContent += item.funderShortname; |
|
196 |
} |
|
197 |
|
|
198 |
tooltipContent += "</div>"; |
|
199 |
} |
|
200 |
|
|
201 |
if(item.funding) { |
|
202 |
tooltipContent += "<div>Funding: "+ item.funding + "</div>"; |
|
203 |
} |
|
204 |
|
|
205 |
if(item.code || item.funderName || item.funderShortname || item.funding) { |
|
206 |
tooltipContent += "</p>"; |
|
207 |
} |
|
208 |
|
|
209 |
if(item.provenanceAction == 'Repository') { |
|
210 |
tooltipContent += "Provided by Repository"; |
|
211 |
} else if(item.provenanceAction == 'Algorithm') { |
|
212 |
tooltipContent += "Inferred by Algorithm"; |
|
213 |
} else if(item.provenanceAction == 'USer') { |
|
214 |
tooltipContent += "Claimed by User"; |
|
215 |
} |
|
216 |
|
|
217 |
tooltipContent+="</div>" |
|
218 |
return tooltipContent; |
|
219 |
} |
|
220 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/software/software.module.ts | ||
---|---|---|
1 |
//import {MaterialModule} from '@angular/material'; |
|
2 |
import { NgModule } from '@angular/core'; |
|
3 |
import { CommonModule } from '@angular/common'; |
|
4 |
import { FormsModule } from '@angular/forms'; |
|
5 |
import { SharedModule } from '../../shared/shared.module'; |
|
6 |
import { RouterModule } from '@angular/router'; |
|
7 |
|
|
8 |
import { SoftwareService } from './software.service'; |
|
9 |
import { SoftwareComponent } from './software.component'; |
|
10 |
import { SoftwareRoutingModule } from './software-routing.module'; |
|
11 |
import { MetricsModule } from '../landing-utils/metrics.module'; |
|
12 |
import { IFrameModule } from '../../utils/iframe.module'; |
|
13 |
import { AltMetricsModule } from '../../utils/altmetrics.module'; |
|
14 |
import { CiteThisModule } from '../landing-utils/citeThis/citeThis.module'; |
|
15 |
import { PagingModule } from '../../utils/paging.module'; |
|
16 |
|
|
17 |
import { ResultLandingModule } from '../landing-utils/resultLanding.module'; |
|
18 |
import { LandingModule } from '../landing-utils/landing.module'; |
|
19 |
import { FreeGuard } from'../../login/freeGuard.guard'; |
|
20 |
|
|
21 |
@NgModule({ |
|
22 |
imports: [ |
|
23 |
CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, CiteThisModule, PagingModule, |
|
24 |
ResultLandingModule, SoftwareRoutingModule, IFrameModule, MetricsModule, AltMetricsModule |
|
25 |
], |
|
26 |
declarations: [ |
|
27 |
SoftwareComponent |
|
28 |
], |
|
29 |
providers:[ |
|
30 |
SoftwareService, FreeGuard |
|
31 |
], |
|
32 |
exports: [ |
|
33 |
SoftwareComponent |
|
34 |
] |
|
35 |
}) |
|
36 |
export class SoftwareModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/software/software-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import {SoftwareComponent } from './software.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
RouterModule.forChild([ |
|
11 |
{ path: '', component: SoftwareComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] } |
|
12 |
]) |
|
13 |
] |
|
14 |
}) |
|
15 |
export class SoftwareRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/software/software.component.html | ||
---|---|---|
1 |
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" > |
|
2 |
<div uk-grid uk-grid> |
|
3 |
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "> |
|
4 |
|
|
5 |
<div class="uk-container uk-margin-top software"> |
|
6 |
|
|
7 |
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-margin-large-top" role="alert">{{warningMessage}}</div> |
|
8 |
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger uk-margin-large-top" role="alert">{{errorMessage}}</div> |
|
9 |
<div *ngIf="showLoading" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div> |
|
10 |
|
|
11 |
<div *ngIf="softwareInfo != null" uk-grid> |
|
12 |
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s"> |
|
13 |
<showTitle [title]="softwareInfo.title"></showTitle> |
|
14 |
<span *ngIf="softwareInfo.types.length > 0"class="uk-label custom-label label-blue label-software " title="Type">{{softwareInfo.types.join(", ")}}</span> |
|
15 |
<span *ngIf="softwareInfo.title && softwareInfo.title.accessMode" [class]="'uk-label custom-label label-green label-'+ softwareInfo.title.accessMode " ><!--span [class]="softwareInfo.title.accessMode" -->{{softwareInfo.title.accessMode}}<!--/span--></span> |
|
16 |
<span *ngIf="softwareInfo.underCurationMessage" class="uk-label custom-label label-yellow " > |
|
17 |
<span uk-tooltip="pos:right; delay:10" |
|
18 |
title="{{buildCurationTooltip()}}"> |
|
19 |
<i>Record in preview</i> |
|
20 |
<i class="uk-icon-info-circle"></i> |
|
21 |
</span></span> |
|
22 |
<!--div *ngIf="softwareInfo.underCurationMessage"> |
|
23 |
<span uk-tooltip="pos:right; delay:10" |
|
24 |
title="{{buildCurationTooltip()}}"> |
|
25 |
<i>Record in preview</i> |
|
26 |
<i class="uk-icon-info-circle"></i> |
|
27 |
</span> |
|
28 |
</div--> |
|
29 |
|
|
30 |
<div class= " uk-margin-top"> |
|
31 |
<showAuthors [authors]="softwareInfo.authors" searchPage="software"></showAuthors> |
|
32 |
<span *ngIf="softwareInfo.date != ''">({{softwareInfo.date}})</span> |
|
33 |
</div> |
|
34 |
|
|
35 |
<ul class="uk-list"> |
|
36 |
<li *ngIf="softwareInfo.publisher"><span class="uk-text-bold">Publisher:</span> {{softwareInfo.publisher}}</li> |
|
37 |
|
|
38 |
<li *ngIf="softwareInfo.embargoEndDate"><span class="uk-text-bold">Embargo end date:</span> {{softwareInfo.embargoEndDate}}</li> |
|
39 |
<li *ngIf="softwareInfo.identifiers && softwareInfo.identifiers.size > 0"> |
|
40 |
<showIdentifiers [identifiers]="softwareInfo.identifiers"></showIdentifiers> |
|
41 |
</li> |
|
42 |
<li *ngIf="softwareInfo.subjects ||softwareInfo.otherSubjects || softwareInfo.classifiedSubjects"> |
|
43 |
<showSubjects [subjects]="softwareInfo.subjects" |
|
44 |
[otherSubjects]="softwareInfo.otherSubjects" |
|
45 |
[classifiedSubjects]="softwareInfo.classifiedSubjects"> |
|
46 |
</showSubjects> |
|
47 |
</li> |
|
48 |
</ul> |
|
49 |
|
|
50 |
<div *ngIf="softwareInfo.description" class="uk-margin-bottom uk-text-justify descriptionText"> |
|
51 |
{{softwareInfo.description}} |
|
52 |
</div> |
|
53 |
|
|
54 |
<div class="uk-clearfix"><div class="uk-button-group uk-float-right uk-margin-top"> |
|
55 |
<button class="uk-button uk-button-small uk-button-action"> |
|
56 |
<span class="uk-icon" > |
|
57 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="link" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M7.925,11.875 L11.925,7.975"></path></svg></span> |
|
58 |
Link this software to |
|
59 |
</button> |
|
60 |
<div class="uk-inline"> |
|
61 |
<button class="uk-button uk-button-small uk-button-action" type="button"> |
|
62 |
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span> |
|
63 |
</button> |
|
64 |
<div uk-dropdown="mode: click; boundary: ! .uk-button-group; boundary-align: true;" |
|
65 |
class="uk-dropdown uk-dropdown-boundary uk-dropdown-bottom-left" style="top: 40px; left: -236.5px;"> |
|
66 |
<ul class="uk-nav uk-dropdown-nav uk-padding-small" > |
|
67 |
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[softwareId,'software','project'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" > |
|
68 |
Projects</a></li> |
|
69 |
<li><a class="uk-width-1-1"[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[softwareId,'software','context'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" > |
|
70 |
Communities</a></li> |
|
71 |
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[softwareId,'software','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" > |
|
72 |
Other research results</a></li> |
|
73 |
</ul> |
|
74 |
|
|
75 |
</div> |
|
76 |
</div> |
|
77 |
</div></div> |
|
78 |
|
|
79 |
|
|
80 |
<ul class="uk-tab uk-visible@m" uk-tab="connect: #tab-content"> |
|
81 |
<li (click)="activeTab='Related Research Results'" |
|
82 |
[class]="activeTab == 'Related Research Results'?'uk-active':''"> |
|
83 |
<a> |
|
84 |
Related Research Results |
|
85 |
<span class="uk-badge uk-badge-notification"> |
|
86 |
{{relatedResearchResultsNum}} |
|
87 |
</span> |
|
88 |
</a> |
|
89 |
</li> |
|
90 |
|
|
91 |
<li (click)="activeTab='Similar Research Results'" |
|
92 |
[class]="activeTab == 'Similar Research Results'?'uk-active':''"> |
|
93 |
<a> |
|
94 |
Similar Research Results |
|
95 |
<span *ngIf="!softwareInfo.similarResearchResults" class="uk-badge uk-badge-notification">0</span> |
|
96 |
<span *ngIf="softwareInfo.similarResearchResults" class="uk-badge uk-badge-notification"> |
|
97 |
{{softwareInfo.similarResearchResults.length}} |
|
98 |
</span> |
|
99 |
</a> |
|
100 |
</li> |
|
101 |
|
|
102 |
<li (click)="metricsClicked=true; activeTab='Metrics'" |
|
103 |
[class]="activeTab == 'Metrics'?'uk-active':''"> |
|
104 |
<a> |
|
105 |
Metrics <!--i class="icon-line-chart"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36" style="fill:currentColor;"> |
|
106 |
<path d="M4.415 31.713h31.704v4.529h-36.233v-36.233h4.529zM10.077 29.447c-1.877 0-3.396-1.521-3.396-3.396s1.521-3.396 3.396-3.396c0.101 0 0.199 0.006 0.297 0.014l3.652-6.086c-0.348-0.534-0.551-1.171-0.551-1.855 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 0.685-0.203 1.321-0.551 1.855l3.652 6.086c0.098-0.009 0.196-0.014 0.297-0.014 0.076 0 0.151 0.004 0.225 0.009l6.028-10.549c-0.373-0.546-0.592-1.204-0.592-1.916 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 1.877-1.521 3.396-3.396 3.396-0.076 0-0.151-0.004-0.225-0.009l-6.028 10.549c0.373 0.546 0.592 1.204 0.592 1.916 0 1.877-1.521 3.396-3.396 3.396s-3.396-1.521-3.396-3.396c0-0.684 0.203-1.321 0.551-1.855l-3.652-6.086c-0.098 0.009-0.196 0.014-0.297 0.014s-0.199-0.006-0.297-0.014l-3.652 6.086c0.348 0.534 0.551 1.171 0.551 1.855 0 1.877-1.521 3.396-3.396 3.396z"></path> |
|
107 |
</svg></i--> |
|
108 |
</a> |
|
109 |
</li> |
|
110 |
</ul> |
|
111 |
|
|
112 |
<button class="uk-button uk-button-default uk-hidden@m" type="button"> |
|
113 |
<span uk-navbar-toggle-icon></span> <span class="uk-margin-small-left">{{activeTab}}</span> |
|
114 |
</button> |
|
115 |
|
|
116 |
<ul id="toggle-small-tabs" class="uk-subnav uk-subnav-pill uk-dropdown uk-hidden@m" uk-switcher="connect: #tab-content" uk-dropdown="mode: click" uk-toggle="target: #toggle-small-tabs"> |
|
117 |
<li (click)="activeTab='Related Research Results'" |
|
118 |
[class]="activeTab == 'Related Research Results'?'uk-active':''"> |
|
119 |
<a> |
|
120 |
Related Research Results |
|
121 |
<span class="uk-badge uk-badge-notification"> |
|
122 |
{{relatedResearchResultsNum}} |
|
123 |
</span> |
|
124 |
</a> |
|
125 |
</li> |
|
126 |
|
|
127 |
<li (click)="activeTab='Similar Research Results'" |
|
128 |
[class]="activeTab == 'Similar Research Results'?'uk-active':''"> |
|
129 |
<a> |
|
130 |
Similar Research Results |
|
131 |
<span *ngIf="!softwareInfo.similarResearchResults" class="uk-badge uk-badge-notification">0</span> |
|
132 |
<span *ngIf="softwareInfo.similarResearchResults" class="uk-badge uk-badge-notification"> |
|
133 |
{{softwareInfo.similarResearchResults.length}} |
|
134 |
</span> |
|
135 |
</a> |
|
136 |
</li> |
|
137 |
|
|
138 |
<li (click)="metricsClicked=true; activeTab='Metrics'" |
|
139 |
[class]="activeTab == 'Metrics'?'uk-active':''"> |
|
140 |
<a> |
|
141 |
Metrics<!--i class="icon-line-chart"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36" style="fill:currentColor;"> |
|
142 |
<path d="M4.415 31.713h31.704v4.529h-36.233v-36.233h4.529zM10.077 29.447c-1.877 0-3.396-1.521-3.396-3.396s1.521-3.396 3.396-3.396c0.101 0 0.199 0.006 0.297 0.014l3.652-6.086c-0.348-0.534-0.551-1.171-0.551-1.855 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 0.685-0.203 1.321-0.551 1.855l3.652 6.086c0.098-0.009 0.196-0.014 0.297-0.014 0.076 0 0.151 0.004 0.225 0.009l6.028-10.549c-0.373-0.546-0.592-1.204-0.592-1.916 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 1.877-1.521 3.396-3.396 3.396-0.076 0-0.151-0.004-0.225-0.009l-6.028 10.549c0.373 0.546 0.592 1.204 0.592 1.916 0 1.877-1.521 3.396-3.396 3.396s-3.396-1.521-3.396-3.396c0-0.684 0.203-1.321 0.551-1.855l-3.652-6.086c-0.098 0.009-0.196 0.014-0.297 0.014s-0.199-0.006-0.297-0.014l-3.652 6.086c0.348 0.534 0.551 1.171 0.551 1.855 0 1.877-1.521 3.396-3.396 3.396z"></path> |
|
143 |
</svg></i--> |
|
144 |
</a> |
|
145 |
</li> |
|
146 |
</ul> |
|
147 |
|
|
148 |
<!--ul id="tab-content" class="uk-switcher uk-margin custom-tab-content"--> |
|
149 |
<div class="uk-margin custom-tab-content"> |
|
150 |
<div *ngIf="activeTab=='Related Research Results'" class="uk-animation-fade"> |
|
151 |
<div *ngIf="!softwareInfo.relatedResearchResults" class = "uk-alert uk-alert-primary" > |
|
152 |
No related research results available |
|
153 |
</div> |
|
154 |
<div *ngIf="softwareInfo.relatedResearchResults"> |
|
155 |
<div *ngFor="let provenanceaction of softwareInfo.relatedResearchResults.keys()"> |
|
156 |
<div class="uk-text-large">{{provenanceaction}}</div> |
|
157 |
|
|
158 |
<tabTable [info]="softwareInfo.relatedResearchResults.get(provenanceaction)"></tabTable> |
|
159 |
</div> |
|
160 |
</div> |
|
161 |
</div> |
|
162 |
|
|
163 |
<div *ngIf="activeTab=='Similar Research Results'" class="uk-animation-fade"> |
|
164 |
<div *ngIf="!softwareInfo.similarResearchResults" class = "uk-alert uk-alert-primary" > |
|
165 |
No similar research results available |
|
166 |
</div> |
|
167 |
<div *ngIf="softwareInfo.similarResearchResults"> |
|
168 |
<tabTable [info]="softwareInfo.similarResearchResults"></tabTable> |
|
169 |
</div> |
|
170 |
</div> |
|
171 |
<div *ngIf="activeTab=='Metrics'" class="uk-animation-fade"> |
|
172 |
<!-- Page Views: {{pageViews}} --> |
|
173 |
<metrics [pageViews]="pageViews" |
|
174 |
[id]="softwareId" [entityType]="'results'" [entity]="'Software'" |
|
175 |
(metricsResults)="metricsResults($event)"> |
|
176 |
</metrics> |
|
177 |
<i-frame *ngIf="metricsClicked && totalViews > 0" |
|
178 |
[url]=viewsFrameUrl width="100%" height="250"> |
|
179 |
</i-frame> |
|
180 |
<i-frame *ngIf="metricsClicked && totalDownloads > 0" |
|
181 |
[url]=downloadsFrameUrl width="100%" height="250"> |
|
182 |
</i-frame> |
|
183 |
</div> |
|
184 |
<!--/ul--> |
|
185 |
</div> |
|
186 |
</div> |
|
187 |
|
|
188 |
<div class="uk-width-1-4@l uk-width-1-4@xl uk-width-1-4@m uk-width-1-1@s"> |
|
189 |
<div > |
|
190 |
Share - Bookmark |
|
191 |
<addThis></addThis> |
|
192 |
</div> |
|
193 |
<altmetrics *ngIf="softwareInfo.identifiers && softwareInfo.identifiers.get('doi')" |
|
194 |
id="{{softwareInfo.identifiers.get('doi')[0]}}" type="doi"> |
|
195 |
</altmetrics > |
|
196 |
<ul class="uk-list "> |
|
197 |
|
|
198 |
<li *ngIf="softwareInfo.downloadFrom && softwareInfo.downloadFrom.size > 0"> |
|
199 |
<dl class="uk-description-list-line"> |
|
200 |
<dt class="title">Download from</dt> |
|
201 |
<dd class="line" |
|
202 |
*ngFor="let key of softwareInfo.downloadFrom.keys() let i=index" > |
|
203 |
<div *ngIf="i<5 || showAllDownloadFrom" |
|
204 |
class="{{softwareInfo.downloadFrom.get(key)['bestAccessMode']}}"> |
|
205 |
<span [class]="softwareInfo.downloadFrom.get(key)['url'].length > 0 ? 'custom-external custom-icon' : ''"> |
|
206 |
<span *ngIf="softwareInfo.downloadFrom.get(key)['url'].length > 1"> |
|
207 |
{{key}} |
|
208 |
<span *ngFor="let url of softwareInfo.downloadFrom.get(key)['url']; let i=index;"> |
|
209 |
<a href="{{url}}" target="_blank" |
|
210 |
[attr.uk-tooltip]="softwareInfo.downloadFrom.get(key)['accessMode'][i] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
211 |
[title]="softwareInfo.downloadFrom.get(key)['accessMode'][i]"> |
|
212 |
[{{i+1}}] |
|
213 |
</a> |
|
214 |
</span> |
|
215 |
</span> |
|
216 |
<a *ngIf="softwareInfo.downloadFrom.get(key)['url'].length == 1" |
|
217 |
href="{{softwareInfo.downloadFrom.get(key)['url']}}" |
|
218 |
target="_blank" |
|
219 |
[attr.uk-tooltip]="softwareInfo.downloadFrom.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
220 |
[title]="softwareInfo.downloadFrom.get(key)['bestAccessMode']"> |
|
221 |
{{key}} |
|
222 |
</a> |
|
223 |
<span *ngIf="softwareInfo.downloadFrom.get(key)['url'].length == 0" |
|
224 |
[attr.uk-tooltip]="softwareInfo.downloadFrom.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
225 |
[title]="softwareInfo.downloadFrom.get(key)['bestAccessMode']"> |
|
226 |
{{key}} |
|
227 |
</span> |
|
228 |
</span> |
|
229 |
</div> |
|
230 |
</dd> |
|
231 |
<dd *ngIf="showAllDownloadFrom" class="uk-text-right"> |
|
232 |
<a class="uk-text-muted" (click)="showAllDownloadFrom = !showAllDownloadFrom;"> |
|
233 |
View less |
|
234 |
</a> |
|
235 |
</dd> |
|
236 |
<dd *ngIf="!showAllDownloadFrom && softwareInfo.downloadFrom.size > 5">...</dd> |
|
237 |
<dd *ngIf="!showAllDownloadFrom && softwareInfo.downloadFrom.size > 5" class="uk-text-right"> |
|
238 |
<a class="uk-text-muted" (click)="showAllDownloadFrom = !showAllDownloadFrom;"> |
|
239 |
View more |
|
240 |
</a> |
|
241 |
</dd> |
|
242 |
</dl> |
|
243 |
</li> |
|
244 |
<li *ngIf="softwareInfo.publishedIn && softwareInfo.publishedIn.size > 0"> |
|
245 |
<dl class="uk-description-list-line"> |
|
246 |
<dt class="title">Published in</dt> |
|
247 |
<dd class="line" *ngFor="let key of softwareInfo.publishedIn.keys() let i=index"> |
|
248 |
<div *ngIf="i<5 || showAllPublishedIn" class="{{softwareInfo.publishedIn.get(key)['bestAccessMode']}}"> |
|
249 |
<span [class]="softwareInfo.publishedIn.get(key)['url'].length > 0 ? 'custom-external custom-icon' : ''"> |
|
250 |
<span *ngIf="softwareInfo.publishedIn.get(key)['url'].length > 1"> |
|
251 |
{{key}} |
|
252 |
<span *ngFor="let url of softwareInfo.publishedIn.get(key)['url']; let i=index"> |
|
253 |
<a href="{{url}}" target="_blank" |
|
254 |
[attr.uk-tooltip]="softwareInfo.publishedIn.get(key)['accessMode'][i] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
255 |
[title]="softwareInfo.publishedIn.get(key)['accessMode'][i]"> |
|
256 |
[{{i+1}}] |
|
257 |
</a> |
|
258 |
</span> |
|
259 |
</span> |
|
260 |
<a *ngIf="softwareInfo.publishedIn.get(key)['url'].length == 1" |
|
261 |
href="{{softwareInfo.publishedIn.get(key)['url']}}" |
|
262 |
target="_blank" |
|
263 |
[attr.uk-tooltip]="softwareInfo.publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
264 |
[title]="softwareInfo.publishedIn.get(key)['bestAccessMode']"> |
|
265 |
{{key}} |
|
266 |
</a> |
|
267 |
<span *ngIf="softwareInfo.publishedIn.get(key)['url'].length == 0" |
|
268 |
[attr.uk-tooltip]="softwareInfo.publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'" |
|
269 |
[title]="softwareInfo.publishedIn.get(key)['bestAccessMode']"> |
|
270 |
{{key}} |
|
271 |
</span> |
|
272 |
</span> |
|
273 |
</div> |
|
274 |
</dd> |
Also available in: Unified diff
New files for software entity added (forgotten from previous commit)