1. Change of SearchResult field for funders (used for project results):

instead of funders: {"funderShortname": string, "funderName": string}[]
	now: funderShortname: string // only 1 funder per project and we don't use the full name
2. Addition of SearchResult field for project results: acronym: string, code: string
3. Parsing of funders changed (searchProjects.service): when more than 1 funders in 'fundingtree', keep 'shortname' of the first one
4. Parsing of project's acronym and code parsed and stored in corresponding fields (not in the title.name)
5. Adjust new fields display in 'tabResult.component' and 'searchResult.component'



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51317 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-03-16 14:54:44 +00:00
parent 15ace3ca00
commit 09017aee04
4 changed files with 56 additions and 46 deletions

View File

@ -10,24 +10,21 @@
<!-- <h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode > -->
<h4 [title] = result.title.accessMode >
<a [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
[no title available]
</p>
<p *ngIf="result['title'].name || result.acronym"><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result['title'].name">-</span><span [innerHTML]="result['title'].name"></span><span *ngIf="result.code">({{result.code}})</span></p>
<p *ngIf="!result['title'].name && !result.acronym">[no title available]<span *ngIf="result.code">({{result.code}})</span></p>
</a>
</h4>
<span *ngIf="result.types && result.types.length > 0" [class]="'uk-label custom-label label-blue label-'+result.entityType" title="Type">{{result.types.join(", ")}}</span>
<span *ngIf="result.languages && result.languages.length > 0" class="uk-label custom-label label-language " title="Language">{{result.languages.join(", ")}}</span>
<span *ngIf="result.title && result.title.accessMode" [class]="'uk-label custom-label label-'+ result.title.accessMode " title="Access Mode">{{result.title.accessMode}}</span>
<span *ngIf="result['funders'] && result['funders'].length > 0" class="uk-label custom-label label-funder " title="Funder"><span *ngFor="let funder of result['funders'] let i=index">
<!-- <span *ngIf="result['funders'] && result['funders'].length > 0" class="uk-label custom-label label-funder " title="Funder"><span *ngFor="let funder of result['funders'] let i=index">
<span *ngIf="funder.funderShortname">
{{funder.funderShortname}}</span><span
*ngIf="i < result['funders'].length-1">, </span>
</span></span>
</span></span> -->
<span *ngIf="result['funderShortname']" class="uk-label custom-label label-funder " title="Funder">{{result['funderShortname']}}></span>
<span *ngIf="result.openAccessMandate != undefined && result.openAccessMandate " class="uk-label custom-label label-openaccessmandate " title="Open Access mandate">Open Access mandate</span>
<span *ngIf="result.title && result.title.sc39" class="uk-label custom-label label-sc39 " title="Special Clause 39">Special Clause 39</span>
@ -94,7 +91,7 @@
</span>
<span *ngIf="result.startYear && result.endYear"> (start {{result.startYear}} - end {{result.endYear}})</span>
</div> -->
<div *ngIf="result.startYear && result.endYear"> Start year: {{result.startYear}} - End year: {{result.endYear}})</div>
<div *ngIf="result.startYear && result.endYear"> Start year: {{result.startYear}} - End year: {{result.endYear}}</div>
<div *ngIf="showOrganizations && result['organizations'] != undefined && result['organizations'].length > 0">
<span> Organization: </span>
<span *ngFor="let organization of result['organizations'].slice(0,10) let i=index">

View File

@ -10,14 +10,15 @@
<!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
<a [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<span *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
<span *ngIf="result['title'].name || result.acronym">
<span *ngIf="result.acronym">{{result.acronym}}</span>
<span *ngIf="result.acronym && result['title'].name">-</span>
<span [innerHTML]="result['title'].name"></span>
<span *ngIf="result.code">({{result.code}})</span>
</span>
<!--p *ngIf="result['title'].name == undefined || result['title'].name == ''">
{{result['title'].url}}
</p-->
<span *ngIf="result['title'].name == undefined || result['title'].name == ''">
<span *ngIf="!result['title'].name && !result.acronym">
[no title available]
<span *ngIf="result.code">({{result.code}})</span>
</span>
</a>
</div>
@ -67,15 +68,16 @@
<mark *ngIf="result.embargoEndDate != undefined && result.embargoEndDate != ''">Embargo End Date: {{result.embargoEndDate}}</mark>
<div *ngIf="result['funders'] != undefined">
<!--span> Funders: </span-->
<span *ngFor="let funder of result['funders'] let i=index">
<div *ngIf="result['funderShortname']">
<!-- <span *ngFor="let funder of result['funders'] let i=index">
<span *ngIf="funder.funderShortname">
{{funder.funderShortname}}</span><span
*ngIf="i < result['funders'].length-1">,</span>
</span> <span *ngIf="result.startYear && result.endYear"> (start {{result.startYear}} - end {{result.endYear}})</span>
</span> -->
<span>{{result['funderShortname']}}></span>
<span *ngIf="result.startYear && result.endYear"> (start {{result.startYear}} - end {{result.endYear}})</span>
</div>
<div *ngIf="showOrganizations && result['organizations'] != undefined && result['organizations'].length > 0">

View File

@ -123,35 +123,27 @@ export class SearchProjectsService {
var result: SearchResult = new SearchResult();
result.openAccessMandate = (resData['oamandatepublications'])?true:false;
result['title'] = {"name": '', "accessMode": '', "sc39": ''};
if(resData['acronym'] != undefined && resData['acronym'] != "") {
result['title'].name = resData['acronym'] + " - ";
}
// if(resData['acronym'] != undefined && resData['acronym'] != "") {
// result['title'].name = resData['acronym'] + " - ";
// }
if(Array.isArray(resData['title'])) {
// resData['title'][0].hasOwnProperty("content") {
result['title'].name += resData['title'][0];
// }
} else {
// resData['title'].hasOwnProperty("content") {
result['title'].name += resData['title'];
// }
}
if(result['title'].name != '') {
result['title'].name += " ("+resData['code']+")"
}
// if(result['title'].name != '') {
// result['title'].name += " ("+resData['code']+")"
// }
if(resData['ecsc39'] == true) {
result['title'].sc39 = "sc39";
}
result.acronym = resData['acronym'];
result.code = resData['code'];
// if(resData['title'].hasOwnProperty("content")) {
// result['title'].name = resData['title'].content;
// }
//result['title'].url = OpenaireProperties.getsearchLinkToProject();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
@ -182,20 +174,36 @@ export class SearchProjectsService {
}
}
if(resData.hasOwnProperty("fundingtree")) {
/*let funderSet: Set<string>;
if(result['funders'] == undefined) {
result['funders'] = new Array<
{"funderShortname": string, "funderName": string}>();
funderSet = new Set<string>();
}
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
let countFunders = result['funders'].length;
if(fundingData.hasOwnProperty("funder")) {
if(!funderSet.has(fundingData['funder'].shortname)) {
let countFunders = result['funders'].length;
result['funders'][countFunders] = {"funderShortname": "", "funderName": ""};
result['funders'][countFunders]['funderShortname'] = fundingData['funder'].shortname;
result['funders'][countFunders]['funderName'] = fundingData['funder'].name;
funderSet.add(fundingData['funder'].shortname);
}
}
}*/
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
if(fundingData.hasOwnProperty("funder")) {
result['funderShortname'] = fundingData['funder'].shortname;
break;
}
}
}

View File

@ -14,7 +14,10 @@ export class SearchResult {
//dataproviders & projects:
organizations: { "name": string, "id": string}[];
//projects:
funders: {"funderShortname": string, "funderName": string}[];
acronym: string;
code: string;
//funders: {"funderShortname": string, "funderName": string}[]; // not used
funderShortname: string;
startYear:number;
endYear:number;
//organizations: