Line 0
Link Here
|
|
|
1 |
[% USE raw %] |
2 |
[% USE Asset %] |
3 |
[% USE Branches %] |
4 |
[% USE Categories %] |
5 |
[% SET footerjs = 1 %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
7 |
<title> |
8 |
[% IF op == 'add_form' %] |
9 |
New authentication provider domain › [% ELSIF op == 'edit_form' %] |
10 |
Edit authentication provider domain › [% END %] |
11 |
|
12 |
Authentication providers › Administration › Koha |
13 |
</title> |
14 |
[% INCLUDE 'doc-head-close.inc' %] |
15 |
</head> |
16 |
|
17 |
<body id="admin_auth_provider_domains" class="admin"> |
18 |
[% INCLUDE 'header.inc' %] |
19 |
[% INCLUDE 'prefs-admin-search.inc' %] |
20 |
|
21 |
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> |
22 |
<ol> |
23 |
<li> |
24 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> |
25 |
</li> |
26 |
<li> |
27 |
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> |
28 |
</li> |
29 |
|
30 |
<li> |
31 |
<a href="/cgi-bin/koha/admin/authentication_providers.pl">Authentication providers</a> |
32 |
</li> |
33 |
|
34 |
[% IF op == 'add_form' %] |
35 |
<li> |
36 |
<a href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | uri -%]">Domains for [%- auth_provider_name | html -%]</a> |
37 |
</li> |
38 |
<li> |
39 |
<a href="#" aria-current="page"> |
40 |
New Domain |
41 |
</a> |
42 |
</li> |
43 |
|
44 |
[% ELSIF op == 'edit_form' %] |
45 |
<li> |
46 |
<a href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | uri -%]">Domains for [%- auth_provider_name | html -%]</a> |
47 |
</li> |
48 |
<li> |
49 |
<a href="#" aria-current="page"> |
50 |
Edit Domain |
51 |
</a> |
52 |
</li> |
53 |
|
54 |
[% ELSE %] |
55 |
<li> |
56 |
<a href="#" aria-current="page"> |
57 |
Domains for [%- auth_provider_code | html -%] |
58 |
</a> |
59 |
</li> |
60 |
[% END %] |
61 |
</ol> |
62 |
</nav> |
63 |
|
64 |
<div class="main container-fluid"> |
65 |
<div class="row"> |
66 |
<div class="col-sm-10 col-sm-push-2"> |
67 |
<main> |
68 |
|
69 |
[% FOREACH m IN messages %] |
70 |
<div class="dialog [% m.type | html %]" id="auth_provider_domain_action_result_dialog"> |
71 |
[% SWITCH m.code %] |
72 |
[% CASE 'error_on_update' %] |
73 |
<span>An error occurred trying to open the authentication provider domain for editing. The passed id is invalid.</span> |
74 |
[% CASE 'error_on_insert' %] |
75 |
<span>An error occurred when adding a new authentication provider domain.</span> |
76 |
[% CASE 'success_on_update' %] |
77 |
<span>Authentication provider domain updated successfully.</span> |
78 |
[% CASE 'success_on_insert' %] |
79 |
<span>Authentication provider domain added successfully.</span> |
80 |
[% CASE %] |
81 |
<span>[% m.code | html %]</span> |
82 |
[% END %] |
83 |
</div> |
84 |
[% END %] |
85 |
|
86 |
<div class="dialog message" id="auth_provider_domain_delete_success" style="display: none;"></div> |
87 |
<div class="dialog alert" id="auth_provider_domain_delete_error" style="display: none;"></div> |
88 |
|
89 |
[% IF op == 'add_form' %] |
90 |
<h1>New authentication provider domain</h1> |
91 |
<form action="/cgi-bin/koha/admin/authentication_providers.pl" id="add" name="add" class="validated" method="post"> |
92 |
<input type="hidden" name="op" value="add" /> |
93 |
<input type="hidden" name="domain_ops" value="1" /> |
94 |
<input type="hidden" name="auth_provider_id" value="[%- auth_provider_id | html -%]" /> |
95 |
<fieldset class="rows"> |
96 |
<ol> |
97 |
<li> |
98 |
<label for="domain">Domain: </label> |
99 |
<input type="text" name="domain" id="domain" size="60" /> |
100 |
</li> |
101 |
</ol> |
102 |
</fieldset> |
103 |
|
104 |
<fieldset class="rows"> |
105 |
<ol> |
106 |
<li> |
107 |
<label for="update_on_auth">Update on login: </label> |
108 |
<select name="update_on_auth" id="update_on_auth"> |
109 |
<option value="1">Update</option> |
110 |
<option value="0" selected="selected">Don't update</option> |
111 |
</select> |
112 |
<span>user data on login</span> |
113 |
</li> |
114 |
<li> |
115 |
<label for="auto_register">Auto register: </label> |
116 |
<select name="auto_register" id="auto_register"> |
117 |
<option value="1">Allow</option> |
118 |
<option value="0" selected="selected">Don't allow</option> |
119 |
</select> |
120 |
<span>users to auto register on login</span> |
121 |
</li> |
122 |
<li> |
123 |
<label for="default_library_id">Default library: </label> |
124 |
<select id="default_library_id" name="default_library_id"> |
125 |
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %] |
126 |
</select> |
127 |
</li> |
128 |
<li> |
129 |
<label for="default_category_id">Default category: </label> |
130 |
[% SET categories = Categories.all() %] |
131 |
<select name="default_category_id" id="default_category_id"> |
132 |
[% FOREACH category IN categories %] |
133 |
<option value="[% category.categorycode | html %]">[% category.description | html %]</option> |
134 |
[% END %] |
135 |
</select> |
136 |
</li> |
137 |
<li> |
138 |
<label for="allow_opac">Allow opac: </label> |
139 |
<select name="allow_opac" id="allow_opac"> |
140 |
<option value="1" selected="selected">Allow</option> |
141 |
<option value="0">Don't allow</option> |
142 |
</select> |
143 |
<span>opac users of this domain to login with this authentication provider</span> |
144 |
</li> |
145 |
<li> |
146 |
<label for="allow_opac">Allow staff: </label> |
147 |
<select name="allow_staff" id="allow_staff"> |
148 |
<option value="1" selected="selected">Allow</option> |
149 |
<option value="0">Don't allow</option> |
150 |
</select> |
151 |
<span>of this domain </span> |
152 |
</li> |
153 |
</ol> |
154 |
</fieldset> |
155 |
<fieldset class="action"> |
156 |
<input type="submit" value="Submit" /> |
157 |
<a class="cancel" href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | html -%]">Cancel</a> |
158 |
</fieldset> |
159 |
</form> |
160 |
[% END %] |
161 |
|
162 |
[% IF op == 'edit_form' %] |
163 |
<h1>Edit authentication provider domain</h1> |
164 |
<form action="/cgi-bin/koha/admin/authentication_providers.pl" id="edit_save" name="edit_save" class="validated" method="post"> |
165 |
<input type="hidden" name="op" value="edit_save" /> |
166 |
<input type="hidden" name="domain_ops" value="1" /> |
167 |
<input type="hidden" name="auth_provider_id" value="[%- auth_provider_id | html -%]" /> |
168 |
<input type="hidden" name="auth_provider_domain_id" value="[%- auth_provider_domain.auth_provider_domain_id | html -%]" /> |
169 |
<fieldset class="rows"> |
170 |
<ol> |
171 |
<li> |
172 |
<label for="domain">Domain: </label> |
173 |
<input type="text" name="domain" id="domain" size="60" value="[%- auth_provider_domain.domain | html -%]"/> |
174 |
</li> |
175 |
</ol> |
176 |
</fieldset> |
177 |
|
178 |
<fieldset class="rows"> |
179 |
<ol> |
180 |
<li> |
181 |
<label for="update_on_auth">Update on login: </label> |
182 |
<select name="update_on_auth" id="update_on_auth"> |
183 |
[% IF auth_provider_domain.update_on_auth == "1" %] |
184 |
<option value="1" selected="selected">Update</option> |
185 |
<option value="0">Don't update</option> |
186 |
[% ELSE %] |
187 |
<option value="1">Update</option> |
188 |
<option value="0" selected="selected">Don't update</option> |
189 |
[% END %] |
190 |
</select> |
191 |
<span>user data on login</span> |
192 |
</li> |
193 |
<li> |
194 |
<label for="auto_register">Auto register: </label> |
195 |
<select name="auto_register" id="auto_register"> |
196 |
[% IF auth_provider_domain.auto_register == "1" %] |
197 |
<option value="1" selected="selected">Allow</option> |
198 |
<option value="0">Don't allow</option> |
199 |
[% ELSE %] |
200 |
<option value="1">Allow</option> |
201 |
<option value="0" selected="selected">Don't allow</option> |
202 |
[% END %] |
203 |
</select> |
204 |
<span>users to auto register on login</span> |
205 |
</li> |
206 |
<li> |
207 |
<label for="default_library_id">Default library: </label> |
208 |
<select id="default_library_id" name="default_library_id"> |
209 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => auth_provider_domain.default_library_id, unfiltered => 1, do_not_select_my_library => 1 ) %] |
210 |
</select> |
211 |
</li> |
212 |
<li> |
213 |
<label for="default_category_id">Default category: </label> |
214 |
[% SET categories = Categories.all() %] |
215 |
<select name="default_category_id" id="default_category_id"> |
216 |
[% FOREACH category IN categories %] |
217 |
[% IF category.categorycode == auth_provider_domain.default_category_id %] |
218 |
<option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option> |
219 |
[% ELSE %] |
220 |
<option value="[% category.categorycode | html %]">[% category.description | html %]</option> |
221 |
[% END %] |
222 |
[% END %] |
223 |
</select> |
224 |
</li> |
225 |
<li> |
226 |
<label for="allow_opac">Allow opac: </label> |
227 |
<select name="allow_opac" id="allow_opac"> |
228 |
[% IF auth_provider_domain.allow_opac == "1" %] |
229 |
<option value="1" selected="selected">Allow</option> |
230 |
<option value="0">Don't allow</option> |
231 |
[% ELSE %] |
232 |
<option value="1">Allow</option> |
233 |
<option value="0" selected="selected">Don't allow</option> |
234 |
[% END %] |
235 |
</select> |
236 |
<span>opac users of this domain to login with this authentication provider</span> |
237 |
</li> |
238 |
<li> |
239 |
<label for="allow_opac">Allow staff: </label> |
240 |
<select name="allow_staff" id="allow_staff"> |
241 |
[% IF auth_provider_domain.allow_staff == "1" %] |
242 |
<option value="1" selected="selected">Allow</option> |
243 |
<option value="0">Don't allow</option> |
244 |
[% ELSE %] |
245 |
<option value="1">Allow</option> |
246 |
<option value="0" selected="selected">Don't allow</option> |
247 |
[% END %] |
248 |
</select> |
249 |
<span>staff users of this domain to login with this authentication provider</span> |
250 |
</li> |
251 |
</ol> |
252 |
</fieldset> |
253 |
<fieldset class="action"> |
254 |
<input type="submit" value="Submit" /> |
255 |
<a class="cancel" href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | html -%]">Cancel</a> |
256 |
</fieldset> |
257 |
</form> |
258 |
[% END %] |
259 |
|
260 |
[% IF op == 'list' %] |
261 |
|
262 |
<div id="toolbar" class="btn-toolbar"> |
263 |
<a class="btn btn-default" id="new_auth_provider_domain" href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | html -%]&op=add_form"><i class="fa fa-plus"></i> New authentication provider domain</a> |
264 |
</div> |
265 |
|
266 |
<h1>Authentication provider domains</h1> |
267 |
|
268 |
<table id="auth_provider_domains"> |
269 |
<thead> |
270 |
<tr> |
271 |
<th>Domain</th> |
272 |
<th>Update on login</th> |
273 |
<th>Auto register</th> |
274 |
<th>Default library</th> |
275 |
<th>Default category</th> |
276 |
<th>Allow opac</th> |
277 |
<th>Allow staff</th> |
278 |
<th data-class-name="actions noExport">Actions</th> |
279 |
</tr> |
280 |
</thead> |
281 |
</table> |
282 |
[% END %] |
283 |
|
284 |
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true"> |
285 |
<div class="modal-dialog"> |
286 |
<div class="modal-content"> |
287 |
<div class="modal-header"> |
288 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
289 |
<h3 id="delete_confirm_modal_label">Delete authentication provider domain</h3> |
290 |
</div> |
291 |
<div class="modal-body"> |
292 |
<div id="delete_confirm_dialog"></div> |
293 |
</div> |
294 |
<div class="modal-footer"> |
295 |
<a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a> |
296 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
297 |
</div> |
298 |
</div> <!-- /.modal-content --> |
299 |
</div> <!-- /.modal-dialog --> |
300 |
</div> <!-- #delete_confirm_modal --> |
301 |
|
302 |
</main> |
303 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
304 |
|
305 |
<div class="col-sm-2 col-sm-pull-10"> |
306 |
<aside> |
307 |
[% INCLUDE 'admin-menu.inc' %] |
308 |
</aside> |
309 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
310 |
</div> <!-- /.row --> |
311 |
|
312 |
|
313 |
[% MACRO jsinclude BLOCK %] |
314 |
[% Asset.js("js/admin-menu.js") | $raw %] |
315 |
[% INCLUDE 'datatables.inc' %] |
316 |
<script> |
317 |
$(document).ready(function() { |
318 |
|
319 |
var auth_provider_domains_url = '/api/v1/auth/providers/[%- auth_provider_id | html -%]/domains'; |
320 |
[% SET categories = Categories.all() %] |
321 |
var categories = { |
322 |
[% FOREACH category IN categories %] |
323 |
"[% category.categorycode | html %]": "[% category.description | html %]", |
324 |
[% END %] |
325 |
}; |
326 |
[% SET libraries = Branches.all() %] |
327 |
var libraries = { |
328 |
[% FOREACH library IN libraries %] |
329 |
"[% library.branchcode | html %]": "[% library.branchname | html %]", |
330 |
[% END %] |
331 |
}; |
332 |
window.auth_provider_domains = $("#auth_provider_domains").kohaTable({ |
333 |
"ajax": { |
334 |
"url": auth_provider_domains_url |
335 |
}, |
336 |
'language': { |
337 |
'emptyTable': '<div class="dialog message">'+_("There are no authentication provider domains defined.")+'</div>' |
338 |
}, |
339 |
"columnDefs": [ { |
340 |
"targets": [1], |
341 |
"render": function (data, type, row, meta) { |
342 |
if ( type == 'display' ) { |
343 |
if ( data != null ) { |
344 |
return data.escapeHtml(); |
345 |
} |
346 |
else { |
347 |
return ""; |
348 |
} |
349 |
} |
350 |
return data; |
351 |
} |
352 |
} ], |
353 |
"columns": [ |
354 |
{ |
355 |
"data": "domain", |
356 |
"searchable": true, |
357 |
"orderable": true, |
358 |
"render": function(data, type, row, meta) { |
359 |
if ( data != null ) { |
360 |
return data.escapeHtml(); |
361 |
} |
362 |
else { |
363 |
return "*"; |
364 |
} |
365 |
} |
366 |
}, |
367 |
{ |
368 |
"data": function( row, type, val, meta ) { |
369 |
if (row.update_on_auth) { |
370 |
return _("Yes"); |
371 |
} else { |
372 |
return _("No"); |
373 |
} |
374 |
}, |
375 |
"searchable": true, |
376 |
"orderable": true |
377 |
}, |
378 |
{ |
379 |
"data": function( row, type, val, meta ) { |
380 |
if (row.auto_register) { |
381 |
return _("Yes"); |
382 |
} else { |
383 |
return _("No"); |
384 |
} |
385 |
}, |
386 |
"searchable": true, |
387 |
"orderable": true |
388 |
}, |
389 |
{ |
390 |
"data": function( row, type, val, meta ) { |
391 |
return libraries[row.default_library_id] || ""; |
392 |
}, |
393 |
"searchable": true, |
394 |
"orderable": true |
395 |
}, |
396 |
{ |
397 |
"data": function( row, type, val, meta ) { |
398 |
return categories[row.default_category_id] || ""; |
399 |
}, |
400 |
"searchable": true, |
401 |
"orderable": true |
402 |
}, |
403 |
{ |
404 |
"data": function( row, type, val, meta ) { |
405 |
if (row.allow_opac) { |
406 |
return _("Yes"); |
407 |
} else { |
408 |
return _("No"); |
409 |
} |
410 |
}, |
411 |
"searchable": true, |
412 |
"orderable": true |
413 |
}, |
414 |
{ |
415 |
"data": function( row, type, val, meta ) { |
416 |
if (row.allow_staff) { |
417 |
return _("Yes"); |
418 |
} else { |
419 |
return _("No"); |
420 |
} |
421 |
}, |
422 |
"searchable": true, |
423 |
"orderable": true |
424 |
}, |
425 |
{ |
426 |
"data": function( row, type, val, meta ) { |
427 |
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/authentication_providers.pl?domain_ops=1&auth_provider_id=[%- auth_provider_id | html -%]&op=edit_form&auth_provider_domain_id='+ encodeURIComponent(row.auth_provider_domain_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n"; |
428 |
result += '<a class="btn btn-default btn-xs delete_auth_provider_domain" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-auth-provider-domain-id="'+ encodeURIComponent(row.auth_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</a>'; |
429 |
return result; |
430 |
}, |
431 |
"searchable": false, |
432 |
"orderable": false |
433 |
} |
434 |
], |
435 |
createdRow: function (row, data, dataIndex) { |
436 |
if ( data.debug ) { |
437 |
$(row).addClass('debug'); |
438 |
} |
439 |
}, |
440 |
}); |
441 |
|
442 |
$('#auth_provider_domains').on( "click", '.delete_auth_provider_domain', function () { |
443 |
var auth_provider_domain_id = $(this).data('auth-provider-domain-id'); |
444 |
var auth_provider_domain = decodeURIComponent($(this).data('auth-provider-domain')); |
445 |
|
446 |
$("#delete_confirm_dialog").html( |
447 |
_("You are about to delete the '%s' authentication provider domain.").format(auth_provider_domain) |
448 |
); |
449 |
$("#delete_confirm_modal_button").data('auth-provider-domain-id', auth_provider_domain_id); |
450 |
$("#delete_confirm_modal_button").data('auth-provider-domain', auth_provider_domain); |
451 |
}); |
452 |
|
453 |
$("#delete_confirm_modal_button").on( "click", function () { |
454 |
|
455 |
var auth_provider_domain_id = $(this).data('auth-provider-domain-id'); |
456 |
var auth_provider_domain = $(this).data('auth-provider-domain'); |
457 |
|
458 |
$.ajax({ |
459 |
method: "DELETE", |
460 |
url: auth_provider_domains_url+"/"+auth_provider_domain_id |
461 |
}).success(function() { |
462 |
window.auth_provider_domains.api().ajax.reload(function (data) { |
463 |
$("#smtp_action_result_dialog").hide(); |
464 |
$("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(auth_provider_domain)).show(); |
465 |
}); |
466 |
}).fail(function () { |
467 |
$("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs.").format(auth_provider_domain)).show(); |
468 |
}).done(function () { |
469 |
$("#delete_confirm_modal").modal('hide'); |
470 |
}); |
471 |
}); |
472 |
}); |
473 |
</script> |
474 |
[% END %] |
475 |
|
476 |
[% INCLUDE 'intranet-bottom.inc' %] |