Clean up src - remove claims related files

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45485 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-01-19 14:03:07 +00:00
parent c1af4972d8
commit 14a766e927
50 changed files with 13 additions and 4467 deletions

View File

@ -9,7 +9,6 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent, XLargeDirective } from './app.component';
// custom modules::
import {ClaimModule} from './claimPages/claim.module';
import {SearchModule} from './searchPages/search.module';
import {DepoditModule} from './deposit/deposit.module';
import {LandingModule} from './landingPages/landing.module';
@ -26,9 +25,7 @@ import {ServicesModule} from './services/services.module';
imports: [
//MaterialModule.forRoot(),
SharedModule,
HomeModule,
ClaimModule,
HomeModule,
SearchModule,
DepoditModule,
LandingModule,

View File

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

@ -1,184 +0,0 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ContextsService} from '../../services/contexts.service';
import {ClaimContext} from '../../utils/entities/claimEntities.class';
import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete.component';
@Component({
// moduleId: module.id,
selector: 'claim-contexts',
template: `
<div class="panel-body" *ngIf="!inline">
<div class="input-group" >
<div class=" input-group-btn">
<button class="btn btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCommunityLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
</ul>
</div>
<div class="input-group-btn ">
<button class="btn btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCategoryLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
</ul>
</div>
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Concepts'" title = "Concepts:" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
</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";
}
}
if (!found) {
this.selectedList.push(context);
}
}
getCommunities () {
this._contextService.getCommunities().subscribe(
data => {
this.communities = data.communities;
},
err => console.log(err)
);
}
getCategories () {
this.categories=[];
if(this.selectedCommunityId != '0'){
this._contextService.getCategories(this.selectedCommunityId).subscribe(
data => {
this.categories = data.category;
this.concepts = [];
this.filteredList = [];
if (this.query !== ""){
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){
this.warningMessage = "";
this.infoMessage = "";
if(this.selectedCommunityId != communityId){
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

@ -1,241 +0,0 @@
import { Component, Input, Output, EventEmitter} from '@angular/core';
import { SearchDataciteService } from '../../services/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {ClaimResult} from '../../utils/entities/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="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div-->
<div class="panel ">
<div class="">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{(dataciteResultsNum==null)?'0':dataciteResultsNum}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire ({{(openaireResultsNum==null)?'0':openaireResultsNum}})</a></li>
</ul>
<div class="tab-content">
<div id="datacite" class="tab-pane fade in active">
<div class = "panel-body">
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0">
<p > {{dataciteResultsNum }} Total Results </p>
<paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load>
</div>
<div *ngIf="dataciteResultsNum == null || dataciteResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
<div >
<ul *ngIf="dataciteResults.length > 0 " class="uk-list">
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.doi))?'list-group-item panel-footer':'list-group-item'" >
<div >
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" >{{item.title}}</a>
<span *ngIf="!item.doi" >{{item.title}}</span>
<i *ngIf="!isSelected(item.doi)" (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi, null,'OPEN')" aria-hidden="true" class= "uk-icon-plus clickable">Add</i>
</div>
<span *ngIf="item.publisher" class="sub-title-elements">Publisher: {{item.publisher}}</span>
<div *ngIf="item.creator" class="sub-title-elements">Authors: <span *ngFor="let author of item.creator let i = index">{{author}}{{(i < (item.creator.length-1))?"; ":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
<div id="openaire" class="tab-pane fade">
<div class = "panel-body">
<div *ngIf="openaireResultsNum != null && openaireResultsNum > 0">
<paging-no-load [currentPage]="openairePage" [totalResults]="openaireResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openairePageChange($event)"> </paging-no-load>
</div>
<div >
<ul *ngIf="openaireResults.length > 0 " class="uk-list">
<li *ngFor=" let result of openaireResults " [class]="(isSelected(result.id))?'list-group-item panel-footer':'list-group-item'">
<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>
<i *ngIf="!isSelected(result.id)"
(click)="add(result, result.id, 'dataset', 'openaire', result['title'].name, result['title'].url, result.year, result['title'].accessMode)" aria-hidden="true" class= "uk-icon-plus clickable">Add</i>
</div>
<span *ngIf="result.publisher" class="sub-title-elements">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)">({{result.year}})</span>
<div *ngIf="result.authors" class="sub-title-elements">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 = "alert alert-info " > No results found </div>
</div>
</div>
</div>
</div>
</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

@ -1,191 +0,0 @@
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {ProjectService} from '../../services/project.service';
import {ModalLoading} from '../../utils/modal/loading.component';
import { Subject } from 'rxjs/Subject';
import {ClaimProject} from '../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-projects',
// styleUrls: ['/autoComplete.component.css'],
template: `
<div class="panel-body" >
<form class="form-group " [class.form-inline]="!inline">
<div [class.input-group]="!inline">
<div class="input-group-btn" >
<button type="button" class="btn btn-info dropdown-toggle" id="dropdownFunder" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
</button>
<ul class="dropdown-menu custom-hidden-dropdown-menu " aria-labelledby="dropdownFunder">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.id,funder.name)" ><a >{{funder.name}}</a></li>
</ul>
</div>
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Search for Projects'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
</div>
</form>
<!--form *ngIf=" inline " class="form-horizontal">
<div class="">
<div class="form-group" >
<button type="button" class="btn btn-xs btn-info dropdown-toggle" id="dropdownFunder" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
</button>
<ul class="dropdown-menu custom-hidden-dropdown-menu" aria-labelledby="dropdownFunder">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
</ul>
</div>
<div class="form-group"> <input id="community" type="text" class="form-control input-sm" (keyup)="search(query)" placeholder="Search for Projects" [(ngModel)]=query name="query" ></div>
</div>
</form>
<div class="suggestions" >
<ul class="uk-list" >
<li *ngFor=" let item of filteredList | async " class="list-group-item" >
<a (click)="select(item)"> {{(item.field[1]['@value'])?item.field[1]['@value']+" - ":""}} {{item.field[3]['@value']}}</a>
</li>
</ul>
</div-->
</div>
<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);
}
}
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

@ -1,110 +0,0 @@
<div class="panel">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{(crossrefResultsNum)?crossrefResultsNum:0}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire ({{ (openaireResultsNum)?openaireResultsNum:0 }})</a></li>
<li><a data-toggle="tab" href="#orcid">Orcid ({{ (orcidResultsNum)?orcidResultsNum:0}})</a></li>
</ul>
<div class="tab-content">
<div id="crossref" class="active tab-pane fade in">
<div class="panel-body" >
<div *ngIf="crossrefStatus == errorCodes.LOADING" class="alert alert-info" role="alert">Loading...</div>
<div *ngIf="crossrefStatus != errorCodes.LOADING && crossrefResults.length == 0" class="alert alert-info" role="alert">No Results found</div>
<div *ngIf="crossrefStatus == errorCodes.ERROR" class="alert alert-warning" role="alert">An Error Occured</div>
<div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0">
<paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load>
</div>
<div >
<ul *ngIf="crossrefResults.length > 0 " class="uk-list">
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'list-group-item panel-footer':'list-group-item'">
<div >
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
<span *ngIf="!item.URL" >{{item.title}}</span>
<i *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')" aria-hidden="true" class= "uk-icon-plus clickable">Add</i>
</div>
<span *ngIf="item.publisher" class="sub-title-elements">Publisher: {{item.publisher}}</span><span *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="sub-title-elements">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="sub-title-elements">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>
</div>
<div id="openaire" class="tab-pane fade">
<div class = "panel-body">
<div *ngIf="openaireStatus == errorCodes.LOADING" class="alert alert-info" role="alert">Loading...</div>
<div *ngIf="openaireStatus == errorCodes.NONE" class="alert alert-info" role="alert">No Results found</div>
<div *ngIf="openaireStatus == errorCodes.ERROR" class="alert alert-warning" role="alert">An Error Occured</div>
<div *ngIf="openaireStatus == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
<div *ngIf="openaireResultsNum != null && openaireResultsNum > 0">
<paging-no-load [currentPage]="openairePage" [totalResults]="openaireResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openairePageChange($event)"> </paging-no-load>
</div>
<div >
<ul *ngIf="openaireResults.length > 0 " class="uk-list">
<li *ngFor=" let result of openaireResults " [class]="(isSelected(result.id))?'list-group-item panel-footer':'list-group-item'">
<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>
<i *ngIf="!isSelected(result.id)" (click)="add(result, result.id, 'openaire', 'publication', result['title'].url, result['title'].name, result.year,result['title'].accessMode)" aria-hidden="true" class= "uk-icon-plus clickable">Add</i>
</div>
<span *ngIf="result.publisher" class="sub-title-elements">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)">({{result.year}})</span>
<div *ngIf="result.authors" class="sub-title-elements">Authors: <span *ngFor="let author of result.authors let i = index">{{author.name}}{{(i < (result.authors.length-1))?"; ":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
<div id="orcid" class="tab-pane fade">
<div class="panel-body" >
<div *ngIf="orcidStatus == errorCodes.LOADING" class="alert alert-info" role="alert">Loading...</div>
<div *ngIf="orcidStatus == errorCodes.ERROR" class="alert alert-warning" role="alert">An Error Occured</div>
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
<div *ngIf="orcidStatus == errorCodes.NONE" class = "alert alert-info " > No results found </div>
<div *ngIf="orcidResultsNum != null" class="panel-body">
<div class = "alert alert-warning " > Not the right author? Choose one of these:
<span class="dropdown">
<button class=" 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>
</span>
</div>
<span>Results for
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
</span>
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " >
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
</div>
<div >
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list">
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['put-code']))?'list-group-item panel-footer':'list-group-item'">
<div>
<span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
<i *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')" aria-hidden="true" class= " uk-icon-plus clickable">Add</i>
</div>
<span *ngIf="item['journal-title'] && item['journal-title'].value " class="sub-title-elements">Journal: {{item['journal-title'].value}}</span><span *ngIf="(item['publication-date']&&item['publication-date'].year&&item['publication-date'].year.value)"> ({{item['publication-date'].year.value}})</span>
<div *ngIf="item.contributors" class="sub-title-elements">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 = "alert alert-info " > No results found </div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,400 +0,0 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {SearchCrossrefService} from '../../services/searchCrossref.service';
import {SearchOrcidService} from '../../services/searchOrcid.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {ClaimResult} from '../../utils/entities/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) {
let id = this.authorIds[index];
console.info("getOrcidResultsById: "+id);
this._searchOrcidService.searchOrcidPublications(id).subscribe(
data => {
if(data != null) {
this.orcidResults=data['orcid-work'];
this.orcidResultsNum = data['orcid-work'].length;
this.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;
}
this.authorGivenName = this.authorGivenNames[index];
this.authorFamilyName = this.authorFamilyNames[index];
this.authorId = id;
},
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

@ -1,108 +0,0 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {ClaimPublicationComponent} from './claimPublication.component';
import {ClaimDatasetComponent} from './claimDataset.component';
import {SearchDataciteService} from '../../services/searchDatacite.service';
@Component({
selector: 'claim-result',
template: `
<div class="panel">
<div class="">
<form>
<!--<md-input class="demo-full-width default" placeholder="Search for Research Results" [(ngModel)]="keyword"></md-input>
<md-radio-group class="default" [(value)]="searchType">
<md-radio-button [value]="publication" [checked]="searchType === 'publication'" >Publication</md-radio-button>
<md-radio-button [value]="dataset" [checked]="searchType != 'publication'">Dataset</md-radio-button>
</md-radio-group> -->
<div class="input-group">
<span class="input-group-addon">
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
</span>
<!--<div class="input-group-btn">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} </button>
<ul class="dropdown-menu">
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
</ul>
</div> -->
<input class=" form-control" [(ngModel)]="keyword" 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 (private _searchDataciteService: SearchDataciteService) {
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

@ -1,111 +0,0 @@
<form class="uk-form">
<fieldset data-uk-margin>
<legend>Filter By:</legend>
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" name="claims-keyword" >
<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>
</fieldset>
</form>
<div class="uk-grid" data-uk-grid-margin="">
<div *ngIf="resultsNum>0" class="uk-width-1-1">
Showing {{(size*page - size +1)}} to {{(size*page>resultsNum)?resultsNum:(size*page)}} of {{resultsNum}} claims
</div>
<div *ngIf="resultsNum" class="uk-width-1-2 uk-row-first">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [params]="getParameters()" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div class="uk-width-1-2" *ngIf="resultsNum>size*page ">
<div class="uk-button-dropdown" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
Show <button class="uk-button">{{size}} <i class="uk-icon-caret-down"></i></button>
<div class="uk-dropdown uk-dropdown-bottom" aria-hidden="true" style="top: 30px; left: 0px;" tabindex="">
<ul class="uk-nav uk-nav-dropdown">
<li *ngIf="resultsNum > 10" ><a (click)="changeSize(10) " >10 </a></li>
<li *ngIf="resultsNum > 20" ><a (click)="changeSize(20)" >20 </a></li>
<li *ngIf="resultsNum > 30" ><a (click)="changeSize(30)" >30 </a></li>
<li *ngIf="resultsNum > 50" ><a (click)="changeSize(40)" >50 </a></li>
</ul>
</div>
</div>
<!--div data-uk-dropdown class="uk-button-dropdown">
Show <button class="uk-button " type="button" id="pagingDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{size}}
</button>
<ul class="uk-nav uk-nav-dropdown" aria-labelledby="pagingDropdown">
<li *ngIf="resultsNum > 10" ><a (click)="changeSize(10) " >10 </a></li>
<li *ngIf="resultsNum > 20" ><a (click)="changeSize(20)" >20 </a></li>
<li *ngIf="resultsNum > 30" ><a (click)="changeSize(30)" >30 </a></li>
<li *ngIf="resultsNum > 50" ><a (click)="changeSize(40)" >50 </a></li>
</ul>
</div-->
</div>
</div>
<div data-uk-dropdown>
<!-- This is the element toggling the dropdown -->
<div>...</div>
<!-- This is the dropdown -->
<div class="uk-dropdown">...</div>
</div>
<div *ngIf="showErrorMessage " class = "alert alert-danger " >
An Error occured.
</div>
<!-- Buttons for selecting and Delete Claims -->
<div *ngIf="enableDelete">
<div *ngIf="selected.length>0 && resultsNum > 0 ">
<div class = "alert 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 = "alert 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

@ -1,490 +0,0 @@
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 '../../services/claims.service';
import {ModalLoading} from '../../utils/modal/loading.component';
import {AlertModal} from '../../utils/modal/alert';
@Component({
selector: 'claims',
templateUrl: 'claims.component.html',
providers:[ ClaimsService]
})
export class ClaimsComponent {
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;
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

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

@ -1,10 +0,0 @@
<div *ngIf="id">
<p>Here is the claim with id : {{id}}</p>
<div *ngIf="claim">
{{claim.id }} || {{claim.userMail }} ||
{{claim | json}} {{claim | json}}
</div>
</div>
<div *ngIf="!id">
<p>No proper id...</p>
</div>

View File

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

@ -1,36 +0,0 @@
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>
<claims enableDelete="true" myClaims="false" isAdim="true"></claims>
</div>
</div>
<div *ngIf="!user" class="container">
TODO login
</div>
`,
})
export class ClaimsAdminComponent {
constructor ( ) {
}
user:string="argirok@di.uoa.gr";
ngOnInit() {
}
}

View File

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

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

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

@ -1,206 +0,0 @@
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchCrossrefService} from '../../../services/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

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

@ -1,264 +0,0 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Router} from '@angular/router';
import {ClaimsService} from '../../../services/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
@Component({
selector: 'claim-insert',
template: `
<button *ngIf="claiming == false && showButton == true" (click)="validateInsertions()" class="btn btn-primary" style="float:right">Finish</button>
<div *ngIf="errorMessage.length > 0">
<div class="alert alert-danger" role="alert">{{errorMessage}}</div>
</div>
<div *ngIf="warningMessage.length > 0">
<div class="alert alert-warning" role="alert">{{warningMessage}}</div>
</div>
<modal-loading [message]= "'Please wait...'"></modal-loading>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`
})
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

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

@ -1,191 +0,0 @@
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' " >
<ol *ngIf=" show != 'myclaims' " class="breadcrumb">
<li *ngIf="linkType == 'project'" [class]="(show == 'project' )?'active':''"><a *ngIf="show != 'project'" (click)="showChangedType('project')" >Project</a><span *ngIf="show == 'project'">Project</span></li>
<li *ngIf="linkType == 'context'" [class]="(show == 'context' )?'active':''"><a *ngIf="show != 'context'" (click)="showChangedType('context')" >Context</a><span *ngIf="show == 'context'">Context</span></li>
<li *ngIf="linkType == 'software'" [class]="(show == 'software' )?'active':''"><a *ngIf="show != 'software'" (click)="showChangedType('software')" >Software</a><span *ngIf="show == 'software'">Software</span> </li>
<li *ngIf="!bulkMode " [class]="(show == 'result' || show == 'publication' || show == 'dataset')?'active':''"><a *ngIf="show != 'result' && show != 'publication' && show != 'dataset'" (click)="showChangedType('result')" >Research Result</a><span *ngIf="show == 'result' || show == 'publication' || show == 'dataset'">Research Result</span></li>
<li *ngIf="!bulkMode " [class]="(show == 'claim')?'active':''"><span *ngIf="show == 'claim'">Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Link</a> </li>
<li *ngIf="bulkMode " [class]="(show == 'claim' )?'active':''"><span *ngIf="show == 'claim'">Upload & Link</span><a *ngIf="show != 'claim'" (click)="showChangedType('claim')">Upload & Link</a> </li>
</ol>
<div *ngIf=" show != 'claim' && show != 'myclaims' " class="row" >
<div class="col-sm-6">
<div *ngIf=" show=='result' && !bulkMode " >
<claim-result [selectedDatasets]="datasets" [selectedPublications]="publications" (datasetsChange)="datasetsChange($event)" (publicationsChange)="publicationsChange($event)" > </claim-result>
</div>
<div *ngIf=" show=='project' " >
<claim-projects [selectedProjects]="projects" > </claim-projects>
</div>
<div *ngIf=" show=='software' " >
<p>TODO software</p>
</div>
<div *ngIf=" show == 'context'" >
<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>
<div class="col-sm-6">
<claim-selected-contexts [contexts]="contexts" [show]="show"
(showChange)="showChange($event)" > </claim-selected-contexts>
<claim-selected-projects [projects]="projects" [show]="show"
(showChange)="showChange($event)" > </claim-selected-projects>
<claim-selected-results [datasets]="datasets" [publications]="publications" [show]="show"
(showChange)="showChange($event)" [linkToResults]="(bulkMode)?false:true" > </claim-selected-results>
</div>
</div>
<div *ngIf=" show == 'claim' " >
<!--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-->
<claim-selected-contexts [contexts]="contexts" [show]="show"
(showChange)="showChange($event)" > </claim-selected-contexts>
<claim-selected-projects [projects]="projects" [show]="show"
(showChange)="showChange($event)" > </claim-selected-projects>
<!-- Bulk Mode Results (publicationsChange)="publicationsChanged($event)" -->
<bulk-claim *ngIf=" bulkMode " [publications]="publications" > </bulk-claim>
<claim-selected-results [datasets]="datasets" [publications]="publications" [show]="show"
(showChange)="showChange($event)" [linkToResults]="(bulkMode)?false:true" [showAccessRights]=true [bulkMode]="bulkMode" >
</claim-selected-results>
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>
</div>
<nav>
<ul *ngIf="show != 'home'" class="pager">
<li class="previous" (click)="prev()"><a ><span aria-hidden="true">&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>
</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

@ -1,58 +0,0 @@
import {Component, Output, EventEmitter, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'linking-home',
template: `
<div class="card-deck-wrapper">
<div class="card-deck">
<div class="card card-inverse card-info text-xs-center">
<!--<img class="card-img-top" data-src="images/funders.png" alt="Card image cap"> -->
<div class="card-block">
<h4 class="card-title">Link with project</h4>
<p class="card-text">Link your research result with funded projects.</p>
<a (click)="select('project')" class="btn btn-primary">Link with project</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>-->
</div>
</div>
<div class="card card-inverse card-success text-xs-center" >
<div class="card-block">
<h4 class="card-title">Link with Community</h4>
<p class="card-text">Link your research result with research communities.</p>
<a (click)="select('context')" class="btn btn-primary">Link with community</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
</div>
</div>
<div class="card card-inverse text-xs-center" style="background-color:pink;">
<div class="card-block">
<h4 class="card-title">Link with Software</h4>
<p class="card-text">....</p>
<a (click)="select('software')" class="btn btn-primary">Link with software</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
</div>
</div>
</div>
<div *ngIf=" !bulkMode " class="card-block">
<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

@ -1,209 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimResult,ClaimProject, ClaimContext} from '../../../utils/entities/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

@ -1,63 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimContext} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-contexts',
template: `
<div [class]="componentClass" >
<!-- Contexts -->
<!--div *ngIf=" !(inline && hideType == 'context') && contexts" class="concepts" -->
<div>
<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>
`
})
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

@ -1,119 +0,0 @@
import {Component, Input,Output, EventEmitter,ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-datasets',
template: `
<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>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`
})
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

@ -1,68 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimProject} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-projects',
template: `
<div> <!-- [class]="componentClass" >
Projects -->
<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>
<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>
`
})
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

@ -1,124 +0,0 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-publications',
template: `
<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">
<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>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`
})
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

@ -1,81 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-results',
template: `
<!-- Results -->
<div *ngIf=" !(inline && (hideType == 'publication' || hideType == 'dataset' )) && (datasets.length > 0 || publications.length > 0)" 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('result')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
</li>
<claim-selected-publications [publications]="publications" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" >
</claim-selected-publications>
<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>
<claim-selected-datasets [datasets]="datasets" [showAccessRights]="showAccessRights"
[linkToResults]="(bulkMode)?false:true" >
</claim-selected-datasets>
</ul>
</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

@ -1,34 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'my-claims',
template: `
<div *ngIf="user" class="container">
<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>
<claims enableDelete="true" myClaims="true" isAdmin="false" [fetchId]="user" ></claims>
</div>
</div>
<div *ngIf="!user" class="container">
TODO login
</div>
`
})
export class MyClaimsComponent {
constructor () {
}
user:string="argirok@di.uoa.gr";
ngOnInit() {
}
}

View File

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

@ -37,10 +37,6 @@
<div class="uk-text-justify">{{datasetInfo.description}}</div>
</blockquote>
<!--div class="uk-text-right">
<button (click)=" toggleClaimResult()" class = "uk-button uk-button-primary uk-button-mini" >Add Research Results</button>
</div>
<inline-claim-result inlineType ="dataset" [inlineEntity]="result" (datasetAdded)="resultsAdded($event,false)" (publicationAdded)="resultsAdded($event,true)" ></inline-claim-result-->
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
<li class="uk-active">
@ -169,8 +165,7 @@
<dl class="uk-description-list-line functionsSection" *ngIf="datasetInfo.fundedByProjects == undefined">
<dt class="title">Funded By</dt>
</dl>
<!--button (click)="toggleClaimProject()" class = "uk-button uk-button-primary uk-button-mini" >Add Projects</button>
<inline-claim-project *ngIf="result " inlineType ="dataset" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project-->
</li>
<li *ngIf="datasetInfo.contexts != undefined">
<dl class="uk-description-list-line functionsSection" >
@ -191,8 +186,6 @@
<dl class="uk-description-list-line functionsSection" *ngIf="datasetInfo.contexts == undefined">
<dt class="title">Related to </dt>
</dl>
<!--button (click)=" toggleClaimContext()" class = "uk-button uk-button-primary uk-button-mini" >Add Concepts</button>
<inline-claim-context inlineType ="dataset" [inlineEntity]="result" (contextAdded)="contextAdded($event)" ></inline-claim-context-->
</li>
</ul>
</div>

View File

@ -4,9 +4,7 @@ import {DatasetService} from '../../services/dataset.service';
import {DatasetInfo} from '../../utils/entities/datasetInfo';
import {ActivatedRoute} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'
import {InlineClaimContextComponent} from '../../claimPages/inlineClaims/inlineClaimContext.component';
import {InlineClaimProjectComponent} from '../../claimPages/inlineClaims/inlineClaimProject.component';
import {InlineClaimResultComponent} from '../../claimPages/inlineClaims/inlineClaimResult.component';
@Component({
selector: 'dataset',
templateUrl: 'dataset.component.html',
@ -26,10 +24,7 @@ export class DatasetComponent {
private viewsFrameUrl: string;
private downloadsFrameUrl: string;
/*@ViewChild (InlineClaimProjectComponent) inlineClaimProject : InlineClaimProjectComponent ;
@ViewChild (InlineClaimContextComponent) inlineClaimContext : InlineClaimContextComponent ;
@ViewChild (InlineClaimResultComponent) inlineClaimResult : InlineClaimResultComponent ;
*/
public warningMessage = "";
public errorMessage = "";
@ -76,73 +71,7 @@ export class DatasetComponent {
);
}
/********** Methods for Inline Claim of project / dataset ******/
/* toggleClaimProject(){
this.inlineClaimProject.toggle();
}
projectAdded($event){
var projects =$event.value;
if(projects){
for(var i=0; i < projects.length; i++){
if(this.datasetInfo.fundedByProjects == undefined) {
this.datasetInfo.fundedByProjects = new Array<
{ "url": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"funding": string, "inline": boolean
}>();
}
var project =projects[i];
let counter = this.datasetInfo.fundedByProjects.length;
this.datasetInfo.fundedByProjects[counter] = {
"url": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "",
"funding": "", "inline": true
}
this.datasetInfo.fundedByProjects[counter]['url'] =
OpenaireProperties.getsearchLinkToProject()+project.projectId;
this.datasetInfo.fundedByProjects[counter]['acronym'] = project.projectAcronym;
this.datasetInfo.fundedByProjects[counter]['title'] = project.projectName;
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = project.funderName;
}
}
}
toggleClaimContext(){
this.inlineClaimContext.toggle();
}
contextAdded($event){
var contexts =$event.value;
if(contexts){
for(var i=0; i < contexts.length; i++){
var context = contexts[i];
if(!this.datasetInfo.contexts){
this.datasetInfo.contexts = new Array<
{ "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}>();
}
var position:number = this.datasetInfo.contexts.length;
this.datasetInfo.contexts[ position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", "inline": true };
this.datasetInfo.contexts[position]['labelContext'] = context.community;
this.datasetInfo.contexts[position]['labelCategory'] = context.category;
this.datasetInfo.contexts[position]['labelConcept'] = context.concept.label;
}
}
}
toggleClaimResult(){
this.inlineClaimResult.toggle();
}
resultsAdded($event, isPublication:boolean){
var results =$event.value;
//TODO
}
*/
showChange($event) {
this.showAllReferences=$event.value;
}

View File

@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {UtilsModule} from '../utils/utils.module';
import {ClaimModule} from '../claimPages/claim.module';
import {ServicesModule} from '../services/services.module';
import {SearchModule} from '../searchPages/search.module';
@ -40,7 +39,6 @@ import { LandingRoutingModule } from './landing-routing.module';
//MaterialModule.forRoot(),
CommonModule, FormsModule,
UtilsModule,
ClaimModule,
ServicesModule,
SearchModule,
LandingRoutingModule
@ -55,7 +53,6 @@ import { LandingRoutingModule } from './landing-routing.module';
],
exports: [
DataProviderComponent, PersonComponent, ProjectComponent, PublicationComponent, OrganizationComponent, DatasetComponent,
// TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent, ShowAuthorsComponent, ShowIdentifiersComponent, ShowIdentifiersComponent,ShowSubjectsComponent,
]
})
export class LandingModule { }

View File

@ -49,10 +49,6 @@
</span>
</dd>
</dl>
<!--div class="uk-text-right">
<button (click)=" toggleClaimResult()" class = "uk-button uk-button-primary uk-button-mini" >Add Research Results</button>
</div>
<inline-claim-result inlineType ="'project'" [inlineEntity]=project (datasetAdded)="resultsAdded($event,false)" (publicationAdded)="resultsAdded($event,true)" ></inline-claim-result-->
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
@ -176,13 +172,7 @@
[filename]="'publications.csv'">
</export>
</li>
<!--li class="list-group-item">
<div class="text-center">
<a class="btn btn-primary" href="/linking">
Link Research Results
</a>
</div>
</li-->
<li>
<div class="uk-text-center">
<a class="uk-button uk-button-primary uk-button-mini" href="/deposit-publications">

View File

@ -3,8 +3,6 @@ import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Params} from '@angular/router';
import {ProjectService} from '../../services/project.service';
import {ProjectInfo} from '../../utils/entities/projectInfo';
import {InlineClaimResultComponent} from '../../claimPages/inlineClaims/inlineClaimResult.component';
import { SearchPublicationsComponent } from '../../searchPages/simple/searchPublications.component';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component';
@ -32,10 +30,6 @@ export class ProjectComponent{
private chartDatasourcesUrl: string;
private project ;
/*@ViewChild (InlineClaimResultComponent) inlineClaimResult : InlineClaimResultComponent ;*/
public warningMessage = "";
public errorMessage = "";
@ -90,12 +84,6 @@ export class ProjectComponent{
ngOnDestroy() {
this.sub.unsubscribe();
// if(this.subPublications != undefined) {
// this.subPublications.unsubscribe();
// }
// if(this.subDatasets != undefined) {
// this.subDatasets.unsubscribe();
// }
this.subDatasetsCount.unsubscribe();
}
@ -111,9 +99,7 @@ export class ProjectComponent{
private searchDatasetsInit() {
if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) {
// this.subDatasets = this.route.queryParams.subscribe(params => {
this.searchDatasets();
// });
}
}
@ -126,7 +112,6 @@ export class ProjectComponent{
this.projectInfo = data;
this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate };
//this.projectName = (this.projectInfo.acronym != undefined && this.projectInfo.acronym != '') ? this.projectInfo.acronym : this.projectInfo.title;
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projViewsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projDownloadsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
//stats tab charts
@ -141,20 +126,5 @@ export class ProjectComponent{
);
}
/*
********* Methods for Inline Claim of results *****
*/
/* toggleClaimResult(){
this.inlineClaimResult.toggle();
}
publicationAdded($event){
//TODO
}
datasetAdded($event){
var contexts =$event.value;
//TODO
}*/
}

View File

@ -54,10 +54,6 @@
<blockquote *ngIf="publicationInfo.description != ''">
<div class="uk-text-justify">{{publicationInfo.description}}</div>
</blockquote>
<!--div class="uk-text-right">
<button (click)=" toggleClaimResult()" class = "uk-button uk-button-primary uk-button-mini" >Add Research Results</button>
</div>
<inline-claim-result inlineType ="publication" [inlineEntity]="result" (datasetAdded)="resultsAdded($event,false)" (publicationAdded)="resultsAdded($event,true)" ></inline-claim-result-->
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
<li class="uk-active">
@ -369,9 +365,7 @@
</a>
</dd>
</dl>
<!--button (click)="toggleClaimProject()" class = "uk-button uk-button-primary uk-button-mini" >Add Projects</button>
<inline-claim-project *ngIf="result " inlineType ="publication" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project-->
</li>
<li *ngIf="publicationInfo.contexts != undefined">
<dl class="uk-description-list-line functionsSection" >
@ -389,12 +383,7 @@
</mark>
</dd>
</dl>
<!--dl class="functionsSection" *ngIf="publicationInfo.contexts == undefined">
<dt class="title">Related to </dt>
</dl>
<button (click)=" toggleClaimContext()" class = "uk-button uk-button-primary uk-button-mini" >Add Concepts</button>
<inline-claim-context inlineType ="publication" [inlineEntity]="result" (contextAdded)="contextAdded($event)" ></inline-claim-context-->
</li>
<li *ngIf="publicationInfo.collectedFrom != undefined">

View File

@ -4,9 +4,6 @@ import {PublicationService} from '../../services/publication.service';
import {PublicationInfo} from '../../utils/entities/publicationInfo';
import {ActivatedRoute} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {InlineClaimContextComponent} from '../../claimPages/inlineClaims/inlineClaimContext.component';
import {InlineClaimProjectComponent} from '../../claimPages/inlineClaims/inlineClaimProject.component';
import {InlineClaimResultComponent} from '../../claimPages/inlineClaims/inlineClaimResult.component';
@Component({
selector: 'publication',
@ -39,10 +36,6 @@ export class PublicationComponent {
public result ;
/* @ViewChild (InlineClaimProjectComponent) inlineClaimProject : InlineClaimProjectComponent ;
@ViewChild (InlineClaimContextComponent) inlineClaimContext : InlineClaimContextComponent ;
@ViewChild (InlineClaimResultComponent) inlineClaimResult : InlineClaimResultComponent ;
*/
public warningMessage = "";
public errorMessage = "";
@ -105,76 +98,7 @@ export class PublicationComponent {
);
}
}
/*
********* Methods for Inline Claim of project / publication *****
*/
/* toggleClaimProject(){
this.inlineClaimProject.toggle();
}
projectAdded($event){
var projects =$event.value;
if(projects){
for(var i=0; i < projects.length; i++){
if(this.publicationInfo.fundedByProjects == undefined) {
this.publicationInfo.fundedByProjects = new Array<
{ "url": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"funding": string, "code": string, "inline": boolean
}>();
}
var project =projects[i];
let counter = this.publicationInfo.fundedByProjects.length;
this.publicationInfo.fundedByProjects[counter] = {
"url": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "",
"funding": "", "code": "", "inline": true
}
this.publicationInfo.fundedByProjects[counter]['url'] =
OpenaireProperties.getsearchLinkToProject() + project.projectId;
this.publicationInfo.fundedByProjects[counter]['acronym'] = project.projectAcronym;
// TODO ARGIRO : code is undefined? this field was missing before
this.publicationInfo.fundedByProjects[counter]['code'] = "-";
this.publicationInfo.fundedByProjects[counter]['title'] = project.projectName;
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = project.funderName;
}
}
}
toggleClaimContext(){
this.inlineClaimContext.toggle();
}
contextAdded($event){
var contexts =$event.value;
if(contexts){
for(var i=0; i < contexts.length; i++){
var context = contexts[i];
if(!this.publicationInfo.contexts){
this.publicationInfo.contexts = new Array<
{ "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}>();
}
var position:number = this.publicationInfo.contexts.length;
this.publicationInfo.contexts[ position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: true };
this.publicationInfo.contexts[position]['labelContext'] = context.community;
this.publicationInfo.contexts[position]['labelCategory'] = context.category;
this.publicationInfo.contexts[position]['labelConcept'] = context.concept.label;
}
}
}
toggleClaimResult(){
this.inlineClaimResult.toggle();
}
resultsAdded($event, isPublication:boolean){
var results =$event.value;
//TODO
}
*/
showChange($event) {
this.showAllReferences=$event.value;
}

View File

@ -1,140 +0,0 @@
import {Injectable} from '@angular/core';
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Claim} from '../utils/entities/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

@ -1,88 +0,0 @@
import {Injectable} from '@angular/core';
import {Jsonp, URLSearchParams,ResponseOptions} from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Claim} from '../utils/entities/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

@ -5,7 +5,6 @@ import { FormsModule } from '@angular/forms';
import {RefineResultsUtils} from './servicesUtils/refineResults.class';
//Services
import { ContextsService} from './contexts.service';
import { DatasetService} from './dataset.service';
import { OpenaireProjectsService } from './openaireProjects.service';
import { OrganizationService} from './organization.service';
@ -38,7 +37,7 @@ import {LoginService} from './login.service';
declarations: [
],
providers:[
ContextsService, DatasetService, OpenaireProjectsService,OrganizationService,
DatasetService, OpenaireProjectsService,OrganizationService,
PersonService, ProjectService, PublicationService, MetricsService,
SearchCrossrefService, SearchCrossrefService, SearchDataciteService,
SearchOrcidService, SearchPublicationsService, SearchDataprovidersService,

View File

@ -76,51 +76,8 @@ import 'rxjs/Rx';
</div>
</li>
<!--li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
<a href="">Linking</a>
<div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom" aria-hidden="true" style="top: 40px; left: 0px;" tabindex="">
<ul class="uk-nav uk-nav-navbar">
<li><a href="/claims">Claims Admin</a></li>
<li><a href="/myclaims">My Claims</a></li>
<li><a href="/linking">Linking</a></li>
<li><a href="/bulk-linking">Bulk Linking</a></li>
</ul>
</div>
</li-->
<!--li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
<a href="">Landing Pages</a>
<div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom" aria-hidden="true" style="top: 40px; left: 0px;" tabindex="">
<ul class="uk-nav uk-nav-navbar">
<li><a href = "search/publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication </a></li>
<li><a href = "search/dataset?datasetId=datacite____::430ac1c41b7f99b7b543ef737dc41a74" >Dataset </a></li>
<li><a href = "search/project?projectId=corda_______::2c37878a0cede85dbbd1081bb9b4a2f8" >Project </a></li>
<li><a href = "search/person?personId=datacite____::9da3a037961b36a634fcd40ab0bf6535" >Person </a></li>
<li><a href = "search/organization?organizationId=dedup_wf_001::f686277c34bf457bbdf19e03589b5e81" >Organization </a></li>
<li><a href = "search/dataprovider?datasourceId=opendoar____::798ed7d4ee7138d49b8828958048130a" >Data Provider </a></li>
</ul>
</div>
</li-->
</ul>
<!--div class="uk-navbar-flip">
<ul class="uk-navbar-nav uk-hidden-small">
<li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
<!-- This is a button toggling the modal -->
<!--a href="#login" data-uk-modal="center: true">Sign In</a-->
<!-- This is the modal -->
<!--div id="login" class="uk-modal">
<div class="uk-modal-dialog">
<a class="uk-modal-close uk-close"></a>
<login></login>
</div>
</div>
</li>
</ul>
</div-->
<a href="#offcanvas-mainmenu" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas="{mode:'slide'}"></a>
<div class="uk-navbar-brand uk-navbar-center uk-visible-small"><img src="assets/newlogo.png" class="uk-responsive-height" title="OpenAIRE" alt="OpenAIRE" ></div>
@ -128,7 +85,7 @@ import 'rxjs/Rx';
</nav>
<div id="offcanvas-mainmenu" class="uk-offcanvas " aria-hidden="false">

View File

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

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

View File

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

@ -14,8 +14,6 @@ import {SearchResult} from './searchResult';
import {DataProviderInfo} from './dataProviderInfo';
import {Metrics} from './metrics';
import {ClaimResult, ClaimProject, ClaimContext} from './claimEntities.class';
@NgModule({
imports: [ CommonModule, FormsModule ],
declarations: [

View File

@ -1,21 +0,0 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'claimTextFilter'
})
export class ClaimTextFilterPipe implements PipeTransform {
transform(value: any, filter: string): any {
console.info('ClaimTextFilterPipe word to filter : '+filter);
filter = filter?filter.toLocaleLowerCase():'';
return filter ? value.filter(claim=> (
claim.sourceType.toLocaleLowerCase().indexOf(filter)!=-1|| //sourceType
claim.targetType.toLocaleLowerCase().indexOf(filter)!=-1|| //targetType
claim.userMail.toLocaleLowerCase().indexOf(filter)!=-1|| //mail
((claim.source.title && claim.source.title.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.source.name && claim.source.name.toLocaleLowerCase().indexOf(filter)!=-1))|| //source title
((claim.target.title && claim.target.title.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.target.name && claim.target.name.toLocaleLowerCase().indexOf(filter)!=-1))|| //target title
((claim.source.funderName && claim.source.funderName.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.source.funderName && claim.source.funderName.toLocaleLowerCase().indexOf(filter)!=-1))|| //source funder name
((claim.target.funderName && claim.target.funderName.toLocaleLowerCase().indexOf(filter)!=-1)||(claim.target.funderName && claim.target.funderName.toLocaleLowerCase().indexOf(filter)!=-1)) //target funder name
)) : value;
}
}

View File

@ -1,35 +0,0 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'claimTypeFilter'})
export class ClaimTypeFilterPipe implements PipeTransform {
transform(value: any, publication:boolean,dataset:boolean,project:boolean,context:boolean) : any {
let filter = publication;
console.info('ClaimTypeFilterPipe types to show : '+(publication?'publication ':' ')+(dataset?'dataset ':' ')+(project?'project ':' ')+(context?'context ':' '));
return (value)?value.filter((claim) =>{
let filter =publication;
if(publication||dataset||project||context) {
let filter = publication
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('publication')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('publication')!=-1 )) {
return true;
}
filter = dataset;
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('dataset')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('dataset')!=-1 )) {
return true;
}
filter = project;
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('project')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('project')!=-1 )) {
return true;
}
filter = context;
if(filter && (claim.sourceType.toLocaleLowerCase().indexOf('context')!=-1 || claim.targetType.toLocaleLowerCase().indexOf('context')!=-1 )) {
return true;
}
return false;
}else{
return true;
}
}):value;
}
}

View File

@ -50,7 +50,7 @@ export class OpenaireProperties {
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/";
// private static searchServiveURL = "http://services.openaire.eu:8380/search/";
private static searchServiveURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
// private static searchServiveURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
private static csvAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2/api/";//publications?format=csv

View File

@ -10,7 +10,7 @@
* ];
**/
export const routes: string[] = [
'claims','claim','myclaims','linking','bulk-linking','search/find',
'search/find',
'search/person','search/publication','search/project','search/dataset','search/dataprovider','search/organization',
'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',