Deleting portal with older version of angular
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@49721 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
c6d700e3e6
commit
e249a3bef1
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"watch": [
|
||||
"dist",
|
||||
"src/index.html"
|
||||
],
|
||||
"ext" : "js ts json html"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
"name": "uoa-services-portal",
|
||||
"version": "1.0.0",
|
||||
"description": "Open Access Infrastructure for Research in Europe ",
|
||||
"scripts": {
|
||||
"postinstall": "typings install",
|
||||
"watch": "webpack --watch",
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "webpack",
|
||||
"prestart": "npm run build",
|
||||
"server": "nodemon dist/server/bundle.js",
|
||||
"start": "npm run server",
|
||||
"predebug": "npm run build",
|
||||
"debug": "node --debug-brk dist/server/bundle.js"
|
||||
},
|
||||
"license": "UOA",
|
||||
"dependencies": {
|
||||
"@angular/common": "2.0.0-rc.1",
|
||||
"@angular/compiler": "2.0.0-rc.1",
|
||||
"@angular/core": "2.0.0-rc.1",
|
||||
"@angular/http": "2.0.0-rc.1",
|
||||
"@angular/platform-browser": "2.0.0-rc.1",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
|
||||
"@angular/platform-server": "2.0.0-rc.1",
|
||||
"@angular/router-deprecated": "2.0.0-rc.1",
|
||||
"angular2-universal": "~0.101.8",
|
||||
"body-parser": "^1.15.1",
|
||||
"bootstrap": "^3.3.6",
|
||||
"express": "^4.13.4",
|
||||
"preboot": "^2.1.2",
|
||||
"rxjs": "5.0.0-beta.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^1.9.2",
|
||||
"rimraf": "^2.5.2",
|
||||
"ts-loader": "^0.8.2",
|
||||
"typescript": "^1.8.9",
|
||||
"typings": "~0.8.1",
|
||||
"webpack": "^1.13.1",
|
||||
"webpack-dev-server": "^1.14.0",
|
||||
"webpack-merge": "^0.13.0"
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
import {Component, Directive, ElementRef, Renderer} from '@angular/core';
|
||||
import {RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {Http} from '@angular/http';
|
||||
import {SearchComponent} from './searchPages/search.component';
|
||||
import {ClaimComponent} from './claimPages/claim/claim.component';
|
||||
import {ClaimsAdminComponent} from './claimPages/claims/claimsAdmin.component';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
import {LinkingComponent} from './claimPages/linking/linking.component';
|
||||
import {LinkingHomeComponent} from './claimPages/linking/linkingHome.component';
|
||||
import {MyClaimsComponent} from './claimPages/myClaims/myClaims.component';
|
||||
import {ProjectComponent} from './landingPages/project/project.component';
|
||||
import {PublicationComponent} from './landingPages/publication/publication.component';
|
||||
import {DatasetComponent} from './landingPages/dataset/dataset.component';
|
||||
import {PersonComponent} from './landingPages/person/person.component';
|
||||
import {MyClaimsDemoComponent} from './claimPages/myClaimsDemo.component';
|
||||
import {SearchPublicationsComponent} from './searchPages/searchPublications.component';
|
||||
import 'rxjs/Rx';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app',
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES, SearchPublicationsComponent
|
||||
],
|
||||
styles: [`
|
||||
.router-link-active {
|
||||
background-color: lightgray;
|
||||
}
|
||||
`],
|
||||
template: `
|
||||
<div>
|
||||
<nav class="navbar navbar-default" id="top">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">OpenAire</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- <li class="active"><a [routerLink]=" ['/Search']" >Search <span class="sr-only">(current)</span></a></li>-->
|
||||
<li><a [routerLink]=" ['/Linking']">Linking</a></li>
|
||||
<li><a [routerLink]=" ['/Claims']">Claims Admin</a></li>
|
||||
<li><a [routerLink]=" ['/SearchPublications']" >Search Publications </a></li>
|
||||
<!-- <li><a [routerLink]=" ['/Home']">Home</a></li>-->
|
||||
<li><a [routerLink]=" ['/MyClaims']">My claims</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
`
|
||||
})
|
||||
@RouteConfig([
|
||||
{ path: '/', component: HomeComponent, name: 'Home', useAsDefault: true },
|
||||
{ path: '/home', component: HomeComponent, name: 'Home' },
|
||||
{ path: '/claims', component: ClaimsAdminComponent, name: 'Claims' },
|
||||
{ path: '/claim', component: ClaimComponent, name: 'Claim' },
|
||||
{ path: '/search', component: SearchComponent, name: 'Search' },
|
||||
{ path: '/linking', component: LinkingComponent, name: 'Linking' },
|
||||
{ path: '/my-claims', component: MyClaimsComponent, name: 'MyClaims' },
|
||||
{ path: '/demo', component: MyClaimsDemoComponent, name: 'MyClaimsDemo' },
|
||||
{ path: '/project', component: ProjectComponent, name: 'Project' },
|
||||
{ path: '/publication', component: PublicationComponent, name: 'Publication' },
|
||||
{ path: '/dataset', component: DatasetComponent, name: 'Dataset' },
|
||||
{ path: '/person', component: PersonComponent, name: 'Person' },
|
||||
{ path: '/search-publications', component: SearchPublicationsComponent, name: 'SearchPublications' }
|
||||
|
||||
])
|
||||
export class App {
|
||||
name: string = 'Angular 2';
|
||||
data = {};
|
||||
server;
|
||||
|
||||
constructor(public http: Http ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
setTimeout(() => {
|
||||
this.server = 'Rendered on the Server';
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
|
||||
// import {ClaimsComponent} from '../claims/claims.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'linking',
|
||||
directives: [ROUTER_DIRECTIVES ],
|
||||
template: `
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1>Bulk Claim Linking</h1>
|
||||
</div>
|
||||
<linking-home *ngIf=" show == 'home' " (linkTypeChange)="linkTypeChange($event)" ></linking-home>
|
||||
<div *ngIf=" show != 'home' && show != 'myclaims' " >
|
||||
<ol *ngIf=" show != 'myclaims' " class="breadcrumb">
|
||||
<li *ngIf="linkType == 'project'" [class]="(show == 'project' )?'active':''"><a *ngIf="show != 'project'" (click)="showChangedType('project')" >Project</a><span *ngIf="show == 'project'">Project</span></li>
|
||||
<li *ngIf="linkType == 'context'" [class]="(show == 'context' )?'active':''"><a *ngIf="show != 'context'" (click)="showChangedType('context')" >Context</a><span *ngIf="show == 'context'">Context</span></li>
|
||||
<li *ngIf="linkType == 'software'" [class]="(show == 'software' )?'active':''"><a *ngIf="show != 'software'" (click)="showChangedType('software')" >Software</a><span *ngIf="show == 'software'">Software</span> </li>
|
||||
<li [class]="(show == 'result' || show == 'publication' || show == 'dataset')?'active':''"><a *ngIf="show != 'result' && show != 'publication' && show != 'dataset'" (click)="showChangedType('result')" >Research Result</a><span *ngIf="show == 'result' || show == 'publication' || show == 'dataset'">Research Result</span></li>
|
||||
<li [class]="(show == 'claim' )?'active':''"><span *ngIf="show == 'claim'">Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Link</a> </li>
|
||||
</ol>
|
||||
|
||||
<div *ngIf=" show != 'claim' && show != 'myclaims'" class="row" >
|
||||
<div class="col-sm-6">
|
||||
|
||||
<div *ngIf=" show=='result' " >
|
||||
<claim-result [selectedDatasets]="datasets" [selectedPublications]="publications" (datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)" > </claim-result>
|
||||
</div>
|
||||
|
||||
<div *ngIf=" show=='project' " >
|
||||
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
|
||||
</div>
|
||||
<div *ngIf=" show=='software' " >
|
||||
<p>TODO software</p>
|
||||
</div>
|
||||
<div *ngIf=" show == 'context'" >
|
||||
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show"
|
||||
(projectsChange)="projectsChange($event)" (contextsChange)="contextsChange($event)" (datasetsChange)="datasetsChange($event)"
|
||||
(publicationsChange)="publicationsChange($event)" (showChange)="showChange($event)" > </claim-selected>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf=" show == 'claim'" >
|
||||
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show" (showChange)="showChange($event)" [showAccessRights]="'true'" > </claim-selected>
|
||||
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show] = "show" (showChange)="showChange($event)"></claim-insert>
|
||||
</div>
|
||||
<nav>
|
||||
<ul *ngIf="show != 'home'" class="pager">
|
||||
<li class="previous" (click)="prev()"><a ><span aria-hidden="true">←</span> Previous</a></li>
|
||||
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">→</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
//[(ngModel)]="date"
|
||||
export class LinkingComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
}
|
||||
sourceType:string;
|
||||
targetType:string;
|
||||
step:number = 1;
|
||||
contexts=[];
|
||||
projects=[];
|
||||
publications=[];
|
||||
datasets=[];
|
||||
show = "home";
|
||||
searchType="publication"; //publication or dataset
|
||||
date='8-6-2016';
|
||||
keyword: string = "";
|
||||
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
next(){
|
||||
|
||||
if((this.show == 'project' || this.show == 'context' || this.show == 'software')){
|
||||
this.show='result';
|
||||
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
|
||||
this.show='claim';
|
||||
// }else if(this.show == 'result' ){
|
||||
// if(this.searchType == 'publication' ){
|
||||
// this.show="publication";
|
||||
// }else{
|
||||
// this.show="dataset";
|
||||
// }
|
||||
}
|
||||
}
|
||||
prev(){
|
||||
if(this.show == 'result'){
|
||||
this.show = this.linkType;
|
||||
// if(this.linkType == 'project'){
|
||||
// this.show='project';
|
||||
// }else if(this.linkType == 'context'){
|
||||
// this.show='context';
|
||||
// }else if(this.linkType == 'software'){
|
||||
// this.show='software';
|
||||
// }else{
|
||||
// this.show='home';
|
||||
//
|
||||
// }
|
||||
}else if(this.show == 'context' || this.show == 'project' || this.show == 'software' ){
|
||||
this.show='home';
|
||||
// }else if(this.show == 'dataset' || this.show == 'publication'){
|
||||
// this.show='result';
|
||||
} else if(this.show == 'claim'){
|
||||
this.show='result';
|
||||
}
|
||||
}
|
||||
goto(term: string) {
|
||||
this._router.navigate( ['Search', { keyword: term }] );
|
||||
}
|
||||
|
||||
search() {
|
||||
if(this.searchType == 'publication' ){
|
||||
this.show="publication";
|
||||
}else{
|
||||
this.show="dataset";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sourceTypeChange($event) {
|
||||
this.sourceType=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
targetTypeChange($event) {
|
||||
this.targetType=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
contextsChange($event) {
|
||||
this.contexts=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
publicationsChange($event) {
|
||||
this.publications=$event.value;
|
||||
}
|
||||
datasetsChange($event) {
|
||||
this.datasets=$event.value;
|
||||
}
|
||||
projectsChange($event) {
|
||||
this.projects=$event.value;
|
||||
}
|
||||
typeChanged(type:string) {
|
||||
this.searchType = type;
|
||||
}
|
||||
linkTypeChange($event) {
|
||||
this.linkType =$event.value;
|
||||
this.show=$event.value;
|
||||
|
||||
}
|
||||
showChange($event) {
|
||||
this.show=$event.value;
|
||||
this.showChangedType($event.value);
|
||||
|
||||
|
||||
}
|
||||
showChangedType(type:string) {
|
||||
this.show=type;
|
||||
if(this.show == 'project' || this.show == 'context' || this.show == 'software'){
|
||||
this.linkType = this.show;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<div *ngIf="id">
|
||||
<p>Here is the claim with id : {{id}}</p>
|
||||
<div *ngIf="claim">
|
||||
{{claim.id }} || {{claim.userMail }} ||
|
||||
{{claim | json}} {{claim | json}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!id">
|
||||
<p>No proper id...</p>
|
||||
</div>
|
|
@ -1,38 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
import {ClaimsService} from '../../services/claims.service';
|
||||
import {Claim} from '../../entities/claim';
|
||||
|
||||
@Component({
|
||||
selector: 'claim',
|
||||
templateUrl: 'src/app/claimPages/claim/claim.component.html',
|
||||
providers:[ ClaimsService, JSONP_PROVIDERS, ...ROUTER_DIRECTIVES]
|
||||
|
||||
})
|
||||
export class ClaimComponent {
|
||||
constructor (private _claimService: ClaimsService,
|
||||
private _routeParams: RouteParams) {}
|
||||
ngOnInit() {
|
||||
|
||||
this.id = this._routeParams.get('id');
|
||||
if(this.id!=null){
|
||||
this.getClaim(this.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
id : string;
|
||||
claim : any;
|
||||
getClaim (id: string) {
|
||||
this._claimService.getClaim(id)
|
||||
.then(data => {
|
||||
this.claim = data;
|
||||
console.log(data);
|
||||
}) ;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
<div class="container">
|
||||
|
||||
|
||||
<!-- KI
|
||||
<h3>Filter claims by type:</h3>
|
||||
<form>
|
||||
<select [(ngModel)]="fetchBy">
|
||||
<option *ngFor="let type of types" [value]="type">{{type}}</option>
|
||||
</select>
|
||||
<input type="text" [(ngModel)]="fetchId" />
|
||||
<button class="btn btn-default" type = "submit" (click)="goTo()">Fetch</button>
|
||||
</form>
|
||||
-->
|
||||
|
||||
<!-- KI-->
|
||||
|
||||
<div class="row row-offcanvas row-offcanvas-right">
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<div class="panel panel-default">
|
||||
<!-- Default panel contents -->
|
||||
<div class="panel-heading">Claims related to</div>
|
||||
<!-- List group -->
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<label> <input [(ngModel)]="projectCB" type="checkbox" (ngModelChange)="changeType()" /> Project </label>
|
||||
</p>
|
||||
<p>
|
||||
<label> <input [(ngModel)]="publicationCB" type="checkbox" (ngModelChange)="changeType()" /> Publication </label>
|
||||
</p>
|
||||
<p>
|
||||
<label> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" /> Dataset </label>
|
||||
</p>
|
||||
<p>
|
||||
<label> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" /> Context </label>
|
||||
</p>
|
||||
<p class="align-right">
|
||||
<button class="btn btn-primary" (click)="clearFilters()">Clear filters</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" id="sidebar">
|
||||
<h4 *ngIf="resultsNum>0" >Showing {{(size*page - size +1)}} to {{(size*page>resultsNum)?resultsNum:(size*page)}} of {{resultsNum}} claims</h4>
|
||||
<div *ngIf="resultsNum>size*page " class="text-right">
|
||||
<span class="dropdown">
|
||||
Show <button class="btn btn-default dropdown-toggle" type="button" id="pagingDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
{{size}}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="pagingDropdown">
|
||||
<li *ngIf="resultsNum > 10" ><a (click)="size=10 " >10 </a></li>
|
||||
<li *ngIf="resultsNum > 20" ><a (click)="size = 20 " >20 </a></li>
|
||||
<li *ngIf="resultsNum > 30" ><a (click)="size = 30 " >30 </a></li>
|
||||
<li *ngIf="resultsNum > 50" ><a (click)="size = 50 " >50 </a></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-right" *ngIf="resultsNum">
|
||||
<!--<paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [size]="size" [params]="getParameters()" > </paging>-->
|
||||
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [params]="getParameters()" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
<!-- Buttons for selecting and Delete Claims -->
|
||||
<div *ngIf="enableDelete">
|
||||
<div *ngIf="selected.length>0 && resultsNum > 0 ">
|
||||
<div class = "alert alert-success " >
|
||||
You have selected {{selected.length}} claim(s)
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-default" (click)="selectAll()">Select All</button> <button class="btn btn-default" (click)="deselectAll()">Deselect All</button> <button class="btn btn-default" (click)="confirmOpen()">Delete</button>
|
||||
</div>
|
||||
<br>
|
||||
<div class="input-group col-lg-6">
|
||||
<span class="input-group-addon" id="sizing-addon2">Filter</span>
|
||||
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" >
|
||||
</div>
|
||||
|
||||
<div *ngIf=" claims && claims.length == 0" class = "alert alert-info " >No entries found.</div>
|
||||
|
||||
<div class="">
|
||||
<table *ngIf="claims && claims.length > 0" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngIf="enableDelete"></th>
|
||||
<!--<th>Id</th>
|
||||
<!-- <th>Target Type</th> -->
|
||||
<th><a (click)="changeOrderby('target')" >Research Result</a> </th>
|
||||
<!--<th>Source type</th> -->
|
||||
<th><a (click)="changeOrderby('source')" >Link to</a> </th>
|
||||
|
||||
<th><a (click)="changeOrderby('user')" >Claimed by</a> </th>
|
||||
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let claim of claims " >
|
||||
<td *ngIf="enableDelete"><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="selectAllClaims"/></td>
|
||||
|
||||
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td>
|
||||
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>
|
||||
<td>{{claim.userMail}}</td>
|
||||
<td>{{claim.date}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<alert (alertOutput)="confirmClose($event)">
|
||||
</alert>
|
||||
<loading [message]= "'Please wait...'"></loading>
|
|
@ -1,377 +0,0 @@
|
|||
import {Component, ViewChild, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Location} from '@angular/common';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimsService} from '../../services/claims.service';
|
||||
import {Claim} from '../../entities/claim';
|
||||
import {ClaimTextFilterPipe} from '../../pipes/claimTextFilter.pipe';
|
||||
import {ClaimTypeFilterPipe} from '../../pipes/claimTypeFilter.pipe';
|
||||
import {PagingFormatter} from '../../common/pagingFormatter.component';
|
||||
import {pagingFormatterNoLoad} from '../../common/pagingFormatterNoLoad.component';
|
||||
import {ClaimEntityFormatter} from '../../common/claimEntityFormatter.component';
|
||||
import {Alert} from '../../common/modal/alert';
|
||||
import {Loading} from '../../common/modal/loading.component';
|
||||
|
||||
@Component({
|
||||
selector: 'claims',
|
||||
directives: [...ROUTER_DIRECTIVES, PagingFormatter, pagingFormatterNoLoad, ClaimEntityFormatter, Alert, Loading],
|
||||
templateUrl: 'src/app/claimPages/claims/claims.component.html',
|
||||
providers:[ ClaimsService, JSONP_PROVIDERS],
|
||||
pipes: [ClaimTextFilterPipe, ClaimTypeFilterPipe]
|
||||
|
||||
})
|
||||
export class ClaimsComponent {
|
||||
constructor (private _claimService: ClaimsService, private _routeParams: RouteParams, private _router:Router, private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info(this.isAdmin+" "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
|
||||
if( this.myClaims == 'true' ){
|
||||
console.info("Is myclaims");
|
||||
this.fetchBy = "User";
|
||||
}else{
|
||||
console.info("Is admin");
|
||||
|
||||
console.info(this.isAdmin);
|
||||
|
||||
this.fetchBy = this._routeParams.get('fetchBy');
|
||||
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
|
||||
this.fetchId = this._routeParams.get('fetchId');
|
||||
console.info("Fetch by:"+this.fetchBy+"Fetch id:"+this.fetchId);
|
||||
this.fetchId=this.fetchId?this.fetchId:'';
|
||||
|
||||
}
|
||||
console.info(this.isAdmin+" "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
|
||||
|
||||
let page = +this._routeParams.get('page');
|
||||
let size = +this._routeParams.get('size');
|
||||
this.keyword = (this._routeParams.get('keyword')?this._routeParams.get('keyword'):"");
|
||||
this.inputkeyword = this.keyword;
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.size = ( size <= 0 ) ? 10 : size;
|
||||
this.entityTypes = (this._routeParams.get('types')?this._routeParams.get('types'):'');
|
||||
this.setTypes(); // check the appropriate checkboxes
|
||||
this.setSortby(this._routeParams.get('sort'));
|
||||
this.getClaims();
|
||||
|
||||
}
|
||||
//string because comes as input from component directive
|
||||
@Input() enableDelete: string = 'false';
|
||||
@Input() myClaims: string= 'false' ;
|
||||
@Input() isAdmin:string = 'false';
|
||||
page : number;
|
||||
size:number;
|
||||
keyword:string; // the keyword string to give to the request as parameter
|
||||
inputkeyword:string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing)
|
||||
lengths = [10,20,30,50];
|
||||
types = ["All","Project","Context","Result","User"];
|
||||
@Input() fetchBy:string;
|
||||
@Input() fetchId:string;
|
||||
|
||||
navigateTo: string = "Claims";
|
||||
resultsNum: number ;
|
||||
claims: string[];
|
||||
|
||||
@ViewChild (Loading) loading : Loading ;
|
||||
|
||||
//checkboxes:
|
||||
publicationCB = false;
|
||||
datasetCB = false;
|
||||
contextCB = false;
|
||||
projectCB = false;
|
||||
entityTypes : string ='' ;
|
||||
|
||||
descending = true;
|
||||
sortby = "date";
|
||||
|
||||
selected=[];
|
||||
selectAllClaims:boolean = false;
|
||||
|
||||
|
||||
|
||||
//params for pagingFormatter to use when navigate to page
|
||||
params;
|
||||
@ViewChild(Alert) alert;
|
||||
|
||||
claimsDeleted:number = 0;
|
||||
|
||||
getClaims () {
|
||||
this.selectAllClaims = false;
|
||||
this.selected=[];
|
||||
if(this.fetchBy =="Project" ){
|
||||
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, this.entityTypes).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}else if(this.fetchBy =="User"){
|
||||
console.info("Fetch by:"+this.fetchBy+"Fetch id:"+this.fetchId);
|
||||
|
||||
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, this.entityTypes).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}else if(this.fetchBy =="Result"){
|
||||
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, this.entityTypes).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}else if(this.fetchBy =="Context"){
|
||||
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, this.entityTypes).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= null;
|
||||
this.resultsNum= data.total;//data.length; //TODO get the total results num
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}else{
|
||||
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, this.entityTypes).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum = null;
|
||||
this.resultsNum= data.total;//data.length; //TODO get the total results num
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
goToClaim(claimId: number){
|
||||
this._router.navigate( ['Claim', { id: claimId}] );
|
||||
}
|
||||
goTo(page:number = 1){
|
||||
|
||||
this.page = page;
|
||||
|
||||
this.location.go(location.pathname,this.getParametersString());
|
||||
this.getClaims();
|
||||
// console.info("In goto - params( page:"+params.page+", size: "+params.size+", fetchId:"+params.fetchId);
|
||||
//this._router.navigate( [this.navigateTo,this.getParameters()] );
|
||||
}
|
||||
getParameters(){
|
||||
let params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() };
|
||||
return params;
|
||||
}
|
||||
getParametersString(){
|
||||
var params='';
|
||||
params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
|
||||
params+=(this.size==10?"":(params.length>0?'&':'')+"size="+this.size);
|
||||
params+=(this.entityTypes==''?"":(params.length>0?'&':'')+"types="+this.entityTypes);
|
||||
if(this.isAdmin === 'true'){
|
||||
params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
|
||||
params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
|
||||
}
|
||||
params+=(this. getSortby()=='datedesc'?"":(params.length>0?'&':'')+"sort="+this. getSortby());
|
||||
params+=(this.keyword==''?"":(params.length>0?'&':'')+"keyword="+this.keyword);
|
||||
return params;
|
||||
}
|
||||
changeLength(){
|
||||
this.goTo();
|
||||
}
|
||||
clearFilters(){
|
||||
this.keyword = '';
|
||||
this.inputkeyword = '';
|
||||
this.publicationCB = false;
|
||||
this.projectCB = false;
|
||||
this.datasetCB = false;
|
||||
this.contextCB = false;
|
||||
this.entityTypes = '';
|
||||
this.goTo();
|
||||
}
|
||||
changeOrderby(sortby:string){
|
||||
if(sortby==this.sortby){
|
||||
this.descending = !this.descending;
|
||||
}else{
|
||||
this.sortby = sortby;
|
||||
this.descending = false;
|
||||
}
|
||||
this.goTo();
|
||||
}
|
||||
setSortby(sortby:string){
|
||||
if(!sortby|| sortby == "datedesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "date";
|
||||
}else if(sortby == "dateasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "date";
|
||||
}else if(sortby == "userasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "user";
|
||||
}else if(sortby == "userdesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "user";
|
||||
}if(sortby =="sourceasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "source";
|
||||
}else if(sortby == "sourcedesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "source";
|
||||
}else if(sortby == "targetasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "target";
|
||||
}else if(sortby == "targetdesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "target";
|
||||
}
|
||||
}
|
||||
getSortby():string{
|
||||
if(this.descending){
|
||||
return this.sortby+"desc";
|
||||
}else{
|
||||
return this.sortby+"asc";
|
||||
}
|
||||
|
||||
}
|
||||
changeType(){
|
||||
console.debug("ChangingType: "+this.entityTypes+" types"+this.publicationCB+ this.datasetCB + this.contextCB + this.projectCB);
|
||||
if(this.publicationCB == true && this.datasetCB == true && this.contextCB == true && this.projectCB == true ){
|
||||
this.entityTypes="";
|
||||
}else{
|
||||
this.entityTypes = "";
|
||||
if(this.publicationCB == true){
|
||||
this.entityTypes = "publication";
|
||||
}
|
||||
if(this.datasetCB == true){
|
||||
this.entityTypes += (this.entityTypes.length > 0?",":"")+"dataset";
|
||||
}
|
||||
if(this.contextCB == true){
|
||||
this.entityTypes += (this.entityTypes.length > 0?",":"")+"context";
|
||||
}
|
||||
if(this.projectCB == true){
|
||||
this.entityTypes += (this.entityTypes.length > 0?",":"")+"project";
|
||||
}
|
||||
}
|
||||
console.debug("Type changed: "+this.entityTypes+" "+this.publicationCB+ this.datasetCB + this.contextCB + this.projectCB);
|
||||
this.goTo();
|
||||
}
|
||||
setTypes(){
|
||||
if(this.entityTypes.length > 0){
|
||||
if(this.entityTypes.indexOf("publication")!=-1){
|
||||
this.publicationCB = true;
|
||||
}
|
||||
if(this.entityTypes.indexOf("dataset")!=-1){
|
||||
this.datasetCB = true;
|
||||
}
|
||||
if(this.entityTypes.indexOf("project")!=-1){
|
||||
this.projectCB = true;
|
||||
}
|
||||
if(this.entityTypes.indexOf("context")!=-1){
|
||||
this.contextCB = true;
|
||||
}
|
||||
}
|
||||
if(this.publicationCB && this.datasetCB && this.contextCB && this.projectCB){
|
||||
this.entityTypes='';
|
||||
}else{
|
||||
if(this.publicationCB){
|
||||
this.entityTypes = "publication";
|
||||
}
|
||||
if(this.datasetCB){
|
||||
this.entityTypes = (this.entityTypes.length > 0?",":"")+"dataset";
|
||||
}
|
||||
if(this.contextCB){
|
||||
this.entityTypes = (this.entityTypes.length > 0?",":"")+"context";
|
||||
}
|
||||
if(this.projectCB){
|
||||
this.entityTypes = (this.entityTypes.length > 0?",":"")+"project";
|
||||
}
|
||||
}
|
||||
}
|
||||
changekeyword(){
|
||||
|
||||
if(this.inputkeyword.length >= 3 || this.inputkeyword.length == 0 ){
|
||||
this.keyword = this.inputkeyword;
|
||||
this.page = 1;
|
||||
this.goTo();
|
||||
}
|
||||
|
||||
}
|
||||
select(item:any,event){
|
||||
var value = event.currentTarget.checked;
|
||||
console.debug("value:"+value);
|
||||
if(value){
|
||||
this.selectAllClaims = false;
|
||||
this.selected.push(item);
|
||||
console.debug("select one more! with id:"+item.id);
|
||||
}else{
|
||||
|
||||
var index:number =this.selected.indexOf(item);
|
||||
console.info("Try to remove item from :"+this.selected.indexOf(item));
|
||||
if (index > -1) {
|
||||
this.selected.splice(index, 1);
|
||||
}
|
||||
console.info("Item removed "+this.selected.indexOf(item));
|
||||
}
|
||||
}
|
||||
selectAll(){
|
||||
this.selectAllClaims = true;
|
||||
this.selected = this.claims;
|
||||
}
|
||||
deselectAll(){
|
||||
this.selectAllClaims = false;
|
||||
this.selected = [];
|
||||
}
|
||||
|
||||
confirmOpen(){
|
||||
this.alert.cancelButton = true;
|
||||
this.alert.okButton = true;
|
||||
this.alert.alertTitle = "Delete "+this.selected.length+" claim(s)";
|
||||
this.alert.message = this.selected.length+" claims will be deleted. Do you want to proceed? ";
|
||||
this.alert.okButtonText = "Yes";
|
||||
this.alert.cancelButtonText = "No";
|
||||
this.alert.open();
|
||||
}
|
||||
confirmClose(data){
|
||||
this.delete();
|
||||
}
|
||||
delete(){
|
||||
this.loading.open();
|
||||
this.claimsDeleted = 0;
|
||||
for (var i = 0; i < this.selected.length; i++){
|
||||
var id =this.selected[i].id;
|
||||
var selected =this.selected[i].id;
|
||||
console.warn("Deleting claim with id:"+id);
|
||||
this.deleteById(id);
|
||||
//TODO for multiple concurrent
|
||||
}
|
||||
}
|
||||
deleteById(id:string){
|
||||
|
||||
console.warn("Deleting claim with id:"+id);
|
||||
// this._claimService.deleteClaimById(id);
|
||||
this._claimService.deleteClaimById(id).subscribe(
|
||||
res => {
|
||||
console.info('Delete response'+res.code );
|
||||
console.warn("Deleted claim with id:"+ id);
|
||||
//remove this claim from the
|
||||
let newClaims=this.claims;
|
||||
for (var _i = 0; _i < this.claims.length; _i++) {
|
||||
let claim = this.claims[_i];
|
||||
if(claim['id'] == id){
|
||||
newClaims.splice(_i, 1);
|
||||
}
|
||||
}
|
||||
//TODO should call getClaims???
|
||||
this.claimsDeleted++;
|
||||
this.claims = newClaims;
|
||||
if(this.claimsDeleted == this.selected.length){
|
||||
this.loading.close();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
pageChange($event) {
|
||||
var page:number = +$event.value
|
||||
this.goTo(page);
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
import {Component, ViewChild, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Location} from '@angular/common';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimsService} from '../../services/claims.service';
|
||||
import {Claim} from '../../entities/claim';
|
||||
import {ClaimTextFilterPipe} from '../../pipes/claimTextFilter.pipe';
|
||||
import {ClaimTypeFilterPipe} from '../../pipes/claimTypeFilter.pipe';
|
||||
import {PagingFormatter} from '../../common/pagingFormatter.component';
|
||||
import {pagingFormatterNoLoad} from '../../common/pagingFormatterNoLoad.component';
|
||||
import {ClaimEntityFormatter} from '../../common/claimEntityFormatter.component';
|
||||
import {Alert} from '../../common/modal/alert';
|
||||
import {Loading} from '../../common/modal/loading.component';
|
||||
import {ClaimsComponent} from './claims.component';
|
||||
|
||||
@Component({
|
||||
selector: 'claims',
|
||||
directives: [...ROUTER_DIRECTIVES , ClaimsComponent],
|
||||
template: `
|
||||
<div *ngIf="user" class="container">
|
||||
<div class="page-header">
|
||||
<h1> Claims Administrator </h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-right"><a [routerLink]=" ['/Linking']">Add more Links?</a></div>
|
||||
<claims enableDelete="true" myClaims="false" isAdim="true"></claims>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="!user" class="container">
|
||||
TODO login
|
||||
</div>
|
||||
`,
|
||||
|
||||
})
|
||||
export class ClaimsAdminComponent {
|
||||
constructor ( ) {
|
||||
|
||||
}
|
||||
user:string="argirok@di.uoa.gr";
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,259 +0,0 @@
|
|||
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimContextComponent} from '../linking/claimContext/claimContext.component';
|
||||
import {ClaimSelectedComponent} from '../linking/selected/selected.component';
|
||||
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
|
||||
|
||||
@Component({
|
||||
selector: 'inline-claim-context',
|
||||
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimSelectedComponent, ClaimInsertComponent],
|
||||
template: `
|
||||
|
||||
|
||||
<div *ngIf="showComp == 'true'" class="panel-body well well-lg">
|
||||
<div class="row" >
|
||||
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" inline="true" [showComponent]="showComp" > </claim-contexts>
|
||||
|
||||
<claim-selected [contexts]="contexts"
|
||||
(contextsChange)="contextsChange($event)"
|
||||
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
</div>
|
||||
<claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
|
||||
<button (click)="insert()" [class]="(enableButton)?'btn btn-xs btn-primary':'btn btn-primary btn-xs disabled'" style="float:right">Finish </button>
|
||||
<button (click)="cancel()" [class]="(enableButton)?'btn btn-xs btn-default ':'btn btn-xs btn-default disabled'" style="float:left">Cancel </button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <h3>Find Context</h3>
|
||||
|
||||
<div *ngIf="show=='context'" >
|
||||
|
||||
|
||||
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
||||
|
||||
<h3>Link to</h3>
|
||||
<claim-selected [contexts]="contexts"
|
||||
(contextsChange)="contextsChange($event)"
|
||||
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
|
||||
|
||||
|
||||
<button (click)="claim()" class="btn btn-primary btn-xs" style="float:right">Finish</button>
|
||||
|
||||
</div>
|
||||
<div *ngIf="show=='claim'" >
|
||||
<claim-insert showAccessRights="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
||||
</div>-->
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class InlineClaimContextComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
|
||||
}
|
||||
|
||||
@Input() public inlineEntity:any;
|
||||
@Input() public inlineType:string;
|
||||
|
||||
|
||||
contexts=[];
|
||||
publications;
|
||||
datasets;
|
||||
private show = 'context';
|
||||
private showComp:string = 'false';
|
||||
private enableButton:boolean=true;
|
||||
keyword: string = "";
|
||||
|
||||
@Output() contextAdded = new EventEmitter();
|
||||
|
||||
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
next(){
|
||||
if(this.inlineType === 'dataset'){
|
||||
this.datasets = [];
|
||||
this.datasets.push(this.inlineEntity[0]);
|
||||
}else if(this.inlineType === 'publication'){
|
||||
this.publications = [];
|
||||
this.publications.push(this.inlineEntity[0]);
|
||||
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
||||
}
|
||||
if( this.show == 'context'){
|
||||
this.show='claim';
|
||||
}
|
||||
}
|
||||
prev(){
|
||||
if(this.show == 'claim'){
|
||||
this.show = 'context';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contextsChange($event) {
|
||||
this.contexts=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
|
||||
showChange($event) {
|
||||
this.show=$event.value;
|
||||
if(this.show == "end"){
|
||||
//TODO
|
||||
this.contextAdded.emit({
|
||||
value: this.contexts
|
||||
});
|
||||
this.contexts = [];
|
||||
this.hideComponent();
|
||||
|
||||
}else if(this.show == "error"){
|
||||
this.showComponent();
|
||||
}
|
||||
}
|
||||
public toggle(){
|
||||
if(this.showComp == 'false'){
|
||||
this.showComponent();
|
||||
}else{
|
||||
this.hideComponent();
|
||||
}
|
||||
}
|
||||
private showComponent(){
|
||||
this.showComp='true';
|
||||
this.enableButton = true;
|
||||
|
||||
}
|
||||
private hideComponent(){
|
||||
this.showComp='false';
|
||||
}
|
||||
private insert(){
|
||||
this.claimInsert.publications = [];
|
||||
this.claimInsert.publications.push(this.inlineEntity[0]);
|
||||
this.publications = [];
|
||||
this.publications.push(this.inlineEntity[0]);
|
||||
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
||||
this.enableButton = false;
|
||||
this.claimInsert.insert();
|
||||
|
||||
}
|
||||
private cancel(){
|
||||
this.contexts = [];
|
||||
|
||||
this.hideComponent();
|
||||
}
|
||||
}
|
||||
|
||||
// import {Component, Input} from '@angular/core';
|
||||
// import {JSONP_PROVIDERS} from '@angular/http';
|
||||
// import {Observable} from 'rxjs/Observable';
|
||||
// import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
// import {ClaimContextComponent} from '../linking/claimContext/claimContext.component';
|
||||
// import {ClaimSelectedComponent} from '../linking/selected/selected.component';
|
||||
// import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
|
||||
//
|
||||
// @Component({
|
||||
// selector: 'inline-claim-context',
|
||||
// directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimSelectedComponent, ClaimInsertComponent],
|
||||
// template: `
|
||||
//
|
||||
//
|
||||
//
|
||||
// <div class="panel-body" >
|
||||
// <h6>Find Context:</h6>
|
||||
// <div *ngIf=" show == 'context' " class="row" >
|
||||
// <claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
||||
// <claim-selected [contexts]="contexts"
|
||||
// (contextsChange)="contextsChange($event)"
|
||||
// (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
// </div>
|
||||
// <div *ngIf=" show == 'claim'" >
|
||||
// <claim-selected [contexts]="contexts" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
// <claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
||||
// </div>
|
||||
// <nav>
|
||||
// <ul class="pager">
|
||||
// <li *ngIf="show != 'context'" class="previous" (click)="prev()"><a ><span aria-hidden="true">←</span> Previous</a></li>
|
||||
// <li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">→</span></a></li>
|
||||
// </ul>
|
||||
// </nav>
|
||||
//
|
||||
// </div>
|
||||
//
|
||||
// <!-- <h3>Find Context</h3>
|
||||
//
|
||||
// <div *ngIf="show=='context'" >
|
||||
//
|
||||
//
|
||||
// <claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
||||
//
|
||||
// <h3>Link to</h3>
|
||||
// <claim-selected [contexts]="contexts"
|
||||
// (contextsChange)="contextsChange($event)"
|
||||
// (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
//
|
||||
//
|
||||
//
|
||||
// <button (click)="claim()" class="btn btn-primary" style="float:right">Finish</button>
|
||||
//
|
||||
// </div>
|
||||
// <div *ngIf="show=='claim'" >
|
||||
// <claim-insert showAccessRights="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
||||
// </div>-->
|
||||
//
|
||||
// `
|
||||
//
|
||||
// })
|
||||
// export class InlineClaimContextComponent {
|
||||
// constructor ( private _router: Router ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Input() public inlineEntity:any;
|
||||
// @Input() public inlineType:string;
|
||||
//
|
||||
//
|
||||
// contexts=[];
|
||||
// publications;
|
||||
// datasets;
|
||||
// show = "context";
|
||||
// keyword: string = "";
|
||||
//
|
||||
// ngOnInit() {
|
||||
//
|
||||
// }
|
||||
// next(){
|
||||
// if(this.inlineType === 'dataset'){
|
||||
// this.datasets = [];
|
||||
// this.datasets.push(this.inlineEntity[0]);
|
||||
// }else if(this.inlineType === 'publication'){
|
||||
// this.publications = [];
|
||||
// this.publications.push(this.inlineEntity[0]);
|
||||
// console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
||||
// }
|
||||
// if( this.show == 'context'){
|
||||
// this.show='claim';
|
||||
// }
|
||||
// }
|
||||
// prev(){
|
||||
// if(this.show == 'claim'){
|
||||
// this.show = 'context';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// contextsChange($event) {
|
||||
// this.contexts=$event.value;
|
||||
// console.log($event.value);
|
||||
// }
|
||||
//
|
||||
// showChange($event) {
|
||||
// this.show=$event.value;
|
||||
// if(this.show == "end"){
|
||||
// this.contexts = [];
|
||||
// this.show = "context";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
|
@ -1,158 +0,0 @@
|
|||
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimProjectsComponent} from '../linking/claimProject/claimProject.component';
|
||||
import {ClaimSelectedComponent} from '../linking/selected/selected.component';
|
||||
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
|
||||
|
||||
@Component({
|
||||
selector: 'inline-claim-project',
|
||||
directives: [ROUTER_DIRECTIVES, ClaimProjectsComponent, ClaimSelectedComponent, ClaimInsertComponent],
|
||||
template: `
|
||||
|
||||
|
||||
<div *ngIf="showComp" class="panel-body well well-lg">
|
||||
<div class="row" >
|
||||
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" inline="true" > </claim-projects>
|
||||
|
||||
<claim-selected [projects]="projects"
|
||||
(projectsChange)="projectsChange($event)"
|
||||
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
</div>
|
||||
<claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
|
||||
<button (click)="insert()" [class]="(enableButton)?'btn btn-xs btn-primary':'btn btn-primary btn-xs disabled'" style="float:right">Finish </button>
|
||||
<button (click)="cancel()" [class]="(enableButton)?'btn btn-xs btn-default ':'btn btn-xs btn-default disabled'" style="float:left">Cancel </button>
|
||||
<!-- <div *ngIf=" show == 'claim'" >
|
||||
<claim-selected [projects]="projects" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
<claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
|
||||
</div>
|
||||
<nav>
|
||||
<ul class="pager">
|
||||
<li *ngIf="show != 'project'" class="previous" (click)="prev()"><a ><span aria-hidden="true">←</span> Previous</a></li>
|
||||
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">→</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!-- <h3>Find Project</h3>
|
||||
|
||||
<div *ngIf="show=='project'" >
|
||||
|
||||
|
||||
<claim-projects [selectedList]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
|
||||
|
||||
<h3>Link to</h3>
|
||||
<claim-selected [projects]="projects"
|
||||
(projectsChange)="projectsChange($event)"
|
||||
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
||||
|
||||
|
||||
|
||||
<button (click)="claim()" class="btn btn-primary btn-xs" style="float:right">Finish</button>
|
||||
|
||||
</div>
|
||||
<div *ngIf="show=='claim'" >
|
||||
<claim-insert showAccessRights="true" [projects]="projects" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
||||
</div>-->
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class InlineClaimProjectComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
|
||||
}
|
||||
|
||||
@Input() public inlineEntity:any;
|
||||
@Input() public inlineType:string;
|
||||
|
||||
|
||||
projects=[];
|
||||
publications;
|
||||
datasets;
|
||||
private show = 'project';
|
||||
private showComp:boolean = false;
|
||||
private enableButton:boolean=true;
|
||||
keyword: string = "";
|
||||
|
||||
@Output() projectAdded = new EventEmitter();
|
||||
|
||||
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
next(){
|
||||
if(this.inlineType === 'dataset'){
|
||||
this.datasets = [];
|
||||
this.datasets.push(this.inlineEntity[0]);
|
||||
}else if(this.inlineType === 'publication'){
|
||||
this.publications = [];
|
||||
this.publications.push(this.inlineEntity[0]);
|
||||
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
||||
}
|
||||
if( this.show == 'project'){
|
||||
this.show='claim';
|
||||
}
|
||||
}
|
||||
prev(){
|
||||
if(this.show == 'claim'){
|
||||
this.show = 'project';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
projectsChange($event) {
|
||||
this.projects=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
|
||||
showChange($event) {
|
||||
this.show=$event.value;
|
||||
if(this.show == "end"){
|
||||
//TODO
|
||||
this.projectAdded.emit({
|
||||
value: this.projects
|
||||
});
|
||||
this.projects = [];
|
||||
this.hideComponent();
|
||||
|
||||
}else if(this.show == "error"){
|
||||
this.showComponent();
|
||||
}
|
||||
}
|
||||
public toggle(){
|
||||
console.info("TOOGLE pr ");
|
||||
if(!this.showComp){
|
||||
console.info("TOOGLE show ");
|
||||
this.showComponent();
|
||||
}else{
|
||||
console.info("TOOGLE hide ");
|
||||
this.hideComponent();
|
||||
}
|
||||
}
|
||||
private showComponent(){
|
||||
this.showComp=true;
|
||||
this.enableButton = true;
|
||||
|
||||
}
|
||||
private hideComponent(){
|
||||
this.showComp=false;
|
||||
}
|
||||
private insert(){
|
||||
this.claimInsert.publications = [];
|
||||
this.claimInsert.publications.push(this.inlineEntity[0]);
|
||||
this.publications = [];
|
||||
this.publications.push(this.inlineEntity[0]);
|
||||
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
||||
this.enableButton = false;
|
||||
this.claimInsert.insert();
|
||||
|
||||
}
|
||||
private cancel(){
|
||||
this.projects = [];
|
||||
|
||||
this.hideComponent();
|
||||
}
|
||||
}
|
|
@ -1,274 +0,0 @@
|
|||
import {Component, Input,Output, ElementRef, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
import {ContextsService} from '../../../services/contexts.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'claim-contexts',
|
||||
template: `
|
||||
<div class="panel-body" >
|
||||
|
||||
<div class="input-group" *ngIf="inline === 'false'">
|
||||
<div class=" input-group-btn">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCommunityLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
|
||||
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
|
||||
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group-btn ">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCategoryLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
|
||||
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
|
||||
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input id="community" type="text" class="validate filter-input form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
|
||||
</div>
|
||||
<div class=" form-horizontal" *ngIf="inline === 'true' && showComponent=='true'">
|
||||
<div class=" form-group ">
|
||||
<button class="btn btn-xs btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCommunityLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
|
||||
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
|
||||
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group ">
|
||||
<button class="btn btn-xs btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCategoryLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
|
||||
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
|
||||
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="community" type="text" class="validate filter-input input-sm form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--<div class="input-group">
|
||||
<div class=" input-group-btn">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCommunityLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
|
||||
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
|
||||
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group-btn ">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{selectedCategoryLabel}}
|
||||
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
|
||||
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
|
||||
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input id="community" type="text" class="validate filter-input form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
|
||||
</div>-->
|
||||
|
||||
|
||||
|
||||
<div class="suggestions" *ngIf="filteredList.length > 0">
|
||||
<ul class="list-group" >
|
||||
<li class="list-group-item" *ngFor=" let item of filteredList">
|
||||
<a (click)="select(item)">{{item.label}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
|
||||
`,
|
||||
providers:[ ContextsService ]
|
||||
|
||||
})
|
||||
export class ClaimContextComponent {
|
||||
ngOnInit() {
|
||||
this.getCommunities();
|
||||
|
||||
}
|
||||
@Input() public inline= 'false' ; // for claimed started from landing pages
|
||||
@Input() public showComponent= 'true' ; // for claimed started from landing pages
|
||||
|
||||
public query = '';
|
||||
public filteredList = [];
|
||||
@Input() public selectedList ;
|
||||
public elementRef;
|
||||
@Output() contextsChange = new EventEmitter();
|
||||
|
||||
public communities:string[];
|
||||
@Input() public selectedCommunityId:string = "0";
|
||||
selectedCommunityLabel:string = "Community:";
|
||||
@Output() cselectedCommunityChange = new EventEmitter();
|
||||
|
||||
public categories:string[];
|
||||
@Input() public selectedCategoryId:string ="0";
|
||||
selectedCategoryLabel:string ="Category:";
|
||||
@Output() selectedCategoryChange = new EventEmitter();
|
||||
public concepts:string[];
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
constructor(private _contextService: ContextsService,myElement: ElementRef) {
|
||||
this.elementRef = myElement;
|
||||
}
|
||||
|
||||
filter() {
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
if(this.selectedCommunityId == "0"){
|
||||
this.warningMessage = "Please select Community";
|
||||
}else if (this.query !== ""){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
if(this.selectedCategoryId == "0"){
|
||||
this.warningMessage = "Specify category for more concepts";
|
||||
}
|
||||
this.filteredList = this.concepts.filter(function(el){
|
||||
return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
|
||||
}.bind(this));
|
||||
if(this.filteredList.length == 0 ){
|
||||
this.infoMessage = "No results found";
|
||||
}
|
||||
}else{
|
||||
this.filteredList = [];
|
||||
}
|
||||
}
|
||||
|
||||
select(item){
|
||||
this.query = "";
|
||||
this.filteredList = [];
|
||||
var context= { community: this.selectedCommunityLabel, category: this.selectedCategoryLabel, concept: item };
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
for (var _i = 0; _i < this.selectedList.length; _i++) {
|
||||
let item = this.selectedList[_i];
|
||||
if(item.concept.id == context.concept.id){
|
||||
found=true;
|
||||
this.warningMessage = "Concept already in selected list";
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this.selectedList.push(context);
|
||||
this.contextsChange.emit({
|
||||
value: this.selectedList
|
||||
});
|
||||
}
|
||||
// var index:number =this.selectedList.indexOf(context);
|
||||
// if (index == -1) {
|
||||
// this.selectedList.push(context);
|
||||
// this.contextsChange.emit({
|
||||
// value: this.selectedList
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
// remove(item){
|
||||
// var index:number =this.selectedList.indexOf(item);
|
||||
// if (index > -1) {
|
||||
// this.selectedList.splice(index, 1);
|
||||
// }
|
||||
// this.contextsChange.emit({
|
||||
// value: this.selectedList
|
||||
// });
|
||||
// }
|
||||
handleClick(event){
|
||||
var clickedComponent = event.target;
|
||||
var inside = false;
|
||||
do {
|
||||
if (clickedComponent === this.elementRef.nativeElement) {
|
||||
inside = true;
|
||||
}
|
||||
clickedComponent = clickedComponent.parentNode;
|
||||
} while (clickedComponent);
|
||||
if(!inside){
|
||||
this.filteredList = [];
|
||||
}
|
||||
}
|
||||
getCommunities () {
|
||||
this._contextService.getCommunities().subscribe(
|
||||
data => {
|
||||
this.communities = data.communities;
|
||||
// var concept= ["{id: this.communities['id'], label: this.communities['label'] }"];
|
||||
// this.filteredList.push(concept);
|
||||
// this.concepts.push(concept);
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
getCategories () {
|
||||
this.categories=[];
|
||||
if(this.selectedCommunityId != '0'){
|
||||
this._contextService.getCategories(this.selectedCommunityId).subscribe(
|
||||
data => {
|
||||
this.categories = data.category;
|
||||
this.concepts = [];
|
||||
this.filteredList = [];
|
||||
if (this.query !== ""){
|
||||
this.filter();
|
||||
}
|
||||
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
getConcepts () {
|
||||
if(this.selectedCategoryId != '0'){
|
||||
this._contextService.getConcepts(this.selectedCategoryId, "").subscribe(
|
||||
data => {
|
||||
this.concepts = data.concept;
|
||||
if (this.query !== ""){
|
||||
this.filter();
|
||||
}
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}else{
|
||||
this.concepts=[];
|
||||
}
|
||||
}
|
||||
communityChanged(communityId:string, communityLabel:string){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
this.selectedCommunityId= communityId;
|
||||
this.selectedCommunityLabel= communityLabel;
|
||||
this.getCategories();
|
||||
|
||||
}
|
||||
categoryChanged(categoryId:string, categoryLabel:string){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
this.selectedCategoryId = categoryId;
|
||||
this.selectedCategoryLabel = categoryLabel;
|
||||
this.getConcepts();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
import {OpenaireProjectsService} from '../../../services/openaireProjects.service';
|
||||
import {Loading} from '../../../common/modal/loading.component';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-projects',
|
||||
template: `
|
||||
<div class="panel-body" >
|
||||
|
||||
<!-- <select [(ngModel)]="selectedFunderId" (ngModelChange)="funderChanged()" >
|
||||
<option [ngValue]="'0'">Funder:</option>
|
||||
<option *ngFor="let funder of funders" [ngValue]="funder.field.field[1]['@value_original']">{{funder.field.field[1]['@value']}}</option>
|
||||
</select> -->
|
||||
|
||||
<form *ngIf="(inline == 'false')">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn" >
|
||||
<button type="button" class="btn btn-info dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
{{selectedFunderName}}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
|
||||
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" -->
|
||||
<input id="community" type="text" class="form-control" placeholder="Search for Projects" [(ngModel)]=query >
|
||||
<span class="input-group-btn" >
|
||||
<button type="submit" (click)="filter()" class="btn btn-default" >Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<form *ngIf="(inline == 'true')" class="form-horizontal">
|
||||
<div class="">
|
||||
<div class="form-group" >
|
||||
<button type="button" class="btn btn-xs btn-info dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
{{selectedFunderName}}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
|
||||
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
|
||||
|
||||
</ul>
|
||||
</div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" -->
|
||||
<div class="form-group"> <input id="community" type="text" class="form-control input-sm" placeholder="Search for Projects" [(ngModel)]=query ></div>
|
||||
<div class="form-group" >
|
||||
<button type="submit" (click)="filter()" class="btn btn-xs btn-default" >Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="suggestions" *ngIf="filteredList.length > 0">
|
||||
<ul class="list-group" >
|
||||
<li *ngFor=" let item of filteredList" class="list-group-item" >
|
||||
<a (click)="select(item)"> {{(item.field[1]['@value'])?item.field[1]['@value']+" - ":""}} {{item.field[3]['@value']}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- <div class="selections" *ngIf="selectedProjects.length > 0">
|
||||
<label for="selecteditems">Selected: </label>
|
||||
<ul id ="selecteditems" class="nav nav-pills" >
|
||||
<li *ngFor="let item of selectedProjects" role="presentation" (click)="remove(item)">{{item.projectId}} - {{item.projectAcronym}} - {{item.projectName}} <span class="badge">X</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
<loading [message]= "'Loading...'"></loading>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
|
||||
`,
|
||||
providers:[ OpenaireProjectsService ],
|
||||
directives: [Loading]
|
||||
|
||||
})
|
||||
export class ClaimProjectsComponent {
|
||||
ngOnInit() {
|
||||
console.info("Claim projects - init ....");
|
||||
this.getFunders();
|
||||
|
||||
}
|
||||
@Input() public inline= 'false' ; // for claimed started from landing pages
|
||||
public query = '';
|
||||
public filteredList = [];
|
||||
@Input() public selectedProjects=[] ;
|
||||
public elementRef;
|
||||
@Output() projectsChange = new EventEmitter();
|
||||
|
||||
public funders:string[];
|
||||
@Input() public selectedFunderId:string ="0";
|
||||
selectedFunderName:string ="Select funder:";
|
||||
@Output() cselectedFunderChange = new EventEmitter();
|
||||
|
||||
public projects:string[];
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
// @ViewChild (Loading) loading : Loading ;
|
||||
|
||||
|
||||
constructor(private _projectService: OpenaireProjectsService,myElement: ElementRef) {
|
||||
this.elementRef = myElement;
|
||||
}
|
||||
|
||||
filter() {
|
||||
console.info("Search projects");
|
||||
if (this.selectedFunderId == '0' ){
|
||||
this.warningMessage = "Please select a funder first";
|
||||
this.infoMessage = "";
|
||||
}else if ( this.query == "" || this.query.length < 3){
|
||||
this.warningMessage = "Please type a keyword, containing at least 3 characters"
|
||||
this.infoMessage = "";
|
||||
}else{
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
// this.loading.open();
|
||||
this._projectService.searchForProjects(this.query, this.selectedFunderId).subscribe(
|
||||
data => {
|
||||
this.filteredList =(data == null)?[]:data;
|
||||
this.infoMessage = (data == null)?"No Results found":"";
|
||||
// this.loading.close();
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
// this.loading.close();
|
||||
this.warningMessage = "An error occured";
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
select(item){
|
||||
this.query = "";
|
||||
this.filteredList = [];
|
||||
var project= { funderId: this.selectedFunderId,funderName: this.selectedFunderName, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] };
|
||||
var index:number =this.selectedProjects.indexOf(project);
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
for (var _i = 0; _i < this.selectedProjects.length; _i++) {
|
||||
let item = this.selectedProjects[_i];
|
||||
if(item.projectId == project.projectId){
|
||||
found=true;
|
||||
this.warningMessage = "Project already in selected list";
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this.selectedProjects.push(project);
|
||||
this.projectsChange.emit({
|
||||
value: this.selectedProjects
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
remove(item){
|
||||
var index:number =this.selectedProjects.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.selectedProjects.splice(index, 1);
|
||||
}
|
||||
this.projectsChange.emit({
|
||||
value: this.selectedProjects
|
||||
});
|
||||
}
|
||||
handleClick(event){
|
||||
var clickedComponent = event.target;
|
||||
var inside = false;
|
||||
do {
|
||||
if (clickedComponent === this.elementRef.nativeElement) {
|
||||
inside = true;
|
||||
}
|
||||
clickedComponent = clickedComponent.parentNode;
|
||||
} while (clickedComponent);
|
||||
if(!inside){
|
||||
this.filteredList = [];
|
||||
}
|
||||
}
|
||||
getFunders () {
|
||||
console.info("Getting Funders....");
|
||||
this._projectService.getFunders().subscribe(
|
||||
data => {
|
||||
this.funders = data;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
getProjects () {
|
||||
if(this.selectedFunderId != '0'){
|
||||
|
||||
}
|
||||
}
|
||||
funderChanged(funderId:string, funderName:string){
|
||||
this.selectedFunderId = funderId;
|
||||
this.selectedFunderName = funderName;
|
||||
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {pagingFormatterNoLoad} from '../../../../common/pagingFormatterNoLoad.component';
|
||||
import {PublicationTitleFormatter} from '../../../../common/publicationTitleFormatter.component';
|
||||
import {SearchDataciteService} from '../../../../services/searchDatacite.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'claim-dataset',
|
||||
directives: [...ROUTER_DIRECTIVES,pagingFormatterNoLoad, PublicationTitleFormatter],
|
||||
template: `
|
||||
<!--
|
||||
<h3>Selected Results:</h3>
|
||||
<div >
|
||||
<p *ngFor=" let item of selectedDatasets "> <publication-title [title]="item.result.title" [url]="'http://dx.doi.org/'+item.result.doi" > </publication-title> {{item.result.doi}} --{{item.result.publisher}}<button type="button" class="close" (click)="remove(item)" aria-label="Close"> <span aria-hidden="true">×</span></button> </p>
|
||||
</div>
|
||||
-->
|
||||
<!-- <div class="panel">
|
||||
<div class="">
|
||||
<form>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Dataset</span>
|
||||
<input class=" form-control" #term [(ngModel)]="keyword"/>
|
||||
<span class="input-group-btn">
|
||||
<button (click)="searchDatacite(term.value,10,1)" type="submit" class="btn btn-default">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>-->
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
|
||||
|
||||
<div class="panel ">
|
||||
<div class="">
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{(dataciteResultsNum==null)?'0':dataciteResultsNum}})</a></li>
|
||||
<li><a data-toggle="tab" href="#openaire">Openaire ({{(openaireResultsNum==null)?'0':openaireResultsNum}})</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="datacite" class="tab-pane fade in active">
|
||||
<div class = "panel-body">
|
||||
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0">
|
||||
<p > {{dataciteResultsNum }} Total Results </p>
|
||||
<paging-no-load [currentPage]="page" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
<div *ngIf="dataciteResultsNum == null || dataciteResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
|
||||
<div >
|
||||
<!-- <p *ngFor=" let item of dataciteResults ">
|
||||
<publication-title [title]="item.title" [url]="'http://dx.doi.org/'+item.doi" > </publication-title>
|
||||
<button (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi)" type="button" class="btn btn-default">Select</button>
|
||||
</p>
|
||||
-->
|
||||
<ul *ngIf="dataciteResults.length > 0 " class="list-group">
|
||||
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.doi))?'list-group-item panel-footer':'list-group-item'" >
|
||||
<span >
|
||||
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" >{{item.title}}</a>
|
||||
<span *ngIf="!item.doi" >{{item.title}}</span>
|
||||
</span>
|
||||
<span *ngIf="!isSelected(item.doi)" (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openaire" class="tab-pane fade">
|
||||
<div class = "panel-body">
|
||||
<div class = "alert alert-info " > Under Development....
|
||||
</div>
|
||||
<div *ngIf="openaireResultsNum == null || openaireResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, SearchDataciteService]
|
||||
})
|
||||
export class ClaimDatasetComponent {
|
||||
constructor (private _searchDataciteService: SearchDataciteService,
|
||||
private _routeParams: RouteParams) {
|
||||
var myDate = new Date();
|
||||
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
if(this.keyword !=null && this.keyword.length > 0){
|
||||
this.searchDatacite(this.keyword,this.size,this.page);
|
||||
}
|
||||
}
|
||||
|
||||
private page : number = 1;
|
||||
private size:number = 10;
|
||||
private navigateTo: string = "Search";
|
||||
private source: string = "datacite";
|
||||
private type : string = "dataset";
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public keyword:string = '';
|
||||
@Input() public selectedDatasets = [] ;
|
||||
@Output() datasetsChange = new EventEmitter();
|
||||
|
||||
dataciteResults=[];
|
||||
dataciteResultsNum : Observable<number> = null;
|
||||
openaireResults=[];
|
||||
openaireResultsNum : Observable<number> = null ;
|
||||
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
private todayDate = '';
|
||||
private nextDate = '';
|
||||
public search(term: string, size : number, page : number){
|
||||
this.searchDatacite(term,10,1);
|
||||
//TODO add openaire search
|
||||
}
|
||||
private searchDatacite (term: string, size : number, page : number) {
|
||||
this.getDataciteResults(term,size,page);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
|
||||
getDataciteResults (term: string, size : number, page : number) {
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data.docs;
|
||||
this.page=page;
|
||||
this.dataciteResultsNum = data.numFound;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
add(item, itemId,itemType,itemSource,itemTitle, itemUrl){
|
||||
var result ;
|
||||
if(itemSource == 'datacite'){
|
||||
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate};
|
||||
}else if (itemSource == 'openaire'){
|
||||
|
||||
}
|
||||
var found:boolean = this.isSelected( result.id);
|
||||
this.warningMessage = "";
|
||||
if (!found) {
|
||||
this.selectedDatasets.push(result);
|
||||
this.datasetsChange.emit({
|
||||
value: this.selectedDatasets
|
||||
});
|
||||
}else{
|
||||
this.warningMessage = "Dataset already in selected list";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
pageChange($event) {
|
||||
this.page=$event.value;
|
||||
this.dataciteResults=[];
|
||||
this.searchDatacite(this.keyword,10,this.page);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
isSelected(id:string){
|
||||
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
for (var _i = 0; _i < this.selectedDatasets.length; _i++) {
|
||||
let item = this.selectedDatasets[_i];
|
||||
if(item.id == id){
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
|
||||
<!--<h3>Selected Results:</h3>
|
||||
<div >
|
||||
<p *ngFor=" let item of selectedPublications "> <publication-title [title]="item.result.title" [url]="item.result.URL" > </publication-title> {{item.result.DOI}} --{{item.result.publisher}} <button (click)="remove(item)" type="button" class="btn btn-default">Remove</button></p>
|
||||
</div>
|
||||
-->
|
||||
<!-- (keyup)="searchCrossref(term.value)" -->
|
||||
<div class="panel">
|
||||
<form>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Publication</span>
|
||||
<input class=" form-control" #term [(ngModel)]="keyword"/>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" (click)="search(term.value,10,1)" class="btn btn-default">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{crossrefResultsNum}})</a></li>
|
||||
<li><a data-toggle="tab" href="#openaire">Openaire ({{openaireResultsNum}})</a></li>
|
||||
<li><a data-toggle="tab" href="#orcid">Orcid ({{orcidResultsNum}})</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="crossref" class="tab-pane fade in active">
|
||||
<div>
|
||||
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0">
|
||||
<p > {{crossrefResultsNum }} Total Results </p>
|
||||
<paging-no-load [currentPage]="page" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div *ngFor=" let item of crossrefResults " [class]=" isSelected(item)?'panel-heading':'panel-body' ">
|
||||
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
|
||||
<p *ngIf="!item.URL" target="_blank" >{{item.title}}</p>
|
||||
<!--<publication-title [title]="item.title" [url]="item.URL" > </publication-title>-->
|
||||
<button (click)="add(item,'crossref', 'publication', item.URL, item.title)" type="button" class="btn btn-default" style="float:right; ">Select</button> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openaire" class="tab-pane fade">
|
||||
|
||||
<p>TODO put openaire results here...</p>
|
||||
</div>
|
||||
<div id="orcid" class="tab-pane fade">
|
||||
<!--
|
||||
<p *ngIf="orcidResultsNum == null"> No authors found for keyword: {{keyword}} </p>
|
||||
|
||||
<div *ngIf="orcidResultsNum != null">
|
||||
<p> Not the right author? Choose one of these: </p>
|
||||
|
||||
<div class="dropdown">
|
||||
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu" aria-labelledby="orcidDropDown">
|
||||
<li *ngFor=" let item of authorIds let i = index" (click)="getOrcidResultsById(i)" role="button">
|
||||
{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}}
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<br/>
|
||||
<h4> {{orcidResultsNum }} Total Results for author
|
||||
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} : {{authorId}} </a>
|
||||
</h4>
|
||||
<br/>
|
||||
|
||||
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " >
|
||||
<paging-no-load [currentPage]="page" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf=" orcidResultsNum > 0" class="panel panel-default">
|
||||
|
||||
<!--<div [class]=" isSelected(item)?'panel-heading':'panel-body' " *ngFor=" let item of orcidResultsToShow ">
|
||||
{{item['work-title']['title'].value}} ({{item['publication-date']['year'].value}}) </div>-->
|
||||
<!--
|
||||
<div [class]=" isSelected(item)?'panel-heading':'panel-body' " *ngFor=" let item of orcidResultsToShow ">
|
||||
<!--<a *ngIf="url" target="_blank" href="{{item.URL}}" >{{item['work-title']['title'].value}}</a> -->
|
||||
{{item['work-title']['title'].value}}
|
||||
<!--<publication-title [title]="item.title" [url]="item.URL" > </publication-title>-->
|
||||
<!-- <button (click)="add(item,'orcid', 'publication', '', {{item['work-title']['title'].value}} )" type="button" class="btn btn-default" style="float:right; ">Select</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,76 +0,0 @@
|
|||
|
||||
<div class="panel">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{(crossrefResultsNum)?crossrefResultsNum:0}})</a></li>
|
||||
<li><a data-toggle="tab" href="#openaire">Openaire ({{ (openaireResultsNum)?openaireResultsNum:0 }})</a></li>
|
||||
<li><a data-toggle="tab" href="#orcid">Orcid ({{ (orcidResultsNum)?orcidResultsNum:0}})</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="crossref" class="tab-pane fade in active">
|
||||
<div class="panel-body" >
|
||||
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0">
|
||||
<paging-no-load [currentPage]="page" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="crossrefResults.length > 0 " class="list-group">
|
||||
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'list-group-item panel-footer':'list-group-item'">
|
||||
<span >
|
||||
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
|
||||
<span *ngIf="!item.URL" >{{item.title}}</span>
|
||||
</span>
|
||||
<span *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="crossrefResults.length == 0" class = "alert alert-info " > No results found </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openaire" class="tab-pane fade">
|
||||
<div class = "panel-body">
|
||||
<div class = "alert alert-info " > Under Development....
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="orcid" class="tab-pane fade">
|
||||
<div class="panel-body" >
|
||||
<div *ngIf="orcidResultsNum == null" class = "alert alert-info " > No results found </div>
|
||||
|
||||
<div *ngIf="orcidResultsNum != null" class="panel-body">
|
||||
<div class = "alert alert-warning " > Not the right author? Choose one of these:
|
||||
|
||||
<span class="dropdown">
|
||||
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
Selected: {{authorGivenName}} {{authorFamilyName}}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="orcidDropDown">
|
||||
<li *ngFor=" let item of authorIds let i = index" > <a (click)="getOrcidResultsById(i)" >
|
||||
{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
|
||||
</div>
|
||||
<span>Results for
|
||||
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
|
||||
</span>
|
||||
|
||||
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " >
|
||||
<paging-no-load [currentPage]="page" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
|
||||
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="list-group">
|
||||
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['put-code']))?'list-group-item panel-footer':'list-group-item'">
|
||||
<span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
|
||||
<span *ngIf="!isSelected(authorId+item['put-code'])" (click)="add(item,authorId+'-'+item['put-code'],'orcid', 'publication', '', item['work-title']['title'].value)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="orcidResultsNum == 0" class = "alert alert-info " > No results found </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,246 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {SearchCrossrefService} from '../../../../services/searchCrossref.service';
|
||||
import {SearchOrcidService} from '../../../../services/searchOrcid.service';
|
||||
import {Publication} from '../../../../entities/publication';
|
||||
import {pagingFormatterNoLoad} from '../../../../common/pagingFormatterNoLoad.component';
|
||||
import {PublicationTitleFormatter} from '../../../../common/publicationTitleFormatter.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'claim-publication',
|
||||
directives: [...ROUTER_DIRECTIVES,pagingFormatterNoLoad, PublicationTitleFormatter],
|
||||
templateUrl: 'src/app/claimPages/linking/claimResult/claimPublication/claimPublication.component.html',
|
||||
providers:[JSONP_PROVIDERS, SearchCrossrefService, SearchOrcidService]
|
||||
})
|
||||
export class ClaimPublicationComponent {
|
||||
constructor (private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService,
|
||||
private _routeParams: RouteParams) {
|
||||
var myDate = new Date();
|
||||
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
let page = +this._routeParams.get('page');
|
||||
let size = +this._routeParams.get('size');
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.size = ( size <= 0 ) ? 10 : size;
|
||||
if(this.keyword !=null && this.keyword.length > 0){
|
||||
this.search(this.keyword,this.size,this.page);
|
||||
}
|
||||
}
|
||||
|
||||
page : number = 1;
|
||||
size:number = 10;
|
||||
@Input() public keyword:string = "";
|
||||
navigateTo: string = "Search";
|
||||
source: string = "crossref";
|
||||
type : string = "publication";
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public selectedPublications = [] ;
|
||||
@Output() publicationsChange = new EventEmitter();
|
||||
|
||||
crossrefResults=[];
|
||||
crossrefResultsNum : Observable<number> ;
|
||||
|
||||
orcidResults: string[];
|
||||
orcidResultsNum: number ;
|
||||
totalPages: number;
|
||||
orcidResultsToShow: string[];
|
||||
|
||||
authorId: string;
|
||||
authorGivenName: string;
|
||||
authorFamilyName: string;
|
||||
|
||||
authorIds: string[];
|
||||
authorGivenNames: string[];
|
||||
authorFamilyNames: string[];
|
||||
|
||||
authorsNum : number ;
|
||||
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
todayDate = '';
|
||||
nextDate = '';
|
||||
|
||||
private searchOrcid (term: string) {
|
||||
this.authorIds = new Array<string>();
|
||||
this.authorGivenNames = new Array<string>();
|
||||
this.authorFamilyNames = new Array<string>();
|
||||
|
||||
this.getOrcidAuthor(term);
|
||||
|
||||
console.info('searchOrcid in searchOrcid file');
|
||||
}
|
||||
|
||||
private readData(data: any) {
|
||||
this.authorIds.push(data[2].path);
|
||||
|
||||
if(data[0] != null) {
|
||||
this.authorGivenNames.push(data[0].value);
|
||||
} else {
|
||||
this.authorGivenNames.push("");
|
||||
}
|
||||
if(data[1] != null) {
|
||||
this.authorFamilyNames.push(data[1].value);
|
||||
} else {
|
||||
this.authorFamilyNames.push("");
|
||||
}
|
||||
}
|
||||
|
||||
private getOrcidAuthor (term: string) {
|
||||
this.orcidResultsNum = null;
|
||||
|
||||
this._searchOrcidService.searchOrcidAuthor(term).subscribe(
|
||||
data => {
|
||||
if(data[2] != null) {
|
||||
this.readData(data);
|
||||
this.getOrcidResultsById(0);
|
||||
}
|
||||
|
||||
},
|
||||
err => this.errorHandler(err, term)
|
||||
);
|
||||
}
|
||||
|
||||
private errorHandler(err: any, term: string) {
|
||||
if(err.status == 404){
|
||||
this.getOrcidAuthors(term);
|
||||
} else {
|
||||
console.error(err.status);
|
||||
}
|
||||
}
|
||||
|
||||
private getOrcidAuthors (term: string) {
|
||||
this.orcidResultsNum = null;
|
||||
|
||||
this._searchOrcidService.searchOrcidAuthors(term).subscribe(
|
||||
data => {
|
||||
if(data[2] != null) {
|
||||
this.readData(data);
|
||||
this.getOrcidResultsById(0);
|
||||
}
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private getOrcidResultsById (index:number) {
|
||||
let id = this.authorIds[index];
|
||||
|
||||
console.info("getOrcidResultsById: "+id);
|
||||
this._searchOrcidService.searchOrcidPublications(id).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.orcidResults=data['orcid-work'];
|
||||
this.orcidResultsNum = data['orcid-work'].length;
|
||||
this.page = 1;
|
||||
if((this.orcidResultsNum % this.size) == 0){
|
||||
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size));
|
||||
} else{
|
||||
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size+1));
|
||||
}
|
||||
|
||||
this.orcidResultsToShow = this.orcidResults.slice(0,10);
|
||||
} else {
|
||||
this.orcidResultsNum = 0;
|
||||
this.totalPages=0;
|
||||
}
|
||||
this.authorGivenName = this.authorGivenNames[index];
|
||||
this.authorFamilyName = this.authorFamilyNames[index];
|
||||
this.authorId = id;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
|
||||
console.info("totalPages = " +this.totalPages);
|
||||
}
|
||||
|
||||
public search(term: string, size : number, page : number){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
this.getCrossrefResults(term,size,page);
|
||||
this.searchOrcid(term);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private getCrossrefResults (term: string, size : number, page : number) {
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.crossrefResults = data.items;
|
||||
this.page=page;
|
||||
this.crossrefResultsNum = data['total-results'];
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private add(item, id, itemSource, itemType, itemUrl, itemTitle){
|
||||
var result ;
|
||||
if(itemSource == 'crossref'){
|
||||
result = {id: id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate};
|
||||
}else if (itemSource == 'orcid'){
|
||||
result = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate};
|
||||
}else if (itemSource == 'openaire'){
|
||||
|
||||
}
|
||||
var found:boolean = this.isSelected(result.id);
|
||||
this.warningMessage = "";
|
||||
if (!found) {
|
||||
this.selectedPublications.push(result);
|
||||
this.publicationsChange.emit({
|
||||
value: this.selectedPublications
|
||||
});
|
||||
}else{
|
||||
this.warningMessage = "Publication already in selected list";
|
||||
}
|
||||
|
||||
}
|
||||
private remove(item){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
var index:number =this.selectedPublications.indexOf(item);
|
||||
item.selected=false;
|
||||
if (index > -1) {
|
||||
this.selectedPublications.splice(index, 1);
|
||||
this.publicationsChange.emit({
|
||||
value: this.selectedPublications
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
private pageChange($event) {
|
||||
this.page=$event.value;
|
||||
this.crossrefResults=[];
|
||||
this.getCrossrefResults(this.keyword,this.size,this.page);
|
||||
}
|
||||
private orcidPageChange($event) {
|
||||
this.page=$event.value;
|
||||
this.orcidResultsToShow=[];
|
||||
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
|
||||
}
|
||||
|
||||
private isSelected(id:string){
|
||||
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
for (var _i = 0; _i < this.selectedPublications.length; _i++) {
|
||||
let item = this.selectedPublications[_i];
|
||||
if(item.id == id){
|
||||
found=true;
|
||||
this.warningMessage = "Publication already in selected list";
|
||||
}
|
||||
}
|
||||
return found;
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {pagingFormatterNoLoad} from '../../../common/pagingFormatterNoLoad.component';
|
||||
import {PublicationTitleFormatter} from '../../../common/publicationTitleFormatter.component';
|
||||
import {ClaimPublicationComponent} from './claimPublication/claimPublication.component';
|
||||
import {ClaimDatasetComponent} from './claimDataset/claimDataset.component';
|
||||
|
||||
import {SearchDataciteService} from '../../../services/searchDatacite.service';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-result',
|
||||
directives: [...ROUTER_DIRECTIVES,pagingFormatterNoLoad, PublicationTitleFormatter, ClaimPublicationComponent, ClaimDatasetComponent],
|
||||
template: `
|
||||
|
||||
|
||||
<div class="panel">
|
||||
<div class="">
|
||||
<form>
|
||||
|
||||
<!--<md-input class="demo-full-width default" placeholder="Search for Research Results" [(ngModel)]="keyword"></md-input>
|
||||
|
||||
<md-radio-group class="default" [(value)]="searchType">
|
||||
<md-radio-button [value]="publication" [checked]="searchType === 'publication'" >Publication</md-radio-button>
|
||||
<md-radio-button [value]="dataset" [checked]="searchType != 'publication'">Dataset</md-radio-button>
|
||||
</md-radio-group> -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
|
||||
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
|
||||
</span>
|
||||
<!--<div class="input-group-btn">
|
||||
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} </button>
|
||||
<ul class="dropdown-menu">
|
||||
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
|
||||
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
|
||||
</ul>
|
||||
</div> -->
|
||||
|
||||
<input class=" form-control" [(ngModel)]="keyword"/>
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button (click)="search()" type="submit" class="btn btn-default">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel ">
|
||||
<div *ngIf=" searchType=='publication' ">
|
||||
<claim-publication [(keyword)]="keyword" [selectedPublications]="selectedPublications" (publicationsChange)="publicationsChanged($event)" > </claim-publication>
|
||||
</div>
|
||||
<div *ngIf=" searchType=='dataset' " >
|
||||
<claim-dataset [(keyword)]="keyword" [(selectedDatasets)]="selectedDatasets" (datasetsChange)="datasetsChanged($event)" > </claim-dataset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, SearchDataciteService]
|
||||
})
|
||||
export class ClaimResultComponent {
|
||||
constructor (private _searchDataciteService: SearchDataciteService,
|
||||
private _routeParams: RouteParams) {
|
||||
var myDate = new Date();
|
||||
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
// if(this.keyword !=null && this.keyword.length > 0){
|
||||
// this.searchDatacite(this.keyword,this.size,this.page);
|
||||
// }
|
||||
}
|
||||
@ViewChild (ClaimPublicationComponent) claimPublicationComponent : ClaimPublicationComponent ;
|
||||
@ViewChild (ClaimDatasetComponent) claimDatasetComponent : ClaimDatasetComponent ;
|
||||
|
||||
page : number = 1;
|
||||
size:number = 10;
|
||||
navigateTo: string = "Search";
|
||||
source: string = "datacite";
|
||||
type : string = "dataset";
|
||||
searchType ="publication";
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public keyword:string = '';
|
||||
@Input() public selectedDatasets = [] ;
|
||||
@Input() public selectedPublications = [] ;
|
||||
@Output() datasetsChange = new EventEmitter();
|
||||
@Output() publicationsChange = new EventEmitter();
|
||||
|
||||
todayDate = '';
|
||||
nextDate = '';
|
||||
search(){
|
||||
if(this.searchType=='dataset'){
|
||||
this.claimDatasetComponent.search(this.keyword,10,1);
|
||||
}else{
|
||||
this.claimPublicationComponent.search(this.keyword,10,1);
|
||||
}
|
||||
}
|
||||
|
||||
typeChanged(type:string) {
|
||||
this.searchType = type;
|
||||
}
|
||||
publicationsChanged($event) {
|
||||
this.selectedPublications=$event.value;
|
||||
this.publicationsChange.emit({
|
||||
value: this.selectedPublications
|
||||
});
|
||||
|
||||
}
|
||||
datasetsChanged($event) {
|
||||
this.selectedDatasets=$event.value;
|
||||
this.datasetsChange.emit({
|
||||
value: this.selectedDatasets
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimsService} from '../../../services/claims.service';
|
||||
import {PublicationTitleFormatter} from '../../../common/publicationTitleFormatter.component';
|
||||
import {Loading} from '../../../common/modal/loading.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'claim-insert',
|
||||
directives: [...ROUTER_DIRECTIVES, Loading],
|
||||
template: `
|
||||
|
||||
<button *ngIf="claiming == false && showButton == 'true' " (click)="insert()" class="btn btn-primary" style="float:right">Finish</button>
|
||||
<div *ngIf="error == true"> <div class="alert alert-warning" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
<div *ngIf="claiming == true && claimsTODO > 0 && claimsTODO == claims" >
|
||||
Now show my claims
|
||||
</div>
|
||||
<loading [message]= "'Please wait...'"></loading>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, ClaimsService]
|
||||
})
|
||||
export class ClaimInsertComponent {
|
||||
constructor (private claimService: ClaimsService, private _routeParams: RouteParams, private _router:Router) {}
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Input() public contexts;
|
||||
@Input() public projects;
|
||||
@Input() public publications;
|
||||
@Input() public datasets;
|
||||
@Input() public showButton:string = 'true';
|
||||
@Input() show='claim';
|
||||
@Input() inline='false';
|
||||
@Output() showChange = new EventEmitter();
|
||||
|
||||
@ViewChild (Loading) loading : Loading ;
|
||||
|
||||
claiming =false;
|
||||
error = false;
|
||||
errorMessage = "";
|
||||
claimsTODO:number = 0;
|
||||
claims:number = 0;
|
||||
errorclaims:number = 0;
|
||||
insert(){
|
||||
this.claiming = true;
|
||||
var user="argirok@di.uoa.gr"
|
||||
if( this.datasets && this.datasets.length == 0 && this.publications && this.publications.length == 0){
|
||||
this.showError("There are no publications or datasets selected.");
|
||||
}else if((!this.contexts|| this.contexts.length==0 )&&(!this.projects|| this.projects.length==0 )){
|
||||
this.showError("There are no projects or concepts to link.");
|
||||
}else if((!this.publications|| this.publications.length==0 )&&(!this.datasets|| this.datasets.length==0 )){
|
||||
this.showError("There are no publications or datasets to link.");
|
||||
}else{
|
||||
this.loading.open();
|
||||
if(this.publications){
|
||||
|
||||
for (var i = 0; i < this.publications.length; i++) {
|
||||
|
||||
var result=this.publications[i];
|
||||
this.insertClaim(result,user);
|
||||
|
||||
}
|
||||
}
|
||||
if(this.datasets){
|
||||
for (var i = 0; i < this.datasets.length; i++) {
|
||||
var result=this.datasets[i];
|
||||
this.insertClaim(result,user);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private claimInserted(){
|
||||
this.claims+=1;
|
||||
if(this.claims == this.claimsTODO){
|
||||
this.show = "context";
|
||||
this.loading.close();
|
||||
if(this.inline == "true"){
|
||||
this.show = "end";
|
||||
}else{
|
||||
this._router.navigate( ['MyClaims'] );
|
||||
}
|
||||
this.showChange.emit({
|
||||
value: this.show
|
||||
});
|
||||
}
|
||||
}
|
||||
private showError(error:string){
|
||||
this.errorMessage = error;
|
||||
this.error = true;
|
||||
if(this.inline == "true"){
|
||||
this.show = "error";
|
||||
this.showChange.emit({
|
||||
value: this.show
|
||||
});
|
||||
}
|
||||
}
|
||||
private claimFailed(){
|
||||
this.errorMessage = "An Error Occured.";
|
||||
this.errorclaims++;
|
||||
if((this.claims+this.errorclaims) == this.claimsTODO){
|
||||
this.show = "context";
|
||||
this.loading.close();
|
||||
if(this.inline == "true"){
|
||||
this.show = "end";
|
||||
}else{
|
||||
this._router.navigate( ['MyClaims'] );
|
||||
}
|
||||
this.showChange.emit({
|
||||
value: this.show
|
||||
});
|
||||
}
|
||||
}
|
||||
insertClaim(result:any, user:any){
|
||||
if(this.contexts){
|
||||
for (var j = 0; j < this.contexts.length; j++) {
|
||||
var context=this.contexts[j];
|
||||
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate:result.embargoEndDate};
|
||||
this.claimsTODO +=1;
|
||||
this.claimService.insertClaim(claim).subscribe(
|
||||
data => {
|
||||
this.claimInserted();
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
this.claimFailed();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
if(this.projects){
|
||||
for (var j = 0; j < this.projects.length; j++) {
|
||||
var project=this.projects[j];
|
||||
|
||||
var claim = { claimedBy : user, sourceId : project.projectId, sourceType : "project", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate:result.embargoEndDate};
|
||||
console.info("Trying to insert project - result relation: projectId: "+claim.sourceId +" resultId : " + claim.targetId + " "+ claim.targetEmbargoEndDate );
|
||||
this.claimsTODO +=1;
|
||||
this.claimService.insertClaim(claim).subscribe(
|
||||
data => {
|
||||
this.claimInserted();
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
this.claimFailed();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimContextComponent} from './claimContext/claimContext.component';
|
||||
import {ClaimResultComponent} from './claimResult/claimResult.component';
|
||||
import {ClaimSelectedComponent} from './selected/selected.component';
|
||||
import {ClaimInsertComponent} from './insertClaim/insertClaim.component';
|
||||
import {ClaimProjectsComponent} from './claimProject/claimProject.component';
|
||||
import {LinkingHomeComponent} from './linkingHome.component';
|
||||
|
||||
@Component({
|
||||
selector: 'linking',
|
||||
//providers: [MdRadioDispatcher],
|
||||
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimSelectedComponent, ClaimInsertComponent, ClaimProjectsComponent, LinkingHomeComponent, ClaimResultComponent],
|
||||
template: `
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1>Link research resutls</h1>
|
||||
</div>
|
||||
<linking-home *ngIf=" show == 'home' " (linkTypeChange)="linkTypeChange($event)" ></linking-home>
|
||||
<div *ngIf=" show != 'home' && show != 'myclaims' " >
|
||||
<ol *ngIf=" show != 'myclaims' " class="breadcrumb">
|
||||
<li *ngIf="linkType == 'project'" [class]="(show == 'project' )?'active':''"><a *ngIf="show != 'project'" (click)="showChangedType('project')" >Project</a><span *ngIf="show == 'project'">Project</span></li>
|
||||
<li *ngIf="linkType == 'context'" [class]="(show == 'context' )?'active':''"><a *ngIf="show != 'context'" (click)="showChangedType('context')" >Context</a><span *ngIf="show == 'context'">Context</span></li>
|
||||
<li *ngIf="linkType == 'software'" [class]="(show == 'software' )?'active':''"><a *ngIf="show != 'software'" (click)="showChangedType('software')" >Software</a><span *ngIf="show == 'software'">Software</span> </li>
|
||||
<li [class]="(show == 'result' || show == 'publication' || show == 'dataset')?'active':''"><a *ngIf="show != 'result' && show != 'publication' && show != 'dataset'" (click)="showChangedType('result')" >Research Result</a><span *ngIf="show == 'result' || show == 'publication' || show == 'dataset'">Research Result</span></li>
|
||||
<li [class]="(show == 'claim' )?'active':''"><span *ngIf="show == 'claim'">Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Link</a> </li>
|
||||
</ol>
|
||||
|
||||
<div *ngIf=" show != 'claim' && show != 'myclaims'" class="row" >
|
||||
<div class="col-sm-6">
|
||||
|
||||
<div *ngIf=" show=='result' " >
|
||||
<claim-result [selectedDatasets]="datasets" [selectedPublications]="publications" (datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)" > </claim-result>
|
||||
</div>
|
||||
<!--<div *ngIf=" show=='result' " >
|
||||
<form>
|
||||
|
||||
!--<md-input class="demo-full-width default" placeholder="Search for Research Results" [(ngModel)]="keyword"></md-input>
|
||||
|
||||
<md-radio-group class="default" [(value)]="searchType">
|
||||
<md-radio-button [value]="publication" [checked]="searchType === 'publication'" >Publication</md-radio-button>
|
||||
<md-radio-button [value]="dataset" [checked]="searchType != 'publication'">Dataset</md-radio-button>
|
||||
</md-radio-group> --
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} </button>
|
||||
<ul class="dropdown-menu">
|
||||
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
|
||||
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
!-- <div class="resultType">
|
||||
<span class="input-group-addon">
|
||||
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
|
||||
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
|
||||
</div>
|
||||
</span>--
|
||||
<input class=" form-control" [(ngModel)]="keyword"/>
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button (click)="search()" type="submit" class="btn btn-default">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div> -->
|
||||
<!-- <div *ngIf=" show=='publication' ">
|
||||
<claim-publication [keyword]="keyword" [selectedPublications]="publications" (publicationsChange)="publicationsChange($event)" > </claim-publication>
|
||||
</div>
|
||||
<div *ngIf=" show=='dataset' " >
|
||||
<claim-dataset [keyword]="keyword" [selectedDatasets]="datasets" (datasetsChange)="datasetsChange($event)" > </claim-dataset>
|
||||
</div> -->
|
||||
<div *ngIf=" show=='project' " >
|
||||
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
|
||||
</div>
|
||||
<div *ngIf=" show=='software' " >
|
||||
<p>TODO software</p>
|
||||
</div>
|
||||
<div *ngIf=" show == 'context'" >
|
||||
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
||||
</div>
|
||||
<!-- <div *ngIf=" show == 'claim'" >
|
||||
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" ></claim-insert>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show"
|
||||
(projectsChange)="projectsChange($event)" (contextsChange)="contextsChange($event)" (datasetsChange)="datasetsChange($event)"
|
||||
(publicationsChange)="publicationsChange($event)" (showChange)="showChange($event)" > </claim-selected>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf=" show == 'claim'" >
|
||||
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show" (showChange)="showChange($event)" [showAccessRights]="'true'" > </claim-selected>
|
||||
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show] = "show" (showChange)="showChange($event)"></claim-insert>
|
||||
</div>
|
||||
<nav>
|
||||
<ul *ngIf="show != 'home'" class="pager">
|
||||
<li class="previous" (click)="prev()"><a ><span aria-hidden="true">←</span> Previous</a></li>
|
||||
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">→</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!--<button class="btn btn-primary" *ngIf="show != 'home'" (click)="prev()">Prev</button>
|
||||
<button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()" >Next</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
//[(ngModel)]="date"
|
||||
export class LinkingComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
}
|
||||
sourceType:string;
|
||||
targetType:string;
|
||||
step:number = 1;
|
||||
contexts=[];
|
||||
projects=[];
|
||||
publications=[];
|
||||
datasets=[];
|
||||
show = "home";
|
||||
searchType="publication"; //publication or dataset
|
||||
date='8-6-2016';
|
||||
keyword: string = "";
|
||||
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
next(){
|
||||
|
||||
if((this.show == 'project' || this.show == 'context' || this.show == 'software')){
|
||||
this.show='result';
|
||||
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
|
||||
this.show='claim';
|
||||
// }else if(this.show == 'result' ){
|
||||
// if(this.searchType == 'publication' ){
|
||||
// this.show="publication";
|
||||
// }else{
|
||||
// this.show="dataset";
|
||||
// }
|
||||
}
|
||||
}
|
||||
prev(){
|
||||
if(this.show == 'result'){
|
||||
this.show = this.linkType;
|
||||
// if(this.linkType == 'project'){
|
||||
// this.show='project';
|
||||
// }else if(this.linkType == 'context'){
|
||||
// this.show='context';
|
||||
// }else if(this.linkType == 'software'){
|
||||
// this.show='software';
|
||||
// }else{
|
||||
// this.show='home';
|
||||
//
|
||||
// }
|
||||
}else if(this.show == 'context' || this.show == 'project' || this.show == 'software' ){
|
||||
this.show='home';
|
||||
// }else if(this.show == 'dataset' || this.show == 'publication'){
|
||||
// this.show='result';
|
||||
} else if(this.show == 'claim'){
|
||||
this.show='result';
|
||||
}
|
||||
}
|
||||
goto(term: string) {
|
||||
this._router.navigate( ['Search', { keyword: term }] );
|
||||
}
|
||||
|
||||
search() {
|
||||
if(this.searchType == 'publication' ){
|
||||
this.show="publication";
|
||||
}else{
|
||||
this.show="dataset";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sourceTypeChange($event) {
|
||||
this.sourceType=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
targetTypeChange($event) {
|
||||
this.targetType=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
contextsChange($event) {
|
||||
this.contexts=$event.value;
|
||||
console.log($event.value);
|
||||
}
|
||||
publicationsChange($event) {
|
||||
this.publications=$event.value;
|
||||
}
|
||||
datasetsChange($event) {
|
||||
this.datasets=$event.value;
|
||||
}
|
||||
projectsChange($event) {
|
||||
this.projects=$event.value;
|
||||
}
|
||||
typeChanged(type:string) {
|
||||
this.searchType = type;
|
||||
}
|
||||
linkTypeChange($event) {
|
||||
this.linkType =$event.value;
|
||||
this.show=$event.value;
|
||||
|
||||
}
|
||||
showChange($event) {
|
||||
this.show=$event.value;
|
||||
this.showChangedType($event.value);
|
||||
|
||||
|
||||
}
|
||||
showChangedType(type:string) {
|
||||
this.show=type;
|
||||
if(this.show == 'project' || this.show == 'context' || this.show == 'software'){
|
||||
this.linkType = this.show;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
import {Component, Output, EventEmitter} from '@angular/core';
|
||||
import {RouteConfig, ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Component({
|
||||
selector: 'linking-home',
|
||||
template: `
|
||||
<div class="card-deck-wrapper">
|
||||
<div class="card-deck">
|
||||
<div class="card card-inverse card-info text-xs-center">
|
||||
<!--<img class="card-img-top" data-src="images/funders.png" alt="Card image cap"> -->
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Link with project</h4>
|
||||
<p class="card-text">Link your research result with funded projects.</p>
|
||||
<a (click)="select('project')" class="btn btn-primary">Link with project</a>
|
||||
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-inverse card-success text-xs-center" >
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Link with Community</h4>
|
||||
<p class="card-text">Link your research result with research communities.</p>
|
||||
<a (click)="select('context')" class="btn btn-primary">Link with community</a>
|
||||
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-inverse text-xs-center" style="background-color:pink;">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Link with Software</h4>
|
||||
<p class="card-text">....</p>
|
||||
<a (click)="select('software')" class="btn btn-primary">Link with software</a>
|
||||
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
],
|
||||
})
|
||||
|
||||
export class LinkingHomeComponent {
|
||||
@Output() linkTypeChange = new EventEmitter();
|
||||
linkType:string = "project";
|
||||
select(type:string){
|
||||
this.linkType = type;
|
||||
this.linkTypeChange.emit({
|
||||
value: this.linkType
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
||||
import {PublicationTitleFormatter} from '../../../common/publicationTitleFormatter.component';
|
||||
@Component({
|
||||
selector: 'claim-selected',
|
||||
template: `
|
||||
|
||||
<div [class]="(showAccessRights== 'true' )?'row':''" >
|
||||
<!-- <div *ngIf=" inline == 'true'">
|
||||
|
||||
<div *ngIf=" inlineType == 'publication' " class="publication" >
|
||||
<a *ngIf="inlineEntity[0].url" target="_blank" href="{{inlineEntity[0].url}}" >{{inlineEntity[0].title}}</a>
|
||||
<span *ngIf="!inlineEntity[0].url" >{{inlineEntity[0].title}}</span>
|
||||
</div>
|
||||
<div *ngIf=" inlineType == 'dataset' " class="dataset" >
|
||||
<a *ngIf="inlineEntity[0].url" target="_blank" href="{{inlineEntity[0].url}}" >{{inlineEntity[0].title}}</a>
|
||||
<span *ngIf="!inlineEntity[0].url" >{{inlineEntity[0].title}}</span>
|
||||
</div>
|
||||
<div *ngIf=" inlineType == 'project' " class="project" >
|
||||
<a *ngIf="inlineEntity[0].url" target="_blank" href="{{inlineEntity[0].url}}" >{{inlineEntity[0].title}}</a>
|
||||
<span *ngIf="!inlineEntity[0].url" >{{inlineEntity[0].title}}</span>
|
||||
<span >{{inlineEntity[0].funderName}} | {{(inlineEntity[0].projectAcronym)?inlineEntity[0].projectAcronym: inlineEntity[0].projectName}}</span>
|
||||
</div>
|
||||
<div>Link to </div>
|
||||
</div> -->
|
||||
<div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
|
||||
|
||||
<div *ngIf=" !(inline == 'true' && inlineType == 'context') && contexts" class="concepts" >
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item list-group-item-success">Selected Concepts ({{(contexts.length)}})
|
||||
<span *ngIf=" inline == 'false'" title="Add More Concepts" (click)="showType('context')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></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 glyphicon glyphicon-remove"></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':''" >
|
||||
|
||||
<div *ngIf=" !(inline == 'true' && inlineType == 'project') && projects " class="projects" >
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
|
||||
<span *ngIf=" inline == 'false'" title="Add More Projects" (click)="showType('project')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
|
||||
</li>
|
||||
<li class="list-group-item" *ngFor="let project of projects">
|
||||
|
||||
<span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}}</span>
|
||||
<span (click)="removeProject(project)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
|
||||
</li>
|
||||
<li *ngIf="projects.length == 0 " class="list-group-item">There are no projects</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf=" !(inline == 'true' && (inlineType == 'publication' || inlineType == 'dataset' )) && (datasets || publications)" class="publications" >
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item panel-footer "> Research Results ({{(datasets.length+publications.length)}})
|
||||
<span *ngIf=" inline == 'false'" title="Add More Research Results" (click)="showType('result')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></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 == 'false'" title="Add More Publications" (click)="showType('publication')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
|
||||
</li>
|
||||
<li *ngFor="let pub of publications" class="list-group-item">
|
||||
<span *ngIf="showAccessRights == 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
|
||||
<span >
|
||||
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" >{{pub.title}}</a>
|
||||
<span *ngIf="!pub.url" >{{pub.title}}</span>
|
||||
</span>
|
||||
<span *ngIf="showAccessRights== 'true' && pub.source != 'openaire' " class="dropdown">
|
||||
<button class="btn btn-default 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="btn btn-default disabled " type="button" >
|
||||
{{pub.accessRights}}
|
||||
</button>
|
||||
</span>
|
||||
<span *ngIf="showAccessRights != 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></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 == 'false'" title="Add More Research Data" (click)="showType('dataset')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
|
||||
</li>
|
||||
<li *ngFor="let dataset of datasets" class="list-group-item">
|
||||
<span *ngIf="showAccessRights == 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
|
||||
<span >
|
||||
<a *ngIf="dataset.url" target="_blank" href="{{dataset.url}}" >{{dataset.title}}</a>
|
||||
<span *ngIf="!dataset.url" >{{dataset.title}}</span>
|
||||
</span>
|
||||
<span *ngIf="showAccessRights== 'true' && dataset.source != 'openaire'" class="dropdown">
|
||||
<button class="btn btn-default 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="btn btn-default disabled " type="button" >
|
||||
{{dataset.accessRights}}
|
||||
</button>
|
||||
</span>
|
||||
<span *ngIf="showAccessRights != 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
directives: [ PublicationTitleFormatter]
|
||||
|
||||
|
||||
})
|
||||
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;
|
||||
@Input() projects;
|
||||
@Input() publications;
|
||||
@Input() datasets;
|
||||
@Input() showAccessRights=false;
|
||||
@Input() show='home';
|
||||
@Input() inline='false';
|
||||
@Input() inlineEntity;
|
||||
@Input() inlineType;
|
||||
@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 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'add-more',
|
||||
template: ``
|
||||
})
|
||||
export class Addmore {
|
||||
@Input() type = 'publication';
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {ClaimsComponent} from '../claims/claims.component';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'my-claims',
|
||||
directives: [ROUTER_DIRECTIVES, ClaimsComponent],
|
||||
template: `
|
||||
<div *ngIf="user" class="container">
|
||||
<div class="page-header">
|
||||
<h1> My Linked research resutls</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-right"><a [routerLink]=" ['/Linking']">Add more Links?</a></div>
|
||||
<claims enableDelete="true" myClaims="true" isAdmin="false" [fetchId]="user" ></claims>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="!user" class="container">
|
||||
TODO login
|
||||
</div>
|
||||
`
|
||||
|
||||
})
|
||||
export class MyClaimsComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
}
|
||||
user:string="argirok@di.uoa.gr";
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'my-claims-demo',
|
||||
directives: [ROUTER_DIRECTIVES],
|
||||
template: `
|
||||
<div *ngIf="user" class="container">
|
||||
<div class="page-header">
|
||||
<h1> My Claims Demo</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class=""><a [routerLink]=" ['/Linking']">Linking</a></div>
|
||||
<div class=""><a [routerLink]=" ['/MyClaims']">MyClaims</a></div>
|
||||
<div class=""><a [routerLink]=" ['/Claims']">Claims Admin</a></div>
|
||||
<p> Extra parameters for claims admin</p>
|
||||
<div class=""><a href="claims?fetchBy=User&fetchId=amelie.baecker@uni-bielefeld.de">Claims By user</a></div>
|
||||
<div class=""><a href="claims?fetchBy=Project&fetchId=corda_______::2c37878a0cede85dbbd1081bb9b4a2f8">Claims By project</a></div>
|
||||
<div class=""><a href="claims?fetchBy=Context&fetchId=egi::country::gr">Claims By context</a></div>
|
||||
|
||||
<!-- <p>Orcid
|
||||
<p>N.M.
|
||||
0000-0002-3477-3082
|
||||
</p>
|
||||
</p> -->
|
||||
<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
|
||||
<!--<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
|
||||
<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
`
|
||||
//(click)="changeOrderby('target')"
|
||||
//od_______908::3a5b2885656a91307156325644e73b92
|
||||
|
||||
})
|
||||
export class MyClaimsDemoComponent {
|
||||
constructor ( private _router: Router ) {
|
||||
}
|
||||
user:string="argirok@di.uoa.gr";
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
goToPub(id: number){
|
||||
this._router.navigate( ['Publication', { articleId: id}] );
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'autocomplete',
|
||||
template: `
|
||||
<div class="container" >
|
||||
<div class="input-field col s12">
|
||||
|
||||
</div>
|
||||
<label for="country">Country</label>
|
||||
<input id="country" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
|
||||
|
||||
|
||||
|
||||
<div class="suggestions" *ngIf="filteredList.length > 0">
|
||||
<ul class="list-group" *ngFor=" let item of filteredList" >
|
||||
<li class="list-group-item" >
|
||||
<a (click)="select(item)">{{item}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="selections" *ngIf="selectedList.length > 0">
|
||||
<label for="selecteditems">Selected: </label>
|
||||
<ul id ="selecteditems" class="nav nav-pills" *ngFor="let item of selectedList" >
|
||||
<li role="presentation" (click)="remove(item)">{{item}} <span class="badge">X</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class AutocompleteComponent {
|
||||
public query = '';
|
||||
public countries = [ "Albania","Andorra","Armenia","Austria","Azerbaijan","Belarus",
|
||||
"Belgium","Bosnia & Herzegovina","Bulgaria","Croatia","Cyprus",
|
||||
"Czech Republic","Denmark","Estonia","Finland","France","Georgia",
|
||||
"Germany","Greece","Hungary","Iceland","Ireland","Italy","Kosovo",
|
||||
"Latvia","Liechtenstein","Lithuania","Luxembourg","Macedonia","Malta",
|
||||
"Moldova","Monaco","Montenegro","Netherlands","Norway","Poland",
|
||||
"Portugal","Romania","Russia","San Marino","Serbia","Slovakia","Slovenia",
|
||||
"Spain","Sweden","Switzerland","Turkey","Ukraine","United Kingdom","Vatican City"];
|
||||
public filteredList = [];
|
||||
public selectedList = [];
|
||||
public elementRef;
|
||||
|
||||
constructor(myElement: ElementRef) {
|
||||
this.elementRef = myElement;
|
||||
}
|
||||
|
||||
filter() {
|
||||
if (this.query !== ""){
|
||||
this.filteredList = this.countries.filter(function(el){
|
||||
return el.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
|
||||
}.bind(this));
|
||||
}else{
|
||||
this.filteredList = [];
|
||||
}
|
||||
}
|
||||
|
||||
select(item){
|
||||
this.query = "";
|
||||
this.filteredList = [];
|
||||
this.selectedList.push(item);
|
||||
console.info("Select:"+this.selectedList);
|
||||
for (var i = 0; i < this.selectedList.length; i++) {
|
||||
console.log(this.selectedList[i]);
|
||||
}
|
||||
}
|
||||
remove(item){
|
||||
var index:number =this.selectedList.indexOf(item);
|
||||
console.info("Try to remove item from :"+this.selectedList.indexOf(item));
|
||||
if (index > -1) {
|
||||
this.selectedList.splice(index, 1);
|
||||
}
|
||||
console.info("Item removed "+this.selectedList.indexOf(item));
|
||||
}
|
||||
handleClick(event){
|
||||
var clickedComponent = event.target;
|
||||
var inside = false;
|
||||
do {
|
||||
if (clickedComponent === this.elementRef.nativeElement) {
|
||||
inside = true;
|
||||
}
|
||||
clickedComponent = clickedComponent.parentNode;
|
||||
} while (clickedComponent);
|
||||
if(!inside){
|
||||
this.filteredList = [];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
|
||||
import {ProjectTitleFormatter} from './projectTitleFormatter.component';
|
||||
|
||||
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
|
||||
|
||||
//externalUrl
|
||||
@Component({
|
||||
selector: 'claim-entity',
|
||||
template: `
|
||||
|
||||
<div *ngIf="type == 'publication' || type == 'dataset'">
|
||||
<i>({{type}}) </i>
|
||||
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'project' ">
|
||||
<i>(Project)</i>
|
||||
<project-title [project]="entity"></project-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'context' ">
|
||||
<i>(Context)</i>
|
||||
<h5><a target="_blank" >{{entity.title}}</a></h5>
|
||||
</div>
|
||||
`,
|
||||
directives: [PublicationTitleFormatter,ProjectTitleFormatter]
|
||||
})
|
||||
|
||||
export class ClaimEntityFormatter {
|
||||
@Input() entity: string[];
|
||||
@Input() type: string;
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
import {Component, ViewEncapsulation, ComponentRef, DynamicComponentLoader,ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
||||
import {Open} from './open.component';
|
||||
|
||||
@Component({
|
||||
selector: 'alert',
|
||||
template: `
|
||||
<div class="modal fade" [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" [hidden]=!alertHeader>
|
||||
<button type="button" class="close" data-dismiss="modal" (click)='cancel()' aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title text-center" id="myModalLabel">{{alertTitle}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div [hidden]=!alertMessage>
|
||||
{{message}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" [hidden]=!alertFooter>
|
||||
<span [hidden]=!okButton >
|
||||
<button class="btn btn-primary" (click)="ok()">{{okButtonText}}</button>
|
||||
</span>
|
||||
<span [hidden]=!cancelButton>
|
||||
<button class="btn btn-primary" (click)="cancel()">{{cancelButtonText}}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
providers: [],
|
||||
directives: [Open],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
pipes: []
|
||||
})
|
||||
/**
|
||||
* API to an open alert window.
|
||||
*/
|
||||
export class Alert{
|
||||
/**
|
||||
* Caption for the title.
|
||||
*/
|
||||
public alertTitle:string;
|
||||
/**
|
||||
* Describes if the alert contains Ok Button.
|
||||
* The default Ok button will close the alert and emit the callback.
|
||||
* Defaults to true.
|
||||
*/
|
||||
public okButton:boolean = true;
|
||||
/**
|
||||
* Caption for the OK button.
|
||||
* Default: Ok
|
||||
*/
|
||||
public okButtonText:string= 'Ok';
|
||||
/**
|
||||
* Describes if the alert contains cancel Button.
|
||||
* The default Cancelbutton will close the alert.
|
||||
* Defaults to true.
|
||||
*/
|
||||
public cancelButton:boolean = true;
|
||||
/**
|
||||
* Caption for the Cancel button.
|
||||
* Default: Cancel
|
||||
*/
|
||||
public cancelButtonText:string = 'Cancel';
|
||||
/**
|
||||
* if the alertMessage is true it will show the contentString inside alert body.
|
||||
*/
|
||||
public alertMessage:boolean = true;
|
||||
/**
|
||||
* Some message/content can be set in message which will be shown in alert body.
|
||||
*/
|
||||
public message:string;
|
||||
/**
|
||||
* if the value is true alert footer will be visible or else it will be hidden.
|
||||
*/
|
||||
public alertFooter:boolean= true;
|
||||
/**
|
||||
* shows alert header if the value is true.
|
||||
*/
|
||||
public alertHeader:boolean = true;
|
||||
/**
|
||||
* if the value is true alert will be visible or else it will be hidden.
|
||||
*/
|
||||
public isOpen:boolean=false;
|
||||
/**
|
||||
* Emitted when a ok button was clicked
|
||||
* or when Ok method is called.
|
||||
*/
|
||||
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
||||
constructor(public dcl:DynamicComponentLoader, public _elementRef: ElementRef){}
|
||||
/**
|
||||
* Opens a alert window creating backdrop.
|
||||
*/
|
||||
open(){
|
||||
this.isOpen= true;
|
||||
}
|
||||
/**
|
||||
* ok method closes the modal and emits modalOutput.
|
||||
*/
|
||||
ok(){
|
||||
this.isOpen = false;
|
||||
this.alertOutput.emit(true);
|
||||
}
|
||||
/**
|
||||
* cancel method closes the moda.
|
||||
*/
|
||||
cancel(){
|
||||
this.isOpen = false;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
import {Component, ViewEncapsulation, ComponentRef, DynamicComponentLoader,ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
||||
import {Open} from './open.component';
|
||||
|
||||
@Component({
|
||||
selector: 'loading',
|
||||
template: `
|
||||
<div class="modal fade" [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-body">
|
||||
<div >
|
||||
<h3 class="text-center" >{{message}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
providers: [],
|
||||
directives: [Open],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
pipes: []
|
||||
})
|
||||
/**
|
||||
* API to an open alert window.
|
||||
*/
|
||||
export class Loading{
|
||||
|
||||
@Input() public message:string ="Loading";
|
||||
|
||||
/**
|
||||
* if the value is true alert will be visible or else it will be hidden.
|
||||
*/
|
||||
public isOpen:boolean=false;
|
||||
/**
|
||||
* Emitted when a ok button was clicked
|
||||
* or when Ok method is called.
|
||||
*/
|
||||
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
||||
constructor(public dcl:DynamicComponentLoader, public _elementRef: ElementRef){}
|
||||
/**
|
||||
* Opens a alert window creating backdrop.
|
||||
*/
|
||||
open(){
|
||||
this.isOpen= true;
|
||||
}
|
||||
|
||||
close(){
|
||||
this.isOpen = false;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
import {Directive, Input, HostBinding} from '@angular/core';
|
||||
|
||||
// todo: add animate
|
||||
// todo: add init and on change
|
||||
@Directive({selector: '[open]'})
|
||||
export class Open {
|
||||
@HostBinding('style.display')
|
||||
private display:string;
|
||||
@HostBinding('class.in')
|
||||
@HostBinding('attr.aria-expanded')
|
||||
private isExpanded:boolean = true;
|
||||
|
||||
@Input()
|
||||
private set open(value:boolean) {
|
||||
this.isExpanded = value;
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
private get open():boolean {
|
||||
return this.isExpanded;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
}
|
||||
init() {
|
||||
this.isExpanded = false;
|
||||
this.display = 'none';
|
||||
}
|
||||
toggle() {
|
||||
if (this.isExpanded) {
|
||||
this.hide();
|
||||
} else {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.isExpanded = false;
|
||||
this.display = 'none';
|
||||
if (typeof document !== 'undefined') {
|
||||
let backDrop = document.getElementsByClassName("modal-backdrop");
|
||||
if(backDrop.length>0){
|
||||
document.body.removeChild(backDrop[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
show() {
|
||||
let backDrop = document.createElement('div');
|
||||
backDrop.className="modal-backdrop fade in";
|
||||
document.body.appendChild(backDrop);
|
||||
this.isExpanded = true;
|
||||
this.display = 'block';
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
//Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="Search" [term]="keyword"> </paging>
|
||||
|
||||
@Component({
|
||||
selector: 'paging',
|
||||
template: `
|
||||
<div *ngIf=" ( getTotalPages() > 0 ) && (getTotalPages() > 1) && ( 0 < currentPage && currentPage <= getTotalPages() ) " >
|
||||
<ul class="pagination pagination-sm">
|
||||
|
||||
<li *ngIf=" currentPage > 1" ><a (click)="onPage((1))" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span></a></li>
|
||||
<!--<li *ngIf=" currentPage > 1"><a (click)="onPage((currentPage -1))">\<</a></li>-->
|
||||
|
||||
<li *ngIf=" currentPage -2 > 0"><a (click)="onPage((currentPage -2))">{{currentPage -2}}</a></li>
|
||||
<li *ngIf=" currentPage -1 > 0 "><a (click)="onPage((currentPage -1))">{{currentPage -1}}</a></li>
|
||||
<li class="active"><a >{{currentPage}}</a></li>
|
||||
<li *ngIf=" currentPage +1 <= getTotalPages() "><a (click)="onPage((currentPage +1))">{{currentPage +1}}</a></li>
|
||||
<li *ngIf=" currentPage +2 <= getTotalPages() "><a (click)="onPage((currentPage +2))">{{currentPage +2}}</a></li>
|
||||
<li *ngIf=" (currentPage -2 <= 0)&&(currentPage +3 <= getTotalPages()) "><a (click)="onPage((currentPage +3))">{{currentPage +3}}</a></li>
|
||||
<li *ngIf=" (currentPage -1 <= 0)&&(currentPage +4 <= getTotalPages()) "><a (click)="onPage((currentPage +4))">{{currentPage +4}}</a></li>
|
||||
|
||||
<li *ngIf="getTotalPages() > currentPage"><a (click)="onPage((getTotalPages()))" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class PagingFormatter {
|
||||
@Input() currentPage: number = 1;
|
||||
@Input() navigateTo: string;
|
||||
@Input() term: string='';
|
||||
@Input() size: number=10;
|
||||
@Input() totalResults: number = 10;
|
||||
@Input() params;
|
||||
|
||||
constructor ( private _router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
|
||||
}
|
||||
getTotalPages(){
|
||||
var i:number =parseInt(''+(this.totalResults/this.size));
|
||||
return (((this.totalResults/this.size) == i )? i :(i+1)) ;
|
||||
}
|
||||
onPrev(){
|
||||
if(this.params){
|
||||
let pageparams= this.params;
|
||||
pageparams.page=this.currentPage -1
|
||||
this._router.navigate( [this.navigateTo, pageparams] );
|
||||
}else{
|
||||
this._router.navigate( [this.navigateTo, { keyword: this.term, page: (this.currentPage -1) }] );
|
||||
}
|
||||
}
|
||||
|
||||
onNext(){
|
||||
if(this.params){
|
||||
let pageparams= this.params;
|
||||
pageparams.page=this.currentPage +1;
|
||||
this._router.navigate( [this.navigateTo, pageparams] );
|
||||
}else{
|
||||
this._router.navigate( [this.navigateTo, { keyword: this.term, page: (this.currentPage +1) }] );
|
||||
}
|
||||
}
|
||||
onPage(pageNum: number){
|
||||
if(this.params){
|
||||
let pageparams= this.params;
|
||||
pageparams.page=pageNum;
|
||||
this._router.navigate( [this.navigateTo, pageparams] );
|
||||
}else if(this.term!=''){
|
||||
this._router.navigate( [this.navigateTo, { keyword: this.term, page: pageNum, size: this.size }] );
|
||||
}else{
|
||||
this._router.navigate( [this.navigateTo, { page: pageNum, size: this.size }] );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
//Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="Search" [term]="keyword"> </paging>
|
||||
|
||||
@Component({
|
||||
selector: 'paging-no-load',
|
||||
template: `
|
||||
<div *ngIf=" ( getTotalPages() > 0 ) && (getTotalPages() > 1) && ( 0 < currentPage && currentPage <= getTotalPages() ) " >
|
||||
<ul class="pagination pagination-sm">
|
||||
|
||||
<li *ngIf=" currentPage > 1" ><a (click)="onPage((1))" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span></a></li>
|
||||
<li *ngIf=" currentPage -2 > 0"><a (click)="onPage((currentPage -2))">{{currentPage -2}}</a></li>
|
||||
<li *ngIf=" currentPage -1 > 0 "><a (click)="onPage((currentPage -1))">{{currentPage -1}}</a></li>
|
||||
<li class="active"><a >{{currentPage}}</a></li>
|
||||
<li *ngIf=" currentPage +1 <= getTotalPages() "><a (click)="onPage((currentPage +1))">{{currentPage +1}}</a></li>
|
||||
<li *ngIf=" currentPage +2 <= getTotalPages() "><a (click)="onPage((currentPage +2))">{{currentPage +2}}</a></li>
|
||||
<li *ngIf=" (currentPage -2 <= 0)&&(currentPage +3 <= getTotalPages()) "><a (click)="onPage((currentPage +3))">{{currentPage +3}}</a></li>
|
||||
<li *ngIf=" (currentPage -1 <= 0)&&(currentPage +4 <= getTotalPages()) "><a (click)="onPage((currentPage +4))">{{currentPage +4}}</a></li>
|
||||
<li *ngIf="getTotalPages() > currentPage"><a (click)="onPage((getTotalPages()))" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
`,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class pagingFormatterNoLoad {
|
||||
@Input() currentPage: number = 1;
|
||||
@Input() navigateTo: string;
|
||||
@Input() term: string='';
|
||||
@Input() size: number=10;
|
||||
@Input() totalResults: number = 10;
|
||||
@Input() params;
|
||||
|
||||
@Output() pageChange = new EventEmitter();
|
||||
|
||||
constructor ( private _router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
|
||||
}
|
||||
getTotalPages(){
|
||||
var i= this.totalResults/this.size;
|
||||
var integerI=parseInt(''+i);
|
||||
return parseInt(''+((i==integerI)?i:i+1));
|
||||
}
|
||||
onPrev(){
|
||||
this.currentPage=this.currentPage-1;
|
||||
this.pageChange.emit({
|
||||
value: this.currentPage
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
onNext(){
|
||||
|
||||
this.currentPage=this.currentPage+1;
|
||||
this.pageChange.emit({
|
||||
value: this.currentPage
|
||||
});
|
||||
}
|
||||
onPage(pageNum: number){
|
||||
|
||||
this.currentPage=pageNum;
|
||||
this.pageChange.emit({
|
||||
value: this.currentPage
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
//Usage Example "<project-title [project]="X" > </project-title>"
|
||||
|
||||
@Component({
|
||||
selector: 'project-title',
|
||||
template: `
|
||||
<div class="project-title">
|
||||
<h5>{{project.name}} ( {{project.funderName}} )</h5>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class ProjectTitleFormatter {
|
||||
@Input() project: string[];
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
//Usage Example "<publication-title [title]="X" [url]="X" > </publication-title>"
|
||||
|
||||
@Component({
|
||||
selector: 'publication-title',
|
||||
template: `
|
||||
<div class="publication-title">
|
||||
<h5 *ngIf="url" ><a target="_blank" href="{{url}}" >{{title}}</a></h5>
|
||||
<h5 *ngIf="!url" >{{title}}</h5>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class PublicationTitleFormatter {
|
||||
@Input() title: string[];
|
||||
@Input() url: string[];
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
export class Claim {
|
||||
id: string;
|
||||
sourceType: string;
|
||||
targetType: string;
|
||||
sourceId: string;
|
||||
targetId: string;
|
||||
date: string;
|
||||
DOI: string;
|
||||
project: Project
|
||||
userMail: string;
|
||||
|
||||
}
|
||||
export class Project{
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
export class DatasetInfo {
|
||||
title: { "name": string, "url": string, "accessMode": string};
|
||||
authors: { "name": string, "url": string}[];
|
||||
date: string;
|
||||
embargoEndDate: string;
|
||||
type: string;
|
||||
downloadFrom: Map<string, {"url": string[], "accessMode": string[]}>; //key is name
|
||||
publishedIn: Map<string, {"url": string[], "accessMode": string[]}>; //key is name
|
||||
identifiers: Map<string, string[]>;
|
||||
publisher: string;
|
||||
subjects: string[];
|
||||
classifiedSubjects: Map<string, string[]>;
|
||||
description: string;
|
||||
bestlicense: string;
|
||||
collectedFrom: { "name": string, "url": string}[];
|
||||
fundedByProjects: { "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean}[];
|
||||
//relatedPublications: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
//relatedResearchData: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
//similarPublications: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
//similarDatasets: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
relatedResearchResults: { "name": string, "url": string, "date": string, "trust": string, "class": string}[];
|
||||
similarResearchResults: {"name": string, "url": string, "date": string, "trust": string, "class": string}[];
|
||||
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string}[];
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
export class PersonInfo {
|
||||
fullname: string;
|
||||
firstname: string;
|
||||
secondnames: string;
|
||||
country: string;
|
||||
|
||||
publications: any;
|
||||
researchData: any;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
export class ProjectInfo {
|
||||
acronym: string;
|
||||
title: string;
|
||||
callIdentifier: string;
|
||||
funder: string;
|
||||
funding: string;
|
||||
contractNum: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
openAccessMandate: string;
|
||||
specialClause39: string;
|
||||
organizations: Map<string, string>;
|
||||
url: string;
|
||||
urlInfo: string;
|
||||
|
||||
publications: any;
|
||||
researchData: any;
|
||||
statistics: any;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
export class Publication {
|
||||
title: string;
|
||||
publisher: string;
|
||||
DOI: string;
|
||||
source: string;
|
||||
type: string;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
export class PublicationInfo {
|
||||
title: { "name": string, "url": string, "accessMode": string};
|
||||
authors: { "name": string, "url": string}[];
|
||||
date: string;
|
||||
embargoEndDate: string;
|
||||
types: string[];
|
||||
downloadFrom: Map<string, {"url": string[], "accessMode": string[]}>; //key is name
|
||||
publishedIn: Map<string, {"url": string[], "accessMode": string[]}>; //key is name
|
||||
bioentities: Map<string, Map<string, string>>; //<site name, <>>
|
||||
identifiers: Map<string, string[]>; //key is the classname
|
||||
publisher: string;
|
||||
journal: {"journal": string, "issn": string, "lissn": string};
|
||||
languages: string[];
|
||||
subjects: string[];
|
||||
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
|
||||
description: string;
|
||||
bestlicense: string;
|
||||
collectedFrom: { "name": string, "url": string}[];
|
||||
fundedByProjects: { "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean}[];
|
||||
//relatedPublications: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
//relatedResearchData: { "name": string, "url": string, "date": string, "trust": string}[];
|
||||
//similarPublications: {"name": string, "url": string, "date": string, "trust": string}[];
|
||||
//similarDatasets: {"name": string, "url": string, "date": string, "trust": string}[];
|
||||
relatedResearchResults: { "name": string, "url": string, "date": string, "trust": string, "class": string}[];
|
||||
similarResearchResults: {"name": string, "url": string, "date": string, "trust": string, "class": string}[];
|
||||
references: { "name": string, "url": string}[];
|
||||
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string}[];
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<form>
|
||||
<div class="col-lg-6">
|
||||
<div class="input-group">
|
||||
<input #term type="text" class="form-control col-xs-5" placeholder="Search for...">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit" (click)="searchTerm(term.value)" >Go!</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -1,21 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {RouteConfig, ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {SearchComponent} from '../searchPages/search.component';
|
||||
import {AutocompleteComponent} from '../common/autoComplete.component';
|
||||
@Component({
|
||||
selector: 'home',
|
||||
templateUrl: 'src/app/home/home.component.html',
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES, AutocompleteComponent
|
||||
],
|
||||
})
|
||||
|
||||
export class HomeComponent {
|
||||
constructor ( private _router: Router) {}
|
||||
|
||||
searchTerm(term: string) {
|
||||
this._router.navigate( ['Search', { keyword: term }] );
|
||||
}
|
||||
}
|
|
@ -1,326 +0,0 @@
|
|||
import {Component, ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DatasetService} from '../../services/dataset.service';
|
||||
import {DatasetInfo} from '../../entities/datasetInfo';
|
||||
import { RouteParams} from '@angular/router-deprecated';
|
||||
import { InlineClaimContextComponent} from '../../claimPages/inlineClaimContext/inlineClaimContext.component';
|
||||
import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/inlineClaimProject.component';
|
||||
|
||||
import {TabPagingComponent} from '../tabPaging.component.ts';
|
||||
import {TabTableComponent} from '../tabTable.component.ts';
|
||||
import {ShowTitleComponent} from '../showTitle.component.ts';
|
||||
import {ShowAuthorsComponent} from '../showAuthors.component.ts';
|
||||
import {ShowIdentifiersComponent} from '../showIdentifiers.component.ts';
|
||||
import {ShowSubjectsComponent} from '../showSubjects.component.ts';
|
||||
|
||||
@Component({
|
||||
selector: 'dataset',
|
||||
template: `
|
||||
<div class="container dataset">
|
||||
<div class="container-header" >
|
||||
<div *ngIf="datasetInfo != null" >
|
||||
<showTitle [title]="datasetInfo.title"></showTitle>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
|
||||
<div class="row row-offcanvas row-offcanvas-right" >
|
||||
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="datasetInfo != null">
|
||||
<div>
|
||||
<showAuthors [authors]="datasetInfo.authors"></showAuthors>
|
||||
<span *ngIf="datasetInfo.date != ''">({{datasetInfo.date}})</span>
|
||||
</div>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt *ngIf="datasetInfo.publisher != undefined && datasetInfo.publisher != ''">Publisher: </dt>
|
||||
<dd *ngIf="datasetInfo.publisher != undefined && datasetInfo.publisher != ''">{{datasetInfo.publisher}}</dd>
|
||||
<dt *ngIf="datasetInfo.type != undefined"> Type: </dt>
|
||||
<dd *ngIf="datasetInfo.type != undefined">{{datasetInfo.type}}</dd>
|
||||
<dt *ngIf="datasetInfo.embargoEndDate != undefined && datasetInfo.embargoEndDate != ''">Embargo end date: </dt>
|
||||
<dd *ngIf="datasetInfo.embargoEndDate != undefined && datasetInfo.embargoEndDate != ''">{{datasetInfo.embargoEndDate}}</dd>
|
||||
|
||||
<showIdentifiers [identifiers]="datasetInfo.identifiers"></showIdentifiers>
|
||||
<showSubjects [subjects]="datasetInfo.subjects" [classifiedSubjects]="datasetInfo.classifiedSubjects"></showSubjects>
|
||||
</dl>
|
||||
|
||||
<blockquote *ngIf="datasetInfo.description != ''">
|
||||
<div class="text-justify" [innerHTML]="datasetInfo.description"></div>
|
||||
</blockquote>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<!--a data-toggle="tab" href="#relatedPublicationsTab">
|
||||
Related Publications
|
||||
<span *ngIf="datasetInfo.isRelatedTo == undefined" class="badge">0</span>
|
||||
<span *ngIf="datasetInfo.isRelatedTo != undefined" class="badge">
|
||||
{{datasetInfo.relatedPublications.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li role="presentation">
|
||||
<a data-toggle="tab" href="#dataTab">
|
||||
Related Research Results
|
||||
<span *ngIf="datasetInfo.relatedResearchData == undefined" class="badge">0</span>
|
||||
<span *ngIf="datasetInfo.relatedResearchData != undefined" class="badge">
|
||||
{{datasetInfo.relatedResearchData.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li-->
|
||||
|
||||
<a data-toggle="tab" href="#relatedTab">
|
||||
Related Research Results
|
||||
<span *ngIf="datasetInfo.relatedResearchResults == undefined" class="badge">0</span>
|
||||
<span *ngIf="datasetInfo.relatedResearchResults != undefined" class="badge">
|
||||
{{datasetInfo.relatedResearchResults.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li role="presentation">
|
||||
<a data-toggle="tab" href="#similarTab">
|
||||
Similar Research Results
|
||||
<span *ngIf="datasetInfo.similarResearchResults == undefined" class="badge">0</span>
|
||||
<span *ngIf="datasetInfo.similarResearchResults != undefined" class="badge">
|
||||
{{datasetInfo.similarResearchResults.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<!--div id="relatedPublicationsTab" class="tab-pane fade in active panel-body">
|
||||
<div *ngIf="datasetInfo.isRelatedTo == undefined" class = "alert alert-info " >
|
||||
There are no related publications
|
||||
</div>
|
||||
<div *ngIf="datasetInfo.isRelatedTo != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
<tabTable [info]="datasetInfo.isRelatedTo"></tabTable>
|
||||
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<div id="relatedTab" class="tab-pane fade in active panel-body">
|
||||
<div *ngIf="datasetInfo.relatedResearchResults == undefined" class = "alert alert-info " >
|
||||
There are no related research results
|
||||
</div>
|
||||
<div *ngIf="datasetInfo.relatedResearchResults != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
<tabTable [info]="datasetInfo.relatedResearchResults"></tabTable>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="similarTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="datasetInfo.similarResearchResults == undefined" class = "alert alert-info " >
|
||||
There are no similar research results
|
||||
</div>
|
||||
<div *ngIf="datasetInfo.similarResearchResults != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
|
||||
<tabTable [info]="datasetInfo.similarResearchResults"></tabTable>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3" *ngIf="datasetInfo != null">
|
||||
<ul class="list-group mainFunctionsBlock">
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection">
|
||||
<dt >Share - Bookmark</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="list-group-item" *ngIf="datasetInfo.collectedFrom != undefined">
|
||||
<dl class="functionsSection">
|
||||
<dt>Collected from</dt>
|
||||
<dd *ngFor="let item of datasetInfo.collectedFrom">
|
||||
<a href="{{item['url']}}">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="list-group-item" *ngIf="datasetInfo.downloadFrom != undefined && datasetInfo.downloadFrom.size > 0">
|
||||
<dl class="functionsSection">
|
||||
<dt class="title">Download from</dt>
|
||||
<dd class="line" *ngFor="let key of datasetInfo.downloadFrom.keys()">
|
||||
<div *ngIf="datasetInfo.downloadFrom.get(key)['url'].length > 1">
|
||||
{{key}}
|
||||
<span *ngFor="let url of datasetInfo.downloadFrom.get(key)['url']; let i=index;">
|
||||
<a href="{{url}}">
|
||||
[{{i+1}}]
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<a *ngIf="datasetInfo.downloadFrom.get(key)['url'].length == 1" href="{{datasetInfo.downloadFrom.get(key)['url']}}">
|
||||
{{key}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection" *ngIf="datasetInfo.fundedByProjects != undefined">
|
||||
<dt class="title">Funded By</dt>
|
||||
<dd
|
||||
title="{{item['title']}}
|
||||
| Project Code: {{item['acronym']}}
|
||||
| Funder: {{item['funderName']}} ({{item['funderShortname']}})
|
||||
| Funding: {{item['funding']}}"
|
||||
class="line" *ngFor="let item of datasetInfo.fundedByProjects">
|
||||
<a *ngIf="!item['new']" href="{{item['url']}}">
|
||||
{{item['funderShortname']?item['funderShortname']:item['funderName']}}
|
||||
| {{ item['acronym']?item['acronym']:item['title']}}
|
||||
</a>
|
||||
|
||||
<a *ngIf="item['new']" href="{{item['url']}}">
|
||||
<mark>
|
||||
{{item['funderShortname']?item['funderShortname']:item['funderName']}}
|
||||
| {{ item['acronym']?item['acronym']:item['title']}}
|
||||
</mark>
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<!--dl class="functionsSection" *ngIf="datasetInfo.fundedByProjects == undefined">
|
||||
<dt class="title">Funded By</dt>
|
||||
</dl-->
|
||||
<button (click)="toggleClaimProject()" class = "btn btn-default btn-xs" >Add more Projects</button>
|
||||
<inline-claim-project *ngIf="result " inline="true" inlineType ="dataset" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project>
|
||||
</li>
|
||||
<!--li class="list-group-item">
|
||||
<dl class="functionsSection" *ngIf="datasetInfo.contexts != undefined">
|
||||
<dt class="title">Related to </dt>
|
||||
<dd class="line" *ngFor="let item of datasetInfo.contexts">
|
||||
<span>{{item['labelContext']}}</span>
|
||||
<span *ngIf="item['labelCategory'] != null">-> {{item['labelCategory']}}</span>
|
||||
<span *ngIf="item['labelConcept'] != null">: {{item['labelConcept']}}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="functionsSection" *ngIf="datasetInfo.contexts == undefined">
|
||||
<dt class="title">Related to </dt>
|
||||
</dl>
|
||||
<button (click)=" toggleClaimContext()" class = "btn btn-default btn-xs" >Add Contexts</button>
|
||||
<inline-claim-context inline="true" inlineType ="dataset" [inlineEntity]="result" ></inline-claim-context>
|
||||
</li-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, DatasetService],
|
||||
directives:[InlineClaimContextComponent, InlineClaimProjectComponent,
|
||||
TabTableComponent, ShowTitleComponent, ShowAuthorsComponent,
|
||||
ShowIdentifiersComponent, ShowSubjectsComponent]
|
||||
})
|
||||
|
||||
export class DatasetComponent {
|
||||
constructor (private _datasetService: DatasetService, private _routeParams: RouteParams) {
|
||||
console.info('dataset constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.getDatasetInfo();
|
||||
}
|
||||
|
||||
private datasetInfo: DatasetInfo;
|
||||
private params: RouteParams;
|
||||
|
||||
private showStyle: boolean = false;
|
||||
private showAllReferences: boolean = false;
|
||||
private showAllRelResData: boolean = false;
|
||||
private showAllSimilPubl: boolean = false;
|
||||
private showAllBioentities: boolean = false;
|
||||
|
||||
private result ;
|
||||
private claimInline:string = "none" ;
|
||||
|
||||
@ViewChild (InlineClaimProjectComponent) inlineClaimProject : InlineClaimProjectComponent ;
|
||||
@ViewChild (InlineClaimContextComponent) inlineClaimContext : InlineClaimContextComponent ;
|
||||
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
|
||||
getDatasetInfo() {
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
if(this.params.get("datasetId")==null || this.params.get("datasetId")==''){
|
||||
this.warningMessage="No valid dataset id";
|
||||
console.info("novalid");
|
||||
}else{
|
||||
console.info("do request");
|
||||
this._datasetService.getDatasetInfo(this.params.get("datasetId")).subscribe(
|
||||
data => {
|
||||
this.datasetInfo = data;
|
||||
|
||||
this.result = []
|
||||
let result_ ={id: this.params.get("datasetId"), type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.bestlicense, embargoEndDate: ''};
|
||||
this.result.push(result_);
|
||||
},
|
||||
err => {
|
||||
console.error(err)
|
||||
console.info("error");
|
||||
|
||||
this.errorMessage = 'No dataset found';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/********** Methods for Inline Claim of project / dataset ******/
|
||||
toggleClaimProject(){
|
||||
this.inlineClaimProject.toggle();
|
||||
}
|
||||
projectAdded($event){
|
||||
var projects =$event.value;
|
||||
if(projects){
|
||||
for(var i=0; i < projects.length; i++){
|
||||
|
||||
if(this.datasetInfo.fundedByProjects == undefined) {
|
||||
this.datasetInfo.fundedByProjects = new Array<
|
||||
{ "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean
|
||||
}>();
|
||||
}
|
||||
var project =projects[i];
|
||||
|
||||
let counter = this.datasetInfo.fundedByProjects.length;
|
||||
this.datasetInfo.fundedByProjects[counter]['url'] =
|
||||
"http://localhost:3000/project?projectId="+project.projectId;
|
||||
this.datasetInfo.fundedByProjects[counter]['acronym'] = project.projectAcronym;
|
||||
this.datasetInfo.fundedByProjects[counter]['title'] = project.projectName;
|
||||
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = project.selectedFunderId;
|
||||
this.datasetInfo.fundedByProjects[counter]['funderName'] = project.selectedFunderName;
|
||||
this.datasetInfo.fundedByProjects[counter]['new'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
toggleClaimContext(){
|
||||
this.inlineClaimContext.toggle();
|
||||
}
|
||||
contextAdded($event){
|
||||
var contexts =$event.value;
|
||||
if(contexts){
|
||||
for(var i=0; i < contexts.length; i++){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams } from '@angular/router-deprecated';
|
||||
import {PersonService} from '../../services/person.service';
|
||||
import {PersonInfo} from '../../entities/personInfo';
|
||||
|
||||
@Component({
|
||||
selector: 'person',
|
||||
template: `
|
||||
|
||||
<div>
|
||||
<div class="container person">
|
||||
<div class="container-header" >
|
||||
<div *ngIf="personInfo != null">
|
||||
<h3>{{personInfo.fullname}}</h3>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
|
||||
<div class="row row-offcanvas row-offcanvas-right" >
|
||||
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="personInfo != null">
|
||||
<dl class="dl-horizontal">
|
||||
<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 class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#publicationsTab">
|
||||
Publications
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a data-toggle="tab" href="#researchDataTab">
|
||||
Research Data
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="publicationsTab" class="tab-pane fade in active panel-body">
|
||||
|
||||
<div *ngIf="personInfo.publications == undefined" class = "alert alert-info " >
|
||||
There are no publications
|
||||
</div>
|
||||
|
||||
<div *ngIf="personInfo.publications != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="researchDataTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="personInfo.researchData == undefined" class = "alert alert-info ">
|
||||
There are no research data
|
||||
</div>
|
||||
<div *ngIf="personInfo.researchData != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-3" *ngIf="personInfo != null">
|
||||
<ul class="list-group mainFunctionsBlock">
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection">
|
||||
<dt >Share - Bookmark</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, PersonService]
|
||||
})
|
||||
|
||||
export class PersonComponent {
|
||||
constructor (private _personService: PersonService,
|
||||
private _routeParams: RouteParams) {
|
||||
console.info('person constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info('person init');
|
||||
this.getPersonInfo();
|
||||
}
|
||||
|
||||
personInfo: PersonInfo;
|
||||
params: RouteParams;
|
||||
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
|
||||
getPersonInfo () {
|
||||
console.info("inside getProjectInfo of component");
|
||||
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
if(this.params.get("personId")==null || this.params.get("personId")==''){
|
||||
this.warningMessage="No valid person id";
|
||||
console.info("novalid");
|
||||
} else {
|
||||
console.info("do request");
|
||||
|
||||
this._personService.getPersonInfo(this.params.get('personId')).subscribe(
|
||||
data => {
|
||||
this.personInfo = data;
|
||||
},
|
||||
err => {
|
||||
console.error(err)
|
||||
console.info("error");
|
||||
|
||||
this.errorMessage = 'No person found';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,238 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams } from '@angular/router-deprecated';
|
||||
import {ProjectService} from '../../services/project.service';
|
||||
import {ProjectInfo} from '../../entities/projectInfo';
|
||||
|
||||
@Component({
|
||||
selector: 'project',
|
||||
template: `
|
||||
<div>
|
||||
<div class="container person">
|
||||
<div class="container-header" >
|
||||
<div *ngIf="projectInfo != null">
|
||||
<h3 class="sc39" title="Special Clause 39">{{projectInfo.acronym}}</h3>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
|
||||
<div class="row row-offcanvas row-offcanvas-right" >
|
||||
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="projectInfo != null">
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt *ngIf="projectInfo.title != undefined && projectInfo.title != ''">Title: </dt>
|
||||
<dd *ngIf="projectInfo.title != undefined && projectInfo.title != ''">{{projectInfo.title}}</dd>
|
||||
<dt *ngIf="projectInfo.funding != undefined && projectInfo.funding != ''">Funding: </dt>
|
||||
<dd *ngIf="projectInfo.funding != undefined && projectInfo.funding != ''">{{projectInfo.funding}}</dd>
|
||||
<dt *ngIf="projectInfo.callIdentifier != undefined && projectInfo.callIdentifier != ''">Call: </dt>
|
||||
<dd *ngIf="projectInfo.callIdentifier != undefined && projectInfo.callIdentifier != ''">{{projectInfo.callIdentifier}}</dd>
|
||||
<dt *ngIf="projectInfo.contractNum != undefined && projectInfo.contractNum != ''">Contract (GA) number: </dt>
|
||||
<dd *ngIf="projectInfo.contractNum != undefined && projectInfo.contractNum != ''">{{projectInfo.contractNum}}</dd>
|
||||
<dt *ngIf="projectInfo.startDate != undefined && projectInfo.startDate != ''">Start Date: </dt>
|
||||
<dd *ngIf="projectInfo.startDate != undefined && projectInfo.startDate != ''">{{projectInfo.startDate}}</dd>
|
||||
<dt *ngIf="projectInfo.endDate != undefined && projectInfo.endDate != ''">End Date: </dt>
|
||||
<dd *ngIf="projectInfo.endDate != undefined && projectInfo.endDate != ''">{{projectInfo.endDate}}</dd>
|
||||
<dt *ngIf="projectInfo.openAccessMandate != undefined && projectInfo.openAccessMandate != ''">Open Access mandate: </dt>
|
||||
<dd *ngIf="projectInfo.openAccessMandate != undefined && projectInfo.openAccessMandate != ''">{{projectInfo.openAccessMandate}}</dd>
|
||||
<dt *ngIf="projectInfo.specialClause39 != undefined && projectInfo.specialClause39 != ''">Special Clause 39: </dt>
|
||||
<dd *ngIf="projectInfo.specialClause39 != undefined && projectInfo.specialClause39 != ''">{{projectInfo.specialClause39}}</dd>
|
||||
<dt *ngIf="projectInfo.organizations != undefined">Organizations: </dt>
|
||||
<dd *ngIf="projectInfo.organizations != undefined">
|
||||
<ul class="list-inline">
|
||||
<li *ngFor="let key of projectInfo.organizations.keys()">
|
||||
<a *ngIf="projectInfo.organizations.get(key) != null &&
|
||||
projectInfo.organizations.get(key) != ''"
|
||||
href="{{projectInfo.organizations.get(key)}}" target="_blank">
|
||||
{{key}}
|
||||
</a>
|
||||
<span *ngIf="projectInfo.organizations.get(key) == null ||
|
||||
projectInfo.organizations.get(key) == ''">
|
||||
{{key}}
|
||||
</span>
|
||||
<span>;</span>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt *ngIf="projectInfo.urlInfo != undefined && projectInfo.urlInfo != ''">More information:</dt>
|
||||
<dd *ngIf="projectInfo.urlInfo != undefined && projectInfo.urlInfo != ''">
|
||||
<a target="_blank" href="{{projectInfo.url}}">
|
||||
{{projectInfo.urlInfo}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#publicationsTab">
|
||||
Publications
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#researchDataTab">
|
||||
Research Data
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#statisticsTab">
|
||||
Statistics
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="publicationsTab" class="tab-pane fade in active panel-body">
|
||||
|
||||
<div *ngIf="projectInfo.publications == undefined" class = "alert alert-info " >
|
||||
There are no publications
|
||||
</div>
|
||||
|
||||
<div *ngIf="projectInfo.publications != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="researchDataTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="projectInfo.researchData == undefined" class = "alert alert-info ">
|
||||
There are no research data
|
||||
</div>
|
||||
<div *ngIf="projectInfo.researchData != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="statisticsTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="projectInfo.statistics == undefined" class = "alert alert-info ">
|
||||
There are no statistics
|
||||
</div>
|
||||
<div *ngIf="projectInfo.statistics != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-3" *ngIf="projectInfo != null">
|
||||
<ul class="list-group mainFunctionsBlock">
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection">
|
||||
<dt >Share - Bookmark</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection">
|
||||
<dt>
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr><td>
|
||||
<a data-toggle="tab" href="">
|
||||
Publication details
|
||||
</a>
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<a data-toggle="tab" href="">
|
||||
Dynamically incorporate publications in your site (HTML)
|
||||
</a>
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<a data-toggle="tab" href="">
|
||||
View EC progress report (HTML)
|
||||
</a>
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<a data-toggle="tab" href="">
|
||||
Download EC progress report (CSV)
|
||||
</a>
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<div class="text-center">
|
||||
<a class="btn btn-danger btn-block" href="">
|
||||
Link Research Results
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="btn btn-danger btn-block" href="">
|
||||
Deposit Publications
|
||||
</a>
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, ProjectService]
|
||||
})
|
||||
export class ProjectComponent {
|
||||
constructor (private _projectService: ProjectService,
|
||||
private _routeParams: RouteParams) {
|
||||
console.info('project constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info('project init');
|
||||
this.getProjectInfo();
|
||||
}
|
||||
|
||||
results : String[];
|
||||
orcidresults : String[];
|
||||
resultsNum : number ;
|
||||
|
||||
projectInfo: ProjectInfo;
|
||||
params: RouteParams;
|
||||
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
|
||||
getProjectInfo () {
|
||||
console.info("inside getProjectInfo of component");
|
||||
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
if(this.params.get("projectId")==null || this.params.get("projectId")==''){
|
||||
this.warningMessage="No valid project id";
|
||||
console.info("novalid");
|
||||
} else {
|
||||
console.info("do request");
|
||||
|
||||
this._projectService.getProjectInfo(this.params.get('projectId')).subscribe(
|
||||
data => {
|
||||
this.projectInfo = data;
|
||||
},
|
||||
err => {
|
||||
console.error(err)
|
||||
console.info("error");
|
||||
|
||||
this.errorMessage = 'No project found';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,450 +0,0 @@
|
|||
import {Component, ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {PublicationService} from '../../services/publication.service';
|
||||
import {PublicationInfo} from '../../entities/publicationInfo';
|
||||
import { RouteParams} from '@angular/router-deprecated';
|
||||
import { InlineClaimContextComponent} from '../../claimPages/inlineClaimContext/inlineClaimContext.component';
|
||||
import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/inlineClaimProject.component';
|
||||
|
||||
import {TabPagingComponent} from '../tabPaging.component.ts';
|
||||
import {TabTableComponent} from '../tabTable.component.ts';
|
||||
import {ShowTitleComponent} from '../showTitle.component.ts';
|
||||
import {ShowAuthorsComponent} from '../showAuthors.component.ts';
|
||||
import {ShowIdentifiersComponent} from '../showIdentifiers.component.ts';
|
||||
import {ShowSubjectsComponent} from '../showSubjects.component.ts';
|
||||
|
||||
@Component({
|
||||
selector: 'publication',
|
||||
template: `
|
||||
<div>
|
||||
<div class="container publication">
|
||||
<div class="container-header" >
|
||||
<div *ngIf="publicationInfo != null">
|
||||
<showTitle [title]="publicationInfo.title"></showTitle>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
|
||||
<div class="row row-offcanvas row-offcanvas-right" >
|
||||
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="publicationInfo != null">
|
||||
<div>
|
||||
<showAuthors [authors]="publicationInfo.authors"></showAuthors>
|
||||
<span *ngIf="publicationInfo.date != ''">({{publicationInfo.date}})</span>
|
||||
</div>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt *ngIf="publicationInfo.publisher != undefined && publicationInfo.publisher != ''">Publisher: </dt>
|
||||
<dd *ngIf="publicationInfo.publisher != undefined && publicationInfo.publisher != ''">{{publicationInfo.publisher}}</dd>
|
||||
<dt *ngIf="publicationInfo.journal != undefined && publicationInfo.journal['journal'] != ''">Journal: </dt>
|
||||
<dd *ngIf="publicationInfo.journal != undefined && publicationInfo.journal != ''">
|
||||
{{publicationInfo.journal['journal']}}
|
||||
<span *ngIf="publicationInfo.journal['issn'] != ''">
|
||||
<mark>issn:</mark> {{publicationInfo.journal['issn']}}
|
||||
</span>
|
||||
<span *ngIf="publicationInfo.journal['lissn'] != ''">
|
||||
<mark>lissn:</mark> {{publicationInfo.journal['lissn']}}
|
||||
</span>
|
||||
</dd>
|
||||
<dt *ngIf="publicationInfo.languages != undefined && publicationInfo.languages != 'Undetermined' && publicationInfo.languages != ''"> Languages: </dt>
|
||||
<dd *ngIf="publicationInfo.languages != undefined && publicationInfo.languages != 'Undetermined' && publicationInfo.languages != ''">{{publicationInfo.languages}}</dd>
|
||||
<dt *ngIf="publicationInfo.types != undefined && publicationInfo.types.length > 0"> Types: </dt>
|
||||
<dd *ngIf="publicationInfo.types != undefined && publicationInfo.types.length > 0">{{publicationInfo.types}}</dd>
|
||||
<dt *ngIf="publicationInfo.embargoEndDate != undefined && publicationInfo.embargoEndDate != ''">Embargo end date: </dt>
|
||||
<dd *ngIf="publicationInfo.embargoEndDate != undefined && publicationInfo.embargoEndDate != ''">{{publicationInfo.embargoEndDate}}</dd>
|
||||
|
||||
<showIdentifiers [identifiers]="publicationInfo.identifiers"></showIdentifiers>
|
||||
<showSubjects [subjects]="publicationInfo.subjects" [classifiedSubjects]="publicationInfo.classifiedSubjects"></showSubjects>
|
||||
</dl>
|
||||
|
||||
<blockquote *ngIf="publicationInfo.description != ''">
|
||||
<div class="text-justify" [innerHTML]="publicationInfo.description"></div>
|
||||
</blockquote>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a data-toggle="tab" href="#citationsTab">
|
||||
References
|
||||
<span *ngIf="publicationInfo.references == undefined" class="badge">0</span>
|
||||
<span *ngIf="publicationInfo.references != undefined" class="badge">
|
||||
{{publicationInfo.references.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a data-toggle="tab" href="#relatedTab">
|
||||
Related Research Results
|
||||
<span *ngIf="publicationInfo.relatedResearchResults == undefined" class="badge">0</span>
|
||||
<span *ngIf="publicationInfo.relatedResearchResults != undefined" class="badge">
|
||||
{{publicationInfo.relatedResearchResults.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a data-toggle="tab" href="#similarTab">
|
||||
Similar Research Results
|
||||
<span *ngIf="publicationInfo.similarResearchResults == undefined" class="badge">0</span>
|
||||
<span *ngIf="publicationInfo.similarResearchResults != undefined" class="badge">
|
||||
{{publicationInfo.similarResearchResults.length}}
|
||||
</span>
|
||||
<!--span *ngIf="publicationInfo.similarPublications == undefined && publicationInfo.similarDatasets == undefined" class="badge">0</span>
|
||||
<span *ngIf="publicationInfo.similarPublications != undefined && publicationInfo.similarDatasets != undefined" class="badge">
|
||||
{{publicationInfo.similarPublications.length + publicationInfo.similarDatasets.length}}
|
||||
</span>
|
||||
<span *ngIf="publicationInfo.similarPublications != undefined && publicationInfo.similarDatasets == undefined" class="badge">
|
||||
{{publicationInfo.similarPublications.length}}
|
||||
</span>
|
||||
<span *ngIf="publicationInfo.similarPublications == undefined && publicationInfo.similarDatasets != undefined" class="badge">
|
||||
{{publicationInfo.similarDatasets.length}}
|
||||
</span-->
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation" *ngIf="publicationInfo.bioentities != undefined">
|
||||
<a data-toggle="tab" href="#bioentitiesTab">
|
||||
Bioentities
|
||||
<span class="badge">{{bioentitiesNum}}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="citationsTab" class="tab-pane fade in active panel-body">
|
||||
|
||||
<div *ngIf="publicationInfo.references == undefined" class = "alert alert-info " >
|
||||
There are no references
|
||||
</div>
|
||||
|
||||
<div *ngIf="publicationInfo.references != undefined">
|
||||
<tabPaging [showAll]="showAllReferences" [length]="publicationInfo.references.length" (changeShowAll)="showChange($event)"></tabPaging>
|
||||
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
|
||||
<div *ngFor="let item of publicationInfo.references.slice(0,10)">
|
||||
<p *ngIf=" item != undefined && item['url'] != undefined">
|
||||
<a href="{{item['url']}}" target="_blank">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
</p>
|
||||
<p *ngIf="item['url'] == undefined">
|
||||
{{item['name']}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="showAllReferences">
|
||||
<div *ngFor="let item of publicationInfo.references.slice(10)">
|
||||
<p *ngIf=" item != undefined && item['url'] != undefined">
|
||||
<a href="{{item['url']}}" target="_blank">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
</p>
|
||||
<p *ngIf="item['url'] == undefined">
|
||||
{{item['name']}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tabPaging [showAll]="showAllReferences" [length]="publicationInfo.references.length" (changeShowAll)="showChange($event)"></tabPaging>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="relatedTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="publicationInfo.relatedResearchResults == undefined" class = "alert alert-info ">
|
||||
There are no related research results
|
||||
</div>
|
||||
<div *ngIf="publicationInfo.relatedResearchResults != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
|
||||
<tabTable [info]="publicationInfo.relatedResearchResults"></tabTable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="similarTab" class="tab-pane fade panel-body">
|
||||
<div *ngIf="publicationInfo.similarResearchResults == undefined" class = "alert alert-info ">
|
||||
There are no similar research results
|
||||
</div>
|
||||
<div *ngIf="publicationInfo.similarResearchResults != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
|
||||
<tabTable [info]="publicationInfo.similarResearchResults"></tabTable>
|
||||
</div>
|
||||
|
||||
<!--div *ngIf="publicationInfo.similarPublications == undefined && publicationInfo.similarDatasets == undefined" class = "alert alert-info " >
|
||||
There are no similar research data
|
||||
</div>
|
||||
<div *ngIf="publicationInfo.similarPublications != undefined || publicationInfo.similarDatasets != undefined">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
|
||||
<div *ngIf="publicationInfo.similarPublications != undefined">
|
||||
<tabTable [info]="publicationInfo.similarPublications"></tabTable>
|
||||
</div>
|
||||
|
||||
<div *ngIf="publicationInfo.similarDatasets != undefined">
|
||||
<tabTable [info]="publicationInfo.similarDatasets"></tabTable>
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
<div *ngIf="publicationInfo.bioentities != undefined" id="bioentitiesTab" class="tab-pane fade panel-body">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</p>
|
||||
<table id="bioentitiesTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Bio Entity</th>
|
||||
<th class="text-center">Site Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let key of publicationInfo.bioentities.keys()">
|
||||
<tr *ngFor="let keyIn of publicationInfo.bioentities.get(key).keys()">
|
||||
<td class="text-center" *ngIf="keyIn != undefined">
|
||||
<a href="{{publicationInfo.bioentities.get(key).get(keyIn)}}" target="_blank">
|
||||
{{keyIn}}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{{key}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3" *ngIf="publicationInfo != null">
|
||||
|
||||
<ul class="list-group mainFunctionsBlock">
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection">
|
||||
<dt >Share - Bookmark</dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="list-group-item" *ngIf="publicationInfo.collectedFrom != undefined">
|
||||
<dl class="functionsSection">
|
||||
<dt >Collected from</dt>
|
||||
<dd *ngFor="let item of publicationInfo.collectedFrom">
|
||||
<a href="{{item['url']}}">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="list-group-item" *ngIf="publicationInfo.downloadFrom != undefined && publicationInfo.downloadFrom.size > 0">
|
||||
<dl class="functionsSection">
|
||||
<dt class="title">Download from</dt>
|
||||
<dd class="line" *ngFor="let key of publicationInfo.downloadFrom.keys()">
|
||||
<div *ngIf="publicationInfo.downloadFrom.get(key)['url'].length > 1">
|
||||
{{key}}
|
||||
<span *ngFor="let url of publicationInfo.downloadFrom.get(key)['url']; let i=index;">
|
||||
<a href="{{url}}">
|
||||
[{{i+1}}]
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<a *ngIf="publicationInfo.downloadFrom.get(key)['url'].length == 1" href="{{publicationInfo.downloadFrom.get(key)['url']}}">
|
||||
{{key}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="list-group-item" *ngIf="publicationInfo.publishedIn != undefined && publicationInfo.publishedIn.length > 0">
|
||||
<dl class="functionsSection">
|
||||
<dt class="title">Published in</dt>
|
||||
<dd class="line" *ngFor="let key of publicationInfo.publishedIn.keys()">
|
||||
<div *ngIf="publicationInfo.publishedIn.get(key)['url'].length > 1">
|
||||
{{key}}
|
||||
<span *ngFor="let url of publicationInfo.publishedIn.get(key)['url']; let i=index">
|
||||
<a href="{{url}}">
|
||||
[{{i+1}}]
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<a *ngIf="publicationInfo.publishedIn.get(key)['url'].length == 1" href="{{publicationInfo.publishedIn.get(key)['url']}}">
|
||||
{{key}}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection" *ngIf="publicationInfo.fundedByProjects != undefined">
|
||||
<dt class="title">Funded By</dt>
|
||||
<dd
|
||||
title="{{item['title']}}
|
||||
| Project Code: {{item['acronym']}}
|
||||
| Funder: {{item['funderName']}} ({{item['funderShortname']}})
|
||||
| Funding: {{item['funding']}}"
|
||||
class="line" *ngFor="let item of publicationInfo.fundedByProjects">
|
||||
<a *ngIf="!item['new']" href="{{item['url']}}">
|
||||
{{item['funderShortname']?item['funderShortname']:item['funderName']}}
|
||||
| {{ item['acronym']?item['acronym']:item['title']}}
|
||||
</a>
|
||||
|
||||
<a *ngIf="item['new']" href="{{item['url']}}">
|
||||
<mark>
|
||||
{{item['funderShortname']?item['funderShortname']:item['funderName']}}
|
||||
| {{ item['acronym']?item['acronym']:item['title']}}
|
||||
</mark>
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<!--dl class="functionsSection" *ngIf="publicationInfo.fundedByProjects == undefined">
|
||||
<dt class="title">Funded By</dt>
|
||||
</dl-->
|
||||
<button (click)="toggleClaimProject()" class = "btn btn-default btn-xs" >Add more Projects</button>
|
||||
<inline-claim-project *ngIf="result " inline="true" inlineType ="publication" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<dl class="functionsSection" *ngIf="publicationInfo.contexts != undefined">
|
||||
<dt class="title">Related to </dt>
|
||||
<dd class="line" *ngFor="let item of publicationInfo.contexts">
|
||||
<span>{{item['labelContext']}}</span>
|
||||
<span *ngIf="item['labelCategory'] != null">-> {{item['labelCategory']}}</span>
|
||||
<span *ngIf="item['labelConcept'] != null">: {{item['labelConcept']}}</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="functionsSection" *ngIf="publicationInfo.contexts == undefined">
|
||||
<dt class="title">Related to </dt>
|
||||
|
||||
</dl>
|
||||
<button (click)=" toggleClaimContext()" class = "btn btn-default btn-xs" >Add Contexts</button>
|
||||
<inline-claim-context inline="true" inlineType ="publication" [inlineEntity]="result" ></inline-claim-context>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, PublicationService],
|
||||
directives:[InlineClaimContextComponent, InlineClaimProjectComponent,
|
||||
TabPagingComponent, TabTableComponent, ShowTitleComponent,
|
||||
ShowAuthorsComponent, ShowIdentifiersComponent, ShowSubjectsComponent]
|
||||
})
|
||||
|
||||
export class PublicationComponent {
|
||||
constructor (private _publicationService: PublicationService, private _routeParams: RouteParams) {
|
||||
console.info('publication constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getPublicationInfo();
|
||||
}
|
||||
|
||||
private publicationInfo: PublicationInfo;
|
||||
private params: RouteParams;
|
||||
|
||||
private showAllReferences: boolean = false;
|
||||
private showAllRelResData: boolean = false;
|
||||
private showAllSimilPubl: boolean = false;
|
||||
private showAllBioentities: boolean = false;
|
||||
private showFundingDetails: boolean = false;
|
||||
|
||||
private bioentitiesNum: number = 0;
|
||||
|
||||
private result;
|
||||
private claimInline:string = "none" ;
|
||||
|
||||
@ViewChild (InlineClaimProjectComponent) inlineClaimProject : InlineClaimProjectComponent ;
|
||||
@ViewChild (InlineClaimContextComponent) inlineClaimContext : InlineClaimContextComponent ;
|
||||
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
|
||||
getPublicationInfo() {
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
if(this.params.get("articleId")==null || this.params.get("articleId")==''){
|
||||
this.warningMessage="No valid publication id";
|
||||
console.info("novalid");
|
||||
}else{
|
||||
console.info("do request");
|
||||
this._publicationService.getPublicationInfo(this.params.get("articleId")).subscribe(
|
||||
data => {
|
||||
this.publicationInfo = data;
|
||||
|
||||
let bioentitiesNum = 0;
|
||||
if(this.publicationInfo.bioentities != undefined) {
|
||||
this.publicationInfo.bioentities.forEach(function (value, key, map) {
|
||||
bioentitiesNum += value.size;
|
||||
});
|
||||
}
|
||||
this.bioentitiesNum = bioentitiesNum;
|
||||
|
||||
this.result = []
|
||||
let result_ ={id: this.params.get("articleId"), type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
|
||||
this.result.push(result_);
|
||||
},
|
||||
err => {
|
||||
console.error(err)
|
||||
console.info("error");
|
||||
|
||||
this.errorMessage = 'No publication found';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/********** Methods for Inline Claim of project / publication ******/
|
||||
toggleClaimProject(){
|
||||
this.inlineClaimProject.toggle();
|
||||
}
|
||||
projectAdded($event){
|
||||
var projects =$event.value;
|
||||
if(projects){
|
||||
for(var i=0; i < projects.length; i++){
|
||||
|
||||
if(this.publicationInfo.fundedByProjects == undefined) {
|
||||
this.publicationInfo.fundedByProjects = new Array<
|
||||
{ "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean
|
||||
}>();
|
||||
}
|
||||
var project =projects[i];
|
||||
|
||||
let counter = this.publicationInfo.fundedByProjects.length;
|
||||
this.publicationInfo.fundedByProjects[counter]['url'] =
|
||||
"http://localhost:3000/project?projectId="+project.projectId;
|
||||
this.publicationInfo.fundedByProjects[counter]['acronym'] = project.projectAcronym;
|
||||
this.publicationInfo.fundedByProjects[counter]['title'] = project.projectName;
|
||||
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = project.selectedFunderId;
|
||||
this.publicationInfo.fundedByProjects[counter]['funderName'] = project.selectedFunderName;
|
||||
this.publicationInfo.fundedByProjects[counter]['new'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
toggleClaimContext(){
|
||||
this.inlineClaimContext.toggle();
|
||||
}
|
||||
contextAdded($event){
|
||||
var contexts =$event.value;
|
||||
if(contexts){
|
||||
for(var i=0; i < contexts.length; i++){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showChange($event) {
|
||||
this.showAllReferences=$event.value;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'showAuthors',
|
||||
template: `
|
||||
<span *ngIf="authors != undefined">
|
||||
<div *ngIf="showAll">
|
||||
<a class="text-muted" (click)="showAll = !showAll;">View less authors</a>
|
||||
</div>
|
||||
<span *ngFor="let item of authors.slice(0,30)">
|
||||
<a class="custom-external" href="{{item['url']}}" target="_blank">
|
||||
{{item['name']}};
|
||||
</a>
|
||||
</span>
|
||||
<span *ngIf="!showAll && authors.length > 30"> ... </span>
|
||||
<span *ngIf="showAll">
|
||||
<span *ngFor="let item of authors.slice(30)">
|
||||
<a class="custom-external" href="{{item['url']}}" target="_blank">
|
||||
{{item['name']}};
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
<span *ngIf="!showAll && authors.length > 30">
|
||||
<a class="text-muted" (click)="showAll = !showAll;">
|
||||
view all {{authors.length}} authors
|
||||
</a>
|
||||
</span>
|
||||
<span *ngIf="showAll">
|
||||
<a class="text-muted" (click)="showAll = !showAll;">View less authors</a>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class ShowAuthorsComponent {
|
||||
@Input() authors: { [key: string]: string }[];
|
||||
private showAll: boolean = false;
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('showAuthors constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'showIdentifiers',
|
||||
template: `
|
||||
<div *ngIf="identifiers != undefined && identifiers.size > 0">
|
||||
<dt>Identifiers:</dt>
|
||||
<dd>
|
||||
<ul class="list-inline">
|
||||
<li *ngFor="let key of identifiers.keys()">
|
||||
<div *ngFor="let item of identifiers.get(key)">
|
||||
<div [ngSwitch]="key">
|
||||
<template [ngSwitchWhen]="'doi'">
|
||||
<a class="custom-external" href="http://dx.doi.org/{{item}}" target="_blank">
|
||||
{{key}}: {{item}}
|
||||
</a>
|
||||
</template>
|
||||
<template [ngSwitchWhen]="'pmc'">
|
||||
<a class="custom-external" href="http://europepmc.org/articles/{{item}}" target="_blank">
|
||||
{{key}}: {{item}}
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class ShowIdentifiersComponent {
|
||||
@Input() identifiers: Map<string, string[]>;//Map<string, string>;
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('showIdentifiers constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'showSubjects',
|
||||
template: `
|
||||
<div *ngIf="subjects != undefined">
|
||||
<dt *ngIf="subjects.length > 0 || classifiedSubjects.size > 0">
|
||||
Subjects:
|
||||
</dt>
|
||||
<dd>
|
||||
<div *ngIf="subjects.length > 0"> {{subjects}} </div>
|
||||
<div *ngIf="subjects.length == 0 && classifiedSubjects.size > 0"> - </div>
|
||||
</dd>
|
||||
|
||||
<dd class="col-md-offset-1" *ngIf="classifiedSubjects.size > 0">
|
||||
<a (click)="showClassifiedSbj = !showClassifiedSbj;">
|
||||
<div *ngIf="!showClassifiedSbj">
|
||||
Show additional classifications
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||
</div>
|
||||
<div *ngIf="showClassifiedSbj">
|
||||
Hide additional classifications
|
||||
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="well" *ngIf="showClassifiedSbj">
|
||||
<div *ngFor="let key of classifiedSubjects.keys()">
|
||||
Classified by OpenAIRE into
|
||||
<div>
|
||||
{{key}}: {{classifiedSubjects.get(key)}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class ShowSubjectsComponent {
|
||||
@Input() subjects: string[];
|
||||
@Input() classifiedSubjects: Map<string, string[]>;
|
||||
private showClassifiedSbj: boolean = false;
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('showSubjects constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'showTitle',
|
||||
template: `
|
||||
<h2 *ngIf="title != undefined">
|
||||
<div *ngIf="title['url'] != undefined">
|
||||
<a class="custom-external" href="{{title['url']}}" target="_blank">
|
||||
<div [innerHTML]="title['name']"></div>
|
||||
</a>
|
||||
</div>
|
||||
<div *ngIf="title['url'] == undefined">
|
||||
<div [innerHTML]="title['name']"></div>
|
||||
</div>
|
||||
</h2>
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class ShowTitleComponent {
|
||||
@Input() title: { [key: string]: string };
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('title constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'tabPaging',
|
||||
template: `
|
||||
<div class="panel panel-default" *ngIf="!showAll && length > 10">
|
||||
<div class="panel-heading">
|
||||
<a (click)="changeShowAll.emit({value: true});">
|
||||
<div class="text-right">view all {{length}}</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class TabPagingComponent {
|
||||
@Input() showAll: boolean;
|
||||
@Input() length: number;
|
||||
@Output() changeShowAll: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('publication:paging constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'tabTable',
|
||||
template: `
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Trust</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of info" class="{{item['class']}}">
|
||||
<td *ngIf="item != undefined">
|
||||
<span *ngIf="item['class'] == 'dataset'" class="glyphicon glyphicon-star" aria-hidden="true">
|
||||
|
||||
</span>
|
||||
<a *ngIf="item['url'] != '' && item['name'] != ''" class="custom-external" href="{{item['url']}}" target="_blank">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
<p *ngIf="item['url'] == '' && item['name'] != ''">{{item['name']}}</p>
|
||||
<span *ngIf="item['date'] != ''">
|
||||
({{item['date']}})
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div *ngIf="item['trust'] != ''" class="progress">
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="29" aria-valuemin="0" aria-valuemax="100" [style.width] = "item['trust']">
|
||||
{{item['trust']}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="item['trust'] == ''">
|
||||
<p>no trust found</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
`
|
||||
,
|
||||
directives: [
|
||||
...ROUTER_DIRECTIVES
|
||||
]
|
||||
})
|
||||
|
||||
export class TabTableComponent {
|
||||
@Input() info: { "name": string, "url": string, "date": string, "trust": string}[];//Map<string, string[]>;
|
||||
|
||||
constructor (private _router: Router) {
|
||||
console.info('tabTable constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'claimTextFilter'
|
||||
})
|
||||
export class ClaimTextFilterPipe implements PipeTransform {
|
||||
|
||||
transform(value: any, filter: string): any {
|
||||
console.info('ClaimTextFilterPipe word to filter : '+filter);
|
||||
filter = filter?filter.toLocaleLowerCase():'';
|
||||
return filter ? value.filter(claim=> (
|
||||
claim.sourceType.toLocaleLowerCase().indexOf(filter)!=-1|| //sourceType
|
||||
claim.targetType.toLocaleLowerCase().indexOf(filter)!=-1|| //targetType
|
||||
claim.userMail.toLocaleLowerCase().indexOf(filter)!=-1|| //mail
|
||||
((claim.source.title && claim.source.title.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.source.name && claim.source.name.toLocaleLowerCase().indexOf(filter)!=-1))|| //source title
|
||||
((claim.target.title && claim.target.title.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.target.name && claim.target.name.toLocaleLowerCase().indexOf(filter)!=-1))|| //target title
|
||||
((claim.source.funderName && claim.source.funderName.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.source.funderName && claim.source.funderName.toLocaleLowerCase().indexOf(filter)!=-1))|| //source funder name
|
||||
((claim.target.funderName && claim.target.funderName.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.target.funderName && claim.target.funderName.toLocaleLowerCase().indexOf(filter)!=-1)) //target funder name
|
||||
)) : value;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
|
||||
@Pipe({name: 'claimTypeFilter'})
|
||||
export class ClaimTypeFilterPipe implements PipeTransform {
|
||||
transform(value: any, publication:boolean,dataset:boolean,project:boolean,context:boolean) : any {
|
||||
let filter = publication;
|
||||
console.info('ClaimTypeFilterPipe types to show : '+(publication?'publication ':' ')+(dataset?'dataset ':' ')+(project?'project ':' ')+(context?'context ':' '));
|
||||
return (value)?value.filter((claim) =>{
|
||||
let filter =publication;
|
||||
if(publication||dataset||project||context) {
|
||||
let filter = publication
|
||||
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('publication')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('publication')!=-1 )) {
|
||||
return true;
|
||||
}
|
||||
filter = dataset;
|
||||
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('dataset')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('dataset')!=-1 )) {
|
||||
return true;
|
||||
}
|
||||
filter = project;
|
||||
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('project')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('project')!=-1 )) {
|
||||
return true;
|
||||
}
|
||||
filter = context;
|
||||
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('context')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('context')!=-1 )) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}):value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {SearchCrossrefService} from '../services/searchCrossref.service';
|
||||
import {Publication} from '../entities/publication';
|
||||
import {PagingFormatter} from '../common/pagingFormatter.component';
|
||||
import {PublicationTitleFormatter} from '../common/publicationTitleFormatter.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'search-all',
|
||||
directives: [...ROUTER_DIRECTIVES,PagingFormatter, PublicationTitleFormatter],
|
||||
template: `
|
||||
|
||||
|
||||
<div *ngIf="claim">
|
||||
<h3>Selected publications:</h3>
|
||||
<p *ngFor=" let item of selected "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> {{item.DOI}} --{{item.publisher}} <button (click)="remove(item)" type="button" class="btn btn-default">Remove</button></p>
|
||||
</div>
|
||||
|
||||
<h1>Search</h1>
|
||||
<form>
|
||||
<input #term [(ngModel)]="keyword"/>
|
||||
<button (click)="search(term)" type="submit" class="btn btn-default">Search</button>
|
||||
</form>
|
||||
<div>
|
||||
<div *ngIf="resultsNum != null && resultsNum > 0">
|
||||
<p > {{resultsNum }} Total Results </p>
|
||||
<paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size"> </paging>
|
||||
</div>
|
||||
<div >
|
||||
|
||||
<p *ngFor=" let item of results "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> {{item.DOI}} --{{item.publisher}} <button *ngIf="claim" (click)="add(item)" type="button" class="btn btn-default">Select</button> </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, SearchCrossrefService]
|
||||
})
|
||||
export class SearchAllComponent {
|
||||
constructor (private _searchService: SearchCrossrefService,
|
||||
private _routeParams: RouteParams) {}
|
||||
ngOnInit() {
|
||||
let page = +this._routeParams.get('page');
|
||||
let size = +this._routeParams.get('size');
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.size = ( size <= 0 ) ? 10 : size;
|
||||
this.keyword = this._routeParams.get('keyword');
|
||||
if(this.keyword !=null){
|
||||
this.searchCrossref(this.keyword,this.size,this.page);
|
||||
}
|
||||
}
|
||||
|
||||
page : number;
|
||||
size:number;
|
||||
keyword:string;
|
||||
navigateTo: string = "Search";
|
||||
|
||||
@Input() public claim:boolean = true ; // add selection for claiming
|
||||
@Input() public publication:boolean = true ; // true for publication/ false for dataset
|
||||
@Input() public source:string = 'openaire' ; // other values : crossref/ datacite/orcid
|
||||
@Input() public selected = [] ;
|
||||
@Output() selectedChange = new EventEmitter();
|
||||
results:string[];
|
||||
resultsNum : Observable<number> ;
|
||||
search(term: string, size : number, page : number) {
|
||||
// if(this.source == 'crossref' && this.publication){
|
||||
this.searchCrossref(term,size,page);
|
||||
// }else if(this.source == 'openaire' && this.publication){
|
||||
//
|
||||
// }else if(this.source == 'openaire' && this.publication){
|
||||
//
|
||||
// }else if(this.source == 'openaire' && !this.publication){
|
||||
//
|
||||
// }else if(this.source == 'orcid' && this.publication){
|
||||
//
|
||||
// }else if(this.source == 'datacite' && !this.publication){
|
||||
//
|
||||
// }
|
||||
}
|
||||
searchCrossref (term: string, size : number, page : number) {
|
||||
this._searchService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.results = data.items;
|
||||
this.page=page;
|
||||
this.resultsNum = data['total-results'];
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
searchOpenaire (term2: string) {
|
||||
//this.items = this._searchService.httpSearchOpenaire(term2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
add(item){
|
||||
this.selected.push(item);
|
||||
console.info("Select:"+this.selected);
|
||||
for (var i = 0; i < this.selected.length; i++) {
|
||||
console.log(this.selected[i]);
|
||||
}
|
||||
|
||||
|
||||
var index:number =this.results.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.results.splice(index, 1);
|
||||
}
|
||||
console.info("Item removed "+this.selected.indexOf(item));
|
||||
this.selectedChange.emit({
|
||||
value: this.selected
|
||||
});
|
||||
}
|
||||
remove(item){
|
||||
var index:number =this.selected.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.selected.splice(index, 1);
|
||||
}
|
||||
this.selectedChange.emit({
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
export class Filter{
|
||||
public title: string;
|
||||
public filterId: string;
|
||||
public countSelectedValues: number;
|
||||
public values: Value[];
|
||||
|
||||
}
|
||||
export class Value{
|
||||
public name: string;
|
||||
public id: string;
|
||||
public selected: boolean;
|
||||
public number: number;
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import { Filter, Value} from './search.class';
|
||||
|
||||
@Component({
|
||||
selector: 'search-filter',
|
||||
template: `
|
||||
<p>{{filter.title}} </p>
|
||||
<p *ngFor = "let value of filter.values.slice(0,5)" >
|
||||
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" /> <span> {{value.name}} ({{value.number}}) </span>
|
||||
|
||||
</p>
|
||||
<a *ngIf = "!showAll && filter.values.length > 5" (click)="toggleShowAll()" > More</a>
|
||||
<span *ngIf = "filter.values.length > 5 && showAll" >
|
||||
<p *ngFor = "let value of filter.values.slice(5)" >
|
||||
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" /> <span> {{value.name}} ({{value.number}}) </span>
|
||||
</p>
|
||||
<a (click)="toggleShowAll()" > Less</a>
|
||||
</span>
|
||||
|
||||
`
|
||||
})
|
||||
export class SearchFilterComponent {
|
||||
@Input() title;
|
||||
@Input() filterId;
|
||||
@Input() values; //array[] " name, id, number, selected"
|
||||
@Input() countSelectedValues:number = 0; //array[] " name, id, number, selected"
|
||||
@Output() change = new EventEmitter();
|
||||
@Input() test:{value:number} ;
|
||||
@Input() filter:Filter;
|
||||
private showAll:boolean = false;
|
||||
constructor () {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
toggleShowAll(){
|
||||
this.showAll = !this.showAll;
|
||||
}
|
||||
|
||||
filterChange(selected:boolean){
|
||||
if(selected){
|
||||
this.filter.countSelectedValues++;
|
||||
}else{
|
||||
this.filter.countSelectedValues--;
|
||||
}
|
||||
this.change.emit({
|
||||
value: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {Location} from '@angular/common';
|
||||
import {SearchResultComponent} from './searchResult.component';
|
||||
import {SearchFilterComponent} from './searchFilter.component';
|
||||
import {pagingFormatterNoLoad} from '../../common/pagingFormatterNoLoad.component';
|
||||
import { Filter, Value} from './search.class';
|
||||
|
||||
@Component({
|
||||
selector: 'search-page',
|
||||
template: `
|
||||
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1>{{pageTitle}}</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="row row-offcanvas row-offcanvas-right">
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<a *ngIf="isFiltered()" (click)="clearFilters()" > Clear Filters</a>
|
||||
<p *ngFor="let filter of filters " >
|
||||
<search-filter [filter]="filter" (change)="filterChanged($event)" >
|
||||
|
||||
</search-filter>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" id="sidebar">
|
||||
<form>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="sizing-addon2">Filter</span>
|
||||
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" >
|
||||
<span class="input-group-btn">
|
||||
<button (click)="goTo(1)" type="submit" class="btn btn-default">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<div class="text-right" *ngIf="results && results.length>= size">
|
||||
<paging-no-load [(currentPage)]="page" [totalResults]="totalResults" [size]="size" (pageChange)="pageChanged($event)" > </paging-no-load>
|
||||
</div>
|
||||
<div>
|
||||
<p *ngFor="let result of results " >
|
||||
<search-result [id]="result.id" [title]="result.title" >
|
||||
|
||||
</search-result>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
directives:[SearchResultComponent, SearchFilterComponent, pagingFormatterNoLoad]
|
||||
})
|
||||
export class SearchPageComponent {
|
||||
@Input() pageTitle = "";
|
||||
@Input() results = [];
|
||||
@Input() filters = [];
|
||||
@Input() type;
|
||||
@Input() page:number = 1;
|
||||
@Input() size: number = 10;
|
||||
@Input() totalResults: number = 0;
|
||||
@Input() keyword:string = '';
|
||||
|
||||
test= { value: 0};
|
||||
|
||||
@Output() queryChange = new EventEmitter();
|
||||
constructor (private location: Location) {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
console.info(" page - value: "+this.page);
|
||||
|
||||
}
|
||||
|
||||
changekeyword(){
|
||||
|
||||
}
|
||||
|
||||
private createUrlParameters(){
|
||||
var allLimits="";
|
||||
for (let filter of this.filters){
|
||||
var filterLimits="";
|
||||
if(filter.countSelectedValues > 0){
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
filterLimits+=((filterLimits.length == 0)?'':',') + value.id;
|
||||
}
|
||||
}
|
||||
allLimits+=((filterLimits.length == 0 )?'':((allLimits.length == 0)?'':'&') +filter.filterId + '='+ filterLimits) ;
|
||||
}
|
||||
}
|
||||
if(this.keyword.length > 0 ){
|
||||
allLimits+=((allLimits.length == 0)?'':'&') + 'keyword=' + this.keyword;
|
||||
}
|
||||
if(this.page != 1 ){
|
||||
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.page;
|
||||
}
|
||||
return allLimits;
|
||||
}
|
||||
private createQueryParameters(){
|
||||
var allLimits="";
|
||||
for (let filter of this.filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
var filterLimits="";
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
filterLimits+=((filterLimits.length == 0)?'':' or ') + filter.filterId + '='+ value.id;
|
||||
}
|
||||
}
|
||||
allLimits+=((filterLimits.length == 0 )?'':((allLimits.length == 0)?'':' and ')+'('+filterLimits +')') ;
|
||||
}
|
||||
}
|
||||
if(this.keyword.length > 0 ){
|
||||
allLimits+=((allLimits.length == 0)?'':' and ') + ' keyword=' + this.keyword;
|
||||
}
|
||||
return allLimits;
|
||||
}
|
||||
private isFiltered(){
|
||||
var filtered=false;
|
||||
for (let filter of this.filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
filtered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this.keyword.length > 0 ){
|
||||
filtered = true;
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
clearFilters(){
|
||||
for (let filter of this.filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
value.selected = false;
|
||||
}
|
||||
}
|
||||
filter.countSelectedValues = 0;
|
||||
}
|
||||
}
|
||||
if(this.keyword.length > 0 ){
|
||||
this.keyword ='';
|
||||
}
|
||||
}
|
||||
|
||||
goTo(page:number = 1){
|
||||
this.page = page;
|
||||
var urlParameters = this.createUrlParameters();
|
||||
var queryParameters = this.createQueryParameters();
|
||||
this.location.go(location.pathname,urlParameters);
|
||||
this.queryChange.emit({
|
||||
value: queryParameters
|
||||
});
|
||||
|
||||
}
|
||||
filterChanged($event){
|
||||
this.goTo(1);
|
||||
}
|
||||
pageChanged($event) {
|
||||
this.page = +$event.value
|
||||
this.goTo(this.page);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
|
||||
@Component({
|
||||
selector: 'search-result',
|
||||
template: `
|
||||
<h3>{{title}}</h3>
|
||||
|
||||
`
|
||||
})
|
||||
export class SearchResultComponent {
|
||||
@Input() title;
|
||||
@Input() id;
|
||||
//publications & organizations:
|
||||
@Input() projects;
|
||||
//datasets & publications
|
||||
@Input() description;
|
||||
@Input() year;
|
||||
@Input() authors;
|
||||
//datasets:
|
||||
@Input() publisher;
|
||||
//dataproviders & projects:
|
||||
@Input() organizations;
|
||||
//projects:
|
||||
@Input() funders;
|
||||
//organizations:
|
||||
@Input() country;
|
||||
//dataproviders:
|
||||
@Input() type;
|
||||
@Input() websiteURL;
|
||||
@Input() OAIPMHURL;
|
||||
|
||||
constructor () {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {SearchCrossrefService} from '../services/searchCrossref.service';
|
||||
import {Publication} from '../entities/publication';
|
||||
import {PagingFormatter} from '../common/pagingFormatter.component';
|
||||
import {PublicationTitleFormatter} from '../common/publicationTitleFormatter.component';
|
||||
import {SearchAllComponent} from '../searchAll/searchAll.component';
|
||||
|
||||
@Component({
|
||||
selector: 'search',
|
||||
directives: [...ROUTER_DIRECTIVES,PagingFormatter, PublicationTitleFormatter,SearchAllComponent],
|
||||
template: `
|
||||
<h1>Search Demo</h1>
|
||||
<p><i>Fetches from crossref </i></p>
|
||||
<form>
|
||||
<input #term [(ngModel)]="keyword"/>
|
||||
<button (click)="search(term.value,10,1)" type="submit" class="btn btn-default">Search</button>
|
||||
</form>
|
||||
<div>
|
||||
<div *ngIf="resultsNum != null && resultsNum > 0">
|
||||
<p > {{resultsNum }} Total Results </p>
|
||||
<paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size"> </paging>
|
||||
</div>
|
||||
<div >
|
||||
<p *ngFor=" let item of results "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> {{item.DOI}} --{{item.publisher}} </p>
|
||||
</div>
|
||||
</div>
|
||||
<!--<p>Directive....</p>
|
||||
<search-all [source]="crossref" [type]="true" [claim]="false" ><search-all>-->
|
||||
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, SearchCrossrefService]
|
||||
})
|
||||
export class SearchComponent {
|
||||
constructor (private _searchService: SearchCrossrefService,
|
||||
private _routeParams: RouteParams) {
|
||||
console.info('search constructor');
|
||||
}
|
||||
ngOnInit() {
|
||||
console.info('search init');
|
||||
|
||||
let page = +this._routeParams.get('page');
|
||||
let size = +this._routeParams.get('size');
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.size = ( size <= 0 ) ? 10 : size;
|
||||
this.keyword = this._routeParams.get('keyword');
|
||||
if(this.keyword !=null){
|
||||
this.search(this.keyword,this.size,this.page);
|
||||
}
|
||||
}
|
||||
|
||||
page : number;
|
||||
size:number;
|
||||
keyword:string;
|
||||
navigateTo: string = "Search";
|
||||
|
||||
results : String[];
|
||||
orcidresults : String[];
|
||||
resultsNum : number ;
|
||||
search (term: string, size : number, page : number) {
|
||||
this.getCrossrefResults(term,size,page);
|
||||
}
|
||||
|
||||
|
||||
getCrossrefResults (term: string, size : number, page : number) {
|
||||
this._searchService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.results = data.items;
|
||||
this.page=page;
|
||||
this.resultsNum = data['total-results'];
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
||||
import {SearchPageComponent} from './common/searchPage.component';
|
||||
import { Filter, Value} from './common/search.class';
|
||||
|
||||
@Component({
|
||||
selector: 'search-publications',
|
||||
template: `
|
||||
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters" [(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword" [(page)] = "page" (queryChange)="queryChanged($event)" >
|
||||
</search-page>
|
||||
|
||||
`,
|
||||
directives:[SearchPageComponent]
|
||||
})
|
||||
export class SearchPublicationsComponent {
|
||||
results =[];
|
||||
filters =[];
|
||||
totalResults:number = 0 ;
|
||||
keyword = '';
|
||||
page :number = 1;
|
||||
constructor (private _routeParams: RouteParams) {
|
||||
this.results =[];
|
||||
this.filters =[];
|
||||
this.totalResults = 123;
|
||||
for(var i=0; i<10 ; i++){
|
||||
var result = {title: "title"+i, id: "id"+i}
|
||||
this.results.push(result);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, values : values, countSelectedValues:0}
|
||||
this.filters.push(filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
let page = +this._routeParams.get('page');
|
||||
let size = +this._routeParams.get('size');
|
||||
this.page= (page?page:1);
|
||||
this.keyword = (this._routeParams.get('keyword')?this._routeParams.get('keyword'):'');
|
||||
//TODO get the rest parameters to create query
|
||||
|
||||
|
||||
}
|
||||
|
||||
getResults(parameters:string){
|
||||
//http://rudie.di.uoa.gr:8080/dnet-functionality-services-1.2.0-SNAPSHOT/search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=%28oaftype+exact+result%29+and+%28resulttypeid+exact+publication%29&page=5&size=10&fields=instancetypenameid&fields=resultlanguageid&fields=relfunderid&fields=relprojectid&fields=resultacceptanceyear&fields=resultbestlicense&fields=resulthostingdatasourceid&fields=communityid&locale=en_GB
|
||||
console.info("Execute search query "+parameters);
|
||||
// this.results =[];
|
||||
// this.filters =[];
|
||||
// for(var i=0; i<30 ; i++){
|
||||
// var result = {title: "title"+i, id: "id"+i}
|
||||
// this.results.push(result);
|
||||
// }
|
||||
//
|
||||
// for(var i=0; i<5 ; i++){
|
||||
// var values = [];
|
||||
// for(var j=0; j<10 ; j++){
|
||||
// var value = {name: "name"+j, id: "id"+j, number:j, selected:false}
|
||||
// values.push(value);
|
||||
// }
|
||||
// var filter = {title: "title"+i, filterId: "id"+i, values : values}
|
||||
// this.filters.push(filter);
|
||||
// }
|
||||
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
}
|
||||
|
||||
private queryChanged($event) {
|
||||
var parameters = $event.value
|
||||
this.getResults(parameters)
|
||||
console.info("Execute search query "+parameters);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Claim} from '../entities/claim';
|
||||
|
||||
@Injectable()
|
||||
export class ClaimsService {
|
||||
// baseUrl='http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/';
|
||||
baseUrl='http://scoobydoo.di.uoa.gr:8181/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/';
|
||||
constructor(private jsonp: Jsonp, private http: Http) {
|
||||
|
||||
}
|
||||
|
||||
private getClaimRequest(size : number, page : number, url :string):any {
|
||||
console.info('ClaimsService: Claims request: '+url);
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json())
|
||||
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims ' );
|
||||
console.info('ClaimsService: Types : '+types );
|
||||
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
|
||||
return this.getClaimRequest(size,page,url);
|
||||
|
||||
}
|
||||
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims for user : '+user);
|
||||
let url = this.baseUrl +"users/"+user+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
|
||||
return this.getClaimRequest(size,page,url);
|
||||
|
||||
}
|
||||
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims for context : '+contextId);
|
||||
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
|
||||
return this.getClaimRequest(size,page,url);
|
||||
|
||||
}
|
||||
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims for result : '+resultId);
|
||||
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
|
||||
return this.getClaimRequest(size,page,url);
|
||||
|
||||
}
|
||||
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims for project : '+projectId);
|
||||
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
|
||||
return this.getClaimRequest(size,page,url);
|
||||
}
|
||||
|
||||
deleteClaimById(claimId:string):any{
|
||||
console.warn('Trying to delete claim with id : '+claimId);
|
||||
let url = this.baseUrl +"claims/"+claimId;
|
||||
console.warn('Delete url: '+url);
|
||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
return this.http.delete( url, options).map(request => <any> request.json())
|
||||
.do(request => console.info("After delete" ))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
insertClaim(claim):any{
|
||||
console.warn('Trying toinsert claim : '+claim);
|
||||
let url = this.baseUrl +"claims";
|
||||
let body = JSON.stringify( claim );
|
||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, options)
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request.status) )
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
getClaim(id:string):any {
|
||||
let url = this.baseUrl+"claims/"+id;
|
||||
return new Promise((resolve, reject) => {
|
||||
this.http.get(url)
|
||||
.map(res => res.json())
|
||||
.subscribe(
|
||||
data => {
|
||||
resolve(data.data);
|
||||
},
|
||||
err => {
|
||||
reject(err);
|
||||
}
|
||||
)
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Jsonp, URLSearchParams,ResponseOptions} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Claim} from '../entities/claim';
|
||||
|
||||
@Injectable()
|
||||
export class ContextsService {
|
||||
// baseUrl='http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/';
|
||||
baseUrl='http://scoobydoo.di.uoa.gr:8181/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/';
|
||||
//'http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/communities';
|
||||
//http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/communities/egi/categories
|
||||
//http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/categories/egi::classification/concepts
|
||||
constructor(private http: Http) {
|
||||
|
||||
}
|
||||
|
||||
public getCommunities():any {
|
||||
let url = this.baseUrl + 'communities';
|
||||
console.info('ContextsService: request communities '+url);
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().data)
|
||||
.do(request => console.info("Get claims: offset = "))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
public getCategories(communityId :string):any {
|
||||
console.info('ContextsService: request categories for community with id '+communityId);
|
||||
let url= this.baseUrl + 'communities/' + communityId + '/categories';
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().data)
|
||||
.do(request => console.info("Get claims: offset = " ))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
public getConcepts(categoryId :string, keyword: string):any {
|
||||
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
|
||||
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().data)
|
||||
.do(request => console.info("Get claims: offset = " ))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
}
|
|
@ -1,616 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DatasetInfo} from '../entities/datasetInfo';
|
||||
|
||||
@Injectable()
|
||||
export class DatasetService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
datasetInfo: DatasetInfo;
|
||||
|
||||
getDatasetInfo (id: string):any {
|
||||
console.info("getDatasetInfo in service");
|
||||
|
||||
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/datasets/'+id;
|
||||
//let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/datasets/'+id;
|
||||
let url = 'http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/datasets/'+id;
|
||||
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
||||
.map(res => res['result']['metadata']['oaf:entity']['oaf:result'])
|
||||
.map(res => [res,
|
||||
res['title'],
|
||||
res['rels']['rel'],
|
||||
res['children'],
|
||||
res['pid'],
|
||||
res['subject'],
|
||||
res['bestlicense'],
|
||||
res['collectedfrom'],
|
||||
res['context'],
|
||||
res['resulttype']
|
||||
])
|
||||
.map(res => this.parseDatasetInfo(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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parseDatasetInfo (data: any):any {
|
||||
this.datasetInfo = new DatasetInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
this.datasetInfo.date = data[0].dateofacceptance.substring(0,4);
|
||||
this.datasetInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.datasetInfo.description = data[0].description;
|
||||
} else {
|
||||
this.datasetInfo.description = data[0].description[0];
|
||||
}
|
||||
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
|
||||
if(data[1] != null) {
|
||||
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(Array.isArray(data[1])) {
|
||||
this.datasetInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.datasetInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let mydata;
|
||||
let counter = 0;
|
||||
let length = data[2].length!=undefined ? data[2].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[2][i] : data[2];
|
||||
if(mydata.hasOwnProperty("to")) {
|
||||
if(mydata['to'].class == "hasAuthor") {
|
||||
if(this.datasetInfo.authors == undefined) {
|
||||
this.datasetInfo.authors = new Array<{"name": string, "url": string}>();
|
||||
}
|
||||
|
||||
this.datasetInfo.authors[mydata.ranking-1] = {"name": "", "url": ""};
|
||||
this.datasetInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
|
||||
this.datasetInfo.authors[mydata.ranking-1]['url'] = "https://beta.openaire.eu/search/person?personId="+mydata['to'].content;
|
||||
} else if(mydata['to'].class == "isProducedBy") {
|
||||
if(this.datasetInfo.fundedByProjects == undefined) {
|
||||
this.datasetInfo.fundedByProjects = new Array<
|
||||
{ "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean
|
||||
}>();
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.fundedByProjects.length;
|
||||
|
||||
this.datasetInfo.fundedByProjects[counter] = {
|
||||
"url": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "new": false
|
||||
}
|
||||
|
||||
this.datasetInfo.fundedByProjects[counter]['url'] =
|
||||
"http://localhost:3000/project?projectId="+mydata['to'].content;
|
||||
this.datasetInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
|
||||
this.datasetInfo.fundedByProjects[counter]['title'] = mydata.title;
|
||||
|
||||
if(mydata.hasOwnProperty("funding")) {
|
||||
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
|
||||
|
||||
for(let j=0; j<length1; j++) {
|
||||
let funding;
|
||||
let mydata1 = length1 > 1 ? mydata['funding'][j] : mydata['funding'];
|
||||
|
||||
if(mydata1.hasOwnProperty("funder")) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
||||
this.datasetInfo.fundedByProjects[counter]['funderName'] = mydata1['funder'].name;
|
||||
}
|
||||
|
||||
if(mydata1.hasOwnProperty("funding_level_2")) {
|
||||
funding = mydata1['funding_level_2'].content;
|
||||
} else if(mydata1.hasOwnProperty("funding_level_1")) {
|
||||
funding = mydata1['funding_level_1'].content;
|
||||
} else if(mydata1.hasOwnProperty("funding_level_0")) {
|
||||
funding = mydata1['funding_level_0'].content;
|
||||
}
|
||||
|
||||
if(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
|
||||
if(this.datasetInfo.fundedByProjects[counter]['funding'] != "") {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] += ", "+funding[1];
|
||||
} else {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] = funding[1];
|
||||
}
|
||||
for(let i=2; i<funding.length; i++) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] += " | " + funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
/*if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "publication") {
|
||||
if(this.datasetInfo.similarPublications == undefined) {
|
||||
this.datasetInfo.similarPublications = new Array<
|
||||
{ "name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
let counter = this.datasetInfo.similarPublications.length;
|
||||
|
||||
this.datasetInfo.similarPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
||||
this.datasetInfo.similarPublications[counter]['url'] = url;
|
||||
this.datasetInfo.similarPublications[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.similarPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
||||
this.datasetInfo.similarPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
} else if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "dataset") {
|
||||
if(this.datasetInfo.similarDatasets == undefined) {
|
||||
this.datasetInfo.similarDatasets = new Array<
|
||||
{ "name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
let counter = this.datasetInfo.similarDatasets.length;
|
||||
|
||||
this.datasetInfo.similarDatasets[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
||||
this.datasetInfo.similarDatasets[counter]['url'] = url;
|
||||
this.datasetInfo.similarDatasets[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.similarDatasets[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
||||
this.datasetInfo.similarDatasets[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
}*/
|
||||
|
||||
if(this.datasetInfo.similarResearchResults == undefined) {
|
||||
this.datasetInfo.similarResearchResults = new Array<{
|
||||
"name": string, "url": string, "date": string,
|
||||
"trust": string, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.similarResearchResults.length;
|
||||
this.datasetInfo.similarResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
||||
|
||||
let url;
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.datasetInfo.similarResearchResults[counter]['url'] = url;
|
||||
this.datasetInfo.similarResearchResults[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.datasetInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
|
||||
|
||||
} else if(mydata['to'].class == "isRelatedTo") {
|
||||
/*if(mydata.hasOwnProperty('resulttype')) {
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
if(this.datasetInfo.relatedPublications == undefined) {
|
||||
this.datasetInfo.relatedPublications = new Array<{
|
||||
"name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
counter = this.datasetInfo.relatedPublications.length;
|
||||
|
||||
this.datasetInfo.relatedPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
||||
|
||||
this.datasetInfo.relatedPublications[counter]['url'] = url;
|
||||
this.datasetInfo.relatedPublications[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.relatedPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.datasetInfo.relatedPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
} else {
|
||||
if(this.datasetInfo.relatedResearchData == undefined) {
|
||||
this.datasetInfo.relatedResearchData = new Array<{
|
||||
"name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
counter = this.datasetInfo.relatedResearchData.length;
|
||||
|
||||
this.datasetInfo.relatedResearchData[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
||||
|
||||
this.datasetInfo.relatedResearchData[counter]['url'] = url;
|
||||
this.datasetInfo.relatedResearchData[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.relatedResearchData[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.datasetInfo.relatedResearchData[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
}
|
||||
}*/
|
||||
|
||||
if(this.datasetInfo.relatedResearchResults == undefined) {
|
||||
this.datasetInfo.relatedResearchResults = new Array<{
|
||||
"name": string, "url": string, "date": string,
|
||||
"trust": string, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.relatedResearchResults.length;
|
||||
this.datasetInfo.relatedResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
||||
|
||||
let url;
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
this.datasetInfo.relatedResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
this.datasetInfo.relatedResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.datasetInfo.relatedResearchResults[counter]['url'] = url;
|
||||
this.datasetInfo.relatedResearchResults[counter]['name'] = mydata['title'].content;
|
||||
this.datasetInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.datasetInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.datasetInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
||||
this.datasetInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[]}>()
|
||||
|
||||
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
||||
|
||||
let counter = 0;
|
||||
let counter1 = 0;
|
||||
let counter2 = 0;
|
||||
let mydata;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
if(mydata.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(mydata['webresource'].length == undefined) {
|
||||
url = mydata['webresource'].url;
|
||||
} else{
|
||||
url = mydata['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(!this.datasetInfo.downloadFrom.has(url) && mydata.hasOwnProperty("hostedby")) {
|
||||
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
|
||||
if(!this.datasetInfo.downloadFrom.has(mydata['hostedby'].name)) {
|
||||
this.datasetInfo.downloadFrom.set(mydata['hostedby'].name, {"url": null, "accessMode": null});
|
||||
}
|
||||
|
||||
if(this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['url'] == null) {
|
||||
this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
counter2 = this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['url'].length;
|
||||
this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['url'][counter2] = url;
|
||||
|
||||
if(this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] == null) {
|
||||
this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("licence")) {
|
||||
this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
|
||||
} else {
|
||||
this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
|
||||
}
|
||||
} else {
|
||||
if(data[0] != null && data[0].hasOwnProperty("source")) {
|
||||
let key: string;
|
||||
if(Array.isArray(data[0].source)) {
|
||||
if(!this.datasetInfo.publishedIn.has(data[0]['source'][counter1])) {
|
||||
key = data[0]['source'][counter1];
|
||||
}
|
||||
} else {
|
||||
if(!this.datasetInfo.publishedIn.has(data[0]['source'])) {
|
||||
key = data[0]['source'];
|
||||
}
|
||||
}
|
||||
|
||||
this.datasetInfo.publishedIn.set(key, {"url": null, "accessMode": null});
|
||||
|
||||
if(this.datasetInfo.publishedIn.get(key)['url'] == null) {
|
||||
this.datasetInfo.publishedIn.get(key)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
counter2 = this.datasetInfo.publishedIn.get(key)['url'].length;
|
||||
this.datasetInfo.publishedIn.get(key)['url'][counter2] = url;
|
||||
|
||||
if(this.datasetInfo.publishedIn.get(key)['accessMode'] == null) {
|
||||
this.datasetInfo.publishedIn.get(key)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("licence")) {
|
||||
this.datasetInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
|
||||
} else {
|
||||
this.datasetInfo.publishedIn.get(key)['accessMode'][counter2] = "";
|
||||
}
|
||||
counter1++;
|
||||
}
|
||||
}
|
||||
if(this.datasetInfo.title != undefined) {
|
||||
if(this.datasetInfo.title['url'] == undefined) {
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
|
||||
switch (this.datasetInfo.title['licence']) {
|
||||
case undefined:
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
break;
|
||||
case "CLOSED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO" ||
|
||||
mydata['licence'].classid == "RESTRICTED") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "RESTRICTED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "EMBARGO":
|
||||
if(mydata['licence'].classid == "OPEN") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
let counter = 0;
|
||||
this.datasetInfo.identifiers = new Map<string, string[]>();
|
||||
|
||||
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
||||
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
||||
if(!this.datasetInfo.identifiers.has(data[4].classname)) {
|
||||
this.datasetInfo.identifiers.set(data[4].classname, new Array<string>());
|
||||
}
|
||||
counter = this.datasetInfo.identifiers.get(data[4].classname).length;
|
||||
this.datasetInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[4].length; i++) {
|
||||
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
||||
if(!this.datasetInfo.identifiers.has(data[4][i].classname)) {
|
||||
this.datasetInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
||||
}
|
||||
counter = this.datasetInfo.identifiers.get(data[4][i].classname).length;
|
||||
this.datasetInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
this.datasetInfo.classifiedSubjects = new Map<string, string[]>();
|
||||
this.datasetInfo.subjects = new Array<string>();
|
||||
|
||||
let mydata;
|
||||
let length = data[5].length!=undefined ? data[5].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[5][i] : data[5];
|
||||
|
||||
if(mydata.classid != "") {
|
||||
if(mydata.inferred == true) {
|
||||
if(!this.datasetInfo.classifiedSubjects.has(mydata.classid)) {
|
||||
this.datasetInfo.classifiedSubjects.set(mydata.classid, new Array<string>());
|
||||
}
|
||||
|
||||
let counter = this.datasetInfo.classifiedSubjects.get(mydata.classid).length;
|
||||
this.datasetInfo.classifiedSubjects.get(mydata.classid)[counter] = mydata.content;
|
||||
} else {
|
||||
let counter = this.datasetInfo.subjects.length;
|
||||
this.datasetInfo.subjects[counter] = mydata.content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[6] != null) {
|
||||
this.datasetInfo.bestlicense = data[6].classid;
|
||||
}
|
||||
|
||||
if(data[7] != null) {
|
||||
this.datasetInfo.collectedFrom = new Array<{"name": string, "url": string}>();
|
||||
|
||||
let mydata;
|
||||
let length = data[7].length!=undefined ? data[7].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[7][i] : data[7];
|
||||
let link = "https://beta.openaire.eu/search/dataprovider?datasourceId=";
|
||||
this.datasetInfo.collectedFrom[i] = {"name": "", "url": ""};
|
||||
this.datasetInfo.collectedFrom[i]['name'] = mydata.name;
|
||||
this.datasetInfo.collectedFrom[i]['url'] = link+mydata.id;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.datasetInfo.publisher != null
|
||||
&& this.datasetInfo.identifiers != null
|
||||
&& this.datasetInfo.identifiers.has("doi")) {
|
||||
|
||||
if( this.datasetInfo.downloadFrom == null) {
|
||||
this.datasetInfo.downloadFrom = new Map<string,{"url": string[], "accessMode": string[]}>();
|
||||
}
|
||||
|
||||
this.datasetInfo.downloadFrom.set(this.datasetInfo.publisher, {"url": null, "accessMode": null});
|
||||
|
||||
let url = "http://dx.doi.org/"+this.datasetInfo.identifiers.get("doi");
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['url'] = new Array<string>();
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['accessMode'] = new Array<string>();
|
||||
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['url'][0] = url;
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['accessMode'][0] = "";
|
||||
|
||||
if(this.datasetInfo.title != undefined && this.datasetInfo.title['url'] == "") {
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[8] != null) {
|
||||
this.datasetInfo.contexts = new Array<
|
||||
{ "labelContext": string, "labelCategory": string, "labelConcept": string}>();
|
||||
|
||||
let position = 0;
|
||||
let labels = "";
|
||||
let mydata;
|
||||
let length = data[8].length!=undefined ? data[8].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[8][i] : data[8];
|
||||
|
||||
if(mydata.hasOwnProperty("type") && mydata['type'] == "community") {
|
||||
if(mydata.hasOwnProperty("category")) {
|
||||
if(mydata['category'].hasOwnProperty("concept")) {
|
||||
let mydata1;
|
||||
let length1 = mydata['category']['concept'].length!=undefined ? mydata['category']['concept'].length : 1;
|
||||
for(let j=0; j<length1; j++) {
|
||||
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
|
||||
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = mydata1.label;
|
||||
|
||||
position++;
|
||||
}
|
||||
} else {
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
} else {
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = null;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[9] != null) {
|
||||
if(data[9].hasOwnProperty('classname')) {
|
||||
this.datasetInfo.type = data[9].classname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//this.printdatasetInfo();
|
||||
return this.datasetInfo;
|
||||
|
||||
}
|
||||
|
||||
printDatasetInfo() {
|
||||
console.info("DATE: "+this.datasetInfo.date);
|
||||
console.info("PUBLISHER: "+this.datasetInfo.publisher);
|
||||
console.info("DESCRIPTION: "+this.datasetInfo.description);
|
||||
|
||||
console.info("TITLE: "+this.datasetInfo.title);
|
||||
|
||||
console.info("AUTHORS: "+this.datasetInfo.authors);
|
||||
console.info("\nFUNDED BY PROJECTS:");
|
||||
if(this.datasetInfo.fundedByProjects != undefined) {
|
||||
this.datasetInfo.fundedByProjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
/*
|
||||
console.info("\nRELATED RESEARCH DATA:");
|
||||
if(this.datasetInfo.relatedResearchData != undefined) {
|
||||
this.datasetInfo.relatedResearchData.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nSIMILAR datasetS:");
|
||||
if(this.datasetInfo.similarPublications != undefined) {
|
||||
this.datasetInfo.similarPublications.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
*/
|
||||
console.info("TYPE: "+this.datasetInfo.type);
|
||||
console.info("\nDOWNLOAD FROM:");
|
||||
if(this.datasetInfo.downloadFrom != undefined) {
|
||||
this.datasetInfo.downloadFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nIDENTIFIERS:");
|
||||
if(this.datasetInfo.identifiers != undefined) {
|
||||
this.datasetInfo.identifiers.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("SUBJECTS: "+this.datasetInfo.subjects);
|
||||
console.info("\nCLASSIFIED OBJECTS:");
|
||||
if(this.datasetInfo.classifiedSubjects != undefined) {
|
||||
this.datasetInfo.classifiedSubjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("BEST LICENSE: "+this.datasetInfo.bestlicense);
|
||||
|
||||
console.info("\nCOLLECTED FROM:");
|
||||
if(this.datasetInfo.collectedFrom != undefined) {
|
||||
this.datasetInfo.collectedFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nDOWNLOAD FROM:");
|
||||
if(this.datasetInfo.downloadFrom != undefined) {
|
||||
this.datasetInfo.downloadFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
// import {Http, Response, Headers} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
// import {Publication} from '../entities/publication';
|
||||
@Injectable()
|
||||
export class OpenaireProjectsService {
|
||||
constructor( private http: Http) {}
|
||||
// searchUrl="http://services.openaire.eu:8380/search/";
|
||||
// searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
||||
searchUrl="http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
||||
getFunders():any {
|
||||
let url = this.searchUrl+'search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json';
|
||||
////"&rows=".$size."&offset=".($page-1)*$size
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().response.browseResults.result)
|
||||
.do(funders => console.log("getFunders : "+funders))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
searchForProjects(keyword:string, funderId:string):any {
|
||||
let url = this.searchUrl+'search?action=search&sTransformer=projects_openaire&query='+
|
||||
'%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22'+keyword+'%22%29+or+%28projectacronym+%3D+%22'+keyword+'%22%29+or+%28projectcode+%3D+%22'+keyword+'%22%29%29+and+%28funderid+exact+'+funderId+'%29&size=10&locale=en_GB&format=json';
|
||||
|
||||
////"&rows=".$size."&offset=".($page-1)*$size
|
||||
return this.http.get( url)
|
||||
.map(request => <any> (request.json().response.results)?request.json().response.results.result:request.json().response.results)
|
||||
.do(funders => console.log("getFunders : "+funders))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
http://services.openaire.eu:8380/search/search?action=search&sTransformer=projects_openaire&query=%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22ope%22%29+or+%28projectacronym+%3D+%22ope%22%29+or+%28projectcode+%3D+%22ope%22%29%29+and+%28funderid+exact+ec__________%3A%3AEC%29&size=10&locale=en_GB&format=json
|
||||
|
||||
http://services.openaire.eu:8380/search/search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json
|
||||
|
||||
*/
|
|
@ -1,54 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {PersonInfo} from '../entities/personInfo';
|
||||
|
||||
@Injectable()
|
||||
export class PersonService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
personInfo: PersonInfo;
|
||||
|
||||
getPersonInfo (id: string):any {
|
||||
console.info("getPersonInfo in service");
|
||||
|
||||
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
//let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
let url = 'http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/people/'+id;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => res['result']['metadata']['oaf:entity']['oaf:person'])
|
||||
.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.error(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;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ProjectInfo} from '../entities/projectInfo';
|
||||
|
||||
@Injectable()
|
||||
export class ProjectService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
projectInfo: ProjectInfo;
|
||||
|
||||
getProjectInfo (id: string):any {
|
||||
console.info("getProjectInfo in service");
|
||||
|
||||
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
//let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
let url = 'http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => res['result']['metadata']['oaf:entity']['oaf:project'])
|
||||
.do(res => console.info(res))
|
||||
.map(res => [res,
|
||||
res['fundingtree'],
|
||||
res['rels']['rel']])
|
||||
.map(res => this.parseProjectInfo(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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parseProjectInfo (data: any):any {
|
||||
this.projectInfo = new ProjectInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
this.projectInfo.acronym = data[0].acronym;
|
||||
this.projectInfo.title = data[0].title;
|
||||
this.projectInfo.callIdentifier = data[0].callidentifier;
|
||||
this.projectInfo.contractNum = data[0].code;
|
||||
this.projectInfo.startDate = data[0].startdate;
|
||||
this.projectInfo.endDate = data[0].enddate;
|
||||
this.projectInfo.openAccessMandate = data[0].oamandatepublications;
|
||||
this.projectInfo.specialClause39 = data[0].ecsc39;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
if(data[1]['funder'] != null) {
|
||||
this.projectInfo.funder = data[1]['funder'].shortname;
|
||||
}
|
||||
|
||||
let funding;
|
||||
this.projectInfo.funding = "";
|
||||
|
||||
if(data[1]['funding_level_2'] != null) {
|
||||
funding = data[1]['funding_level_2'].id;
|
||||
} else if(data[1]['funding_level_1'] != null) {
|
||||
funding = data[1]['funding_level_1'].id;
|
||||
} else if(data[1]['funding_level_0'] != null) {
|
||||
funding = data[1]['funding_level_0'].id;
|
||||
}
|
||||
|
||||
if(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
for(let i=1; i<funding.length; i++) {
|
||||
if(this.projectInfo.funding != "") {
|
||||
this.projectInfo.funding += " | ";
|
||||
}
|
||||
this.projectInfo.funding += funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
this.projectInfo.organizations = new Map<string, string>();
|
||||
|
||||
let name = "";
|
||||
let url = "";
|
||||
|
||||
if(!Array.isArray(data[2])) {
|
||||
if(data[2].hasOwnProperty("legalshortname")) {
|
||||
name = data[2].legalshortname;
|
||||
} else if(data[2].hasOwnProperty("legalname")) {
|
||||
name = data[2].legalname;
|
||||
}
|
||||
|
||||
if(data[2].hasOwnProperty("to")) {
|
||||
url = "https://beta.openaire.eu/search/organization?organizationId="+data[2]['to'].content;
|
||||
}
|
||||
this.projectInfo.organizations.set(name, url);
|
||||
} else {
|
||||
for(let i=0; i<data[2].length; i++) {
|
||||
if(data[2][i].hasOwnProperty("legalshortname")) {
|
||||
name = data[2][i].legalshortname;
|
||||
} else if(data[2][i].hasOwnProperty("legalname")) {
|
||||
name = data[2][i].legalname;
|
||||
}
|
||||
|
||||
if(data[2][i].hasOwnProperty("to")) {
|
||||
url = "https://beta.openaire.eu/search/organization?organizationId="+data[2][i]['to'].content;
|
||||
}
|
||||
this.projectInfo.organizations.set(name, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.projectInfo.funder == "EC") {
|
||||
this.projectInfo.url = "http://cordis.europa.eu/projects/"+this.projectInfo.contractNum;
|
||||
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
|
||||
}
|
||||
|
||||
return this.projectInfo;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,708 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {PublicationInfo} from '../entities/publicationInfo';
|
||||
|
||||
@Injectable()
|
||||
export class PublicationService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
publicationInfo: PublicationInfo;
|
||||
|
||||
getPublicationInfo (id: string):any {
|
||||
console.info("getPublicationInfo in service");
|
||||
|
||||
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
||||
//let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
||||
let url = 'http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
||||
.map(res => res['result']['metadata']['oaf:entity'])
|
||||
.map(res => [res['oaf:result'],
|
||||
res['oaf:result']['title'],
|
||||
res['oaf:result']['rels']['rel'],
|
||||
res['oaf:result']['children'],
|
||||
res['oaf:result']['pid'],
|
||||
res['oaf:result']['journal'],
|
||||
res['oaf:result']['language'],
|
||||
res['oaf:result']['subject'],
|
||||
res['oaf:result']['bestlicense'],
|
||||
res['oaf:result']['collectedfrom'],
|
||||
(res['extraInfo']!= undefined && res['extraInfo']['citations']!= undefined)? res['extraInfo']['citations']['citation']:null,
|
||||
res['oaf:result']['context']
|
||||
])
|
||||
.map(res => this.parsePublicationInfo(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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parsePublicationInfo (data: any):any {
|
||||
this.publicationInfo = new PublicationInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
this.publicationInfo.date = data[0].dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.publicationInfo.description = data[0].description;
|
||||
} else {
|
||||
this.publicationInfo.description = data[0].description[0];
|
||||
}
|
||||
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
|
||||
if(data[1] != null) {
|
||||
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
|
||||
if(Array.isArray(data[1])) {
|
||||
this.publicationInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.publicationInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let mydata;
|
||||
let counter = 0;
|
||||
let length = data[2].length!=undefined ? data[2].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[2][i] : data[2];
|
||||
if(mydata.hasOwnProperty("to")) {
|
||||
if(mydata['to'].class == "hasAuthor") {
|
||||
if(this.publicationInfo.authors == undefined) {
|
||||
this.publicationInfo.authors = new Array<{"name": string, "url": string}>();
|
||||
}
|
||||
|
||||
this.publicationInfo.authors[mydata.ranking-1] = {"name": "", "url": ""};
|
||||
this.publicationInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
|
||||
this.publicationInfo.authors[mydata.ranking-1]['url'] = "https://beta.openaire.eu/search/person?personId="+mydata['to'].content;
|
||||
} else if(mydata['to'].class == "isProducedBy") {
|
||||
if(this.publicationInfo.fundedByProjects == undefined) {
|
||||
this.publicationInfo.fundedByProjects = new Array<
|
||||
{ "url": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "new": boolean
|
||||
}>();
|
||||
}
|
||||
|
||||
counter = this.publicationInfo.fundedByProjects.length;
|
||||
|
||||
this.publicationInfo.fundedByProjects[counter] = {
|
||||
"url": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "new": false
|
||||
}
|
||||
|
||||
this.publicationInfo.fundedByProjects[counter]['url'] =
|
||||
"http://localhost:3000/project?projectId="+mydata['to'].content;
|
||||
this.publicationInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
|
||||
this.publicationInfo.fundedByProjects[counter]['title'] = mydata.title;
|
||||
|
||||
if(mydata.hasOwnProperty("funding")) {
|
||||
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
|
||||
|
||||
for(let j=0; j<length1; j++) {
|
||||
let funding;
|
||||
let mydata1 = length1 > 1 ? mydata['funding'][j] : mydata['funding'];
|
||||
|
||||
if(mydata1.hasOwnProperty("funder")) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
||||
this.publicationInfo.fundedByProjects[counter]['funderName'] = mydata1['funder'].name;
|
||||
}
|
||||
|
||||
if(mydata1.hasOwnProperty("funding_level_2")) {
|
||||
funding = mydata1['funding_level_2'].content;
|
||||
} else if(mydata1.hasOwnProperty("funding_level_1")) {
|
||||
funding = mydata1['funding_level_1'].content;
|
||||
} else if(mydata1.hasOwnProperty("funding_level_0")) {
|
||||
funding = mydata1['funding_level_0'].content;
|
||||
}
|
||||
|
||||
if(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
|
||||
if(this.publicationInfo.fundedByProjects[counter]['funding'] != "") {
|
||||
this.publicationInfo.fundedByProjects[counter]['funding'] += ", "+funding[1];
|
||||
} else {
|
||||
this.publicationInfo.fundedByProjects[counter]['funding'] = funding[1];
|
||||
}
|
||||
for(let i=2; i<funding.length; i++) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funding'] += " | " + funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(mydata['to'].class == "isRelatedTo") {
|
||||
/* if(mydata['resulttype'].classname == "publication") {
|
||||
if(this.publicationInfo.relatedPublications == undefined) {
|
||||
this.publicationInfo.relatedPublications = new Array<{
|
||||
"name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
counter = this.publicationInfo.relatedPublications.length;
|
||||
|
||||
this.publicationInfo.relatedPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
||||
|
||||
this.publicationInfo.relatedPublications[counter]['url'] = url;
|
||||
this.publicationInfo.relatedPublications[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.relatedPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.publicationInfo.relatedPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
} else {
|
||||
if(this.publicationInfo.relatedResearchData == undefined) {
|
||||
this.publicationInfo.relatedResearchData = new Array<{
|
||||
"name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
counter = this.publicationInfo.relatedResearchData.length;
|
||||
|
||||
this.publicationInfo.relatedResearchData[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
||||
|
||||
this.publicationInfo.relatedResearchData[counter]['url'] = url;
|
||||
this.publicationInfo.relatedResearchData[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.relatedResearchData[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.publicationInfo.relatedResearchData[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
}*/
|
||||
if(this.publicationInfo.relatedResearchResults == undefined) {
|
||||
this.publicationInfo.relatedResearchResults = new Array<{
|
||||
"name": string, "url": string, "date": string,
|
||||
"trust": string, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.publicationInfo.relatedResearchResults.length;
|
||||
this.publicationInfo.relatedResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
||||
|
||||
let url;
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
this.publicationInfo.relatedResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
this.publicationInfo.relatedResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.publicationInfo.relatedResearchResults[counter]['url'] = url;
|
||||
this.publicationInfo.relatedResearchResults[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
|
||||
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
/*if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "publication") {
|
||||
if(this.publicationInfo.similarPublications == undefined) {
|
||||
this.publicationInfo.similarPublications = new Array<
|
||||
{ "name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
let counter = this.publicationInfo.similarPublications.length;
|
||||
|
||||
this.publicationInfo.similarPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
||||
this.publicationInfo.similarPublications[counter]['url'] = url;
|
||||
this.publicationInfo.similarPublications[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.similarPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.similarPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
} else if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "dataset") {
|
||||
if(this.publicationInfo.similarDatasets == undefined) {
|
||||
this.publicationInfo.similarDatasets = new Array<
|
||||
{ "name": string, "url": string, "date": string, "trust": string}>();
|
||||
}
|
||||
|
||||
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
let counter = this.publicationInfo.similarDatasets.length;
|
||||
|
||||
this.publicationInfo.similarDatasets[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
||||
this.publicationInfo.similarDatasets[counter]['url'] = url;
|
||||
this.publicationInfo.similarDatasets[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.similarDatasets[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.similarDatasets[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
}*/
|
||||
|
||||
if(this.publicationInfo.similarResearchResults == undefined) {
|
||||
this.publicationInfo.similarResearchResults = new Array<{
|
||||
"name": string, "url": string, "date": string,
|
||||
"trust": string, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.publicationInfo.similarResearchResults.length;
|
||||
this.publicationInfo.similarResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
||||
|
||||
let url;
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.publicationInfo.similarResearchResults[counter]['url'] = url;
|
||||
this.publicationInfo.similarResearchResults[counter]['name'] = mydata['title'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
||||
this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[]}>();
|
||||
|
||||
this.publicationInfo.types = new Array<string>();
|
||||
|
||||
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
||||
|
||||
let types = new Set<string>();
|
||||
let counter = 0;
|
||||
let counter1 = 0;
|
||||
let counter2 = 0;
|
||||
let mydata;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
if(mydata.hasOwnProperty("instancetype")) {
|
||||
if(!types.has(mydata['instancetype'].classname)) {
|
||||
this.publicationInfo.types[counter] = mydata['instancetype'].classname;
|
||||
types.add(mydata['instancetype'].classname);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(mydata['webresource'].length == undefined) {
|
||||
url = mydata['webresource'].url;
|
||||
} else{
|
||||
url = mydata['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("hostedby")) {
|
||||
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
|
||||
if(!this.publicationInfo.downloadFrom.has(mydata['hostedby'].name)) {
|
||||
this.publicationInfo.downloadFrom.set(mydata['hostedby'].name, {"url": null, "accessMode": null});
|
||||
}
|
||||
|
||||
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] == null) {
|
||||
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
counter2 = this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'].length;
|
||||
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'][counter2] = url;
|
||||
|
||||
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] == null) {
|
||||
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("licence")) {
|
||||
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
|
||||
} else {
|
||||
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
|
||||
}
|
||||
} else {
|
||||
if(data[0] != null && data[0].hasOwnProperty("source")) {
|
||||
let key: string;
|
||||
if(Array.isArray(data[0].source)) {
|
||||
if(!this.publicationInfo.publishedIn.has(data[0]['source'][counter1])) {
|
||||
key = data[0]['source'][counter1];
|
||||
}
|
||||
} else {
|
||||
if(!this.publicationInfo.publishedIn.has(data[0]['source'])) {
|
||||
key = data[0]['source'];
|
||||
}
|
||||
}
|
||||
|
||||
this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null});
|
||||
|
||||
if(this.publicationInfo.publishedIn.get(key)['url'] == null) {
|
||||
this.publicationInfo.publishedIn.get(key)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
counter2 = this.publicationInfo.publishedIn.get(key)['url'].length;
|
||||
this.publicationInfo.publishedIn.get(key)['url'][counter2] = url;
|
||||
|
||||
if(this.publicationInfo.publishedIn.get(key)['accessMode'] == null) {
|
||||
this.publicationInfo.publishedIn.get(key)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("licence")) {
|
||||
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
|
||||
} else {
|
||||
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = "";
|
||||
}
|
||||
counter1++;
|
||||
}
|
||||
}
|
||||
if(this.publicationInfo.title != undefined) {
|
||||
if(this.publicationInfo.title['url'] == "") {
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
|
||||
switch (this.publicationInfo.title['accessMode']) {
|
||||
case undefined:
|
||||
this.publicationInfo.title['accessMode'] = mydata['accessMode'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
break;
|
||||
case "CLOSED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO" ||
|
||||
mydata['licence'].classid == "RESTRICTED") {
|
||||
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "RESTRICTED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO") {
|
||||
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "EMBARGO":
|
||||
if(mydata['licence'].classid == "OPEN") {
|
||||
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3].hasOwnProperty("externalreference")) {
|
||||
this.publicationInfo.bioentities = new Map<string, Map<string, string>>();
|
||||
|
||||
let length = data[3]['externalreference'].length!=undefined ? data[3]['externalreference'].length : 1;
|
||||
|
||||
let mydata;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[3]['externalreference'][i] : data[3]['externalreference'];
|
||||
|
||||
if(!this.publicationInfo.bioentities.has(mydata.sitename)) {
|
||||
this.publicationInfo.bioentities.set(mydata.sitename, new Map<string, string>());
|
||||
}
|
||||
this.publicationInfo.bioentities.get(mydata.sitename).set(mydata.refidentifier, mydata.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
let counter = 0;
|
||||
this.publicationInfo.identifiers = new Map<string, string[]>();
|
||||
|
||||
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
||||
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
||||
if(!this.publicationInfo.identifiers.has(data[4].classname)) {
|
||||
this.publicationInfo.identifiers.set(data[4].classname, new Array<string>());
|
||||
}
|
||||
counter = this.publicationInfo.identifiers.get(data[4].classname).length;
|
||||
this.publicationInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[4].length; i++) {
|
||||
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
||||
if(!this.publicationInfo.identifiers.has(data[4][i].classname)) {
|
||||
this.publicationInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
||||
}
|
||||
counter = this.publicationInfo.identifiers.get(data[4][i].classname).length;
|
||||
this.publicationInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
this.publicationInfo.journal = {"journal": "", "issn": "", "lissn": ""}
|
||||
|
||||
this.publicationInfo.journal['journal'] = data[5].content;
|
||||
this.publicationInfo.journal['issn'] = data[5].issn;
|
||||
this.publicationInfo.journal['lissn'] = data[5].lissn;
|
||||
}
|
||||
|
||||
if(data[6] != null) {
|
||||
this.publicationInfo.languages = new Array<string>();
|
||||
|
||||
if(data[6].hasOwnProperty("classname")) {
|
||||
this.publicationInfo.languages[0] = data[6].classname;
|
||||
} else {
|
||||
for(let i=0; i<data[6].length; i++) {
|
||||
this.publicationInfo.languages[i] = data[6][i].classname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[7] != null) {
|
||||
this.publicationInfo.classifiedSubjects = new Map<string, string[]>();
|
||||
this.publicationInfo.subjects = new Array<string>();
|
||||
|
||||
let mydata;
|
||||
let length = data[7].length!=undefined ? data[7].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[7][i] : data[7];
|
||||
|
||||
if(mydata.classid != "") {
|
||||
if(mydata.inferred == true) {
|
||||
if(!this.publicationInfo.classifiedSubjects.has(mydata.classid)) {
|
||||
this.publicationInfo.classifiedSubjects.set(mydata.classid, new Array<string>());
|
||||
}
|
||||
|
||||
let counter = this.publicationInfo.classifiedSubjects.get(mydata.classid).length;
|
||||
this.publicationInfo.classifiedSubjects.get(mydata.classid)[counter] = mydata.content;
|
||||
} else {
|
||||
let counter = this.publicationInfo.subjects.length;
|
||||
this.publicationInfo.subjects[counter] = mydata.content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[8] != null) {
|
||||
this.publicationInfo.bestlicense = data[8].classid;
|
||||
}
|
||||
|
||||
if(data[9] != null) {
|
||||
this.publicationInfo.collectedFrom = new Array<{"name": string, "url": string}>();
|
||||
|
||||
let mydata;
|
||||
let length = data[9].length!=undefined ? data[9].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[9][i] : data[9];
|
||||
let link = "https://beta.openaire.eu/search/dataprovider?datasourceId=";
|
||||
this.publicationInfo.collectedFrom[i] = {"name": "", "url": ""};
|
||||
this.publicationInfo.collectedFrom[i]['name'] = mydata.name;
|
||||
this.publicationInfo.collectedFrom[i]['url'] = link+mydata.id;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.publicationInfo.publisher != null
|
||||
&& this.publicationInfo.identifiers != null
|
||||
&& this.publicationInfo.identifiers.has('doi')) {
|
||||
|
||||
if( this.publicationInfo.downloadFrom == null) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
||||
}
|
||||
|
||||
let key: string;
|
||||
if(this.publicationInfo.journal != null) {
|
||||
key = this.publicationInfo.publisher + "/ "+this.publicationInfo.journal
|
||||
} else {
|
||||
key = this.publicationInfo.publisher;
|
||||
}
|
||||
this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null});
|
||||
|
||||
let url = "http://dx.doi.org/"+this.publicationInfo.identifiers.get("doi")[0];
|
||||
|
||||
this.publicationInfo.downloadFrom.get(key)['url'] = new Array<string>();
|
||||
this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array<string>();
|
||||
|
||||
this.publicationInfo.downloadFrom.get(key)['url'][0] = url;
|
||||
this.publicationInfo.downloadFrom.get(key)['accessMode'][0] = "";
|
||||
|
||||
if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") {
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[10] != null) {
|
||||
this.publicationInfo.references = new Array<{"name": string, "url": string}>();
|
||||
|
||||
let mydata;
|
||||
let length = data[10].length!=undefined ? data[10].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[10][i] : data[10];
|
||||
|
||||
let url;
|
||||
if(mydata.hasOwnProperty("id")) {
|
||||
let mydata1;
|
||||
let length1 = mydata['id'].length!=undefined ? mydata['id'].length : 1;
|
||||
for(let j=0; j<length1; j++) {
|
||||
mydata1 = length1 > 1 ? mydata['id'][j] : mydata['id'];
|
||||
|
||||
if(mydata1.type == "pmid") {
|
||||
url = "http://www.ncbi.nlm.nih.gov/pubmed/"+mydata1.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.publicationInfo.references[mydata.position-1] = { "name": "", "url": ""};
|
||||
this.publicationInfo.references[mydata.position-1]['name'] = mydata.rawText;
|
||||
this.publicationInfo.references[mydata.position-1]['url'] = url;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[11] != null) {
|
||||
this.publicationInfo.contexts = new Array<
|
||||
{ "labelContext": string, "labelCategory": string, "labelConcept": string}>();
|
||||
|
||||
let position = 0;
|
||||
let labels = "";
|
||||
let mydata;
|
||||
let length = data[11].length!=undefined ? data[11].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = length > 1 ? data[11][i] : data[11];
|
||||
|
||||
if(mydata.hasOwnProperty("type") && mydata['type'] == "community") {
|
||||
if(mydata.hasOwnProperty("category")) {
|
||||
if(mydata['category'].hasOwnProperty("concept")) {
|
||||
let mydata1;
|
||||
let length1 = mydata['category']['concept'].length!=undefined ? mydata['category']['concept'].length : 1;
|
||||
for(let j=0; j<length1; j++) {
|
||||
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
|
||||
|
||||
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.publicationInfo.contexts[position]['labelConcept'] = mydata1.label;
|
||||
|
||||
position++;
|
||||
}
|
||||
} else {
|
||||
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
} else {
|
||||
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
||||
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.publicationInfo.contexts[position]['labelCategory'] = null;
|
||||
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this.printPublicationInfo();
|
||||
return this.publicationInfo;
|
||||
|
||||
}
|
||||
|
||||
printPublicationInfo() {
|
||||
console.info("DATE: "+this.publicationInfo.date);
|
||||
console.info("PUBLISHER: "+this.publicationInfo.publisher);
|
||||
console.info("DESCRIPTION: "+this.publicationInfo.description);
|
||||
|
||||
console.info("TITLE: "+this.publicationInfo.title);
|
||||
|
||||
console.info("AUTHORS: "+this.publicationInfo.authors);
|
||||
console.info("\nFUNDED BY PROJECTS:");
|
||||
if(this.publicationInfo.fundedByProjects != undefined) {
|
||||
this.publicationInfo.fundedByProjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
/*
|
||||
console.info("\nRELATED RESEARCH DATA:");
|
||||
if(this.publicationInfo.relatedResearchData != undefined) {
|
||||
this.publicationInfo.relatedResearchData.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nSIMILAR PUBLICATIONS:");
|
||||
if(this.publicationInfo.similarPublications != undefined) {
|
||||
this.publicationInfo.similarPublications.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
*/
|
||||
console.info("TYPES: "+this.publicationInfo.types);
|
||||
console.info("\nDOWNLOAD FROM:");
|
||||
if(this.publicationInfo.downloadFrom != undefined) {
|
||||
this.publicationInfo.downloadFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
console.info("\nBIOENTITIES:");
|
||||
if(this.publicationInfo.bioentities != undefined) {
|
||||
this.publicationInfo.bioentities.forEach(function (value, key, map) {
|
||||
value.forEach(function (value1, key1, map1) {
|
||||
console.info(key + " = " + key1 + " = " + value1);
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nIDENTIFIERS:");
|
||||
if(this.publicationInfo.identifiers != undefined) {
|
||||
this.publicationInfo.identifiers.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("JOURNAL: "+this.publicationInfo.journal);
|
||||
|
||||
|
||||
console.info("LANGUAGES: "+this.publicationInfo.languages);
|
||||
|
||||
|
||||
console.info("SUBJECTS: "+this.publicationInfo.subjects);
|
||||
console.info("\nCLASSIFIED OBJECTS:");
|
||||
if(this.publicationInfo.classifiedSubjects != undefined) {
|
||||
this.publicationInfo.classifiedSubjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("BEST LICENSE: "+this.publicationInfo.bestlicense);
|
||||
|
||||
console.info("\nCOLLECTED FROM:");
|
||||
if(this.publicationInfo.collectedFrom != undefined) {
|
||||
this.publicationInfo.collectedFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
|
||||
console.info("\nREFERENCES:");
|
||||
if(this.publicationInfo.references != undefined) {
|
||||
for(let i in this.publicationInfo.references) {
|
||||
for(let key in this.publicationInfo.references[i]) {
|
||||
console.info(key+" : "+this.publicationInfo.references[i][key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
// import {Http, Response, Headers} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
// import {Publication} from '../entities/publication';
|
||||
@Injectable()
|
||||
export class SearchCrossrefService {
|
||||
constructor( private http: Http) {}
|
||||
|
||||
|
||||
searchCrossrefResults (term: string, size : number, page : number):any {
|
||||
let url = 'http://api.crossref.org/works?query='+term+'&rows='+size+'&offset='+(size*(page-1));
|
||||
////"&rows=".$size."&offset=".($page-1)*$size
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().message)
|
||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Jsonp, URLSearchParams} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class SearchDataciteService {
|
||||
constructor(private jsonp: Jsonp, private http: Http) {}
|
||||
|
||||
searchDataciteResults (term: string, size : number, page : number):any {
|
||||
console.info("In search datacite results "+term);
|
||||
let url = 'http://search.datacite.org/api?q='+term+'&fl=doi,title,creator,publisher&wt=json&rows='+size+'&start='+(size*(page-1));
|
||||
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json().response)
|
||||
.do(items => console.log("Datacite Results: total results = "+items['numFound']+" keyword = "+term))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
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.error(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
private extractData(res: Response) {
|
||||
if (res.status < 200 || res.status >= 300) {
|
||||
throw new Error('Bad response status: ' + res.status);
|
||||
}
|
||||
let body = res.json();
|
||||
return body.data || { };
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Jsonp, URLSearchParams} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import { Headers, RequestOptions } from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class SearchOrcidService {
|
||||
constructor(private jsonp: Jsonp, private http: Http) {}
|
||||
|
||||
searchOrcidAuthor (term: string):any {
|
||||
console.info("In searchOrcidAuthor: "+term);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = 'https://pub.orcid.org/'+term+'/orcid-bio';
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-profile'])
|
||||
.map(res => [res['orcid-bio']['personal-details']['given-names'],
|
||||
res['orcid-bio']['personal-details']['family-name'],
|
||||
res['orcid-identifier']]);
|
||||
}
|
||||
|
||||
searchOrcidAuthors (term: string):any {
|
||||
console.info("In search Orcid authors for keyword: "+term);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = 'https://pub.orcid.org/search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10';
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-search-results'])
|
||||
.flatMap(res => res['orcid-search-result'])
|
||||
.map(res => res['orcid-profile'])
|
||||
.map(res => [res['orcid-bio']['personal-details']['given-names'],
|
||||
res['orcid-bio']['personal-details']['family-name'],
|
||||
res['orcid-identifier']]);
|
||||
}
|
||||
|
||||
searchOrcidPublications (id: string):any {
|
||||
console.info("In search Orcid publications for author: "+id);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = 'https://pub.orcid.org/'+id+'/orcid-works';
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-profile']['orcid-activities']['orcid-works'])
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
import 'angular2-universal/polyfills';
|
||||
|
||||
import {bootstrap, enableProdMode, BROWSER_ROUTER_PROVIDERS, BROWSER_HTTP_PROVIDERS} from 'angular2-universal';
|
||||
|
||||
import {App} from './app/app.component';
|
||||
|
||||
enableProdMode();
|
||||
|
||||
bootstrap(App, [
|
||||
...BROWSER_ROUTER_PROVIDERS,
|
||||
...BROWSER_HTTP_PROVIDERS
|
||||
]);
|
|
@ -1,25 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>OpenAIRE</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="Open Access Infrastructure for Europe ">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js" ></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
|
||||
|
||||
<base href="/">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<app>
|
||||
... Loading ...
|
||||
</app>
|
||||
|
||||
<script defer src="https://code.getmdl.io/1.1.3/material.min.js"></script>
|
||||
<script src="/dist/client/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
|
@ -1,79 +0,0 @@
|
|||
import 'angular2-universal/polyfills';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as express from 'express';
|
||||
import * as bodyParser from 'body-parser';
|
||||
|
||||
// Angular 2 Universal
|
||||
import {
|
||||
provide,
|
||||
enableProdMode,
|
||||
expressEngine,
|
||||
REQUEST_URL,
|
||||
ORIGIN_URL,
|
||||
BASE_URL,
|
||||
NODE_ROUTER_PROVIDERS,
|
||||
NODE_HTTP_PROVIDERS,
|
||||
ExpressEngineConfig
|
||||
} from 'angular2-universal';
|
||||
|
||||
// Application
|
||||
import {App} from './app/app.component';
|
||||
|
||||
const app = express();
|
||||
const ROOT = path.join(path.resolve(__dirname, '..'));
|
||||
|
||||
enableProdMode();
|
||||
|
||||
// Express View
|
||||
app.engine('.html', expressEngine);
|
||||
app.set('views', __dirname);
|
||||
app.set('view engine', 'html');
|
||||
|
||||
app.use(bodyParser.json());
|
||||
|
||||
|
||||
function ngApp(req, res) {
|
||||
let baseUrl = '/';
|
||||
let url = req.originalUrl || '/';
|
||||
|
||||
let config: ExpressEngineConfig = {
|
||||
directives: [ App ],
|
||||
platformProviders: [
|
||||
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
|
||||
provide(BASE_URL, {useValue: baseUrl}),
|
||||
],
|
||||
providers: [
|
||||
provide(REQUEST_URL, {useValue: url}),
|
||||
NODE_ROUTER_PROVIDERS,
|
||||
NODE_HTTP_PROVIDERS,
|
||||
],
|
||||
async: true,
|
||||
preboot: false // { appRoot: 'app' } // your top level app component selector
|
||||
};
|
||||
|
||||
res.render('index', config);
|
||||
}
|
||||
|
||||
function indexFile(req, res) {
|
||||
res.sendFile('/index.html', {root: __dirname});
|
||||
}
|
||||
|
||||
// Serve static files
|
||||
app.use(express.static(ROOT, {index: false}));
|
||||
|
||||
// Our API for demos only
|
||||
app.get('/data.json', (req, res) => {
|
||||
res.json({
|
||||
data: 'This fake data came from the server.'
|
||||
});
|
||||
});
|
||||
|
||||
// Routes with html5pushstate
|
||||
app.use('/', ngApp);
|
||||
app.use('/home', ngApp);
|
||||
app.use('/search', ngApp);
|
||||
// Server
|
||||
app.listen(3000, () => {
|
||||
console.log('Listening on: http://localhost:3000');
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Custom Type Definitions
|
||||
* When including 3rd party modules you also need to include the type definition for the module
|
||||
* if they don't provide one within the module. You can try to install it with typings
|
||||
typings install node --save
|
||||
* If you can't find the type definition in the registry we can make an ambient definition in
|
||||
* this file for now. For example
|
||||
declare module "my-module" {
|
||||
export function doesSomething(value: string): string;
|
||||
}
|
||||
*
|
||||
* If you're prototying and you will fix the types later you can also declare it as type any
|
||||
*
|
||||
declare var assert: any;
|
||||
*
|
||||
* If you're importing a module that uses Node.js modules which are CommonJS you need to import as
|
||||
*
|
||||
import * as _ from 'lodash'
|
||||
* You can include your type definitions in this file until you create one for the typings registry
|
||||
* see https://github.com/typings/registry
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Extra variables that live on Global that will be replaced by webpack DefinePlugin
|
||||
declare var ENV: string;
|
||||
declare var HMR: boolean;
|
||||
interface GlobalEnvironment {
|
||||
ENV;
|
||||
HMR;
|
||||
}
|
||||
|
||||
interface WebpackModule {
|
||||
hot: {
|
||||
data?: any,
|
||||
idle: any,
|
||||
accept(dependencies?: string | string[], callback?: (updatedDependencies?: any) => void): void;
|
||||
decline(dependencies?: string | string[]): void;
|
||||
dispose(callback?: (data?: any) => void): void;
|
||||
addDisposeHandler(callback?: (data?: any) => void): void;
|
||||
removeDisposeHandler(callback?: (data?: any) => void): void;
|
||||
check(autoApply?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
|
||||
apply(options?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
|
||||
status(callback?: (status?: string) => void): void | string;
|
||||
removeStatusHandler(callback?: (status?: string) => void): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface WebpackRequire {
|
||||
context(file: string, flag?: boolean, exp?: RegExp): any;
|
||||
}
|
||||
|
||||
|
||||
interface ErrorStackTraceLimit {
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
|
||||
// Extend typings
|
||||
interface NodeRequire extends WebpackRequire {}
|
||||
interface ErrorConstructor extends ErrorStackTraceLimit {}
|
||||
interface NodeModule extends WebpackModule {}
|
||||
interface Global extends GlobalEnvironment {}
|
||||
|
||||
|
||||
interface Thenable<T> {
|
||||
then<U>(
|
||||
onFulfilled?: (value: T) => U | Thenable<U>,
|
||||
onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
then<U>(
|
||||
onFulfilled?: (value: T) => U | Thenable<U>,
|
||||
onRejected?: (error: any) => void): Thenable<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"removeComments": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"typings/main.d.ts",
|
||||
"typings/main",
|
||||
"node_modules"
|
||||
],
|
||||
"compileOnSave": false,
|
||||
"buildOnSave": false,
|
||||
"atom": { "rewriteTsconfig": false }
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"ambientDependencies": {
|
||||
"body-parser": "registry:dt/body-parser#0.0.0+20160317120654",
|
||||
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
|
||||
"express": "registry:dt/express#4.0.0+20160317120654",
|
||||
"express-serve-static-core": "registry:dt/express-serve-static-core#0.0.0+20160322035842",
|
||||
"mime": "registry:dt/mime#0.0.0+20160316155526",
|
||||
"node": "registry:dt/node#4.0.0+20160412142033",
|
||||
"serve-static": "registry:dt/serve-static#0.0.0+20160317120654"
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
|
||||
var commonConfig = {
|
||||
resolve: {
|
||||
extensions: ['', '.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
// TypeScript
|
||||
{ test: /\.ts$/, loader: 'ts-loader' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.OccurenceOrderPlugin(true)
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var clientConfig = {
|
||||
target: 'web',
|
||||
entry: './src/client',
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist', 'client')
|
||||
},
|
||||
node: {
|
||||
global: true,
|
||||
__dirname: true,
|
||||
__filename: true,
|
||||
process: true,
|
||||
Buffer: false
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var serverConfig = {
|
||||
target: 'node',
|
||||
entry: './src/server',
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist', 'server')
|
||||
},
|
||||
externals: checkNodeImport,
|
||||
node: {
|
||||
global: true,
|
||||
__dirname: true,
|
||||
__filename: true,
|
||||
process: true,
|
||||
Buffer: true
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Default config
|
||||
var defaultConfig = {
|
||||
module: {
|
||||
noParse: [
|
||||
path.join(__dirname, 'zone.js', 'dist'),
|
||||
path.join(__dirname, 'angular2', 'bundles')
|
||||
]
|
||||
},
|
||||
context: __dirname,
|
||||
resolve: {
|
||||
root: path.join(__dirname, '/src')
|
||||
},
|
||||
output: {
|
||||
publicPath: path.resolve(__dirname),
|
||||
filename: 'bundle.js'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var webpackMerge = require('webpack-merge');
|
||||
module.exports = [
|
||||
// Client
|
||||
webpackMerge({}, defaultConfig, commonConfig, clientConfig),
|
||||
|
||||
// Server
|
||||
webpackMerge({}, defaultConfig, commonConfig, serverConfig)
|
||||
]
|
||||
|
||||
// Helpers
|
||||
function checkNodeImport(context, request, cb) {
|
||||
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
|
||||
cb(null, 'commonjs ' + request); return;
|
||||
}
|
||||
cb();
|
||||
}
|
Loading…
Reference in New Issue