Adding new functionalities (add orcid pub, add dataset, access rights, add and remove entities from selection lists, ) - better layout for linking

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43017 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-06-22 14:08:32 +00:00
parent 475025f4cb
commit ed65181226
11 changed files with 517 additions and 283 deletions

View File

@ -45,38 +45,9 @@ import 'rxjs/Rx';
<li><a [routerLink]=" ['/Claims']">Claims</a></li> <li><a [routerLink]=" ['/Claims']">Claims</a></li>
<li><a [routerLink]=" ['/Linking']">Linking</a></li> <li><a [routerLink]=" ['/Linking']">Linking</a></li>
<li><a [routerLink]=" ['/Home']">Home</a></li> <li><a [routerLink]=" ['/Home']">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul> </ul>
</div><!-- /.navbar-collapse --> </div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</nav> </nav>

View File

@ -8,42 +8,33 @@ import {ContextsService} from '../../services/contexts.service';
@Component({ @Component({
selector: 'claim-contexts', selector: 'claim-contexts',
template: ` template: `
<div class="container" > <div class="panel" >
<div class="input-field col s12"> <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}}
</div> </button>
<div class="dropdown"> <ul class="dropdown-menu" aria-labelledby="communityDropDown">
<button class="btn btn-default dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
{{selectedCommunityLabel}} <li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
</button> </ul>
<ul class="dropdown-menu" aria-labelledby="communityDropDown"> </div>
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li> <div class="input-group-btn ">
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li> <button class="btn btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCategoryLabel}}
</ul> </button>
</div> <ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<div class="dropdown"> <li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
<button class="btn btn-default dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
{{selectedCategoryLabel}}
</button> </ul>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown"> </div>
<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> <input id="community" type="text" class="validate filter-input form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
</div> </div>
<!-- <select [(ngModel)]="selectedCommunity" (ngModelChange)="communityChanged()" >
<option [ngValue]="'0'">Community:</option>
<option *ngIf="communities" [ngValue]="communities.id">{{communities.label}}</option>
</select>
<select [(ngModel)]="selectedCategory" (ngModelChange)="categoryChanged()" >
<option [ngValue]="'0'">Category:</option>
<option *ngFor="let category of categories" [ngValue]="category.id">{{category.label}}</option>
</select>-->
<h4>Select concepts:</h4>
<input id="community" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
<div class="suggestions" *ngIf="filteredList.length > 0"> <div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" > <ul class="list-group" >
<li class="list-group-item" *ngFor=" let item of filteredList"> <li class="list-group-item" *ngFor=" let item of filteredList">
@ -51,14 +42,9 @@ import {ContextsService} from '../../services/contexts.service';
</li> </li>
</ul> </ul>
</div> </div>
<div class="selections" *ngIf="selectedList.length > 0"> </div>
<label for="selecteditems">Selected: </label> <div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<ul id ="selecteditems" class="nav nav-pills" *ngFor="let item of selectedList" > <div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
<li role="presentation" (click)="remove(item)">{{item.concept.label}} <span class="badge">X</span>
</li>
</ul>
</div>
</div>
`, `,
providers:[ ContextsService ] providers:[ ContextsService ]
@ -84,16 +70,30 @@ public categories:string[];
selectedCategoryLabel:string ="Category:"; selectedCategoryLabel:string ="Category:";
@Output() selectedCategoryChange = new EventEmitter(); @Output() selectedCategoryChange = new EventEmitter();
public concepts:string[]; public concepts:string[];
public warningMessage = "";
public infoMessage = "";
constructor(private _contextService: ContextsService,myElement: ElementRef) { constructor(private _contextService: ContextsService,myElement: ElementRef) {
this.elementRef = myElement; this.elementRef = myElement;
} }
filter() { filter() {
if (this.query !== ""){ this.warningMessage = "";
this.filteredList = this.concepts.filter(function(el){ this.infoMessage = "";
if(this.selectedCommunityId == "0"){
this.warningMessage = "Please select Community";
}else if (this.query !== ""){
this.warningMessage = "";
this.infoMessage = "";
if(this.selectedCategoryId == "0"){
this.warningMessage = "Specify category for more concepts";
}
this.filteredList = this.concepts.filter(function(el){
return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1; return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
}.bind(this)); }.bind(this));
if(this.filteredList.length == 0 ){
this.infoMessage = "No results found";
}
}else{ }else{
this.filteredList = []; this.filteredList = [];
} }
@ -102,25 +102,40 @@ filter() {
select(item){ select(item){
this.query = ""; this.query = "";
this.filteredList = []; this.filteredList = [];
var index:number =this.selectedList.indexOf(item); var context= { community: this.selectedCommunityLabel, category: this.selectedCategoryLabel, concept: item };
if (index == -1) { var found:boolean = false;
var context= { community: this.selectedCommunityId, category: this.selectedCategoryId, concept: item }; this.warningMessage = "";
for (var _i = 0; _i < this.selectedList.length; _i++) {
let item = this.selectedList[_i];
if(item.concept.id == context.concept.id){
found=true;
this.warningMessage = "Concept already in selected list";
}
}
if (!found) {
this.selectedList.push(context); this.selectedList.push(context);
this.contextsChange.emit({ this.contextsChange.emit({
value: this.selectedList value: this.selectedList
}); });
} }
// var index:number =this.selectedList.indexOf(context);
// if (index == -1) {
// this.selectedList.push(context);
// this.contextsChange.emit({
// value: this.selectedList
// });
// }
} }
remove(item){ // remove(item){
var index:number =this.selectedList.indexOf(item); // var index:number =this.selectedList.indexOf(item);
if (index > -1) { // if (index > -1) {
this.selectedList.splice(index, 1); // this.selectedList.splice(index, 1);
} // }
this.contextsChange.emit({ // this.contextsChange.emit({
value: this.selectedList // value: this.selectedList
}); // });
} // }
handleClick(event){ handleClick(event){
var clickedComponent = event.target; var clickedComponent = event.target;
var inside = false; var inside = false;
@ -138,6 +153,9 @@ getCommunities () {
this._contextService.getCommunities().subscribe( this._contextService.getCommunities().subscribe(
data => { data => {
this.communities = data.communities; this.communities = data.communities;
// var concept= ["{id: this.communities['id'], label: this.communities['label'] }"];
// this.filteredList.push(concept);
// this.concepts.push(concept);
}, },
err => console.error(err) err => console.error(err)
); );
@ -149,6 +167,10 @@ getCommunities () {
data => { data => {
this.categories = data.category; this.categories = data.category;
this.concepts = []; this.concepts = [];
this.filteredList = [];
if (this.query !== ""){
this.filter();
}
}, },
err => console.error(err) err => console.error(err)
@ -160,21 +182,31 @@ getCommunities () {
this._contextService.getConcepts(this.selectedCategoryId, "").subscribe( this._contextService.getConcepts(this.selectedCategoryId, "").subscribe(
data => { data => {
this.concepts = data.concept; this.concepts = data.concept;
if (this.query !== ""){
this.filter();
}
}, },
err => console.error(err) err => console.error(err)
); );
}else{
this.concepts=[];
} }
} }
communityChanged(communityId:string, communityLabel:string){ communityChanged(communityId:string, communityLabel:string){
this.warningMessage = "";
this.infoMessage = "";
this.selectedCommunityId= communityId; this.selectedCommunityId= communityId;
this.selectedCommunityLabel= communityLabel; this.selectedCommunityLabel= communityLabel;
this.getCategories(); this.getCategories();
} }
categoryChanged(categoryId:string, categoryLabel:string){ categoryChanged(categoryId:string, categoryLabel:string){
this.warningMessage = "";
this.infoMessage = "";
this.selectedCategoryId = categoryId; this.selectedCategoryId = categoryId;
this.selectedCategoryLabel = categoryLabel; this.selectedCategoryLabel = categoryLabel;
this.getConcepts(); this.getConcepts();
} }
} }

View File

@ -30,29 +30,48 @@ import {SearchDataciteService} from '../../services/searchDatacite.service';
</form> </form>
</div> </div>
</div> </div>
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
<div class="panel "> <div class="panel ">
<div class=""> <div class="">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{resultsNum}})</a></li> <li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{(dataciteResultsNum==null)?'0':dataciteResultsNum}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire</a></li> <li><a data-toggle="tab" href="#openaire">Openaire ({{(openaireResultsNum==null)?'0':openaireResultsNum}})</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="datacite" class="tab-pane fade in active"> <div id="datacite" class="tab-pane fade in active">
<div> <div>
<div *ngIf="resultsNum != null && resultsNum > 0"> <div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0">
<p > {{resultsNum }} Total Results </p> <p > {{dataciteResultsNum }} Total Results </p>
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="page" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div> </div>
<div *ngIf="dataciteResultsNum == null || dataciteResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
<div > <div >
<p *ngFor=" let item of results "> <publication-title [title]="item.title" [url]="'http://dx.doi.org/'+item.doi" > </publication-title> <button (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi)" type="button" class="btn btn-default">Select</button> </p> <!-- <p *ngFor=" let item of dataciteResults ">
<publication-title [title]="item.title" [url]="'http://dx.doi.org/'+item.doi" > </publication-title>
<button (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi)" type="button" class="btn btn-default">Select</button>
</p>
-->
<ul *ngIf="dataciteResults.length > 0 " class="list-group">
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.doi))?'list-group-item disabled':'list-group-item'" >
<span >
<a *ngIf="item.doi" target="_blank" href="{{'http://dx.doi.org/'+item.doi}}" >{{item.title}}</a>
<span *ngIf="!item.doi" >{{item.title}}</span>
</span>
<span *ngIf="!isSelected(item.doi)" (click)="add(item, item.doi,'dataset','datacite',item.title,'http://dx.doi.org/'+item.doi)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
</li>
</ul>
</div> </div>
</div> </div>
</div> </div>
<div id="openaire" class="tab-pane fade"> <div id="openaire" class="tab-pane fade">
<h3>Menu 1</h3> <div class = "panel-body">
<p>Some content in menu 1.</p> <div class = "alert alert-info " > Under Development....
</div>
<div *ngIf="openaireResultsNum == null || openaireResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
</div> </div>
</div> </div>
</div> </div>
@ -80,51 +99,72 @@ export class ClaimDatasetComponent {
@Input() public selectedDatasets = [] ; @Input() public selectedDatasets = [] ;
@Output() datasetsChange = new EventEmitter(); @Output() datasetsChange = new EventEmitter();
results=[]; dataciteResults=[];
resultsNum : Observable<number> ; dataciteResultsNum : Observable<number> = null;
openaireResults=[];
openaireResultsNum : Observable<number> = null ;
public warningMessage = "";
public infoMessage = "";
searchDatacite (term: string, size : number, page : number) { searchDatacite (term: string, size : number, page : number) {
this.getDataciteResults(term,size,page); this.getDataciteResults(term,size,page);
console.info('searchDatacite in searchDatacite file'); this.warningMessage = "";
this.infoMessage = "";
} }
getDataciteResults (term: string, size : number, page : number) { getDataciteResults (term: string, size : number, page : number) {
console.info("In getDataciteResults (start) "+term); this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
data => { data => {
this.results = data.docs; this.dataciteResults = data.docs;
this.page=page; this.page=page;
this.resultsNum = data.numFound; this.dataciteResultsNum = data.numFound;
}, },
err => console.error(err) err => console.error(err)
); );
console.info("In getDataciteResults (end) "+term); }
}
add(item, itemId,itemType,itemSource,itemTitle, itemUrl){ add(item, itemId,itemType,itemSource,itemTitle, itemUrl){
var result ={id: itemId, type : itemType, source : itemSource, title: itemTitle, url: itemUrl, result: item}; var result ;
if(itemSource == 'datacite'){
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
}else if (itemSource == 'openaire'){
}
var found:boolean = this.isSelected( result.id);
this.warningMessage = "";
if (!found) {
this.selectedDatasets.push(result); this.selectedDatasets.push(result);
var index:number =this.results.indexOf(item);
if (index > -1) {
this.results.splice(index, 1);
}
this.datasetsChange.emit({ this.datasetsChange.emit({
value: this.selectedDatasets value: this.selectedDatasets
}); });
} }else{
remove(item){ this.warningMessage = "Dataset already in selected list";
var index:number =this.selectedDatasets.indexOf(item); }
if (index > -1) {
this.selectedDatasets.splice(index, 1);
this.datasetsChange.emit({
value: this.selectedDatasets
});
}
} }
pageChange($event) { pageChange($event) {
this.page=$event.value; this.page=$event.value;
this.results=[]; this.dataciteResults=[];
this.searchDatacite(this.keyword,10,this.page); this.searchDatacite(this.keyword,10,this.page);
this.warningMessage = "";
this.infoMessage = "";
}
isSelected(id:string){
var found:boolean = false;
this.warningMessage = "";
for (var _i = 0; _i < this.selectedDatasets.length; _i++) {
let item = this.selectedDatasets[_i];
if(item.id == id){
found=true;
break;
}
}
return found;
} }
} }

View File

@ -14,27 +14,35 @@ import {OpenaireProjectsService} from '../../services/openaireProjects.service';
<option [ngValue]="'0'">Funder:</option> <option [ngValue]="'0'">Funder:</option>
<option *ngFor="let funder of funders" [ngValue]="funder.field.field[1]['@value_original']">{{funder.field.field[1]['@value']}}</option> <option *ngFor="let funder of funders" [ngValue]="funder.field.field[1]['@value_original']">{{funder.field.field[1]['@value']}}</option>
</select> --> </select> -->
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
</ul> <form>
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-info dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
</ul>
</div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" -->
<input id="community" type="text" class="form-control" placeholder="Search for Projects" [(ngModel)]=query >
<span class="input-group-btn">
<button type="submit" (click)="filter()" class="btn btn-default">Search</button>
</span>
</div> </div>
<input *ngIf="selectedFunderId != '0'" id="community" type="text" class="form-control" placeholder="Search for Projects" [(ngModel)]=query (keyup)=filter() > </form>
</div>
<div class="suggestions" *ngIf="filteredList.length > 0"> <div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" > <ul class="list-group" >
<li *ngFor=" let item of filteredList" class="list-group-item" > <li *ngFor=" let item of filteredList" class="list-group-item" >
<a (click)="select(item)"> {{item.field[1]['@value']}}- {{item.field[3]['@value']}}</a> <a (click)="select(item)"> {{(item.field[1]['@value'])?item.field[1]['@value']+" - ":""}} {{item.field[3]['@value']}}</a>
</li> </li>
</ul> </ul>
</div> </div>
<!-- <div class="selections" *ngIf="selectedProjects.length > 0"> <!-- <div class="selections" *ngIf="selectedProjects.length > 0">
<label for="selecteditems">Selected: </label> <label for="selecteditems">Selected: </label>
<ul id ="selecteditems" class="nav nav-pills" > <ul id ="selecteditems" class="nav nav-pills" >
@ -45,6 +53,8 @@ import {OpenaireProjectsService} from '../../services/openaireProjects.service';
--> -->
</div> </div>
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
`, `,
providers:[ OpenaireProjectsService ] providers:[ OpenaireProjectsService ]
@ -67,38 +77,49 @@ selectedFunderName:string ="Select funder:";
@Output() cselectedFunderChange = new EventEmitter(); @Output() cselectedFunderChange = new EventEmitter();
public projects:string[]; public projects:string[];
public warningMessage = "";
public infoMessage = "";
constructor(private _projectService: OpenaireProjectsService,myElement: ElementRef) { constructor(private _projectService: OpenaireProjectsService,myElement: ElementRef) {
this.elementRef = myElement; this.elementRef = myElement;
} }
filter() { filter() {
if(this.selectedFunderId != '0' && this.query !== "" && this.query.length >= 3 ){ console.info("Search projects");
if (this.selectedFunderId == '0' ){
this.warningMessage = "Please select a funder first";
this.infoMessage = "";
}else if ( this.query == "" || this.query.length < 3){
this.warningMessage = "Please type a keyword, containing at least 3 characters"
this.infoMessage = "";
}else{
this.warningMessage = "";
this.infoMessage = "";
this._projectService.searchForProjects(this.query, this.selectedFunderId).subscribe( this._projectService.searchForProjects(this.query, this.selectedFunderId).subscribe(
data => { data => {
this.filteredList = data; this.filteredList =(data == null)?[]:data;
this.infoMessage = (data == null)?"No Results found":"";
}, },
err => console.error(err) err => console.error(err)
); );
} }
// if (this.query !== ""){
// this.filteredList = this.concepts.filter(function(el){
// return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
// }.bind(this));
// }else{
// this.filteredList = [];
// }
} }
select(item){ select(item){
this.query = ""; this.query = "";
this.filteredList = []; this.filteredList = [];
var index:number =this.selectedProjects.indexOf(item); var project= { funderId: this.selectedFunderId,funderName: this.selectedFunderName, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] };
if (index == -1) { var index:number =this.selectedProjects.indexOf(project);
//{{item.field[0]['@value']}} - {{item.field[1]['@value']}} var found:boolean = false;
var project= { funderId: this.selectedFunderId, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] }; this.warningMessage = "";
for (var _i = 0; _i < this.selectedProjects.length; _i++) {
let item = this.selectedProjects[_i];
if(item.projectId == project.projectId){
found=true;
this.warningMessage = "Project already in selected list";
}
}
if (!found) {
this.selectedProjects.push(project); this.selectedProjects.push(project);
this.projectsChange.emit({ this.projectsChange.emit({
value: this.selectedProjects value: this.selectedProjects
@ -140,23 +161,14 @@ getFunders () {
getProjects () { getProjects () {
if(this.selectedFunderId != '0'){ if(this.selectedFunderId != '0'){
// this._contextService.getConcepts(this.selectedCategory, "").subscribe(
// data => {
// this.concepts = data.concept;
//
// },
// err => console.error(err)
// );
} }
} }
funderChanged(funderId:string, funderName:string){ funderChanged(funderId:string, funderName:string){
this.selectedFunderId = funderId; this.selectedFunderId = funderId;
this.selectedFunderName = funderName; this.selectedFunderName = funderName;
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName ); console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
this.selectedProjects = [];
} }
// categoryChanged(){
// this.getConcepts();
// }
} }

View File

@ -16,61 +16,76 @@
</div> </div>
</form> </form>
</div> </div>
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
<div class="panel"> <div class="panel">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{crossrefResultsNum}})</a></li> <li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{(crossrefResultsNum)?crossrefResultsNum:0}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire ({{openaireResultsNum}})</a></li> <li><a data-toggle="tab" href="#openaire">Openaire ({{ (openaireResultsNum)?openaireResultsNum:0 }})</a></li>
<li><a data-toggle="tab" href="#orcid">Orcid ({{orcidResultsNum}})</a></li> <li><a data-toggle="tab" href="#orcid">Orcid ({{ (orcidResultsNum)?orcidResultsNum:0}})</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="crossref" class="tab-pane fade in active"> <div id="crossref" class="tab-pane fade in active">
<div> <div>
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0"> <div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0">
<p > {{crossrefResultsNum }} Total Results </p> <paging-no-load [currentPage]="page" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
<paging-no-load [currentPage]="page" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div> </div>
<div > <div >
<p *ngFor=" let item of crossrefResults " [class]=" item.selected?'panel-heading':'panel-body' "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> <button (click)="add(item,'crossref', 'publication', item.URL, item.title)" type="button" class="btn btn-default">Select</button> </p> <ul *ngIf="crossrefResults.length > 0 " class="list-group">
</div> <li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'list-group-item disabled':'list-group-item'">
<span >
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" >{{item.title}}</a>
<span *ngIf="!item.URL" >{{item.title}}</span>
</span>
<span *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
</li>
</ul>
<div *ngIf="crossrefResults.length == 0" class = "alert alert-info " > No results found </div>
</div>
</div> </div>
</div> </div>
<div id="openaire" class="tab-pane fade"> <div id="openaire" class="tab-pane fade">
<div class = "panel-body">
<p>TODO put openaire results here...</p> <div class = "alert alert-info " > Under Development....
</div>
</div>
</div> </div>
<div id="orcid" class="tab-pane fade"> <div id="orcid" class="tab-pane fade">
<p *ngIf="orcidResultsNum == null"> No authors found for keyword: {{keyword}} </p> <p *ngIf="orcidResultsNum == null"> No authors found for keyword: {{keyword}} </p>
<div *ngIf="orcidResultsNum != null"> <div *ngIf="orcidResultsNum != null" class="panel-body">
<p> Not the right author? Choose one of these: </p> <div class = "alert alert-warning " > Not the right author? Choose one of these:
<div class="dropdown"> <span class="dropdown">
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}</button> <button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}</button>
<ul class="dropdown-menu" aria-labelledby="orcidDropDown"> <ul class="dropdown-menu" aria-labelledby="orcidDropDown">
<li *ngFor=" let item of authorIds let i = index" (click)="getOrcidResultsById(i)" role="button"> <li *ngFor=" let item of authorIds let i = index" (click)="getOrcidResultsById(i)" role="button">
{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} {{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}}
</li> </li>
</ul> </ul>
</span>
</div> </div>
<div> <span>Results for
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
<br/> </span>
<h4> {{orcidResultsNum }} Total Results for author
<a target="_blank" href="http://orcid.org/{{authorId}}"> {{authorGivenName}} {{authorFamilyName}} : {{authorId}} </a>
</h4>
<br/>
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " > <div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " >
<paging-no-load [currentPage]="page" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="page" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
</div> </div>
<div >
<div *ngIf=" orcidResultsNum > 0"> <ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="list-group">
<p *ngFor=" let item of orcidResultsToShow "> {{item['work-title']['title'].value}} ({{item['publication-date']['year'].value}}) </p> <li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+item['put-code']))?'list-group-item disabled':'list-group-item'">
</div> <span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
</div> <span *ngIf="!isSelected(authorId+item['put-code'])" (click)="add(item,authorId+item['put-code'],'orcid', 'publication', '', item['work-title']['title'].value)" aria-hidden="true" class= " btn glyphicon glyphicon-plus"></span>
</li>
</ul>
<div *ngIf="orcidResultsNum == 0" class = "alert alert-info " > No results found </div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -56,6 +56,9 @@ export class ClaimPublicationComponent {
authorsNum : number ; authorsNum : number ;
public warningMessage = "";
public infoMessage = "";
searchOrcid (term: string) { searchOrcid (term: string) {
this.authorIds = new Array<string>(); this.authorIds = new Array<string>();
this.authorGivenNames = new Array<string>(); this.authorGivenNames = new Array<string>();
@ -151,7 +154,9 @@ export class ClaimPublicationComponent {
} }
search(term: string, size : number, page : number){ search(term: string, size : number, page : number){
this.getCrossrefResults(term,size,page); this.warningMessage = "";
this.infoMessage = "";
this.getCrossrefResults(term,size,page);
this.searchOrcid(term); this.searchOrcid(term);
} }
@ -170,25 +175,30 @@ search(term: string, size : number, page : number){
} }
add(item, itemSource, itemType, itemUrl, itemTitle){ add(item, id, itemSource, itemType, itemUrl, itemTitle){
var result ={id: item.DOI, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''}; var result ;
console.info("Add result:"+result.id+" "+result.source+" "+item); if(itemSource == 'crossref'){
var index:number =this.selectedPublications.indexOf(result); result = {id: id, type :itemType, source : 'openaire', title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
item.selected=true; }else if (itemSource == 'orcid'){
if (index== -1) { result = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
this.selectedPublications.push(result); }else if (itemSource == 'openaire'){
}
var found:boolean = this.isSelected(result.id);
this.warningMessage = "";
if (!found) {
this.selectedPublications.push(result);
this.publicationsChange.emit({
value: this.selectedPublications
});
}else{
this.warningMessage = "Publication already in selected list";
} }
//do not remove it from the list
// var index:number =this.crossrefResults.indexOf(item);
// if (index > -1) {
// this.crossrefResults.splice(index, 1);
// }
this.publicationsChange.emit({
value: this.selectedPublications
});
} }
remove(item){ remove(item){
this.warningMessage = "";
this.infoMessage = "";
var index:number =this.selectedPublications.indexOf(item); var index:number =this.selectedPublications.indexOf(item);
item.selected=false; item.selected=false;
if (index > -1) { if (index > -1) {
@ -210,12 +220,19 @@ search(term: string, size : number, page : number){
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size); this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
} }
isSelected(item){ isSelected(id:string){
var index:number =this.selectedPublications.indexOf(item);
if (index > -1) { var found:boolean = false;
return true; this.warningMessage = "";
}else{ for (var _i = 0; _i < this.selectedPublications.length; _i++) {
return false; let item = this.selectedPublications[_i];
} if(item.id == id){
found=true;
this.warningMessage = "Publication already in selected list";
}
}
return found;
} }
} }

View File

@ -11,7 +11,7 @@ import {ClaimsService} from '../../services/claims.service';
directives: [...ROUTER_DIRECTIVES], directives: [...ROUTER_DIRECTIVES],
template: ` template: `
<button *ngIf="claiming == false" (click)="insert()">Claim</button> <button *ngIf="claiming == false" (click)="insert()" class="btn btn-primary" style="float:right">Finish</button>
<div *ngIf="error == true"> <div class="alert alert-warning" role="alert">{{errorMessage}}</div> <div *ngIf="error == true"> <div class="alert alert-warning" role="alert">{{errorMessage}}</div>
</div> </div>

View File

@ -23,8 +23,16 @@ import {LinkingHomeComponent} from './linkingHome.component';
<div class="page-header"> <div class="page-header">
<h1>Link research resutls</h1> <h1>Link research resutls</h1>
</div> </div>
<linking-home *ngIf=" show == 'home' " (chosenTypeChange)="chosenTypeChange($event)" ></linking-home> <linking-home *ngIf=" show == 'home' " (linkTypeChange)="linkTypeChange($event)" ></linking-home>
<div *ngIf=" show != 'home' " > <div *ngIf=" show != 'home' " >
<ol class="breadcrumb">
<li *ngIf="linkType == 'project'" [class]="(show == 'project' )?'active':''"><a *ngIf="show != 'project'" (click)="showChangedType('project')" >Project</a><span *ngIf="show == 'project'">Project</span></li>
<li *ngIf="linkType == 'context'" [class]="(show == 'context' )?'active':''"><a *ngIf="show != 'context'" (click)="showChangedType('context')" >Context</a><span *ngIf="show == 'context'">Context</span></li>
<li *ngIf="linkType == 'software'" [class]="(show == 'software' )?'active':''"><a *ngIf="show != 'software'" (click)="showChangedType('software')" >Software</a><span *ngIf="show == 'software'">Software</span> </li>
<li [class]="(show == 'result' || show == 'publication' || show == 'dataset')?'active':''"><a *ngIf="show != 'result' && show != 'publication' && show != 'dataset'" (click)="showChangedType('result')" >Research Result</a><span *ngIf="show == 'result' || show == 'publication' || show == 'dataset'">Research Result</span></li>
<li [class]="(show == 'claim' )?'active':''"><a *ngIf="show != 'claim'">Link</a><span *ngIf="show == 'claim'" (click)="showChangedType('claim')">Link</span> </li>
</ol>
<div *ngIf=" show != 'claim'" class="row" > <div *ngIf=" show != 'claim'" class="row" >
<div class="col-sm-6"> <div class="col-sm-6">
<div *ngIf=" show=='result' " > <div *ngIf=" show=='result' " >
@ -38,7 +46,7 @@ import {LinkingHomeComponent} from './linkingHome.component';
</md-radio-group> --> </md-radio-group> -->
<div class="input-group"> <div class="input-group">
<div class="input-group-btn"> <div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} </button> <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"> <ul class="dropdown-menu">
<li (click)="typeChanged('publication')" ><a >Publication</a></li> <li (click)="typeChanged('publication')" ><a >Publication</a></li>
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li> <li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
@ -78,16 +86,18 @@ import {LinkingHomeComponent} from './linkingHome.component';
</div>--> </div>-->
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" > </claim-selected> <claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show"
(projectsChange)="projectsChange($event)" (contextsChange)="contextsChange($event)" (datasetsChange)="datasetsChange($event)"
(publicationsChange)="publicationsChange($event)" (showChange)="showChange($event)" > </claim-selected>
</div> </div>
</div> </div>
<div *ngIf=" show == 'claim'" > <div *ngIf=" show == 'claim'" >
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [showAccessRights]="'true'" > </claim-selected> <claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [show]="show" (showChange)="showChange($event)" [showAccessRights]="'true'" > </claim-selected>
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects"></claim-insert> <claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects"></claim-insert>
</div> </div>
<button class="btn btn-primary" *ngIf="show != 'home'" (click)="prev()">Prev</button> <button class="btn btn-primary" *ngIf="show != 'home'" (click)="prev()">Prev</button>
<button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()">Next</button> <button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()" >Next</button>
</div> </div>
</div> </div>
@ -107,10 +117,10 @@ export class LinkingComponent {
publications=[]; publications=[];
datasets=[]; datasets=[];
show = "home"; show = "home";
searchType="publication"; searchType="publication"; //publication or dataset
date='8-6-2016'; date='8-6-2016';
keyword: string = ""; keyword: string = "";
chosenType:string ="project"; linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
ngOnInit() { ngOnInit() {
} }
@ -130,11 +140,11 @@ export class LinkingComponent {
} }
prev(){ prev(){
if(this.show == 'result'){ if(this.show == 'result'){
if(this.chosenType == 'project'){ if(this.linkType == 'project'){
this.show='project'; this.show='project';
}else if(this.chosenType == 'context'){ }else if(this.linkType == 'context'){
this.show='context'; this.show='context';
}else if(this.chosenType == 'software'){ }else if(this.linkType == 'software'){
this.show='software'; this.show='software';
}else{ }else{
this.show='home'; this.show='home';
@ -185,9 +195,23 @@ export class LinkingComponent {
typeChanged(type:string) { typeChanged(type:string) {
this.searchType = type; this.searchType = type;
} }
chosenTypeChange($event) { linkTypeChange($event) {
this.chosenType = this.show; this.linkType =$event.value;
this.show=$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,4 +1,4 @@
import {Component, Output, EventEmitter } from '@angular/core'; import {Component, Output, EventEmitter} from '@angular/core';
import {RouteConfig, ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated'; import {RouteConfig, ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated';
import {JSONP_PROVIDERS} from '@angular/http'; import {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
@ -42,13 +42,12 @@ import {Observable} from 'rxjs/Observable';
}) })
export class LinkingHomeComponent { export class LinkingHomeComponent {
@Output() chosenTypeChange = new EventEmitter(); @Output() linkTypeChange = new EventEmitter();
chosenType:string = "result"; linkType:string = "project";
select(type:string){ select(type:string){
console.info('Changed!'+type); this.linkType = type;
this.chosenType = type; this.linkTypeChange.emit({
this.chosenTypeChange.emit({ value: this.linkType
value: this.chosenType
}); });
} }

View File

@ -1,60 +1,130 @@
import {Component, Input,Output} from '@angular/core'; import {Component, Input,Output, EventEmitter} from '@angular/core';
import {PublicationTitleFormatter} from '../../common/publicationTitleFormatter.component'; import {PublicationTitleFormatter} from '../../common/publicationTitleFormatter.component';
@Component({ @Component({
selector: 'claim-selected', selector: 'claim-selected',
template: ` template: `
<div *ngIf="publications.length > 0 " class="publications" >
<h5>Selected Publications:</h5> <div [class]="(showAccessRights== 'true' )?'row':''" >
<i *ngFor="let pub of publications" >Source: {{pub.source}} - Title: <publication-title [title]="pub.title" [url]="pub.url" > </publication-title> <div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
<p *ngIf="showAccessRights== 'true'" >
<select [(ngModel)]="pub.accessRights"> <div class="concepts" >
<option *ngFor="let type of accessTypes" [value]="type">{{type}}</option> <ul class="list-group">
</select> <li class="list-group-item list-group-item-success">Selected Concepts ({{(contexts.length)}})
<!--<div class="dropdown"> <span title="Add More Concepts" (click)="showType('context')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> </li>
{{pub.accessRights}} <li class="list-group-item" *ngFor="let context of contexts" >
<span class="caret"></span> <span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
</button> <span (click)="removeContext(context)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let type of accessTypes" ><a href="#" (click)="pub.accessRights = type " >{{type}} </a></li> </li>
</ul> <li *ngIf="contexts.length == 0 " class="list-group-item">There are no contexts</li>
</div>--> </ul>
</p> </div>
</i>
</div> </div>
<div *ngIf="contexts.length > 0 " class="concepts" > <div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
<ul class="list-group">
<li class="list-group-item list-group-item-success">Selected Concepts:</li> <div class="projects" >
<li class="list-group-item" *ngFor="let context of contexts" >{{context.community}} - Category: {{context.category}} </li> <ul class="list-group">
</ul> <li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
</div> <span title="Add More Projects" (click)="showType('project')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
<div *ngIf="projects.length > 0 " class="conprojectscepts" >
<ul class="list-group">
<li class="list-group-item list-group-item-info">Selected Projects</li>
<li class="list-group-item" *ngFor="let project of projects">
<span class="glyphicons glyphicons-remove"></span>
{{project.projectAcronym}} - {{project.projectName}}
</li> </li>
</ul> <li class="list-group-item" *ngFor="let project of projects">
<span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'()'+project.projectAcronym+')':''}}</span>
<span (click)="removeProject(project)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
</li>
<li *ngIf="projects.length == 0 " class="list-group-item">There are no projects</li>
</ul>
</div>
</div> </div>
<div *ngIf="datasets.length > 0 " class="datasets" > </div>
<h5>Selected datasets:</h5> <!--<div *ngIf="contexts.length == 0 " class="concepts" >
<i *ngFor="let dataset of datasets" > Datasets: Source: {{dataset.source}} - Title: <publication-title [title]="dataset.title" [url]="dataset.url" > </publication-title> </i>
</div>
<div *ngIf="projects.length == 0 " class="conprojectscepts" >
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item list-group-item-info">Selected Projects:</li> <li class="list-group-item list-group-item-success">Selected Concepts
<li class="list-group-item">Please use the form on the left to select a project</li> <span title="Add More Concepts" (click)="showType('context')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li class="list-group-item">There are no contexts</li>
</ul> </ul>
</div> </div>
<div *ngIf="contexts.length == 0 " class="concepts" > <div *ngIf="projects.length == 0 " class="projects" >
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item list-group-item-success">Selected Concepts:</li> <li class="list-group-item list-group-item-info">Selected Projects
<li class="list-group-item">Please use the form on the left to select a concept</li> <span title="Add More Projects" (click)="showType('project')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li class="list-group-item">There are no projects</li>
</ul> </ul>
</div> </div>
<!-- KI <i>TODO: add more types</i> -->
`, <div *ngIf="publications.length == 0 && datasets.length == 0" class="results" >
<ul class="list-group">
<li class="list-group-item disabled">Selected Research Results
<span title="Add More Research Results" (click)="showType('result')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li class="list-group-item">There are no Research Results </li>
</ul>
</div>
-->
<div class="publications" >
<ul class="list-group">
<li class="list-group-item disabled "> Research Results ({{(datasets.length+publications.length)}})
<span title="Add More Research Results" (click)="showType('result')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li *ngIf="publications.length == 0 && datasets.length == 0" class="list-group-item">There are no Research Results </li>
<li class="list-group-item list-group-item-warning ">{{publications. length }} Selected Publications:
<span title="Add More Publications" (click)="showType('publication')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li *ngFor="let pub of publications" class="list-group-item">
<span *ngIf="showAccessRights == 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
<span >
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" >{{pub.title}}</a>
<span *ngIf="!pub.url" >{{pub.title}}</span>
</span>
<span *ngIf="showAccessRights== 'true' && pub.source != 'openaire' " class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="{{'dropdown'+pub.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{pub.accessRights}}
</button>
<ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+pub.id">
<li *ngFor="let type of accessTypes" ><a (click)="pub.accessRights = type " >{{type}} </a></li>
</ul>
</span>
<span *ngIf="showAccessRights== 'true' && pub.source == 'openaire' " >
<button class="btn btn-default disabled " type="button" >
{{pub.accessRights}}
</button>
</span>
<span *ngIf="showAccessRights != 'true'" (click)="removePublication(pub)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
</li>
<li class="list-group-item list-group-item-warning "> {{datasets.length}} Selected Research Data:
<span title="Add More Research Data" (click)="showType('dataset')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</li>
<li *ngFor="let dataset of datasets" class="list-group-item">
<span *ngIf="showAccessRights == 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
<span >
<a *ngIf="dataset.url" target="_blank" href="{{dataset.url}}" >{{dataset.title}}</a>
<span *ngIf="!dataset.url" >{{dataset.title}}</span>
</span>
<span *ngIf="showAccessRights== 'true' && dataset.source != 'openaire'" class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="{{'dropdown'+dataset.id}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{dataset.accessRights}}
</button>
<ul class="dropdown-menu" [attr.aria-labelledby]="'dropdown'+dataset.id">
<li *ngFor="let type of accessTypes" ><a (click)="dataset.accessRights = type " >{{type}} </a></li>
</ul>
</span>
<span *ngIf="showAccessRights== 'true' && dataset.source == 'openaire' " >
<button class="btn btn-default disabled " type="button" >
{{dataset.accessRights}}
</button>
</span>
<span *ngIf="showAccessRights != 'true'" (click)="removeDataset(dataset)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
</li>
</ul>
</div>
`,
directives: [ PublicationTitleFormatter] directives: [ PublicationTitleFormatter]
@ -70,16 +140,69 @@ export class ClaimSelectedComponent {
@Input() publications=[]; @Input() publications=[];
@Input() datasets=[]; @Input() datasets=[];
@Input() showAccessRights=false; @Input() showAccessRights=false;
@Input() show='home';
@Output() projectsChange = new EventEmitter();
@Output()publicationsChange = new EventEmitter();
@Output() datasetsChange = new EventEmitter();
@Output() contextsChange = new EventEmitter();
@Output() showChange = new EventEmitter();
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"]; accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
}
@Component({
selector: 'add-more',
template: ``
})
export class Addmore {
@Input() type = 'publication';
} }

View File

@ -9,7 +9,8 @@ import {Observable} from 'rxjs/Observable';
export class OpenaireProjectsService { export class OpenaireProjectsService {
constructor( private http: Http) {} constructor( private http: Http) {}
// searchUrl="http://services.openaire.eu:8380/search/"; // searchUrl="http://services.openaire.eu:8380/search/";
searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/"; // searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
searchUrl="http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
getFunders():any { getFunders():any {
let url = this.searchUrl+'search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json'; let url = this.searchUrl+'search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json';
////"&rows=".$size."&offset=".($page-1)*$size ////"&rows=".$size."&offset=".($page-1)*$size
@ -26,7 +27,7 @@ export class OpenaireProjectsService {
////"&rows=".$size."&offset=".($page-1)*$size ////"&rows=".$size."&offset=".($page-1)*$size
return this.http.get( url) return this.http.get( url)
.map(request => <any> request.json().response.results.result) .map(request => <any> (request.json().response.results)?request.json().response.results.result:request.json().response.results)
.do(funders => console.log("getFunders : "+funders)) .do(funders => console.log("getFunders : "+funders))
.catch(this.handleError); .catch(this.handleError);