Line 0
Link Here
|
0 |
- |
1 |
[% USE raw %] |
|
|
2 |
[% USE Asset %] |
3 |
[% SET footerjs = 1 %] |
4 |
[% USE TablesSettings %] |
5 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
<title>Koha › Administration › SMTP servers |
7 |
[% IF op == 'add_form' %] |
8 |
›[% IF library %]Modify SMTP server[% ELSE %]New SMTP server[% END %] |
9 |
[% ELSIF op == 'delete_confirm' %] |
10 |
› Confirm deletion of SMTP server '[% server.name | html %]' |
11 |
[% END %] |
12 |
</title> |
13 |
[% INCLUDE 'doc-head-close.inc' %] |
14 |
</head> |
15 |
|
16 |
<body id="admin_smtp_servers" class="admin"> |
17 |
[% INCLUDE 'header.inc' %] |
18 |
[% INCLUDE 'prefs-admin-search.inc' %] |
19 |
|
20 |
<div id="breadcrumbs"> |
21 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> › |
22 |
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › |
23 |
<a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a> |
24 |
[% IF op == 'add_form' %] |
25 |
› <span> New</span> |
26 |
[% ELSIF op == 'edit_form' %] |
27 |
› <span> Edit</span> |
28 |
[% END %] |
29 |
</div> |
30 |
|
31 |
<div class="main container-fluid"> |
32 |
<div class="row"> |
33 |
<div class="col-sm-10 col-sm-push-2"> |
34 |
<main> |
35 |
|
36 |
[% FOREACH m IN messages %] |
37 |
<div class="dialog [% message.type | html %]"> |
38 |
[% SWITCH m.code %] |
39 |
[% CASE 'error_on_update' %] |
40 |
An error occurred when updating this library. Perhaps it already exists. |
41 |
[% CASE 'error_on_insert' %] |
42 |
An error occurred when adding this library. The branchcode might already exist. |
43 |
[% CASE 'error_on_delete' %] |
44 |
An error occurred when deleting this library. Check the logs. |
45 |
[% CASE 'success_on_update' %] |
46 |
Library updated successfully. |
47 |
[% CASE 'success_on_insert' %] |
48 |
Library added successfully. |
49 |
[% CASE 'success_on_delete' %] |
50 |
Library deleted successfully. |
51 |
[% CASE 'cannot_delete_library' %] |
52 |
This library cannot be deleted. Patrons or items are still using it |
53 |
[% IF m.data.patrons_count and m.data.items_count %] |
54 |
([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items). |
55 |
[% ELSIF m.data.patrons_count %] |
56 |
([% m.data.patrons_count | html %] patrons). |
57 |
[% ELSIF m.data.items_count %] |
58 |
([% m.data.items_count | html %] items). |
59 |
[% END %] |
60 |
[% CASE 'error_on_update_category' %] |
61 |
An error occurred when updating this library category. Perhaps it already exists. |
62 |
[% CASE 'error_on_insert_category' %] |
63 |
An error occurred when adding this library category. The categorycode might already exist. |
64 |
[% CASE 'error_on_delete_category' %] |
65 |
An error occurred when deleting this library category. Check the logs. |
66 |
[% CASE 'success_on_update_category' %] |
67 |
Library category updated successfully. |
68 |
[% CASE 'success_on_insert_category' %] |
69 |
Library category added successfully. |
70 |
[% CASE 'success_on_delete_category' %] |
71 |
Library category deleted successfully. |
72 |
[% CASE 'cannot_delete_category' %] |
73 |
This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it. |
74 |
[% CASE %] |
75 |
[% m.code | html %] |
76 |
[% END %] |
77 |
</div> |
78 |
[% END %] |
79 |
|
80 |
[% IF op == 'add_form' %] |
81 |
<h3>New SMTP server</h3> |
82 |
<form action="/cgi-bin/koha/admin/smtp_servers.pl" id="add" name="add" class="validated" method="post"> |
83 |
<input type="hidden" name="op" value="add" /> |
84 |
<fieldset class="rows"> |
85 |
<ol> |
86 |
<li> |
87 |
<label for="library_id" class="required">Library: </label> |
88 |
<select name="library_id" id="library_id"> |
89 |
[%- UNLESS default_set -%] |
90 |
<option value="*">All libraries</option> |
91 |
[%- END -%] |
92 |
[%- FOREACH library IN unset_libraries -%] |
93 |
<option value="[% library.branchcode | html %]">[% library.branchname | html %]</option> |
94 |
[%- END -%] |
95 |
</select> |
96 |
<span class="required">Required</span> |
97 |
</li> |
98 |
</select> |
99 |
<li> |
100 |
<label for="smtp_name" class="required">Name: </label> |
101 |
<input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" /> |
102 |
<span class="required">Required</span> |
103 |
</li> |
104 |
</ol> |
105 |
</fieldset> |
106 |
|
107 |
<fieldset class="rows"> |
108 |
<ol> |
109 |
<li> |
110 |
<label for="smtp_host">Host: </label> |
111 |
<input type="text" name="smtp_host" id="smtp_host" size="60" class="required"/> |
112 |
<span class="required">Required</span> |
113 |
</li> |
114 |
<li> |
115 |
<label for="smtp_port">Port: </label> |
116 |
<input type="number" step="1" value="25" name="smtp_port" id="smtp_port" size="20" class="required"/> |
117 |
<span class="required">Required</span> |
118 |
</li> |
119 |
<li> |
120 |
<label for="smtp_timeout">Timeout (seconds): </label> |
121 |
<input type="number" step="1" value="120" name="smtp_timeout" id="smtp_timeout" size="20" /> |
122 |
</li> |
123 |
<li> |
124 |
<label for="smtp_ssl">SSL: </label> |
125 |
<select name="smtp_ssl" id="smtp_ssl"> |
126 |
<option value="1" selected="selected">Yes</option> |
127 |
<option value="0">No</option> |
128 |
</select> |
129 |
</li> |
130 |
<li> |
131 |
<label for="smtp_user_name">User name: </label> |
132 |
<input type="text" name="smtp_user_name" id="smtp_user_name" size="60" /> |
133 |
</li> |
134 |
<li> |
135 |
<label for="smtp_password">Password: </label> |
136 |
<input type="password" name="smtp_password" id="smtp_password" size="60" /> |
137 |
</li> |
138 |
</ol> |
139 |
</fieldset> |
140 |
<fieldset class="action"> |
141 |
<input type="submit" value="Submit" /> |
142 |
<a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a> |
143 |
</fieldset> |
144 |
</form> |
145 |
[% END %] |
146 |
|
147 |
[% IF op == 'edit_form' %] |
148 |
<h3>Edit SMTP server</h3> |
149 |
<form action="/cgi-bin/koha/admin/smtp_servers.pl" id="edit_save" name="edit_save" class="validated" method="post"> |
150 |
<input type="hidden" name="op" value="edit_save" /> |
151 |
<input type="hidden" name="smtp_server_id" value="[%- smtp_server.id | html -%]" /> |
152 |
<fieldset class="rows"> |
153 |
<ol> |
154 |
<li> |
155 |
<label for="library_id">Library: </label> |
156 |
[% IF smtp_server.library %] |
157 |
<span name="library_id" id="library_id">[%- smtp_server.library.branchname | html -%]</span> |
158 |
[%- ELSE -%] |
159 |
<span name="library_id" id="library_id">All libraries</span> |
160 |
[%- END -%] |
161 |
</li> |
162 |
</select> |
163 |
<li> |
164 |
<label for="smtp_name" class="required">Name: </label> |
165 |
<input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" value="[%- smtp_server.name | html -%]"/> |
166 |
<span class="required">Required</span> |
167 |
</li> |
168 |
</ol> |
169 |
</fieldset> |
170 |
|
171 |
<fieldset class="rows"> |
172 |
<ol> |
173 |
<li> |
174 |
<label for="smtp_host">Host: </label> |
175 |
<input type="text" name="smtp_host" id="smtp_host" size="60" class="required" value="[%- smtp_server.host | html -%]"/> |
176 |
<span class="required">Required</span> |
177 |
</li> |
178 |
<li> |
179 |
<label for="smtp_port">Port: </label> |
180 |
<input type="number" step="1" value="25" name="smtp_port" id="smtp_port" size="20" class="required" value="[%- smtp_server.port | html -%]"/> |
181 |
<span class="required">Required</span> |
182 |
</li> |
183 |
<li> |
184 |
<label for="smtp_timeout">Timeout (seconds): </label> |
185 |
<input type="number" step="1" value="120" name="smtp_timeout" id="smtp_timeout" size="20" value="[%- smtp_server.timeout | html -%]"/> |
186 |
</li> |
187 |
<li> |
188 |
<label for="smtp_ssl">SSL: </label> |
189 |
<select name="smtp_ssl" id="smtp_ssl"> |
190 |
[%- IF smtp_server.ssl -%] |
191 |
<option value="1" selected="selected">Yes</option> |
192 |
<option value="0">No</option> |
193 |
[%- ELSE -%] |
194 |
<option value="1">Yes</option> |
195 |
<option value="0" selected="selected">No</option> |
196 |
[%- END -%] |
197 |
</select> |
198 |
</li> |
199 |
<li> |
200 |
<label for="smtp_user_name">User name: </label> |
201 |
<input type="text" name="smtp_user_name" id="smtp_user_name" size="60" value="[%- smtp_server.user_name | html -%]"/> |
202 |
</li> |
203 |
<li> |
204 |
<label for="smtp_password">Password: </label> |
205 |
<input type="password" name="smtp_password" id="smtp_password" size="60" value="[%- smtp_server.password | html -%]"/> |
206 |
</li> |
207 |
</ol> |
208 |
</fieldset> |
209 |
<fieldset class="action"> |
210 |
<input type="submit" value="Submit" /> |
211 |
<a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a> |
212 |
</fieldset> |
213 |
</form> |
214 |
[% END %] |
215 |
|
216 |
[% IF op == 'list' %] |
217 |
|
218 |
[%- IF unset_libraries.count > 0 -%] |
219 |
<div id="toolbar" class="btn-toolbar"> |
220 |
<a class="btn btn-default" id="new_smtp_server" href="/cgi-bin/koha/admin/smtp_servers.pl?op=add_form"><i class="fa fa-plus"></i> New SMTP server</a> |
221 |
</div> |
222 |
[%- END -%] |
223 |
|
224 |
<h3>SMTP servers</h3> |
225 |
|
226 |
[% IF servers_count > 0 %] |
227 |
<table id="smtp_servers"> |
228 |
<thead> |
229 |
<tr> |
230 |
<th>Library</th> |
231 |
<th>Name</th> |
232 |
<th>Host</th> |
233 |
<th>Port</th> |
234 |
<th>Timeout (secs)</th> |
235 |
<th>SSL</th> |
236 |
<th>Authenticated</th> |
237 |
<th data-class-name="actions">Actions</th> |
238 |
</tr> |
239 |
</thead> |
240 |
</table> |
241 |
[% ELSE %] |
242 |
<div class="dialog message">No user-defined SMTP servers. Using the default configuration: |
243 |
<ul> |
244 |
<li><strong>Host</strong>: [%- default_config.host | html -%]</li> |
245 |
<li><strong>Port</strong>: [%- default_config.port | html -%]</li> |
246 |
<li><strong>Timeout (secs)</strong>: [%- default_config.timeout | html -%]</li> |
247 |
<li><strong>SSL</strong>: [%- IF default_config.ssl -%]Yes[%- ELSE -%]No[%- END -%]</li> |
248 |
</ul> |
249 |
</pre> |
250 |
</div> |
251 |
[% END %] |
252 |
[% END %] |
253 |
|
254 |
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true"> |
255 |
<div class="modal-dialog"> |
256 |
<div class="modal-content"> |
257 |
<div class="modal-header"> |
258 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
259 |
<h3 id="delete_confirm_modal_label">Delete server</h3> |
260 |
</div> |
261 |
<div class="modal-body"> |
262 |
<div id="delete_confirm_dialog"></div> |
263 |
</div> |
264 |
<div class="modal-footer"> |
265 |
<a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a> |
266 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
267 |
</div> |
268 |
</div> <!-- /.modal-content --> |
269 |
</div> <!-- /.modal-dialog --> |
270 |
</div> <!-- #delete_confirm_modal --> |
271 |
|
272 |
</main> |
273 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
274 |
|
275 |
<div class="col-sm-2 col-sm-pull-10"> |
276 |
<aside> |
277 |
[% INCLUDE 'admin-menu.inc' %] |
278 |
</aside> |
279 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
280 |
</div> <!-- /.row --> |
281 |
|
282 |
|
283 |
[% MACRO jsinclude BLOCK %] |
284 |
[% Asset.js("js/admin-menu.js") | $raw %] |
285 |
[% INCLUDE 'datatables.inc' %] |
286 |
[% INCLUDE 'columns_settings.inc' %] |
287 |
[% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %] |
288 |
[% INCLUDE 'str/tinymce_i18n.inc' %] |
289 |
<script> |
290 |
$(document).ready(function() { |
291 |
|
292 |
var smtp_servers_url = '/api/v1/config/smtp_servers'; |
293 |
var smtp_servers = $("#smtp_servers").api({ |
294 |
"ajax": { |
295 |
"url": smtp_servers_url |
296 |
}, |
297 |
"embed": [ |
298 |
"library" |
299 |
], |
300 |
'emptyTable': '<div class="dialog message">'+_("There are no SMTP servers defined.")+'</div>', |
301 |
"columnDefs": [ { |
302 |
"targets": [0,1,2], |
303 |
"render": function (data, type, row, meta) { |
304 |
if ( type == 'display' ) { |
305 |
if ( data != null ) { |
306 |
return data.escapeHtml(); |
307 |
} |
308 |
else { |
309 |
return "Default"; |
310 |
} |
311 |
} |
312 |
return data; |
313 |
} |
314 |
} ], |
315 |
"columns": [ |
316 |
{ |
317 |
"data": "library.name", |
318 |
"searchable": true, |
319 |
"orderable": true |
320 |
}, |
321 |
{ |
322 |
"data": "name", |
323 |
"searchable": true, |
324 |
"orderable": true |
325 |
}, |
326 |
{ |
327 |
"data": "host", |
328 |
"searchable": true, |
329 |
"orderable": true |
330 |
}, |
331 |
{ |
332 |
"data": "port", |
333 |
"searchable": true, |
334 |
"orderable": false |
335 |
}, |
336 |
{ |
337 |
"data": "timeout", |
338 |
"searchable": true, |
339 |
"orderable": false |
340 |
}, |
341 |
{ |
342 |
"data": "ssl", |
343 |
"render": function (data, type, row, meta) { |
344 |
if (data) { |
345 |
return _("Yes"); |
346 |
} |
347 |
else { |
348 |
return _("No"); |
349 |
} |
350 |
}, |
351 |
"searchable": false, |
352 |
"orderable": false |
353 |
}, |
354 |
{ |
355 |
"data": function( row, type, val, meta ) { |
356 |
if ( row.user_name != null ) { |
357 |
return _("Yes"); |
358 |
} |
359 |
else { |
360 |
return _("No"); |
361 |
} |
362 |
}, |
363 |
"searchable": false, |
364 |
"orderable": false |
365 |
}, |
366 |
{ |
367 |
"data": function( row, type, val, meta ) { |
368 |
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+ encodeURIComponent(row.smtp_server_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; |
369 |
result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-smtp-server-id="'+ encodeURIComponent(row.smtp_server_id) +'" data-smtp-server-name="'+ encodeURIComponent(row.name) +'"><i class="fa fa-trash" aria-hidden="true"></i>'+_("Delete")+'</a>'; |
370 |
return result; |
371 |
}, |
372 |
"searchable": false, |
373 |
"orderable": false |
374 |
} |
375 |
] |
376 |
}); |
377 |
|
378 |
$('#smtp_servers').on( "click", '.delete_server', function () { |
379 |
var smtp_server_id = $(this).data('smtp-server-id'); |
380 |
var smtp_server_name = $(this).data('smtp-server-name'); |
381 |
|
382 |
$("#delete_confirm_dialog").html( |
383 |
_("You are about to delete the \"%s\" SMTP server.").format(smtp_server_name) |
384 |
); |
385 |
$("#delete_confirm_modal_button").attr("href", "/cgi-bin/koha/admin/smtp_servers.pl?op=delete&smtp_server_id=" + encodeURIComponent(smtp_server_id)); |
386 |
}); |
387 |
}); |
388 |
</script> |
389 |
[% END %] |
390 |
|
391 |
[% INCLUDE 'intranet-bottom.inc' %] |