Revision 56563
Added by Konstantina Galouni almost 5 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/searchResultsInDeposit.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
|
|
6 |
import {ErrorMessagesModule} from '../utils/errorMessages.module'; |
|
7 |
import {SearchResultsInDepositComponent} from './searchResultsInDeposit.component'; |
|
8 |
import {ApprovedByCommunityModule} from '../connect/approvedByCommunity/approved.module'; |
|
9 |
|
|
10 |
@NgModule({ |
|
11 |
imports: [ |
|
12 |
CommonModule, FormsModule, |
|
13 |
RouterModule, ErrorMessagesModule, |
|
14 |
ApprovedByCommunityModule |
|
15 |
], |
|
16 |
declarations: [ |
|
17 |
SearchResultsInDepositComponent |
|
18 |
], |
|
19 |
providers:[ |
|
20 |
], |
|
21 |
exports: [ |
|
22 |
SearchResultsInDepositComponent |
|
23 |
] |
|
24 |
}) |
|
25 |
export class SearchResultsInDepositModule { } |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/searchDataprovidersToDeposit.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
import { RouterModule } from '@angular/router'; |
|
5 |
|
|
6 |
import{SearchDataprovidersToDepositComponent} from './searchDataprovidersToDeposit.component'; |
|
7 |
|
|
8 |
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module'; |
|
9 |
|
|
10 |
import {DataProvidersServiceModule} from '../services/dataProvidersService.module'; |
|
11 |
import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module'; |
|
12 |
import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module'; |
|
13 |
import {FreeGuard} from'../login/freeGuard.guard'; |
|
14 |
import {IsRouteEnabled} from '../error/isRouteEnabled.guard'; |
|
15 |
|
|
16 |
@NgModule({ |
|
17 |
imports: [ |
|
18 |
CommonModule, FormsModule, |
|
19 |
RouterModule, |
|
20 |
DataProvidersServiceModule, |
|
21 |
SearchFormModule, SearchResultsModule, SearchPageModule |
|
22 |
|
|
23 |
], |
|
24 |
declarations: [ |
|
25 |
SearchDataprovidersToDepositComponent |
|
26 |
], |
|
27 |
providers:[FreeGuard, IsRouteEnabled], |
|
28 |
exports: [ |
|
29 |
SearchDataprovidersToDepositComponent |
|
30 |
] |
|
31 |
}) |
|
32 |
export class SearchDataprovidersToDepositModule { } |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/depositFirstPage.component.ts | ||
---|---|---|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {Router, ActivatedRoute} from '@angular/router'; |
|
3 |
import {ErrorCodes} from '../utils/properties/errorCodes'; |
|
4 |
|
|
5 |
import{EnvProperties} from '../utils/properties/env-properties'; |
|
6 |
|
|
7 |
import {RouterHelper} from '../utils/routerHelper.class'; |
|
8 |
|
|
9 |
import {ZenodoInformationClass} from './utils/zenodoInformation.class'; |
|
10 |
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service"; |
|
11 |
import {CommunityService} from "../connect/community/community.service"; |
|
12 |
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
13 |
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class"; |
|
14 |
import {ConnectHelper} from "../connect/connectHelper"; |
|
15 |
import {StringUtils} from "../utils/string-utils.class"; |
|
16 |
import {SearchFields} from "../utils/properties/searchFields"; |
|
17 |
|
|
18 |
@Component({ |
|
19 |
selector: 'deposit-first-page', |
|
20 |
template: ` |
|
21 |
<div class="uk-section uk-margin-top uk-padding-remove-bottom"> |
|
22 |
<div class="communityPanelBackground uk-margin-top uk-padding-small"> |
|
23 |
<div class="uk-align-center uk-container uk-container-large uk-margin-top uk-margin-bottom"> |
|
24 |
<div class="uk-text-center font-41 uk-margin-large-top"> |
|
25 |
<span class="uk-text-bold">Deposit</span> your research |
|
26 |
</div> |
|
27 |
|
|
28 |
<div class="uk-container uk-container-large uk-margin-large-top"> |
|
29 |
<div class="uk-grid-divider" uk-grid> |
|
30 |
<div class="uk-width-1-2@m uk-width-1-1@s"> |
|
31 |
<p class="uk-margin-auto uk-text-large">How to <span class="uk-text-bold">deposit</span> your research...</p> |
|
32 |
<span class="uk-grid"> |
|
33 |
<span class="uk-margin-top uk-icon"><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="search"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg></span> |
|
34 |
<!-- <span class="uk-margin-small-right" uk-icon="search"></span>--> |
|
35 |
<span class="uk-width-expand"> |
|
36 |
<div class="uk-margin-small-bottom">Find the appropriate repository, archive or journal</div> |
|
37 |
<div class="uk-text-small"> |
|
38 |
Find the appropriate thematic repository or archive to deposit your research products of any type (publication, data, software, other) or to include in your data management plan. |
|
39 |
Search and browse for OpenAIRE compliant repositories registered in OpenDOAR and re3data. |
|
40 |
Looking for Open Access journals? Find those that suits your community among the journals registered in the Directory of Open Access Journals (DOAJ). |
|
41 |
</div> |
|
42 |
</span> |
|
43 |
</span> |
|
44 |
<span class="uk-margin-top uk-grid"> |
|
45 |
<span class="uk-margin-top uk-icon"><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="upload"><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><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></span> |
|
46 |
<!-- <span class="uk-margin-small-right" uk-icon="upload"></span>--> |
|
47 |
<span class="uk-width-expand"> |
|
48 |
<div class="uk-margin-small-bottom">Deposit</div> |
|
49 |
<div class="uk-text-small"> |
|
50 |
Find the repository to deposit your research or use the Zenodo communities suggested by the community curators. |
|
51 |
</div> |
|
52 |
</span> |
|
53 |
</span> |
|
54 |
<div></div> |
|
55 |
</div> |
|
56 |
<div class="uk-width-1-2@m uk-width-1-1@s"> |
|
57 |
<p class="uk-margin-auto-top uk-margin-remove-bottom"> |
|
58 |
Start by <span class="uk-text-bold">searching</span> repositories |
|
59 |
</p> |
|
60 |
<div class="uk-margin"> |
|
61 |
<form class="uk-search uk-search-default uk-width-xlarge@l uk-width-medium@m uk-width-auto"> |
|
62 |
<!-- <span uk-search-icon class="uk-icon"></span>--> |
|
63 |
<button routerLinkActive="uk-link" |
|
64 |
routerLink="{{depositRoute}}" [queryParams]="{keyword: keyword}" class="uk-search-icon uk-icon" uk-search-icon> |
|
65 |
</button> |
|
66 |
<input class="uk-search-input uk-input" |
|
67 |
type="search" [(ngModel)]="keyword" name="keyword" |
|
68 |
placeholder="{{searchPlaceHolder}}"> |
|
69 |
</form> |
|
70 |
</div> |
|
71 |
<div class="uk-width-1-4 uk-text-right"> |
|
72 |
<hr class="uk-divider-vertical"> |
|
73 |
<div>OR</div> |
|
74 |
<hr class="uk-divider-vertical"> |
|
75 |
</div> |
|
76 |
|
|
77 |
<div> |
|
78 |
<a [queryParams]="{}" routerLinkActive="router-link-active" routerLink="/search-deposit" |
|
79 |
type="submit" class="uk-button uk-button-large uk-button-primary uk-padding uk-padding-remove-vertical"> |
|
80 |
<span><span>Browse all repositories</span><span uk-icon="arrow-right"></span></span> |
|
81 |
</a> |
|
82 |
</div> |
|
83 |
</div> |
|
84 |
</div> |
|
85 |
</div> |
|
86 |
</div> |
|
87 |
</div> |
|
88 |
</div> |
|
89 |
|
|
90 |
<div class="uk-section tm-middle uk-container uk-container-large uk-margin-small-top uk-padding-remove-top uk-padding-remove-bottom"> |
|
91 |
<div class="uk-container uk-container-large uk-margin-bottom border-grey uk-margin-medium-top"> |
|
92 |
<div class="uk-grid"> |
|
93 |
<div class="uk-width-1-2 uk-text-center"> |
|
94 |
<div class="uk-margin-top"> |
|
95 |
<svg xmlns="http://www.w3.org/2000/svg" width="173" height="56.685" viewBox="0 0 173 56.685"><defs><style>.a{fill:#191919;}</style></defs><path class="a" d="M171.749,22.311a16.158,16.158,0,0,0-3.364-4.953A15.511,15.511,0,0,0,157.4,12.837a15.213,15.213,0,0,0-6.074,1.206,16.4,16.4,0,0,0-2.63,1.424,16.2,16.2,0,0,0-2.325,1.891,14.893,14.893,0,0,0-1.242,1.383,19.241,19.241,0,0,0-1.173,1.7,19.372,19.372,0,0,0-1.482,3.343c.048-1.943.332-4.842,1.482-6.468V3.272a3.081,3.081,0,0,0-.993-2.323,3.251,3.251,0,0,0-5.556,2.323V15.765a17.084,17.084,0,0,0-4.261-2.156,14.8,14.8,0,0,0-4.781-.773,15.314,15.314,0,0,0-6.028,1.206,15.575,15.575,0,0,0-4.959,3.316,16.056,16.056,0,0,0-3.352,4.953c-.063.142-.118.286-.177.43-.056-.144-.111-.288-.173-.43a16.158,16.158,0,0,0-3.364-4.953,15.519,15.519,0,0,0-4.95-3.316,15.795,15.795,0,0,0-12.105,0,16.068,16.068,0,0,0-4.954,3.316,15.182,15.182,0,0,0-3.359,4.953c-.058.136-.109.272-.162.407-.056-.135-.109-.271-.167-.407a16.056,16.056,0,0,0-3.357-4.953,15.532,15.532,0,0,0-4.956-3.316,15.795,15.795,0,0,0-12.105,0,16.084,16.084,0,0,0-4.948,3.316,15.129,15.129,0,0,0-3.366,4.953c-.051.125-.1.253-.148.378-.051-.125-.1-.253-.155-.378a16.165,16.165,0,0,0-3.366-4.953,15.489,15.489,0,0,0-10.979-4.521,15.185,15.185,0,0,0-6.072,1.206,16.01,16.01,0,0,0-4.622,3.017v-.521A3.335,3.335,0,0,0,27.211,13.2H3.837a3.334,3.334,0,0,0,0,6.669h18.37L.658,48.884A3.333,3.333,0,0,0,0,50.872v2.176a3.337,3.337,0,0,0,3.336,3.336H28.214a3.335,3.335,0,0,0,3.324-3.09,15.693,15.693,0,0,0,3.675,2.184,15.189,15.189,0,0,0,6.031,1.207A14.892,14.892,0,0,0,49.857,54.1a15.447,15.447,0,0,0,4.827-5.188v4.5a3.245,3.245,0,0,0,3.277,3.275,3.194,3.194,0,0,0,2.281-.949,3.077,3.077,0,0,0,.991-2.326V41.733h-.012a.087.087,0,0,1,.012-.015h-8.17a3.175,3.175,0,0,0-1.851.558,3.007,3.007,0,0,0-1.161,1.507l-.535,1.1a8.969,8.969,0,0,1-8.271,5.254,9.141,9.141,0,0,1-3.493-.684,8.463,8.463,0,0,1-2.883-1.939,9.963,9.963,0,0,1-1.94-2.888,8.4,8.4,0,0,1-.729-3.447V38.252H61.234V28.34a8.74,8.74,0,0,1,.688-3.442,8.959,8.959,0,0,1,8.355-5.515,9.117,9.117,0,0,1,3.493.687,8.459,8.459,0,0,1,2.883,1.94,10.032,10.032,0,0,1,1.94,2.889,8.36,8.36,0,0,1,.734,3.442V53.409A3.233,3.233,0,0,0,82.6,56.684a3.211,3.211,0,0,0,2.286-.949,3.107,3.107,0,0,0,.986-2.326v-4.5a15.828,15.828,0,0,0,2.482,3.249,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.035,16.035,0,0,0,5-3.314,15.226,15.226,0,0,0,3.359-4.951c.044-.112.087-.225.129-.338.046.113.087.226.134.338a15.068,15.068,0,0,0,3.359,4.951,16.075,16.075,0,0,0,4.951,3.314,15.79,15.79,0,0,0,12.109,0,15.476,15.476,0,0,0,4.946-3.314,16.166,16.166,0,0,0,3.366-4.951c.06-.142.116-.283.173-.426.058.143.111.284.173.426a16.07,16.07,0,0,0,3.359,4.951,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.008,16.008,0,0,0,5-3.314A15.314,15.314,0,0,0,173,41.178V28.341A14.991,14.991,0,0,0,171.749,22.311ZM8.35,49.716,25.794,26.224a16.054,16.054,0,0,0-.143,2.117V41.178A14.759,14.759,0,0,0,26.9,47.211a16.514,16.514,0,0,0,1.366,2.5H8.35ZM50.285,31.7H32.2V28.34a8.738,8.738,0,0,1,.686-3.442,8.951,8.951,0,0,1,8.36-5.515,9.1,9.1,0,0,1,3.486.687,8.423,8.423,0,0,1,2.885,1.94,10.033,10.033,0,0,1,1.94,2.889,8.318,8.318,0,0,1,.729,3.442V31.7Zm58.093,9.48a8.7,8.7,0,0,1-.688,3.447,8.941,8.941,0,0,1-8.352,5.511,9.141,9.141,0,0,1-3.493-.684,8.417,8.417,0,0,1-2.883-1.939,9.917,9.917,0,0,1-1.94-2.888,8.353,8.353,0,0,1-.729-3.447V28.341A8.74,8.74,0,0,1,90.98,24.9a8.935,8.935,0,0,1,1.937-2.889,9.165,9.165,0,0,1,9.9-1.94,8.433,8.433,0,0,1,2.888,1.94,10.129,10.129,0,0,1,1.94,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Zm29.035,0a8.32,8.32,0,0,1-.729,3.447,9.947,9.947,0,0,1-1.94,2.888,8.358,8.358,0,0,1-2.888,1.939,9.337,9.337,0,0,1-7.018,0,9.046,9.046,0,0,1-4.825-4.826,8.735,8.735,0,0,1-.69-3.447V28.341a8.439,8.439,0,0,1,.732-3.442,10.1,10.1,0,0,1,1.94-2.889,8.522,8.522,0,0,1,2.883-1.94,9.152,9.152,0,0,1,3.493-.687,8.985,8.985,0,0,1,8.357,5.515,8.775,8.775,0,0,1,.686,3.442V41.178Zm29.035,0a8.82,8.82,0,0,1-.686,3.447,9.129,9.129,0,0,1-11.85,4.826,8.424,8.424,0,0,1-2.882-1.939,9.946,9.946,0,0,1-1.942-2.888,8.337,8.337,0,0,1-.732-3.447V28.341a8.742,8.742,0,0,1,.69-3.442,8.935,8.935,0,0,1,1.937-2.889,9.169,9.169,0,0,1,9.905-1.94,8.423,8.423,0,0,1,2.885,1.94,10.088,10.088,0,0,1,1.942,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Z"/></svg> |
|
96 |
</div> |
|
97 |
<div class="uk-margin-top"> |
|
98 |
<span class="uk-text-bold">Deposit</span> your research <span class="uk-text-bold">immediately</span> |
|
99 |
</div> |
|
100 |
<a *ngIf="zenodoInformation.shareInZenodoUrl" href="{{zenodoInformation.shareInZenodoUrl}}" type="submit" |
|
101 |
class="uk-button uk-button-primary uk-padding uk-padding-remove-vertical uk-margin-medium-top uk-margin-bottom"> |
|
102 |
<span><span>Related zenodo communities</span><span uk-icon="arrow-right"></span></span> |
|
103 |
</a> |
|
104 |
<a *ngIf="!zenodoInformation.shareInZenodoUrl" target="_blank" href="{{zenodoInformation.url}}" type="submit" |
|
105 |
class="uk-button uk-button-primary uk-padding uk-padding-remove-vertical uk-margin-medium-top uk-margin-bottom"> |
|
106 |
<span><span>Deposit in Zenodo</span><span uk-icon="arrow-right"></span></span> |
|
107 |
</a> |
|
108 |
</div> |
|
109 |
<div class="uk-width-1-2"> |
|
110 |
<div class="uk-margin-top"> |
|
111 |
<div class="uk-text-bold">Research. Shared.</div> |
|
112 |
<p> |
|
113 |
All research outputs from across all fields of research are welcome! Sciences and Humanities, really! </p> |
|
114 |
</div> |
|
115 |
<div class="uk-margin-top"> |
|
116 |
<div class="uk-text-bold">Citeable. Discoverable. </div> |
|
117 |
<p> |
|
118 |
Uploads gets a Digital Object Identifier (DOI) to make them easily and uniquely citeable. |
|
119 |
</p> |
|
120 |
</div> |
|
121 |
<div class="uk-margin-top"> |
|
122 |
<div class="uk-text-bold">Funding</div> |
|
123 |
<p> |
|
124 |
Identify grants, integrated in reporting lines for research funded by the European Commission via OpenAIRE. |
|
125 |
</p> |
|
126 |
</div> |
|
127 |
<div class="uk-margin-top"> |
|
128 |
<div class="uk-text-bold">Flexible licensing</div> |
|
129 |
<p> |
|
130 |
Because not everything is under Creative Commons. |
|
131 |
</p> |
|
132 |
</div> |
|
133 |
<div class="uk-margin-top"> |
|
134 |
<div class="uk-text-bold">Safe</div> |
|
135 |
<p> |
|
136 |
Your research output is stored safely for the future in the same cloud infrastructure as CERN's own LHC research data. |
|
137 |
</p> |
|
138 |
</div> |
|
139 |
</div> |
|
140 |
</div> |
|
141 |
</div> |
|
142 |
</div> |
|
143 |
|
|
144 |
<div class="uk-section uk-section-muted uk-margin-top uk-margin-bottom uk-padding-remove-bottom uk-padding-remove-top"> |
|
145 |
<!-- grey-background--> |
|
146 |
<div class="uk-margin-top uk-padding-small"> |
|
147 |
<div class="uk-align-center uk-container uk-container-large uk-margin-top uk-margin-bottom"> |
|
148 |
<helper position="bottom"></helper> |
|
149 |
</div> |
|
150 |
</div> |
|
151 |
</div> |
|
152 |
` |
|
153 |
}) |
|
154 |
|
|
155 |
export class DepositFirstPageComponent { |
|
156 |
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); |
|
157 |
fetchZenodoInformation: FetchZenodoInformation; |
|
158 |
|
|
159 |
@Input() compatibility: string = ''; |
|
160 |
@Input() piwikSiteId = null; |
|
161 |
// Type of entity: Publication or Research Data |
|
162 |
@Input() requestFor: string = "Publications"; |
|
163 |
|
|
164 |
public organization: {"name": string, "url": string}; |
|
165 |
public organizationId: string = ""; |
|
166 |
|
|
167 |
// Id of the new selected organization to be searched |
|
168 |
public selectedId: string = ""; |
|
169 |
|
|
170 |
@Input() subjectResults: boolean = false; |
|
171 |
@Input() subject: string = ""; |
|
172 |
|
|
173 |
public status: number; |
|
174 |
public warningMessage: string = ""; |
|
175 |
|
|
176 |
public parameterNames:string[] =[]; |
|
177 |
public parameterValues:string[] =[]; |
|
178 |
|
|
179 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
180 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
|
181 |
|
|
182 |
sub: any; piwiksub: any; |
|
183 |
properties:EnvProperties; |
|
184 |
url=null; |
|
185 |
|
|
186 |
public keyword: string; |
|
187 |
public depositRoute = "/search-deposit"; |
|
188 |
public searchPlaceHolder = "Search for repositories by title, country, organization, subject..."; |
|
189 |
|
|
190 |
constructor (private _router: Router, |
|
191 |
private route: ActivatedRoute, |
|
192 |
private _zenodoCommunitieService: ZenodoCommunitiesService, |
|
193 |
private _communityService: CommunityService, |
|
194 |
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { |
|
195 |
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService); |
|
196 |
} |
|
197 |
ngOnInit() { |
|
198 |
this.route.data |
|
199 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
200 |
this.properties = data.envSpecific; |
|
201 |
|
|
202 |
this.route.queryParams.subscribe(params => { |
|
203 |
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); |
|
204 |
if (!communityId) { |
|
205 |
communityId = params['communityId']; |
|
206 |
} |
|
207 |
|
|
208 |
if (communityId) { |
|
209 |
|
|
210 |
if (communityId != null && communityId != '') { |
|
211 |
|
|
212 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe( |
|
213 |
community => { |
|
214 |
let masterZenodoCommunityId = community.zenodoCommunity; |
|
215 |
if (masterZenodoCommunityId) { |
|
216 |
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId; |
|
217 |
//this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation); |
|
218 |
} else { |
|
219 |
this.zenodoInformation.url = this.properties.zenodo; |
|
220 |
this.zenodoInformation.name = "Zenodo"; |
|
221 |
} |
|
222 |
//this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation); |
|
223 |
}, |
|
224 |
error => { |
|
225 |
this.handleError("Error getting community with id: " + communityId, error); |
|
226 |
} |
|
227 |
); |
|
228 |
} |
|
229 |
} |
|
230 |
|
|
231 |
if (!this.zenodoInformation.shareInZenodoUrl) { |
|
232 |
this.zenodoInformation.url = this.properties.zenodo; |
|
233 |
} |
|
234 |
if (!this.zenodoInformation.name) { |
|
235 |
this.zenodoInformation.name = "Zenodo"; |
|
236 |
} |
|
237 |
}); |
|
238 |
|
|
239 |
}); |
|
240 |
} |
|
241 |
|
|
242 |
ngOnDestroy() {} |
|
243 |
|
|
244 |
private handleError(message: string, error) { |
|
245 |
console.error("Deposit Result Page: "+message, error); |
|
246 |
} |
|
247 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/depositFirstPage.module.ts | ||
---|---|---|
1 |
/* Common Component of deposit for both research data & ppublications*/ |
|
2 |
|
|
3 |
import { NgModule } from '@angular/core'; |
|
4 |
import { CommonModule } from '@angular/common'; |
|
5 |
import { FormsModule } from '@angular/forms'; |
|
6 |
import { RouterModule } from '@angular/router'; |
|
7 |
|
|
8 |
import {PiwikServiceModule} from '../utils/piwik/piwikService.module'; |
|
9 |
import {HelperModule} from '../utils/helper/helper.module'; |
|
10 |
import {IFrameModule} from '../utils/iframe.module'; |
|
11 |
import {Schema2jsonldModule} from '../sharedComponents/schema2jsonld/schema2jsonld.module'; |
|
12 |
import { SEOServiceModule } from '../sharedComponents/SEO/SEOService.module'; |
|
13 |
import {DepositFirstPageComponent} from "./depositFirstPage.component"; |
|
14 |
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service"; |
|
15 |
import {CommunityService} from "../connect/community/community.service"; |
|
16 |
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
17 |
|
|
18 |
|
|
19 |
@NgModule({ |
|
20 |
imports: [ |
|
21 |
CommonModule, FormsModule, |
|
22 |
RouterModule, |
|
23 |
PiwikServiceModule, |
|
24 |
HelperModule, |
|
25 |
IFrameModule, Schema2jsonldModule, SEOServiceModule |
|
26 |
], |
|
27 |
declarations: [ |
|
28 |
DepositFirstPageComponent |
|
29 |
], |
|
30 |
exports: [ |
|
31 |
DepositFirstPageComponent |
|
32 |
], |
|
33 |
providers: [ |
|
34 |
ZenodoCommunitiesService, CommunityService, SearchZenodoCommunitiesService |
|
35 |
] |
|
36 |
}) |
|
37 |
export class DepositFirstPageModule { } |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/searchResultsInDeposit.component.html | ||
---|---|---|
1 |
<errorMessages *ngIf="status != errorCodes.NONE" [status]="[status]" [type]="'results'"></errorMessages> |
|
2 |
<div *ngIf="status == errorCodes.NONE" class="uk-text-center uk-align-center uk-width-3-5"> |
|
3 |
<p class="uk-text-large uk-text-muted uk-margin">There are no repositories for your preferences</p> |
|
4 |
|
|
5 |
<p class="uk-text-large uk-text-muted">We suggest to deposit your research in</p> |
|
6 |
<!-- <a href="{{zenodoInformation.url}}" target="_blank" class="custom-external custom-icon">{{zenodoInformation.name}}</a>--> |
|
7 |
<svg xmlns="http://www.w3.org/2000/svg" width="173" height="56.685" viewBox="0 0 173 56.685"><defs><style>.a{fill:#191919;}</style></defs><path class="a" d="M171.749,22.311a16.158,16.158,0,0,0-3.364-4.953A15.511,15.511,0,0,0,157.4,12.837a15.213,15.213,0,0,0-6.074,1.206,16.4,16.4,0,0,0-2.63,1.424,16.2,16.2,0,0,0-2.325,1.891,14.893,14.893,0,0,0-1.242,1.383,19.241,19.241,0,0,0-1.173,1.7,19.372,19.372,0,0,0-1.482,3.343c.048-1.943.332-4.842,1.482-6.468V3.272a3.081,3.081,0,0,0-.993-2.323,3.251,3.251,0,0,0-5.556,2.323V15.765a17.084,17.084,0,0,0-4.261-2.156,14.8,14.8,0,0,0-4.781-.773,15.314,15.314,0,0,0-6.028,1.206,15.575,15.575,0,0,0-4.959,3.316,16.056,16.056,0,0,0-3.352,4.953c-.063.142-.118.286-.177.43-.056-.144-.111-.288-.173-.43a16.158,16.158,0,0,0-3.364-4.953,15.519,15.519,0,0,0-4.95-3.316,15.795,15.795,0,0,0-12.105,0,16.068,16.068,0,0,0-4.954,3.316,15.182,15.182,0,0,0-3.359,4.953c-.058.136-.109.272-.162.407-.056-.135-.109-.271-.167-.407a16.056,16.056,0,0,0-3.357-4.953,15.532,15.532,0,0,0-4.956-3.316,15.795,15.795,0,0,0-12.105,0,16.084,16.084,0,0,0-4.948,3.316,15.129,15.129,0,0,0-3.366,4.953c-.051.125-.1.253-.148.378-.051-.125-.1-.253-.155-.378a16.165,16.165,0,0,0-3.366-4.953,15.489,15.489,0,0,0-10.979-4.521,15.185,15.185,0,0,0-6.072,1.206,16.01,16.01,0,0,0-4.622,3.017v-.521A3.335,3.335,0,0,0,27.211,13.2H3.837a3.334,3.334,0,0,0,0,6.669h18.37L.658,48.884A3.333,3.333,0,0,0,0,50.872v2.176a3.337,3.337,0,0,0,3.336,3.336H28.214a3.335,3.335,0,0,0,3.324-3.09,15.693,15.693,0,0,0,3.675,2.184,15.189,15.189,0,0,0,6.031,1.207A14.892,14.892,0,0,0,49.857,54.1a15.447,15.447,0,0,0,4.827-5.188v4.5a3.245,3.245,0,0,0,3.277,3.275,3.194,3.194,0,0,0,2.281-.949,3.077,3.077,0,0,0,.991-2.326V41.733h-.012a.087.087,0,0,1,.012-.015h-8.17a3.175,3.175,0,0,0-1.851.558,3.007,3.007,0,0,0-1.161,1.507l-.535,1.1a8.969,8.969,0,0,1-8.271,5.254,9.141,9.141,0,0,1-3.493-.684,8.463,8.463,0,0,1-2.883-1.939,9.963,9.963,0,0,1-1.94-2.888,8.4,8.4,0,0,1-.729-3.447V38.252H61.234V28.34a8.74,8.74,0,0,1,.688-3.442,8.959,8.959,0,0,1,8.355-5.515,9.117,9.117,0,0,1,3.493.687,8.459,8.459,0,0,1,2.883,1.94,10.032,10.032,0,0,1,1.94,2.889,8.36,8.36,0,0,1,.734,3.442V53.409A3.233,3.233,0,0,0,82.6,56.684a3.211,3.211,0,0,0,2.286-.949,3.107,3.107,0,0,0,.986-2.326v-4.5a15.828,15.828,0,0,0,2.482,3.249,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.035,16.035,0,0,0,5-3.314,15.226,15.226,0,0,0,3.359-4.951c.044-.112.087-.225.129-.338.046.113.087.226.134.338a15.068,15.068,0,0,0,3.359,4.951,16.075,16.075,0,0,0,4.951,3.314,15.79,15.79,0,0,0,12.109,0,15.476,15.476,0,0,0,4.946-3.314,16.166,16.166,0,0,0,3.366-4.951c.06-.142.116-.283.173-.426.058.143.111.284.173.426a16.07,16.07,0,0,0,3.359,4.951,15.454,15.454,0,0,0,4.954,3.314,15.671,15.671,0,0,0,12.061,0,16.008,16.008,0,0,0,5-3.314A15.314,15.314,0,0,0,173,41.178V28.341A14.991,14.991,0,0,0,171.749,22.311ZM8.35,49.716,25.794,26.224a16.054,16.054,0,0,0-.143,2.117V41.178A14.759,14.759,0,0,0,26.9,47.211a16.514,16.514,0,0,0,1.366,2.5H8.35ZM50.285,31.7H32.2V28.34a8.738,8.738,0,0,1,.686-3.442,8.951,8.951,0,0,1,8.36-5.515,9.1,9.1,0,0,1,3.486.687,8.423,8.423,0,0,1,2.885,1.94,10.033,10.033,0,0,1,1.94,2.889,8.318,8.318,0,0,1,.729,3.442V31.7Zm58.093,9.48a8.7,8.7,0,0,1-.688,3.447,8.941,8.941,0,0,1-8.352,5.511,9.141,9.141,0,0,1-3.493-.684,8.417,8.417,0,0,1-2.883-1.939,9.917,9.917,0,0,1-1.94-2.888,8.353,8.353,0,0,1-.729-3.447V28.341A8.74,8.74,0,0,1,90.98,24.9a8.935,8.935,0,0,1,1.937-2.889,9.165,9.165,0,0,1,9.9-1.94,8.433,8.433,0,0,1,2.888,1.94,10.129,10.129,0,0,1,1.94,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Zm29.035,0a8.32,8.32,0,0,1-.729,3.447,9.947,9.947,0,0,1-1.94,2.888,8.358,8.358,0,0,1-2.888,1.939,9.337,9.337,0,0,1-7.018,0,9.046,9.046,0,0,1-4.825-4.826,8.735,8.735,0,0,1-.69-3.447V28.341a8.439,8.439,0,0,1,.732-3.442,10.1,10.1,0,0,1,1.94-2.889,8.522,8.522,0,0,1,2.883-1.94,9.152,9.152,0,0,1,3.493-.687,8.985,8.985,0,0,1,8.357,5.515,8.775,8.775,0,0,1,.686,3.442V41.178Zm29.035,0a8.82,8.82,0,0,1-.686,3.447,9.129,9.129,0,0,1-11.85,4.826,8.424,8.424,0,0,1-2.882-1.939,9.946,9.946,0,0,1-1.942-2.888,8.337,8.337,0,0,1-.732-3.447V28.341a8.742,8.742,0,0,1,.69-3.442,8.935,8.935,0,0,1,1.937-2.889,9.169,9.169,0,0,1,9.905-1.94,8.423,8.423,0,0,1,2.885,1.94,10.088,10.088,0,0,1,1.942,2.889,8.356,8.356,0,0,1,.729,3.442V41.178Z"/></svg> |
|
8 |
<p>The OpenAIRE Catch-all repository hosted at CERN cloud infrastructure. Whatever your field of research is, you can deposit any type of research product, select the proper license, ask for a DOI and link it to the funding projects for easy reporting.</p> |
|
9 |
<a *ngIf="zenodoInformation.shareInZenodoUrl" href="{{zenodoInformation.shareInZenodoUrl}}" type="submit" |
|
10 |
class="uk-button portal-button uk-padding uk-padding-remove-vertical uk-margin-small-left"> |
|
11 |
<span><span>Related zenodo communities</span><span uk-icon="arrow-right"></span></span> |
|
12 |
</a> |
|
13 |
<a *ngIf="!zenodoInformation.shareInZenodoUrl" target="_blank" href="{{zenodoInformation.url}}" type="submit" |
|
14 |
class="uk-button portal-button uk-padding uk-padding-remove-vertical uk-margin-small-left"> |
|
15 |
<span><span>Deposit in Zenodo</span><span uk-icon="arrow-right"></span></span> |
|
16 |
</a> |
|
17 |
</div> |
|
18 |
|
|
19 |
<ul [class]="'uk-margin-top uk-list uk-margin '+custom_class"> |
|
20 |
<li *ngFor="let result of results" class="uk-animation-fade"> |
|
21 |
<div class=" uk-card uk-card-small uk-card-default uk-card-body uk-padding-remove-horizontal"> |
|
22 |
<h3 class="uk-card-title uk-margin-remove uk-padding uk-padding-remove-vertical"> |
|
23 |
<div [title] = result.title.accessMode class="uk-h5 uk-grid uk-margin-small-bottom"> |
|
24 |
<a *ngIf="result.id && !result.compatibilityUNKNOWN" class="uk-width-expand uk-text-bold uk-flex uk-flex-middle" |
|
25 |
[queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}"> |
|
26 |
<p *ngIf="result['title'].name || result.acronym"><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result.acronym && result['title'].name">-</span><span *ngIf="result['title'].name" [innerHTML]="result['title'].name"></span><span *ngIf="result.code"> ({{result.code}})</span></p> |
|
27 |
<p *ngIf="!result['title'].name && !result.acronym">[no title available]<span *ngIf="result.code"> ({{result.code}})</span></p> |
|
28 |
</a> |
|
29 |
<div *ngIf="!result.id || result.compatibilityUNKNOWN" class="uk-width-expand uk-text-bold uk-flex uk-flex-middle"> |
|
30 |
<p *ngIf="result['title'].name || result.acronym"><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result.acronym && result['title'].name">-</span><span *ngIf="result['title'].name" [innerHTML]="result['title'].name"></span><span *ngIf="result.code"> ({{result.code}})</span></p> |
|
31 |
<p *ngIf="!result['title'].name && !result.acronym">[no title available]<span *ngIf="result.code"> ({{result.code}})</span></p> |
|
32 |
</div> |
|
33 |
<span class="uk-width-expand uk-flex uk-flex-bottom uk-flex-right"> |
|
34 |
<a *ngIf="result['websiteURL']" href="{{result['websiteURL']}}" target="_blank" type="submit" class="uk-float-right uk-button portal-button uk-padding uk-padding-remove-vertical uk-margin-small-left"> |
|
35 |
<span><span>Visit repository to deposit</span><span uk-icon="arrow-right"></span></span> |
|
36 |
<!-- <span class="uk-button-text ">Visit repository to deposit</span>--> |
|
37 |
</a> |
|
38 |
</span> |
|
39 |
</div> |
|
40 |
</h3> |
|
41 |
<hr> |
|
42 |
|
|
43 |
<div class="uk-padding uk-padding-remove-vertical"> |
|
44 |
<span *ngIf="result['type'] != undefined && result['type'] != ''" class="uk-label custom-label label-blue label-dataprovider" title="Type"> {{result['type']}}</span>{{' '}} |
|
45 |
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != '' && result['compatibility'] != 'not available'" class="uk-label custom-label label-compatibility" title="Compatibility">{{result.compatibility}}</span>{{' '}} |
|
46 |
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != '' && result['compatibility'] == 'not available'" class="uk-label custom-label label-danger" title="Compatibility">NOT OPENAIRE COMPATIBLE</span>{{' '}} |
|
47 |
|
|
48 |
<div class="uk-margin-top" *ngIf="result['countries'] && result['countries'].length > 0"> |
|
49 |
<div class="uk-text-muted">Countries</div> |
|
50 |
<span *ngFor="let country of result['countries'].slice(0,10) let i = index">{{country}}{{(i < ( result['countries'].slice(0,10).length-1))?"; ":""}}{{(i == result['countries'].slice(0,10).length-1 && result['countries'].length > 10)?"...":""}}</span> |
|
51 |
</div> |
|
52 |
<div class="uk-margin-top" *ngIf="result['organizations'] != undefined && result['organizations'].length > 0"> |
|
53 |
<div class="uk-text-muted">Organizations</div> |
|
54 |
<div> |
|
55 |
<span *ngFor="let organization of result['organizations'].slice(0,10) let i=index"> |
|
56 |
<a *ngIf="organization.id && !result.compatibilityUNKNOWN" [queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization"> |
|
57 |
<u>{{organization.name}}</u> |
|
58 |
</a> |
|
59 |
<span *ngIf="!organization.id || result.compatibilityUNKNOWN">{{organization.name}}</span> |
|
60 |
<span *ngIf="(i < result['organizations'].length-1) && (i < 9)">;{{" "}}</span> |
|
61 |
</span> |
|
62 |
<span *ngIf="result['organizations'].length > 10">...</span> |
|
63 |
</div> |
|
64 |
</div> |
|
65 |
<div class="uk-margin-top" *ngIf="result['subjects'] && result['subjects'].length > 0"> |
|
66 |
<div class="uk-text-muted">Subjects</div> |
|
67 |
<span *ngFor="let subject of result['subjects'].slice(0,10) let i = index">{{subject}}{{(i < ( result['subjects'].slice(0,10).length-1))?"; ":""}}{{(i == result['subjects'].slice(0,10).length-1 && result['subjects'].length > 10)?"...":""}}</span> |
|
68 |
</div> |
|
69 |
<div class="uk-margin-top" *ngIf="result['OAIPMHURL'] != undefined && result['OAIPMHURL'] != ''"> |
|
70 |
<div class="uk-text-muted">OAI-PMH</div> |
|
71 |
<span> |
|
72 |
<a href="{{result['OAIPMHURL']}}" target="_blank" class="custom-external custom-icon"> |
|
73 |
<u>{{result['OAIPMHURL']}}</u> |
|
74 |
</a> |
|
75 |
</span> |
|
76 |
</div> |
|
77 |
</div> |
|
78 |
<!-- <p>Lorem ipsum <a href="#">dolor</a> sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>--> |
|
79 |
</div> |
|
80 |
</li> |
|
81 |
</ul> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/searchResultsInDeposit.component.ts | ||
---|---|---|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {SearchResult} from '../utils/entities/searchResult'; |
|
3 |
import {ErrorCodes} from '../utils/properties/errorCodes'; |
|
4 |
import {RouterHelper} from '../utils/routerHelper.class'; |
|
5 |
import{EnvProperties} from '../utils/properties/env-properties'; |
|
6 |
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service"; |
|
7 |
import {CommunityService} from "../connect/community/community.service"; |
|
8 |
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
9 |
import {ZenodoInformationClass} from "./utils/zenodoInformation.class"; |
|
10 |
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class"; |
|
11 |
import {ConnectHelper} from "../connect/connectHelper"; |
|
12 |
import {PiwikHelper} from "../../utils/piwikHelper"; |
|
13 |
import {ActivatedRoute} from "@angular/router"; |
|
14 |
@Component({ |
|
15 |
selector: 'deposit-result', |
|
16 |
templateUrl:'searchResultsInDeposit.component.html' |
|
17 |
}) |
|
18 |
|
|
19 |
export class SearchResultsInDepositComponent { |
|
20 |
@Input() results: SearchResult[]; |
|
21 |
@Input() status: number; |
|
22 |
@Input() type: string; |
|
23 |
@Input() showLoading: boolean = false; |
|
24 |
@Input() showSubjects: boolean = false; |
|
25 |
@Input() showOrganizations: boolean = true; |
|
26 |
@Input() custom_class: string = "search-results"; |
|
27 |
@Input() properties:EnvProperties; |
|
28 |
|
|
29 |
|
|
30 |
public urlParam: string; |
|
31 |
public linkToAdvancedSearchPage: string; |
|
32 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
|
33 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
34 |
public errorMessage: string = "No results found"; |
|
35 |
|
|
36 |
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); |
|
37 |
fetchZenodoInformation: FetchZenodoInformation; |
|
38 |
|
|
39 |
constructor (private route: ActivatedRoute, |
|
40 |
private _ΖenodoCommunitieService: ZenodoCommunitiesService, |
|
41 |
private _communityService: CommunityService, |
|
42 |
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { |
|
43 |
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService); |
|
44 |
} |
|
45 |
|
|
46 |
ngOnInit() { |
|
47 |
|
|
48 |
if(this.type == "publication") { |
|
49 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedPublications; |
|
50 |
this.urlParam = "articleId"; |
|
51 |
} else if(this.type == "dataset") { |
|
52 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedDatasets; |
|
53 |
this.urlParam = "datasetId"; |
|
54 |
} else if(this.type == "software") { |
|
55 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedSoftware; |
|
56 |
this.urlParam = "softwareId"; |
|
57 |
} else if(this.type == "other") { |
|
58 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedOrps; |
|
59 |
this.urlParam = "orpId"; |
|
60 |
} else if(this.type == "project") { |
|
61 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedProjects; |
|
62 |
this.urlParam = "projectId"; |
|
63 |
} else if(this.type == "organization") { |
|
64 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedOrganizations; |
|
65 |
this.urlParam = "organizationId"; |
|
66 |
} else if(this.type == "dataprovider") { |
|
67 |
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedDataProviders; |
|
68 |
this.urlParam = "datasourceId"; |
|
69 |
} |
|
70 |
|
|
71 |
this.route.queryParams.subscribe(params => { |
|
72 |
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); |
|
73 |
if (!communityId) { |
|
74 |
communityId = params['communityId']; |
|
75 |
} |
|
76 |
|
|
77 |
if (communityId) { |
|
78 |
|
|
79 |
if (communityId != null && communityId != '') { |
|
80 |
|
|
81 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe( |
|
82 |
community => { |
|
83 |
var community = community; |
|
84 |
var masterZenodoCommunityId = community.zenodoCommunity; |
|
85 |
if (masterZenodoCommunityId) { |
|
86 |
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId; |
|
87 |
//this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation); |
|
88 |
} else { |
|
89 |
this.zenodoInformation.url = this.properties.zenodo; |
|
90 |
this.zenodoInformation.name = "Zenodo"; |
|
91 |
} |
|
92 |
//this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation); |
|
93 |
}, |
|
94 |
error => { |
|
95 |
this.handleError("Error getting community with id: " + communityId, error); |
|
96 |
} |
|
97 |
); |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
if (!this.zenodoInformation.shareInZenodoUrl) { |
|
102 |
this.zenodoInformation.url = this.properties.zenodo; |
|
103 |
} |
|
104 |
if (!this.zenodoInformation.name) { |
|
105 |
this.zenodoInformation.name = "Zenodo"; |
|
106 |
} |
|
107 |
}); |
|
108 |
|
|
109 |
|
|
110 |
} |
|
111 |
|
|
112 |
public quote(params: string):string { |
|
113 |
return '"'+params+'"'; |
|
114 |
} |
|
115 |
|
|
116 |
private handleError(message: string, error) { |
|
117 |
console.error("search Results in Deposit page: "+message, error); |
|
118 |
} |
|
119 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/searchDataprovidersToDeposit.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import {ActivatedRoute} from '@angular/router'; |
|
3 |
import {Location} from '@angular/common'; |
|
4 |
import {SearchDataprovidersService} from '../services/searchDataproviders.service'; |
|
5 |
import {ErrorCodes} from '../utils/properties/errorCodes'; |
|
6 |
import {ErrorMessagesComponent} from '../utils/errorMessages.component'; |
|
7 |
import {SearchFields} from '../utils/properties/searchFields'; |
|
8 |
import {SearchPageComponent } from '../searchPages/searchUtils/searchPage.component'; |
|
9 |
import {SearchCustomFilter, SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class'; |
|
10 |
import {EnvProperties} from '../utils/properties/env-properties'; |
|
11 |
import {ZenodoInformationClass} from "./utils/zenodoInformation.class"; |
|
12 |
import {ConnectHelper} from "../connect/connectHelper"; |
|
13 |
import {PiwikHelper} from "../../utils/piwikHelper"; |
|
14 |
import {CommunityService} from "../connect/community/community.service"; |
|
15 |
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
16 |
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class"; |
|
17 |
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service"; |
|
18 |
import {StringUtils} from "../utils/string-utils.class"; |
|
19 |
|
|
20 |
@Component({ |
|
21 |
selector: 'search-dataproviders', |
|
22 |
template: ` |
|
23 |
|
|
24 |
<div class="uk-section uk-margin-top"> |
|
25 |
<div class="communityPanelBackground uk-margin-top uk-padding-small"> |
|
26 |
<div class="uk-container uk-container-large uk-margin-small-top uk-margin-small-bottom"> |
|
27 |
<ul class="uk-breadcrumb"> |
|
28 |
<li><a class="breadcrumb" routerLinkActive="router-link-active" routerLink="/deposit">Deposit</a></li> |
|
29 |
<li><span class="active">Browse repositories</span></li> |
|
30 |
</ul> |
|
31 |
</div> |
|
32 |
</div> |
|
33 |
</div> |
|
34 |
<search-page pageTitle="Search Content Providers" |
|
35 |
formPlaceholderText = "Search for Content Providers" |
|
36 |
type="content providers" entityType="dataprovider" [(filters)] = "filters" |
|
37 |
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" |
|
38 |
(queryChange)="queryChanged($event)" |
|
39 |
[csvParams]="csvParams" csvPath="datasources" |
|
40 |
[disableForms]="disableForms" |
|
41 |
[loadPaging]="loadPaging" |
|
42 |
[oldTotalResults]="oldTotalResults" |
|
43 |
[piwikSiteId]=piwikSiteId |
|
44 |
[usedBy]="'deposit'" |
|
45 |
[showMoreFilterValuesInline]=true |
|
46 |
[filterValuesNum]=4 |
|
47 |
[lastIndex]=false> |
|
48 |
</search-page> |
|
49 |
` |
|
50 |
}) |
|
51 |
export class SearchDataprovidersToDepositComponent { |
|
52 |
private errorCodes: ErrorCodes; |
|
53 |
private errorMessages: ErrorMessagesComponent; |
|
54 |
@Input() piwikSiteId = null; |
|
55 |
@Input() customFilter:SearchCustomFilter= null; |
|
56 |
public results =[]; |
|
57 |
public filters =[]; |
|
58 |
public totalResults:number = 0 ; |
|
59 |
public baseUrl:string; |
|
60 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
61 |
public sub: any; public subResults: any; |
|
62 |
public _location:Location; |
|
63 |
public searchFields:SearchFields = new SearchFields(); |
|
64 |
public refineFields: string[] = this.searchFields.DEPOSIT_DATASOURCE_REFINE_FIELDS; |
|
65 |
public fieldIdsMap= this.searchFields.DEPOSIT_DATASOURCE_FIELDS; |
|
66 |
public keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS; |
|
67 |
public csvParams: string; |
|
68 |
|
|
69 |
public disableForms: boolean = false; |
|
70 |
public loadPaging: boolean = true; |
|
71 |
public oldTotalResults: number = 0; |
|
72 |
pagingLimit = 0; |
|
73 |
|
|
74 |
properties:EnvProperties; |
|
75 |
|
|
76 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
|
77 |
|
|
78 |
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService) { |
|
79 |
this.errorCodes = new ErrorCodes(); |
|
80 |
this.errorMessages = new ErrorMessagesComponent(); |
|
81 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
82 |
this.searchUtils.page =1; |
|
83 |
} |
|
84 |
|
|
85 |
public ngOnInit() { |
|
86 |
this.route.data |
|
87 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
88 |
this.properties = data.envSpecific; |
|
89 |
this.baseUrl = "/search-deposit";//data.envSpecific.searchLinkToDataProviders; |
|
90 |
this.pagingLimit = data.envSpecific.pagingLimit; |
|
91 |
}); |
|
92 |
this.searchPage.refineFields = this.refineFields; |
|
93 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
94 |
this.searchPage.keywordFields = this.keywordFields; |
|
95 |
var firstLoad =true; |
|
96 |
|
|
97 |
this.sub = this.route.queryParams.subscribe(params => { |
|
98 |
if(params['page'] && this.searchUtils.page != params['page']) { |
|
99 |
this.loadPaging = false; |
|
100 |
this.oldTotalResults = this.searchUtils.totalResults; |
|
101 |
} |
|
102 |
|
|
103 |
this.searchUtils.keyword = (params['keyword']?params['keyword']:''); |
|
104 |
var refine = true; |
|
105 |
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){ |
|
106 |
refine = false; |
|
107 |
|
|
108 |
} |
|
109 |
firstLoad = false; |
|
110 |
this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; |
|
111 |
this.searchUtils.size = (params['size']=== undefined)?5:+params['size']; |
|
112 |
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) { |
|
113 |
this.searchUtils.size = 5; |
|
114 |
} |
|
115 |
this.searchPage.customFilter = this.customFilter; |
|
116 |
this.searchPage.usedBy = "deposit"; |
|
117 |
var queryParameters = this.searchPage.getQueryParametersFromUrl(params); |
|
118 |
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size); |
|
119 |
}); |
|
120 |
} |
|
121 |
|
|
122 |
public ngOnDestroy() { |
|
123 |
if(this.sub){ |
|
124 |
this.sub.unsubscribe(); |
|
125 |
} |
|
126 |
if(this.subResults){ |
|
127 |
this.subResults.unsubscribe(); |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
public getResults(keyword:string,refine:boolean, page: number, size: number){ |
|
132 |
var parameters = ""; |
|
133 |
if(keyword.length > 0){ |
|
134 |
//parameters = "q="+ keyword; |
|
135 |
|
|
136 |
if(this.keywordFields.length > 0) { |
|
137 |
parameters = "&fq="; |
|
138 |
} |
|
139 |
|
|
140 |
for(let i=0; i< this.keywordFields.length ; i++) { |
|
141 |
if(i > 0) { |
|
142 |
parameters += " or "; |
|
143 |
} |
|
144 |
let field = this.keywordFields[i]; |
|
145 |
parameters += field.name+field.equalityOperator+StringUtils.URIEncode(this.searchUtils.keyword); |
|
146 |
} |
|
147 |
} |
|
148 |
this._getResults(parameters,refine,page, size); |
|
149 |
} |
|
150 |
private _getResults(parameters:string,refine:boolean, page: number, size: number){ |
|
151 |
if(page > this.pagingLimit) { |
|
152 |
size=0; |
|
153 |
} |
|
154 |
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { |
|
155 |
this.csvParams = parameters; |
|
156 |
|
|
157 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
158 |
|
|
159 |
this.disableForms = true; |
|
160 |
this.results = []; |
|
161 |
this.searchUtils.totalResults = 0; |
|
162 |
|
|
163 |
this.subResults = this._searchDataprovidersService.searchDataprovidersForDepositSearch(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields(),this.properties, "deposit").subscribe( |
|
164 |
data => { |
|
165 |
this.searchUtils.totalResults = data[0]; |
|
166 |
this.results = data[1]; |
|
167 |
if(refine){ |
|
168 |
this.filters = data[2]; |
|
169 |
} |
|
170 |
this.searchPage.checkSelectedFilters(this.filters); |
|
171 |
this.searchPage.updateBaseUrlWithParameters(this.filters); |
|
172 |
this.searchUtils.status = this.errorCodes.DONE; |
|
173 |
if(this.searchUtils.totalResults == 0 ){ |
|
174 |
this.searchUtils.status = this.errorCodes.NONE; |
|
175 |
} |
|
176 |
this.disableForms = false; |
|
177 |
|
|
178 |
if(this.searchUtils.status == this.errorCodes.DONE) { |
|
179 |
// Page out of limit!!! |
|
180 |
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); |
|
181 |
if(!(Number.isInteger(totalPages))) { |
|
182 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
183 |
} |
|
184 |
if(totalPages < page) { |
|
185 |
this.searchUtils.totalResults = 0; |
|
186 |
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
187 |
} |
|
188 |
} |
|
189 |
}, |
|
190 |
err => { |
|
191 |
this.handleError("Error getting content providers", err); |
|
192 |
this.searchUtils.status = this.errorMessages.getErrorCode(err.status); |
|
193 |
|
|
194 |
this.disableForms = false; |
|
195 |
} |
|
196 |
); |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
public queryChanged($event) { |
|
201 |
this.loadPaging = true; |
|
202 |
} |
|
203 |
|
|
204 |
private handleError(message: string, error) { |
|
205 |
console.error("Content Providers simple Search Page: "+message, error); |
|
206 |
} |
|
207 |
} |
Also available in: Unified diff
[Trunk | Library]:
Add components and modules for Deposit First Page (depositFirstPage) - Deposit Search Page (searchDataprovidersToDeposit & searchResultsInDeposit) for new mocks in connect.