Linking: improve layout for selected entities, add external links | in simple search & advanced change paging links to angular router links | on simple search pages don't request refine fields if the only change is the page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46092 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-03-02 12:09:37 +00:00
parent 22f772851b
commit bce2dfa03b
31 changed files with 212 additions and 479 deletions

View File

@ -33,7 +33,7 @@ import{DOI} from '../../utils/string-utils.class';
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.doi))?'uk-block-muted':''" >
<div >
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" >{{item.title}}</a>
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" ><span class="uk-icon-external-link" ></span> {{item.title}}</a>
<span *ngIf="!item.doi" >{{item.title}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(item.doi)" (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi, null,'OPEN')"><i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>

View File

@ -23,7 +23,7 @@
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''">
<div >
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" ><span class="uk-icon-external-link" ></span> {{item.title}}</a>
<span *ngIf="!item.URL" >{{item.title}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')"><i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>
</div>
@ -91,7 +91,7 @@
</div>
<span>Results for
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
<a target="_blank" href="http://orcid.org/{{authorId}}"><span class="uk-icon-external-link" ></span> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
</span>
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">

View File

@ -120,6 +120,7 @@ export class LinkingGenericComponent {
type:string = null; // entity type (publication or dataset)
linkTo:string = null; // entity type (project or context)
entityTypes=["dataset", "publication", "project","context"];
inlineSearchResult:ClaimResult =null;
sub:any =null;
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService) {
@ -133,15 +134,27 @@ export class LinkingGenericComponent {
this.type = (this.entityTypes.indexOf(this.type) != -1)? this.type:'publication';
this.linkTo = (this.entityTypes.indexOf(this.linkTo) != -1 || this.linkTo == "result")? this.linkTo:'project';
this.show = this.linkTo;
this.linkType = (this.type == "project")?"project":this.linkTo;
this.addSelected(this.id,this.type);
this.linkType = this.linkTo;
var isInlineSearchResult:boolean = false;
if((this.type == "publication" || this.type == "dataset") && (this.linkTo == "publication" || this.linkTo == "dataset")){
isInlineSearchResult = true;
}
if(this.type == "project"){
this.linkType = "project";
this.getProjectById(this.id);
}else if(this.type == "publication"){
this.getPublicationById(this.id,isInlineSearchResult);
}else if(this.type == "dataset"){
this.getDatasetById(this.id,isInlineSearchResult);
}
}
});
}
addSelected(id:string,type:string){
if(type == "project"){
this.sub = this.entitySearch.fetchByType(id,type).subscribe(
getProjectById(id:string){
this.sub = this.entitySearch.fetchByType(id,"project").subscribe(
data => {
console.log(data);
var item =data[0];
@ -150,25 +163,35 @@ export class LinkingGenericComponent {
},
err => console.log("An error occured"));
}else if(type == "publication"){
}
getPublicationById(id:string, isInlineSearchResult:boolean){
this.sub = this.publicationsSearch.searchPublicationById(id).subscribe(
data => {
var item =data[0];
var result: ClaimResult = {id: id, type :type, source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
var result: ClaimResult = {id: id, type :"publication", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
if(isInlineSearchResult){
this.inlineSearchResult = result;
}else{
this.publications.push( result);
}
},
err => console.log("An error occured"));
}else if(type == "dataset"){
}
getDatasetById(id:string, isInlineSearchResult:boolean){
this.sub = this.datasetsSearch.searchDatasetById(id).subscribe(
data => {
var item =data[0];
console.log(item);
var result: ClaimResult = {id: id, type :type, source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
var result: ClaimResult = {id: id, type : "dataset", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
if(isInlineSearchResult){
this.inlineSearchResult = result;
}else{
this.datasets.push( result);
}
},
err => console.log("An error occured"));
}
}
next(){

View File

@ -1,209 +0,0 @@
// import {Component, Input,Output, EventEmitter} from '@angular/core';
// import {ClaimResult,ClaimProject, ClaimContext} from '../../claim-utils/claimEntities.class';
//
// @Component({
// selector: 'claim-selected',
// template: `
//
// <div [class]="(showAccessRights== 'true' )?'row':''" >
//
// <div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
// <!-- Contexts -->
// <div *ngIf=" !(inline && hideType == 'context') && contexts" class="concepts" >
// <ul class="uk-list">
// <li class="list-group-item list-group-item-success">Selected Concepts ({{(contexts.length)}})
// <span *ngIf=" !inline" title="Add More Concepts" (click)="showType('context')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li>
// <li class="list-group-item" *ngFor="let context of contexts" >
// <span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
// <span (click)="removeContext(context)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
//
// </li>
// <li *ngIf="contexts.length == 0 " class="list-group-item">There are no contexts</li>
// </ul>
// </div>
//
// </div>
// <div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
// <!-- Projects -->
// <div *ngIf=" !(inline && hideType == 'project') && projects " class="projects" >
// <ul class="uk-list">
// <li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
// <span *ngIf=" !inline " title="Add More Projects" (click)="showType('project')" aria-hidden="true" style="float:right;cursor: pointer;"> <i class="uk-icon-plus"></i></span>
// </li>
// <li class="list-group-item" *ngFor="let project of projects">
//
// <span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></span>
// <span (click)="removeProject(project)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
// </li>
// <li *ngIf="projects.length == 0 " class="list-group-item">There are no projects</li>
// </ul>
// </div>
//
// </div>
// </div>
// <!-- Results -->
//
// <div *ngIf=" !(inline && (hideType == 'publication' || hideType == 'dataset' )) && (datasets || publications)" class="publications" >
// <ul class="uk-list">
// <li class="list-group-item panel-footer "> Research Results ({{(datasets.length+publications.length)}})
// <span *ngIf=" !inline && linkToResults " title="Add More Research Results" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li>
// <li *ngIf="publications && datasets && publications.length == 0 && datasets.length == 0" class="list-group-item">There are no Research Results </li>
// <li *ngIf="(publications && publications.length > 0) ||(datasets && datasets.length > 0 ) " class="list-group-item list-group-item-warning ">{{publications. length }} Selected Publications:
// <span *ngIf=" !inline && linkToResults " title="Add More Publications" (click)="showType('publication')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li>
// <li *ngFor="let pub of publications" class="list-group-item">
// <span *ngIf="showAccessRights == 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
// <span >
// <a *ngIf="pub.url" target="_blank" href="{{pub.url}}" >{{pub.title}}</a>
// <span *ngIf="!pub.url" >{{pub.title}}</span><span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
// </span>
// <span *ngIf="showAccessRights== 'true' && pub.source != 'openaire' " class="dropdown">
// <button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+pub.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
// {{pub.accessRights}}
// </button>
// <ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+pub.id">
// <li *ngFor="let type of accessTypes" ><a (click)="pub.accessRights = type " >{{type}} </a></li>
// </ul>
// <input *ngIf="pub.accessRights== 'EMBARGO'" type="date" id="{{'date'+pub.id}}" name="" [min]="todayDate" (keyup)="dateChanged($event, pub)" [value]="pub.embargoEndDate">
// </span>
// <span *ngIf="showAccessRights== 'true' && pub.source == 'openaire' " >
// <button class="uk-button disabled " type="button" >
// {{pub.accessRights}}
// </button>
// </span>
// <span *ngIf="showAccessRights != 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
// </li>
// <li *ngIf="publications.length > 0 || datasets.length > 0" class="list-group-item list-group-item-warning "> {{datasets.length}} Selected Research Data:
// <span *ngIf=" !inline && linkToResults " title="Add More Research Data" (click)="showType('dataset')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li>
// <li *ngFor="let dataset of datasets" class="list-group-item">
// <span *ngIf="showAccessRights == 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
// <span >
// <a *ngIf="dataset.url" target="_blank" href="{{dataset.url}}" >{{dataset.title}}</a>
// <span *ngIf="!dataset.url" >{{dataset.title}}</span>
// <span *ngIf="dataset.date" >({{dataset.date.substring(0,4)}})</span>
// </span>
// <span *ngIf="showAccessRights== 'true' && dataset.source != 'openaire'" class="dropdown">
// <button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+dataset.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
// {{dataset.accessRights}}
// </button>
// <ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+dataset.id">
// <li *ngFor="let type of accessTypes" ><a (click)="dataset.accessRights = type " >{{type}} </a></li>
// </ul>
// <input *ngIf="dataset.accessRights== 'EMBARGO'" type="date" id="{{'date'+dataset.id}}" name="" [min]="todayDate" (keyup)="dateChanged($event,dataset)" [value]="dataset.embargoEndDate">
// </span>
// <span *ngIf="showAccessRights== 'true' && dataset.source == 'openaire' " >
// <button class="uk-button disabled " type="button" >
// {{dataset.accessRights}}
// </button>
// </span>
// <span *ngIf="showAccessRights != 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
// </li>
//
// </ul>
// </div>
// <!-- Bulk Mode Results (publicationsChange)="publicationsChanged($event)" -->
// <div *ngIf="bulkMode">
// <bulk-claim *ngIf=" bulkMode " [(publications)]="publications" (publicationsChange)="publicationsChanged($event)" > </bulk-claim>
// </div>
// `
//
//
// })
// export class ClaimSelectedComponent {
// ngOnInit() {
// console.info("Show accessRights selection? :"+this.showAccessRights);
// var myDate = new Date();
// this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
// this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
// //2015-05-01
// }
//
//
// @Input() contexts: ClaimContext[];
// @Input() projects: ClaimProject[];
// @Input() publications: ClaimResult[];
// @Input() datasets: ClaimResult[];
// @Input() showAccessRights:boolean = false;
// @Input() show='home';
// @Input() inline:boolean = false;
// @Input() hideType;
// @Input() bulkMode:boolean = false;
// @Input() linkToResults:boolean = true;
// @Output() projectsChange = new EventEmitter();
// @Output()publicationsChange = new EventEmitter();
// @Output() datasetsChange = new EventEmitter();
// @Output() contextsChange = new EventEmitter();
//
// @Output() showChange = new EventEmitter();
//
// todayDate = '';
// nextDate = '';
// removeContext(item:any){
// var index:number =this.contexts.indexOf(item);
// if (index > -1) {
// this.contexts.splice(index, 1);
// }
// this.contextsChange.emit({
// value: this.contexts
// });
// }
// removePublication(item:any){
// var index:number =this.publications.indexOf(item);
// if (index > -1) {
// this.publications.splice(index, 1);
// }
// this.publicationsChange.emit({
// value: this.publications
// });
// }
// removeDataset(item:any){
// var index:number =this.datasets.indexOf(item);
// if (index > -1) {
// this.datasets.splice(index, 1);
// }
// this.datasetsChange.emit({
// value: this.datasets
// });
// }
// removeProject(item:any){
// var index:number =this.projects.indexOf(item);
// if (index > -1) {
// this.projects.splice(index, 1);
// }
// this.projectsChange.emit({
// value: this.projects
// });
// }
// showType(type){
// if(type != this.show){
// this.show = type;
// this.showChange.emit({
// value: this.show
// });
// }
// }
// accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
//
// dateChanged (event:any, item:any) {
// item.embargoEndDate = event.target.value ;
// }
// publicationsChanged($event) {
// this.publications=$event.value;
// this.publicationsChange.emit({
// value: this.publications
// });
// }
// }
//
//
//
// // @Component({
// // selector: 'add-more',
// // template: ``
// // })
// // export class Addmore {
// // @Input() type = 'publication';
// // }

View File

@ -11,10 +11,10 @@ import {ClaimContext} from '../../claim-utils/claimEntities.class';
<!--span *ngIf=" !inline" title="Add More Concepts" (click)="showType('context')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span-->
</h3>
<div class="uk-accordion-content" >
<ul class="uk-list">
<ul class="uk-list uk-list-line">
<li class="list-group-item" *ngFor="let context of contexts" >
<span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
<span (click)="removeContext(context)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
<span (click)="removeContext(context)" aria-hidden="true" class="uk-button "><i class="uk-icon-remove"></i></span>
</li>
</ul>

View File

@ -9,20 +9,16 @@ import {ClaimResult} from '../../claim-utils/claimEntities.class';
<h3 class="uk-accordion-title" > <i class="uk-icon-caret-square-o-right"></i> Research Data ({{(datasets.length)}}) </h3>
<div class="uk-accordion-content" >
<!--li *ngIf="publications.length > 0 || datasets.length > 0" class="list-group-item list-group-item-warning "> {{datasets.length}} Selected Research Data:
<span *ngIf=" !inline && linkToResults " title="Add More Research Data" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
</li-->
<span *ngIf="datasets.length == 0 " class="uk-alert uk-alert-primary">There are no selected research data</span>
<ul *ngIf="datasets.length > 0 " class="uk-list">
<li *ngFor="let dataset of datasets" class="list-group-item">
<div class="row">
<ul *ngIf="datasets.length > 0 " class="uk-list uk-list-line">
<li *ngFor="let dataset of datasets" >
<div class="uk-grid">
<div [ngClass]="showAccessRights?'col-md-8':'col-md-12'">
<div [ngClass]="showAccessRights?'uk-width-7-10':'uk-width-1-1'">
<div>
<span *ngIf="showAccessRights" (click)="removeDataset(dataset)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
<a *ngIf="dataset.url" target="_blank" href="{{dataset.url}}" >{{dataset.title}}</a>
<span *ngIf="showAccessRights" (click)="removeDataset(dataset)" aria-hidden="true" class="uk-button "><i class="uk-icon-remove"></i></span>
<a *ngIf="dataset.url" target="_blank" href="{{dataset.url}}" ><span class="uk-icon-external-link" ></span> {{dataset.title}}</a>
<span *ngIf="!dataset.url" >{{dataset.title}}</span>
<span *ngIf="!showAccessRights" (click)="removeDataset(dataset)" aria-hidden="true" class="uk-button"><i class="uk-icon-remove"></i></span>
</div>
@ -31,15 +27,20 @@ import {ClaimResult} from '../../claim-utils/claimEntities.class';
<div *ngIf="dataset.result.creator" class="uk-article-meta">Authors: <span *ngFor="let author of dataset.result.creator let i = index">{{author}}{{(i < (dataset.result.creator.length-1))?"; ":""}}</span></div>
</div>
<div class = "col-md-4">
<div *ngIf="showAccessRights" class = "uk-width-3-10">
<span *ngIf="showAccessRights && dataset.source != 'openaire'" class="dropdown">
<button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+dataset.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<select [(ngModel)]="dataset.accessRights" name="{{'select_rights_'+dataset.id}}" >
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,dataset)">{{type}}</option>
</select>
<input *ngIf="dataset.accessRights== 'EMBARGO'" class="uk-form-width-small" id="{{'date'+dataset.id}}" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}">
<!--button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+dataset.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{dataset.accessRights}}
</button>
<ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+dataset.id">
<li *ngFor="let type of accessTypes" ><a (click)="accessRightsTypeChanged(type,dataset) " >{{type}} </a></li>
</ul>
<input *ngIf="dataset.accessRights== 'EMBARGO'" type="date" id="{{'date'+dataset.id}}" name="" [min]="todayDate" (keyup)="dateChanged($event,dataset)" [value]="dataset.embargoEndDate">
<input *ngIf="dataset.accessRights== 'EMBARGO'" type="date" id="{{'date'+dataset.id}}" name="" [min]="todayDate" (keyup)="dateChanged($event,dataset)" [value]="dataset.embargoEndDate"-->
</span>
<span *ngIf="showAccessRights && dataset.source == 'openaire' " >
<button class="uk-button disabled " type="button" >
@ -128,11 +129,13 @@ export class ClaimSelectedDatasetsComponent {
}
confirmClose(data){
for (var i = 0; i < this.datasets.length; i++) {
if(this.datasets[i].source != 'openaire' ){
this.datasets[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.datasets[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}
}

View File

@ -1,5 +1,6 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimProject} from '../../claim-utils/claimEntities.class';
import {RouterHelper} from '../../../utils/routerHelper.class';
@Component({
selector: 'claim-selected-projects',
@ -15,10 +16,10 @@ import {ClaimProject} from '../../claim-utils/claimEntities.class';
<span *ngIf=" !inline " title="Add More Projects" (click)="showType('project')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
</li-->
<div class="uk-accordion-content">
<ul class="uk-list">
<ul class="uk-list uk-list-line">
<li class="list-group-item" *ngFor="let project of projects">
<span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></span>
<span (click)="removeProject(project)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)" routerLinkActive="router-link-active" routerLink="/search/project" >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></a>
<span (click)="removeProject(project)" aria-hidden="true" class="uk-button "><i class="uk-icon-remove"></i></span>
</li>
</ul>
<span *ngIf="projects.length == 0 " class="uk-alert uk-alert-primary">There are no projects</span>
@ -50,6 +51,7 @@ ngOnInit() {
todayDate = '';
nextDate = '';
public routerHelper:RouterHelper = new RouterHelper();
removeProject(item:any){
var index:number =this.projects.indexOf(item);

View File

@ -1,10 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedProjectsComponent} from './selectedProjects.component';
@NgModule({
imports: [
SharedModule
SharedModule, RouterModule
],
declarations: [
ClaimSelectedProjectsComponent

View File

@ -17,7 +17,7 @@ import {ClaimResult} from '../../claim-utils/claimEntities.class';
<div [ngClass]="showAccessRights?'uk-width-7-10':'uk-width-1-1'" >
<div>
<span *ngIf="showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-button"><i class="uk-icon-remove"></i></span>
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" >{{pub.title}}</a>
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" ><span class="uk-icon-external-link" ></span> {{pub.title}}</a>
<span *ngIf="!pub.url" >{{pub.title}}</span>
<span *ngIf="!showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-button "><i class="uk-icon-remove"></i></span>
</div>
@ -137,10 +137,12 @@ public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when
}
confirmClose(data){
for (var i = 0; i < this.publications.length; i++) {
if(this.publications[i].source != 'openaire' ){
this.publications[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.publications[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}
}

View File

@ -1,91 +0,0 @@
// import {Component, Input,Output, EventEmitter} from '@angular/core';
// import {ClaimResult} from '../../claim-utils/claimEntities.class';
//
// @Component({
// selector: 'claim-selected-results',
// template: `
//
//
// <!-- Results -->
// <div class =" ">
// <div *ngIf=" !(inline && hideType == 'publication' ) " class="uk-accordion uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 " data-uk-accordion="{showfirst:false}" >
// <h3 class="uk-accordion-title" > Publications ({{(publications.length)}}) </h3>
// <div class="uk-accordion-content" >
// <!--ul class="uk-list">
// <li class="list-group-item panel-footer "> Research Results ({{(datasets.length+publications.length)}})
// <span *ngIf=" !inline && linkToResults " title="Add More Research Results" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li>
// <li *ngIf="publications && datasets && publications.length == 0 && datasets.length == 0" class="list-group-item">There are no Research Results </li>
// <li *ngIf="(publications && publications.length > 0) ||(datasets && datasets.length > 0 ) " class="list-group-item list-group-item-warning ">{{publications. length }} Selected Publications:
// <span *ngIf=" !inline && linkToResults " title="Add More Publications" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li-->
//
//
// <span *ngIf="publications.length == 0 " class="uk-alert uk-alert-primary">There are no selected publications</span>
//
// <claim-selected-publications *ngIf="publications.length > 0 " [publications]="publications" [showAccessRights]="showAccessRights"
// [linkToResults]="(bulkMode)?false:true" >
// </claim-selected-publications>
// </div>
// </div>
//
// <div *ngIf=" !(inline && ( hideType == 'dataset' ))" class="uk-accordion uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2" data-uk-accordion="{showfirst:false}" >
// <h3 class="uk-accordion-title" > Research Data ({{(datasets.length)}}) </h3>
// <div class="uk-accordion-content" >
//
// <!--li *ngIf="publications.length > 0 || datasets.length > 0" class="list-group-item list-group-item-warning "> {{datasets.length}} Selected Research Data:
// <span *ngIf=" !inline && linkToResults " title="Add More Research Data" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
// </li-->
//
// <span *ngIf="datasets.length == 0 " class="uk-alert uk-alert-primary">There are no selected research data</span>
// <claim-selected-datasets *ngIf="datasets.length > 0 " [datasets]="datasets" [showAccessRights]="showAccessRights"
// [linkToResults]="(bulkMode)?false:true" >
// </claim-selected-datasets>
// </div>
// </div>
//
//
// `
//
// })
// export class ClaimSelectedResultsComponent {
// ngOnInit() {
// var myDate = new Date();
// this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
// this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
// //2015-05-01
// }
//
//
//
// @Input() publications:ClaimResult[];
// @Input() datasets:ClaimResult[];
// @Input() showAccessRights:boolean = false;
// @Input() show='home';
// @Input() inline:boolean = false;
// @Input() hideType;
// @Input() bulkMode:boolean = false;
// @Input() linkToResults:boolean = true;
// @Output() showChange = new EventEmitter();
//
// todayDate = '';
// nextDate = '';
// showType(type){
// if(type != this.show){
// this.show = type;
// this.showChange.emit({
// value: this.show
// });
// }
// }
// showChanged($event) {
// this.show=$event.value;
//
// this.showChange.emit({
// value: this.show
// });
//
// }
//
//
// }

View File

@ -54,7 +54,7 @@
<blockquote *ngIf="publicationInfo.description != ''">
<div class="uk-text-justify">{{publicationInfo.description}}</div>
</blockquote>
<a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[articleId,'publication','publication'])" routerLinkActive="router-link-active" routerLink="/linking" > <i class="uk-icon-link"></i> Links to research Results</a>
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
<li class="uk-active">
<a href="#citationsTab">

View File

@ -54,6 +54,7 @@ export class AdvancedSearchDataProvidersComponent {
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);

View File

@ -59,6 +59,7 @@ export class AdvancedSearchDatasetsComponent {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);

View File

@ -57,6 +57,7 @@ public resourcesQuery = "(oaftype exact organization)";
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);

View File

@ -58,6 +58,7 @@ export class AdvancedSearchPeopleComponent {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);

View File

@ -57,6 +57,7 @@ export class AdvancedSearchProjectsComponent {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);

View File

@ -57,6 +57,7 @@ export class AdvancedSearchPublicationsComponent {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;

View File

@ -38,7 +38,7 @@ import {StringUtils} from '../../utils/string-utils.class';
(queryChange)="queryChanged($event)">
</advanced-search-form>
<!--div class="uk-text-right" *ngIf="results && results.length>= size"-->
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" ></search-paging>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
<!--/div-->
@ -71,6 +71,9 @@ export class AdvancedSearchPageComponent {
@Input() csvParams: string;
@Input() csvPath: string;
public parameterNames:string[] =[];
public parameterValues:string[] =[];
public urlParam: string;
public baseURLWithParameters:string = '';
@ -79,6 +82,8 @@ export class AdvancedSearchPageComponent {
}
ngOnInit() {
console.log("ASP init!");
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
this.updateBaseUrlWithParameters();
this.defineUrlParam();
// this.searchUtils.totalResults = this.results.length;
@ -101,6 +106,7 @@ export class AdvancedSearchPageComponent {
}
public getSelectedFiltersFromUrl(params){
// this.selectedFields =[];
for(var i=0; i< this.fieldIds.length ; i++){
var fieldId = this.fieldIds[i];
@ -127,8 +133,10 @@ export class AdvancedSearchPageComponent {
}
private createUrlParameters(includePage:boolean){
var params="";
this.parameterNames.splice(0,this.parameterNames.length);
this.parameterValues.splice(0,this.parameterValues.length);
var fields: { [key:string]:{ values:string[], operators:string[] }}={};
console.log("In createUrlParameters :"+ this.selectedFields.length);
for(var i = 0; i< this.selectedFields.length; i++){
if(this.fieldIdsMap[this.selectedFields[i].id] != undefined && this.selectedFields[i].value.length > 0){
if(!fields[this.selectedFields[i].id]){
@ -146,11 +154,16 @@ export class AdvancedSearchPageComponent {
params+="&"+this.fieldIdsMap[this.fieldIds[i]].param+"="+fields[this.fieldIds[i]].values.join()+
"&"+this.getOperatorParameter(this.fieldIdsMap[this.fieldIds[i]].param)+"="+fields[this.fieldIds[i]].operators.join()
this.parameterNames.push(this.fieldIdsMap[this.fieldIds[i]].param);
this.parameterValues.push(fields[this.fieldIds[i]].values.join());
this.parameterNames.push(this.getOperatorParameter(this.fieldIdsMap[this.fieldIds[i]].param));
this.parameterValues.push(fields[this.fieldIds[i]].operators.join());
}
}
if(includePage && this.searchUtils.page != 1){
params += "&page="+this.searchUtils.page;
}
console.log("In end of createUrlParameters :"+ this.selectedFields.length);
return '?'+params;
}
public createQueryParameters(){

View File

@ -39,7 +39,7 @@ import {ModalLoading} from '../../utils/modal/loading.component';
</div>
<div class="uk-width-large-3-4 uk-width-medium-3-4 uk-width-small-1-1" >
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters"></search-paging>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results"
[totalResults]="searchUtils.totalResults"
@ -54,7 +54,7 @@ import {ModalLoading} from '../../utils/modal/loading.component';
<div *ngIf="!showRefine" >
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters"></search-paging>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results"
[totalResults]="searchUtils.totalResults"
@ -93,6 +93,8 @@ export class SearchPageComponent {
private sub: any;
public countFilters= 0;
public urlParam: string;
public parameterNames:string[] =[];
public parameterValues:string[] =[];
constructor (private location: Location ) {
}
@ -233,9 +235,7 @@ export class SearchPageComponent {
filter.countSelectedValues = 0;
if(this.queryParameters[filter.filterId] != undefined) {
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
console.log("Values"+values +" -- "+values.length);
for(let filterValue of filter.values) {
console.log("Filter id"+StringUtils.quote(filterValue.id));
if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
filterValue.selected = true;
filter.countSelectedValues++;
@ -264,6 +264,9 @@ export class SearchPageComponent {
*/
private createUrlParameters(filters:Filter[], includePage:boolean){
var allLimits="";//location.search.slice(1);
this.parameterNames.splice(0,this.parameterNames.length);
this.parameterValues.splice(0,this.parameterValues.length);
for (let filter of filters){
var filterLimits="";
if(filter.countSelectedValues > 0){
@ -273,15 +276,22 @@ export class SearchPageComponent {
}
}
this.queryParameters[filter.filterId]=filterLimits;
if(filterLimits.length > 0){
this.parameterNames.push(filter.filterId);
this.parameterValues.push(filterLimits);
}
allLimits+=(allLimits.length==0?"?":"&")+((filterLimits.length == 0 )?'':filter.filterId + '='+ filterLimits) ;
}
}
if(this.searchUtils.keyword.length > 0 ){
allLimits+=(allLimits.length==0?"?":"&")+'keyword=' + this.searchUtils.keyword;
this.parameterNames.push("keyword");
this.parameterValues.push(this.searchUtils.keyword);
}
if(this.searchUtils.page != 1 && includePage){
allLimits+=((allLimits.length == 0)?'?':'&') + 'page=' + this.searchUtils.page;
}
return allLimits;
}
/*
@ -405,13 +415,13 @@ export class SearchPageComponent {
}
goTo(page:number = 1){
this.searchUtils.page = page;
// console.info("searchUtils.page goto = "+this.searchUtils.page);
console.info("searchUtils.page goto = "+this.searchUtils.page);
this.queryParameters = new Map<string,string>();
var urlParameters = this.createUrlParameters(this.filters,true);
// console.info("urlParams : "+urlParameters);
console.info("urlParams : "+urlParameters);
this.updateBaseUrlWithParameters(this.filters);
var queryParameters = this.createSearchQueryParameters(this.filters);
// console.info("queryParams : "+queryParameters);
console.info("queryParams : "+queryParameters);
var indexQuery = this.createIndexQueryParameters(this.filters);
this.location.go(location.pathname,urlParameters);

View File

@ -6,7 +6,7 @@ import {Observable} from 'rxjs/Observable';
template: `
<div class= "searchPaging uk-panel uk-margin-top">
<div class="uk-float-right" *ngIf="results && searchUtils.totalResults > searchUtils.size">
<paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size"> </paging>
<paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" > </paging>
</div>
<div class="" *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages())}}
@ -20,6 +20,8 @@ export class SearchPagingComponent {
@Input() results;
@Input() baseUrl;
@Input() type;
@Input() parameterNames:string[];
@Input() parameterValues:string[];
// @Input() totalResults:number = 0;
constructor () {

View File

@ -3,29 +3,23 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchResult} from '../../utils/entities/searchResult';
// import {SearchPagingComponent} from './searchPaging.component';
// import {SearchDownloadComponent} from './searchDownload.component';
import {SearchResultComponent} from './searchResult.component';
// import{PagingModule} from '../../utils/paging.module';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule
// ,PagingModule
],
declarations: [
SearchResultComponent,
// SearchPagingComponent,
// SearchDownloadComponent,
],
providers:[
],
exports: [
// SearchPagingComponent,
// SearchDownloadComponent,
SearchResultComponent
]

View File

@ -45,19 +45,27 @@ export class SearchDataprovidersComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
}
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -230,7 +238,9 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this.searchUtils.totalResults = data[0];
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);

View File

@ -45,6 +45,7 @@ export class SearchDatasetsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
}
@ -52,14 +53,18 @@ export class SearchDatasetsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
// this.getRefineResults();
//this.getResults(this.searchUtils.keyword, this.searchUtils.page, this.searchUtils.size, "searchPage");
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -177,7 +182,9 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchUtils.totalResults = data[0];
console.info("search Datasets: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -43,6 +43,7 @@ export class SearchOrganizationsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
}
@ -50,13 +51,19 @@ export class SearchOrganizationsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -92,7 +99,9 @@ export class SearchOrganizationsComponent {
this.searchUtils.totalResults = data[0];
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -55,62 +55,9 @@ export class SearchPeopleComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
for(var i=0; i<5 ; i++){
var values = [];
for(var j=0; j<10 ; j++){
var value:Value = {name: "name"+j, id: "filter_"+i+ "_id_"+j, number:j, selected:false}
values.push(value);
}
values.sort((n2,n1) => {
if (n1.number > n2.number) {
return 1;
}
if (n1.number < n2.number) {
return -1;
}
this.getResults(this.searchUtils.keyword, false, this.searchUtils.page, this.searchUtils.size);
return 0;
});
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, originalFilterId: "filter_"+i, values : values, countSelectedValues:0, "filterOperator": 'and'}
if(i==0) {
var values = [];
for(var j=0; j<10 ; j++){
var value:Value = {name: "MYname"+j, id: "MYfilter_"+i+ "_id_"+j, number:j, selected:false}
values.push(value);
}
values.sort((n2,n1) => {
if (n1.number > n2.number) {
return 1;
}
if (n1.number < n2.number) {
return -1;
}
return 0;
});
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
this.filters.push(filter1);
this.getResults(this.searchUtils.keyword, true, this.searchUtils.page, this.searchUtils.size);
}
console.info(params);
if(params[filter.filterId] != undefined) {
let values = params[filter.filterId].split(",");
for(let value of values) {
for(let filterValue of filter.values) {
if(filterValue.id == value) {
filterValue.selected = true;
filter.countSelectedValues++;
}
}
}
}
}
});
}
@ -118,34 +65,6 @@ export class SearchPeopleComponent {
public ngOnDestroy() {
this.sub.unsubscribe();
}
/*
public getResults(parameters:string, page: number, searchUtils.size: number){
console.info("getResults: Execute search query "+parameters);
this._searchPeopleService.searchPeople(parameters, page, searchUtils.size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search People total="+this.searchUtils.totalResults);
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.log(err);
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
*/
public getResults(keyword:string,refine:boolean, page: number, size: number){
var parameters = "";

View File

@ -43,6 +43,7 @@ export class SearchProjectsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
}
@ -52,17 +53,22 @@ export class SearchProjectsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
console.info(" ngOnInit SearchProjectsComponent "+this.refineFields.length);
//get refine field filters from url parameters
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
//get keyword from url parameters
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
//get page from url parameters
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -98,7 +104,9 @@ export class SearchProjectsComponent {
this.searchUtils.totalResults = data[0];
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);

View File

@ -54,6 +54,7 @@ export class SearchPublicationsComponent {
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
}
@ -62,13 +63,20 @@ export class SearchPublicationsComponent {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = "publication";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -209,7 +217,9 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchUtils.totalResults = data[0];
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -25,4 +25,6 @@ export class SearchResult {
OAIPMHURL: string;
compatibility: string;
countries: string[];
constructor(){}
}

View File

@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {pagingFormatterNoLoad} from './pagingFormatterNoLoad.component';
@ -9,7 +10,7 @@ import {PagingFormatter} from './pagingFormatter.component';
@NgModule({
imports: [
CommonModule, FormsModule
CommonModule, FormsModule, RouterModule
],
declarations: [
pagingFormatterNoLoad,

View File

@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core';
import {Router} from '@angular/router';
import {DomSanitizer} from '@angular/platform-browser';
//Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="Search" [term]="keyword"> </paging>
import {RouterHelper} from './routerHelper.class';
@Component({
selector: 'paging',
@ -10,21 +11,21 @@ import {DomSanitizer} from '@angular/platform-browser';
<ul *ngIf=" ( getTotalPages() > 0 ) && (getTotalPages() > 1) && ( 0 < currentPage && currentPage <= getTotalPages() ) " class="uk-pagination">
<li *ngIf=" currentPage > 1" ><a [href]="onPage((1))" aria-label="Previous">
<li *ngIf=" currentPage > 1" ><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',1)" routerLinkActive="router-link-active" [routerLink]=baseUrl aria-label="Previous">
<span><i class="uk-icon-angle-double-left"></i></span></a></li>
<li *ngIf=" currentPage > 1" ><a [href]="onPage((currentPage -1))" aria-label="Previous">
<li *ngIf=" currentPage > 1" ><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage - 1))" routerLinkActive="router-link-active" [routerLink]=baseUrl aria-label="Previous">
<span><i class="uk-icon-angle-left"></i></span></a></li>
<!--<li *ngIf=" currentPage > 1"><a [href]="onPage((currentPage -1))">\<</a></li>-->
<li *ngIf=" currentPage -2 > 0"><a [href]="onPage((currentPage -2))">{{currentPage -2}}</a></li>
<li *ngIf=" currentPage -1 > 0 "><a [href]="onPage((currentPage -1))">{{currentPage -1}}</a></li>
<li *ngIf=" currentPage -2 > 0"><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage - 2))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{currentPage -2}}</a></li>
<li *ngIf=" currentPage -1 > 0 "><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage - 1))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{currentPage -1}}</a></li>
<li class="uk-active"><span >{{currentPage}}</span></li>
<li *ngIf=" currentPage +1 <= getTotalPages() "><a [href]="onPage((currentPage +1))">{{currentPage +1}}</a></li>
<li *ngIf=" currentPage +2 <= getTotalPages() "><a [href]="onPage((currentPage +2))">{{currentPage +2}}</a></li>
<li *ngIf=" (currentPage -2 <= 0)&&(currentPage +3 <= getTotalPages()) "><a [href]="onPage((currentPage +3))">{{currentPage +3}}</a></li>
<li *ngIf=" (currentPage -1 <= 0)&&(currentPage +4 <= getTotalPages()) "><a [href]="onPage((currentPage +4))">{{currentPage +4}}</a></li>
<li *ngIf=" currentPage +1 <= getTotalPages() "><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage +1))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{currentPage +1}}</a></li>
<li *ngIf=" currentPage +2 <= getTotalPages() "><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage +2))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{currentPage +2}}</a></li>
<li *ngIf=" (currentPage -2 <= 0)&&(currentPage +3 <= getTotalPages()) "><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage +3))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{currentPage +3}}</a></li>
<li *ngIf=" (currentPage -1 <= 0)&&(currentPage +4 <= getTotalPages()) "><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage +4))" routerLinkActive="router-link-active" [routerLink]=baseUrl >{{currentPage +4}}</a></li>
<li *ngIf="getTotalPages() > currentPage"><a [href]="onPage((currentPage +1))" aria-label="Next">
<li *ngIf="getTotalPages() > currentPage"><a [queryParams]="routerHelper.createQueryParamsPaging(parameterNames,parameterValues,'page',(currentPage + 1))" routerLinkActive="router-link-active" [routerLink]=baseUrl aria-label="Next">
<i class="uk-icon-angle-right"></i>
</a></li>
@ -38,6 +39,10 @@ export class PagingFormatter {
@Input() size: number=10;
@Input() totalResults: number = 10;
@Input() baseUrl:string="";
@Input() parameterNames:string[];
@Input() parameterValues:string[];
public routerHelper:RouterHelper = new RouterHelper();
constructor ( private _router: Router, private sanitizer:DomSanitizer) {
}
@ -50,8 +55,8 @@ export class PagingFormatter {
return (((this.totalResults/this.size) == i )? i :(i+1)) ;
}
onPage(pageNum: number){
return this.sanitizer.bypassSecurityTrustUrl( this.baseUrl+((this.baseUrl.indexOf("?") > -1 )?'&':'?')+ "page=" + (pageNum));
}
// onPage(pageNum: number){
// return this.sanitizer.bypassSecurityTrustUrl( this.baseUrl+((this.baseUrl.indexOf("?") > -1 )?'&':'?')+ "page=" + (pageNum));
//
// }
}

View File

@ -9,6 +9,12 @@ export class RouterHelper {
obj[key]=value;
return obj;
}
public createQueryParamsPaging(keys:string[],values:string[],key:string,value:number){
var obj = this.createQueryParams(keys, values);
obj[key] = ""+value;
return obj;
}
public createQueryParams(keys:string[],values:string[]){
var obj ={};