Lines 52-789
Link Here
|
52 |
[% END #/ WRAPPER breadcrumbs %] |
52 |
[% END #/ WRAPPER breadcrumbs %] |
53 |
[% END #/ WRAPPER sub-header.inc %] |
53 |
[% END #/ WRAPPER sub-header.inc %] |
54 |
|
54 |
|
55 |
<div class="main container-fluid"> |
55 |
[% WRAPPER 'main-container.inc' aside='admin-menu' %] |
56 |
<div class="row"> |
56 |
[% INCLUDE 'messages.inc' %] |
57 |
<div class="col-md-10 order-md-2 order-sm-1"> |
57 |
|
58 |
<main> |
58 |
[% FOREACH m IN messages %] |
59 |
[% INCLUDE 'messages.inc' %] |
59 |
<div class="alert alert-[% m.type | html %]" id="sftp_action_result_dialog"> |
60 |
|
60 |
[% SWITCH m.code %] |
61 |
[% FOREACH m IN messages %] |
61 |
[% CASE 'error_on_insert' %] |
62 |
<div class="alert alert-[% m.type | html %]" id="sftp_action_result_dialog"> |
62 |
<span>An error occurred when adding the server. The passed ID already exists.</span> |
63 |
[% SWITCH m.code %] |
63 |
[% CASE 'error_on_update' %] |
64 |
[% CASE 'error_on_insert' %] |
64 |
<span>An error occurred trying to open the server for editing. The passed ID is invalid.</span> |
65 |
<span>An error occurred when adding the server. The passed ID already exists.</span> |
65 |
[% CASE 'error_on_edit' %] |
66 |
[% CASE 'error_on_update' %] |
66 |
<span>An error occurred trying to open the server for editing. The passed ID is invalid.</span> |
67 |
<span>An error occurred trying to open the server for editing. The passed ID is invalid.</span> |
67 |
[% CASE 'success_on_update' %] |
68 |
[% CASE 'error_on_edit' %] |
68 |
<span>Server updated successfully.</span> |
69 |
<span>An error occurred trying to open the server for editing. The passed ID is invalid.</span> |
69 |
[% CASE 'success_on_insert' %] |
70 |
[% CASE 'success_on_update' %] |
70 |
<span>Server added successfully.</span> |
71 |
<span>Server updated successfully.</span> |
71 |
[% CASE %] |
72 |
[% CASE 'success_on_insert' %] |
72 |
<span>[% m.code | html %]</span> |
73 |
<span>Server added successfully.</span> |
73 |
[% END %] |
74 |
[% CASE %] |
74 |
</div> |
75 |
<span>[% m.code | html %]</span> |
75 |
[% END %] |
76 |
[% END %] |
76 |
|
77 |
</div> |
77 |
<div class="alert alert-info" id="sftp_delete_success" style="display: none;"></div> |
78 |
[% END %] |
78 |
<div class="alert alert-warning" id="sftp_delete_error" style="display: none;"></div> |
79 |
|
79 |
|
80 |
<div class="alert alert-info" id="sftp_delete_success" style="display: none;"></div> |
80 |
[% IF op == 'add_form' %] |
81 |
<div class="alert alert-warning" id="sftp_delete_error" style="display: none;"></div> |
81 |
<!-- Modal --> |
82 |
|
82 |
<div id="confirm_key_accept" class="modal" tabindex="-1" role="dialog" aria-labelledby="confirm_key_accept_submit" aria-hidden="true"> |
83 |
[% IF op == 'add_form' %] |
83 |
<div class="modal-dialog modal-lg"> |
84 |
<!-- Modal --> |
84 |
<div class="modal-content modal-lg"> |
85 |
<div id="confirm_key_accept" class="modal" tabindex="-1" role="dialog" aria-labelledby="confirm_key_accept_submit" aria-hidden="true"> |
85 |
<div class="modal-header"> |
86 |
<div class="modal-dialog modal-lg"> |
86 |
<h1 class="modal-title">Are you sure?</h1> |
87 |
<div class="modal-content modal-lg"> |
87 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
88 |
<div class="modal-header"> |
|
|
89 |
<h1 class="modal-title">Are you sure?</h1> |
90 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
91 |
</div> |
92 |
<div class="modal-body"> |
93 |
<div id="modal_message" class="alert alert-warning">Saving these changes will trigger a connection test and this will automatically accept the remote servers host key</div> |
94 |
<p>Before saving, please check the following details again to make sure you are certain they are correct. Sending or receiving data from an unknown source potentially puts your system at risk.</p> |
95 |
<table class="mx-4 mb-3"> |
96 |
<thead></thead> |
97 |
<tbody> |
98 |
<tr> |
99 |
<td><strong>Transport</strong></td> |
100 |
<td id="modal_transport"></td> |
101 |
</tr> |
102 |
<tr> |
103 |
<td><strong>Host</strong></td> |
104 |
<td id="modal_host"></td> |
105 |
</tr> |
106 |
<tr> |
107 |
<td><strong>Port</strong></td> |
108 |
<td id="modal_port"></td> |
109 |
</tr> |
110 |
<tr> |
111 |
<td><strong>Username</strong></td> |
112 |
<td id="modal_user_name"></td> |
113 |
</tr> |
114 |
<tr> |
115 |
<td><strong>Authentication mode</strong></td> |
116 |
<td id="modal_auth_mode"></td> |
117 |
</tr> |
118 |
</tbody> |
119 |
</table> |
120 |
<p>If you are ready to progress with these details, please click Save.</p> |
121 |
</div> |
122 |
<div class="modal-footer"> |
123 |
<button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button> |
124 |
<button class="btn btn-default deny cancel" type="button" data-bs-dismiss="modal"><i class="fa fa-times"></i> Cancel</button> |
125 |
</div> |
126 |
</div> |
127 |
</div> |
128 |
</div> |
88 |
</div> |
129 |
<!-- END Modal --> |
89 |
<div class="modal-body"> |
130 |
|
90 |
<div id="modal_message" class="alert alert-warning">Saving these changes will trigger a connection test and this will automatically accept the remote servers host key</div> |
131 |
<h1>New file transport</h1> |
91 |
<p>Before saving, please check the following details again to make sure you are certain they are correct. Sending or receiving data from an unknown source potentially puts your system at risk.</p> |
132 |
|
92 |
<table class="mx-4 mb-3"> |
133 |
<form action="/cgi-bin/koha/admin/file_transports.pl" id="add" name="add" class="validated" method="post"> |
93 |
<thead></thead> |
134 |
[% INCLUDE 'csrf-token.inc' %] |
94 |
<tbody> |
135 |
<input type="hidden" name="op" value="cud-add" /> |
95 |
<tr> |
136 |
<fieldset class="rows"> |
96 |
<td><strong>Transport</strong></td> |
137 |
<ol> |
97 |
<td id="modal_transport"></td> |
138 |
<li> |
98 |
</tr> |
139 |
<label for="sftp_name" class="required">Name: </label> |
99 |
<tr> |
140 |
<input type="text" name="sftp_name" id="sftp_name" size="60" class="required focus" required="required" /> |
100 |
<td><strong>Host</strong></td> |
141 |
<span class="required">Required</span> |
101 |
<td id="modal_host"></td> |
142 |
</li> |
102 |
</tr> |
143 |
</ol> |
103 |
<tr> |
144 |
</fieldset> |
104 |
<td><strong>Port</strong></td> |
145 |
|
105 |
<td id="modal_port"></td> |
146 |
<fieldset class="rows"> |
106 |
</tr> |
147 |
<ol> |
107 |
<tr> |
148 |
<li> |
108 |
<td><strong>Username</strong></td> |
149 |
<label for="sftp_transport" class="required">Transport: </label> |
109 |
<td id="modal_user_name"></td> |
150 |
<select name="sftp_transport" id="sftp_transport" class="required"> |
110 |
</tr> |
151 |
<option value="ftp">FTP</option> |
111 |
<tr> |
152 |
<option value="sftp" selected="selected">SFTP</option> |
112 |
<td><strong>Authentication mode</strong></td> |
153 |
</select> |
113 |
<td id="modal_auth_mode"></td> |
154 |
<span class="required">Required</span> |
114 |
</tr> |
155 |
</li> |
115 |
</tbody> |
156 |
<li> |
116 |
</table> |
157 |
<label for="sftp_host" class="required">Host: </label> |
117 |
<p>If you are ready to progress with these details, please click Save.</p> |
158 |
<input type="text" value="localhost" name="sftp_host" id="sftp_host" size="60" class="required" /> |
|
|
159 |
<span class="required">Required</span> |
160 |
</li> |
161 |
<li> |
162 |
<label for="sftp_port" class="required">Port: </label> |
163 |
<input type="text" inputmode="numeric" pattern="[0-9]*" value="22" name="sftp_port" id="sftp_port" size="20" class="required" /> |
164 |
<span class="required">Required</span> |
165 |
</li> |
166 |
<li> |
167 |
<label for="sftp_passive">Passive mode: </label> |
168 |
<select name="sftp_passive" id="sftp_passive" disabled="disabled"> |
169 |
<option value="1" selected="selected">On (Recommended)</option> |
170 |
<option value="0">Off</option> |
171 |
</select> |
172 |
<span class="hint">Only applies to FTP connections</span> |
173 |
</li> |
174 |
<li> |
175 |
<label for="sftp_auth_mode">Authentication mode: </label> |
176 |
<select name="sftp_auth_mode" id="sftp_auth_mode"> |
177 |
<option value="password" selected="selected">Password-based</option> |
178 |
<option value="key_file">Key file-based</option> |
179 |
<option value="noauth">No authentication</option> |
180 |
</select> |
181 |
</li> |
182 |
<li> |
183 |
<label for="sftp_user_name" class="required">Username: </label> |
184 |
<input type="text" name="sftp_user_name" id="sftp_user_name" size="60" autocomplete="off" class="required" /> |
185 |
<span class="required">Required</span> |
186 |
</li> |
187 |
<li> |
188 |
<label for="sftp_password">Password: </label> |
189 |
<input type="password" name="sftp_password" id="sftp_password" size="60" autocomplete="off" /> |
190 |
</li> |
191 |
<li> |
192 |
<label for="sftp_key_file">Key file: </label> |
193 |
<textarea name="sftp_key_file" id="sftp_key_file" rows="10" cols="58"></textarea> |
194 |
<span class="hint">Only applies to SFTP connections</span> |
195 |
</li> |
196 |
<li> |
197 |
<label for="sftp_download_directory">Remote download directory: </label> |
198 |
<input type="text" name="sftp_download_directory" id="sftp_download_directory" size="60" autocomplete="off" /><br /> |
199 |
<span class="hint">The path on the remote server where we will download from</span> |
200 |
</li> |
201 |
<li> |
202 |
<label for="sftp_upload_directory">Remote upload directory: </label> |
203 |
<input type="text" name="sftp_upload_directory" id="sftp_upload_directory" size="60" autocomplete="off" /><br /> |
204 |
<span class="hint">The path on the remote server where we will upload to</span> |
205 |
</li> |
206 |
<input type="hidden" value="" name="sftp_status" id="sftp_status" /> |
207 |
<li> |
208 |
<label for="sftp_debug_mode">Debug mode: </label> |
209 |
<select name="sftp_debug_mode" id="sftp_debug_mode"> |
210 |
<option value="1">Enabled</option> |
211 |
<option value="0" selected="selected">Disabled</option> |
212 |
</select> |
213 |
<span class="hint">Enables additional debug output in the logs</span> |
214 |
</li> |
215 |
</ol> |
216 |
</fieldset> |
217 |
<fieldset class="action"> |
218 |
<a id="confirm_key_accept_submit" data-bs-target="#confirm_key_accept" class="btn btn-primary" data-bs-toggle="modal">Submit</a> |
219 |
<a class="cancel" href="/cgi-bin/koha/admin/file_transports.pl">Cancel</a> |
220 |
</fieldset> |
221 |
</form> |
222 |
[% END %] |
223 |
|
224 |
[% IF op == 'edit_form' && !messages %] |
225 |
<!-- Modal --> |
226 |
<div id="confirm_key_accept" class="modal" tabindex="-1" role="dialog" aria-labelledby="confirm_key_accept_submit" aria-hidden="true"> |
227 |
<div class="modal-dialog modal-lg"> |
228 |
<div class="modal-content modal-lg"> |
229 |
<div class="modal-header"> |
230 |
<h1 class="modal-title">Are you sure?</h1> |
231 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
232 |
</div> |
233 |
<div class="modal-body"> |
234 |
<div id="modal_message" class="alert alert-warning">Saving these changes will trigger a connection test and this will automatically accept the remote servers host key</div> |
235 |
<p>Before saving, please check the following details again to make sure you are certain they are correct. Sending or receiving data from an unknown source potentially puts your system at risk.</p> |
236 |
<table class="mx-4 mb-3"> |
237 |
<thead></thead> |
238 |
<tbody> |
239 |
<tr> |
240 |
<td><strong>Transport</strong></td> |
241 |
<td id="modal_transport"></td> |
242 |
</tr> |
243 |
<tr> |
244 |
<td><strong>Host</strong></td> |
245 |
<td id="modal_host"></td> |
246 |
</tr> |
247 |
<tr> |
248 |
<td><strong>Port</strong></td> |
249 |
<td id="modal_port"></td> |
250 |
</tr> |
251 |
<tr> |
252 |
<td><strong>Username</strong></td> |
253 |
<td id="modal_user_name"></td> |
254 |
</tr> |
255 |
<tr> |
256 |
<td><strong>Authentication mode</strong></td> |
257 |
<td id="modal_auth_mode"></td> |
258 |
</tr> |
259 |
</tbody> |
260 |
</table> |
261 |
<p>If you are ready to progress with these details, please click Save.</p> |
262 |
</div> |
263 |
<div class="modal-footer"> |
264 |
<button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button> |
265 |
<button class="btn btn-default deny cancel" type="button" data-bs-dismiss="modal"><i class="fa fa-times"></i> Cancel</button> |
266 |
</div> |
267 |
</div> |
268 |
</div> |
269 |
</div> |
118 |
</div> |
270 |
<!-- END Modal --> |
119 |
<div class="modal-footer"> |
271 |
|
120 |
<button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button> |
272 |
<h1>[% tx("Modify file transport '{sftp_server}'", { sftp_server = sftp_server.name }) | html %]</h1> |
121 |
<button class="btn btn-default deny cancel" type="button" data-bs-dismiss="modal"><i class="fa fa-times"></i> Cancel</button> |
273 |
|
|
|
274 |
<form action="/cgi-bin/koha/admin/file_transports.pl" id="edit_save" name="edit_save" class="validated" method="post"> |
275 |
[% INCLUDE 'csrf-token.inc' %] |
276 |
<input type="hidden" name="op" value="cud-edit_save" /> |
277 |
<input type="hidden" name="file_transport_id" value="[%- sftp_server.id | html -%]" /> |
278 |
<fieldset class="rows"> |
279 |
<ol> |
280 |
<li> |
281 |
<label for="sftp_name" class="required">Name: </label> |
282 |
<input type="text" value="[% sftp_server.name | html %]" name="sftp_name" id="sftp_name" size="60" class="required focus" required="required" /> |
283 |
<span class="required">Required</span> |
284 |
</li> |
285 |
</ol> |
286 |
</fieldset> |
287 |
|
288 |
<fieldset class="rows"> |
289 |
<ol> |
290 |
<li> |
291 |
<label for="sftp_transport" class="required">Transport: </label> |
292 |
<select name="sftp_transport" id="sftp_transport" class="required"> |
293 |
[% IF sftp_server.transport == 'ftp' %] |
294 |
<option value="ftp" selected="selected">FTP</option> |
295 |
[% ELSE %] |
296 |
<option value="ftp">FTP</option> |
297 |
[% END %] |
298 |
[% IF sftp_server.transport == 'sftp' %] |
299 |
<option value="sftp" selected="selected">SFTP</option> |
300 |
[% ELSE %] |
301 |
<option value="sftp">SFTP</option> |
302 |
[% END %] |
303 |
</select> |
304 |
<span class="required">Required</span> |
305 |
</li> |
306 |
<li> |
307 |
<label for="sftp_host" class="required">Host: </label> |
308 |
<input type="text" value="[% sftp_server.host | html %]" name="sftp_host" id="sftp_host" size="60" class="required" /> |
309 |
<span class="required">Required</span> |
310 |
</li> |
311 |
<li> |
312 |
<label for="sftp_port" class="required">Port: </label> |
313 |
<input type="text" inputmode="numeric" pattern="[0-9]*" value="[% sftp_server.port | html %]" name="sftp_port" id="sftp_port" size="20" class="required" /> |
314 |
<span class="required">Required</span> |
315 |
</li> |
316 |
<li> |
317 |
<label for="sftp_passive">Passive mode: </label> |
318 |
<select name="sftp_passive" id="sftp_passive" disabled="disabled"> |
319 |
[% IF sftp_server.passive == 1 %] |
320 |
<option value="1" selected="selected">Enabled (Recommended)</option> |
321 |
[% ELSE %] |
322 |
<option value="1">Enabled (Recommended)</option> |
323 |
[% END %] |
324 |
[% IF sftp_server.passive == 0 %] |
325 |
<option value="0" selected="selected">Disabled</option> |
326 |
[% ELSE %] |
327 |
<option value="0">Disabled</option> |
328 |
[% END %] |
329 |
</select> |
330 |
<span class="hint">Only applies to FTP connections</span> |
331 |
</li> |
332 |
<li> |
333 |
<label for="sftp_auth_mode">Authentication mode: </label> |
334 |
<select name="sftp_auth_mode" id="sftp_auth_mode"> |
335 |
[% IF sftp_server.auth_mode == 'password' %] |
336 |
<option value="password" selected="selected">Password-based</option> |
337 |
[% ELSE %] |
338 |
<option value="password">Password-based</option> |
339 |
[% END %] |
340 |
[% IF sftp_server.auth_mode == 'key_file' %] |
341 |
<option value="key_file" selected="selected">Key file-based</option> |
342 |
[% ELSE %] |
343 |
<option value="key_file">Key file-based</option> |
344 |
[% END %] |
345 |
[% IF sftp_server.auth_mode == 'noauth' %] |
346 |
<option value="noauth" selected="selected">No authentication</option> |
347 |
[% ELSE %] |
348 |
<option value="noauth">No authentication</option> |
349 |
[% END %] |
350 |
</select> |
351 |
</li> |
352 |
<li> |
353 |
<label for="sftp_user_name" class="required">Username: </label> |
354 |
<input type="text" value="[% sftp_server.user_name | html %]" name="sftp_user_name" id="sftp_user_name" size="60" autocomplete="off" class="required" /> |
355 |
<span class="required">Required</span> |
356 |
</li> |
357 |
<li> |
358 |
<label for="sftp_password">Password: </label> |
359 |
<input type="password" value="[% sftp_server_plain_text_password | html %]" name="sftp_password" id="sftp_password" size="60" autocomplete="off" /> |
360 |
</li> |
361 |
<li> |
362 |
<label for="sftp_key_file">Key file path: </label> |
363 |
<textarea name="sftp_key_file" id="sftp_key_file" rows="10" cols="58">[% sftp_server_plain_text_key | html %]</textarea> |
364 |
<span class="hint">Only applies to SFTP connections</span> |
365 |
</li> |
366 |
<li> |
367 |
<label for="sftp_download_directory">Remote download directory: </label> |
368 |
<input type="text" value="[% sftp_server.download_directory | html %]" name="sftp_download_directory" id="sftp_download_directory" size="60" autocomplete="off" /><br /> |
369 |
<span class="hint">The path on the remote server where we will download from</span> |
370 |
</li> |
371 |
<li> |
372 |
<label for="sftp_upload_directory">Remote upload directory: </label> |
373 |
<input type="text" value="[% sftp_server.upload_directory | html %]" name="sftp_upload_directory" id="sftp_upload_directory" size="60" autocomplete="off" /><br /> |
374 |
<span class="hint">The path on the remote server where we will upload to</span> |
375 |
</li> |
376 |
<input type="hidden" value="" name="sftp_status" id="sftp_status" /> |
377 |
<li> |
378 |
<label for="sftp_debug_mode">Debug mode: </label> |
379 |
<select name="sftp_debug_mode" id="sftp_debug_mode"> |
380 |
[% IF sftp_server.debug == 1 %] |
381 |
<option value="1" selected="selected">Enabled</option> |
382 |
[% ELSE %] |
383 |
<option value="1">Enabled</option> |
384 |
[% END %] |
385 |
[% IF sftp_server.debug == 0 %] |
386 |
<option value="0" selected="selected">Disabled</option> |
387 |
[% ELSE %] |
388 |
<option value="0">Disabled</option> |
389 |
[% END %] |
390 |
</select> |
391 |
<span class="hint">Enables additional debug output in the logs</span> |
392 |
</li> |
393 |
</ol> |
394 |
</fieldset> |
395 |
<fieldset class="action"> |
396 |
<a id="confirm_key_accept_submit" data-bs-target="#confirm_key_accept" class="btn btn-primary" data-bs-toggle="modal">Submit</a> |
397 |
<a class="cancel" href="/cgi-bin/koha/admin/file_transports.pl">Cancel</a> |
398 |
</fieldset> |
399 |
</form> |
400 |
[% END %] |
401 |
|
402 |
[% IF op == 'list' %] |
403 |
<div id="toolbar" class="btn-toolbar"> |
404 |
<a class="btn btn-default" id="new_sftp_server" href="/cgi-bin/koha/admin/file_transports.pl?op=add_form"><i class="fa fa-plus"></i> New file transport</a> |
405 |
</div> |
122 |
</div> |
|
|
123 |
</div> |
124 |
</div> |
125 |
</div> |
126 |
<!-- END Modal --> |
127 |
|
128 |
<h1>New file transport</h1> |
129 |
|
130 |
<form action="/cgi-bin/koha/admin/file_transports.pl" id="add" name="add" class="validated" method="post"> |
131 |
[% INCLUDE 'csrf-token.inc' %] |
132 |
<input type="hidden" name="op" value="cud-add" /> |
133 |
<fieldset class="rows"> |
134 |
<ol> |
135 |
<li> |
136 |
<label for="sftp_name" class="required">Name: </label> |
137 |
<input type="text" name="sftp_name" id="sftp_name" size="60" class="required focus" required="required" /> |
138 |
<span class="required">Required</span> |
139 |
</li> |
140 |
</ol> |
141 |
</fieldset> |
142 |
|
143 |
<fieldset class="rows"> |
144 |
<ol> |
145 |
<li> |
146 |
<label for="sftp_transport" class="required">Transport: </label> |
147 |
<select name="sftp_transport" id="sftp_transport" class="required"> |
148 |
<option value="ftp">FTP</option> |
149 |
<option value="sftp" selected="selected">SFTP</option> |
150 |
</select> |
151 |
<span class="required">Required</span> |
152 |
</li> |
153 |
<li> |
154 |
<label for="sftp_host" class="required">Host: </label> |
155 |
<input type="text" value="localhost" name="sftp_host" id="sftp_host" size="60" class="required" /> |
156 |
<span class="required">Required</span> |
157 |
</li> |
158 |
<li> |
159 |
<label for="sftp_port" class="required">Port: </label> |
160 |
<input type="text" inputmode="numeric" pattern="[0-9]*" value="22" name="sftp_port" id="sftp_port" size="20" class="required" /> |
161 |
<span class="required">Required</span> |
162 |
</li> |
163 |
<li> |
164 |
<label for="sftp_passive">Passive mode: </label> |
165 |
<select name="sftp_passive" id="sftp_passive" disabled="disabled"> |
166 |
<option value="1" selected="selected">On (Recommended)</option> |
167 |
<option value="0">Off</option> |
168 |
</select> |
169 |
<span class="hint">Only applies to FTP connections</span> |
170 |
</li> |
171 |
<li> |
172 |
<label for="sftp_auth_mode">Authentication mode: </label> |
173 |
<select name="sftp_auth_mode" id="sftp_auth_mode"> |
174 |
<option value="password" selected="selected">Password-based</option> |
175 |
<option value="key_file">Key file-based</option> |
176 |
<option value="noauth">No authentication</option> |
177 |
</select> |
178 |
</li> |
179 |
<li> |
180 |
<label for="sftp_user_name" class="required">Username: </label> |
181 |
<input type="text" name="sftp_user_name" id="sftp_user_name" size="60" autocomplete="off" class="required" /> |
182 |
<span class="required">Required</span> |
183 |
</li> |
184 |
<li> |
185 |
<label for="sftp_password">Password: </label> |
186 |
<input type="password" name="sftp_password" id="sftp_password" size="60" autocomplete="off" /> |
187 |
</li> |
188 |
<li> |
189 |
<label for="sftp_key_file">Key file: </label> |
190 |
<textarea name="sftp_key_file" id="sftp_key_file" rows="10" cols="58"></textarea> |
191 |
<span class="hint">Only applies to SFTP connections</span> |
192 |
</li> |
193 |
<li> |
194 |
<label for="sftp_download_directory">Remote download directory: </label> |
195 |
<input type="text" name="sftp_download_directory" id="sftp_download_directory" size="60" autocomplete="off" /><br /> |
196 |
<span class="hint">The path on the remote server where we will download from</span> |
197 |
</li> |
198 |
<li> |
199 |
<label for="sftp_upload_directory">Remote upload directory: </label> |
200 |
<input type="text" name="sftp_upload_directory" id="sftp_upload_directory" size="60" autocomplete="off" /><br /> |
201 |
<span class="hint">The path on the remote server where we will upload to</span> |
202 |
</li> |
203 |
<input type="hidden" value="" name="sftp_status" id="sftp_status" /> |
204 |
<li> |
205 |
<label for="sftp_debug_mode">Debug mode: </label> |
206 |
<select name="sftp_debug_mode" id="sftp_debug_mode"> |
207 |
<option value="1">Enabled</option> |
208 |
<option value="0" selected="selected">Disabled</option> |
209 |
</select> |
210 |
<span class="hint">Enables additional debug output in the logs</span> |
211 |
</li> |
212 |
</ol> |
213 |
</fieldset> |
214 |
<fieldset class="action"> |
215 |
<a id="confirm_key_accept_submit" data-bs-target="#confirm_key_accept" class="btn btn-primary" data-bs-toggle="modal">Submit</a> |
216 |
<a class="cancel" href="/cgi-bin/koha/admin/file_transports.pl">Cancel</a> |
217 |
</fieldset> |
218 |
</form> |
219 |
[% END %] |
406 |
|
220 |
|
407 |
<h1>File transports</h1> |
221 |
[% IF op == 'edit_form' && !messages %] |
408 |
|
222 |
<!-- Modal --> |
409 |
[% IF servers_count < 1 %] |
223 |
<div id="confirm_key_accept" class="modal" tabindex="-1" role="dialog" aria-labelledby="confirm_key_accept_submit" aria-hidden="true"> |
410 |
<div class="alert alert-info" id="dno_servers_message"> |
224 |
<div class="modal-dialog modal-lg"> |
411 |
<p> |
225 |
<div class="modal-content modal-lg"> |
412 |
<em>There are no file transports defined.</em><br /> |
226 |
<div class="modal-header"> |
413 |
To create one, use the <strong>new file transport</strong> button above. |
227 |
<h1 class="modal-title">Are you sure?</h1> |
414 |
</p> |
228 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
415 |
</div> |
229 |
</div> |
416 |
[% ELSE %] |
230 |
<div class="modal-body"> |
417 |
<div class="page-section"> |
231 |
<div id="modal_message" class="alert alert-warning">Saving these changes will trigger a connection test and this will automatically accept the remote servers host key</div> |
418 |
<table id="file_transports"> |
232 |
<p>Before saving, please check the following details again to make sure you are certain they are correct. Sending or receiving data from an unknown source potentially puts your system at risk.</p> |
419 |
<thead> |
233 |
<table class="mx-4 mb-3"> |
420 |
<tr> |
234 |
<thead></thead> |
421 |
<th>Name</th> |
235 |
<tbody> |
422 |
<th>Host</th> |
236 |
<tr> |
423 |
<th>Port</th> |
237 |
<td><strong>Transport</strong></td> |
424 |
<th>Transport</th> |
238 |
<td id="modal_transport"></td> |
425 |
<th>Authentication mode</th> |
239 |
</tr> |
426 |
<th>Username</th> |
240 |
<tr> |
427 |
<th>Download directory</th> |
241 |
<td><strong>Host</strong></td> |
428 |
<th>Upload directory</th> |
242 |
<td id="modal_host"></td> |
429 |
<th>Status</th> |
243 |
</tr> |
430 |
<th>Debug</th> |
244 |
<tr> |
431 |
<th data-class-name="actions noExport">Actions</th> |
245 |
<td><strong>Port</strong></td> |
432 |
</tr> |
246 |
<td id="modal_port"></td> |
433 |
</thead> |
247 |
</tr> |
434 |
</table> |
248 |
<tr> |
435 |
</div> |
249 |
<td><strong>Username</strong></td> |
436 |
<!-- /.page-section --> |
250 |
<td id="modal_user_name"></td> |
437 |
[% END %] |
251 |
</tr> |
438 |
[% END %] |
252 |
<tr> |
439 |
|
253 |
<td><strong>Authentication mode</strong></td> |
440 |
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true"> |
254 |
<td id="modal_auth_mode"></td> |
441 |
<div class="modal-dialog"> |
255 |
</tr> |
442 |
<div class="modal-content"> |
256 |
</tbody> |
443 |
<div class="modal-header"> |
257 |
</table> |
444 |
<h1 class="modal-title" id="delete_confirm_modal_label">Delete server</h1> |
258 |
<p>If you are ready to progress with these details, please click Save.</p> |
445 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
259 |
</div> |
446 |
</div> |
260 |
<div class="modal-footer"> |
447 |
<div class="modal-body"> |
261 |
<button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button> |
448 |
<div id="delete_confirm_dialog"></div> |
262 |
<button class="btn btn-default deny cancel" type="button" data-bs-dismiss="modal"><i class="fa fa-times"></i> Cancel</button> |
449 |
</div> |
|
|
450 |
<div class="modal-footer"> |
451 |
<button type="button" class="btn btn-danger" id="delete_confirm_modal_button" data-bs-toggle="modal">Delete</button> |
452 |
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button> |
453 |
</div> |
454 |
</div> |
455 |
<!-- /.modal-content --> |
456 |
</div> |
263 |
</div> |
457 |
<!-- /.modal-dialog --> |
|
|
458 |
</div> |
264 |
</div> |
459 |
<!-- #delete_confirm_modal --> |
265 |
</div> |
460 |
</main> |
266 |
</div> |
|
|
267 |
<!-- END Modal --> |
268 |
|
269 |
<h1>[% tx("Modify file transport '{sftp_server}'", { sftp_server = sftp_server.name }) | html %]</h1> |
270 |
|
271 |
<form action="/cgi-bin/koha/admin/file_transports.pl" id="edit_save" name="edit_save" class="validated" method="post"> |
272 |
[% INCLUDE 'csrf-token.inc' %] |
273 |
<input type="hidden" name="op" value="cud-edit_save" /> |
274 |
<input type="hidden" name="file_transport_id" value="[%- sftp_server.id | html -%]" /> |
275 |
<fieldset class="rows"> |
276 |
<ol> |
277 |
<li> |
278 |
<label for="sftp_name" class="required">Name: </label> |
279 |
<input type="text" value="[% sftp_server.name | html %]" name="sftp_name" id="sftp_name" size="60" class="required focus" required="required" /> |
280 |
<span class="required">Required</span> |
281 |
</li> |
282 |
</ol> |
283 |
</fieldset> |
284 |
|
285 |
<fieldset class="rows"> |
286 |
<ol> |
287 |
<li> |
288 |
<label for="sftp_transport" class="required">Transport: </label> |
289 |
<select name="sftp_transport" id="sftp_transport" class="required"> |
290 |
[% IF sftp_server.transport == 'ftp' %] |
291 |
<option value="ftp" selected="selected">FTP</option> |
292 |
[% ELSE %] |
293 |
<option value="ftp">FTP</option> |
294 |
[% END %] |
295 |
[% IF sftp_server.transport == 'sftp' %] |
296 |
<option value="sftp" selected="selected">SFTP</option> |
297 |
[% ELSE %] |
298 |
<option value="sftp">SFTP</option> |
299 |
[% END %] |
300 |
</select> |
301 |
<span class="required">Required</span> |
302 |
</li> |
303 |
<li> |
304 |
<label for="sftp_host" class="required">Host: </label> |
305 |
<input type="text" value="[% sftp_server.host | html %]" name="sftp_host" id="sftp_host" size="60" class="required" /> |
306 |
<span class="required">Required</span> |
307 |
</li> |
308 |
<li> |
309 |
<label for="sftp_port" class="required">Port: </label> |
310 |
<input type="text" inputmode="numeric" pattern="[0-9]*" value="[% sftp_server.port | html %]" name="sftp_port" id="sftp_port" size="20" class="required" /> |
311 |
<span class="required">Required</span> |
312 |
</li> |
313 |
<li> |
314 |
<label for="sftp_passive">Passive mode: </label> |
315 |
<select name="sftp_passive" id="sftp_passive" disabled="disabled"> |
316 |
[% IF sftp_server.passive == 1 %] |
317 |
<option value="1" selected="selected">Enabled (Recommended)</option> |
318 |
[% ELSE %] |
319 |
<option value="1">Enabled (Recommended)</option> |
320 |
[% END %] |
321 |
[% IF sftp_server.passive == 0 %] |
322 |
<option value="0" selected="selected">Disabled</option> |
323 |
[% ELSE %] |
324 |
<option value="0">Disabled</option> |
325 |
[% END %] |
326 |
</select> |
327 |
<span class="hint">Only applies to FTP connections</span> |
328 |
</li> |
329 |
<li> |
330 |
<label for="sftp_auth_mode">Authentication mode: </label> |
331 |
<select name="sftp_auth_mode" id="sftp_auth_mode"> |
332 |
[% IF sftp_server.auth_mode == 'password' %] |
333 |
<option value="password" selected="selected">Password-based</option> |
334 |
[% ELSE %] |
335 |
<option value="password">Password-based</option> |
336 |
[% END %] |
337 |
[% IF sftp_server.auth_mode == 'key_file' %] |
338 |
<option value="key_file" selected="selected">Key file-based</option> |
339 |
[% ELSE %] |
340 |
<option value="key_file">Key file-based</option> |
341 |
[% END %] |
342 |
[% IF sftp_server.auth_mode == 'noauth' %] |
343 |
<option value="noauth" selected="selected">No authentication</option> |
344 |
[% ELSE %] |
345 |
<option value="noauth">No authentication</option> |
346 |
[% END %] |
347 |
</select> |
348 |
</li> |
349 |
<li> |
350 |
<label for="sftp_user_name" class="required">Username: </label> |
351 |
<input type="text" value="[% sftp_server.user_name | html %]" name="sftp_user_name" id="sftp_user_name" size="60" autocomplete="off" class="required" /> |
352 |
<span class="required">Required</span> |
353 |
</li> |
354 |
<li> |
355 |
<label for="sftp_password">Password: </label> |
356 |
<input type="password" value="[% sftp_server_plain_text_password | html %]" name="sftp_password" id="sftp_password" size="60" autocomplete="off" /> |
357 |
</li> |
358 |
<li> |
359 |
<label for="sftp_key_file">Key file path: </label> |
360 |
<textarea name="sftp_key_file" id="sftp_key_file" rows="10" cols="58">[% sftp_server_plain_text_key | html %]</textarea> |
361 |
<span class="hint">Only applies to SFTP connections</span> |
362 |
</li> |
363 |
<li> |
364 |
<label for="sftp_download_directory">Remote download directory: </label> |
365 |
<input type="text" value="[% sftp_server.download_directory | html %]" name="sftp_download_directory" id="sftp_download_directory" size="60" autocomplete="off" /><br /> |
366 |
<span class="hint">The path on the remote server where we will download from</span> |
367 |
</li> |
368 |
<li> |
369 |
<label for="sftp_upload_directory">Remote upload directory: </label> |
370 |
<input type="text" value="[% sftp_server.upload_directory | html %]" name="sftp_upload_directory" id="sftp_upload_directory" size="60" autocomplete="off" /><br /> |
371 |
<span class="hint">The path on the remote server where we will upload to</span> |
372 |
</li> |
373 |
<input type="hidden" value="" name="sftp_status" id="sftp_status" /> |
374 |
<li> |
375 |
<label for="sftp_debug_mode">Debug mode: </label> |
376 |
<select name="sftp_debug_mode" id="sftp_debug_mode"> |
377 |
[% IF sftp_server.debug == 1 %] |
378 |
<option value="1" selected="selected">Enabled</option> |
379 |
[% ELSE %] |
380 |
<option value="1">Enabled</option> |
381 |
[% END %] |
382 |
[% IF sftp_server.debug == 0 %] |
383 |
<option value="0" selected="selected">Disabled</option> |
384 |
[% ELSE %] |
385 |
<option value="0">Disabled</option> |
386 |
[% END %] |
387 |
</select> |
388 |
<span class="hint">Enables additional debug output in the logs</span> |
389 |
</li> |
390 |
</ol> |
391 |
</fieldset> |
392 |
<fieldset class="action"> |
393 |
<a id="confirm_key_accept_submit" data-bs-target="#confirm_key_accept" class="btn btn-primary" data-bs-toggle="modal">Submit</a> |
394 |
<a class="cancel" href="/cgi-bin/koha/admin/file_transports.pl">Cancel</a> |
395 |
</fieldset> |
396 |
</form> |
397 |
[% END %] |
398 |
|
399 |
[% IF op == 'list' %] |
400 |
<div id="toolbar" class="btn-toolbar"> |
401 |
<a class="btn btn-default" id="new_sftp_server" href="/cgi-bin/koha/admin/file_transports.pl?op=add_form"><i class="fa fa-plus"></i> New file transport</a> |
461 |
</div> |
402 |
</div> |
462 |
<!-- /.col-md-10.order-md-2 --> |
|
|
463 |
|
403 |
|
464 |
<div class="col-md-2 order-sm-2 order-md-1"> |
404 |
<h1>File transports</h1> |
465 |
<aside> [% INCLUDE 'admin-menu.inc' %] </aside> |
405 |
|
|
|
406 |
[% IF servers_count < 1 %] |
407 |
<div class="alert alert-info" id="dno_servers_message"> |
408 |
<p> |
409 |
<em>There are no file transports defined.</em><br /> |
410 |
To create one, use the <strong>new file transport</strong> button above. |
411 |
</p> |
412 |
</div> |
413 |
[% ELSE %] |
414 |
<div class="page-section"> |
415 |
<table id="file_transports"> |
416 |
<thead> |
417 |
<tr> |
418 |
<th>Name</th> |
419 |
<th>Host</th> |
420 |
<th>Port</th> |
421 |
<th>Transport</th> |
422 |
<th>Authentication mode</th> |
423 |
<th>Username</th> |
424 |
<th>Download directory</th> |
425 |
<th>Upload directory</th> |
426 |
<th>Status</th> |
427 |
<th>Debug</th> |
428 |
<th data-class-name="actions noExport">Actions</th> |
429 |
</tr> |
430 |
</thead> |
431 |
</table> |
432 |
</div> |
433 |
<!-- /.page-section --> |
434 |
[% END %] |
435 |
[% END %] |
436 |
|
437 |
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true"> |
438 |
<div class="modal-dialog"> |
439 |
<div class="modal-content"> |
440 |
<div class="modal-header"> |
441 |
<h1 class="modal-title" id="delete_confirm_modal_label">Delete server</h1> |
442 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
443 |
</div> |
444 |
<div class="modal-body"> |
445 |
<div id="delete_confirm_dialog"></div> |
446 |
</div> |
447 |
<div class="modal-footer"> |
448 |
<button type="button" class="btn btn-danger" id="delete_confirm_modal_button" data-bs-toggle="modal">Delete</button> |
449 |
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button> |
450 |
</div> |
451 |
</div> |
452 |
<!-- /.modal-content --> |
466 |
</div> |
453 |
</div> |
467 |
<!-- /.col-md-2.order-md-1 --> |
454 |
<!-- /.modal-dialog --> |
468 |
</div> |
455 |
</div> |
469 |
<!-- /.row --> |
456 |
<!-- #delete_confirm_modal --> |
470 |
|
457 |
[% END %] |
471 |
[% MACRO jsinclude BLOCK %] |
458 |
|
472 |
[% Asset.js("js/admin-menu.js") | $raw %] |
459 |
[% MACRO jsinclude BLOCK %] |
473 |
[% Asset.js("js/transport_status.js") | $raw %] |
460 |
[% Asset.js("js/admin-menu.js") | $raw %] |
474 |
[% INCLUDE 'datatables.inc' %] |
461 |
[% Asset.js("js/transport_status.js") | $raw %] |
475 |
<script> |
462 |
[% INCLUDE 'datatables.inc' %] |
476 |
$(document).ready(function() { |
463 |
<script> |
477 |
|
464 |
$(document).ready(function() { |
478 |
var file_transports_url = '/api/v1/config/file_transports'; |
465 |
|
479 |
window.file_transports = $("#file_transports").kohaTable({ |
466 |
var file_transports_url = '/api/v1/config/file_transports'; |
480 |
"ajax": { |
467 |
window.file_transports = $("#file_transports").kohaTable({ |
481 |
"url": file_transports_url |
468 |
"ajax": { |
|
|
469 |
"url": file_transports_url |
470 |
}, |
471 |
"language": { |
472 |
"emptyTable": "<div class=\"alert alert-info\">"+_("There are no file transports defined.")+"</div>" |
473 |
}, |
474 |
"columnDefs": [ { |
475 |
"targets": [0,1], |
476 |
"render": function(data, type, row, meta) { |
477 |
if (type == "display") { |
478 |
if(data != null) { |
479 |
return data.escapeHtml(); |
480 |
} else { |
481 |
return "Default"; |
482 |
} |
483 |
} |
484 |
return data; |
485 |
} |
486 |
} ], |
487 |
"columns": [ |
488 |
{ |
489 |
"data": "name", |
490 |
"searchable": true, |
491 |
"orderable": true |
482 |
}, |
492 |
}, |
483 |
"language": { |
493 |
{ |
484 |
"emptyTable": "<div class=\"alert alert-info\">"+_("There are no file transports defined.")+"</div>" |
494 |
"data": "host", |
|
|
495 |
"searchable": true, |
496 |
"orderable": true |
485 |
}, |
497 |
}, |
486 |
"columnDefs": [ { |
498 |
{ |
487 |
"targets": [0,1], |
499 |
"data": "port", |
|
|
500 |
"searchable": true, |
501 |
"orderable": false |
502 |
}, |
503 |
{ |
504 |
"data": "transport", |
488 |
"render": function(data, type, row, meta) { |
505 |
"render": function(data, type, row, meta) { |
489 |
if (type == "display") { |
506 |
return data.toUpperCase(); |
490 |
if(data != null) { |
|
|
491 |
return data.escapeHtml(); |
492 |
} else { |
493 |
return "Default"; |
494 |
} |
495 |
} |
496 |
return data; |
497 |
} |
498 |
} ], |
499 |
"columns": [ |
500 |
{ |
501 |
"data": "name", |
502 |
"searchable": true, |
503 |
"orderable": true |
504 |
}, |
505 |
{ |
506 |
"data": "host", |
507 |
"searchable": true, |
508 |
"orderable": true |
509 |
}, |
510 |
{ |
511 |
"data": "port", |
512 |
"searchable": true, |
513 |
"orderable": false |
514 |
}, |
507 |
}, |
515 |
{ |
508 |
"searchable": true, |
516 |
"data": "transport", |
509 |
"orderable": false |
517 |
"render": function(data, type, row, meta) { |
510 |
}, |
518 |
return data.toUpperCase(); |
511 |
{ |
519 |
}, |
512 |
"data": "auth_mode", |
520 |
"searchable": true, |
513 |
"render": function(data, type, row, meta) { |
521 |
"orderable": false |
514 |
if(data == "password") { |
522 |
}, |
515 |
return _("Password-based"); |
523 |
{ |
516 |
} else if(data == "key_file") { |
524 |
"data": "auth_mode", |
517 |
return _("Key file-based"); |
525 |
"render": function(data, type, row, meta) { |
518 |
} else { |
526 |
if(data == "password") { |
519 |
return _("No authentication"); |
527 |
return _("Password-based"); |
520 |
} |
528 |
} else if(data == "key_file") { |
|
|
529 |
return _("Key file-based"); |
530 |
} else { |
531 |
return _("No authentication"); |
532 |
} |
533 |
}, |
534 |
"searchable": false, |
535 |
"orderable": false |
536 |
}, |
537 |
{ |
538 |
"data": "user_name", |
539 |
"searchable": false, |
540 |
"orderable": false |
541 |
}, |
521 |
}, |
542 |
{ |
522 |
"searchable": false, |
543 |
"data": "download_directory", |
523 |
"orderable": false |
544 |
"render": function(data, type, row, meta) { |
524 |
}, |
545 |
if(data) { |
525 |
{ |
546 |
return data; |
526 |
"data": "user_name", |
547 |
} else { |
527 |
"searchable": false, |
548 |
return "<em>" + _("Not specified") + "</em>"; |
528 |
"orderable": false |
549 |
} |
529 |
}, |
550 |
}, |
530 |
{ |
551 |
"searchable": false, |
531 |
"data": "download_directory", |
552 |
"orderable": false |
532 |
"render": function(data, type, row, meta) { |
|
|
533 |
if(data) { |
534 |
return data; |
535 |
} else { |
536 |
return "<em>" + _("Not specified") + "</em>"; |
537 |
} |
553 |
}, |
538 |
}, |
554 |
{ |
539 |
"searchable": false, |
555 |
"data": "upload_directory", |
540 |
"orderable": false |
556 |
"render": function(data, type, row, meta) { |
541 |
}, |
557 |
if(data) { |
542 |
{ |
558 |
return data; |
543 |
"data": "upload_directory", |
559 |
} else { |
544 |
"render": function(data, type, row, meta) { |
560 |
return "<em>" + _("Not specified") + "</em>"; |
545 |
if(data) { |
561 |
} |
546 |
return data; |
562 |
}, |
547 |
} else { |
563 |
"searchable": false, |
548 |
return "<em>" + _("Not specified") + "</em>"; |
564 |
"orderable": false |
549 |
} |
565 |
}, |
550 |
}, |
566 |
{ |
551 |
"searchable": false, |
567 |
"data": "status", |
552 |
"orderable": false |
568 |
"render": function(data, type, row, meta) { |
553 |
}, |
569 |
let render = ''; |
554 |
{ |
570 |
if (data) { |
555 |
"data": "status", |
571 |
if (data.status == "ok") { |
556 |
"render": function(data, type, row, meta) { |
572 |
render += '<i class="text-success fa-solid fa-circle-check"></i> '; |
557 |
let render = ''; |
573 |
render += '<span class="text-success">'; |
558 |
if (data) { |
574 |
render += _("Tests passing"); |
559 |
if (data.status == "ok") { |
575 |
render += '</span>' |
560 |
render += '<i class="text-success fa-solid fa-circle-check"></i> '; |
576 |
} else if (data.status == "errors") { |
561 |
render += '<span class="text-success">'; |
577 |
data.operations.forEach(operation => { |
562 |
render += _("Tests passing"); |
578 |
render += "<div>"; |
563 |
render += '</span>' |
579 |
if ( operation.status == "error" ) { |
564 |
} else if (data.status == "errors") { |
580 |
render += '<i class="text-danger fa-solid fa-circle-xmark"></i> '; |
565 |
data.operations.forEach(operation => { |
581 |
render += '<span class="text-danger">'; |
566 |
render += "<div>"; |
582 |
render += operationLabels[operation.code] || operation.code; |
567 |
if ( operation.status == "error" ) { |
583 |
render += ' ' + _("failed"); |
568 |
render += '<i class="text-danger fa-solid fa-circle-xmark"></i> '; |
584 |
render += '</span>'; |
569 |
render += '<span class="text-danger">'; |
585 |
} else { |
570 |
render += operationLabels[operation.code] || operation.code; |
586 |
render += '<i class="text-success fa-solid fa-circle-check"></i> '; |
571 |
render += ' ' + _("failed"); |
587 |
render += '<span class="text-success">'; |
572 |
render += '</span>'; |
588 |
render += operationLabels[operation.code] || operation.code; |
573 |
} else { |
589 |
render += ' ' + _("ok"); |
574 |
render += '<i class="text-success fa-solid fa-circle-check"></i> '; |
590 |
render += '</span>'; |
575 |
render += '<span class="text-success">'; |
591 |
} |
576 |
render += operationLabels[operation.code] || operation.code; |
592 |
render += "</div>"; |
577 |
render += ' ' + _("ok"); |
593 |
}); |
578 |
render += '</span>'; |
594 |
} else { |
579 |
} |
595 |
render += "<em>" + _("Never used") + "</em>"; |
580 |
render += "</div>"; |
596 |
} |
581 |
}); |
597 |
} else { |
582 |
} else { |
598 |
render += "<em>" + _("Never used") + "</em>"; |
583 |
render += "<em>" + _("Never used") + "</em>"; |
599 |
} |
584 |
} |
600 |
return render; |
585 |
} else { |
601 |
}, |
586 |
render += "<em>" + _("Never used") + "</em>"; |
602 |
"searchable": false, |
587 |
} |
603 |
"orderable": false |
588 |
return render; |
604 |
}, |
589 |
}, |
605 |
{ |
590 |
"searchable": false, |
606 |
"data": "debug", |
591 |
"orderable": false |
607 |
"render": function(data, type, row, meta) { |
592 |
}, |
608 |
if(data == true) { |
593 |
{ |
609 |
return "[% tp("Active", "On") | html %]"; |
594 |
"data": "debug", |
610 |
} |
595 |
"render": function(data, type, row, meta) { |
611 |
else { |
596 |
if(data == true) { |
612 |
return _("Off"); |
597 |
return "[% tp("Active", "On") | html %]"; |
613 |
} |
598 |
} |
614 |
}, |
599 |
else { |
615 |
"searchable": false, |
600 |
return _("Off"); |
616 |
"orderable": false |
601 |
} |
617 |
}, |
602 |
}, |
618 |
{ |
603 |
"searchable": false, |
619 |
"data": function(row, type, val, meta) { |
604 |
"orderable": false |
620 |
let result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/file_transports.pl?op=edit_form&file_transport_id='+ encodeURIComponent(row.file_transport_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; |
|
|
621 |
result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-sftp-server-id="'+ encodeURIComponent(row.file_transport_id) +'" data-sftp-server-name="'+ encodeURIComponent(row.name.escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; |
622 |
return result; |
623 |
}, |
624 |
"searchable": false, |
625 |
"orderable": false |
626 |
} |
627 |
], |
628 |
createdRow: function(row, data, dataIndex) { |
629 |
if(data.is_default) { |
630 |
$(row).addClass('default warn'); |
631 |
} |
632 |
if(data.debug) { |
633 |
$(row).addClass('debug'); |
634 |
} |
635 |
}, |
605 |
}, |
636 |
}); |
606 |
{ |
|
|
607 |
"data": function(row, type, val, meta) { |
608 |
let result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/file_transports.pl?op=edit_form&file_transport_id='+ encodeURIComponent(row.file_transport_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; |
609 |
result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-sftp-server-id="'+ encodeURIComponent(row.file_transport_id) +'" data-sftp-server-name="'+ encodeURIComponent(row.name.escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>'; |
610 |
return result; |
611 |
}, |
612 |
"searchable": false, |
613 |
"orderable": false |
614 |
} |
615 |
], |
616 |
createdRow: function(row, data, dataIndex) { |
617 |
if(data.is_default) { |
618 |
$(row).addClass('default warn'); |
619 |
} |
620 |
if(data.debug) { |
621 |
$(row).addClass('debug'); |
622 |
} |
623 |
}, |
624 |
}); |
637 |
|
625 |
|
638 |
$('#file_transports').on("click", '.delete_server', function() { |
626 |
$('#file_transports').on("click", '.delete_server', function() { |
639 |
var file_transport_id = $(this).data('sftp-server-id'); |
627 |
var file_transport_id = $(this).data('sftp-server-id'); |
640 |
var sftp_server_name = decodeURIComponent($(this).data('sftp-server-name')); |
628 |
var sftp_server_name = decodeURIComponent($(this).data('sftp-server-name')); |
641 |
|
629 |
|
642 |
$("#delete_confirm_dialog").html( |
630 |
$("#delete_confirm_dialog").html( |
643 |
_("You are about to delete the '%s' file transport.").format(sftp_server_name) |
631 |
_("You are about to delete the '%s' file transport.").format(sftp_server_name) |
644 |
); |
632 |
); |
645 |
$("#delete_confirm_modal_button").data('sftp-server-id', file_transport_id); |
633 |
$("#delete_confirm_modal_button").data('sftp-server-id', file_transport_id); |
646 |
$("#delete_confirm_modal_button").data('sftp-server-name', sftp_server_name); |
634 |
$("#delete_confirm_modal_button").data('sftp-server-name', sftp_server_name); |
647 |
}); |
635 |
}); |
|
|
636 |
|
637 |
$("#delete_confirm_modal_button").on("click", function() { |
648 |
|
638 |
|
649 |
$("#delete_confirm_modal_button").on("click", function() { |
639 |
var file_transport_id = $(this).data('sftp-server-id'); |
650 |
|
640 |
var sftp_server_name = $(this).data('sftp-server-name'); |
651 |
var file_transport_id = $(this).data('sftp-server-id'); |
641 |
|
652 |
var sftp_server_name = $(this).data('sftp-server-name'); |
642 |
$.ajax({ |
653 |
|
643 |
method: "DELETE", |
654 |
$.ajax({ |
644 |
url: "/api/v1/config/file_transports/"+file_transport_id |
655 |
method: "DELETE", |
645 |
}).success(function() { |
656 |
url: "/api/v1/config/file_transports/"+file_transport_id |
646 |
window.file_transports.api().ajax.reload(function(data) { |
657 |
}).success(function() { |
647 |
$("#sftp_action_result_dialog").hide(); |
658 |
window.file_transports.api().ajax.reload(function(data) { |
648 |
$("#sftp_delete_success").html(_("Server '%s' deleted successfully.").format(sftp_server_name)).show(); |
659 |
$("#sftp_action_result_dialog").hide(); |
|
|
660 |
$("#sftp_delete_success").html(_("Server '%s' deleted successfully.").format(sftp_server_name)).show(); |
661 |
}); |
662 |
}).fail(function() { |
663 |
$("#sftp_delete_error").html(_("Error deleting server '%s'. Please ensure all linked EDI accounts are unlinked or deleted. Check the logs for details.").format(sftp_server_name)).show(); |
664 |
}).done(function() { |
665 |
$("#delete_confirm_modal").modal('hide'); |
666 |
}); |
649 |
}); |
|
|
650 |
}).fail(function() { |
651 |
$("#sftp_delete_error").html(_("Error deleting server '%s'. Please ensure all linked EDI accounts are unlinked or deleted. Check the logs for details.").format(sftp_server_name)).show(); |
652 |
}).done(function() { |
653 |
$("#delete_confirm_modal").modal('hide'); |
667 |
}); |
654 |
}); |
|
|
655 |
}); |
668 |
|
656 |
|
|
|
657 |
transportChange(); |
658 |
$("#sftp_transport").on("change", function(event) { |
669 |
transportChange(); |
659 |
transportChange(); |
670 |
$("#sftp_transport").on("change", function(event) { |
660 |
}); |
671 |
transportChange(); |
|
|
672 |
}); |
673 |
|
661 |
|
|
|
662 |
authModeChange(); |
663 |
$("#sftp_auth_mode").on("change", function(event) { |
674 |
authModeChange(); |
664 |
authModeChange(); |
675 |
$("#sftp_auth_mode").on("change", function(event) { |
665 |
}); |
676 |
authModeChange(); |
|
|
677 |
}); |
678 |
|
679 |
$('#confirm_key_accept_submit').on('click', function(event) { |
680 |
event.preventDefault(); |
681 |
|
682 |
if ( $('#add').length > 0 ) { |
683 |
if( $('#add').valid() == true ) { |
684 |
modalChange(); |
685 |
$('#confirm_key_accept').modal('show'); |
686 |
} else { |
687 |
$('#confirm_key_accept').modal('hide'); |
688 |
} |
689 |
} |
690 |
|
691 |
if ( $('#edit_save').length > 0 ) { |
692 |
if( $('#edit_save').valid() == true ) { |
693 |
modalChange(); |
694 |
$('#confirm_key_accept').modal('show'); |
695 |
} else { |
696 |
$('#confirm_key_accept').modal('hide'); |
697 |
} |
698 |
} |
699 |
|
700 |
}); |
701 |
|
666 |
|
702 |
$('#confirm_key_accept .approve').on('click', function() { |
667 |
$('#confirm_key_accept_submit').on('click', function(event) { |
703 |
$('#confirm_key_accept .deny').click(); |
668 |
event.preventDefault(); |
704 |
|
669 |
|
705 |
if ( $('#add').length > 0 ) { |
670 |
if ( $('#add').length > 0 ) { |
706 |
$('#add').submit(); |
671 |
if( $('#add').valid() == true ) { |
|
|
672 |
modalChange(); |
673 |
$('#confirm_key_accept').modal('show'); |
674 |
} else { |
675 |
$('#confirm_key_accept').modal('hide'); |
707 |
} |
676 |
} |
|
|
677 |
} |
708 |
|
678 |
|
709 |
if ( $('#edit_save').length > 0 ) { |
679 |
if ( $('#edit_save').length > 0 ) { |
710 |
$('#edit_save').submit(); |
680 |
if( $('#edit_save').valid() == true ) { |
|
|
681 |
modalChange(); |
682 |
$('#confirm_key_accept').modal('show'); |
683 |
} else { |
684 |
$('#confirm_key_accept').modal('hide'); |
711 |
} |
685 |
} |
712 |
}); |
686 |
} |
713 |
|
687 |
|
714 |
}); |
688 |
}); |
715 |
|
689 |
|
716 |
function transportChange() { |
690 |
$('#confirm_key_accept .approve').on('click', function() { |
717 |
let sftp_transport = $("#sftp_transport"); |
691 |
$('#confirm_key_accept .deny').click(); |
718 |
|
|
|
719 |
if(sftp_transport.val() == "ftp") { |
720 |
$("#sftp_host").removeAttr("disabled"); |
721 |
$("#sftp_port").removeAttr("disabled"); |
722 |
$("#sftp_passive").removeAttr("disabled"); |
723 |
$("#sftp_auth_mode").removeAttr("disabled"); |
724 |
$("#sftp_user_name").removeAttr("disabled"); |
725 |
$("#sftp_password").removeAttr("disabled"); |
726 |
$("#sftp_key_file").attr("disabled", "disabled"); |
727 |
|
728 |
$("#sftp_auth_mode option[value='password']").removeAttr("disabled"); |
729 |
$("#sftp_auth_mode option[value='key_file']").attr("disabled", "disabled"); |
730 |
$("#sftp_auth_mode option[value='noauth']").removeAttr("disabled"); |
731 |
if($("#sftp_auth_mode option:selected").val() == "key_file") { |
732 |
$("#sftp_auth_mode option[value='password']").prop("selected", true); |
733 |
} |
734 |
|
692 |
|
735 |
let sftp_port = $("#sftp_port").val(); |
693 |
if ( $('#add').length > 0 ) { |
736 |
if(sftp_port == 22) $("#sftp_port").val("21"); |
694 |
$('#add').submit(); |
737 |
|
695 |
} |
738 |
authModeChange(); |
|
|
739 |
} else if(sftp_transport.val() == "sftp") { |
740 |
$("#sftp_host").removeAttr("disabled"); |
741 |
$("#sftp_port").removeAttr("disabled"); |
742 |
$("#sftp_passive").attr("disabled", "disabled"); |
743 |
$("#sftp_auth_mode").removeAttr("disabled"); |
744 |
$("#sftp_user_name").removeAttr("disabled"); |
745 |
$("#sftp_password").removeAttr("disabled"); |
746 |
$("#sftp_key_file").removeAttr("disabled"); |
747 |
|
748 |
$("#sftp_auth_mode option[value='password']").removeAttr("disabled"); |
749 |
$("#sftp_auth_mode option[value='key_file']").removeAttr("disabled"); |
750 |
$("#sftp_auth_mode option[value='noauth']").removeAttr("disabled"); |
751 |
$("#sftp_passive option[value='1']").prop("selected", true); |
752 |
|
753 |
let sftp_port = $("#sftp_port").val(); |
754 |
if(sftp_port == 21) $("#sftp_port").val("22"); |
755 |
|
696 |
|
756 |
return authModeChange(); |
697 |
if ( $('#edit_save').length > 0 ) { |
|
|
698 |
$('#edit_save').submit(); |
757 |
} |
699 |
} |
758 |
} |
700 |
}); |
759 |
|
701 |
|
760 |
function authModeChange() { |
702 |
}); |
761 |
let sftp_auth_mode = $("#sftp_auth_mode").val(); |
703 |
|
762 |
|
704 |
function transportChange() { |
763 |
if(sftp_auth_mode == "password") { |
705 |
let sftp_transport = $("#sftp_transport"); |
764 |
$("#sftp_password").removeAttr("disabled"); |
706 |
|
765 |
$("#sftp_key_file").attr("disabled", "disabled"); |
707 |
if(sftp_transport.val() == "ftp") { |
766 |
} else if(sftp_auth_mode == "key_file") { |
708 |
$("#sftp_host").removeAttr("disabled"); |
767 |
$("#sftp_password").attr("disabled", "disabled"); |
709 |
$("#sftp_port").removeAttr("disabled"); |
768 |
$("#sftp_key_file").removeAttr("disabled"); |
710 |
$("#sftp_passive").removeAttr("disabled"); |
769 |
} else { |
711 |
$("#sftp_auth_mode").removeAttr("disabled"); |
770 |
$("#sftp_password").attr("disabled", "disabled"); |
712 |
$("#sftp_user_name").removeAttr("disabled"); |
771 |
$("#sftp_key_file").attr("disabled", "disabled"); |
713 |
$("#sftp_password").removeAttr("disabled"); |
|
|
714 |
$("#sftp_key_file").attr("disabled", "disabled"); |
715 |
|
716 |
$("#sftp_auth_mode option[value='password']").removeAttr("disabled"); |
717 |
$("#sftp_auth_mode option[value='key_file']").attr("disabled", "disabled"); |
718 |
$("#sftp_auth_mode option[value='noauth']").removeAttr("disabled"); |
719 |
if($("#sftp_auth_mode option:selected").val() == "key_file") { |
720 |
$("#sftp_auth_mode option[value='password']").prop("selected", true); |
772 |
} |
721 |
} |
773 |
} |
|
|
774 |
|
722 |
|
775 |
function modalChange() { |
723 |
let sftp_port = $("#sftp_port").val(); |
776 |
$('#modal_message').hide(); |
724 |
if(sftp_port == 22) $("#sftp_port").val("21"); |
777 |
if ( $('#sftp_transport').val() == 'sftp' ) $('#modal_message').show(); |
|
|
778 |
|
725 |
|
779 |
$('#modal_host').text( $('#sftp_host').val() ); |
726 |
authModeChange(); |
780 |
$('#modal_port').text( $('#sftp_port').val() ); |
727 |
} else if(sftp_transport.val() == "sftp") { |
781 |
$('#modal_transport').text( $('#sftp_transport option:selected').text() ); |
728 |
$("#sftp_host").removeAttr("disabled"); |
782 |
$('#modal_user_name').text( $('#sftp_user_name').val() ); |
729 |
$("#sftp_port").removeAttr("disabled"); |
783 |
$('#modal_auth_mode').text( $('#sftp_auth_mode option:selected').text() ); |
730 |
$("#sftp_passive").attr("disabled", "disabled"); |
|
|
731 |
$("#sftp_auth_mode").removeAttr("disabled"); |
732 |
$("#sftp_user_name").removeAttr("disabled"); |
733 |
$("#sftp_password").removeAttr("disabled"); |
734 |
$("#sftp_key_file").removeAttr("disabled"); |
735 |
|
736 |
$("#sftp_auth_mode option[value='password']").removeAttr("disabled"); |
737 |
$("#sftp_auth_mode option[value='key_file']").removeAttr("disabled"); |
738 |
$("#sftp_auth_mode option[value='noauth']").removeAttr("disabled"); |
739 |
$("#sftp_passive option[value='1']").prop("selected", true); |
740 |
|
741 |
let sftp_port = $("#sftp_port").val(); |
742 |
if(sftp_port == 21) $("#sftp_port").val("22"); |
743 |
|
744 |
return authModeChange(); |
784 |
} |
745 |
} |
785 |
</script> |
746 |
} |
786 |
[% END %] |
747 |
|
787 |
|
748 |
function authModeChange() { |
788 |
[% INCLUDE 'intranet-bottom.inc' %] |
749 |
let sftp_auth_mode = $("#sftp_auth_mode").val(); |
789 |
</div> |
750 |
|
|
|
751 |
if(sftp_auth_mode == "password") { |
752 |
$("#sftp_password").removeAttr("disabled"); |
753 |
$("#sftp_key_file").attr("disabled", "disabled"); |
754 |
} else if(sftp_auth_mode == "key_file") { |
755 |
$("#sftp_password").attr("disabled", "disabled"); |
756 |
$("#sftp_key_file").removeAttr("disabled"); |
757 |
} else { |
758 |
$("#sftp_password").attr("disabled", "disabled"); |
759 |
$("#sftp_key_file").attr("disabled", "disabled"); |
760 |
} |
761 |
} |
762 |
|
763 |
function modalChange() { |
764 |
$('#modal_message').hide(); |
765 |
if ( $('#sftp_transport').val() == 'sftp' ) $('#modal_message').show(); |
766 |
|
767 |
$('#modal_host').text( $('#sftp_host').val() ); |
768 |
$('#modal_port').text( $('#sftp_port').val() ); |
769 |
$('#modal_transport').text( $('#sftp_transport option:selected').text() ); |
770 |
$('#modal_user_name').text( $('#sftp_user_name').val() ); |
771 |
$('#modal_auth_mode').text( $('#sftp_auth_mode option:selected').text() ); |
772 |
} |
773 |
</script> |
774 |
[% END %] |
775 |
[% INCLUDE 'intranet-bottom.inc' %] |
790 |
- |
|
|