Revision 47593
Added by Argiro Kokogiannaki almost 7 years ago
modules/uoa-services-portal/trunk/portal-2/src/app/utils/entities/personInfo.ts | ||
---|---|---|
1 |
export class PersonInfo { |
|
2 |
fullname: string; |
|
3 |
firstname: string; |
|
4 |
secondnames: string; |
|
5 |
country: string; |
|
6 |
|
|
7 |
publications: any; |
|
8 |
researchData: any; |
|
9 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/entities/entities.module.ts | ||
---|---|---|
6 | 6 |
//Entities |
7 | 7 |
import {DatasetInfo} from './datasetInfo'; |
8 | 8 |
import {OrganizationInfo} from './organizationInfo'; |
9 |
import {PersonInfo} from './personInfo'; |
|
10 | 9 |
import {ProjectInfo} from './projectInfo'; |
11 | 10 |
import {Publication} from './publication'; |
12 | 11 |
import {PublicationInfo} from './publicationInfo'; |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/searchFields.ts | ||
---|---|---|
7 | 7 |
"relfunderid", |
8 | 8 |
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", |
9 | 9 |
"relproject","resultacceptanceyear", |
10 |
"resultbestlicense", "instancetypename", "resultlanguagename", "community","resulthostingdatasource"]; |
|
10 | 11 |
|
11 |
"resultbestlicense", "instancetypename", "resultlanguagename", "community","collectedfrom"]; |
|
12 |
|
|
13 | 12 |
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypename", |
14 | 13 |
"resultlanguagename", "community","relprojectid", "relfunderid", |
15 | 14 |
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", |
16 |
"resultdateofacceptance","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
|
|
15 |
"resultdateofacceptance","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid"]; |
|
17 | 16 |
public RESULT_FIELDS: { [key:string]:FieldDetails}={ |
18 | 17 |
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="}, |
19 | 18 |
["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="}, |
... | ... | |
21 | 20 |
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="}, |
22 | 21 |
["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "}, |
23 | 22 |
["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "}, |
24 |
["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
|
|
23 |
["resulthostingdatasource"]:{name:"Datasource", type:"refine", param:"hostedBy", equalityOperator: " exact "},
|
|
25 | 24 |
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "}, |
26 | 25 |
// ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "}, |
27 | 26 |
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "}, |
... | ... | |
122 | 121 |
|
123 | 122 |
}; |
124 | 123 |
|
125 |
//PERSON |
|
126 |
public PERSON_REFINE_FIELDS:string[] = []; |
|
127 |
public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"]; |
|
128 |
public PERSON_FIELDS: { [key:string]:FieldDetails}={ |
|
129 |
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="}, |
|
130 |
["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="}, |
|
131 |
["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="}, |
|
132 |
["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="} |
|
133 |
}; |
|
134 | 124 |
|
135 | 125 |
|
136 | 126 |
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id", |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/openaireProperties.ts | ||
---|---|---|
8 | 8 |
private static baseSearchLink="/"; |
9 | 9 |
private static searchLinkToPublication = "search/publication?articleId="; |
10 | 10 |
private static searchLinkToProject = "search/project?projectId="; |
11 |
private static searchLinkToPerson = "search/person?personId="; |
|
12 | 11 |
private static searchLinkToDataProvider = "search/dataprovider?datasourceId="; |
13 | 12 |
private static searchLinkToDataset = "search/dataset?datasetId="; |
14 | 13 |
private static searchLinkToOrganization = "search/organization?organizationId="; |
... | ... | |
102 | 101 |
public static getsearchLinkToProject():string{ |
103 | 102 |
return this.baseSearchLink + this.searchLinkToProject; |
104 | 103 |
} |
105 |
public static getsearchLinkToPerson():string{ |
|
106 |
return this.baseSearchLink + this.searchLinkToPerson; |
|
107 |
} |
|
104 |
|
|
108 | 105 |
public static getsearchLinkToOrganization():string{ |
109 | 106 |
return this.searchLinkToOrganization; |
110 | 107 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts | ||
---|---|---|
63 | 63 |
searchByType(keyword:string,type:string){ |
64 | 64 |
if (type == "project"){ |
65 | 65 |
return this.searchEntity(keyword,"projects","oaf:project","project"); |
66 |
}else if (type == "person"){ |
|
67 |
return this.searchEntity(keyword,"people","oaf:person","person"); |
|
68 | 66 |
}else if (type == "dataset"){ |
69 | 67 |
return this.searchEntity(keyword,"datasets","oaf:result","dataset"); |
70 | 68 |
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){ |
... | ... | |
80 | 78 |
fetchByType(id:string,type:string){ |
81 | 79 |
if (type == "project"){ |
82 | 80 |
return this.fetchEntity(id,"projects","oaf:project","project"); |
83 |
}else if (type == "person"){ |
|
84 |
return this.fetchEntity(id,"people","oaf:person","person"); |
|
85 | 81 |
}else if (type == "dataset"){ |
86 | 82 |
return this.fetchEntity(id,"datasets","oaf:result","dataset"); |
87 | 83 |
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){ |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/fetchEntitiesClasses/fetchPeople.class.ts | ||
---|---|---|
1 |
import {SearchPeopleService} from '../../services/searchPeople.service'; |
|
2 |
import { ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
3 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
4 |
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class'; |
|
5 |
|
|
6 |
export class FetchPeople { |
|
7 |
public results =[]; |
|
8 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
9 |
public sub: any; |
|
10 |
public searchFields:SearchFields = new SearchFields(); |
|
11 |
|
|
12 |
constructor ( private _searchPeopleService: SearchPeopleService ) { |
|
13 |
|
|
14 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
15 |
this.searchUtils.status =errorCodes.LOADING; |
|
16 |
|
|
17 |
} |
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
public ngOnDestroy() { |
|
22 |
this.sub.unsubscribe(); |
|
23 |
} |
|
24 |
|
|
25 |
public getResultsByKeyword(keyword:string, page: number, size: number){ |
|
26 |
var parameters = ""; |
|
27 |
if(keyword.length > 0){ |
|
28 |
parameters = "q=" + keyword; |
|
29 |
} |
|
30 |
|
|
31 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
32 |
this.searchUtils.status = errorCodes.LOADING; |
|
33 |
|
|
34 |
this._searchPeopleService.searchPeople(parameters, null, page, size,[]).subscribe( |
|
35 |
data => { |
|
36 |
this.searchUtils.totalResults = data[0]; |
|
37 |
console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); |
|
38 |
this.results = data[1]; |
|
39 |
|
|
40 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
41 |
this.searchUtils.status = errorCodes.DONE; |
|
42 |
if(this.searchUtils.totalResults == 0 ){ |
|
43 |
this.searchUtils.status = errorCodes.NONE; |
|
44 |
} |
|
45 |
}, |
|
46 |
err => { |
|
47 |
console.log(err); |
|
48 |
//TODO check erros (service not available, bad request) |
|
49 |
// if( ){ |
|
50 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
51 |
// } |
|
52 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
53 |
this.searchUtils.status = errorCodes.ERROR; |
|
54 |
} |
|
55 |
); |
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts | ||
---|---|---|
95 | 95 |
var parameters = ""; |
96 | 96 |
if(entity == "project") { |
97 | 97 |
parameters = "projects/"+id; |
98 |
} else if(entity == "person") { |
|
99 |
parameters = "people/"+id; |
|
100 | 98 |
} else if(entity == "organization") { |
101 | 99 |
parameters = "organizations/"+id; |
102 | 100 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts | ||
---|---|---|
78 | 78 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
79 | 79 |
this.searchUtils.status = errorCodes.LOADING; |
80 | 80 |
|
81 |
|
|
81 | 82 |
if(id != "" && entity != "") { |
82 |
|
|
83 | 83 |
this._searchDatasetsService.numOfEntityDatasets(id, entity).subscribe( |
84 | 84 |
data => { |
85 | 85 |
this.searchUtils.totalResults = data; |
... | ... | |
111 | 111 |
|
112 | 112 |
if(entity == "project") { |
113 | 113 |
parameters = "projects/"+id; |
114 |
} else if(entity == "person") { |
|
115 |
parameters = "people/"+id; |
|
116 | 114 |
} |
117 | 115 |
|
118 | 116 |
if(parameters != "") { |
modules/uoa-services-portal/trunk/portal-2/src/app/services/searchPeople.service.ts | ||
---|---|---|
1 |
import {Injectable} from '@angular/core'; |
|
2 |
import {Http, Response} from '@angular/http'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 |
import 'rxjs/add/observable/of'; |
|
5 |
import 'rxjs/add/operator/do'; |
|
6 |
import 'rxjs/add/operator/share'; |
|
7 |
import { CacheService } from '../shared/cache.service'; |
|
8 |
import {OpenaireProperties} from '../utils/properties/openaireProperties'; |
|
9 |
import {SearchResult} from '../utils/entities/searchResult'; |
|
10 |
import {RefineResultsUtils} from './servicesUtils/refineResults.class'; |
|
11 |
|
|
12 |
@Injectable() |
|
13 |
export class SearchPeopleService { |
|
14 |
|
|
15 |
constructor(private http: Http, public _cache: CacheService) {} |
|
16 |
|
|
17 |
searchPeople (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any { |
|
18 |
|
|
19 |
console.info("In searchProjects"); |
|
20 |
|
|
21 |
let link = OpenaireProperties.getSearchAPIURLLast()+"people"; |
|
22 |
|
|
23 |
let url = link+"?"; |
|
24 |
if(params!= null && params != '' ) { |
|
25 |
url += params; |
|
26 |
} |
|
27 |
if(refineParams!= null && params != '' ) { |
|
28 |
url += refineParams; |
|
29 |
} |
|
30 |
url += "&page="+(page-1)+"&size="+size + "&format=json"; |
|
31 |
let key = url; |
|
32 |
if (this._cache.has(key)) { |
|
33 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]); |
|
34 |
} |
|
35 |
|
|
36 |
return this.http.get(url) |
|
37 |
.map(res => <any> res.json()) |
|
38 |
//.do(res => console.info(res)) |
|
39 |
.do(res => { |
|
40 |
this._cache.set(key, res); |
|
41 |
}) |
|
42 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]); |
|
43 |
} |
|
44 |
advancedSearchPeople (params: string, page: number, size: number ):any { |
|
45 |
let url = OpenaireProperties.getSearchResourcesAPIURL(); |
|
46 |
var basicQuery = "(oaftype exact person) " |
|
47 |
url += "?query="; |
|
48 |
if(params!= null && params != '' ) { |
|
49 |
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; |
|
50 |
}else{ |
|
51 |
url +=" ( "+basicQuery+ " ) "; |
|
52 |
} |
|
53 |
|
|
54 |
url += "&page="+(page-1)+"&size="+size; |
|
55 |
url += "&format=json"; |
|
56 |
let key = url; |
|
57 |
if (this._cache.has(key)) { |
|
58 |
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
59 |
} |
|
60 |
return this.http.get(url) |
|
61 |
.map(res => <any> res.json()) |
|
62 |
//.do(res => console.info(res)) |
|
63 |
.do(res => { |
|
64 |
this._cache.set(key, res); |
|
65 |
}) |
|
66 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
67 |
} |
|
68 |
parseResults(data: any): SearchResult[] { |
|
69 |
let results: SearchResult[] = []; |
|
70 |
|
|
71 |
let length = Array.isArray(data) ? data.length : 1; |
|
72 |
|
|
73 |
for(let i=0; i<length; i++) { |
|
74 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person']; |
|
75 |
|
|
76 |
var result: SearchResult = new SearchResult(); |
|
77 |
|
|
78 |
result['title'] = {"name": '', "accessMode": '', "sc39": ''}; |
|
79 |
|
|
80 |
result['title'].name = resData.fullname; |
|
81 |
|
|
82 |
//result['title'].url = OpenaireProperties.getsearchLinkToPerson(); |
|
83 |
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
84 |
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
85 |
|
|
86 |
results.push(result); |
|
87 |
} |
|
88 |
|
|
89 |
return results; |
|
90 |
} |
|
91 |
|
|
92 |
numOfEntityPeople(id: string, entity: string):any { |
|
93 |
|
|
94 |
//OpenaireProperties.getSearchAPIURLLast() |
|
95 |
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/" |
|
96 |
let url = OpenaireProperties.getSearchAPIURLLast()+entity+id+"/people/count"+ "?format=json"; |
|
97 |
let key = url; |
|
98 |
if (this._cache.has(key)) { |
|
99 |
return Observable.of(this._cache.get(key)); |
|
100 |
} |
|
101 |
return this.http.get(url) |
|
102 |
.map(res => <any> res.json()) |
|
103 |
.map(res => res.total) |
|
104 |
.do(res => { |
|
105 |
this._cache.set(key, res); |
|
106 |
}); |
|
107 |
} |
|
108 |
|
|
109 |
numOfSearchPeople(params: string):any { |
|
110 |
|
|
111 |
//OpenaireProperties.getSearchAPIURLLast() |
|
112 |
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/" |
|
113 |
let url = OpenaireProperties.getSearchAPIURLLast()+"people/count?q=" + params + "&format=json"; |
|
114 |
let key = url; |
|
115 |
if (this._cache.has(key)) { |
|
116 |
return Observable.of(this._cache.get(key)); |
|
117 |
} |
|
118 |
return this.http.get(url) |
|
119 |
.map(res => <any> res.json()) |
|
120 |
.map(res => res.total) |
|
121 |
.do(res => { |
|
122 |
this._cache.set(key, res); |
|
123 |
}); |
|
124 |
} |
|
125 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/services/peopleService.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import {SearchPeopleService} from './searchPeople.service'; |
|
6 |
|
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
CommonModule, FormsModule |
|
11 |
], |
|
12 |
declarations: [ |
|
13 |
], |
|
14 |
providers:[ |
|
15 |
SearchPeopleService |
|
16 |
], |
|
17 |
exports: [ |
|
18 |
] |
|
19 |
}) |
|
20 |
export class PeopleServiceModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/mainSearch.module.ts | ||
---|---|---|
13 | 13 |
import {ProjectsServiceModule} from '../../services/projectsService.module'; |
14 | 14 |
import {PublicationsServiceModule} from '../../services/publicationsService.module'; |
15 | 15 |
import {OrganizationsServiceModule} from '../../services/organizationsService.module'; |
16 |
import {PeopleServiceModule} from '../../services/peopleService.module'; |
|
17 | 16 |
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module'; |
18 | 17 |
import {SearchFormModule} from '../searchUtils/searchForm.module'; |
19 | 18 |
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; |
... | ... | |
23 | 22 |
imports: [ |
24 | 23 |
CommonModule, FormsModule, RouterModule, |
25 | 24 |
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, |
26 |
PublicationsServiceModule, OrganizationsServiceModule, PeopleServiceModule,
|
|
25 |
PublicationsServiceModule, OrganizationsServiceModule, |
|
27 | 26 |
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule |
28 | 27 |
|
29 | 28 |
], |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/search.component.ts | ||
---|---|---|
10 | 10 |
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; |
11 | 11 |
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; |
12 | 12 |
import { FetchOrganizations } from '../../utils/fetchEntitiesClasses/fetchOrganizations.class'; |
13 |
import { FetchPeople } from '../../utils/fetchEntitiesClasses/fetchPeople.class'; |
|
14 | 13 |
|
15 | 14 |
import {SearchPublicationsService} from '../../services/searchPublications.service'; |
16 | 15 |
import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; |
17 | 16 |
import {SearchProjectsService} from '../../services/searchProjects.service'; |
18 | 17 |
import {SearchDatasetsService} from '../../services/searchDatasets.service'; |
19 |
import {SearchPeopleService} from '../../services/searchPeople.service'; |
|
20 | 18 |
import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; |
21 | 19 |
|
22 | 20 |
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; |
... | ... | |
77 | 75 |
<span *ngIf = "fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span> |
78 | 76 |
</a> |
79 | 77 |
</li> |
80 |
<li (click)="searchPeople()" > |
|
81 |
<a> |
|
82 |
People |
|
83 |
<span *ngIf = "fetchPeople.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
84 |
<span *ngIf = "fetchPeople.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchPeople.searchUtils.totalResults :'')}}</span> |
|
85 |
</a> |
|
86 |
</li> |
|
87 | 78 |
|
88 | 79 |
|
89 | 80 |
|
81 |
|
|
90 | 82 |
</ul> |
91 | 83 |
|
92 | 84 |
<button class="uk-button uk-button-default uk-hidden@m" type="button"> |
... | ... | |
129 | 121 |
<span *ngIf = "fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span> |
130 | 122 |
</a> |
131 | 123 |
</li> |
132 |
<li (click)="searchPeople()" > |
|
133 |
<a> |
|
134 |
People |
|
135 |
<span *ngIf = "fetchPeople.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
136 |
<span *ngIf = "fetchPeople.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchPeople.searchUtils.totalResults :'')}}</span> |
|
137 |
</a> |
|
138 |
</li> |
|
124 |
|
|
139 | 125 |
</ul> |
140 | 126 |
|
141 | 127 |
<ul id="searchtabs" class="uk-switcher uk-width-1-1 uk-margin-top custom-tab-content-large"> |
... | ... | |
229 | 215 |
<browse-entities entityName="organization" baseUrl="/search/find/organizations" [refineFields]=searchFields.ORGANIZATION_REFINE_FIELDS></browse-entities> |
230 | 216 |
</div> |
231 | 217 |
</li> |
232 |
<li> |
|
233 |
<div *ngIf = "keyword.length > 0" class ="uk-animation-fade"> |
|
234 |
<div class = "uk-text-right" *ngIf = "fetchPeople.searchUtils.totalResults> 10"> |
|
235 |
<!--a [href] = "linkToSearchPeople"--> |
|
236 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
237 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchPeople"> |
|
238 |
View all {{fetchPeople.searchUtils.totalResults}} results <span uk-icon="icon: chevron-right"></span> |
|
239 |
</a> |
|
240 |
</div> |
|
241 |
<search-result [(results)]="fetchPeople.results" |
|
242 |
[(status)]= "fetchPeople.searchUtils.status" showLoading = true |
|
243 |
type="person" urlParam="personId"> |
|
244 |
</search-result> |
|
245 |
</div> |
|
246 |
<div *ngIf = "keyword.length == 0 && activeTab=='people'" class ="uk-animation-fade"> |
|
247 |
<div class="uk-alert uk-alert-primary " role="alert">No person statistics found</div> |
|
248 | 218 |
|
249 |
</div> |
|
250 |
</li> |
|
251 | 219 |
</ul> |
252 | 220 |
</div> |
253 | 221 |
|
... | ... | |
262 | 230 |
public reloadProjects: boolean; |
263 | 231 |
public reloadDataproviders: boolean; |
264 | 232 |
public reloadOrganizations: boolean; |
265 |
public reloadPeople: boolean; |
|
266 | 233 |
|
267 | 234 |
|
268 | 235 |
public pageTitle = "Search in OpenAIRE" |
... | ... | |
272 | 239 |
public projectsTab:string[]; |
273 | 240 |
public dataproviders:string[]; |
274 | 241 |
public organizations:string[]; |
275 |
public people:string[]; |
|
276 | 242 |
|
277 | 243 |
public activeTab = "publications"; |
278 | 244 |
public linkToSearchPublications = ""; |
... | ... | |
280 | 246 |
public linkToSearchDataproviders = ""; |
281 | 247 |
public linkToSearchDatasets = ""; |
282 | 248 |
public linkToSearchOrganizations = ""; |
283 |
public linkToSearchPeople = ""; |
|
284 | 249 |
|
285 | 250 |
public fetchPublications : FetchPublications; |
286 | 251 |
public fetchDataproviders : FetchDataproviders; |
287 | 252 |
public fetchProjects : FetchProjects; |
288 | 253 |
public fetchDatasets: FetchDatasets; |
289 | 254 |
public fetchOrganizations: FetchOrganizations; |
290 |
public fetchPeople: FetchPeople; |
|
291 | 255 |
|
292 | 256 |
public searchFields:SearchFields = new SearchFields(); |
293 | 257 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
294 | 258 |
public routerHelper:RouterHelper = new RouterHelper(); |
295 | 259 |
|
296 |
public subPub;public subData;public subProjects;public subOrg;public subPeople; public subDataPr;
|
|
260 |
public subPub;public subData;public subProjects;public subOrg; public subDataPr; |
|
297 | 261 |
constructor ( private route: ActivatedRoute, |
298 | 262 |
private _router: Router, |
299 | 263 |
private _searchPublicationsService: SearchPublicationsService, |
... | ... | |
301 | 265 |
private _searchProjectsService: SearchProjectsService, |
302 | 266 |
private _searchDatasetsService: SearchDatasetsService, |
303 | 267 |
private _searchOrganizationsService: SearchOrganizationsService, |
304 |
private _searchPeopleService: SearchPeopleService, |
|
305 | 268 |
private location: Location, private _meta: Meta ) { |
306 | 269 |
this.fetchPublications = new FetchPublications(this._searchPublicationsService); |
307 | 270 |
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); |
308 | 271 |
this.fetchProjects = new FetchProjects(this._searchProjectsService); |
309 | 272 |
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService); |
310 | 273 |
this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService); |
311 |
this.fetchPeople = new FetchPeople(this._searchPeopleService); |
|
274 |
|
|
312 | 275 |
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; |
313 | 276 |
var title = "Search publications, datasets, projects... | OpenAIRE"; |
314 | 277 |
var url = OpenaireProperties.getBaseLink()+this._router.url; |
... | ... | |
355 | 318 |
if(this.subOrg){ |
356 | 319 |
this.subOrg.unsubscribe(); |
357 | 320 |
} |
358 |
if(this.subPeople){ |
|
359 |
this.subPeople.unsubscribe(); |
|
360 |
} |
|
361 | 321 |
if(this.subDataPr){ |
362 | 322 |
this.subDataPr.unsubscribe(); |
363 | 323 |
} |
... | ... | |
404 | 364 |
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword; |
405 | 365 |
} |
406 | 366 |
} |
407 |
public searchPeople() { |
|
408 |
this.activeTab = "people"; |
|
409 |
if(this.reloadPeople) { |
|
410 |
this.reloadPeople = false; |
|
411 |
this.fetchPeople.getResultsByKeyword(this.keyword, 1, 10); |
|
412 |
this.linkToSearchPeople = OpenaireProperties.getLinkToSearchPeople();// + "?keyword=" + this.keyword; |
|
413 |
} |
|
414 |
} |
|
415 | 367 |
|
368 |
|
|
416 | 369 |
public keywordChanged($event){ |
417 | 370 |
|
418 | 371 |
this.keyword = $event.value; |
... | ... | |
434 | 387 |
if(this.activeTab == "organizations") { |
435 | 388 |
this.searchOrganizations(); |
436 | 389 |
} |
437 |
if(this.activeTab == "people") { |
|
438 |
this.searchPeople(); |
|
439 |
} |
|
390 |
|
|
440 | 391 |
this.count(); |
441 | 392 |
} |
442 | 393 |
|
... | ... | |
499 | 450 |
} |
500 | 451 |
); |
501 | 452 |
} |
502 |
if(this.activeTab != "people"){ |
|
503 |
this.fetchPeople.searchUtils.status = this.errorCodes.LOADING; |
|
504 |
this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe( |
|
505 |
data => { |
|
506 |
this.fetchPeople.searchUtils.totalResults = data; |
|
507 |
this.fetchPeople.searchUtils.status = this.errorCodes.DONE; |
|
508 | 453 |
|
509 |
}, |
|
510 |
err => { |
|
511 |
console.log(err); |
|
512 |
this.fetchPeople.searchUtils.status = this.errorCodes.ERROR; |
|
513 | 454 |
|
514 |
} |
|
515 |
); |
|
516 |
} |
|
517 |
|
|
518 | 455 |
} |
519 | 456 |
|
520 | 457 |
private reloadTabs() { |
... | ... | |
523 | 460 |
this.reloadProjects = true; |
524 | 461 |
this.reloadDataproviders = true; |
525 | 462 |
this.reloadOrganizations = true; |
526 |
this.reloadPeople = true; |
|
527 | 463 |
} |
528 | 464 |
|
529 | 465 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPeople.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 {SearchPeopleService} from '../../services/searchPeople.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-organizations', |
|
15 |
template: ` |
|
16 |
<advanced-search-page pageTitle="Advanced Search People" entityType="person" |
|
17 |
type = "people" |
|
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/people" |
|
23 |
[disableForms]="disableForms"> |
|
24 |
</advanced-search-page> |
|
25 |
|
|
26 |
` |
|
27 |
}) |
|
28 |
|
|
29 |
export class AdvancedSearchPeopleComponent { |
|
30 |
public results =[]; |
|
31 |
public filters =[]; |
|
32 |
|
|
33 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
34 |
|
|
35 |
public searchFields:SearchFields = new SearchFields(); |
|
36 |
|
|
37 |
public fieldIds: string[] = this.searchFields.PERSON_ADVANCED_FIELDS; |
|
38 |
public fieldIdsMap = this.searchFields.PERSON_FIELDS; |
|
39 |
public selectedFields:AdvancedField[] = []; |
|
40 |
|
|
41 |
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; |
|
42 |
public resourcesQuery = "(oaftype exact person)"; |
|
43 |
public csvParams: string; |
|
44 |
public disableForms: boolean = false; |
|
45 |
|
|
46 |
constructor (private route: ActivatedRoute, private _searchPeopleService: SearchPeopleService ) { |
|
47 |
|
|
48 |
this.results =[]; |
|
49 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
50 |
this.searchUtils.status =errorCodes.LOADING; |
|
51 |
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPeople; |
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
} |
|
56 |
ngOnInit() { |
|
57 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
58 |
this.searchUtils.status =errorCodes.LOADING; |
|
59 |
this.sub = this.route.queryParams.subscribe(params => { |
|
60 |
let page = (params['page']=== undefined)?1:+params['page']; |
|
61 |
this.searchUtils.page = ( page <= 0 ) ? 1 : page; |
|
62 |
this.searchPage.fieldIds = this.fieldIds; |
|
63 |
this.selectedFields =[]; |
|
64 |
this.searchPage.selectedFields = this.selectedFields; |
|
65 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
66 |
this.searchPage.getSelectedFiltersFromUrl(params); |
|
67 |
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); |
|
68 |
|
|
69 |
}); |
|
70 |
} |
|
71 |
ngOnDestroy() { |
|
72 |
this.sub.unsubscribe(); |
|
73 |
} |
|
74 |
sub: any; |
|
75 |
public getResults(parameters:string, page: number, size: number){ |
|
76 |
if(parameters!= null && parameters != '' ) { |
|
77 |
this.csvParams ="&type=people&query=( "+this.resourcesQuery + "and (" + parameters + "))"; |
|
78 |
}else{ |
|
79 |
this.csvParams ="&type=people&query="+this.resourcesQuery; |
|
80 |
} |
|
81 |
|
|
82 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
83 |
this.searchUtils.status = errorCodes.LOADING; |
|
84 |
//this.searchPage.openLoading(); |
|
85 |
this.disableForms = true; |
|
86 |
this.results = []; |
|
87 |
this.searchUtils.totalResults = 0; |
|
88 |
|
|
89 |
console.info("Advanced Search People: Execute search query "+parameters); |
|
90 |
this._searchPeopleService.advancedSearchPeople(parameters, page, size).subscribe( |
|
91 |
data => { |
|
92 |
this.searchUtils.totalResults = data[0]; |
|
93 |
console.info("search People total="+this.searchUtils.totalResults); |
|
94 |
this.results = data[1]; |
|
95 |
this.searchPage.updateBaseUrlWithParameters(); |
|
96 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
97 |
this.searchUtils.status = errorCodes.DONE; |
|
98 |
if(this.searchUtils.totalResults == 0 ){ |
|
99 |
this.searchUtils.status = errorCodes.NONE; |
|
100 |
} |
|
101 |
//this.searchPage.closeLoading(); |
|
102 |
this.disableForms = false; |
|
103 |
|
|
104 |
}, |
|
105 |
err => { |
|
106 |
console.log(err); |
|
107 |
console.info("error"); |
|
108 |
//TODO check erros (service not available, bad request) |
|
109 |
// if( ){ |
|
110 |
// this.searchUtils.status = errorCodes.ERROR; |
|
111 |
// } |
|
112 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
113 |
this.searchUtils.status = errorCodes.NOT_AVAILABLE; |
|
114 |
//this.searchPage.closeLoading(); |
|
115 |
this.disableForms = false; |
|
116 |
} |
|
117 |
); |
|
118 |
} |
|
119 |
private setFilters(){ |
|
120 |
//TODO set filters from |
|
121 |
} |
|
122 |
|
|
123 |
public queryChanged($event) { |
|
124 |
var parameters = $event.value; |
|
125 |
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); |
|
126 |
console.info("queryChanged: Execute search query "+parameters); |
|
127 |
|
|
128 |
} |
|
129 |
|
|
130 |
|
|
131 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', component: AdvancedSearchPeopleComponent, canActivate: [FreeGuard] } |
|
11 |
|
|
12 |
]) |
|
13 |
] |
|
14 |
}) |
|
15 |
export class AdvancedSearchPeopleRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ AdvancedSearchPeopleRoutingModule} from './advancedSearchPeople-routing.module'; |
|
6 |
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component'; |
|
7 |
|
|
8 |
|
|
9 |
import {PeopleServiceModule} from '../../services/peopleService.module'; |
|
10 |
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module'; |
|
11 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
12 |
|
|
13 |
@NgModule({ |
|
14 |
imports: [ |
|
15 |
CommonModule, FormsModule, |
|
16 |
PeopleServiceModule, |
|
17 |
AdvancedSearchPeopleRoutingModule, AdvancedSearchPageModule |
|
18 |
|
|
19 |
], |
|
20 |
declarations: [ |
|
21 |
AdvancedSearchPeopleComponent |
|
22 |
], |
|
23 |
providers:[FreeGuard |
|
24 |
], |
|
25 |
exports: [ |
|
26 |
AdvancedSearchPeopleComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
export class AdvancedSearchPeopleModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts | ||
---|---|---|
186 | 186 |
this.urlParam = "projectId"; |
187 | 187 |
} else if(this.entityType == "organization") { |
188 | 188 |
this.urlParam = "organizationId"; |
189 |
} else if(this.entityType == "person") { |
|
190 |
this.urlParam = "personId"; |
|
191 |
} else { |
|
189 |
} else { |
|
192 | 190 |
this.urlParam = "datasourceId"; |
193 | 191 |
} |
194 | 192 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts | ||
---|---|---|
32 | 32 |
<span *ngIf="result['authors'] != undefined"> |
33 | 33 |
<span *ngFor="let author of result['authors'].slice(0,15)"> |
34 | 34 |
<!--a href="{{author['url']}}"--> |
35 |
<a [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
|
|
35 |
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(author['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+type+'s'">
|
|
36 | 36 |
{{author['name']}}; |
37 | 37 |
</a> |
38 | 38 |
</span> |
... | ... | |
144 | 144 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
145 | 145 |
public routerHelper:RouterHelper = new RouterHelper(); |
146 | 146 |
public errorMessage: string = "No results found"; |
147 |
constructor () { |
|
147 | 148 |
|
148 |
constructor () { |
|
149 |
|
|
150 | 149 |
} |
151 | 150 |
|
152 | 151 |
ngOnInit() {} |
152 |
|
|
153 |
|
|
154 |
public quote(params: string):string { |
|
155 |
return '"'+params+'"'; |
|
156 |
} |
|
153 | 157 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/tabResult.component.ts | ||
---|---|---|
33 | 33 |
<div> |
34 | 34 |
<span *ngIf="result['authors'] != undefined"> |
35 | 35 |
<span *ngFor="let author of result['authors'].slice(0,15)"> |
36 |
<a [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
|
|
37 |
{{author['name']}};
|
|
38 |
</a>
|
|
36 |
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(author['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+type+'s'">
|
|
37 |
{{author['name']}}; |
|
38 |
</a> |
|
39 | 39 |
</span> |
40 | 40 |
<span *ngIf="result['authors'].length > 15">...</span> |
41 | 41 |
</span> |
... | ... | |
140 | 140 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
141 | 141 |
public routerHelper:RouterHelper = new RouterHelper(); |
142 | 142 |
public errorMessage: string = "No results found"; |
143 |
|
|
144 | 143 |
constructor () { |
145 | 144 |
|
146 | 145 |
} |
147 | 146 |
|
148 | 147 |
ngOnInit() {} |
148 |
|
|
149 |
public quote(params: string):string { |
|
150 |
return '"'+params+'"'; |
|
151 |
} |
|
149 | 152 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts | ||
---|---|---|
102 | 102 |
this.urlParam = "projectId"; |
103 | 103 |
} else if(this.entityType == "organization") { |
104 | 104 |
this.urlParam = "organizationId"; |
105 |
} else if(this.entityType == "person") { |
|
106 |
this.urlParam = "personId"; |
|
107 | 105 |
} else { |
108 | 106 |
this.urlParam = "datasourceId"; |
109 | 107 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPeople.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ SearchPeopleRoutingModule} from './searchPeople-routing.module'; |
|
6 |
import{SearchPeopleComponent} from './searchPeople.component'; |
|
7 |
|
|
8 |
import {SearchResultsModule } from '../searchUtils/searchResults.module'; |
|
9 |
|
|
10 |
import {PeopleServiceModule} from '../../services/peopleService.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 |
PeopleServiceModule, |
|
21 |
SearchFormModule, SearchResultsModule, SearchPeopleRoutingModule, SearchPageModule//, SearchFilterModalModule |
|
22 |
|
|
23 |
], |
|
24 |
declarations: [ |
|
25 |
SearchPeopleComponent |
|
26 |
], |
|
27 |
providers:[FreeGuard |
|
28 |
], |
|
29 |
exports: [ |
|
30 |
SearchPeopleComponent |
|
31 |
] |
|
32 |
}) |
|
33 |
export class SearchPeopleModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPeople.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import { ActivatedRoute} from '@angular/router'; |
|
3 |
import {Location} from '@angular/common'; |
|
4 |
|
|
5 |
import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; |
|
6 |
|
|
7 |
import {SearchPeopleService} from '../../services/searchPeople.service'; |
|
8 |
import {SearchResult} from '../../utils/entities/searchResult'; |
|
9 |
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
10 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
11 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
|
12 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
|
13 |
|
|
14 |
@Component({ |
|
15 |
selector: 'search-people', |
|
16 |
template: ` |
|
17 |
|
|
18 |
<search-page pageTitle="Search People" |
|
19 |
type="people" entityType="person" [(filters)] = "filters" |
|
20 |
[(results)] = "results" [(searchUtils)] = "searchUtils" |
|
21 |
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false |
|
22 |
[csvParams]="csvParams" csvPath="people" advancedSearchLink="/search/advanced/people" |
|
23 |
[disableForms]="disableForms"> |
|
24 |
</search-page> |
|
25 |
|
|
26 |
` |
|
27 |
|
|
28 |
}) |
|
29 |
export class SearchPeopleComponent { |
|
30 |
public results =[]; |
|
31 |
public filters =[]; |
|
32 |
public baseUrl:string; |
|
33 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
34 |
public sub: any; |
|
35 |
public _location:Location; |
|
36 |
public searchFields:SearchFields = new SearchFields(); |
|
37 |
public refineFields = this.searchFields.PERSON_REFINE_FIELDS; |
|
38 |
public csvParams: string; |
|
39 |
public disableForms: boolean = false; |
|
40 |
|
|
41 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
|
42 |
|
|
43 |
constructor (private route: ActivatedRoute, private _searchPeopleService: SearchPeopleService ) { |
|
44 |
//this.results =[]; |
|
45 |
//this.filters =[]; |
|
46 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
47 |
this.searchUtils.status =errorCodes.LOADING; |
|
48 |
this.baseUrl = OpenaireProperties.getLinkToSearchPeople(); |
|
49 |
//get refine field filters from url parameters |
|
50 |
// if(!this.searchPage){ |
|
51 |
// this.searchPage = new SearchPageComponent(this._location); |
|
52 |
// } |
|
53 |
} |
|
54 |
|
|
55 |
public ngOnInit() { |
|
56 |
this.searchPage.refineFields = this.refineFields; //TODO make it work as a directive |
|
57 |
this.sub = this.route.queryParams.subscribe(params => { |
|
58 |
this.searchUtils.keyword = (params['keyword']?params['keyword']:''); |
|
59 |
this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; |
|
60 |
|
|
61 |
this.getResults(this.searchUtils.keyword, false, this.searchUtils.page, this.searchUtils.size); |
|
62 |
|
|
63 |
|
|
64 |
}); |
|
65 |
} |
|
66 |
|
|
67 |
public ngOnDestroy() { |
|
68 |
this.sub.unsubscribe(); |
|
69 |
} |
|
70 |
|
|
71 |
public getResults(keyword:string,refine:boolean, page: number, size: number){ |
|
72 |
var parameters = ""; |
|
73 |
if(keyword.length > 0){ |
|
74 |
parameters = "q="+ keyword; |
|
75 |
} |
|
76 |
this._getResults(parameters,refine,page,this.searchUtils.size); |
|
77 |
} |
|
78 |
private _getResults(parameters:string,refine:boolean, page: number, size: number){ |
|
79 |
this.csvParams = parameters; |
|
80 |
|
|
81 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
82 |
this.searchUtils.status = errorCodes.LOADING; |
|
83 |
//this.searchPage.openLoading(); |
|
84 |
this.disableForms = true; |
|
85 |
this.results = []; |
|
86 |
this.searchUtils.totalResults = 0; |
|
87 |
|
|
88 |
this._searchPeopleService.searchPeople(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( |
|
89 |
data => { |
|
90 |
this.searchUtils.totalResults = data[0]; |
|
91 |
console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); |
|
92 |
this.results = data[1]; |
|
93 |
this.filters = this.searchPage.checkSelectedFilters(data[2]); |
|
94 |
this.searchPage.updateBaseUrlWithParameters(this.filters); |
|
95 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
96 |
this.searchUtils.status = errorCodes.DONE; |
|
97 |
if(this.searchUtils.totalResults == 0 ){ |
|
98 |
this.searchUtils.status = errorCodes.NONE; |
|
99 |
} |
|
100 |
//this.searchPage.closeLoading(); |
|
101 |
this.disableForms = false; |
|
102 |
}, |
|
103 |
err => { |
|
104 |
console.log(err); |
|
105 |
//TODO check erros (service not available, bad request) |
|
106 |
// if( ){ |
|
107 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
108 |
// } |
|
109 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
110 |
this.searchUtils.status = errorCodes.ERROR; |
|
111 |
//this.searchPage.closeLoading(); |
|
112 |
this.disableForms = false; |
|
113 |
} |
|
114 |
); |
|
115 |
} |
|
116 |
|
|
117 |
private setFilters(){ |
|
118 |
//TODO set filters from |
|
119 |
} |
|
120 |
|
|
121 |
public queryChanged($event) { |
|
122 |
var parameters = $event.value; |
|
123 |
console.info("queryChanged: Execute search query "+parameters); |
|
124 |
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size); |
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{SearchPeopleComponent} from './searchPeople.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', component: SearchPeopleComponent, canActivate: [FreeGuard] } |
|
11 |
|
|
12 |
]) |
|
13 |
] |
|
14 |
}) |
|
15 |
export class SearchPeopleRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDatasets.component.ts | ||
---|---|---|
87 | 87 |
|
88 | 88 |
if(entity == "project") { |
89 | 89 |
parameters = "projects/"+id; |
90 |
} else if(entity == "person") { |
|
91 |
parameters = "people/"+id; |
|
92 | 90 |
} |
93 |
|
|
91 |
|
|
94 | 92 |
if(parameters != "") { |
95 | 93 |
|
96 | 94 |
this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size).subscribe( |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPublications.component.ts | ||
---|---|---|
94 | 94 |
|
95 | 95 |
if(entity == "project") { |
96 | 96 |
parameters = "projects/"+id; |
97 |
} else if(entity == "person") { |
|
98 |
parameters = "people/"+id; |
|
99 |
} |
|
97 |
} |
|
100 | 98 |
|
101 | 99 |
if(parameters != "") { |
102 | 100 |
|
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claim-utils/startOver.component.ts | ||
---|---|---|
1 |
import {Component, Input, Output, EventEmitter} from '@angular/core'; |
|
1 |
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
|
|
2 | 2 |
|
3 | 3 |
import {ClaimResult} from '../claim-utils/claimEntities.class'; |
4 |
import {AlertModal} from '../../utils/modal/alert'; |
|
4 | 5 |
|
5 | 6 |
@Component({ |
6 | 7 |
selector: 'start-over', |
7 |
template: `<button (click)="startOver()" class="uk-button uk-button-danger uk-align-right" > <span uk-icon="icon: refresh"></span> Clear All</button>`, |
|
8 |
template: ` |
|
9 |
<button (click)="confirmOpen()" class="uk-button uk-button-danger uk-align-left" > <span uk-icon="icon: refresh"></span> Clear All</button> |
|
10 |
<modal-alert (alertOutput)="confirmClose($event)"> |
|
11 |
</modal-alert> |
|
12 |
`, |
|
8 | 13 |
|
9 | 14 |
}) |
10 | 15 |
export class StartOverComponent { |
... | ... | |
24 | 29 |
@Input() public projects; |
25 | 30 |
@Input() public contexts; |
26 | 31 |
|
32 |
@ViewChild(AlertModal) alertApplyAll; |
|
27 | 33 |
|
34 |
confirmOpen(type: boolean, message: string){ |
|
35 |
this.alertApplyAll.cancelButton = true; |
|
36 |
this.alertApplyAll.okButton = true; |
|
37 |
this.alertApplyAll.alertTitle = "Remove selected"; |
|
38 |
this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?"; |
|
39 |
this.alertApplyAll.okButtonText = "Yes"; |
|
40 |
this.alertApplyAll.cancelButtonText = "No"; |
|
41 |
this.alertApplyAll.open(); |
|
42 |
} |
|
43 |
confirmClose(data){ |
|
44 |
this.startOver(); |
|
45 |
} |
|
28 | 46 |
startOver(){ |
29 |
console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length ); |
|
30 | 47 |
if(this.type != null && this.linkTo != null){ |
31 | 48 |
console.log("inline"); |
32 | 49 |
if(this.linkTo == "project"){ |
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claim-utils/startOver.module.ts | ||
---|---|---|
2 | 2 |
import { SharedModule } from '../../shared/shared.module'; |
3 | 3 |
import { CommonModule } from '@angular/common'; |
4 | 4 |
import {StartOverComponent} from './startOver.component'; |
5 |
import {AlertModalModule} from '../../utils/modal/alertModal.module'; |
|
5 | 6 |
|
6 | 7 |
@NgModule({ |
7 | 8 |
imports: [ |
8 |
SharedModule, CommonModule |
|
9 |
SharedModule, CommonModule, AlertModalModule
|
|
9 | 10 |
], |
10 | 11 |
declarations: [ |
11 | 12 |
StartOverComponent |
modules/uoa-services-portal/trunk/portal-2/src/app/claims/linking/selected/selectedResults.component.ts | ||
---|---|---|
62 | 62 |
<div *ngIf="showAccessRights && pub.source != 'openaire' " class = "uk-width-1-3 uk-grid"> |
63 | 63 |
<div class="uk-width-1-3 uk-padding-remove-left"> |
64 | 64 |
<select [(ngModel)]="pub.type" name="{{'select_type_'+pub.id}}" > |
65 |
<option [value]="'publication'" >Publication</option> |
|
66 |
<option [value]="'dataset'" >Dataset</option> |
|
65 |
<option [value]="'publication'" (click)="onTypeChanged('publication',pub)" >Publication</option>
|
|
66 |
<option [value]="'dataset'" (click)="onTypeChanged('dataset',pub)" >Dataset</option>
|
|
67 | 67 |
</select> |
68 | 68 |
</div> |
69 | 69 |
<div class="uk-width-1-3 uk-padding-remove-left"> |
... | ... | |
120 | 120 |
|
121 | 121 |
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result |
122 | 122 |
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result |
123 |
public commonType; // for research result type - changes when user apply a change to every result |
|
124 |
public typeChanged:boolean = true; // |
|
123 | 125 |
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"]; |
124 | 126 |
private myDatePickerOptions: IMyOptions = { |
125 | 127 |
// other options... |
... | ... | |
148 | 150 |
if(this.results.length > 1 ){ |
149 | 151 |
this.commonAccessRights = "EMBARGO"; |
150 | 152 |
this.commonEmbargoEndDate = item.embargoEndDate; |
151 |
this.confirmOpen(); |
|
153 |
this.confirmOpen(false,"Do you wish to apply the change to every result?");
|
|
152 | 154 |
} |
153 | 155 |
|
154 | 156 |
} |
157 |
onTypeChanged (event:any, item:any) { |
|
158 |
item.type =(event); |
|
159 |
if(this.results.length > 1 ){ |
|
160 |
this.commonType = item.type; |
|
161 |
this.confirmOpen(true, "Do you wish to apply the change to every result?"); |
|
162 |
} |
|
163 |
|
|
164 |
} |
|
155 | 165 |
// resultsChanged($event) { |
156 | 166 |
// this.results=$event.value; |
157 | 167 |
// this.resultsChange.emit({ |
... | ... | |
169 | 179 |
this.commonAccessRights = type; |
170 | 180 |
if(this.commonAccessRights != "EMBARGO"){ |
171 | 181 |
this.commonEmbargoEndDate = item.embargoEndDate; |
172 |
this.confirmOpen(); |
|
182 |
this.confirmOpen(false, "Do you wish to apply the change to every result?");
|
|
173 | 183 |
} |
174 | 184 |
} |
175 | 185 |
|
176 | 186 |
} |
177 |
confirmOpen(){ |
|
187 |
confirmOpen(type: boolean, message: string){ |
|
188 |
this.typeChanged = type; |
|
178 | 189 |
this.alertApplyAll.cancelButton = true; |
179 | 190 |
this.alertApplyAll.okButton = true; |
180 |
this.alertApplyAll.alertTitle = "Change access rights";
|
|
191 |
this.alertApplyAll.alertTitle = "Change metadata";
|
|
181 | 192 |
this.alertApplyAll.message = "Do you wish to apply the change to every result?"; |
182 | 193 |
this.alertApplyAll.okButtonText = "Yes"; |
183 | 194 |
this.alertApplyAll.cancelButtonText = "No"; |
184 | 195 |
this.alertApplyAll.open(); |
185 | 196 |
} |
186 | 197 |
confirmClose(data){ |
187 |
for (var i = 0; i < this.results.length; i++) {
|
|
188 |
if(this.results[i].source != 'openaire' ){ |
|
189 |
this.results[i].accessRights = this.commonAccessRights;
|
|
190 |
if(this.commonAccessRights == "EMBARGO"){
|
|
191 |
this.results[i].embargoEndDate = this.commonEmbargoEndDate;
|
|
198 |
if(this.typeChanged){
|
|
199 |
|
|
200 |
for (var i = 0; i < this.results.length; i++) {
|
|
201 |
if(this.results[i].source != 'openaire' ){
|
|
202 |
this.results[i].type = this.commonType;
|
|
192 | 203 |
} |
193 | 204 |
} |
194 |
} |
|
205 |
|
|
206 |
}else{ |
|
207 |
for (var i = 0; i < this.results.length; i++) { |
|
208 |
if(this.results[i].source != 'openaire' ){ |
|
209 |
this.results[i].accessRights = this.commonAccessRights; |
|
210 |
if(this.commonAccessRights == "EMBARGO"){ |
|
211 |
this.results[i].embargoEndDate = this.commonEmbargoEndDate; |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
} |
|
195 | 216 |
} |
196 | 217 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/claims/linking/selected/selectedContexts.component.ts | ||
---|---|---|
19 | 19 |
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form> |
20 | 20 |
</div> |
21 | 21 |
<div class="uk-width-1-2 "> |
22 |
<h3 > Selected Projects ({{projects.length}}) </h3>
|
|
22 |
<h3 > Selected Communities ({{projects.length}}) </h3>
|
|
23 | 23 |
<ul class="uk-list uk-list-divider"> |
24 | 24 |
<li class="list-group-item" *ngFor="let context of contexts" > |
25 | 25 |
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span> |
modules/uoa-services-portal/trunk/portal-2/src/app/claims/linking/linkingGeneric.component.ts | ||
---|---|---|
15 | 15 |
<div class="page-header"> |
16 | 16 |
<h1>Linking</h1> |
17 | 17 |
</div> |
18 |
<div class="uk-clearfix"> |
|
19 |
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> What is linking about? </a> |
|
20 |
</div> |
|
21 |
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden> |
|
22 |
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a> |
|
23 |
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Linking Functioanlity:</div> |
|
24 |
<p>TODO: Put some useful information here... </p> |
|
18 | 25 |
|
26 |
|
|
27 |
</div> |
|
28 |
|
|
19 | 29 |
<ul class="uk-breadcrumb"> |
20 | 30 |
<li [class]="(show=='project')?'uk-active':''" ><a (click)="show='project';"> Select Projects <span >({{projects.length}})</span></a></li> |
21 | 31 |
<li [class]="(show=='context')?'uk-active':''" ><a (click)="show='context';"> Select Communities <span >({{contexts.length}})</span></a></li> |
22 | 32 |
<li [class]="(show=='result')?'uk-active':''" ><a (click)="show='result';"> Select Research Results <span >({{results.length}})</span></a></li> |
23 |
<li [class]="(show=='claim')?'uk-active':''" (click)="canProceedToMetadata();"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" > Complete metadata</a></li>
|
|
33 |
<li [class]="(show=='claim')?'uk-active':''" (click)="canProceedToMetadata();"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" > Review metadata</a></li>
|
|
24 | 34 |
</ul> |
25 | 35 |
<start-over [results]="results" [contexts]="contexts" [projects]="projects" ></start-over> |
26 | 36 |
|
27 |
<div class="uk-clearfix"> |
|
28 |
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> What is linking about? </a> |
|
29 |
</div> |
|
30 |
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden> |
|
31 |
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a> |
|
32 |
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Linking Functioanlity:</div> |
|
33 |
<p>TODO: Put some useful information here... </p> |
|
34 | 37 |
|
35 | 38 |
|
36 |
</div> |
|
37 | 39 |
|
38 |
|
|
39 | 40 |
<!--ul class="uk-pagination uk-margin-remove-bottom"> |
40 | 41 |
<li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li> |
41 | 42 |
<li *ngIf="show != 'claim' " (click)="next()" class="uk-margin-auto-left"><a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li> |
... | ... | |
84 | 85 |
|
85 | 86 |
<ul class="uk-pagination"> |
86 | 87 |
<!--li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li--> |
87 |
<li *ngIf="show != 'claim' " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li> |
|
88 |
<li *ngIf="show != 'claim' && this.results.length > 0 " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
|
88 | 89 |
<li *ngIf="show == 'claim' " (click)="next()" class="uk-margin-auto-left"> |
89 | 90 |
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show" |
90 | 91 |
(showChange)="showChange($event)" ></claim-insert> |
modules/uoa-services-portal/trunk/portal-2/src/app/login/login.service.ts | ||
---|---|---|
6 | 6 |
import 'rxjs/add/operator/share'; |
7 | 7 |
|
8 | 8 |
import { CacheService } from '../shared/cache.service'; |
9 |
import {PersonInfo} from '../utils/entities/personInfo'; |
|
10 | 9 |
import {OpenaireProperties} from '../utils/properties/openaireProperties'; |
11 | 10 |
import {User,Session,MyJWT} from './utils/helper.class'; |
12 | 11 |
|
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/person/person-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import { PersonComponent } from './person.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', component: PersonComponent, canActivate: [FreeGuard] } |
|
11 |
]) |
|
12 |
] |
|
13 |
}) |
|
14 |
export class PersonRoutingModule { } |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/person/person.component.html | ||
---|---|---|
1 |
<div class="uk-container uk-margin-top person"> |
|
2 |
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div> |
|
3 |
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div> |
|
4 |
|
|
5 |
<div *ngIf="personInfo != null" uk-grid> |
|
6 |
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s"> |
|
7 |
<h2>{{personInfo.fullname}}</h2> |
|
8 |
|
|
9 |
<dl class="uk-description-list"> |
|
10 |
<dt *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">Last name: </dt> |
|
11 |
<dd *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">{{personInfo.secondnames}}</dd> |
|
12 |
<dt *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">First name: </dt> |
|
13 |
<dd *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">{{personInfo.firstname}}</dd> |
|
14 |
<dt *ngIf="personInfo.country != undefined && personInfo.country != ''">Country: </dt> |
|
15 |
<dd *ngIf="personInfo.country != undefined && personInfo.country != ''">{{personInfo.country}}</dd> |
|
16 |
</dl> |
|
17 |
|
|
18 |
<ul *ngIf="showTabs" class="uk-tab" data-uk-switcher="{connect:'#tab-content'}"> |
|
19 |
<li class="uk-active"> |
|
20 |
<a> |
|
21 |
Publications |
|
22 |
<span class="uk-badge uk-badge-notification"> |
|
23 |
{{fetchPublications.searchUtils.totalResults}} |
|
24 |
</span> |
|
25 |
</a> |
|
26 |
</li> |
|
27 |
<li (click)="searchDatasetsInit()"> |
|
28 |
<a> |
|
29 |
Research Data |
|
30 |
<span class="uk-badge uk-badge-notification"> |
|
31 |
{{fetchDatasets.searchUtils.totalResults}} |
|
32 |
</span> |
|
33 |
</a> |
|
34 |
</li> |
|
35 |
</ul> |
|
36 |
|
|
37 |
<ul *ngIf="showTabs" id="tab-content" class="uk-switcher uk-margin custom-tab-content"> |
|
38 |
<li class="uk-animation-fade"> |
|
39 |
|
|
40 |
<div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary"> |
|
41 |
There are no publications |
|
42 |
</div> |
|
43 |
|
|
44 |
<div *ngIf="fetchPublications.searchUtils.totalResults > 0"> |
|
45 |
|
|
46 |
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10" > |
|
47 |
<a [queryParams]="{personId: personId, pe: 'and'}" routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications"> |
|
48 |
View all {{fetchPublications.searchUtils.totalResults}} results |
|
49 |
</a> |
|
50 |
</div> |
|
51 |
<tab-result [(results)]="fetchPublications.results" |
|
52 |
[(status)]= "fetchPublications.searchUtils.status" |
|
53 |
type="publication" urlParam="articleId"> |
|
54 |
</tab-result> |
|
55 |
</div> |
|
56 |
</li> |
|
57 |
|
|
58 |
<li class="uk-animation-fade"> |
|
59 |
<div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary"> |
|
60 |
There are no research data |
|
61 |
</div> |
|
62 |
|
|
63 |
<div *ngIf="fetchDatasets.searchUtils.totalResults > 0"> |
|
64 |
|
|
65 |
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults > 10" > |
|
66 |
<a [queryParams]="{personId: personId, pe: 'and'}" routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets"> |
|
67 |
View all {{fetchDatasets.searchUtils.totalResults}} results |
|
68 |
</a> |
|
69 |
</div> |
|
70 |
<tab-result [(results)]="fetchDatasets.results" |
|
71 |
[(status)]= "fetchDatasets.status" |
|
72 |
type="dataset" urlParam="datasetId"> |
|
73 |
</tab-result> |
|
74 |
</div> |
|
75 |
</li> |
|
76 |
</ul> |
|
77 |
</div> |
|
78 |
|
|
79 |
<div class="uk-width-1-4@l uk-width-1-4@xl uk-width-1-4@m uk-width-1-1@s"> |
|
80 |
<ul class="uk-list uk-list-striped"> |
|
81 |
<li> |
|
82 |
<dl class="uk-description-list-line"> |
|
83 |
<dt >Share - Bookmark |
|
84 |
</dt> |
|
85 |
<dd> |
|
86 |
<addThis ></addThis> |
|
87 |
</dd> |
|
88 |
</dl> |
|
89 |
</li> |
|
90 |
</ul> |
|
91 |
</div> |
|
92 |
</div> |
|
93 |
</div> |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/person/person.service.ts | ||
---|---|---|
1 |
import {Injectable} from '@angular/core'; |
|
2 |
import {Http, Response} from '@angular/http'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 |
import 'rxjs/add/observable/of'; |
|
5 |
import 'rxjs/add/operator/do'; |
|
6 |
import 'rxjs/add/operator/share'; |
|
7 |
|
|
8 |
import { CacheService } from '../../shared/cache.service'; |
|
9 |
import {PersonInfo} from '../../utils/entities/personInfo'; |
|
10 |
import {OpenaireProperties} from '../../utils/properties/openaireProperties' |
|
11 |
|
|
12 |
export function hashCodeString(str: string): string { |
|
13 |
let hash = 0; |
|
14 |
if (str.length === 0) { |
|
15 |
return hash + ''; |
|
16 |
} |
|
17 |
for (let i = 0; i < str.length; i++) { |
|
18 |
let char = str.charCodeAt(i); |
|
19 |
hash = ((hash << 5) - hash) + char; |
|
20 |
hash = hash & hash; // Convert to 32bit integer |
|
21 |
} |
|
22 |
return hash + ''; |
|
23 |
} |
|
24 |
|
|
25 |
@Injectable() |
|
26 |
export class PersonService { |
|
27 |
|
|
28 |
constructor(private http: Http, public _cache: CacheService) {} |
|
29 |
|
|
30 |
personInfo: PersonInfo; |
|
31 |
|
|
32 |
getPersonInfo (id: string):any { |
|
33 |
|
|
34 |
console.info("getPersonInfo in service"); |
|
35 |
|
|
36 |
let url = OpenaireProperties. getSearchAPIURLLast()+'people/'+id+"?format=json"; |
|
37 |
let key = url; |
|
38 |
if (this._cache.has(key)) { |
|
39 |
return Observable.of(this._cache.get(key)).map(res => this.parsePersonInfo(res)); |
|
40 |
} |
|
41 |
return this.http.get(url) |
|
42 |
.map(res => <any> res.json()) |
|
43 |
.map(res => res['result']['metadata']['oaf:entity']['oaf:person']) |
|
44 |
.do(res => { |
|
45 |
this._cache.set(key, res); |
|
46 |
}) |
|
47 |
.map(res => this.parsePersonInfo(res)); |
|
48 |
|
|
49 |
|
|
50 |
|
Also available in: Unified diff
Remove person landing - links to landing pages of people - search pages for people | Linking: minor layout changes - add apply all functionality for result type change in dropdown