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]=" ['/Linking']">Linking</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>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

View File

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

View File

@ -30,29 +30,48 @@ import {SearchDataciteService} from '../../services/searchDatacite.service';
</form>
</div>
</div>
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div>
<div class="panel ">
<div class="">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{resultsNum}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire</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 ({{(openaireResultsNum==null)?'0':openaireResultsNum}})</a></li>
</ul>
<div class="tab-content">
<div id="datacite" class="tab-pane fade in active">
<div>
<div *ngIf="resultsNum != null && resultsNum > 0">
<p > {{resultsNum }} Total Results </p>
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0">
<p > {{dataciteResultsNum }} Total Results </p>
<paging-no-load [currentPage]="page" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div *ngIf="dataciteResultsNum == null || dataciteResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
<div >
<p *ngFor=" let item of 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 id="openaire" class="tab-pane fade">
<h3>Menu 1</h3>
<p>Some content in menu 1.</p>
<div class = "panel-body">
<div class = "alert alert-info " > Under Development....
</div>
<div *ngIf="openaireResultsNum == null || openaireResultsNum == 0" class="alert alert-info" role="alert">No results found</div>
</div>
</div>
</div>
@ -80,51 +99,72 @@ export class ClaimDatasetComponent {
@Input() public selectedDatasets = [] ;
@Output() datasetsChange = new EventEmitter();
results=[];
resultsNum : Observable<number> ;
dataciteResults=[];
dataciteResultsNum : Observable<number> = null;
openaireResults=[];
openaireResultsNum : Observable<number> = null ;
public warningMessage = "";
public infoMessage = "";
searchDatacite (term: string, size : number, page : number) {
this.getDataciteResults(term,size,page);
console.info('searchDatacite in searchDatacite file');
this.warningMessage = "";
this.infoMessage = "";
}
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 => {
this.results = data.docs;
this.dataciteResults = data.docs;
this.page=page;
this.resultsNum = data.numFound;
this.dataciteResultsNum = data.numFound;
},
err => console.error(err)
);
console.info("In getDataciteResults (end) "+term);
}
}
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);
var index:number =this.results.indexOf(item);
if (index > -1) {
this.results.splice(index, 1);
}
this.datasetsChange.emit({
value: this.selectedDatasets
});
}
remove(item){
var index:number =this.selectedDatasets.indexOf(item);
if (index > -1) {
this.selectedDatasets.splice(index, 1);
this.datasetsChange.emit({
value: this.selectedDatasets
});
}
});
}else{
this.warningMessage = "Dataset already in selected list";
}
}
pageChange($event) {
this.page=$event.value;
this.results=[];
this.dataciteResults=[];
this.searchDatacite(this.keyword,10,this.page);
this.warningMessage = "";
this.infoMessage = "";
}
isSelected(id:string){
var found:boolean = false;
this.warningMessage = "";
for (var _i = 0; _i < this.selectedDatasets.length; _i++) {
let item = this.selectedDatasets[_i];
if(item.id == id){
found=true;
break;
}
}
return found;
}
}

View File

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

View File

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

View File

@ -56,6 +56,9 @@ export class ClaimPublicationComponent {
authorsNum : number ;
public warningMessage = "";
public infoMessage = "";
searchOrcid (term: string) {
this.authorIds = new Array<string>();
this.authorGivenNames = new Array<string>();
@ -151,7 +154,9 @@ export class ClaimPublicationComponent {
}
search(term: string, size : number, page : number){
this.getCrossrefResults(term,size,page);
this.warningMessage = "";
this.infoMessage = "";
this.getCrossrefResults(term,size,page);
this.searchOrcid(term);
}
@ -170,25 +175,30 @@ search(term: string, size : number, page : number){
}
add(item, itemSource, itemType, itemUrl, itemTitle){
var result ={id: item.DOI, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
console.info("Add result:"+result.id+" "+result.source+" "+item);
var index:number =this.selectedPublications.indexOf(result);
item.selected=true;
if (index== -1) {
this.selectedPublications.push(result);
add(item, id, itemSource, itemType, itemUrl, itemTitle){
var result ;
if(itemSource == 'crossref'){
result = {id: id, type :itemType, source : 'openaire', title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
}else if (itemSource == 'orcid'){
result = {id:id, 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.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){
this.warningMessage = "";
this.infoMessage = "";
var index:number =this.selectedPublications.indexOf(item);
item.selected=false;
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);
}
isSelected(item){
var index:number =this.selectedPublications.indexOf(item);
if (index > -1) {
return true;
}else{
return false;
}
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

@ -11,7 +11,7 @@ import {ClaimsService} from '../../services/claims.service';
directives: [...ROUTER_DIRECTIVES],
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>

View File

@ -23,8 +23,16 @@ import {LinkingHomeComponent} from './linkingHome.component';
<div class="page-header">
<h1>Link research resutls</h1>
</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' " >
<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 class="col-sm-6">
<div *ngIf=" show=='result' " >
@ -38,7 +46,7 @@ import {LinkingHomeComponent} from './linkingHome.component';
</md-radio-group> -->
<div class="input-group">
<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">
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
@ -78,16 +86,18 @@ import {LinkingHomeComponent} from './linkingHome.component';
</div>-->
</div>
<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 *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>
</div>
<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>
@ -107,10 +117,10 @@ export class LinkingComponent {
publications=[];
datasets=[];
show = "home";
searchType="publication";
searchType="publication"; //publication or dataset
date='8-6-2016';
keyword: string = "";
chosenType:string ="project";
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
ngOnInit() {
}
@ -130,11 +140,11 @@ export class LinkingComponent {
}
prev(){
if(this.show == 'result'){
if(this.chosenType == 'project'){
if(this.linkType == 'project'){
this.show='project';
}else if(this.chosenType == 'context'){
}else if(this.linkType == 'context'){
this.show='context';
}else if(this.chosenType == 'software'){
}else if(this.linkType == 'software'){
this.show='software';
}else{
this.show='home';
@ -185,9 +195,23 @@ export class LinkingComponent {
typeChanged(type:string) {
this.searchType = type;
}
chosenTypeChange($event) {
this.chosenType = this.show;
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,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 {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable';
@ -42,13 +42,12 @@ import {Observable} from 'rxjs/Observable';
})
export class LinkingHomeComponent {
@Output() chosenTypeChange = new EventEmitter();
chosenType:string = "result";
@Output() linkTypeChange = new EventEmitter();
linkType:string = "project";
select(type:string){
console.info('Changed!'+type);
this.chosenType = type;
this.chosenTypeChange.emit({
value: this.chosenType
this.linkType = type;
this.linkTypeChange.emit({
value: this.linkType
});
}

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';
@Component({
selector: 'claim-selected',
template: `
<div *ngIf="publications.length > 0 " class="publications" >
<h5>Selected Publications:</h5>
<i *ngFor="let pub of publications" >Source: {{pub.source}} - Title: <publication-title [title]="pub.title" [url]="pub.url" > </publication-title>
<p *ngIf="showAccessRights== 'true'" >
<select [(ngModel)]="pub.accessRights">
<option *ngFor="let type of accessTypes" [value]="type">{{type}}</option>
</select>
<!--<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{pub.accessRights}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let type of accessTypes" ><a href="#" (click)="pub.accessRights = type " >{{type}} </a></li>
</ul>
</div>-->
</p>
</i>
<div [class]="(showAccessRights== 'true' )?'row':''" >
<div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
<div class="concepts" >
<ul class="list-group">
<li class="list-group-item list-group-item-success">Selected Concepts ({{(contexts.length)}})
<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" *ngFor="let context of contexts" >
<span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
<span (click)="removeContext(context)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
</li>
<li *ngIf="contexts.length == 0 " class="list-group-item">There are no contexts</li>
</ul>
</div>
</div>
<div *ngIf="contexts.length > 0 " class="concepts" >
<ul class="list-group">
<li class="list-group-item list-group-item-success">Selected Concepts:</li>
<li class="list-group-item" *ngFor="let context of contexts" >{{context.community}} - Category: {{context.category}} </li>
</ul>
</div>
<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}}
<div [class]="(showAccessRights== 'true' )?'col-sm-6':''" >
<div class="projects" >
<ul class="list-group">
<li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
<span title="Add More Projects" (click)="showType('project')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
</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 *ngIf="datasets.length > 0 " class="datasets" >
<h5>Selected datasets:</h5>
<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" >
</div>
<!--<div *ngIf="contexts.length == 0 " class="concepts" >
<ul class="list-group">
<li class="list-group-item list-group-item-info">Selected Projects:</li>
<li class="list-group-item">Please use the form on the left to select a project</li>
<li class="list-group-item list-group-item-success">Selected Concepts
<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>
</div>
<div *ngIf="contexts.length == 0 " class="concepts" >
<div *ngIf="projects.length == 0 " class="projects" >
<ul class="list-group">
<li class="list-group-item list-group-item-success">Selected Concepts:</li>
<li class="list-group-item">Please use the form on the left to select a concept</li>
<li class="list-group-item list-group-item-info">Selected Projects
<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>
</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]
@ -70,16 +140,69 @@ export class ClaimSelectedComponent {
@Input() publications=[];
@Input() datasets=[];
@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"];
}
@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 {
constructor( private http: Http) {}
// searchUrl="http://services.openaire.eu:8380/search/";
searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
// searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
searchUrl="http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
getFunders():any {
let url = this.searchUrl+'search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json';
////"&rows=".$size."&offset=".($page-1)*$size
@ -26,7 +27,7 @@ export class OpenaireProjectsService {
////"&rows=".$size."&offset=".($page-1)*$size
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))
.catch(this.handleError);