adding cite this component & library | fixing autocomplete bugs for advanced search pages | changing css for filters | more minor bugs

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46352 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-03-20 10:31:39 +00:00
parent 65fc6976ec
commit d19c45c193
26 changed files with 356 additions and 69 deletions

View File

@ -58,6 +58,7 @@
"angular2-universal": "~2.1.0-rc.1", "angular2-universal": "~2.1.0-rc.1",
"angular2-universal-polyfills": "~2.1.0-rc.1", "angular2-universal-polyfills": "~2.1.0-rc.1",
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"citation-js": "^0.3.0-2",
"clipboard": "^1.5.16", "clipboard": "^1.5.16",
"compression": "^1.6.2", "compression": "^1.6.2",
"express": "^4.14.0", "express": "^4.14.0",

View File

@ -18,7 +18,7 @@ declare var UIkit:any;
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option> <option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option>
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{funder.name}}</option> <option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{funder.name}}</option>
</select></td><td > </select></td><td >
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete> <entities-autocomplete fieldId="project" entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
</td></tr></table> </td></tr></table>
</form> </form>

View File

@ -33,7 +33,7 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
<h3>Locate data provider via your institution</h3> <h3>Locate data provider via your institution</h3>
<form class= "uk-form uk-form-row"> <form class= "uk-form uk-form-row">
<entities-autocomplete (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true <entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
[placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false [placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event)"> (selectedValueChanged)="valueChanged($event)">
</entities-autocomplete> </entities-autocomplete>

View File

@ -194,6 +194,7 @@
</dl> </dl>
</li> </li>
<li><citeThis [result]="datasetInfo" [id]="datasetId"></citeThis></li>
<li *ngIf="datasetInfo.collectedFrom != undefined"> <li *ngIf="datasetInfo.collectedFrom != undefined">
<dl class="uk-description-list-line functionsSection"> <dl class="uk-description-list-line functionsSection">
<dt>Collected from</dt> <dt>Collected from</dt>

View File

@ -11,6 +11,7 @@ import { DatasetRoutingModule } from './dataset-routing.module';
import {MetricsModule} from '../metrics.module'; import {MetricsModule} from '../metrics.module';
import {IFrameModule} from '../../utils/iframe.module'; import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module'; import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ResultLandingModule } from '../resultLanding.module'; import { ResultLandingModule } from '../resultLanding.module';
import { LandingModule } from '../landing.module'; import { LandingModule } from '../landing.module';
@ -18,7 +19,7 @@ import { LandingModule } from '../landing.module';
@NgModule({ @NgModule({
imports: [ imports: [
//MaterialModule.forRoot(), //MaterialModule.forRoot(),
CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CiteThisModule,
ResultLandingModule, DatasetRoutingModule, MetricsModule, IFrameModule, AltMetricsModule ResultLandingModule, DatasetRoutingModule, MetricsModule, IFrameModule, AltMetricsModule
], ],
declarations: [ declarations: [

View File

@ -56,6 +56,7 @@ export class DatasetService {
if(data[0] != null) { if(data[0] != null) {
this.datasetInfo.date = data[0].dateofacceptance.substring(0,4); this.datasetInfo.date = data[0].dateofacceptance.substring(0,4);
this.datasetInfo.dateofacceptance = data[0].dateofacceptance;
this.datasetInfo.publisher = data[0].publisher; this.datasetInfo.publisher = data[0].publisher;
if(!Array.isArray(data[0].description)) { if(!Array.isArray(data[0].description)) {
this.datasetInfo.description = data[0].description; this.datasetInfo.description = data[0].description;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
import {Component, ElementRef, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Citation, CitationData} from './citation.class';
//<addThis ></addThis>
@Component({
selector: 'citeThis',
template: `
<div class="citationDownloader ">
<dl class="uk-description-list-line">
<dt class="title">Cite this article</dt>
<dd class="line" >
<select class="select" id="citations" name="citeselect" [(ngModel)]="selectedStyle" (click)="styleChanged()">
<option *ngFor=" let style of this.citation.templates let i = index" [value]="style">{{style}}</option>
</select>
<div id="citation" class="box-content">{{citationText}}</div>
</dd>
</dl>
</div>
`
})
export class CiteThisComponent {
private sub:any;
public selectedStyle:string;
public citationText:string;
public citation:Citation = new Citation();
public cite: any;
@Input() result: any;
@Input() id: string;
public data;//= '[ { "id": "Q23571040", "type": "apple", "title": "Correlation of the Base Strengths of Amines 1", "DOI": "10.1021/ja01577a030", "author": [ { "given": "H. K.", "family": "Hall" } ], "issued": [ { "date-parts": [ "1957", "1", "1" ] } ], "container-title": "Journal of the American Chemical Society", "volume": "79", "issue": "20", "page": "5441-5444" } ]';
constructor(private route: ActivatedRoute) {
this.selectedStyle = this.citation.templates[0];
}
ngOnInit() {
// this.Cite
// this.sub = this.route.queryParams.subscribe(data => {
this.parseData();
var Cite = require('citation-js');
this.cite = new Cite(this.data);
// this.cite.setData(this.data);
this.citationText = this.cite.get(this.citation.getOptionsBy(this.selectedStyle));
// });
}
parseData(){
var citationData:CitationData = new CitationData();
// try{
citationData.id = this.id;
if(this.result.types != undefined && this.result.types.length > 0 && this.result.types[0]){
citationData.type = this.result.types[0].toLowerCase();
}else if(this.result.type != undefined ){
citationData.type = this.result.type.toLowerCase();
}
if(this.result.title && this.result.title.name){
citationData.title = this.result.title.name;
}
if(this.result.journal && this.result.journal.journal){
citationData["container-title"] = this.result.journal.journal;
}
if(this.result.publisher){
citationData.publisher = this.result.publisher;
}
citationData.author = [];
for (var i =0 ;i < this.result.authors.length; i++){
if(this.result.authors[i].name && this.result.authors[i].name.indexOf(", ") !== -1){
citationData.author.push({given:this.result.authors[i].name.split(", ")[0], family:this.result.authors[i].name.split(", ")[1], 'parse-names':true});
}else{
citationData.author.push({given:"", family:this.result.authors[i].name, 'parse-names':true});
}
citationData.authors.push(this.result.authors[i].name);
}
if(this.result.dateofacceptance != undefined){
citationData.issued = [];
//[this.result.dateofacceptance.substring(0,4),this.result.dateofacceptance.substring(5,7),this.result.dateofacceptance.substring(8,10)]
citationData.issued.push({"date-parts":["2011","1","1"]});
//
// // citationData.issued[0]["date-parts"].push(this.result.dateofacceptance.substring(0,4));
// // citationData.issued[0]["date-parts"].push(this.result.dateofacceptance.substring(5,7));
// if(this.result.dateofacceptance.substring(5,6)=="0"){
// citationData.issued[0]["date-parts"][1] =(this.result.dateofacceptance.substring(6,7));
//
// }
// // citationData.issued[0]["date-parts"].push(this.result.dateofacceptance.substring(8,10));
// if(this.result.dateofacceptance.substring(8,9)=="0"){
// citationData.issued[0]["date-parts"][2]=(this.result.dateofacceptance.substring(9,10));
//
// }
citationData.date = this.result.dateofacceptance ;
console.log(citationData.issued[0]["date-parts"][0]+" "+citationData.issued[0]["date-parts"][1]+" "+citationData.issued[0]["date-parts"][2] + "--->"+ citationData.date)
}
// }catch (e) {
// console.log("Error parsing data for citeThis component");
// console.log(e);
//
// citationData = new CitationData();
// }
this.data = JSON.stringify([citationData]);
console.log(this.data);
}
styleChanged(){
this.citationText = this.cite.get(this.citation.getOptionsBy(this.selectedStyle));
}
}

View File

@ -0,0 +1,23 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {CiteThisComponent} from './citeThis.component';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
CiteThisComponent
],
providers:[
],
exports: [
CiteThisComponent
]
})
export class CiteThisModule { }

View File

@ -404,7 +404,7 @@
</dl> </dl>
</li> </li>
<li><citeThis [result]="publicationInfo" [id]="articleId"></citeThis></li>
<li *ngIf="publicationInfo.collectedFrom != undefined"> <li *ngIf="publicationInfo.collectedFrom != undefined">
<dl class="uk-description-list-line"> <dl class="uk-description-list-line">
<dt>Collected from</dt> <dt>Collected from</dt>

View File

@ -11,6 +11,7 @@ import { PublicationRoutingModule } from './publication-routing.module';
import {MetricsModule} from '../metrics.module'; import {MetricsModule} from '../metrics.module';
import {IFrameModule} from '../../utils/iframe.module'; import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module'; import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ResultLandingModule } from '../resultLanding.module'; import { ResultLandingModule } from '../resultLanding.module';
@ -18,7 +19,7 @@ import { LandingModule } from '../landing.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, CiteThisModule,
ResultLandingModule, PublicationRoutingModule, IFrameModule, MetricsModule, AltMetricsModule ResultLandingModule, PublicationRoutingModule, IFrameModule, MetricsModule, AltMetricsModule
], ],
declarations: [ declarations: [

View File

@ -55,6 +55,7 @@ export class PublicationService {
if(data[0] != null) { if(data[0] != null) {
this.publicationInfo.date = data[0].dateofacceptance.substring(0,4); this.publicationInfo.date = data[0].dateofacceptance.substring(0,4);
this.publicationInfo.dateofacceptance = data[0].dateofacceptance;
this.publicationInfo.publisher = data[0].publisher; this.publicationInfo.publisher = data[0].publisher;
if(!Array.isArray(data[0].description)) { if(!Array.isArray(data[0].description)) {
this.publicationInfo.description = data[0].description; this.publicationInfo.description = data[0].description;

View File

@ -54,7 +54,7 @@ export class SearchCompatibleDataprovidersComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes(); var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING; this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.searchLinkToCompatibleDataProviders; this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProviders();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){ for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="

View File

@ -54,7 +54,7 @@ export class SearchEntityRegistriesComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes(); var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING; this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.searchLinkToEntityRegistriesDataProviders; this.baseUrl = OpenaireProperties.getLinkToSearchEntityRegistries();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){ for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="

View File

@ -336,7 +336,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe( this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
data => { data => {
console.log("Count results: "+data); console.log("Count results: "+data);
// this.fetchPublications.searchUtils.totalResults = data; this.fetchPublications.searchUtils.totalResults = data;
this.fetchPublications.searchUtils.status = this.errorCodes.DONE; this.fetchPublications.searchUtils.status = this.errorCodes.DONE;
}, },
err => { err => {
@ -374,7 +374,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
if(this.activeTab != "dataproviders"){ if(this.activeTab != "dataproviders"){
this.fetchDataproviders.getNumForSearch(this.keyword); this.fetchDataproviders.getNumForSearch(this.keyword);
} }
if(this.activeTab != "dataproviders"){ if(this.activeTab != "organizations"){
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING; this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe( this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
data => { data => {

View File

@ -17,26 +17,23 @@ import {Dates} from '../../utils/string-utils.class';
<td *ngIf = "i != 0" class=""><select [(ngModel)]="selectedField.operatorId" name="selectOp_{{i}}" > <td *ngIf = "i != 0" class=""><select [(ngModel)]="selectedField.operatorId" name="selectOp_{{i}}" >
<option *ngFor="let op of operators" (change)="fieldOperatorChanged(i, op.id, op.id)" (click)="fieldOperatorChanged(i, op.id, op.id)" [value]="op.id">{{op.id}}</option> <option *ngFor="let op of operators" (change)="fieldOperatorChanged(i, op.id, op.id)" (click)="fieldOperatorChanged(i, op.id, op.id)" [value]="op.id">{{op.id}}</option>
</select></td> </select></td>
<td ><select [(ngModel)]="selectedField.id" name="selectField_{{i}}" (click)="fieldIdsChanged(i)" > <td ><select [(ngModel)]="selectedField.id" name="selectField_{{i}}" (ngModelChange)="fieldIdsChanged(i,selectedField.id)" ><!--(click)="fieldIdsChanged(i)" -->
<option *ngFor="let id of fieldIds" [value]="id" >{{fieldIdsMap[id].name}}</option> <option *ngFor="let id of fieldIds" [value]="id" >{{fieldIdsMap[id].name}} </option>
</select> </td> </select> </td>
<td *ngIf = "selectedField.type == 'keyword'" ><input type="text" class="form-control" placeholder="Type keywords..." <td *ngIf = "selectedField.type == 'keyword'" ><input type="text" class="form-control" placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]"></td> [(ngModel)]="selectedField.value" name="value[{{i}}]"></td>
<td *ngIf = "selectedField.type == 'date'" > <td *ngIf = "selectedField.type == 'date'" >
<!--input type="text" class="form-control" placeholder="Type Year..."
[(ngModel)]="selectedField.value" name="value[{{i}}]" (keyup)=validateDate(i,selectedField.value)-->
<date-filter [(dateValue)]=selectedField.dateValue ></date-filter> <date-filter [(dateValue)]=selectedField.dateValue ></date-filter>
</td> </td>
<!--[(filterId)]=i --> <td *ngIf = " selectedField.id && selectedField.type == 'vocabulary'" >
<td *ngIf = "selectedField.type == 'vocabulary'" > <static-autocomplete *ngIf = " selectedField.id" [(vocabularyId)] = selectedField.param [fieldId]=selectedField.id
<static-autocomplete [(vocabularyId)] = selectedField.param
[(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete> (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete>
</td> </td>
<td *ngIf = " selectedField.type == 'refine'" > <td *ngIf = " selectedField.id && selectedField.type == 'refine'" >
<static-autocomplete [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = [selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete></td> <static-autocomplete [(list)] = this.fieldList[selectedField.id] [fieldId]=selectedField.id [entityName] = "entityType" [fieldName] = [selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete></td>
<td *ngIf = "selectedField.type == 'entity'" ><entities-autocomplete [entityType]=selectedField.param [selectedValue]=selectedField.value [showSelected]=true <td *ngIf = "selectedField.type == 'entity'" ><entities-autocomplete [fieldId]=selectedField.id [entityType]=selectedField.param [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)" > (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)" >
</entities-autocomplete></td> </entities-autocomplete></td>
@ -125,15 +122,16 @@ export class AdvancedSearchFormComponent {
this.selectedFields[index].valid = Dates.isValidYear(value); this.selectedFields[index].valid = Dates.isValidYear(value);
} }
fieldIdsChanged(index: number) { fieldIdsChanged(index: number, fieldId:string ) {
console.log("Field index::"+index + this.selectedFields[index].id ); console.log("Field index::"+index + " " + this.selectedFields[index].id + " function id:" +fieldId);
var id= this.fieldIds[0]; var id= this.fieldIds[0];
this.selectedFields[index].name = this.fieldIdsMap[id].name; this.selectedFields[index].name = this.fieldIdsMap[id].name;
this.selectedFields[index].type = this.fieldIdsMap[id].type; this.selectedFields[index].type = this.fieldIdsMap[id].type;
this.selectedFields[index].value = ""; this.selectedFields[index].value = "";
this.selectedFields[index].param = this.fieldIdsMap[id].param; this.selectedFields[index].param = this.fieldIdsMap[id].param;
var id =this.selectedFields[index].id; var id =fieldId;//this.selectedFields[index].id;
this.selectedFields[index].name = this.fieldIdsMap[id].name; this.selectedFields[index].name = this.fieldIdsMap[id].name;
this.selectedFields[index].type = this.fieldIdsMap[id].type; this.selectedFields[index].type = this.fieldIdsMap[id].type;
this.selectedFields[index].value = ""; this.selectedFields[index].value = "";

View File

@ -17,17 +17,19 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<h4 class="tm-article-subtitle">{{filter.title}}</h4> <h4 class="tm-article-subtitle">{{filter.title}}</h4>
<div *ngIf="filter.values.length == 0" class="uk-alert uk-alert-info" role="alert">No {{filter.title}} statistics found</div> <div *ngIf="filter.values.length == 0" class="uk-alert uk-alert-info" role="alert">No {{filter.title}} statistics found</div>
<ul *ngIf="filter.values.length > 0 && !viewAll" class="uk-list uk-list-line "> <ul *ngIf="filter.values.length > 0 && !viewAll" class="uk-list uk-list-line browseFilters">
<li *ngFor= "let value of filter.values.slice(0,5)"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a--> <li *ngFor= "let value of filter.values.slice(0,5)"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a-->
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a> <a class = " filterItem" [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>
<span class="filterName"><div title = "{{value.name}}">{{_formatName(value)}} </div></span><span class="filterNumber" > ({{value.number}})</span></a>
</li> </li>
<li *ngIf= " filter.values.length > 5 && !viewAll " (click)="viewAll=true;"> <li *ngIf= " filter.values.length > 5 && !viewAll " (click)="viewAll=true;">
<span ><span class="uk-text-muted clickable">View more </span><a><i class="uk-icon-toggle-right"></i></a></span> <span ><span class="uk-text-muted clickable">View more </span><a><i class="uk-icon-toggle-right"></i></a></span>
</li> </li>
</ul> </ul>
<ul *ngIf="filter.values.length > 0 && viewAll" class="uk-list uk-list-line searchFilterBoxValues"> <ul *ngIf="filter.values.length > 0 && viewAll" class="uk-list uk-list-line browseFilters">
<li *ngFor= "let value of filter.values"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a--> <li *ngFor= "let value of filter.values"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a-->
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a> <a class = " filterItem" [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>
<span class="filterName"><div title = "{{value.name}}">{{_formatName(value)}} </div></span><span class="filterNumber" > ({{value.number}})</span></a>
</li> </li>
<li *ngIf= " filter.values.length > 5 && viewAll " (click)="viewAll=false;"> <li *ngIf= " filter.values.length > 5 && viewAll " (click)="viewAll=false;">
<span ><span class="uk-text-muted clickable">View less </span><a><i class="uk-icon-toggle-up"></i></a></span> <span ><span class="uk-text-muted clickable">View less </span><a><i class="uk-icon-toggle-up"></i></a></span>
@ -58,7 +60,7 @@ export class BrowseStatisticComponent {
} }
private _formatName(value){ private _formatName(value){
return (((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name) return value.name+" ";//(((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name)
} }
} }

View File

@ -12,37 +12,24 @@ import { Filter, Value} from './searchHelperClasses.class';
</h3> </h3>
<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;" aria-expanded="false"> <div data-wrapper="true" style="overflow:hidden;height:0;position:relative;" aria-expanded="false">
<div class="uk-accordion-content searchFilterBoxValues "> <div class="uk-accordion-content searchFilterBoxValues ">
<div *ngFor = "let value of getSelectedValues(filter)" class = "uk-animation-fade"> <div *ngFor = "let value of getSelectedValues(filter)" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}">
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" /> <input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span> {{_formatName(value)}} </div></span><span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number}})</span>
</div> </div>
<div class="uk-grid-divider uk-margin-remove"></div> <div class="uk-grid-divider uk-margin-remove"></div>
<div *ngFor = "let value of getNotSelectedValues(filter)" class = "uk-animation-fade"> <div *ngFor = "let value of getNotSelectedValues(filter)" class = "uk-animation-fade filterItem">
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span> <span class="filterName"><div title = "{{value.name}}"> <input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
{{_formatName(value)}} </div></span><span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number}})</span>
</div> </div>
<!--div *ngFor = "let value of filter.values" >
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span>
</div-->
</div> </div>
</div> </div>
</div> </div>
<!--div *ngIf="filter.countSelectedValues == 0 " class = "uk-accordion " data-uk-accordion="{collapse: true, showfirst: false}">
<h3 class="uk-accordion-title">{{_formatTitle(filter.title,filter.values.length)}}
</h3>
<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;" aria-expanded="false">
<div class="uk-accordion-content searchFilterBoxValues ">
<div *ngFor = "let value of filter.values" >
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span>
</div>
</div>
</div>
</div-->
` `
}) })
@ -65,7 +52,7 @@ export class SearchFilterComponent {
return (((title+" ("+length+")").length >this._maxCharacters)?(title.substring(0,(this._maxCharacters - (" ("+length+")").length - ('...').length))+"..."):title+" ("+length+")") return (((title+" ("+length+")").length >this._maxCharacters)?(title.substring(0,(this._maxCharacters - (" ("+length+")").length - ('...').length))+"..."):title+" ("+length+")")
} }
private _formatName(value){ private _formatName(value){
return (((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name) return value.name;//(((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name)
} }
toggleShowAll(){ toggleShowAll(){
this.showAll = !this.showAll; this.showAll = !this.showAll;

View File

@ -2,6 +2,7 @@ export class DatasetInfo {
title: { "name": string, "url": string, "accessMode": string}; title: { "name": string, "url": string, "accessMode": string};
authors: { "name": string, "id": string}[]; authors: { "name": string, "id": string}[];
date: string; date: string;
dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;
type: string; type: string;
downloadFrom: Map<string, {"url": string[], "accessMode": string[]}>; //key is name downloadFrom: Map<string, {"url": string[], "accessMode": string[]}>; //key is name

View File

@ -2,6 +2,7 @@ export class PublicationInfo {
title: { "name": string, "url": string, "accessMode": string}; title: { "name": string, "url": string, "accessMode": string};
authors: { "name": string, "id": string}[]; authors: { "name": string, "id": string}[];
date: string; date: string;
dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;
types: string[]; types: string[];
downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>; //key is name downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>; //key is name

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Input, Output, EventEmitter} from '@angular/core'; import {Component, ElementRef, Input, Output, EventEmitter, OnChanges, SimpleChange} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject'; import {Subject} from 'rxjs/Subject';
import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class'; import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
@ -56,6 +56,8 @@ export class EntitiesAutocompleteComponent {
@Input() public allowDuplicates:boolean = false; @Input() public allowDuplicates:boolean = false;
@Input() public selectedValue:string = ''; @Input() public selectedValue:string = '';
@Input() public keyword = ''; @Input() public keyword = '';
@Input() public fieldId:string ;
public currentFieldId: string ;
public warningMessage = ""; public warningMessage = "";
public infoMessage = ""; public infoMessage = "";
@ -75,13 +77,17 @@ export class EntitiesAutocompleteComponent {
public results = 0; public results = 0;
public focus:boolean = false; public focus:boolean = false;
constructor (private _search:EntitiesSearchService, private myElement: ElementRef) { constructor (private _search:EntitiesSearchService, private myElement: ElementRef) {
this.currentFieldId=this.fieldId;
} }
ngOnInit () { ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
if(this.currentFieldId!=this.fieldId){ //this is going to be called when
this.currentFieldId=this.fieldId;
this.initialize();
}
}
private initialize(){
this.showInput = true;
if(this.entityType == "project" && this.funderId ){ if(this.entityType == "project" && this.funderId ){
this.filtered = this.searchTermStream this.filtered = this.searchTermStream
.debounceTime(300).distinctUntilChanged() .debounceTime(300).distinctUntilChanged()
@ -232,6 +238,7 @@ export class EntitiesAutocompleteComponent {
return (str.length > size)?str.substr(0,size)+'...':str; return (str.length > size)?str.substr(0,size)+'...':str;
} }
private getSelectedNameFromGivenId(){ private getSelectedNameFromGivenId(){
this.showInput = true;
if(this.selectedValue && this.selectedValue.length > 0 ){ if(this.selectedValue && this.selectedValue.length > 0 ){

View File

@ -111,6 +111,12 @@ export class OpenaireProperties {
public static getLinkToSearchDataProviders():string{ public static getLinkToSearchDataProviders():string{
return this.baseSearchLink + this.searchLinkToDataProviders; return this.baseSearchLink + this.searchLinkToDataProviders;
} }
public static getLinkToSearchCompatibleDataProviders():string{
return this.baseSearchLink + this.searchLinkToCompatibleDataProviders;
}
public static getLinkToSearchEntityRegistries():string{
return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders;
}
public static getLinkToSearchDatasets():string{ public static getLinkToSearchDatasets():string{
return this.baseSearchLink + this.searchLinkToDatasets; return this.baseSearchLink + this.searchLinkToDatasets;
} }

View File

@ -48,7 +48,7 @@ export class SearchFields {
public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords", public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
"funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id", "funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
"projectstartdate","projectenddate","projectecsc39", "projectstartdate","projectenddate","projectecsc39",
"projectcode","relorganizationid", "collectedfromdatasourceid"]; "projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
public PROJECT_FIELDS: { [key:string]:FieldDetails}={ public PROJECT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="}, ["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="}, ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
@ -64,7 +64,7 @@ export class SearchFields {
["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", equalityOperator: " within "}, ["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", equalityOperator: " within "},
["projectenddate"]:{name:"End Date", type:"date", param:"enddate", equalityOperator: " within "}, ["projectenddate"]:{name:"End Date", type:"date", param:"enddate", equalityOperator: " within "},
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "}, ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
["projectcode"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "}, ["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "}, ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "} ["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Input, Output, EventEmitter} from '@angular/core'; import {Component, ElementRef, Input, Output, EventEmitter, OnChanges, SimpleChange} from '@angular/core';
import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class'; import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
import {ISVocabulariesService} from './ISVocabularies.service'; import {ISVocabulariesService} from './ISVocabularies.service';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
@ -18,7 +18,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
<span (click)="remove(item)" aria-hidden="true" title="Remove selection" > <i class="uk-icon-remove clickable"></i> </span> <span (click)="remove(item)" aria-hidden="true" title="Remove selection" > <i class="uk-icon-remove clickable"></i> </span>
</span> </span>
</span> </span>
<input *ngIf = "showInput" type="text" class="auto-complete-input validate filter-input input-sm form-control " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=filter() > <input *ngIf = "showInput " type="text" class="auto-complete-input validate filter-input input-sm form-control " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=filter() >
<!--span *ngIf="showLoading" class="uk-alert uk-alert-primary" data-uk-alert=""> <i class="uk-icon-spinner"></i> Loading... </span> <!--span *ngIf="showLoading" class="uk-alert uk-alert-primary" data-uk-alert=""> <i class="uk-icon-spinner"></i> Loading... </span>
<span *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" data-uk-alert=""> {{warningMessage}} <a href="" class="uk-alert-close uk-close"></a></span--> <span *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" data-uk-alert=""> {{warningMessage}} <a href="" class="uk-alert-close uk-close"></a></span-->
<div *ngIf="focus && showInput" class="uk-dropdown" aria-expanded="true" style="display:block" > <div *ngIf="focus && showInput" class="uk-dropdown" aria-expanded="true" style="display:block" >
@ -37,7 +37,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
` `
}) })
export class StaticAutoCompleteComponent { export class StaticAutoCompleteComponent implements OnChanges{
@Input() placeHolderMessage = "Search for entries"; @Input() placeHolderMessage = "Search for entries";
@Input() title = "Autocomplete"; @Input() title = "Autocomplete";
@Output() addItem = new EventEmitter(); // when selected list changes update parent component @Output() addItem = new EventEmitter(); // when selected list changes update parent component
@ -54,6 +54,7 @@ export class StaticAutoCompleteComponent {
@Input() public vocabularyId:string ; @Input() public vocabularyId:string ;
@Input() public fieldName:string ; @Input() public fieldName:string ;
@Input() public entityName:string ; @Input() public entityName:string ;
@Input() public fieldId:string ;
@Input() public keyword = ''; @Input() public keyword = '';
@Input() public type = 'search' //search, result, context, project @Input() public type = 'search' //search, result, context, project
@ -66,18 +67,29 @@ export class StaticAutoCompleteComponent {
public done = false; public done = false;
public results = 0; public results = 0;
public focus:boolean = false; public focus:boolean = false;
public currentFieldId: string ;
constructor ( private _vocabulariesService: ISVocabulariesService,private _refineService: RefineFieldResultsService, private myElement: ElementRef) { constructor ( private _vocabulariesService: ISVocabulariesService,private _refineService: RefineFieldResultsService, private myElement: ElementRef) {
this.currentFieldId=this.fieldId;
} }
ngOnDestroy(){ ngOnDestroy(){
if(this.sub && this.sub != undefined){ if(this.sub && this.sub != undefined){
this.sub.unsubscribe(); this.sub.unsubscribe();
} }
} }
ngOnInit () {
ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
if(this.currentFieldId!=this.fieldId){ //this is going to be called when
this.currentFieldId=this.fieldId;
this.initialize();
}
}
private initialize(){
this.showInput = true;
if(this.list == undefined || this.list.length == 0){ if(this.list == undefined || this.list.length == 0){
this.showLoading = true; this.showLoading = true;
console.log("getVocabulary id: "+ this.vocabularyId + " for entity: "+ this.entityName);
if(this.vocabularyId){ if(this.vocabularyId){
// this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName); // this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName);
// this.afterListFetchedActions(); // this.afterListFetchedActions();
@ -171,14 +183,10 @@ export class StaticAutoCompleteComponent {
} }
remove(item:any){ remove(item:any){
var index:number =this.checkIfExists(item,this.selected); var index:number =this.checkIfExists(item,this.selected);
console.info("try to remove: index = "+index + " length: "+this.selected.length);
if (index > -1) { if (index > -1) {
this.selected.splice(index, 1); this.selected.splice(index, 1);
} }
console.info("after remove: length: "+this.selected.length);
if(!this.multipleSelections && this.selected.length == 0 ){ if(!this.multipleSelections && this.selected.length == 0 ){
console.info("no multiselections ");
this.showInput = true; this.showInput = true;
this.selectedValue = ""; this.selectedValue = "";
this.selectedValueChanged.emit({ this.selectedValueChanged.emit({
@ -218,7 +226,6 @@ export class StaticAutoCompleteComponent {
}); });
} }
console.log("selected"+this.selected.length );
} }
private checkIfExists(item:any,list):number{ private checkIfExists(item:any,list):number{
@ -261,11 +268,14 @@ export class StaticAutoCompleteComponent {
if(this.list == null ){ if(this.list == null ){
return; return;
} }
this.showInput = true;
for( var i = 0; i < this.list.length; i++){ for( var i = 0; i < this.list.length; i++){
if(this.list[i].id == this.selectedValue){ if(this.list[i].id == this.selectedValue){
this.selectedValue = this.list[i].label; this.selectedValue = this.list[i].label;
this.selected.push(this.list[i]); this.selected.push(this.list[i]);
this.showInput = false; this.showInput = false;
return;
} }
} }
} }

View File

@ -126,6 +126,29 @@
.dateFilter .mydp{ .dateFilter .mydp{
margin-top:5px; margin-top:5px;
} }
.filterItem span {
display: inline-flex;
}
.filterItem .filterName {
max-width: 80%;
}
.browseFilters .filterItem .filterName {
max-width: 68%;
}
.filterItem .filterNumber {
width: 20%;
}
.filterItem span {
white-space: nowrap;
}
.filterItem span div {
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>
</head> </head>

View File

@ -15,7 +15,7 @@ export const routes: string[] = [
'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations', 'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations', 'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
'deposit-publications','deposit-datasets','deposit-publications-result','deposit-datasets-result', 'deposit-publications','deposit-datasets','deposit-publications-result','deposit-datasets-result',
'search/data-providers','search/entity-registries', 'search/data-providers','search/entity-registries', 'project-report',
'claims','myclaims','linking', 'bulk-linking', 'claims','myclaims','linking', 'bulk-linking',
'test', 'test',
'error', 'login' 'error', 'login'