Remove person landing - links to landing pages of people - search pages for people | Linking: minor layout changes - add apply all functionality for result type change in dropdown

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47593 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-06-20 09:57:28 +00:00
parent 7b851aa569
commit 53b488f00a
43 changed files with 141 additions and 1128 deletions

View File

@ -9,10 +9,7 @@ export function getDatasetModule() {
return System.import('./landingPages/dataset/dataset.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DatasetModuleNgFactory' : 'DatasetModule')]);
}
export function getPersonModule() {
return System.import('./landingPages/person/person.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'PersonModuleNgFactory' : 'PersonModule')]);
}
export function getProjectModule() {
return System.import('./landingPages/project/project.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ProjectModuleNgFactory' : 'ProjectModule')]);
@ -69,10 +66,7 @@ export function getSearchDataProvidersModule() {
return System.import('./searchPages/simple/searchDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchDataProvidersModuleNgFactory' : 'SearchDataProvidersModule')]);
}
export function getSearchPeopleModule() {
return System.import('./searchPages/simple/searchPeople.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchPeopleModuleNgFactory' : 'SearchPeopleModule')]);
}
export function getCompatibleDataProvidersModule() {
return System.import('./searchPages/dataProviders/compatibleDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'CompatibleDataProvidersModuleNgFactory' : 'CompatibleDataProvidersModule')]);
@ -109,10 +103,7 @@ export function getAdvancedSearchProjectsModule() {
return System.import('./searchPages/advanced/advancedSearchProjects.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchProjectsModuleNgFactory' : 'AdvancedSearchProjectsModule')]);
}
export function getAdvancedSearchPeopleModule() {
return System.import('./searchPages/advanced/advancedSearchPeople.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchPeopleModuleNgFactory' : 'AdvancedSearchPeopleModule')]);
}
export function gethtmlProjectReportModule() {
return System.import('./landingPages/htmlProjectReport/htmlProjectReport.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'HtmlProjectReportModuleNgFactory' : 'HtmlProjectReportModule')]);
@ -151,7 +142,6 @@ export function getUserModule() {
{ path: '', redirectTo: '/search/find', pathMatch: 'full'},
{ path: 'search/publication', loadChildren: getPublicationModule },
{ path: 'search/dataset', loadChildren: getDatasetModule },
{ path: 'search/person', loadChildren: getPersonModule },
{ path: 'search/organization', loadChildren: getOrganizationModule },
{ path: 'search/project', loadChildren: getProjectModule },
{ path: 'search/dataprovider', loadChildren: getDataProviderModule },
@ -166,7 +156,6 @@ export function getUserModule() {
{ path: 'search/find/projects', loadChildren: getSearchProjectsModule },
{ path: 'search/find/dataproviders', loadChildren: getSearchDataProvidersModule },
{ path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule },
{ path: 'search/find/people', loadChildren: getSearchPeopleModule },
{ path: 'search/content-providers', loadChildren: getCompatibleDataProvidersModule },
{ path: 'search/content-providers-table', loadChildren: getCompatibleDataProvidersTableModule },
{ path: 'search/entity-registries', loadChildren: getEntityRegistriesModule },
@ -176,7 +165,6 @@ export function getUserModule() {
{ path: 'search/advanced/organizations', loadChildren: getAdvancedSearchOrganizationsModule },
{ path: 'search/advanced/dataproviders', loadChildren: getAdvancedSearchDataProvidersModule },
{ path: 'search/advanced/projects', loadChildren: getAdvancedSearchProjectsModule },
{ path: 'search/advanced/people', loadChildren: getAdvancedSearchPeopleModule },
{ path: 'project-report', loadChildren: gethtmlProjectReportModule },
{ path: 'myclaims', loadChildren: getMyClaimsModule },
{ path: 'claims', loadChildren: getClaimsAdminModule },

View File

@ -1,10 +1,15 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {ClaimResult} from '../claim-utils/claimEntities.class';
import {AlertModal} from '../../utils/modal/alert';
@Component({
selector: 'start-over',
template: `<button (click)="startOver()" class="uk-button uk-button-danger uk-align-right" > <span uk-icon="icon: refresh"></span> Clear All</button>`,
template: `
<button (click)="confirmOpen()" class="uk-button uk-button-danger uk-align-left" > <span uk-icon="icon: refresh"></span> Clear All</button>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`,
})
export class StartOverComponent {
@ -24,9 +29,21 @@ export class StartOverComponent {
@Input() public projects;
@Input() public contexts;
@ViewChild(AlertModal) alertApplyAll;
confirmOpen(type: boolean, message: string){
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Remove selected";
this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
this.startOver();
}
startOver(){
console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length );
if(this.type != null && this.linkTo != null){
console.log("inline");
if(this.linkTo == "project"){

View File

@ -2,10 +2,11 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {StartOverComponent} from './startOver.component';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
@NgModule({
imports: [
SharedModule, CommonModule
SharedModule, CommonModule, AlertModalModule
],
declarations: [
StartOverComponent

View File

@ -15,26 +15,27 @@ declare var UIkit:any;
<div class="page-header">
<h1>Linking</h1>
</div>
<div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> What is linking about? </a>
</div>
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a>
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Linking Functioanlity:</div>
<p>TODO: Put some useful information here... </p>
</div>
<ul class="uk-breadcrumb">
<li [class]="(show=='project')?'uk-active':''" ><a (click)="show='project';"> Select Projects <span >({{projects.length}})</span></a></li>
<li [class]="(show=='context')?'uk-active':''" ><a (click)="show='context';"> Select Communities <span >({{contexts.length}})</span></a></li>
<li [class]="(show=='result')?'uk-active':''" ><a (click)="show='result';"> Select Research Results <span >({{results.length}})</span></a></li>
<li [class]="(show=='claim')?'uk-active':''" (click)="canProceedToMetadata();"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" > Complete metadata</a></li>
<li [class]="(show=='claim')?'uk-active':''" (click)="canProceedToMetadata();"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" > Review metadata</a></li>
</ul>
<start-over [results]="results" [contexts]="contexts" [projects]="projects" ></start-over>
<div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> What is linking about? </a>
</div>
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a>
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Linking Functioanlity:</div>
<p>TODO: Put some useful information here... </p>
</div>
<!--ul class="uk-pagination uk-margin-remove-bottom">
<li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
@ -84,7 +85,7 @@ declare var UIkit:any;
<ul class="uk-pagination">
<!--li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li-->
<li *ngIf="show != 'claim' " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
<li *ngIf="show != 'claim' && this.results.length > 0 " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
<li *ngIf="show == 'claim' " (click)="next()" class="uk-margin-auto-left">
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>

View File

@ -19,7 +19,7 @@ import {ClaimContext} from '../../claim-utils/claimEntities.class';
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form>
</div>
<div class="uk-width-1-2 ">
<h3 > Selected Projects ({{projects.length}}) </h3>
<h3 > Selected Communities ({{projects.length}}) </h3>
<ul class="uk-list uk-list-divider">
<li class="list-group-item" *ngFor="let context of contexts" >
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span>

View File

@ -62,8 +62,8 @@ import {Dates} from '../../../utils/string-utils.class';
<div *ngIf="showAccessRights && pub.source != 'openaire' " class = "uk-width-1-3 uk-grid">
<div class="uk-width-1-3 uk-padding-remove-left">
<select [(ngModel)]="pub.type" name="{{'select_type_'+pub.id}}" >
<option [value]="'publication'" >Publication</option>
<option [value]="'dataset'" >Dataset</option>
<option [value]="'publication'" (click)="onTypeChanged('publication',pub)" >Publication</option>
<option [value]="'dataset'" (click)="onTypeChanged('dataset',pub)" >Dataset</option>
</select>
</div>
<div class="uk-width-1-3 uk-padding-remove-left">
@ -120,6 +120,8 @@ export class ClaimSelectedResultsComponent {
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result
public commonType; // for research result type - changes when user apply a change to every result
public typeChanged:boolean = true; //
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
private myDatePickerOptions: IMyOptions = {
// other options...
@ -148,7 +150,15 @@ private myDatePickerOptions: IMyOptions = {
if(this.results.length > 1 ){
this.commonAccessRights = "EMBARGO";
this.commonEmbargoEndDate = item.embargoEndDate;
this.confirmOpen();
this.confirmOpen(false,"Do you wish to apply the change to every result?");
}
}
onTypeChanged (event:any, item:any) {
item.type =(event);
if(this.results.length > 1 ){
this.commonType = item.type;
this.confirmOpen(true, "Do you wish to apply the change to every result?");
}
}
@ -169,28 +179,39 @@ private myDatePickerOptions: IMyOptions = {
this.commonAccessRights = type;
if(this.commonAccessRights != "EMBARGO"){
this.commonEmbargoEndDate = item.embargoEndDate;
this.confirmOpen();
this.confirmOpen(false, "Do you wish to apply the change to every result?");
}
}
}
confirmOpen(){
confirmOpen(type: boolean, message: string){
this.typeChanged = type;
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Change access rights";
this.alertApplyAll.alertTitle = "Change metadata";
this.alertApplyAll.message = "Do you wish to apply the change to every result?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
for (var i = 0; i < this.results.length; i++) {
if(this.results[i].source != 'openaire' ){
this.results[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.results[i].embargoEndDate = this.commonEmbargoEndDate;
if(this.typeChanged){
for (var i = 0; i < this.results.length; i++) {
if(this.results[i].source != 'openaire' ){
this.results[i].type = this.commonType;
}
}
}
}else{
for (var i = 0; i < this.results.length; i++) {
if(this.results[i].source != 'openaire' ){
this.results[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.results[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}
}
}

View File

@ -22,7 +22,7 @@
<div class="uk-width-2-3" *ngIf="datasetInfo != null"-->
<div>
<showAuthors [authors]="datasetInfo.authors"></showAuthors>
<showAuthors [authors]="datasetInfo.authors" searchPage="datasets"></showAuthors>
<span *ngIf="datasetInfo.date != ''">({{datasetInfo.date}})</span>
</div>

View File

@ -93,7 +93,7 @@ export class DatasetService {
this.datasetInfo.authors[mydata.ranking-1] = {"name": "", "id": ""};
this.datasetInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
this.datasetInfo.authors[mydata.ranking-1]['id'] = /*OpenaireProperties.getsearchLinkToPerson()+*/mydata['to'].content;
/* this.datasetInfo.authors[mydata.ranking-1]['id'] = mydata['to'].content;*/
} else if(mydata['to'].class == "isProducedBy") {
if(this.datasetInfo.fundedByProjects == undefined) {
this.datasetInfo.fundedByProjects = new Array<

View File

@ -1,14 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { PersonComponent } from './person.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: PersonComponent, canActivate: [FreeGuard] }
])
]
})
export class PersonRoutingModule { }

View File

@ -1,93 +0,0 @@
<div class="uk-container uk-margin-top person">
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
<div *ngIf="personInfo != null" uk-grid>
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
<h2>{{personInfo.fullname}}</h2>
<dl class="uk-description-list">
<dt *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">Last name: </dt>
<dd *ngIf="personInfo.secondnames != undefined && personInfo.secondnames != ''">{{personInfo.secondnames}}</dd>
<dt *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">First name: </dt>
<dd *ngIf="personInfo.firstname != undefined && personInfo.firstname != ''">{{personInfo.firstname}}</dd>
<dt *ngIf="personInfo.country != undefined && personInfo.country != ''">Country: </dt>
<dd *ngIf="personInfo.country != undefined && personInfo.country != ''">{{personInfo.country}}</dd>
</dl>
<ul *ngIf="showTabs" class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
<li class="uk-active">
<a>
Publications
<span class="uk-badge uk-badge-notification">
{{fetchPublications.searchUtils.totalResults}}
</span>
</a>
</li>
<li (click)="searchDatasetsInit()">
<a>
Research Data
<span class="uk-badge uk-badge-notification">
{{fetchDatasets.searchUtils.totalResults}}
</span>
</a>
</li>
</ul>
<ul *ngIf="showTabs" id="tab-content" class="uk-switcher uk-margin custom-tab-content">
<li class="uk-animation-fade">
<div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
There are no publications
</div>
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10" >
<a [queryParams]="{personId: personId, pe: 'and'}" routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications">
View all {{fetchPublications.searchUtils.totalResults}} results
</a>
</div>
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.searchUtils.status"
type="publication" urlParam="articleId">
</tab-result>
</div>
</li>
<li class="uk-animation-fade">
<div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
There are no research data
</div>
<div *ngIf="fetchDatasets.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults > 10" >
<a [queryParams]="{personId: personId, pe: 'and'}" routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets">
View all {{fetchDatasets.searchUtils.totalResults}} results
</a>
</div>
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.status"
type="dataset" urlParam="datasetId">
</tab-result>
</div>
</li>
</ul>
</div>
<div class="uk-width-1-4@l uk-width-1-4@xl uk-width-1-4@m uk-width-1-1@s">
<ul class="uk-list uk-list-striped">
<li>
<dl class="uk-description-list-line">
<dt >Share - Bookmark
</dt>
<dd>
<addThis ></addThis>
</dd>
</dl>
</li>
</ul>
</div>
</div>
</div>

View File

@ -1,169 +0,0 @@
import {Component, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { ActivatedRoute, Route, Router} from '@angular/router';
import {PersonService} from './person.service';
import { PersonInfo } from '../../utils/entities/personInfo';
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import { SearchPublicationsService } from '../../services/searchPublications.service';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import { SearchDatasetsService } from '../../services/searchDatasets.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import { Meta} from '../../../angular2-meta';
@Component({
selector: 'person',
templateUrl: 'person.component.html',
})
export class PersonComponent {
sub: any;
subPublications: any;
subDatasets: any;
subDatasetsCount: any;
public fetchPublications : FetchPublications;
private linkToSearchPublications = "";
public fetchDatasets : FetchDatasets;
private linkToSearchDatasets = "";
personInfo: PersonInfo;
private personId: string;
public warningMessage = "";
public errorMessage = "";
public showTabs = false;
constructor (private element: ElementRef,
private _personService: PersonService,
private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService,
private _router: Router,
private _meta: Meta) {
this.fetchPublications = new FetchPublications( this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
// this.scrollUp = this._route.events.subscribe((path) => {
// element.nativeElement.scrollIntoView();
// });
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
}
ngOnInit() {
console.info('person init');
this.sub = this.route.queryParams.subscribe(params => {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
this.personInfo = null;
this.updateTitle("Person");
this.updateDescription("person, publication, research data, search, open access");
this.personId = params['personId'];
console.info("Id is :"+this.personId);
if(this.personId){
this.showTabs = false;
this.fetchPersonInfo();
this.showTabs = true;
this.searchPublications();
}else{
this.warningMessage="No valid person id";
}
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
});
/*this.subDatasetsCount = this.route.queryParams.subscribe(params => {
this._searchDatasetsService.numOfEntityDatasets(this.personId, "people/").subscribe(
data => {
this.fetchDatasets.searchUtils.totalResults = data;
},
err => {
console.log(err);
}
);
})*/
}
private searchDatasetsInit() {
if(this.subDatasets == undefined && this.fetchDatasets.searchUtils.totalResults > 0) {
this.subDatasets = this.route.queryParams.subscribe(params => {
this.searchDatasets();
});
}
}
ngOnDestroy() {
this.sub.unsubscribe();
// this.subPublications.unsubscribe();
// if(this.subDatasets != undefined) {
// this.subDatasets.unsubscribe();
// }
// this.subDatasetsCount.unsubscribe();
}
private fetchPersonInfo () {
console.info("inside fetchPersonInfo of component");
this.warningMessage = '';
this.errorMessage=""
this._personService.getPersonInfo(this.personId).subscribe(
data => {
this.personInfo = data;
this.updateTitle(this.personInfo.fullname);
this.updateDescription("person, publication, research data, search, open access, "+this.personInfo.fullname);
/*this._searchDatasetsService.numOfEntityDatasets("people/"+this.personId).subscribe(
data => {
this.fetchDatasets.searchUtils.totalResults = data;
},
err => {
console.log(err);
}
);*/
this.fetchDatasets.getNumForEntity("people", this.personId);
},
err => {
console.log(err)
console.info("error");
this.errorMessage = 'No person found';
}
);
}
private searchPublications() {
this.fetchPublications.getResultsForEntity("person", this.personId, 1, 10);
this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();// + "?person=" + this.personId + "&pe=and";
}
private searchDatasets() {
this.fetchDatasets.getResultsForEntity("person", this.personId, 1, 10);
this.linkToSearchDatasets = OpenaireProperties.getLinkToAdvancedSearchDatasets();// + "?person=" + this.personId + "&pe=and";
}
updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
}
updateTitle(title:string){
var _suffix ="| OpenAIRE";
var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
this._meta.setTitle(_title );
this._meta.updateProperty("og:title",_title);
}
updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
}

View File

@ -1,34 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { PersonService} from './person.service';
import { PersonComponent } from './person.component';
import { PersonRoutingModule } from './person-routing.module';
import { LandingModule } from '../landing.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
LandingModule,
PersonRoutingModule,
TabResultModule,
DatasetsServiceModule, PublicationsServiceModule
],
declarations: [
PersonComponent
],
providers:[
PersonService, FreeGuard
],
exports: [
PersonComponent
]
})
export class PersonModule { }

View File

@ -1,80 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../shared/cache.service';
import {PersonInfo} from '../../utils/entities/personInfo';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'
export function hashCodeString(str: string): string {
let hash = 0;
if (str.length === 0) {
return hash + '';
}
for (let i = 0; i < str.length; i++) {
let char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32bit integer
}
return hash + '';
}
@Injectable()
export class PersonService {
constructor(private http: Http, public _cache: CacheService) {}
personInfo: PersonInfo;
getPersonInfo (id: string):any {
console.info("getPersonInfo in service");
let url = OpenaireProperties. getSearchAPIURLLast()+'people/'+id+"?format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parsePersonInfo(res));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['result']['metadata']['oaf:entity']['oaf:person'])
.do(res => {
this._cache.set(key, res);
})
.map(res => this.parsePersonInfo(res));
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
parsePersonInfo (data: any):any {
console.info("parsePersonInfo");
this.personInfo = new PersonInfo();
if(data != null) {
if(data.hasOwnProperty('firstname')) {
this.personInfo.firstname = data.firstname;
}
if(data.hasOwnProperty('secondnames')) {
this.personInfo.secondnames = data.secondnames;
}
if(data.hasOwnProperty('fullname')) {
this.personInfo.fullname = data.fullname;
}
}
return this.personInfo;
}
}

View File

@ -18,7 +18,7 @@
<div>
<showAuthors [authors]="publicationInfo.authors"></showAuthors>
<showAuthors [authors]="publicationInfo.authors" searchPage="publications"></showAuthors>
<span *ngIf="publicationInfo.date != ''">({{publicationInfo.date}})</span>
</div>

View File

@ -95,7 +95,7 @@ export class PublicationService {
this.publicationInfo.authors[relation.ranking-1] = {"name": "", "id": ""};
this.publicationInfo.authors[relation.ranking-1]['name'] = relation.fullname;
this.publicationInfo.authors[relation.ranking-1]['id'] = /*OpenaireProperties.getsearchLinkToPerson() + */relation['to'].content;
/*this.publicationInfo.authors[relation.ranking-1]['id'] = relation['to'].content;*/
} else if(relation['to'].class == "isProducedBy") {
if(this.publicationInfo.fundedByProjects == undefined) {
this.publicationInfo.fundedByProjects = new Array<

View File

@ -1,4 +1,5 @@
import {Component, Input} from '@angular/core';
import {RouterHelper} from '../utils/routerHelper.class';
@Component({
selector: 'showAuthors',
@ -9,15 +10,19 @@ import {Component, Input} from '@angular/core';
</div>
<span *ngFor="let item of authors.slice(0,30) let i=index">
<!--a href="{{item['url']}}"-->
<a *ngIf="item.id" routerLinkActive="router-link-active" routerLink="/search/person" [queryParams]="{personId: item.id}">{{item['name']}}</a><span *ngIf="item.id && i<29 && i<(authors.length-1)">;</span>
<span *ngIf="!item.id">{{item['name']}}</span><span *ngIf="!item.id && i<29 && i<(authors.length-1)">;</span>
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(item['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+searchPage">
{{item['name']}}
</a>
<span *ngIf=" i<29 && i<(authors.length-1)">;</span>
</span>
<span *ngIf="!showAll && authors.length > 30"> ... </span>
<span *ngIf="showAll">
<span *ngFor="let item of authors.slice(30) let i=index">
<!--a href="{{item['url']}}"-->
<a *ngIf="item.id" routerLinkActive="router-link-active" routerLink="/search/person" [queryParams]="{personId: item.id}">{{item['name']}}</a><span *ngIf="item.id && i<(authors.length-1)">;</span>
<span *ngIf="!item.id">{{item['name']}}</span><span *ngIf="!item.id && i<(authors.length-1)">;</span>
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(item['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+searchPage">
{{item['name']}}
</a>
<span *ngIf=" i<(authors.length-1)">;</span>
</span>
</span>
<span *ngIf="!showAll && authors.length > 30">
@ -36,11 +41,18 @@ import {Component, Input} from '@angular/core';
export class ShowAuthorsComponent {
@Input() authors: { [key: string]: string }[];
@Input() searchPage:string ="publications"
private showAll: boolean = false;
public routerHelper:RouterHelper = new RouterHelper();
constructor () {
}
ngOnInit() {
}
public quote(params: string):string {
return '"'+params+'"';
}
}

View File

@ -6,7 +6,6 @@ import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import {PersonInfo} from '../utils/entities/personInfo';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {User,Session,MyJWT} from './utils/helper.class';

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchPeopleComponent, canActivate: [FreeGuard] }
])
]
})
export class AdvancedSearchPeopleRoutingModule { }

View File

@ -1,131 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchPeopleService} from '../../services/searchPeople.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
selector: 'advanced-search-organizations',
template: `
<advanced-search-page pageTitle="Advanced Search People" entityType="person"
type = "people"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/people"
[disableForms]="disableForms">
</advanced-search-page>
`
})
export class AdvancedSearchPeopleComponent {
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.PERSON_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PERSON_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "(oaftype exact person)";
public csvParams: string;
public disableForms: boolean = false;
constructor (private route: ActivatedRoute, private _searchPeopleService: SearchPeopleService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPeople;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
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);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number){
if(parameters!= null && parameters != '' ) {
this.csvParams ="&type=people&query=( "+this.resourcesQuery + "and (" + parameters + "))";
}else{
this.csvParams ="&type=people&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
console.info("Advanced Search People: Execute search query "+parameters);
this._searchPeopleService.advancedSearchPeople(parameters, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search People total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
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;
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
private setFilters(){
//TODO set filters from
}
public queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}
}

View File

@ -1,29 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{ AdvancedSearchPeopleRoutingModule} from './advancedSearchPeople-routing.module';
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component';
import {PeopleServiceModule} from '../../services/peopleService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
PeopleServiceModule,
AdvancedSearchPeopleRoutingModule, AdvancedSearchPageModule
],
declarations: [
AdvancedSearchPeopleComponent
],
providers:[FreeGuard
],
exports: [
AdvancedSearchPeopleComponent
]
})
export class AdvancedSearchPeopleModule { }

View File

@ -13,7 +13,6 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
import {PeopleServiceModule} from '../../services/peopleService.module';
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
@ -23,7 +22,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
imports: [
CommonModule, FormsModule, RouterModule,
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule,
PublicationsServiceModule, OrganizationsServiceModule, PeopleServiceModule,
PublicationsServiceModule, OrganizationsServiceModule,
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule
],

View File

@ -10,13 +10,11 @@ import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDatap
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import { FetchOrganizations } from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
import { FetchPeople } from '../../utils/fetchEntitiesClasses/fetchPeople.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchPeopleService} from '../../services/searchPeople.service';
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@ -77,13 +75,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<span *ngIf = "fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchPeople()" >
<a>
People
<span *ngIf = "fetchPeople.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchPeople.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchPeople.searchUtils.totalResults :'')}}</span>
</a>
</li>
@ -129,13 +121,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<span *ngIf = "fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchPeople()" >
<a>
People
<span *ngIf = "fetchPeople.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchPeople.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchPeople.searchUtils.totalResults :'')}}</span>
</a>
</li>
</ul>
<ul id="searchtabs" class="uk-switcher uk-width-1-1 uk-margin-top custom-tab-content-large">
@ -229,25 +215,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<browse-entities entityName="organization" baseUrl="/search/find/organizations" [refineFields]=searchFields.ORGANIZATION_REFINE_FIELDS></browse-entities>
</div>
</li>
<li>
<div *ngIf = "keyword.length > 0" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchPeople.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchPeople"-->
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)"
routerLinkActive="router-link-active" [routerLink]="linkToSearchPeople">
View all {{fetchPeople.searchUtils.totalResults}} results <span uk-icon="icon: chevron-right"></span>
</a>
</div>
<search-result [(results)]="fetchPeople.results"
[(status)]= "fetchPeople.searchUtils.status" showLoading = true
type="person" urlParam="personId">
</search-result>
</div>
<div *ngIf = "keyword.length == 0 && activeTab=='people'" class ="uk-animation-fade">
<div class="uk-alert uk-alert-primary " role="alert">No person statistics found</div>
</div>
</li>
</ul>
</div>
@ -262,7 +230,6 @@ export class SearchComponent {
public reloadProjects: boolean;
public reloadDataproviders: boolean;
public reloadOrganizations: boolean;
public reloadPeople: boolean;
public pageTitle = "Search in OpenAIRE"
@ -272,7 +239,6 @@ export class SearchComponent {
public projectsTab:string[];
public dataproviders:string[];
public organizations:string[];
public people:string[];
public activeTab = "publications";
public linkToSearchPublications = "";
@ -280,20 +246,18 @@ export class SearchComponent {
public linkToSearchDataproviders = "";
public linkToSearchDatasets = "";
public linkToSearchOrganizations = "";
public linkToSearchPeople = "";
public fetchPublications : FetchPublications;
public fetchDataproviders : FetchDataproviders;
public fetchProjects : FetchProjects;
public fetchDatasets: FetchDatasets;
public fetchOrganizations: FetchOrganizations;
public fetchPeople: FetchPeople;
public searchFields:SearchFields = new SearchFields();
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
public subPub;public subData;public subProjects;public subOrg;public subPeople; public subDataPr;
public subPub;public subData;public subProjects;public subOrg; public subDataPr;
constructor ( private route: ActivatedRoute,
private _router: Router,
private _searchPublicationsService: SearchPublicationsService,
@ -301,14 +265,13 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
private _searchProjectsService: SearchProjectsService,
private _searchDatasetsService: SearchDatasetsService,
private _searchOrganizationsService: SearchOrganizationsService,
private _searchPeopleService: SearchPeopleService,
private location: Location, private _meta: Meta ) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService);
this.fetchPeople = new FetchPeople(this._searchPeopleService);
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
var title = "Search publications, datasets, projects... | OpenAIRE";
var url = OpenaireProperties.getBaseLink()+this._router.url;
@ -355,9 +318,6 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
if(this.subOrg){
this.subOrg.unsubscribe();
}
if(this.subPeople){
this.subPeople.unsubscribe();
}
if(this.subDataPr){
this.subDataPr.unsubscribe();
}
@ -404,14 +364,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword;
}
}
public searchPeople() {
this.activeTab = "people";
if(this.reloadPeople) {
this.reloadPeople = false;
this.fetchPeople.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchPeople = OpenaireProperties.getLinkToSearchPeople();// + "?keyword=" + this.keyword;
}
}
public keywordChanged($event){
@ -434,9 +387,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
if(this.activeTab == "organizations") {
this.searchOrganizations();
}
if(this.activeTab == "people") {
this.searchPeople();
}
this.count();
}
@ -499,21 +450,7 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
}
);
}
if(this.activeTab != "people"){
this.fetchPeople.searchUtils.status = this.errorCodes.LOADING;
this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe(
data => {
this.fetchPeople.searchUtils.totalResults = data;
this.fetchPeople.searchUtils.status = this.errorCodes.DONE;
},
err => {
console.log(err);
this.fetchPeople.searchUtils.status = this.errorCodes.ERROR;
}
);
}
}
@ -523,7 +460,6 @@ public subPub;public subData;public subProjects;public subOrg;public subPeople;
this.reloadProjects = true;
this.reloadDataproviders = true;
this.reloadOrganizations = true;
this.reloadPeople = true;
}
}

View File

@ -102,8 +102,6 @@ export class AdvancedSearchPageComponent {
this.urlParam = "projectId";
} else if(this.entityType == "organization") {
this.urlParam = "organizationId";
} else if(this.entityType == "person") {
this.urlParam = "personId";
} else {
this.urlParam = "datasourceId";
}

View File

@ -186,9 +186,7 @@ export class SearchPageComponent {
this.urlParam = "projectId";
} else if(this.entityType == "organization") {
this.urlParam = "organizationId";
} else if(this.entityType == "person") {
this.urlParam = "personId";
} else {
} else {
this.urlParam = "datasourceId";
}
}

View File

@ -32,7 +32,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<span *ngIf="result['authors'] != undefined">
<span *ngFor="let author of result['authors'].slice(0,15)">
<!--a href="{{author['url']}}"-->
<a [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(author['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+type+'s'">
{{author['name']}};
</a>
</span>
@ -144,10 +144,14 @@ export class SearchResultComponent {
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
public errorMessage: string = "No results found";
constructor () {
constructor () {
}
ngOnInit() {}
public quote(params: string):string {
return '"'+params+'"';
}
}

View File

@ -33,9 +33,9 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<div>
<span *ngIf="result['authors'] != undefined">
<span *ngFor="let author of result['authors'].slice(0,15)">
<a [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
{{author['name']}};
</a>
<a [queryParams]="routerHelper.createQueryParams(['author','au'],[quote(author['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="'/search/advanced/'+type+'s'">
{{author['name']}};
</a>
</span>
<span *ngIf="result['authors'].length > 15">...</span>
</span>
@ -140,10 +140,13 @@ export class TabResultComponent {
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
public errorMessage: string = "No results found";
constructor () {
}
ngOnInit() {}
public quote(params: string):string {
return '"'+params+'"';
}
}

View File

@ -87,10 +87,8 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(entity == "project") {
parameters = "projects/"+id;
} else if(entity == "person") {
parameters = "people/"+id;
}
if(parameters != "") {
this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size).subscribe(

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import{SearchPeopleComponent} from './searchPeople.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchPeopleComponent, canActivate: [FreeGuard] }
])
]
})
export class SearchPeopleRoutingModule { }

View File

@ -1,128 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchPeopleService} from '../../services/searchPeople.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
selector: 'search-people',
template: `
<search-page pageTitle="Search People"
type="people" entityType="person" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false
[csvParams]="csvParams" csvPath="people" advancedSearchLink="/search/advanced/people"
[disableForms]="disableForms">
</search-page>
`
})
export class SearchPeopleComponent {
public results =[];
public filters =[];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields = this.searchFields.PERSON_REFINE_FIELDS;
public csvParams: string;
public disableForms: boolean = false;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchPeopleService: SearchPeopleService ) {
//this.results =[];
//this.filters =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchPeople();
//get refine field filters from url parameters
// if(!this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
}
public ngOnInit() {
this.searchPage.refineFields = this.refineFields; //TODO make it work as a directive
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.getResults(this.searchUtils.keyword, false, this.searchUtils.page, this.searchUtils.size);
});
}
public ngOnDestroy() {
this.sub.unsubscribe();
}
public getResults(keyword:string,refine:boolean, page: number, size: number){
var parameters = "";
if(keyword.length > 0){
parameters = "q="+ keyword;
}
this._getResults(parameters,refine,page,this.searchUtils.size);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this._searchPeopleService.searchPeople(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
private setFilters(){
//TODO set filters from
}
public queryChanged($event) {
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
}

View File

@ -1,33 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{ SearchPeopleRoutingModule} from './searchPeople-routing.module';
import{SearchPeopleComponent} from './searchPeople.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {PeopleServiceModule} from '../../services/peopleService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
PeopleServiceModule,
SearchFormModule, SearchResultsModule, SearchPeopleRoutingModule, SearchPageModule//, SearchFilterModalModule
],
declarations: [
SearchPeopleComponent
],
providers:[FreeGuard
],
exports: [
SearchPeopleComponent
]
})
export class SearchPeopleModule { }

View File

@ -94,9 +94,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(entity == "project") {
parameters = "projects/"+id;
} else if(entity == "person") {
parameters = "people/"+id;
}
}
if(parameters != "") {

View File

@ -1,20 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchPeopleService} from './searchPeople.service';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
],
providers:[
SearchPeopleService
],
exports: [
]
})
export class PeopleServiceModule { }

View File

@ -1,125 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {SearchResult} from '../utils/entities/searchResult';
import {RefineResultsUtils} from './servicesUtils/refineResults.class';
@Injectable()
export class SearchPeopleService {
constructor(private http: Http, public _cache: CacheService) {}
searchPeople (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
console.info("In searchProjects");
let link = OpenaireProperties.getSearchAPIURLLast()+"people";
let url = link+"?";
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && params != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size + "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]);
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.do(res => {
this._cache.set(key, res);
})
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "person")]);
}
advancedSearchPeople (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact person) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]);
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.do(res => {
this._cache.set(key, res);
})
.map(res => [res['meta'].total, this.parseResults(res['results'])]);
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person'];
var result: SearchResult = new SearchResult();
result['title'] = {"name": '', "accessMode": '', "sc39": ''};
result['title'].name = resData.fullname;
//result['title'].url = OpenaireProperties.getsearchLinkToPerson();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
results.push(result);
}
return results;
}
numOfEntityPeople(id: string, entity: string):any {
//OpenaireProperties.getSearchAPIURLLast()
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
let url = OpenaireProperties.getSearchAPIURLLast()+entity+id+"/people/count"+ "?format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res.total)
.do(res => {
this._cache.set(key, res);
});
}
numOfSearchPeople(params: string):any {
//OpenaireProperties.getSearchAPIURLLast()
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
let url = OpenaireProperties.getSearchAPIURLLast()+"people/count?q=" + params + "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res.total)
.do(res => {
this._cache.set(key, res);
});
}
}

View File

@ -40,7 +40,6 @@ import {Session} from '../login/utils/helper.class';
<li><a routerLinkActive="uk-link" routerLink="/search/find/projects" class="uk-offcanvas-close custom-offcanvas-close">Projects</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders" class="uk-offcanvas-close custom-offcanvas-close">Data Providers</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/organizations" class="uk-offcanvas-close custom-offcanvas-close">Organizations</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/people" class="uk-offcanvas-close custom-offcanvas-close">People</a></li>
</ul>
</li>
<li class="uk-nav-header uk-parent">
@ -134,7 +133,6 @@ import {Session} from '../login/utils/helper.class';
<li><a routerLinkActive="uk-link" routerLink="/search/find/projects">Projects</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders">Data Providers</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/organizations">Organizations</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/people">People</a></li>
</ul>
</div>
</div>

View File

@ -6,7 +6,6 @@ import { FormsModule } from '@angular/forms';
//Entities
import {DatasetInfo} from './datasetInfo';
import {OrganizationInfo} from './organizationInfo';
import {PersonInfo} from './personInfo';
import {ProjectInfo} from './projectInfo';
import {Publication} from './publication';
import {PublicationInfo} from './publicationInfo';

View File

@ -1,9 +0,0 @@
export class PersonInfo {
fullname: string;
firstname: string;
secondnames: string;
country: string;
publications: any;
researchData: any;
}

View File

@ -63,8 +63,6 @@ export class EntitiesSearchService {
searchByType(keyword:string,type:string){
if (type == "project"){
return this.searchEntity(keyword,"projects","oaf:project","project");
}else if (type == "person"){
return this.searchEntity(keyword,"people","oaf:person","person");
}else if (type == "dataset"){
return this.searchEntity(keyword,"datasets","oaf:result","dataset");
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
@ -80,8 +78,6 @@ export class EntitiesSearchService {
fetchByType(id:string,type:string){
if (type == "project"){
return this.fetchEntity(id,"projects","oaf:project","project");
}else if (type == "person"){
return this.fetchEntity(id,"people","oaf:person","person");
}else if (type == "dataset"){
return this.fetchEntity(id,"datasets","oaf:result","dataset");
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){

View File

@ -78,8 +78,8 @@ public getNumForEntity(entity:string, id:string){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
if(id != "" && entity != "") {
if(id != "" && entity != "") {
this._searchDatasetsService.numOfEntityDatasets(id, entity).subscribe(
data => {
this.searchUtils.totalResults = data;
@ -111,8 +111,6 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(entity == "project") {
parameters = "projects/"+id;
} else if(entity == "person") {
parameters = "people/"+id;
}
if(parameters != "") {

View File

@ -1,59 +0,0 @@
import {SearchPeopleService} from '../../services/searchPeople.service';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchPeople {
public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any;
public searchFields:SearchFields = new SearchFields();
constructor ( private _searchPeopleService: SearchPeopleService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
}
public ngOnDestroy() {
this.sub.unsubscribe();
}
public getResultsByKeyword(keyword:string, page: number, size: number){
var parameters = "";
if(keyword.length > 0){
parameters = "q=" + keyword;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
this._searchPeopleService.searchPeople(parameters, null, page, size,[]).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search People: [Parameters:"+parameters+" ] [total results:"+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);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
}
);
}
}

View File

@ -95,8 +95,6 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
var parameters = "";
if(entity == "project") {
parameters = "projects/"+id;
} else if(entity == "person") {
parameters = "people/"+id;
} else if(entity == "organization") {
parameters = "organizations/"+id;
}

View File

@ -8,7 +8,6 @@ export class OpenaireProperties {
private static baseSearchLink="/";
private static searchLinkToPublication = "search/publication?articleId=";
private static searchLinkToProject = "search/project?projectId=";
private static searchLinkToPerson = "search/person?personId=";
private static searchLinkToDataProvider = "search/dataprovider?datasourceId=";
private static searchLinkToDataset = "search/dataset?datasetId=";
private static searchLinkToOrganization = "search/organization?organizationId=";
@ -102,9 +101,7 @@ export class OpenaireProperties {
public static getsearchLinkToProject():string{
return this.baseSearchLink + this.searchLinkToProject;
}
public static getsearchLinkToPerson():string{
return this.baseSearchLink + this.searchLinkToPerson;
}
public static getsearchLinkToOrganization():string{
return this.searchLinkToOrganization;
}

View File

@ -7,13 +7,12 @@ export class SearchFields {
"relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"relproject","resultacceptanceyear",
"resultbestlicense", "instancetypename", "resultlanguagename", "community","collectedfrom"];
"resultbestlicense", "instancetypename", "resultlanguagename", "community","resulthostingdatasource"];
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypename",
"resultlanguagename", "community","relprojectid", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultdateofacceptance","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
"resultdateofacceptance","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid"];
public RESULT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
@ -21,7 +20,7 @@ export class SearchFields {
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
["resulthostingdatasource"]:{name:"Datasource", type:"refine", param:"hostedBy", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
// ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
@ -122,15 +121,6 @@ export class SearchFields {
};
//PERSON
public PERSON_REFINE_FIELDS:string[] = [];
public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
public PERSON_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
};
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",

View File

@ -23,19 +23,37 @@
<link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<title>Search OpenAIRE</title>
<script>
window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
console.log(errorMsg + " __" + url + " __" + lineNumber + " __" + column + " __" + errorObj);
if(errorMsg.indexOf("uikit.js") != -1 || url.indexOf("uikit.js") != -1 ){
console.log("********UIKIT Error ***********");
jQuery.loadScript = function (url, callback) {
jQuery.ajax({
url: url,
dataType: 'script',
});}
$.loadScript("assets/dl119_files/uikit.js", function(){
console.log("LOOOOOOOOOOOOOOOOOOOAD");});
}
}
</script>
<!-- <script src="assets/jquery/jquery.min.js" type="text/javascript"></script> -->
<script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="assets/dl119_files/jquery.js"></script>
<script src="assets/dl119_files/uikit.js"></script>
<script src="assets/dl119_files/uikit-icons-max.js"></script>
<!-- <link rel="stylesheet" href="node_modules/uikit/dist/css/uikit.min.css"> -->
<link rel="stylesheet" href="assets/dl119_files/theme.css">
<link rel="stylesheet" href="assets/dl119_files/custom.css">
<link rel="stylesheet" href="assets/custom.css">
<script src="assets/dl119_files/jquery.js"></script>
<script src="assets/dl119_files/uikit.js"></script>
<!-- <script async src="assets/dl119_files/theme.js"></script> -->
<!--script src="node_modules/uikit/dist/js/uikit.min.js"></script-->
<script src="assets/dl119_files/uikit-icons-max.js"></script>
<!-- Google sitename markup-->
<script type="application/ld+json">
{