get back claim Pages | create lazy routes for admin, myclaims, linking | fix the layout with uikit | gets work fine | delete and inserts don't

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45951 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-02-17 15:56:33 +00:00
parent 78e67c04d3
commit 731003e050
71 changed files with 4700 additions and 103 deletions

View File

@ -106,7 +106,19 @@ export function gethtmlProjectReportModule() {
return System.import('./landingPages/htmlProjectReport/htmlProjectReport.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'HtmlProjectReportModuleNgFactory' : 'HtmlProjectReportModule')]);
}
export function getMyClaimsModule() {
return System.import('./claims/myClaims/myClaims.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'MyClaimsModuleNgFactory' : 'MyClaimsModule')]);
}
export function getClaimsAdminModule() {
return System.import('./claims/claimsAdmin/claimsAdmin.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ClaimsAdminModuleNgFactory' : 'ClaimsAdminModule')]);
}
export function getLinkingModule() {
return System.import('./claims/linking/linking.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'LinkingModuleNgFactory' : 'LinkingModule')]);
}
@NgModule({
imports: [
RouterModule.forChild([
@ -136,7 +148,12 @@ export function gethtmlProjectReportModule() {
{ path: 'search/advanced/dataproviders', loadChildren: getAdvancedSearchDataProvidersModule },
{ path: 'search/advanced/projects', loadChildren: getAdvancedSearchProjectsModule },
{ path: 'search/advanced/people', loadChildren: getAdvancedSearchPeopleModule },
{ path: 'project-report', loadChildren: gethtmlProjectReportModule }
{ path: 'project-report', loadChildren: gethtmlProjectReportModule },
{ path: 'myclaims', loadChildren: getMyClaimsModule },
{ path: 'claims', loadChildren: getClaimsAdminModule },
{ path: 'linking', loadChildren: getLinkingModule }
])

View File

@ -0,0 +1,22 @@
// import { NgModule } from '@angular/core';
// import { RouterModule } from '@angular/router';
//
// import {ClaimsAdminComponent} from './claims/claimsAdmin.component';
// import {ClaimComponent} from './claim/claim.component';
// import {MyClaimsComponent} from './myClaims/myClaims.component';
// import { LinkingComponent } from './linking/linking.component';
// import { BulkLinkingComponent } from './linking/bulkLinking.component';
//
// @NgModule({
// imports: [
// RouterModule.forChild([
// { path: 'claims', component: ClaimsAdminComponent },
// { path: 'myclaims', component: MyClaimsComponent },
// { path: 'claim', component: ClaimComponent },
// { path: 'linking', component: LinkingComponent },
// { path: 'bulk-linking', component: BulkLinkingComponent},
//
// ])
// ]
// })
// export class ClaimRoutingModule { }

View File

@ -0,0 +1,15 @@
export class Claim {
id: string;
sourceType: string;
targetType: string;
sourceId: string;
targetId: string;
date: string;
DOI: string;
project: Project
userMail: string;
}
export class Project{
}

View File

@ -0,0 +1,215 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ContextsService} from './service/contexts.service';
import {ClaimContext} from './claimEntities.class';
import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete/staticAutoComplete.component';
declare var UIkit:any;
@Component({
// moduleId: module.id,
selector: 'claim-contexts',
template: `
<div class="panel-body" *ngIf="!inline">
<div class="uk-form" >
<!--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-->
<table ><tr><td >
<select name="select_funder" >
<option value="0" (click)="communityChanged('0','Community:')">Select Community:</option>
<option *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" [value]="communities.id" >{{communities.label}}</option>
</select>
</td><td >
<!--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-->
<select name="select_funder" >
<option value="0" (click)="categoryChanged('0','Category:')">Select Community:</option>
<option *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" [value]="category.id" >{{category.label}}</option>
</select>
</td><td >
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Concepts'" title = "Concepts:" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
</td></tr></table>
</div>
</div>
<div class="panel-body" *ngIf=" inline && showComponent ">
<div class=" form-horizontal">
<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 custom-hidden-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 custom-hidden-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>
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Concepts'" title = "Concepts:" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
</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>
`
})
export class ClaimContextComponent {
@Input() public inline:boolean = false ; // for claimed started from landing pages
@Input() public showComponent:boolean = true ; // for claimed started from landing pages
@Input() public selectedList = [];
@Input() public selectedCommunityId:string = "0";
@Input() public selectedCategoryId:string ="0";
@Output() cselectedCommunityChange = new EventEmitter();
@Output() selectedCategoryChange = new EventEmitter();
@ViewChild (StaticAutoCompleteComponent) autocomplete : StaticAutoCompleteComponent ;
public query = '';
public filteredList = [];
public communities:string[];
public selectedCommunityLabel:string = "Community:";
public categories:string[];
public selectedCategoryLabel:string ="Category:";
public concepts = [];
public warningMessage = "";
public infoMessage = "";
ngOnInit() {
this.getCommunities();
}
constructor(private _contextService: ContextsService) {
}
select($event){
var item = $event.value;
var context: ClaimContext= { 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";
}
}
// var UIkit:any;
if (!found) {
this.selectedList.push(context);
UIkit.notify({
message : 'A context is selected.',
status : 'info',
timeout : 1000,
pos : 'top-center'
});
}else{
UIkit.notify({
message : 'The context is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
getCommunities () {
this._contextService.getCommunities().subscribe(
data => {
this.communities = data.communities;
},
err => console.log(err)
);
}
getCategories () {
console.log(" Getting Categories... ");
this.categories=[];
if(this.selectedCommunityId != '0'){
this._contextService.getCategories(this.selectedCommunityId).subscribe(
data => {
this.categories = data.category;
this.concepts = [];
this.filteredList = [];
if (this.query !== ""){
var event = {value: ""};
event.value = this.query;
}
},
err => console.log(err)
);
}
}
getConcepts () {
if(this.selectedCategoryId != '0'){
this._contextService.getConcepts(this.selectedCategoryId, "").subscribe(
data => {
this.concepts = data;
this.autocomplete.updateList(this.concepts);
if (this.query !== ""){
var event = {value: ""};
event.value = this.query;
// this.filter(event);
}
},
err => console.log(err)
);
}else{
this.concepts=[];
}
}
communityChanged(communityId:string, communityLabel:string){
console.log(communityId +" "+communityLabel);
console.log(this.selectedCommunityId +" ");
this.warningMessage = "";
this.infoMessage = "";
if(this.selectedCommunityId != communityId){
console.log( " here");
this.selectedCommunityId = communityId;
this.selectedCommunityLabel = communityLabel;
this.getCategories();
}
}
categoryChanged(categoryId:string, categoryLabel:string){
this.warningMessage = "";
this.infoMessage = "";
if(this.selectedCategoryId != categoryId){
this.selectedCategoryId = categoryId;
this.selectedCategoryLabel = categoryLabel;
this.getConcepts();
}
}
}

View File

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { ClaimContextComponent } from './claimContext.component';
import{ContextsServiceModule} from './service/contextsService.module';
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
@NgModule({
imports: [
SharedModule,
ContextsServiceModule,
StaticAutocompleteModule
],
declarations: [
ClaimContextComponent
], exports: [ClaimContextComponent ]
})
export class ClaimContextModule { }

View File

@ -0,0 +1,247 @@
import { Component, Input, Output, EventEmitter} from '@angular/core';
import { SearchDataciteService } from '../claim-utils/service/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {ClaimResult} from '../claim-utils/claimEntities.class';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import{DOI} from '../../utils/string-utils.class';
@Component({
selector: 'claim-dataset',
template: `
<!--div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="uk-alert uk-alert-info" role="alert">{{infoMessage}}</div-->
<div class="uk-margin-top ">
<div class="">
<ul class="uk-tab" data-uk-switcher="{connect:'#claimsearchtabs'}">
<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>
<ul id="claimsearchtabs" class="uk-switcher">
<li id="datacite" class="tab-pane fade in active">
<div class = "uk-margin-top">
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load>
</div>
</div>
<div *ngIf="dataciteResultsNum == null || dataciteResultsNum == 0" class="uk-alert uk-alert-info" role="alert">No results found</div>
<div >
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.doi))?'uk-block-muted':''" >
<div >
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" >{{item.title}}</a>
<span *ngIf="!item.doi" >{{item.title}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(item.doi)" (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi, null,'OPEN')"><i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>
</div>
<span *ngIf="item.publisher" class="uk-article-meta">Publisher: {{item.publisher}}</span>
<div *ngIf="item.creator" class="uk-article-meta">Authors: <span *ngFor="let author of item.creator let i = index">{{author}}{{(i < (item.creator.length-1))?"; ":""}}</span></div>
</li>
</ul>
</div>
</div>
</li>
<li id="openaire" class="tab-pane fade">
<div class = "uk-margin-top">
<div *ngIf="openaireResultsNum != null && openaireResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="openairePage" [totalResults]="openaireResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openairePageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="openaireResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let result of openaireResults " [class]="(isSelected(result.id))?'uk-block-muted':''">
<div >
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(result.id)"
(click)="add(result, result.id, 'dataset', 'openaire', result['title'].name, result['title'].url, result.year, result['title'].accessMode)"> <i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)">({{result.year}})</span>
<div *ngIf="result.authors" class="uk-article-meta">Authors: <span *ngFor="let author of result.authors let i = index">{{author.name}}{{(i < (result.authors.length-1))?"; ":""}}</span></div>
</li>
</ul>
<div *ngIf="openaireResults.length == 0" class = "uk-alert uk-alert-info " > No results found </div>
</div>
</div>
</li>
</ul>
</div>
`
})
export class ClaimDatasetComponent {
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService){
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.search(this.keyword,this.size,1);
}
}
@Input() public select:boolean = true ;
@Input() public keyword:string = '';
@Input() public selectedDatasets = [] ;
@Output() datasetsChange = new EventEmitter();
public size:number = 10;
public navigateTo: string = "Search";
public source: string = "datacite";
public type : string = "dataset";
public errorCodes:ErrorCodes = new ErrorCodes();
dataciteResults=[];
dataciteResultsNum:number = null;
// dataciteResultsNum : Observable<number> = null;
dataciteStatus = this.errorCodes.NONE;
datacitePage : number = 1;
openaireResults=[];
openaireResultsNum:number = 0 ;
openaireStatus = this.errorCodes.NONE;
openairePage : number = 1;
public warningMessage = "";
public infoMessage = "";
public todayDate = '';
public nextDate = '';
public DOIs:string[] = [];
public search(term: string, size : number, page : number){
this.DOIs = DOI.getDOIsFromString(term);
this.searchDatacite(term,10,1);
this.searchOpenaire(term,10,1);
}
private searchDatacite (term: string, size : number, page : number) {
this.getDataciteResults(term,size,page);
this.warningMessage = "";
this.infoMessage = "";
}
private searchOpenaire (term: string, size : number, page : number) {
if(this.DOIs.length > 0 ){
this.openaireStatus = this.errorCodes.LOADING;
this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePage=page;
this.openaireResultsNum = data[0];
this.openaireResults = data[1];
this.openaireStatus = this.errorCodes.DONE;
if(this.openaireResultsNum == 0){
this.openaireStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}else{
this._searchDatasetsService.searchDatasets('q="'+term+'"', null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePage=page;
this.openaireResultsNum = data[0];
this.openaireResults = data[1];
this.openaireStatus = this.errorCodes.DONE;
if(this.openaireResultsNum == 0){
this.openaireStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
this.warningMessage = "";
this.infoMessage = "";
}
private getDataciteResults (term: string, size : number, page : number) {
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
data => {
this.dataciteResults = data.docs;
this.datacitePage=page;
this.dataciteResultsNum = data.numFound;
this.dataciteStatus = this.errorCodes.DONE;
},
err => {
this.dataciteStatus = this.errorCodes.ERROR;
console.log(err);
}
);
}
add(item, itemId,itemType,itemSource,itemTitle, itemUrl, date, accessmode){
console.log(' adding dataset '+ itemSource+" "+ itemTitle);
var result: ClaimResult ;
if(itemSource == 'datacite'){
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
}else if (itemSource == 'openaire'){
//TODO put right access rights
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
}
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";
}
}
datacitePageChange($event) {
this.datacitePage=$event.value;
this.dataciteResults=[];
this.searchDatacite(this.keyword,10,this.datacitePage);
this.warningMessage = "";
this.infoMessage = "";
}
openairePageChange($event) {
this.openairePage=$event.value;
this.openaireResults=[];
this.searchOpenaire(this.keyword,10,this.openairePage);
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;
}
}

View File

@ -0,0 +1,30 @@
//Classes used in linking / inlinelinking when selecting an entity
export class ClaimResult{
public id: string;
public type: string;
public source: string;
public title: string;
public url: string;
public result: any;
public accessRights: string = "OPEN";
public embargoEndDate: string;
public date: string;
}
export class ClaimProject{
public funderId: string;
public funderName: string;
public projectId: string;
public projectName: string;
public projectAcronym: string;
public startDate: string;
public endDate: string;
}
export class ClaimContext{
public community: string;
public category: string;
public concept:any;
}

View File

@ -0,0 +1,179 @@
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {ProjectService} from '../../landingPages/project/project.service';
import {ModalLoading} from '../../utils/modal/loading.component';
import { Subject } from 'rxjs/Subject';
import {ClaimProject} from './claimEntities.class';
declare var UIkit:any;
@Component({
selector: 'claim-projects',
// styleUrls: ['/autoComplete.component.css'],
template: `
<div class="panel-body" >
<form class="uk-form " [class.form-inline]="!inline">
<table ><tr><td >
<select [(ngModel)]="selectedFunderId" name="select_funder" >
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option>
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{funder.name}}</option>
</select></td><td >
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
</td></tr></table>
</form>
</div>
<modal-loading [message]= "'Loading...'"></modal-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-->
`
})
export class ClaimProjectsComponent {
ngOnInit() {
this.getFunders();
}
@ViewChild (ModalLoading) loading : ModalLoading ;
@Input() public inline: boolean = false ; // for claimed started from landing pages
public query = '';
@Input() public selectedProjects=[] ;
public elementRef;
public funders:string[];
@Input() public selectedFunderId:string ="0";
selectedFunderName:string ="Select funder:";
@Output() cselectedFunderChange = new EventEmitter();
public projects:string[];
public warningMessage = "";
public infoMessage = "";
public searchTermStream = new Subject<string>();
filtered: Observable<{}> = this.searchTermStream
.debounceTime(300).distinctUntilChanged()
.switchMap((term: string) => this._projectService.searchForProjectsObs(term, this.selectedFunderId));
public tries:number = 0 ;
public keywordlimit = 3;
constructor(private _service: ProjectService, private _projectService: SearchProjectsService, myElement: ElementRef) {
this.elementRef = myElement;
}
search() {
console.info("heeere "+this.query );
this.infoMessage = "";
// this.filtered = [];
if(this.query == ""){
this.tries = 0;
this.warningMessage = "";
} else if(this.query && this.query.length < this.keywordlimit){
this.tries++;
if(this.tries == this.keywordlimit -1 ){
this.warningMessage = "Type at least " + this.keywordlimit + " characters";
this.tries = 0;
}
}else{
console.info("doo the search "+this.query );
this.tries = 0;
this.warningMessage = "";
this.searchTermStream.next(this.query);
}
}
select(item){
this.query = "";
this.searchTermStream.next(this.query); //clear
item = item.value;
var project: ClaimProject = { funderId: this.selectedFunderId,funderName: this.selectedFunderName, projectId: item.id, projectName: item.projectName , projectAcronym: item.projectAcronym, startDate: item.startDate, endDate: item.endDate };
console.log(item);
// this._service.getProjectDates(project.projectId).subscribe(
// data => {
// project.startDate = data.startDate;
// project.endDate = data.endDate;
// },
// err => console.log(err)
// );
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);
UIkit.notify({
message : 'A project "'+item.projectName+'" is selected.',
status : 'info',
timeout : 1000,
pos : 'top-center'
});
}else{
UIkit.notify({
message : 'The project is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
showItem(item):string{
return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value'];
}
remove(item){
var index:number =this.selectedProjects.indexOf(item);
if (index > -1) {
this.selectedProjects.splice(index, 1);
}
}
handleClick(event){
var clickedComponent = event.target;
var inside = false;
do {
if (clickedComponent === this.elementRef.nativeElement) {
inside = true;
}
clickedComponent = clickedComponent.parentNode;
} while (clickedComponent);
}
getFunders () {
console.info("Getting Funders....");
this._projectService.getFunders().subscribe(
data => {
this.funders = data[1];
},
err => console.log(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 );
}
}

View File

@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {ClaimProjectsComponent} from './claimProject.component';
import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {ProjectServiceModule} from '../../landingPages/project/projectService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
@NgModule({
imports: [
SharedModule, CommonModule, LoadingModalModule, ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule
],
providers:[
],
declarations: [
ClaimProjectsComponent
],
exports: [ClaimProjectsComponent ]
})
export class ClaimProjectModule { }

View File

@ -0,0 +1,121 @@
<div class="uk-margin-top">
<ul class="uk-tab" data-uk-switcher="{connect:'#claimsearchtabs'}">
<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>
<ul id="claimsearchtabs" class="uk-switcher">
<li id="crossref" >
<div class="uk-margin-top" >
<div *ngIf="crossrefStatus == errorCodes.LOADING" class="uk-alert uk-alert-info" role="alert">Loading...</div>
<div *ngIf="crossrefStatus != errorCodes.LOADING && crossrefResults.length == 0" class="uk-alert uk-alert-info" role="alert">No Results found</div>
<div *ngIf="crossrefStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''">
<div >
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
<span *ngIf="!item.URL" >{{item.title}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')"><i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>
</div>
<span *ngIf="item.publisher" class="uk-article-meta">Publisher: {{item.publisher}}</span><span class="uk-article-meta" *ngIf="(item['published-print'] && item['published-print']['date-parts'] && item['published-print']['date-parts'][0])">({{(item['published-print']['date-parts'][0][0])?item['published-print']['date-parts'][0][0]:item['published-print']['date-parts'][0]}})</span>
<div *ngIf="item.author" class="uk-article-meta">Authors: <span *ngFor="let author of item.author let i = index">{{author.family}} {{author.given}}{{(i < (item.author.length-1))?"; ":""}}</span></div>
<div *ngIf="item.editor" class="uk-article-meta">Editors: <span *ngFor="let author of item.editor let i = index">{{author.family}} {{author.given}}{{(i < (item.editor.length-1))?"; ":""}}</span></div>
</li>
</ul>
</div>
</div>
</li>
<li id="openaire" >
<div class = "uk-margin-top">
<div *ngIf="openaireStatus == errorCodes.LOADING" class="uk-alert uk-alert-info" role="alert">Loading...</div>
<div *ngIf="openaireStatus == errorCodes.NONE" class="uk-alert uk-alert-info" role="alert">No Results found</div>
<div *ngIf="openaireStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="openaireStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="openaireResultsNum != null && openaireResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="openairePage" [totalResults]="openaireResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openairePageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="openaireResults.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let result of openaireResults " [class]="(isSelected(result.id))?'uk-block-muted':''">
<div >
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
<button *ngIf="!isSelected(result.id)" (click)="add(result, result.id, 'openaire', 'publication', result['title'].url, result['title'].name, result.year,result['title'].accessMode)" class="uk-button uk-align-right"><i aria-hidden="true" class= "uk-icon-plus clickable"></i></button>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span class="uk-article-meta" *ngIf="(result.year)">({{result.year}})</span>
<div *ngIf="result.authors" class="uk-article-meta">Authors: <span *ngFor="let author of result.authors let i = index">{{author.name}}{{(i < (result.authors.length-1))?"; ":""}}</span></div>
</li>
</ul>
</div>
</div>
</li>
<li id="orcid" class="tab-pane fade">
<div class="uk-margin-top" >
<div *ngIf="orcidStatus == errorCodes.LOADING" class="uk-alert uk-alert-info" role="alert">Loading...</div>
<div *ngIf="orcidStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="orcidStatus == errorCodes.NONE && (!authorIds ||authorIds.length == 0)" class = "uk-alert uk-alert-info " > No results found </div>
<div *ngIf="orcidResultsNum != null" class="panel-body">
<div class = "uk-alert uk-alert-warning " > Not the right author? Choose one of these:
<span class="dropdown">
<!--button class=" uk-button 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-->
<select [(ngModel)]="authorId" name="select_author" >authorIds
<option *ngFor=" let item of authorIds let i = index" [value]="authorIds[i]" (click)="getOrcidResultsById(i)" >{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option>
</select>
</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 )) " class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list uk-list-line">
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['put-code']))?'uk-block-muted':''">
<div>
<span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
<button class="uk-button uk-align-right" *ngIf="!isSelected(authorId+item['put-code'])" (click)="add(item,authorId+'-'+item['put-code'],'orcid', 'publication', '', item['work-title']['title'].value, item['publication-date']?item['publication-date'].year.value :null,'OPEN')"><i aria-hidden="true" class= " uk-icon-plus clickable"></i></button>
</div>
<span *ngIf="item['journal-title'] && item['journal-title'].value " class="uk-article-meta">Journal: {{item['journal-title'].value}}</span><span class="uk-article-meta" *ngIf="(item['publication-date']&&item['publication-date'].year&&item['publication-date'].year.value)"> ({{item['publication-date'].year.value}})</span>
<div *ngIf="item.contributors" class="uk-article-meta">Authors: <span *ngFor="let author of item.contributors let i = index">{{author}}{{(i < (item.contributors.length-1))?"; ":""}}</span></div>
</li>
</ul>
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-info " > No results found </div>
</div>
</div>
</div>
</li>
</ul>
</div>

View File

@ -0,0 +1,401 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {SearchCrossrefService} from '../claim-utils/service/searchCrossref.service';
import {SearchOrcidService} from '../claim-utils/service/searchOrcid.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {ClaimResult} from '../claim-utils/claimEntities.class';
import{DOI} from '../../utils/string-utils.class';
@Component({
selector: 'claim-publication',
templateUrl: 'claimPublication.component.html',
})
export class ClaimPublicationComponent {
constructor (private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
private route: ActivatedRoute) {
var myDate = new Date();
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate = (myDate.getFullYear()+100)+ "-01-01" ;
}
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
if(this.keyword !=null && this.keyword.length > 0){
this.search(this.keyword);
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
@Input() public keyword:string = "";
@Input() public select:boolean = true ;
@Input() public selectedPublications = [] ;
@Output() publicationsChange = new EventEmitter();
sub: any;
size:number = 10;
source: string = "crossref";
type : string = "publication";
errorCodes:ErrorCodes = new ErrorCodes();
crossrefResults=[];
crossrefResultsNum : number = null;
crossrefPage : number = 1;
crossrefStatus:number = this.errorCodes.NONE;
openaireResults = [];
openaireResultsNum: number ;
openairePage : number = 1;
openaireStatus:number = this.errorCodes.NONE;
orcidResults: string[];
orcidResultsNum: number ;
totalPages: number;
orcidResultsToShow: string[];
orcidPage : number = 1;
orcidStatus:number = this.errorCodes.NONE;
authorId: string;
authorGivenName: string;
authorFamilyName: string;
authorIds: string[];
authorGivenNames: string[];
authorFamilyNames: string[];
authorsNum : number ;
public warningMessage = "";
public infoMessage = "";
todayDate = '';
nextDate = '';
private DOIs:string[] = [];
public search(term: string){
this.warningMessage = "";
this.infoMessage = "";
this.DOIs = DOI.getDOIsFromString(term);
this.getCrossrefResults(term, this.size,1);
this.searchOrcid(term);
this.searchOpenaire(term, this.size, 1);
}
private getCrossrefResults (term: string, size : number, page : number) {
this.crossrefStatus = this.errorCodes.LOADING;
if( this.DOIs.length > 0 ){
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
if(data.items == 0){
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
}else{
this.crossrefStatus = this.errorCodes.ERROR;
}
},
err =>{
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}else{
this.crossrefStatus = this.errorCodes.DONE;
}
}
},
err => {
//console.log(err);
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
},
err => {
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}
);
}else{
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
}else{
this.crossrefStatus = this.errorCodes.ERROR;
}
},
err => {
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}
}
private searchOpenaire(term: string, size : number, page : number) {
if(this.DOIs.length > 0 ){
this.openaireStatus = this.errorCodes.LOADING;
this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePage=page;
this.openaireResultsNum = data[0];
this.openaireResults = data[1];
this.openaireStatus = this.errorCodes.DONE;
if(this.openaireResultsNum == 0){
this.openaireStatus = this.errorCodes.NONE;
}
}else {
this.openaireStatus = this.errorCodes.ERROR;
}
},
err => {
this.openaireStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}else{
this.openaireStatus = this.errorCodes.LOADING;
this._searchPublicationsService.searchPublications('q="'+term+'"', null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePage=page;
this.openaireResultsNum = data[0];
this.openaireResults = data[1];
this.openaireStatus = this.errorCodes.DONE;
if(this.openaireResultsNum == 0){
this.openaireStatus = this.errorCodes.NONE;
}
}else {
this.openaireStatus = this.errorCodes.ERROR;
}
},
err => {
this.openaireStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
}
private searchOrcid (term: string) {
if(this.DOIs.length > 0){
this.orcidStatus = this.errorCodes.NONE;
return;
}
this.orcidStatus = this.errorCodes.LOADING;
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;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthor(term, this.authorIds,
this.authorGivenNames, this.authorFamilyNames).subscribe(
data => {
if(data != null && data == true) {
this.getOrcidResultsById(0);
}
this.orcidStatus = this.errorCodes.NONE;
},
err => this.errorHandler(err, term)
);
}
private errorHandler(err: any, term: string) {
if(err.status == 404){
this.getOrcidAuthors(term);
} else {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
}
}
private getOrcidAuthors (term: string) {
this.orcidResultsNum = null;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthors(term, this.authorIds,
this.authorGivenNames, this.authorFamilyNames).subscribe(
data => {
if(data != null && data == true) {
this.getOrcidResultsById(0);
}else{
this.orcidStatus = this.errorCodes.ERROR;
}
},
err => {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
private getOrcidResultsById (index:number) {
if(this.authorIds.length > index) {
this.orcidStatus = this.errorCodes.LOADING;
let id = this.authorIds[index];
this.authorGivenName = this.authorGivenNames[index];
this.authorFamilyName = this.authorFamilyNames[index];
this.authorId = id;
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.orcidPage = 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);
this.orcidStatus = this.errorCodes.DONE;
if(this.orcidResultsNum == 0){
this.orcidStatus = this.errorCodes.NONE;
}
} else {
this.orcidResultsNum = 0;
this.totalPages=0;
this.orcidStatus = this.errorCodes.NONE;
}
},
err => {
console.log(err.status);
this.orcidStatus = this.errorCodes.ERROR;
}
);
}
}
private add(item, id, itemSource, itemType, itemUrl, itemTitle, date, accessMode){
var result: ClaimResult ;
if(itemSource == 'crossref'){
date = (date == null) ? null : date.substring(0,10);
result = {id: id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date};
}else if (itemSource == 'orcid'){
date = (date == null) ? null : date + "-01.-01"
result = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date};
}else if (itemSource == 'openaire'){
//TODO put right access rights
result = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: null, date};
}
console.info("Added result:"+result.date);
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 crossrefPageChange($event) {
this.crossrefPage=$event.value;
this.crossrefResults=[];
console.log("Crossref chaenged "+this.crossrefPage);
this.getCrossrefResults(this.keyword,this.size,this.crossrefPage);
}
private orcidPageChange($event) {
this.orcidPage=$event.value;
this.orcidResultsToShow=[];
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
}
private openairePageChange($event) {
this.openairePage=$event.value;
this.searchOpenaire(this.keyword,this.size,this.openairePage);
}
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;
}
}

View File

@ -0,0 +1,107 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {ClaimPublicationComponent} from './claimPublication.component';
import {ClaimDatasetComponent} from './claimDataset.component';
@Component({
selector: 'claim-result',
template: `
<div class="panel">
<div class="">
<form class="uk-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">
<label><input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication</label>
<label><input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset</label>
</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" name="keyword"/>
<span class="input-group-btn">
<button (click)="search()" type="submit" class="uk-button">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>
`,
})
export class ClaimResultComponent {
constructor () {
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);
}
}
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
});
}
}

View File

@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {ClaimPublicationComponent} from './claimPublication.component';
import {ClaimDatasetComponent} from './claimDataset.component';
import {ClaimResultComponent} from './claimResult.component';
import {SearchDataciteService} from './service/searchDatacite.service';
import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module';
import {SearchOrcidService} from './service/searchOrcid.service';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {PagingModule } from '../../utils/paging.module';
@NgModule({
imports: [
SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule
],
providers:[
SearchDataciteService, SearchOrcidService
],
declarations: [
ClaimPublicationComponent, ClaimDatasetComponent, ClaimResultComponent
],
exports: [ClaimResultComponent ]
})
export class ClaimResultModule { }

View File

@ -0,0 +1,88 @@
<form class="uk-form">
<div class="uk-form-row">
<span class="uk-text-bold">Filter By:</span>
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" name="claims-keyword" ></div>
<div class="uk-form-row">
<label> <input [(ngModel)]="projectCB" type="checkbox" (ngModelChange)="changeType()" name="project" /> Project </label>
<label> <input [(ngModel)]="publicationCB" type="checkbox" (ngModelChange)="changeType()" name="publication" /> Publication </label>
<label> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" name="dataset" /> Dataset </label>
<label> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" name="context" /> Context </label>
</div>
</form>
<div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin="">
<div *ngIf="resultsNum" class="uk-float-right">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [params]="getParameters()" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div *ngIf="resultsNum>0" class="">
<span > Show
<select *ngIf="resultsNum>10" [(ngModel)]="size" name="select_size" >
<option *ngFor="let size of sizes" [value]="size">{{size}}</option>
</select>
</span>
<span >Showing {{(size*page - size +1)}} to {{(size*page>resultsNum)?resultsNum:(size*page)}} of {{resultsNum}} claims </span>
</div>
</div>
<div *ngIf="showErrorMessage " class = "uk-alert uk-alert-danger " >
An Error occured.
</div>
<!-- Buttons for selecting and Delete Claims -->
<div *ngIf="enableDelete">
<div *ngIf="selected.length>0 && resultsNum > 0 ">
<div class = "uk-alert uk-alert-info " >
You have selected {{selected.length}} claim(s)
</div>
</div>
<div *ngIf="deleteMessage.length>0 " [innerHTML]="deleteMessage">
</div>
<button class="uk-button" (click)="selectAll()">Select All</button> <button class="uk-button" (click)="deselectAll()">Deselect All</button> <button class="uk-button" (click)="confirmOpen()">Delete</button>
</div>
<br>
<div *ngIf=" claims && claims.length == 0" >
<div class = "uk-alert uk-alert-info " >No entries found.</div>
</div>
<div class="">
<table *ngIf="claims && claims.length > 0" class="uk-table uk-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]="isSelected(claim.id)"/></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>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
<modal-loading [message]= "'Please wait...'"></modal-loading>

View File

@ -0,0 +1,491 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {ClaimsService} from '../service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
@Component({
selector: 'displayClaims',
templateUrl: 'displayClaims.component.html',
providers:[ ClaimsService]
})
export class DisplayClaimsComponent {
constructor (private _claimService: ClaimsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
if( this.myClaims == 'true' ){
this.fetchBy = "User";
}else{
this.fetchBy = params['fetchBy'];
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
this.fetchId = params['fetchId'];
this.fetchId=this.fetchId?this.fetchId:'';
}
let page = (params['page']=== undefined)?1:+params['page'];
let size = (params['size']=== undefined)?10:+params['size'];
this.keyword = (params['keyword']?params['keyword']:"");
this.inputkeyword = this.keyword;
this.page = ( page <= 0 ) ? 1 : page;
this.size = ( size <= 0 ) ? 10 : size;
this.entityTypes = []//(params['types']?params['types']:[]);
this.setTypes(params['types']); // check the appropriate checkboxes
this.setSortby(params['sort']);
this.getClaims();
});
// this.sub = this.route.params.subscribe(params => {
// 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 = params['fetchBy'];
// this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
// this.fetchId = params['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 = (params['page']=== undefined)?1:+params['page'];
// let size = (params['size']=== undefined)?10:+params['size'];
//
// this.keyword = (params['keyword']?params['keyword']:"");
// this.inputkeyword = this.keyword;
// this.page = ( page <= 0 ) ? 1 : page;
// this.size = ( size <= 0 ) ? 10 : size;
// this.entityTypes = []//(params['types']?params['types']:[]);
// this.setTypes(params['types']); // check the appropriate checkboxes
// this.setSortby(params['sort']);
// this.getClaims();
// console.info("params: "+params['page']+" page "+page +" this.page: "+this.page );
// });
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
//string because comes as input from component directive
@Input() enableDelete: string = 'false';
@Input() myClaims: string= 'false' ;
@Input() isAdmin:string = 'false';
page : number;
size:number;
sizes = [10,20,30,50];
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 (ModalLoading) loading : ModalLoading ;
//checkboxes:
publicationCB = false;
datasetCB = false;
contextCB = false;
projectCB = false;
entityTypes : string[] =[] ;
descending = true;
sortby = "date";
selected=[];
deleteMessage:string = "";
showErrorMessage:boolean = false;
//params for pagingFormatter to use when navigate to page
params;
@ViewChild(AlertModal) alert;
claimsDeleted:number = 0;
getClaims () {
this.selected=[];
var types = '';
this.showErrorMessage = false;
for (var type of this.entityTypes){
types+=(types.length>0?'&':'')+"types="+type;
}
if(this.fetchBy =="Project" ){
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
console.log(err);
this.showErrorMessage = true;
}
);
}else if(this.fetchBy =="User"){
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
console.log(err);
this.showErrorMessage = true;
}
);
}else if(this.fetchBy =="Result"){
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
console.log(err);
this.showErrorMessage = true;
}
);
}else if(this.fetchBy =="Context"){
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= null;
this.resultsNum= data.total;//data.length; //TODO get the total results num
},
err => {
console.log(err);
this.showErrorMessage = true;
}
);
}else{
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum = null;
this.resultsNum= data.total;//data.length; //TODO get the total results num
},
err => {
console.log(err);
this.showErrorMessage = true;
}
);
}
}
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();
}
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);
var types="";
for (var type of this.entityTypes){
types+=(types.length>0?',':'')+type;
}
params+=(types.length>0)?"types="+types:"";
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;
}
changeSize(size: number ){
this.size = size;
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(){
this.entityTypes = [];
if(this.publicationCB){
this.entityTypes.push('publication');
}
if(this.datasetCB){
this.entityTypes.push('dataset');
}
if(this.projectCB){
this.entityTypes.push('project');
}
if(this.contextCB){
this.entityTypes.push('context');
}
// 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(types:string){
if(!types){
return;
}
if(types.length > 0){
this.entityTypes = [];
if(types.indexOf("publication")!=-1){
this.publicationCB = true;
this.entityTypes.push("publication");
}
if(types.indexOf("dataset")!=-1){
this.datasetCB = true;
this.entityTypes.push("dataset");
}
if(types.indexOf("project")!=-1){
this.projectCB = true;
this.entityTypes.push("project");
}
if(types.indexOf("context")!=-1){
this.contextCB = true;
this.entityTypes.push("context");
}
}
if(this.publicationCB && this.datasetCB && this.contextCB && this.projectCB){
this.entityTypes=[];
}
}
changekeyword(){
if(this.inputkeyword.length >= 3 || this.inputkeyword.length == 0 ){
this.keyword = this.inputkeyword;
this.page = 1;
this.goTo();
}
}
select(item:any,event){
this.deleteMessage="";
var value = event.currentTarget.checked;
if(value){
this.selected.push(item);
}else{
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == item.id){
this.selected.splice(_i, 1);
}
}
}
}
selectAll(){
this.selected = [];
for (var _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
this.selected.push(claim);
}
this.deleteMessage = "";
}
deselectAll(){
this.selected = [];
this.deleteMessage="";
}
isSelected(id:string){
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == id){
return true;
}
}
return false;
}
confirmOpen(){
if(this.selected.length <= 0){
}else{
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.deleteMessage="";
this.loading.open();
this.claimsDeleted = 0;
var ids = [];
for (var i = 0; i < this.selected.length; i++){
var id =this.selected[i].id;
ids.push(id);
// var selected =this.selected[i].id;
// console.warn("Deleting claim with id:"+id);
// this.deleteById(id);
//TODO for multiple concurrent
}
this.batchDeleteById(ids);
}
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.resultsNum = this.resultsNum - this.selected.length;
this.loading.close();
this.selected = [];
}
});
}
batchDeleteById(ids:string[]){
console.warn("Deleting claim with ids:"+ids);
this._claimService.deleteBulk(ids).subscribe(
res => {
console.info('Delete response'+res.code );
console.warn("Deleted ids:"+ res.deletedIds);
console.warn("Not found ids:"+ res.notFoundIds);
//remove this claim from the
let newClaims=this.claims;
for(var id of res.deletedIds){
for (var _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
if(claim['id'] == id){
newClaims.splice(_i, 1);
}
}
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == id){
this.selected.splice(_i, 1);
}
}
}
this.claims = newClaims;
this.resultsNum = this.resultsNum - res.deletedIds.length;
this.loading.close();
if(res.deletedIds.length>0){
this.deleteMessage=this.deleteMessage+'<div class = "alert alert-success " >'+res.deletedIds.length+' claim(s) successfully deleted.</div>';
}
if(res.notFoundIds.length>0){
this.deleteMessage=this.deleteMessage+'<div class = "alert alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
}
});
}
pageChange($event) {
var page:number = +$event.value
this.goTo(page);
}
}

View File

@ -0,0 +1,28 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ClaimServiceModule} from '../service/claimsService.module';
import {DisplayClaimsComponent} from './displayClaims.component';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import {ClaimEntityFormatterModule} from '../entityFormatter/claimEntityFormatter.module';
import {PagingModule } from '../../../utils/paging.module';
// import { Claim } from '../claim';
//helpers
@NgModule({
imports: [
CommonModule, FormsModule, ClaimServiceModule, LoadingModalModule, AlertModalModule,
ClaimEntityFormatterModule, PagingModule
],
declarations: [
DisplayClaimsComponent
],
providers: [ ],
exports: [
DisplayClaimsComponent
]
})
export class DisplayClaimsModule { }

View File

@ -0,0 +1,36 @@
import {Component, Input} from '@angular/core';
//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>{{entity.title}}</h5>
</div>
`
})
export class ClaimEntityFormatter {
@Input() entity: string[];
@Input() type: string;
constructor () {}
ngOnInit() {
}
}

View File

@ -0,0 +1,23 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ProjectTitleFormatter} from './projectTitleFormatter.component';
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
import {ClaimEntityFormatter} from './claimEntityFormatter.component';
@NgModule({
imports: [
CommonModule
],
declarations: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
],
providers: [ ],
exports: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
]
})
export class ClaimEntityFormatterModule { }

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
//Usage Example "<project-title [project]="X" > </project-title>"

View File

@ -0,0 +1,140 @@
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 '../claim';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class ClaimsService {
private baseUrl;
constructor(private jsonp: Jsonp, private http: Http, public _cache: CacheService) {
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
}
private getClaimRequest(size : number, page : number, url :string):any {
console.info('ClaimsService: Claims request: '+url);
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
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)
.do(res => {
this._cache.set(key, res);
});
}
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;
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;
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;
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;
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;
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;
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);
}
deleteBulk(claimIds:string[]):any{
console.warn('Trying to delete claims with ids : '+claimIds);
var url = "";
for(var claimId of claimIds){
url=url+(url.length >0 ?"&":"")+"claimId="+claimId;
}
url= this.baseUrl +"claims/bulk?"+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);
}
insertBulkClaims(claims):any{
console.warn('Trying toinsert claims : '+claims);
let url = this.baseUrl +"claims/bulk";
let body = JSON.stringify( claims );
console.warn('Json body: : '+body);
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);
}
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.log(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);
}
)
;
});
}
}

View File

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

View File

@ -0,0 +1,88 @@
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 '../claim';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import {AutoCompleteValue} from '../../../searchPages/searchUtils/searchHelperClasses.class';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class ContextsService {
private baseUrl;
constructor(private http: Http, public _cache: CacheService) {
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
}
public getCommunities():any {
let url = this.baseUrl + 'communities';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
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)
.do(res => {
this._cache.set(key, res);
});
}
public getCategories(communityId :string):any {
console.info('ContextsService: request categories for community with id '+communityId);
let url= this.baseUrl + 'communities/' + communityId + '/categories';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().data)
// .do(request => console.info("Get claims: offset = " ))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
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";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().data)
.map(res => this.parse(res.concept))
// .do(res => console.info(res ))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
parse (data: any):AutoCompleteValue[] {
var array:AutoCompleteValue[] =[]
for(var i = 0; i < data.length; i++){
var value:AutoCompleteValue = new AutoCompleteValue();
value.id = data[i].id;
value.label = data[i].label;
array.push(value);
}
return array;
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

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

View File

@ -1,11 +1,11 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchCrossrefService {
constructor( private http: Http, public _cache: CacheService) {}

View File

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

View File

@ -1,11 +1,11 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchDataciteService {
constructor(private http: Http, public _cache: CacheService) {}

View File

@ -3,15 +3,16 @@ import {URLSearchParams} from '@angular/http';
import {Http, Response} from '@angular/http';
import { Headers, RequestOptions } from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchOrcidService {
constructor( private http: Http, public _cache: CacheService) {}
searchOrcidAuthor (term: string, authorIds: string[],
authorGivenNames: string[], authorFamilyNames: string[]):any {
console.info("In searchOrcidAuthor: "+term);

View File

@ -0,0 +1,68 @@
// import { NgModule} from '@angular/core';
// import { CommonModule } from '@angular/common';
// import { FormsModule } from '@angular/forms';
// //
// import {UtilsModule} from '../utils/utils.module';
// import {ServicesModule} from '../services/services.module';
//
// import { ClaimsService} from '../services/claims.service';
// //main
// import {ClaimComponent} from './claim/claim.component';
// import {ClaimsAdminComponent} from './claims/claimsAdmin.component';
// import {MyClaimsComponent} from './myClaims/myClaims.component';
// import {LinkingHomeComponent} from './linking/linkingHome.component';
// import {LinkingComponent} from './linking/linking.component';
// import { BulkLinkingComponent } from './linking/bulkLinking.component';
//
// import {BulkClaimComponent} from './linking/bulkClaim/bulkClaim.component';
// import {ClaimsComponent} from './claim-utils/claims.component';
//
// import {ClaimContextComponent} from './claim-utils/claimContext.component';
// import {ClaimProjectsComponent} from './claim-utils/claimProject.component';
// import {ClaimResultComponent} from './claim-utils/claimResult.component';
// import {ClaimPublicationComponent} from './claim-utils/claimPublication.component';
// import {ClaimDatasetComponent} from './claim-utils/claimDataset.component';
//
// import {ClaimInsertComponent} from './linking/insertClaim/insertClaim.component';
//
// import {ClaimSelectedContextsComponent} from './linking/selected/selectedContexts.component';
// import {ClaimSelectedComponent} from './linking/selected/selected.component';
// import {ClaimSelectedDatasetsComponent} from './linking/selected/selectedDatasets.component';
// import {ClaimSelectedResultsComponent} from './linking/selected/selectedResults.component';
// import {ClaimSelectedProjectsComponent} from './linking/selected/selectedProjects.component';
// import {ClaimSelectedPublicationsComponent} from './linking/selected/selectedPublications.component';
//
// import {LinkingGenericComponent} from './linking/linkingGeneric.component';
//
// import {InlineClaimContextComponent} from './inlineClaims/inlineClaimContext.component';
// import {InlineClaimProjectComponent} from './inlineClaims/inlineClaimProject.component';
// import {InlineClaimResultComponent} from './inlineClaims/inlineClaimResult.component';
// import {ClaimEntityFormatter} from '../utils/claimEntityFormatter.component';
//
// import { Claim } from '../utils/entities/claim';
// //helpers
//
// import { ClaimRoutingModule } from './claim-routing.module';
// @NgModule({
// imports: [
// CommonModule, FormsModule,
// UtilsModule,
// ServicesModule,
// ClaimRoutingModule
//
// ],
// declarations: [
// ClaimsAdminComponent, MyClaimsComponent, ClaimComponent, ClaimsComponent,
// BulkLinkingComponent, LinkingComponent, LinkingHomeComponent, LinkingGenericComponent,
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent, ClaimSelectedComponent,
// ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent,
// ClaimResultComponent, ClaimSelectedPublicationsComponent, ClaimSelectedDatasetsComponent, ClaimSelectedResultsComponent, ClaimPublicationComponent,
// ClaimDatasetComponent, BulkClaimComponent,
// ClaimEntityFormatter
// ],
// providers: [ ClaimsService ],
// exports: [
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent
// ]
// })
// export class ClaimModule { }

View File

@ -0,0 +1,10 @@
<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>

View File

@ -0,0 +1,43 @@
import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {ClaimsService} from '../../services/claims.service';
// import {Claim} from '../../utils/entities/claim';
@Component({
selector: 'claim',
templateUrl: 'claim.component.html',
})
export class ClaimComponent {
constructor (private _claimService: ClaimsService,
private route: ActivatedRoute, private _router:Router) {}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
this.id = params['id'];
console.info("Claim id:"+this.id +" " +params['id']);
if(this.id!=null){
this.getClaim(this.id);
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
id : string;
claim : any;
getClaim (id: string) {
this._claimService.getClaim(id)
.then(data => {
this.claim = data;
console.log(data);
}) ;
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ClaimsAdminComponent } from './claimsAdmin.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ClaimsAdminComponent},
])
]
})
export class ClaimsAdminRoutingModule { }

View File

@ -0,0 +1,36 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'claims-admin',
template: `
<div *ngIf="user" class="container">
<div class="page-header">
<h1> Claims Administrator </h1>
</div>
<div>
<div class="uk-text-right"><a routerLink="/linking">Add more Links?</a></div>
<displayClaims enableDelete="false" myClaims="false" isAdim="true"></displayClaims>
</div>
</div>
<div *ngIf="!user" class="container">
TODO login
</div>
`,
})
export class ClaimsAdminComponent {
constructor ( ) {
}
user:string="argirok@di.uoa.gr";
ngOnInit() {
}
}

View File

@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { ClaimsAdminComponent } from './claimsAdmin.component';
import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
@NgModule({
imports: [
SharedModule,
ClaimsAdminRoutingModule,
// ClaimServiceModule,
DisplayClaimsModule
],
declarations: [
ClaimsAdminComponent
]
})
export class ClaimsAdminModule { }

View File

@ -0,0 +1,94 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
@Component({
selector: 'inline-claim-context',
template: `
<div *ngIf="showComp" 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]="contexts"
(showChange)="showChange($event)" inline=true [hideType]="inlineType" > </claim-selected-contexts>
</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>
`
})
export class InlineClaimContextComponent {
constructor ( ) {
}
@Input() public inlineEntity:any;
@Input() public inlineType:string;
contexts=[];
publications;
datasets;
public show = 'context';
public showComp:boolean = false;
public enableButton:boolean=true;
public keyword: string = "";
@Output() contextAdded = new EventEmitter();
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
ngOnInit() {
}
showChange($event) {
this.show=$event.value;
if(this.show == "end"){
//TODO
this.contextAdded.emit({
value: this.contexts
});
this.contexts = [];
this.showComponent();
}else if(this.show == "error"){
this.showComponent();
}
}
public toggle(){
if(!this.showComp){
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);
this.publications = [];
this.publications.push(this.inlineEntity);
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;
if (!this.claimInsert.validateInsertions()){
this.enableButton = true;
}
}
private cancel(){
this.contexts = [];
this.hideComponent();
}
}

View File

@ -0,0 +1,107 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
@Component({
selector: 'inline-claim-project',
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]="projects"
(showChange)="showChange($event)" inline=true [hideType]="inlineType" > </claim-selected-projects>
</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>
`
})
export class InlineClaimProjectComponent {
constructor () {
}
@Input() public inlineEntity:any;
@Input() public inlineType:string;
public projects=[];
public publications;
public datasets;
public show = 'project';
public showComp:boolean = false;
public enableButton:boolean=true;
public keyword: string = "";
@Output() projectAdded = new EventEmitter();
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
ngOnInit() {
}
showChange($event) {
this.show=$event.value;
if(this.show == "end"){
//TODO
this.projectAdded.emit({
value: this.projects
});
this.projects = [];
this.showComponent();
}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(){
if(this.inlineType === 'dataset'){
this.datasets = [];
this.datasets.push(this.inlineEntity);
this.claimInsert.datasets = [];
this.claimInsert.datasets.push(this.inlineEntity);
}else if(this.inlineType === 'publication'){
this.claimInsert.publications = [];
this.claimInsert.publications.push(this.inlineEntity);
this.publications = [];
this.publications.push(this.inlineEntity);
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;
if (!this.claimInsert.validateInsertions()){
this.enableButton = true;
}
}
private cancel(){
this.projects = [];
this.hideComponent();
}
}

View File

@ -0,0 +1,117 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
// import {ClaimResultComponent} from '../linking/claimResult/claimResult.component';
// import {ClaimSelectedResultsComponent} from '../linking/selected/selectedResults.component';
@Component({
selector: 'inline-claim-result',
template: `
<div *ngIf="showComp" class="panel-body well well-lg">
<div class="row" >
<claim-result [selectedDatasets]="datasets" [selectedPublications]="publications" (datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)" inline=true > </claim-result>
<!-- ClaimSelectedResultsComponent -->
<claim-selected-results [publications]="publications" [datasets]="datasets"
(datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)"
(showChange)="showChange($event)" inline=true [hideType]="hideType" [showAccessRights]=true > </claim-selected-results>
</div>
<claim-insert (showChange)="showChange($event)" inline=true [publications]="publications" [datasets]="datasets" showButton=false [inlineEntity]="inlineEntity" ></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>
`
})
export class InlineClaimResultComponent {
constructor () {
}
// This is the component from the landing page
@Input() public inlineEntity:any;
@Input() public inlineType:string;
public hideType:string;
public publications = [];
public datasets = [];
public show = 'project';
public showComp:boolean = false;
public enableButton:boolean=true;
public keyword: string = "";
@Output() datasetAdded = new EventEmitter();
@Output() publicationAdded = new EventEmitter();
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
ngOnInit() {
console.info("Inline entity:"+this.inlineEntity.id);
this.hideType = this.inlineType;
if(this.inlineType == 'dataset' || this.inlineType == 'publication' ){
this.hideType = "";
}
}
datasetsChange($event) {
this.datasets=$event.value;
console.log($event.value);
}
publicationsChange($event) {
this.publications=$event.value;
console.log($event.value);
}
showChange($event) {
this.show=$event.value;
if(this.show == "end"){
this.datasetAdded.emit({
value: this.datasets
});
this.publicationAdded.emit({
value: this.publications
});
this.datasets = [];
this.publications = [];
this.showComponent();
}else if(this.show == "error"){
this.showComponent();
}
}
public toggle(){
if(!this.showComp){
this.showComponent();
}else{
this.hideComponent();
}
}
private showComponent(){
this.showComp=true;
this.enableButton = true;
}
private hideComponent(){
this.showComp=false;
}
private insert(){
if(this.inlineType === 'project'){ //TODO check if neccessary
this.claimInsert.projects = [];
this.claimInsert.projects.push(this.inlineEntity);
}
this.enableButton = false;
if (!this.claimInsert.validateInsertions()){
this.enableButton = true;
}
}
private cancel(){
this.datasets = [];
this.publications = [];
this.hideComponent();
}
}

View File

@ -0,0 +1,206 @@
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {Dates, DOI} from '../../../utils/string-utils.class';
@Component({
selector: 'bulk-claim',
template: `
<form class="form-inline">
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input id="exampleInputFile" type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
</div>
<div class="form-group">
<button class="btn btn-success" [class.disabled]="!enableUpload" type="button" (click)="upload()">Upload</button>
</div>
</form>
<div class="help-block">Upload a csv file containing DOIs. For each DOI found in file, metadata will be fetched from CrossRef.
Available results can be linked with the selected Projects and Contexts.
<a (click)="showInfo = !showInfo"> More information</a>
<div *ngIf = "showInfo">
CSV format:
<ul>
<li>The format of CSV file should be "DOI","ACCESS_MODE","DATE".</li>
<li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</li>
<li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li>
<li>In case access mode is not available default value is "OPEN".</li>
</ul>
</div>
</div>
<div *ngIf="showReport" class="alert alert-info" role="alert" >
<span>{{all}} rows found in file.</span>
<span>{{found}} results fetched from CrossRef.</span>
<span *ngIf ="duplicate > 0" [title] = "'Duplicate DOIs: '+ duplicateIds.join()">{{duplicate}} DOIs were duplicates.</span>
<span *ngIf = "notFound > 0" [title] = "'Not found DOIs: '+ notFoundIds.join()" >{{notFound}} DOIs not found in crossref. ({{notFoundIds.join()}}) </span>
<span *ngIf = "all == 0 || found == 0" > Please make sure you are using the right format for he csv file... </span>
</div>
<div *ngIf="errorMessage.length > 0 " class="alert alert-danger" role="alert">{{errorMessage}}</div>
<modal-loading [message]= "'Please wait...'"></modal-loading>
`
})
//[(ngModel)]="date"
export class BulkClaimComponent {
filesToUpload: Array<File>;
navigateTo: string = "Search";
source: string = "crossref";
type : string = "publication";
resultsFromSearch:number;
@Input() public select:boolean = true ;
@Input() public publications;
all:number = 0;
allIds:string[] = [];
found:number = 0;
foundIds:string[] = [];
duplicate:number = 0;
duplicateIds:string[] = [];
notFound:number = 0;
notFoundIds:string[] = [];
showReport:boolean = false;
showInfo :boolean = false;
@ViewChild (ModalLoading) loading : ModalLoading ;
errorMessage = "";
infoMEssage = "";
enableUpload:boolean = true;
constructor(private _searchCrossrefService: SearchCrossrefService) {
this.filesToUpload = [];
}
ngOnInit() {}
upload() {
this.enableUpload = false;
this.showReport = false;
this.errorMessage = "";
if(this.filesToUpload.length == 0){
this.errorMessage = "There is no selected file to upload.";
return ;
}
this.makeFileRequest("http://localhost:8000/upload", [], this.filesToUpload).then((result) => {
var rows = (result as any).split('\n'); // I have used space, you can use any thing.
var i = 0;
this.all = 0;
this.duplicate = 0;
this.duplicateIds = [];
this.allIds = [];
this.found = 0;
this.foundIds = [];
this.publications.slice(0,this.publications.length);
this.notFound = 0;
this.notFoundIds = [];
for(i=0;i<rows.length;i++){
if(rows[i] && rows[i] != null ){
var values = rows[i].split(',');
this.all++;
var id=this.removeDoubleQuotes(values[0]);
if(DOI.isValidDOI(id)){
var accessMode = (values[1] != undefined) ? this.removeDoubleQuotes(values[1]):"OPEN";
accessMode = (this.validateAccessMode(accessMode)?accessMode:"OPEN");
var embargoDate =(values[2] != undefined) ? this.removeDoubleQuotes(values[2]):Dates.getDateToday();
embargoDate = (Dates.isValidDate(embargoDate)?embargoDate:Dates.getDateToday());
if(this.allIds.indexOf(id)>-1){
this.duplicate++;
this.duplicateIds.push(id);
}else{
this.allIds.push(id);
this.fetchResult(id,accessMode,embargoDate);
}
}
}
}
}, (error) => {
this.enableUpload = true;
console.log(error);
// this.loading.close();
this.errorMessage = "An error occured while uploading...";
});
}
private removeDoubleQuotes(value){
if(value.indexOf('"')== 0){
value = value.substring(1,value.length);
}
var index =+value.indexOf('"');
if(index == (value.length - 1) || index == (value.length - 2) ){
value = value.substring(0,index);
}
return value;
}
private validateAccessMode(value){
var accessModes = ["OPEN", "CLOSED", "EMBARGO"];
if(accessModes.indexOf(value) > -1){
return true;
}
return false;
}
fileChangeEvent(fileInput: any){
this.filesToUpload = <Array<File>> fileInput.target.files;
}
makeFileRequest(url: string, params: Array<string>, files: Array<File>) {
return new Promise((resolve, reject) => {
var formData: any = new FormData();
var xhr = new XMLHttpRequest();
for(var i = 0; i < files.length; i++) {
formData.append("uploads[]", files[i], files[i].name);
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
}
}
xhr.open("POST", url, true);
xhr.send(formData);
});
}
fetchResult(id:string,accessMode:string,date:string){
this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe(
data => {
var crossrefResult = data.items[0];
if(data.items.length > 0){
this.found++;
this.foundIds.push(id);
var result = {id: id, type :'publication', source : 'crossref',
title: crossrefResult.title,url: crossrefResult.URL, result: crossrefResult, accessRights: accessMode, embargoEndDate: date, date : crossrefResult.created['date-time']};
this.publications.push(result);
}else{
this.notFound++;
this.notFoundIds.push(id);
}
this.endOfFetching();
},
err => {
console.log(err);
this.notFound++;
this.notFoundIds.push(id);
this.endOfFetching();
}
);
}
endOfFetching(){
if(this.all == this.found+this.notFound+ this.duplicate ){
this.showReport = true;
this.enableUpload = true;
}
}
}

View File

@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {BulkClaimComponent} from './bulkClaim.component';
import {SearchCrossrefServiceModule} from '../../claim-utils/service/searchCrossrefService.module';
@NgModule({
imports: [
SharedModule, LoadingModalModule, SearchCrossrefServiceModule
],
declarations: [
BulkClaimComponent
], exports:[ BulkClaimComponent]
})
export class BulkClaimModule { }

View File

@ -0,0 +1,16 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'bulk-linking',
//providers: [MdRadioDispatcher],
template: `
<linking-generic [bulkMode]=true> </linking-generic>
`
})
//[(ngModel)]="date"
export class BulkLinkingComponent {
constructor () {
}
}

View File

@ -0,0 +1,264 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Router} from '@angular/router';
import {ClaimsService} from '../../claim-utils/service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
@Component({
selector: 'claim-insert',
template: `
<div *ngIf="errorMessage.length > 0">
<div class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
</div>
<div *ngIf="warningMessage.length > 0">
<div class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
</div>
<modal-loading [message]= "'Please wait...'"></modal-loading>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
<button *ngIf="claiming == false && showButton == true" (click)="validateInsertions()" class="uk-button uk-button-primary uk-align-right" >Finish</button>
`
})
export class ClaimInsertComponent {
constructor (private claimService: ClaimsService, private _router:Router) {}
ngOnInit() {
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
}
@Input() public contexts;
@Input() public projects;
@Input() public publications;
@Input() public datasets;
@Input() public showButton:boolean = true;
@Input() show='claim';
@Input() inline: boolean = false; // link from landing page?
@Input() inlineEntity; // the entity from the landing page
@Output() showChange = new EventEmitter();
@ViewChild (ModalLoading) loading : ModalLoading ;
@ViewChild(AlertModal) alert;
public claiming =false;
public error = false;
public errorMessage = "";
public warningMessage = "";
public claimsTODO:number = 0;
public claims:number = 0;
public errorclaims:number = 0;
public validateInsertions(){
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
if(this.validate()){
if(this.validateDates()){
this.insert();
return true;
}
}
return
}
private insert(){
this.claiming = true;
var user="argirok@di.uoa.gr"
this.loading.open();
var claims = [];
if(this.publications){
console.info("publications: "+this.publications.length);
for (var i = 0; i < this.publications.length; i++) {
var result=this.publications[i];
if(this.contexts){
for (var j = 0; j < this.contexts.length; j++) {
var context = this.contexts[j];
var claim = this.createContextClaim(result, context, user);
claims.push(claim);
}
}
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
var projectClaim = this.createProjectClaim(result, project, user);
claims.push(projectClaim);
}
}
if(this.inline && this.inlineEntity){
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
claims.push(resultClaim);
}
}
}
if(this.datasets){
for (var i = 0; i < this.datasets.length; i++) {
var result=this.datasets[i];
if(this.contexts){
for (var j = 0; j < this.contexts.length; j++) {
var context = this.contexts[j];
var claim = this.createContextClaim(result, context, user);
claims.push(claim);
}
}
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
var projectClaim = this.createProjectClaim(result, project, user);
claims.push(projectClaim);
}
}
if(this.inline && this.inlineEntity){
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
claims.push(resultClaim);
}
}
}
console.info("try to insert "+claims.length+" claims");
this.claimService.insertBulkClaims(claims).subscribe(
data => {
var inserted = data.insertedIds.length;
var inserted = data.insertedIds.length;
this.afterclaimsInsertion(data.insertedIds,data.errorInClaims);
},
err => {
console.log(err);
this.errorsInClaimsInsertion(err.insertedIds,err.errorInClaims);
}
);
}
private validate(){
this.warningMessage = "";
this.errorMessage = "";
if(this.datasets && this.datasets.length == 0 && this.publications && this.publications.length == 0){
this.warningMessage = "There are no publications or datasets selected.";
}else if((!this.contexts|| this.contexts.length==0 )&&(!this.projects|| this.projects.length==0 )&& ( !this.inlineEntity)){
this.warningMessage = "There are no projects or concepts to link.";
// }else if (this.inline && !this.inlineEntity){
// this.errorMessage = "No inline entity";
// console.log(this.inline + " "+ this.inlineEntity);
}else{
return true;
}
return false;
}
private validateDates(){
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
console.info(project.startDate+" "+project.endDate + " "+project.projectAcronym);
if(this.publications){
for (var i = 0; i < this.publications.length; i++) {
var result = this.publications[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((project.startDate && result.date < project.startDate) || ( project.endDate && result.date > project.endDate) ){
this.confirmOpen();
return false;
}
}
}
}
if(this.datasets){
for (var i = 0; i < this.datasets.length; i++) {
var result = this.datasets[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((project.startDate && result.date < project.startDate) || ( project.endDate && result.date > project.endDate) ){
this.confirmOpen();
return false;
}
}
}
}
}
}
if(this.publications){
for (var i = 0; i < this.publications.length; i++) {
var result = this.publications[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((result.embargoEndDate && result.embargoEndDate != null) && result.date >result.embargoEndDate ){
this.confirmOpen();
return false;
}
}
}
}
if(this.datasets){
for (var i = 0; i < this.datasets.length; i++) {
var result = this.datasets[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((result.embargoEndDate && result.embargoEndDate != null) && result.date >result.embargoEndDate ){
this.confirmOpen();
return false;
}
}
}
}
return true;
}
private afterclaimsInsertion(insertedIds, errorInClaims){
this.loading.close();
if(errorInClaims.length == 0){
if(this.inline){
this.show = "end";
}else{
this._router.navigate( ['/myclaims'] );
}
this.showChange.emit({
value: this.show
});
}else{
this.errorsInClaimsInsertion(insertedIds, errorInClaims);
}
}
private errorsInClaimsInsertion(insertedIds, errorInClaims){
this.errorMessage = "An Error Occured.";
this.loading.close();
this.error = true;
if(this.inline){
this.show = "error";
this.showChange.emit({
value: this.show
});
}
}
private createContextClaim(result:any, context:any, user:any){
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 == null?"":result.embargoEndDate)};
return claim;
}
private createProjectClaim(result:any, project:any, user:any){
//project.projectId
// var dummyID = "dummyID";
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 == null?"":result.embargoEndDate)};
return claim;
}
private createResultClaim(inlineResult:any, result:any, user:any){
var claim = { claimedBy : user, sourceId : result.id, sourceType : result.type, sourceCollectedFrom: result.source, sourceAccessRights: result.accessRights, sourceEmbargoEndDate: result.embargoEndDate, targetId : inlineResult.id , targetType : inlineResult.type, targetCollectedFrom: inlineResult.source, targetAccessRights: inlineResult.accessRights, targetEmbargoEndDate: (inlineResult.embargoEndDate == null?"":inlineResult.embargoEndDate)};
return claim;
}
confirmOpen(){
this.alert.cancelButton = true;
this.alert.okButton = true;
this.alert.alertTitle = "Invalid dates";
this.alert.message = "There is a research result whose publication date is after project end date or before project start date. Or embargo end date of a research result is before research result's publication date.";
this.alert.okButtonText = "Procceed anyway";
this.alert.cancelButtonText = "Cancel";
this.alert.open();
}
confirmClose(data){
this.insert();
}
}

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {ClaimInsertComponent} from './insertClaim.component';
import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module';
@NgModule({
imports: [
SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule
],
declarations: [
ClaimInsertComponent
], exports:[ ClaimInsertComponent]
})
export class InsertClaimsModule { }

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LinkingComponent } from './linking.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: LinkingComponent},
])
]
})
export class LinkingRoutingModule { }

View File

@ -0,0 +1,16 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {LinkingGenericComponent} from './linkingGeneric.component';
@Component({
selector: 'linking',
template: `
<linking-generic [bulkMode]=false> </linking-generic>
`
})
export class LinkingComponent {
constructor () {
}
}

View File

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { LinkingComponent } from './linking.component';
import { LinkingRoutingModule } from './linking-routing.module';
import {LinkingGenericModule} from './linkingGeneric.module';
@NgModule({
imports: [
SharedModule,
LinkingRoutingModule,
LinkingGenericModule
],
declarations: [
LinkingComponent
], exports:[LinkingComponent]
})
export class LinkingModule { }

View File

@ -0,0 +1,223 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
@Component({
selector: 'linking-generic',
//providers: [MdRadioDispatcher],
template: `
<div class="container">
<div class="page-header">
<div *ngIf=" bulkMode " class="pull-right"><span class="badge"><h5>Bulk mode</h5></span></div>
<h1>Link research resutls</h1>
</div>
<linking-home *ngIf=" show == 'home' " [bulkMode]="bulkMode" (linkTypeChange)="linkTypeChange($event)" ></linking-home>
<div *ngIf=" show != 'home' && show != 'myclaims' " >
<ul *ngIf=" show != 'myclaims' " class="uk-breadcrumb">
<li *ngIf="linkType == 'project'" [class]="(show == 'project' )?'uk-active':''"><a *ngIf="show != 'project'" (click)="showChangedType('project')" >Project</a><span *ngIf="show == 'project'">Project</span></li>
<li *ngIf="linkType == 'context'" [class]="(show == 'context' )?'uk-active':''"><a *ngIf="show != 'context'" (click)="showChangedType('context')" >Context</a><span *ngIf="show == 'context'">Context</span></li>
<li *ngIf="linkType == 'software'" [class]="(show == 'software' )?'uk-active':''"><a *ngIf="show != 'software'" (click)="showChangedType('software')" >Software</a><span *ngIf="show == 'software'">Software</span> </li>
<li *ngIf="!bulkMode " [class]="(show == 'result' || show == 'publication' || show == 'dataset')?'uk-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 *ngIf="!bulkMode " [class]="(show == 'claim')?'uk-active':''"><span *ngIf="show == 'claim'">Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Link</a> </li>
<li *ngIf="bulkMode " [class]="(show == 'claim' )?'uk-active':''"><span *ngIf="show == 'claim'">Upload & Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Upload & Link</a> </li>
</ul>
<div *ngIf=" show != 'claim' && show != 'myclaims' " class="uk-grid" >
<div *ngIf=" show=='result' && !bulkMode " class="uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2">
<claim-result [selectedDatasets]="datasets" [selectedPublications]="publications" (datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)" > </claim-result>
</div>
<div *ngIf=" show=='project' " class="uk-width-1-1" >
<claim-projects [selectedProjects]="projects" > </claim-projects>
</div>
<div *ngIf=" show=='software' " class="uk-width-1-1">
<p>TODO software</p>
</div>
<div *ngIf=" show == 'context'" class="uk-width-1-1" >
<claim-contexts [selectedList]="contexts" > </claim-contexts>
</div>
<!-- <div *ngIf=" show == 'claim'" >
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" ></claim-insert>
</div>-->
<div [class]="( show=='result' && !bulkMode)?'uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 ':'uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 uk-margin-top uk-grid'">
<div [class]="( show=='result' && !bulkMode)?'uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 ':'uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2 '">
<claim-selected-contexts [contexts]="contexts" [show]="show"
(showChange)="showChange($event)" > </claim-selected-contexts>
</div>
<div [class]="( show=='result' && !bulkMode)?'uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 ':'uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2 '">
<claim-selected-projects [projects]="projects" [show]="show"
(showChange)="showChange($event)" > </claim-selected-projects>
</div>
<!---claim-selected-results [datasets]="datasets" [publications]="publications" [show]="show"
(showChange)="showChange($event)" [linkToResults]="(bulkMode)?false:true" > </claim-selected-results-->
<div [class]="( show=='result' && !bulkMode)?'uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 ':'uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2'">
<claim-selected-publications [publications]="publications" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" [bulkMode]="bulkMode">
</claim-selected-publications>
</div>
<div [class]="( show=='result' && !bulkMode)?'uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 ':'uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2 '">
<claim-selected-datasets [datasets]="datasets" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" [bulkMode]="bulkMode">
</claim-selected-datasets>
</div>
</div>
</div>
<div *ngIf=" show == 'claim' " class="uk-width-small-1-1 uk-width-medium-1-1 uk-width-large-1-1 uk-grid">
<!--claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show"
(showChange)="showChange($event)" (publicationsChange)="publicationsChange($event)" [showAccessRights]="'true'" [bulkMode]="bulkMode"
[linkToResults]="(bulkMode)?false:true" > </claim-selected-->
<div class="uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2">
<claim-selected-contexts [contexts]="contexts" [show]="show" (showChange)="showChange($event)" > </claim-selected-contexts>
</div>
<div class="uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2">
<claim-selected-projects [projects]="projects" [show]="show"
(showChange)="showChange($event)" > </claim-selected-projects>
<!-- Bulk Mode Results (publicationsChange)="publicationsChanged($event)" -->
</div>
<bulk-claim *ngIf=" bulkMode " [publications]="publications" > </bulk-claim>
<div class="uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2">
<claim-selected-publications [publications]="publications" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" [bulkMode]="bulkMode">
</claim-selected-publications>
</div>
<div class="uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2 uk-width-xlarge-1-2">
<claim-selected-datasets [datasets]="datasets" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" [bulkMode]="bulkMode">
</claim-selected-datasets>
</div>
<!--claim-selected-results [datasets]="datasets" [publications]="publications" [show]="show"
(showChange)="showChange($event)" [linkToResults]="(bulkMode)?false:true" [showAccessRights]=true [bulkMode]="bulkMode" >
</claim-selected-results-->
<div class="uk-width-1-1 ">
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>
</div>
</div>
<!--nav>
<ul *ngIf="show != 'home'" class="pager">
<li class="previous" (click)="prev()"><a ><span aria-hidden="true">&larr;</span> Previous</a></li>
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav-->
<ul *ngIf="show != 'home'" class="uk-pagination">
<li class="uk-pagination-previous" (click)="prev()"><a><i class="uk-icon-angle-left"></i> Previous</a></li>
<li class="uk-pagination-next" *ngIf="show != 'claim'" (click)="next()"><a>Next <i class="uk-icon-angle-right"></i></a></li>
</ul>
</div>
</div>
`
})
//[(ngModel)]="date"
export class LinkingGenericComponent {
constructor ( private _router: Router) {
}
@Input() bulkMode: boolean = false;
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')){
if(!this.bulkMode){
this.show='result';
}else{
this.show='claim';
}
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
this.show='claim';
}
}
prev(){
if(this.show == 'result'){
this.show = this.linkType;
}else if(this.show == 'context' || this.show == 'project' || this.show == 'software' ){
this.show='home';
} else if(this.show == 'claim'){
// this.show='result';
if(!this.bulkMode){
this.show='result';
}else{
this.show = this.linkType;
}
}
}
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;
}
}
}

View File

@ -0,0 +1,33 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import {SelectedProjectsModule} from './selected/selectedProjects.module';
import {SelectedContextsModule} from './selected/selectedContexts.module';
import {SelectedPublicationsModule} from './selected/selectedPublications.module';
import {SelectedDatasetsModule} from './selected/selectedDatasets.module';
// import {SelectedModule} from './selected/selectedResults.module';
import {ClaimProjectModule} from '../claim-utils/claimProject.module';
import {ClaimResultModule} from '../claim-utils/claimResult.module';
import {ClaimContextModule} from '../claim-utils/claimContext.module';
import {InsertClaimsModule} from './insertClaim/insertClaim.module';
import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
import {LinkingHomeComponent} from './linkingHome.component';
import {LinkingGenericComponent} from './linkingGeneric.component';
@NgModule({
imports: [
SharedModule, SelectedProjectsModule, SelectedContextsModule,
SelectedPublicationsModule, SelectedDatasetsModule, // SelectedResultsModule,
ClaimProjectModule,
ClaimResultModule, ClaimContextModule, InsertClaimsModule, BulkClaimModule
],
declarations: [
LinkingHomeComponent, LinkingGenericComponent
], exports:[
LinkingGenericComponent ]
})
export class LinkingGenericModule { }

View File

@ -0,0 +1,51 @@
import {Component, Output, EventEmitter, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'linking-home',
template: `
<div class="uk-grid">
<!--<img class="card-img-top" data-src="images/funders.png" alt="Card image cap"> -->
<div class="uk-block uk-block-muted uk-margin uk-text-center uk-width-1-2">
<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>
</div>
<div class="uk-block uk-block-muted uk-margin uk-text-center uk-width-1-2">
<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>
</div>
<!--div class="uk-block uk-block-muted uk-margin uk-width-1-2">
<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>
</div-->
<div *ngIf=" !bulkMode " class="uk-block uk-block-muted uk-margin uk-text-center uk-width-1-2">
<h4 class="card-title">Bulk mode linking</h4>
<p class="card-text">Link Research Results to projects,contects, etc, providing a CSV file with research results' DOIs</p>
<a href="/bulk-linking" class="btn btn-primary">Bulk mode linking</a>
</div>
</div>
`
})
export class LinkingHomeComponent {
@Output() linkTypeChange = new EventEmitter();
@Input() bulkMode:boolean = false;
linkType:string = "project";
select(type:string){
this.linkType = type;
this.linkTypeChange.emit({
value: this.linkType
});
}
}

View File

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

View File

@ -0,0 +1,66 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimContext} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'claim-selected-contexts',
template: `
<div [class]="componentClass" >
<!-- Contexts -->
<!--div *ngIf=" !(inline && hideType == 'context') && contexts" class="concepts" -->
<div *ngIf=" !(inline && hideType == 'context') " class="uk-accordion" data-uk-accordion="{showfirst:false}">
<h3 class="uk-accordion-title">Concepts ({{(contexts.length)}})
<!--span *ngIf=" !inline" title="Add More Concepts" (click)="showType('context')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span-->
</h3>
<div class="uk-accordion-content" >
<ul class="uk-list">
<li class="list-group-item" *ngFor="let context of contexts" >
<span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
<span (click)="removeContext(context)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
</li>
</ul>
<span *ngIf="contexts.length == 0 " class="uk-alert uk-alert-primary">There are no contexts</span>
</div>
</div>
</div>
`
})
export class ClaimSelectedContextsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
//2015-05-01
}
@Input() contexts:ClaimContext[];
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
@Input() show='home';
@Input() inline:boolean = false;
@Input() hideType;
@Input() bulkMode:boolean = false;
@Output() showChange = new EventEmitter();
todayDate = '';
nextDate = '';
showType(type){
if(type != this.show){
this.show = type;
this.showChange.emit({
value: this.show
});
}
}
removeContext(item:any){
var index:number =this.contexts.indexOf(item);
if (index > -1) {
this.contexts.splice(index, 1);
}
}
}

View File

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedContextsComponent} from './selectedContexts.component';
@NgModule({
imports: [
SharedModule,
],
declarations: [
ClaimSelectedContextsComponent
], exports:[ClaimSelectedContextsComponent]
})
export class SelectedContextsModule { }

View File

@ -0,0 +1,133 @@
import {Component, Input,Output, EventEmitter,ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
import {ClaimResult} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'claim-selected-datasets',
template: `
<div *ngIf=" !(inline && ( hideType == 'dataset' ))" class="uk-accordion " data-uk-accordion="{showfirst:false}" >
<h3 class="uk-accordion-title" > Research Data ({{(datasets.length)}}) </h3>
<div class="uk-accordion-content" >
<!--li *ngIf="publications.length > 0 || datasets.length > 0" class="list-group-item list-group-item-warning "> {{datasets.length}} Selected Research Data:
<span *ngIf=" !inline && linkToResults " title="Add More Research Data" (click)="showType('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
</li-->
<span *ngIf="datasets.length == 0 " class="uk-alert uk-alert-primary">There are no selected research data</span>
<ul *ngIf="datasets.length > 0 " class="uk-list">
<li *ngFor="let dataset of datasets" class="list-group-item">
<div class="row">
<div [ngClass]="showAccessRights?'col-md-8':'col-md-12'">
<span *ngIf="showAccessRights" (click)="removeDataset(dataset)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
<a *ngIf="dataset.url" target="_blank" class="uk-icon-external-link" href="{{dataset.url}}" >{{dataset.title}}</a>
<span *ngIf="!dataset.url" >{{dataset.title}}</span>
<span *ngIf="dataset.date" >({{dataset.date.substring(0,4)}})</span>
<span *ngIf="!showAccessRights" (click)="removeDataset(dataset)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
</div>
<div class = "col-md-4">
<span *ngIf="showAccessRights && dataset.source != 'openaire'" class="dropdown">
<button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+dataset.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{dataset.accessRights}}
</button>
<ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+dataset.id">
<li *ngFor="let type of accessTypes" ><a (click)="accessRightsTypeChanged(type,dataset) " >{{type}} </a></li>
</ul>
<input *ngIf="dataset.accessRights== 'EMBARGO'" type="date" id="{{'date'+dataset.id}}" name="" [min]="todayDate" (keyup)="dateChanged($event,dataset)" [value]="dataset.embargoEndDate">
</span>
<span *ngIf="showAccessRights && dataset.source == 'openaire' " >
<button class="uk-button disabled " type="button" >
{{dataset.accessRights}}
</button>
</span>
</div>
</div>
</li>
</ul>
<modal-alert (alertOutput)="confirmClose($event)"> </modal-alert>
</div>
</div>
`
})
export class ClaimSelectedDatasetsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
//2015-05-01
}
@Input() datasets: ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() inline:boolean = false;
@Input() hideType;
@Input() bulkMode:boolean = false;
@Input() linkToResults:boolean = true;
@Output() datasetsChange = new EventEmitter();
todayDate = '';
nextDate = '';
@ViewChild(AlertModal) alertApplyAll;
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result
removeDataset(item:any){
var index:number =this.datasets.indexOf(item);
if (index > -1) {
this.datasets.splice(index, 1);
}
this.datasetsChange.emit({
value: this.datasets
});
}
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
dateChanged (event:any, item:any) {
item.embargoEndDate = event.target.value ;
this.confirmOpen();
}
/* The following methods:
*typeChanged
*confirmOpen
*confirmClose
implement the functionality: change accessRights of a publication - apply to all if asked */
accessRightsTypeChanged (type:any, item:any) {
item.accessRights = type;
if(this.datasets.length > 1 ){
this.commonAccessRights = type;
if(this.commonAccessRights == "EMBARGO"){
this.commonEmbargoEndDate = item.embargoEndDate;
}
this.confirmOpen();
}
}
confirmOpen(){
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Change access rights";
this.alertApplyAll.message = "Do you wish to apply the change to every dataset?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
for (var i = 0; i < this.datasets.length; i++) {
this.datasets[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.datasets[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedDatasetsComponent} from './selectedDatasets.component';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
@NgModule({
imports: [
SharedModule, AlertModalModule
],
declarations: [
ClaimSelectedDatasetsComponent
], exports:[ClaimSelectedDatasetsComponent]
})
export class SelectedDatasetsModule { }

View File

@ -0,0 +1,72 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimProject} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'claim-selected-projects',
template: `
<div *ngIf=" !(inline && hideType == 'project') " class="uk-accordion" data-uk-accordion="{showfirst:false}">
<h3 class="uk-accordion-title"> Projects ({{(projects.length)}})
</h3>
<!--div *ngIf=" !(inline && hideType == 'project') && projects.length > 0 " class="projects" >
<ul class="uk-list">
<li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
<span *ngIf=" !inline " title="Add More Projects" (click)="showType('project')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
</li-->
<div class="uk-accordion-content">
<ul class="uk-list">
<li class="list-group-item" *ngFor="let project of projects">
<span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></span>
<span (click)="removeProject(project)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
</li>
</ul>
<span *ngIf="projects.length == 0 " class="uk-alert uk-alert-primary">There are no projects</span>
</div>
</div>
`
})
export class ClaimSelectedProjectsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
//2015-05-01
}
@Input() projects: ClaimProject[];
@Input() show='home';
@Input() inline:boolean = false;
@Input() hideType;
@Input() bulkMode:boolean = false;
@Input() linkToResults:boolean = true;
@Output() projectsChange = new EventEmitter();
@Output() showChange = new EventEmitter();
todayDate = '';
nextDate = '';
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
});
}
}
}

View File

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedProjectsComponent} from './selectedProjects.component';
@NgModule({
imports: [
SharedModule
],
declarations: [
ClaimSelectedProjectsComponent
], exports:[ClaimSelectedProjectsComponent]
})
export class SelectedProjectsModule { }

View File

@ -0,0 +1,138 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
import {ClaimResult} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'claim-selected-publications',
template: `
<div class =" ">
<div *ngIf=" !(inline && hideType == 'publication' ) " class="uk-accordion " data-uk-accordion="{showfirst:false}" >
<h3 class="uk-accordion-title" > Publications ({{(publications.length)}}) </h3>
<div class="uk-accordion-content" >
<span *ngIf="publications.length == 0 " class="uk-alert uk-alert-primary">There are no selected publications</span>
<ul *ngIf="publications.length > 0 " class="uk-list">
<li *ngFor="let pub of publications" class="list-group-item">
<div class="row">
<div [ngClass]="showAccessRights?'col-md-8':'col-md-12'" >
<span *ngIf="showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="btn"><i class="uk-icon-remove"></i></span>
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" >{{pub.title}}</a>
<span *ngIf="!pub.url" >{{pub.title}}</span><span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
<span *ngIf="!showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
</div>
<div *ngIf="showAccessRights && pub.source != 'openaire' " class = "col-md-4">
<span *ngIf="showAccessRights && pub.source != 'openaire' " class="dropdown">
<select [(ngModel)]="pub.accessRights" name="{{'select_rights_'+pub.id}}" >
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,pub)">{{type}}</option>
</select>
<input *ngIf="pub.accessRights== 'EMBARGO'" id="{{'date'+pub.id}}" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}">
<!--button class="uk-button dropdown-toggle" type="button" id="{{'dropdown'+pub.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{pub.accessRights}}
</button>
<ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+pub.id">
<li *ngFor="let type of accessTypes" ><a (click)="accessRightsTypeChanged(type,pub) " >{{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>
</div>
<div *ngIf="showAccessRights && pub.source == 'openaire' " class = "col-md-4">
<span >
<button class="uk-button disabled " type="button" >
{{pub.accessRights}}
</button>
</span>
</div>
</div>
</li>
</ul>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
</div>
</div>
`
})
export class ClaimSelectedPublicationsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
//2015-05-01
}
@Input() publications: ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() inline:boolean = false;
@Input() hideType;
@Input() bulkMode:boolean = false;
@Input() linkToResults:boolean = true;
@Output()publicationsChange = new EventEmitter();
@Output() showChange = new EventEmitter();
todayDate = '';
nextDate = '';
@ViewChild(AlertModal) alertApplyAll;
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result
removePublication(item:any){
var index:number =this.publications.indexOf(item);
if (index > -1) {
this.publications.splice(index, 1);
}
this.publicationsChange.emit({
value: this.publications
});
}
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
dateChanged (event:any, item:any) {
item.embargoEndDate = event.target.value ;
}
publicationsChanged($event) {
this.publications=$event.value;
this.publicationsChange.emit({
value: this.publications
});
}
/* The following methods:
*typeChanged
*confirmOpen
*confirmClose
implement the functionality: change accessRights of a publication - apply to all if asked */
accessRightsTypeChanged (type:any, item:any) {
item.accessRights = type;
if(this.publications.length > 1 ){
this.commonAccessRights = type;
if(this.commonAccessRights == "EMBARGO"){
this.commonEmbargoEndDate = item.embargoEndDate;
}
this.confirmOpen();
}
}
confirmOpen(){
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Change access rights";
this.alertApplyAll.message = "Do you wish to apply the change to every publication?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
for (var i = 0; i < this.publications.length; i++) {
this.publications[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.publications[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedPublicationsComponent} from './selectedPublications.component';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
@NgModule({
imports: [
SharedModule, AlertModalModule
],
declarations: [
ClaimSelectedPublicationsComponent
], exports:[ClaimSelectedPublicationsComponent]
})
export class SelectedPublicationsModule { }

View File

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

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {SelectedDatasetsModule} from './selectedDatasets.module';
import {SelectedPublicationsModule} from './selectedPublications.module';
// import {ClaimSelectedResultsComponent} from './selectedResults.component';
@NgModule({
imports: [
SharedModule, SelectedDatasetsModule, SelectedPublicationsModule
],
declarations: [
// ClaimSelectedResultsComponent
], exports:[
// ClaimSelectedResultsComponent
]
})
export class SelectedResultsModule { }

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { MyClaimsComponent } from './myClaims.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: MyClaimsComponent},
])
]
})
export class MyClaimsRoutingModule { }

View File

@ -0,0 +1,34 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'my-claims',
template: `
<div *ngIf="user" class="container uk-margin-top">
<div class="page-header">
<h1> My Linked research resutls</h1>
</div>
<div>
<div class="uk-text-right"><a routerLink="/linking">Add more Links?</a></div>
<displayClaims enableDelete="false" myClaims="true" isAdmin="false" [fetchId]="user" ></displayClaims>
</div>
</div>
<div *ngIf="!user" class="container">
TODO login
</div>
`
})
export class MyClaimsComponent {
constructor () {
}
user:string="argirok@di.uoa.gr";
ngOnInit() {
}
}

View File

@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { MyClaimsComponent } from './myClaims.component';
import { MyClaimsRoutingModule } from './myClaims-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
@NgModule({
imports: [
SharedModule,
MyClaimsRoutingModule,
// ClaimServiceModule,
DisplayClaimsModule
],
declarations: [
MyClaimsComponent
]
})
export class MyClaimsModule { }

View File

@ -0,0 +1,51 @@
// import {Component, Input} from '@angular/core';
// import {Observable} from 'rxjs/Observable';
// import { Router } from '@angular/router';
//
//
//
// @Component({
// selector: 'my-claims-demo',
// 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}] );
// }
// }

View File

@ -103,7 +103,7 @@
</li>
</ul>
<ul id="tab-content" class="uk-switcher uk-margin">
<ul id="{{'tab-content'+articleId}}" class="uk-switcher uk-margin">
<li id="citationsTab">
<div *ngIf="publicationInfo.references == undefined" class = "uk-alert" >

View File

@ -1,75 +0,0 @@
import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {SearchCrossrefService} from '../services/searchCrossref.service';
@Component({
selector: 'search',
template: `
<h1>Search Demo</h1>
<p><i>Fetches from crossref </i></p>
<form class="uk-form">
<input #term [(ngModel)]="keyword" name="keyword" />
<button (click)="search(term.value,10,1)" type="submit" class="uk-button">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>
`
})
export class SearchComponent {
constructor (private _searchService: SearchCrossrefService,
private route: ActivatedRoute) {
console.info('search constructor');
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
console.info('Params'+params);
let page = (params['page']=== undefined)?1:+params['page'];
let size = (params['size']=== undefined)?10:+params['size'];
this.page = ( page <= 0 ) ? 1 : page;
this.size = ( size <= 0 ) ? 10 : size;
this.keyword = params['keyword'];
if(this.keyword !=null){
this.search(this.keyword,this.size,this.page);
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
public sub: any;
public page : number;
public size:number;
public keyword:string;
public navigateTo: string = "./search";
public results : String[];
public orcidresults : String[];
public 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.log(err)
);
}
}

View File

@ -14,6 +14,7 @@ import {EntitiesSearchService} from './entitySearch.service';
'(document:click)': 'handleClick($event)',
},
template: `
<span class="custom-autocomplete">
<span *ngIf = "showSelected && selectedValue != ''">
<span class="uk-alert-default" data-uk-alert="" *ngFor="let item of selected" [title]="showItem(item)" > <span >{{truncate(showItem(item),14)}} </span>
@ -40,7 +41,6 @@ import {EntitiesSearchService} from './entitySearch.service';
</span>
`
})
export class EntitiesAutocompleteComponent {
@ -168,6 +168,7 @@ export class EntitiesAutocompleteComponent {
if (index > -1 && !this.allowDuplicates) {
// this.keyword = "";
// this.filtered.splice(0, this.filtered.length);
this.focus=false;
return;
}
else{
@ -177,6 +178,7 @@ export class EntitiesAutocompleteComponent {
this.addItem.emit({
value: item
});
this.focus=false;
}
}else{
this.selected.splice(0, this.selected.length);
@ -188,6 +190,7 @@ export class EntitiesAutocompleteComponent {
this.selectedValueChanged.emit({
value: this.selectedValue
});
this.focus=false;
}

View File

@ -6,27 +6,26 @@ import {Open} from './open.component';
@Component({
selector: 'modal-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">&times;</span></button>
<h4 class="modal-title text-center" id="myModalLabel">{{alertTitle}}</h4>
<div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="uk-modal-dialog" role="">
<div class="modal-header" [hidden]=!alertHeader>
<a href="" class="uk-modal-close uk-close uk-float-right" (click)='cancel()' ></a>
<h4 class="modal-title text-center" id="myModalLabel">{{alertTitle}}</h4>
</div>
<div class="modal-body">
<div class="uk-margin uk-modal-content">
<div [hidden]=!alertMessage>
{{message}}
</div>
</div>
<div class="modal-footer" [hidden]=!alertFooter>
<div class="uk-modal-footer uk-text-right" [hidden]=!alertFooter>
<span [hidden]=!okButton >
<button class="btn btn-primary" (click)="ok()">{{okButtonText}}</button>
<button class="uk-button " (click)="ok()">{{okButtonText}}</button>
</span>
<span [hidden]=!cancelButton>
<button class="btn btn-primary" (click)="cancel()">{{cancelButtonText}}</button>
<button class="uk-button" (click)="cancel()">{{cancelButtonText}}</button>
</span>
</div>
</div>
</div>
</div>
`,

View File

@ -8,8 +8,8 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
template: `
<ul *ngIf=" ( getTotalPages() > 0 ) && (getTotalPages() > 1) && ( 0 < currentPage && currentPage <= getTotalPages() ) " class="uk-pagination">
<li *ngIf=" currentPage > 1" ><a (click)="onPage((1))" aria-label="Previous">
<span><i class="uk-icon-angle-double-left"></i></span></a></li>
<li *ngIf=" currentPage > 1" ><a (click)="onPage((currentPage -1))" aria-label="Previous">
<span><i class="uk-icon-angle-left"></i></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="uk-active"><span >{{currentPage}}</span></li>
@ -17,8 +17,8 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
<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">
<i class="uk-icon-angle-double-right"></i>
<li *ngIf="getTotalPages() > currentPage"><a (click)="onPage(currentPage +1)" aria-label="Next">
<i class="uk-icon-angle-right"></i>
</a>
</li>

View File

@ -56,7 +56,7 @@ export class OpenaireProperties {
private static csvAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv
private static searchCrossrefAPIURL = "http://api.crossref.org/works";
private static searchDataciteAPIURL = "http://search.datacite.org/api";
private static searchDataciteAPIURL = "https://search.datacite.org/api";
private static searchOrcidURL = "https://pub.orcid.org/";
// Identifiers

View File

@ -41,7 +41,7 @@ export class ISVocabulariesService {
vocabulary = "dnet:access_modes.json";
return this.getVocabularyFromService(vocabulary);
} else if( (field == "datasourcetype") && (entity == "dataprovider")){
} else if( (field == "type") && (entity == "dataprovider")){
// file = "dataProviderType.json";
// return this.getVocabularyFromFile(file);
vocabulary = "dnet:datasource_typologies.json";

View File

@ -29,7 +29,9 @@
<script src="assets/uikit-2.27.2/js/core/switcher.min.js" type="text/javascript"></script>
<!-- Progress Bar -->
<link href="assets/uikit-2.27.2/css/components/progress.almost-flat.min.css" rel="stylesheet" type="text/css" />
<!-- Notify -->
<link href="assets/uikit-2.27.2/css/components/notify.almost-flat.min.css" rel="stylesheet" type="text/css" />
<script src="assets/uikit-2.27.2/js/components/notify.min.js" type="text/javascript"></script>
<!-- Tooltip -->
<link href="assets/uikit-2.27.2/css/components/tooltip.almost-flat.min.css" rel="stylesheet" type="text/css" />
<script src="assets/uikit-2.27.2/js/components/tooltip.min.js" type="text/javascript"></script>