Revision 55253
Added by Argiro Kokogiannaki over 5 years ago
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/bulkLinking.module.ts | ||
---|---|---|
1 |
// import { NgModule } from '@angular/core'; |
|
2 |
// |
|
3 |
// import { SharedModule } from '../../shared/shared.module'; |
|
4 |
// import { BulkLinkingComponent } from './bulkLinking.component'; |
|
5 |
// import { BulkLinkingRoutingModule } from './bulkLinking-routing.module'; |
|
6 |
// import {LinkingGenericModule} from './linkingGeneric.module'; |
|
7 |
// import {BulkClaimModule} from './bulkClaim/bulkClaim.module'; |
|
8 |
// @NgModule({ |
|
9 |
// imports: [ |
|
10 |
// SharedModule, |
|
11 |
// BulkLinkingRoutingModule, |
|
12 |
// LinkingGenericModule, |
|
13 |
// BulkClaimModule |
|
14 |
// |
|
15 |
// ], |
|
16 |
// declarations: [ |
|
17 |
// BulkLinkingComponent |
|
18 |
// ], exports:[BulkLinkingComponent] |
|
19 |
// }) |
|
20 |
// export class BulkLinkingModule { } |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/claim-utils/service/searchCrossref.service.ts | ||
---|---|---|
72 | 72 |
result.source = 'crossref'; |
73 | 73 |
result.type = 'publication'; |
74 | 74 |
if(item['published-print']){ |
75 |
result.date = item['published-print']['date-parts'][0]; |
|
75 |
result.date = item['published-print']['date-parts'][0][0];
|
|
76 | 76 |
} |
77 | 77 |
result.accessRights = "OPEN"; |
78 | 78 |
result.publisher = item.publisher; |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/linkingGeneric.module.ts | ||
---|---|---|
17 | 17 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
18 | 18 |
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; |
19 | 19 |
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; |
20 |
|
|
20 |
import {MetadataPreviewModule} from './selected/metadataPreview.module'; |
|
21 | 21 |
@NgModule({ |
22 | 22 |
imports: [ |
23 | 23 |
SharedModule, SelectedProjectsModule, SelectedContextsModule, |
24 | 24 |
SelectedPublicationsModule, |
25 | 25 |
InsertClaimsModule, StartOverModule, |
26 | 26 |
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, |
27 |
HelperModule, Schema2jsonldModule, SEOServiceModule |
|
27 |
HelperModule, Schema2jsonldModule, SEOServiceModule, MetadataPreviewModule
|
|
28 | 28 |
], |
29 | 29 |
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], |
30 | 30 |
declarations: [ |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/bulkClaim/bulkClaim.component.ts | ||
---|---|---|
26 | 26 |
<!--button class="uk-button portal-button" type="button" tabindex="-1" [class.disabled]="!enableUpload" ><span class="uk-margin-small-right uk-icon" > |
27 | 27 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline> <rect x="3" y="17" width="13" height="1"></rect> |
28 | 28 |
<line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></span> Select</button--> |
29 |
<helper div="link-result-bulk" tooltip=true ></helper>
|
|
29 |
<!--helper div="link-result-bulk" tooltip=true ></helper-->
|
|
30 | 30 |
</div> |
31 | 31 |
|
32 | 32 |
|
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/selected/metadataPreview.component.html | ||
---|---|---|
1 |
<div class="uk-grid" > |
|
2 |
<div class="uk-width-expand"> |
|
3 |
<!-- Sources --> |
|
4 |
<div> |
|
5 |
<h5 class=" uk-margin uk-h5 uk-text-primary" > Sources ({{sources.length | number}}) </h5> |
|
6 |
<ul *ngIf="sources.length > 0 " class="uk-list"> |
|
7 |
<li *ngFor=" let result of sources " [class]="(result.warningMessages && result.warningMessages.length > 0)?'uk-alert warningBorder':'uk-alert '" > |
|
8 |
<div class="uk-text-muted">{{(result.type =='project' || result.type =='community')?result.type:(result.source=='openaire'?result.type:(result.source+' result'))}}</div> |
|
9 |
<div class="uk-grid"> |
|
10 |
<div class="uk-width-expand"> |
|
11 |
<span class="uk-text-bold"> |
|
12 |
<a *ngIf="result.url" target="_blank" [href]="result.url" >{{result.title?result.title:'[No title available]'}}</a> |
|
13 |
<span *ngIf="!result.url && (result.type!='project' && result.type!='community')" >{{result.title?result.title:'[No title available]'}}</span> |
|
14 |
<span *ngIf="result.type=='project'"> {{(result.acronym?result.acronym:result.title)}}</span> |
|
15 |
<span *ngIf="result.type=='community'"> |
|
16 |
<span *ngIf="result.type=='community' && result.community != result.concept.label"> |
|
17 |
{{result.community }} > {{result.category}} > |
|
18 |
</span> |
|
19 |
<span> {{result.concept.label}}</span> |
|
20 |
</span> |
|
21 |
</span> |
|
22 |
</div> |
|
23 |
<div class="uk-padding-remove-left"> |
|
24 |
<a class="uk-button-default uk-align-right" |
|
25 |
(click)="remove(result, false)" class="uk-icon-button icon-button-small"> |
|
26 |
<span class="uk-icon"> |
|
27 |
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg> |
|
28 |
</span> |
|
29 |
</a> |
|
30 |
</div> |
|
31 |
</div> |
|
32 |
<div class="uk-grid uk-margin-remove uk-text-small"> |
|
33 |
<div class="uk-width-1-2 uk-padding-remove-left"> |
|
34 |
<span *ngIf="result.publisher!=null"><span class="uk-text-muted">Publisher</span> {{result.publisher}}</span> |
|
35 |
<span *ngIf="result.journal!=null"><span class="uk-text-muted">Journal</span> {{result.journal}}</span> |
|
36 |
</div> |
|
37 |
<div class="uk-width-1-2"> |
|
38 |
<span *ngIf="(result.date)"><span class="uk-text-muted">Published in </span> <span [class]="(getProjectDurationMessage(result)?'uk-text-warning':'')">{{result.date}}</span></span> |
|
39 |
<div [class]="(getProjectDurationMessage(result)?'uk-text-warning':'')">{{getProjectDurationMessage(result)}} |
|
40 |
</div> |
|
41 |
</div> |
|
42 |
</div> |
|
43 |
|
|
44 |
<div *ngIf="result.authors && result.authors.length >0 " class="uk-text-small"><span class="uk-text-muted">Authors </span> <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div> |
|
45 |
<div *ngIf="result.editors && result.editors.length > 0" class="uk-text-small"><span class="uk-text-muted">Editors </span><span *ngFor="let author of result.editors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div> |
|
46 |
<div *ngIf="result.type == 'project'" class="uk-grid uk-margin-remove-top uk-text-small"> |
|
47 |
<div class="uk-width-1-2"> |
|
48 |
<div *ngIf="result.funderName"> |
|
49 |
<span class="uk-text-muted">Funder </span>{{result.funderName}} |
|
50 |
</div> |
|
51 |
<div *ngIf="result.organization"> |
|
52 |
<span class="uk-text-muted">Organization </span>{{result.organization}} |
|
53 |
</div> |
|
54 |
</div> |
|
55 |
<div class="uk-width-1-2"> |
|
56 |
<div *ngIf="result.code"> |
|
57 |
<span class="uk-text-muted">GrandId </span>{{result.code}} |
|
58 |
</div> |
|
59 |
<div *ngIf="result.startDate || result.endDate"> |
|
60 |
<span class="uk-text-muted">Duration </span>{{result.startDate}}-{{result.endDate}} |
|
61 |
</div> |
|
62 |
</div> |
|
63 |
|
|
64 |
</div> |
|
65 |
<div *ngIf="result.source && result.source!='openaire' " class="uk-grid uk-text-small"> |
|
66 |
<div class="uk-width-1-2"> |
|
67 |
<span class="uk-text-muted">Type </span> |
|
68 |
<select [(ngModel)]="result.type" name="{{'select_type_'+result.id}}" class="uk-select uk-width-small"> |
|
69 |
<option [value]="'publication'" (click)="onTypeChanged('publication',result, false)" >Publication</option> |
|
70 |
<option [value]="'dataset'" (click)="onTypeChanged('dataset',result, false)" >Research data</option> |
|
71 |
<option [value]="'software'" (click)="onTypeChanged('software',result, false)" >Software</option> |
|
72 |
<option [value]="'other'" (click)="onTypeChanged('other',result, false)" >Other research product</option> |
|
73 |
</select> |
|
74 |
</div> |
|
75 |
<div class="uk-width-1-2 uk-grid"> |
|
76 |
<span class="uk-text-muted">Access mode</span> |
|
77 |
<select [(ngModel)]="result.accessRights" name="{{'select_rights_'+result.id}}" class="uk-select uk-width-small"> |
|
78 |
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,result, false)">{{type}}</option> |
|
79 |
</select> |
|
80 |
<my-date-picker *ngIf="result.accessRights== 'EMBARGO'" name="{{'date'+result.id}}" [options]="myDatePickerOptions" |
|
81 |
[(ngModel)]="nextDate" (dateChanged)="onDateChanged($event,result, false)" class="uk-width-expand uk-padding-remove-left"></my-date-picker> |
|
82 |
<div *ngIf="result.accessRights== 'EMBARGO'" [class]="(getEmbargoEndDateMessage(result)?'uk-text-warning':'')">{{getEmbargoEndDateMessage(result)}} |
|
83 |
</div> |
|
84 |
</div> |
|
85 |
</div> |
|
86 |
|
|
87 |
|
|
88 |
</li> |
|
89 |
</ul> |
|
90 |
</div> |
|
91 |
<!-- Results --> |
|
92 |
<div> |
|
93 |
<h5 class=" uk-margin uk-h5 uk-text-primary" > Link To ({{results.length | number}}) </h5> |
|
94 |
<ul *ngIf="results.length > 0 " class="uk-list uk-list-divider"> |
|
95 |
<li *ngFor=" let result of results " > |
|
96 |
<div class="uk-text-muted">{{(result.type =='project' || result.type =='community')?result.type:(result.source=='openaire'?result.type:(result.source+' result'))}}</div> |
|
97 |
<div class="uk-grid"> |
|
98 |
<div class="uk-width-expand"> |
|
99 |
<span class="uk-text-bold"> |
|
100 |
<a *ngIf="result.url" target="_blank" [href]="result.url" >{{result.title?result.title:'[No title available]'}}</a> |
|
101 |
<span *ngIf="!result.url && (result.type!='project' && result.type!='community')" >{{result.title?result.title:'[No title available]'}}</span> |
|
102 |
<span *ngIf="result.type=='project'"> {{(result.acronym?result.acronym:result.title)}}</span> |
|
103 |
<span *ngIf="result.type=='community'"> |
|
104 |
<span *ngIf="result.type=='community' && result.community != result.concept.label"> |
|
105 |
{{result.community }} > {{result.category}} > |
|
106 |
</span> |
|
107 |
<span> {{result.concept.label}}</span> |
|
108 |
</span> |
|
109 |
</span> |
|
110 |
</div> |
|
111 |
<div class="uk-padding-remove-left"> |
|
112 |
<a class="uk-button-default uk-align-right" |
|
113 |
(click)="remove(result, true)" class="uk-icon-button icon-button-small"> |
|
114 |
<span class="uk-icon"> |
|
115 |
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg> |
|
116 |
</span> |
|
117 |
</a> |
|
118 |
</div> |
|
119 |
</div> |
|
120 |
<div class="uk-grid"> |
|
121 |
<div class="uk-width-1-2"> |
|
122 |
<span *ngIf="result.publisher!=null" class="uk-article-meta">Publisher: {{result.publisher}}</span> |
|
123 |
<span *ngIf="result.journal!=null" class="uk-article-meta">Journal: {{result.journal}}</span> |
|
124 |
</div> |
|
125 |
<div class="uk-width-1-2"> |
|
126 |
<span *ngIf="(result.date)" class="uk-article-meta"> ({{result.date}})</span> |
|
127 |
</div> |
|
128 |
</div> |
|
129 |
<div *ngIf="result.authors && result.authors.length >0 " class=""><span class="uk-text-muted">Authors </span> <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div> |
|
130 |
<div *ngIf="result.editors && result.editors.length > 0" class=""><span class="uk-text-muted">Editors </span><span *ngFor="let author of result.editors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div> |
|
131 |
<div *ngIf="result.type == 'project'" class="uk-grid uk-margin-remove-top"> |
|
132 |
<div class="uk-width-1-2"> |
|
133 |
<div *ngIf="result.funderName"> |
|
134 |
<span class="uk-text-muted">Funder </span>{{result.funderName}} |
|
135 |
</div> |
|
136 |
<div *ngIf="result.organization"> |
|
137 |
<span class="uk-text-muted">Organization </span>{{result.organization}} |
|
138 |
</div> |
|
139 |
</div> |
|
140 |
<div class="uk-width-1-2"> |
|
141 |
<div *ngIf="result.code"> |
|
142 |
<span class="uk-text-muted">GrandId </span>{{result.code}} |
|
143 |
</div> |
|
144 |
<div *ngIf="result.startDate || result.endDate"> |
|
145 |
<span class="uk-text-muted">Duration </span>{{result.startDate}}-{{result.endDate}} |
|
146 |
</div> |
|
147 |
</div> |
|
148 |
|
|
149 |
</div> |
|
150 |
<div *ngIf="result.source && result.source!='openaire' " class="uk-grid"> |
|
151 |
<div class="uk-width-1-2"> |
|
152 |
<span class="uk-text-muted">Type </span> |
|
153 |
<select [(ngModel)]="result.type" name="{{'select_type_'+result.id}}" class="uk-select uk-width-small"> |
|
154 |
<option [value]="'publication'" (click)="onTypeChanged('publication',result, true)" >Publication</option> |
|
155 |
<option [value]="'dataset'" (click)="onTypeChanged('dataset',result, true)" >Research data</option> |
|
156 |
<option [value]="'software'" (click)="onTypeChanged('software',result, true)" >Software</option> |
|
157 |
<option [value]="'other'" (click)="onTypeChanged('other',result, true)" >Other research product</option> |
|
158 |
</select> |
|
159 |
</div> |
|
160 |
<div class="uk-width-1-2 uk-grid"> |
|
161 |
<span class="uk-text-muted">Access mode</span> |
|
162 |
<select [(ngModel)]="result.accessRights" name="{{'select_rights_'+result.id}}" class="uk-select uk-width-small"> |
|
163 |
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,result, true)">{{type}}</option> |
|
164 |
</select> |
|
165 |
<my-date-picker *ngIf="result.accessRights== 'EMBARGO'" name="{{'date'+result.id}}" [options]="myDatePickerOptions" |
|
166 |
[(ngModel)]="nextDate" (dateChanged)="onDateChanged($event,result, true)" class="uk-width-expand"></my-date-picker> |
|
167 |
</div> |
|
168 |
</div> |
|
169 |
|
|
170 |
|
|
171 |
</li> |
|
172 |
</ul> |
|
173 |
</div> |
|
174 |
</div> |
|
175 |
<div class="uk-width-1-4"> |
|
176 |
<!-- Errors and Warning --> |
|
177 |
<h5 *ngIf="errors.length > 0" class=" uk-margin uk-h5 uk-text-primary" > Errors ({{errors.length | number}}) </h5> |
|
178 |
<div *ngIf="errors.length > 0 "> |
|
179 |
<div *ngFor=" let message of errors " class="uk-alert dangerBorder"> |
|
180 |
{{message.type}} |
|
181 |
</div> |
|
182 |
</div> |
|
183 |
<h5 *ngIf="warnings.length > 0" class=" uk-margin uk-h5 uk-text-primary" > Warnings ({{warnings.length | number}}) </h5> |
|
184 |
<div *ngIf="warnings.length > 0 "> |
|
185 |
<div *ngFor=" let message of warnings " class="uk-alert warningBorder"> |
|
186 |
<div *ngIf="message.type == 'embargoEndDate'"> |
|
187 |
<div class="uk-text-warning uk-text-bold"> |
|
188 |
Embargo date must be later than published date in |
|
189 |
</div> |
|
190 |
<div class=""> |
|
191 |
{{message.result.title}} |
|
192 |
</div> |
|
193 |
</div> |
|
194 |
<div *ngIf="message.type == 'projectDuration'"> |
|
195 |
<div class="uk-text-warning uk-text-bold"> |
|
196 |
Published date must be in the project's date boundaries (from {{message.project.startDate}} {{(message.project.endDate)?(' to '+(addStringToNumber(message.project.endDate,5))):''}}) in |
|
197 |
</div> |
|
198 |
<div class=""> |
|
199 |
{{message.result.title}} |
|
200 |
</div> |
|
201 |
<div class="uk-text-muted uk-text-small"> |
|
202 |
with link to |
|
203 |
</div> |
|
204 |
<div class=""> |
|
205 |
{{message.project.title}} |
|
206 |
</div> |
|
207 |
<div><span class="uk-text-muted uk-text-small"> |
|
208 |
Project boundaries: </span>({{message.project.startDate}} {{(message.project.endDate)?(' - '+(message.project.endDate)+ ') +5 years'):')'}} |
|
209 |
</div> |
|
210 |
</div> |
|
211 |
|
|
212 |
</div> |
|
213 |
</div> |
|
214 |
</div> |
|
215 |
|
|
216 |
<modal-alert (alertOutput)="confirmClose($event)"> |
|
217 |
</modal-alert> |
|
218 |
</div> |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/selected/metadataPreview.component.ts | ||
---|---|---|
1 |
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core'; |
|
2 |
import {AlertModal} from '../../../utils/modal/alert'; |
|
3 |
import {ClaimResult} from '../../claim-utils/claimEntities.class'; |
|
4 |
import {IMyOptions, IMyDateModel} from '../../../utils/my-date-picker/interfaces/index'; |
|
5 |
import {Dates} from '../../../utils/string-utils.class'; |
|
6 |
|
|
7 |
@Component({ |
|
8 |
selector: 'metadata-preview', |
|
9 |
templateUrl: 'metadataPreview.component.html' |
|
10 |
|
|
11 |
}) |
|
12 |
export class MetadataPreviewComponent { |
|
13 |
ngOnInit() { |
|
14 |
var myDate = new Date(); |
|
15 |
this.nextDate = { date: { year: myDate.getFullYear()+10, month: (myDate.getMonth()+1), day: myDate.getDate() } }; |
|
16 |
//2015-05-01 |
|
17 |
this.runValidation(); |
|
18 |
|
|
19 |
} |
|
20 |
|
|
21 |
@Input() results; |
|
22 |
@Input() sources; |
|
23 |
@Input() title:string = "Research Results"; |
|
24 |
@Input() bulkMode:boolean = false; |
|
25 |
|
|
26 |
|
|
27 |
nextDate = {}; |
|
28 |
@ViewChild(AlertModal) alertApplyAll; |
|
29 |
@Input() localStoragePrefix:string = ""; |
|
30 |
errors = []; |
|
31 |
warnings = []; |
|
32 |
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result |
|
33 |
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result |
|
34 |
public commonType; // for research result type - changes when user apply a change to every result |
|
35 |
public applyToResults:boolean; // true apply to results, false apply to sources |
|
36 |
public typeChanged:boolean = true; // |
|
37 |
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"]; |
|
38 |
private myDatePickerOptions: IMyOptions = { |
|
39 |
// other options... |
|
40 |
dateFormat: 'yyyy-mm-dd', |
|
41 |
selectionTxtFontSize: '15px', |
|
42 |
height:'28px', |
|
43 |
width: '100%', |
|
44 |
editableDateField: false, |
|
45 |
showClearDateBtn: false |
|
46 |
}; |
|
47 |
|
|
48 |
|
|
49 |
removePublication(item:any){ |
|
50 |
var index:number =this.results.indexOf(item); |
|
51 |
if (index > -1) { |
|
52 |
this.results.splice(index, 1); |
|
53 |
if(this.results != null){ |
|
54 |
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.results)); |
|
55 |
} |
|
56 |
} |
|
57 |
// this.resultsChange.emit({ |
|
58 |
// value: this.results |
|
59 |
// }); |
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
onDateChanged (event:any, item:any, applyToResults) { |
|
64 |
item.embargoEndDate = event.formatted; |
|
65 |
if((applyToResults && this.results.length > 1) || (!applyToResults && this.sources.length > 1)){ |
|
66 |
this.commonAccessRights = "EMBARGO"; |
|
67 |
this.commonEmbargoEndDate = item.embargoEndDate; |
|
68 |
this.applyToResults = applyToResults; |
|
69 |
this.confirmOpen(false,"Do you wish to apply the change to every result?"); |
|
70 |
}else{ |
|
71 |
this.validateEmbargoDate((applyToResults)?this.results:this.sources); |
|
72 |
} |
|
73 |
|
|
74 |
} |
|
75 |
onTypeChanged (event:any, item:any, applyToResults) { |
|
76 |
item.type =(event); |
|
77 |
if((applyToResults && this.results.length > 1) || (!applyToResults && this.sources.length > 1)){ |
|
78 |
this.commonType = item.type; |
|
79 |
this.applyToResults = applyToResults; |
|
80 |
this.confirmOpen(true, "Do you wish to apply the change to every result?"); |
|
81 |
} |
|
82 |
|
|
83 |
} |
|
84 |
// resultsChanged($event) { |
|
85 |
// this.results=$event.value; |
|
86 |
// this.resultsChange.emit({ |
|
87 |
// value: this.results |
|
88 |
// }); |
|
89 |
// } |
|
90 |
/* The following methods: |
|
91 |
*typeChanged |
|
92 |
*confirmOpen |
|
93 |
*confirmClose |
|
94 |
implement the functionality: change accessRights of a publication - apply to all if asked */ |
|
95 |
accessRightsTypeChanged (type:any, item:any, applyToResults) { |
|
96 |
item.accessRights = type; |
|
97 |
if((applyToResults && this.results.length > 1) || (!applyToResults && this.sources.length > 1)){ |
|
98 |
this.commonAccessRights = type; |
|
99 |
this.applyToResults = applyToResults; |
|
100 |
if(this.commonAccessRights != "EMBARGO"){ |
|
101 |
this.commonEmbargoEndDate = item.embargoEndDate; |
|
102 |
this.confirmOpen(false, "Do you wish to apply the change to every result?"); |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
107 |
confirmOpen(type: boolean, message: string){ |
|
108 |
this.typeChanged = type; |
|
109 |
this.alertApplyAll.cancelButton = true; |
|
110 |
this.alertApplyAll.okButton = true; |
|
111 |
this.alertApplyAll.alertTitle = "Change metadata"; |
|
112 |
this.alertApplyAll.message = "Do you wish to apply the change to every result?"; |
|
113 |
this.alertApplyAll.okButtonText = "Yes"; |
|
114 |
this.alertApplyAll.cancelButtonText = "No"; |
|
115 |
this.alertApplyAll.open(); |
|
116 |
if(!this.typeChanged && this.commonAccessRights == "EMBARGO"){ |
|
117 |
this.runValidation(); |
|
118 |
} |
|
119 |
|
|
120 |
} |
|
121 |
confirmClose(data){ |
|
122 |
|
|
123 |
if(this.typeChanged){ |
|
124 |
if(this.applyToResults){ |
|
125 |
for (var i = 0; i < this.results.length; i++) { |
|
126 |
if(this.results[i].source != 'openaire' && this.results[i].type!= 'project' && this.results[i].type!= 'community' ){ |
|
127 |
this.results[i].type = this.commonType; |
|
128 |
} |
|
129 |
} |
|
130 |
}else{ |
|
131 |
for (var i = 0; i < this.sources.length; i++) { |
|
132 |
if(this.sources[i].source != 'openaire' && this.sources[i].type!= 'project' && this.sources[i].type!= 'community' ){ |
|
133 |
this.sources[i].type = this.commonType; |
|
134 |
} |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
}else{ |
|
139 |
if(this.applyToResults){ |
|
140 |
for (var i = 0; i < this.results.length; i++) { |
|
141 |
if(this.results[i].source != 'openaire' && this.results[i].type!= 'project' && this.results[i].type!= 'community'){ |
|
142 |
this.results[i].accessRights = this.commonAccessRights; |
|
143 |
if(this.commonAccessRights == "EMBARGO"){ |
|
144 |
this.results[i].embargoEndDate = this.commonEmbargoEndDate; |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
}else{ |
|
149 |
for (var i = 0; i < this.sources.length; i++) { |
|
150 |
if(this.sources[i].source != 'openaire' && this.sources[i].type!= 'project' && this.sources[i].type!= 'community'){ |
|
151 |
this.sources[i].accessRights = this.commonAccessRights; |
|
152 |
if(this.commonAccessRights == "EMBARGO"){ |
|
153 |
this.sources[i].embargoEndDate = this.commonEmbargoEndDate; |
|
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
} |
|
158 |
} |
|
159 |
|
|
160 |
} |
|
161 |
|
|
162 |
|
|
163 |
remove(item:any, applyToResults:boolean){ |
|
164 |
if(applyToResults){ |
|
165 |
var index:number =this.results.indexOf(item); |
|
166 |
item.warningMessages.splice(0, item.warningMessages.length); |
|
167 |
if (index > -1) { |
|
168 |
this.results.splice(index, 1); |
|
169 |
localStorage.setItem(this.localStoragePrefix+'results', JSON.stringify(this.results)); |
|
170 |
} |
|
171 |
}else{ |
|
172 |
var index:number =this.sources.indexOf(item); |
|
173 |
item.warningMessages.splice(0, item.warningMessages.length); |
|
174 |
if (index > -1) { |
|
175 |
this.sources.splice(index, 1); |
|
176 |
localStorage.setItem(this.localStoragePrefix+'sources', JSON.stringify(this.sources)); |
|
177 |
|
|
178 |
} |
|
179 |
} |
|
180 |
this.runValidation(); |
|
181 |
} |
|
182 |
|
|
183 |
addStringToNumber(str:string, num:number){ |
|
184 |
return (+str)+num; |
|
185 |
} |
|
186 |
runValidation(){ |
|
187 |
console.log("Run validation!!!") |
|
188 |
this.warnings = []; |
|
189 |
this.errors = []; |
|
190 |
this.validateEmbargoDate(this.sources); |
|
191 |
this.validateEmbargoDate(this.results); |
|
192 |
this.validateProjectDuration(); |
|
193 |
} |
|
194 |
validateProjectDuration(){ |
|
195 |
for (var item of this.results) { |
|
196 |
if(item.type=='project'){ |
|
197 |
var project = item; |
|
198 |
for (var result of this.sources) { |
|
199 |
if(result.date && result.date != null){ |
|
200 |
if((project.startDate && result.date < project.startDate) || ( project.endDate && result.date > (5+ +project.endDate)) ){ |
|
201 |
var projectInfo = {title: project.title, startDate: project.startDate, endDate: project.endDate}; |
|
202 |
var message = {type:'projectDuration', resultId: result.id, result: result.title, projectId: project.id, project:projectInfo}; |
|
203 |
result.warningMessages.push(message); |
|
204 |
this.warnings.push(message); |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
} |
|
210 |
} |
|
211 |
validateEmbargoDate(sources){ |
|
212 |
for (var result of sources) { |
|
213 |
result.warningMessages= []; |
|
214 |
console.log("validate validateEmbargoDate" +result.date +" " + result.embargoEndDate +" "+" "+(result.date >result.embargoEndDate)); |
|
215 |
if(result.accessRights && result.accessRights== 'EMBARGO' && result.date && result.date != null && (result.embargoEndDate && result.embargoEndDate != null) && result.date >result.embargoEndDate.substr(0,4) ){ |
|
216 |
var message = {type:'embargoEndDate', resultId: result.id, result: result.title}; |
|
217 |
result.warningMessages.push(message); |
|
218 |
this.warnings.push(message); |
|
219 |
|
|
220 |
|
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
// getMessages(resultId){ |
|
225 |
// var messages = []; |
|
226 |
// for (var message of this.warnings) { |
|
227 |
// if(message.resultId==resultId){ |
|
228 |
// messages.push(message); |
|
229 |
// } |
|
230 |
// } |
|
231 |
// return messages; |
|
232 |
// } |
|
233 |
getProjectDurationMessage(result){ |
|
234 |
for (var message of result.warningMessages) { |
|
235 |
if(message.type == "projectDuration"){ |
|
236 |
return "Should be from "+message.project.startDate + ((message.project.endDate)?(" to "+((5+ +message.project.endDate))):""); |
|
237 |
} |
|
238 |
} |
|
239 |
return null; |
|
240 |
} |
|
241 |
getEmbargoEndDateMessage(result){ |
|
242 |
for (var message of result.warningMessages) { |
|
243 |
if(message.type == "embargoEndDate"){ |
|
244 |
return "Embargo end date must be later than published date"; |
|
245 |
} |
|
246 |
} |
|
247 |
return null; |
|
248 |
} |
|
249 |
|
|
250 |
|
|
251 |
} |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/selected/metadataPreview.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { SharedModule } from '../../../shared/shared.module'; |
|
3 |
import {MetadataPreviewComponent} from './metadataPreview.component'; |
|
4 |
import {AlertModalModule} from '../../../utils/modal/alertModal.module'; |
|
5 |
import { MyDatePickerModule } from '../../../utils/my-date-picker/my-date-picker.module'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
SharedModule, |
|
10 |
AlertModalModule, |
|
11 |
MyDatePickerModule, |
|
12 |
// BulkClaimModule, ClaimResultSearchFormModule, |
|
13 |
], |
|
14 |
declarations: [ |
|
15 |
MetadataPreviewComponent |
|
16 |
], exports:[MetadataPreviewComponent] |
|
17 |
}) |
|
18 |
export class MetadataPreviewModule { } |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/linkingGeneric.component.html | ||
---|---|---|
3 | 3 |
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "> |
4 | 4 |
<schema2jsonld *ngIf="url" [URL]="url" name="Link your research results" type="other"></schema2jsonld> |
5 | 5 |
|
6 |
<div class="uk-container uk-margin-top"> |
|
6 |
<div class="uk-container uk-container-large uk-margin-top">
|
|
7 | 7 |
|
8 | 8 |
|
9 | 9 |
<div > |
10 |
<div class="uk-width-1-1"> |
|
10 |
<!-- <div class="uk-width-1-1">
|
|
11 | 11 |
<helper position="top"></helper> |
12 |
</div> |
|
12 |
</div> -->
|
|
13 | 13 |
<div class="uk-grid helper-grid"> |
14 | 14 |
|
15 | 15 |
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper> |
16 | 16 |
<div class="uk-width-expand"> |
17 |
<!-- <ul uk-accordion class="uk-padding-small uk-margin-remove-bottom basket-accordion"> |
|
18 |
<li> |
|
19 |
<h3 class=" uk-text-right uk-margin-remove-vertical uk-width-small uk-margin-auto-left uk-accordion-title basket-title uk-text-danger" uk-tooltip="title:Click to see your selections"> |
|
20 | 17 |
|
21 |
<span class="uk-icon"><svg xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" height="28px" id="my-box" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="28px" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"></path></g> </svg> </span> |
|
22 |
<span class="uk-badge basket-badge ">{{(projects.length + contexts.length + results.length) | number}}</span> |
|
23 |
</h3> |
|
24 |
<div class="uk-accordion-content uk-background-muted uk-margin-remove-top uk-margin-left uk-margin-right dropbasket uk-padding-small uk-margin uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-grid uk-grid-stack"> |
|
25 |
<start-over [results]="results" [contexts]="contexts" [projects]="projects" [localStoragePrefix]=localStoragePrefix ></start-over> |
|
26 |
<claim-selected-projects title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType |
|
27 |
(showChange)="showChange($event)" [localStoragePrefix]=localStoragePrefix > </claim-selected-projects> |
|
28 |
|
|
29 |
<claim-selected-contexts title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [show]="show" [linkType]=linkType |
|
30 |
(showChange)="showChange($event)" [localStoragePrefix]=localStoragePrefix> </claim-selected-contexts> |
|
31 |
<claim-selected-results *ngIf="step!=3" title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false [localStoragePrefix]=localStoragePrefix> |
|
32 |
</claim-selected-results> |
|
33 |
</div> |
|
34 |
</li> |
|
35 |
</ul> --> |
|
36 |
|
|
37 |
<!-- <ul class="uk-subnav uk-margin-remove-bottom uk-subnav-pill linkingSteps" uk-margin=""> |
|
38 |
<li [class]="(step==1)?'uk-active':' '" ><a (click)="step=1;"> 1 Select Projects <span >or Communities </span></a></li> |
|
39 |
<li [class]="(step==2)?'uk-active':' '" ><a (click)="step=2;">2 Select Research Results </a></li> |
|
40 |
<li [class]="(step==3)?'uk-active':' '" (click)="step=3;"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" >3 Review metadata</a></li> |
|
41 |
</ul> |
|
42 |
<ul class=" uk-pagination uk-flex-center uk-margin-auto uk-text-center"> |
|
43 |
<li *ngIf="step !=1 " (click)="step=step-1;" ><a><span class=" " uk-pagination-previous></span> Previous</a></li> |
|
44 |
<li *ngIf="step !=3 " (click)="step=step + 1;" > |
|
45 |
<a>Next <span uk-pagination-next></span></a> |
|
46 |
</li> |
|
47 |
</ul> --> |
|
48 | 18 |
<div *ngIf= "properties" class="uk-section uk-section-default uk-padding-remove-top"> |
49 | 19 |
<div *ngIf="show=='claim'"> |
50 | 20 |
<claim-insert [results]="results" [show] = "show" (showChange)="showChange($event)" [(properties)] = properties [localStoragePrefix]=localStoragePrefix class="uk-float-right"></claim-insert> |
... | ... | |
54 | 24 |
Confirm that the links you provided are all correct |
55 | 25 |
<br><a (click)="show='projects';">Go back!</a> |
56 | 26 |
</div> |
57 |
<div style="" class="uk-container uk-margin-top"> |
|
27 |
<div style="" class="uk-container uk-container-large uk-margin-top">
|
|
58 | 28 |
<div class="uk-grid"> |
59 | 29 |
<div class="uk-width-expand"> |
60 | 30 |
<div class="uk-text-large"> |
... | ... | |
84 | 54 |
<claim-result-search-form [selectedResults]="results" [(properties)]=properties [localStoragePrefix]="localStoragePrefix+'results'"> </claim-result-search-form> |
85 | 55 |
</div> |
86 | 56 |
<div *ngIf="show=='claim'"> |
87 |
Metadata preview... |
|
57 |
<metadata-preview title= "Selected Sources" [results]="results" [sources]="sources" [localStoragePrefix]="localStoragePrefix"> |
|
58 |
</metadata-preview> |
|
88 | 59 |
</div> |
89 | 60 |
</div> |
90 | 61 |
<!-- Basket--> |
... | ... | |
163 | 134 |
FINISH LINKING <span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg></span> |
164 | 135 |
</div> |
165 | 136 |
</div> |
166 |
{{show}}
|
|
137 |
<!--
|
|
167 | 138 |
<div class="uk-h1">header - H1</div> |
168 | 139 |
<div class="uk-h2">header - H2</div> |
169 | 140 |
<div class="uk-h3">header - H3</div> |
170 | 141 |
<div class="uk-h4">header - H4</div> |
171 | 142 |
<div class="uk-h5">header - H5</div> |
172 | 143 |
<div class="uk-h6">header - H6</div> |
173 |
<div class="uk-h7">header - H7</div> |
|
144 |
<div class="uk-h7">header - H7</div> -->
|
|
174 | 145 |
|
175 | 146 |
</div> |
176 | 147 |
</div> |
177 | 148 |
</div> |
178 | 149 |
|
179 |
|
|
150 |
|
|
180 | 151 |
<helper position="right" styleName=" uk-width-1-5"></helper> |
181 | 152 |
</div> |
182 | 153 |
<helper position="bottom"></helper> |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/linking/linkingGeneric.component.ts | ||
---|---|---|
29 | 29 |
// contexts=[]; |
30 | 30 |
// projects=[]; |
31 | 31 |
results = []; |
32 |
show = "sources";
|
|
32 |
show = "claim";
|
|
33 | 33 |
date='8-6-2016'; |
34 | 34 |
keyword: string = ""; |
35 | 35 |
linkType:string ="sources"; // link type (selected in home page) : project, context, software, etc |
Also available in: Unified diff
[newlinking|Library]
Add metadataPreview component according to new linking mocks