more for inline linking in publication landing page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43109 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-07-03 15:56:13 +00:00
parent 1a04444e54
commit 3ea5df83cb
6 changed files with 306 additions and 73 deletions

View File

@ -1,4 +1,4 @@
import {Component, Input} from '@angular/core'; import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {JSONP_PROVIDERS} from '@angular/http'; import {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated'; import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
@ -12,28 +12,21 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
template: ` template: `
<div *ngIf="showComp == 'true'" class="panel-body well well-lg">
<div class="row" >
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" inline="true" [showComponent]="showComp" > </claim-contexts>
<div class="panel-body" > <claim-selected [contexts]="contexts"
<h6>Find Context:</h6>
<div *ngIf=" show == 'context' " class="row" >
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
<claim-selected [contexts]="contexts"
(contextsChange)="contextsChange($event)" (contextsChange)="contextsChange($event)"
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected> (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
</div> </div>
<div *ngIf=" show == 'claim'" > <claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
<claim-selected [contexts]="contexts" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected> <button (click)="insert()" [class]="(enableButton)?'btn btn-xs btn-primary':'btn btn-primary btn-xs disabled'" style="float:right">Finish </button>
<claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert> <button (click)="cancel()" [class]="(enableButton)?'btn btn-xs btn-default ':'btn btn-xs btn-default disabled'" style="float:left">Cancel </button>
</div>
<nav>
<ul class="pager">
<li *ngIf="show != 'context'" class="previous" (click)="prev()"><a ><span aria-hidden="true">&larr;</span> Previous</a></li>
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
</div> </div>
<!-- <h3>Find Context</h3> <!-- <h3>Find Context</h3>
<div *ngIf="show=='context'" > <div *ngIf="show=='context'" >
@ -48,7 +41,7 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
<button (click)="claim()" class="btn btn-primary" style="float:right">Finish</button> <button (click)="claim()" class="btn btn-primary btn-xs" style="float:right">Finish</button>
</div> </div>
<div *ngIf="show=='claim'" > <div *ngIf="show=='claim'" >
@ -70,9 +63,14 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
contexts=[]; contexts=[];
publications; publications;
datasets; datasets;
show = "context"; private show = 'context';
private showComp:string = 'false';
private enableButton:boolean=true;
keyword: string = ""; keyword: string = "";
@Output() contextAdded = new EventEmitter();
@ViewChild (ClaimInsertComponent) claimInsert : ClaimInsertComponent ;
ngOnInit() { ngOnInit() {
} }
@ -104,9 +102,158 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
showChange($event) { showChange($event) {
this.show=$event.value; this.show=$event.value;
if(this.show == "end"){ if(this.show == "end"){
//TODO
this.contextAdded.emit({
value: this.contexts
});
this.contexts = []; this.contexts = [];
this.show = "context"; this.hideComponent();
}else if(this.show == "error"){
this.showComponent();
} }
} }
public toggle(){
if(this.showComp == 'false'){
this.showComponent();
}else{
this.hideComponent();
}
}
private showComponent(){
this.showComp='true';
this.enableButton = true;
}
private hideComponent(){
this.showComp='false';
}
private insert(){
this.claimInsert.publications = [];
this.claimInsert.publications.push(this.inlineEntity[0]);
this.publications = [];
this.publications.push(this.inlineEntity[0]);
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
this.enableButton = false;
this.claimInsert.insert();
}
private cancel(){
this.contexts = [];
this.hideComponent();
}
} }
// import {Component, Input} from '@angular/core';
// import {JSONP_PROVIDERS} from '@angular/http';
// import {Observable} from 'rxjs/Observable';
// import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
// import {ClaimContextComponent} from '../linking/claimContext/claimContext.component';
// import {ClaimSelectedComponent} from '../linking/selected/selected.component';
// import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
//
// @Component({
// selector: 'inline-claim-context',
// directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimSelectedComponent, ClaimInsertComponent],
// template: `
//
//
//
// <div class="panel-body" >
// <h6>Find Context:</h6>
// <div *ngIf=" show == 'context' " class="row" >
// <claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
// <claim-selected [contexts]="contexts"
// (contextsChange)="contextsChange($event)"
// (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
// </div>
// <div *ngIf=" show == 'claim'" >
// <claim-selected [contexts]="contexts" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
// <claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
// </div>
// <nav>
// <ul class="pager">
// <li *ngIf="show != 'context'" class="previous" (click)="prev()"><a ><span aria-hidden="true">&larr;</span> Previous</a></li>
// <li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">&rarr;</span></a></li>
// </ul>
// </nav>
//
// </div>
//
// <!-- <h3>Find Context</h3>
//
// <div *ngIf="show=='context'" >
//
//
// <claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
//
// <h3>Link to</h3>
// <claim-selected [contexts]="contexts"
// (contextsChange)="contextsChange($event)"
// (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
//
//
//
// <button (click)="claim()" class="btn btn-primary" style="float:right">Finish</button>
//
// </div>
// <div *ngIf="show=='claim'" >
// <claim-insert showAccessRights="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
// </div>-->
//
// `
//
// })
// export class InlineClaimContextComponent {
// constructor ( private _router: Router ) {
//
// }
//
// @Input() public inlineEntity:any;
// @Input() public inlineType:string;
//
//
// contexts=[];
// publications;
// datasets;
// show = "context";
// keyword: string = "";
//
// ngOnInit() {
//
// }
// next(){
// if(this.inlineType === 'dataset'){
// this.datasets = [];
// this.datasets.push(this.inlineEntity[0]);
// }else if(this.inlineType === 'publication'){
// this.publications = [];
// this.publications.push(this.inlineEntity[0]);
// console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
// }
// if( this.show == 'context'){
// this.show='claim';
// }
// }
// prev(){
// if(this.show == 'claim'){
// this.show = 'context';
// }
// }
//
//
// contextsChange($event) {
// this.contexts=$event.value;
// console.log($event.value);
// }
//
// showChange($event) {
// this.show=$event.value;
// if(this.show == "end"){
// this.contexts = [];
// this.show = "context";
// }
// }
//
// }

View File

@ -13,49 +13,48 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
<div *ngIf="showComp" class="panel-body well well-lg"> <div *ngIf="showComp" class="panel-body well well-lg">
<h6>Search for Projects:</h6> <div class="row" >
<div class="row" >
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" inline="true" > </claim-projects> <claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" inline="true" > </claim-projects>
<claim-selected [projects]="projects" <claim-selected [projects]="projects"
(projectsChange)="projectsChange($event)" (projectsChange)="projectsChange($event)"
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected> (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
</div> </div>
<claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButtton="false" ></claim-insert> <claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
<button (click)="insert()" [class]="(enableButton)?'btn btn-primary':'btn btn-primary disabled'" style="float:right">Finish </button> <button (click)="insert()" [class]="(enableButton)?'btn btn-xs btn-primary':'btn btn-primary btn-xs disabled'" style="float:right">Finish </button>
<button (click)="cancel()" [class]="(enableButton)?'btn ':'btn disabled'" style="float:left">Cancel </button> <button (click)="cancel()" [class]="(enableButton)?'btn btn-xs btn-default ':'btn btn-xs btn-default disabled'" style="float:left">Cancel </button>
<!-- <div *ngIf=" show == 'claim'" > <!-- <div *ngIf=" show == 'claim'" >
<claim-selected [projects]="projects" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected> <claim-selected [projects]="projects" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
<claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButtton="false" ></claim-insert> <claim-insert (showChange)="showChange($event)" inline="true" [projects]="projects" [publications]="publications" [datasets]="datasets" showButton="false" ></claim-insert>
</div> </div>
<nav> <nav>
<ul class="pager"> <ul class="pager">
<li *ngIf="show != 'context'" class="previous" (click)="prev()"><a ><span aria-hidden="true">&larr;</span> Previous</a></li> <li *ngIf="show != 'project'" class="previous" (click)="prev()"><a ><span aria-hidden="true">&larr;</span> Previous</a></li>
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">&rarr;</span></a></li> <li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">&rarr;</span></a></li>
</ul> </ul>
</nav> </nav>
--> -->
</div> </div>
<!-- <h3>Find Context</h3> <!-- <h3>Find Project</h3>
<div *ngIf="show=='context'" > <div *ngIf="show=='project'" >
<claim-projects [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts> <claim-projects [selectedList]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
<h3>Link to</h3> <h3>Link to</h3>
<claim-selected [contexts]="contexts" <claim-selected [projects]="projects"
(contextsChange)="contextsChange($event)" (projectsChange)="projectsChange($event)"
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected> (showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
<button (click)="claim()" class="btn btn-primary" style="float:right">Finish</button> <button (click)="claim()" class="btn btn-primary btn-xs" style="float:right">Finish</button>
</div> </div>
<div *ngIf="show=='claim'" > <div *ngIf="show=='claim'" >
<claim-insert showAccessRights="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert> <claim-insert showAccessRights="true" [projects]="projects" [publications]="publications" [datasets]="datasets" ></claim-insert>
</div>--> </div>-->
` `
@ -93,13 +92,13 @@ import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component
this.publications.push(this.inlineEntity[0]); this.publications.push(this.inlineEntity[0]);
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate); console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
} }
if( this.show == 'context'){ if( this.show == 'project'){
this.show='claim'; this.show='claim';
} }
} }
prev(){ prev(){
if(this.show == 'claim'){ if(this.show == 'claim'){
this.show = 'context'; this.show = 'project';
} }
} }

View File

@ -8,8 +8,9 @@ import {ContextsService} from '../../../services/contexts.service';
@Component({ @Component({
selector: 'claim-contexts', selector: 'claim-contexts',
template: ` template: `
<div class="panel" > <div class="panel-body" >
<div class="input-group">
<div class="input-group" *ngIf="inline === 'false'">
<div class=" input-group-btn"> <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"> <button class="btn btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCommunityLabel}} {{selectedCommunityLabel}}
@ -35,6 +36,64 @@ import {ContextsService} from '../../../services/contexts.service';
<input id="community" type="text" class="validate filter-input form-control" placeholder="Search for contexts" [(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>
<div class=" form-horizontal" *ngIf="inline === 'true' && showComponent=='true'">
<div class=" form-group ">
<button class="btn btn-xs btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCommunityLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
</ul>
</div>
<div class="form-group ">
<button class="btn btn-xs btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCategoryLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
</ul>
</div>
<div class="form-group">
<input id="community" type="text" class="validate filter-input input-sm form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
</div>
</div>
<!--<div class="input-group">
<div class=" input-group-btn">
<button class="btn btn-success dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCommunityLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
</ul>
</div>
<div class="input-group-btn ">
<button class="btn btn-success dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{selectedCategoryLabel}}
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
</ul>
</div>
<input id="community" type="text" class="validate filter-input form-control" placeholder="Search for contexts" [(ngModel)]=query (keyup)=filter() >
</div>-->
<div class="suggestions" *ngIf="filteredList.length > 0"> <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">
@ -54,6 +113,9 @@ export class ClaimContextComponent {
this.getCommunities(); this.getCommunities();
} }
@Input() public inline= 'false' ; // for claimed started from landing pages
@Input() public showComponent= 'true' ; // for claimed started from landing pages
public query = ''; public query = '';
public filteredList = []; public filteredList = [];
@Input() public selectedList ; @Input() public selectedList ;

View File

@ -8,17 +8,17 @@ import {Loading} from '../../../common/modal/loading.component';
@Component({ @Component({
selector: 'claim-projects', selector: 'claim-projects',
template: ` template: `
<div class="panel" > <div class="panel-body" >
<!-- <select [(ngModel)]="selectedFunderId" (ngModelChange)="funderChanged()" > <!-- <select [(ngModel)]="selectedFunderId" (ngModelChange)="funderChanged()" >
<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> -->
<form> <form *ngIf="(inline == 'false')">
<div [class]="(inline =='false')?'input-group':''"> <div class="input-group">
<div [class]="(inline =='false')?'input-group-btn':''" > <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"> <button type="button" class="btn btn-info dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}} {{selectedFunderName}}
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
@ -27,11 +27,29 @@ import {Loading} from '../../../common/modal/loading.component';
</ul> </ul>
</div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" --> </div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" -->
<input id="community" type="text" class="form-control" placeholder="Search for Projects" [(ngModel)]=query > <input id="community" type="text" class="form-control" placeholder="Search for Projects" [(ngModel)]=query >
<span [class]="(inline =='false')?'input-group-btn':''" > <span class="input-group-btn" >
<button type="submit" (click)="filter()" class="btn btn-default">Search</button> <button type="submit" (click)="filter()" class="btn btn-default" >Search</button>
</span> </span>
</div> </div>
</form>
<form *ngIf="(inline == 'true')" class="form-horizontal">
<div class="">
<div class="form-group" >
<button type="button" class="btn btn-xs btn-info dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
</ul>
</div><!-- (keyup)=filter() *ngIf="selectedFunderId != '0'" -->
<div class="form-group"> <input id="community" type="text" class="form-control input-sm" placeholder="Search for Projects" [(ngModel)]=query ></div>
<div class="form-group" >
<button type="submit" (click)="filter()" class="btn btn-xs btn-default" >Search</button>
</div>
</div>
</form> </form>
<div class="suggestions" *ngIf="filteredList.length > 0"> <div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" > <ul class="list-group" >

View File

@ -34,7 +34,7 @@ export class ClaimInsertComponent {
@Input() public projects; @Input() public projects;
@Input() public publications; @Input() public publications;
@Input() public datasets; @Input() public datasets;
@Input() public showButton:string = 'false'; @Input() public showButton:string = 'true';
@Input() show='claim'; @Input() show='claim';
@Input() inline='false'; @Input() inline='false';
@Output() showChange = new EventEmitter(); @Output() showChange = new EventEmitter();

View File

@ -205,11 +205,11 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
</a> </a>
</dd> </dd>
</dl> </dl>
<a (click)="toggleClaimProject()">Add more Projects</a> <button (click)="toggleClaimProject()" class = "btn btn-default btn-xs" >Add more Projects</button>
<inline-claim-project *ngIf="result " inline="true" inlineType ="publication" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project> <inline-claim-project *ngIf="result " inline="true" inlineType ="publication" [inlineEntity]="result" (projectAdded)="projectAdded($event)" ></inline-claim-project>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<a (click)=" claimInline=(claimInline=='context')?'none':'context'" >Add more Contexts</a> <button (click)=" toggleClaimContext()" class = "btn btn-default btn-xs" >Add Contexts</button>
<inline-claim-context *ngIf="result " inline="true" inlineType ="publication" [inlineEntity]="result" ></inline-claim-context> <inline-claim-context *ngIf="result " inline="true" inlineType ="publication" [inlineEntity]="result" ></inline-claim-context>
</li> </li>
@ -234,17 +234,13 @@ export class PublicationComponent {
this.params = _routeParams; this.params = _routeParams;
} }
ngOnInit() { ngOnInit() {
console.info('publication init'); this.getPublicationInfo();
// let result_ = {id: this.params.get("articleId"), type :"publication", source : "openaire", title:"lalalla",url: null, result: null, accessRights:"OPEN", embargoEndDate: null};
// this.result.push(result_);
this.getPublicationInfo();
} }
publicationInfo: PublicationInfo; publicationInfo: PublicationInfo;
params: RouteParams; params: RouteParams;
//AK - For the claims
private result ; private result ;
private claimInline:string = "none" ; private claimInline:string = "none" ;
@ -253,22 +249,22 @@ export class PublicationComponent {
getPublicationInfo() { getPublicationInfo() {
console.info("inside getPublicationInfo of component");
this._publicationService.getPublicationInfo(this.params.get("articleId")).subscribe( this._publicationService.getPublicationInfo(this.params.get("articleId")).subscribe(
data => { data => {
this.publicationInfo = data; this.publicationInfo = data;
//AK - For the claims this.result = []
this.result = []
let result_ ={id: this.params.get("articleId"), type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; let result_ ={id: this.params.get("articleId"), type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
this.result.push(result_); this.result.push(result_);
}, },
err => console.error(err) err => console.error(err)
); );
} }
/*
********* Methods for Inline Claim of project / publication *****
*/
toggleClaimProject(){ toggleClaimProject(){
console.info("TOOGLE "); this.inlineClaimProject.toggle();
this.inlineClaimProject.toggle();
} }
projectAdded($event){ projectAdded($event){
var projects =$event.value; var projects =$event.value;
@ -279,21 +275,32 @@ export class PublicationComponent {
this.publicationInfo.fundedByProjects = new Map<string, string[]>(); this.publicationInfo.fundedByProjects = new Map<string, string[]>();
} }
var project =projects[i]; var project =projects[i];
// this.publicationInfo.fundedByProjects.set(mydata.code, new Array<string>());
// this.publicationInfo.fundedByProjects.get(mydata.code)[0] = mydata.acronym;
// this.publicationInfo.fundedByProjects.get(mydata.code)[1] = mydata.title;
// var project= { funderId: this.selectedFunderId,funderName: this.selectedFunderName, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] };
this.publicationInfo.fundedByProjects.set(project.projectId, new Array<string>()); this.publicationInfo.fundedByProjects.set(project.projectId, new Array<string>());
this.publicationInfo.fundedByProjects.get(project.projectId)[0] = project.projectAcronym; this.publicationInfo.fundedByProjects.get(project.projectId)[0] = project.projectAcronym;
this.publicationInfo.fundedByProjects.get(project.projectId)[1] = project.projectName; this.publicationInfo.fundedByProjects.get(project.projectId)[1] = project.projectName;
this.publicationInfo.fundedByProjects.get(project.projectId)[2] =project.selectedFunderId;
this.publicationInfo.fundedByProjects.get(project.projectId)[3] = project.selectedFunderName;
}
}
}
toggleClaimContext(){
this.inlineClaimContext.toggle();
}
contextAdded($event){
var contexts =$event.value;
if(contexts){
for(var i=0; i < contexts.length; i++){
// this.publicationInfo.fundedByProjects.get(mydata.code)[2] = mydata['funding']['funder'].shortname; // if(this.publicationInfo.fundedByProjects == undefined) {
// this.publicationInfo.fundedByProjects.get(mydata.code)[3] = mydata['funding']['funder'].name; // this.publicationInfo.fundedByProjects = new Map<string, string[]>();
this.publicationInfo.fundedByProjects.get(project.projectId)[2] =project.selectedFunderId; // }
this.publicationInfo.fundedByProjects.get(project.projectId)[3] = project.selectedFunderName; // var context =contexts[i];
// this.publicationInfo.fundedByProjects.set(project.projectId, new Array<string>());
// this.publicationInfo.fundedByProjects.get(project.projectId)[0] = project.projectAcronym;
// this.publicationInfo.fundedByProjects.get(project.projectId)[1] = project.projectName;
// this.publicationInfo.fundedByProjects.get(project.projectId)[2] =project.selectedFunderId;
// this.publicationInfo.fundedByProjects.get(project.projectId)[3] = project.selectedFunderName;
}
}
} }
}
}
} }