Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt
Jonathan Druart 69fd7c026d
Bug 34478: op =~ ^cud- everywhere
This is the result of
  perl op_must_start_with_cud.pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:06 +01:00

498 lines
26 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Categories %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
[% IF op == 'add_form' %]
[% t("New identity provider domain") | html %] &rsaquo;
[% ELSIF op == 'edit_form' %]
[% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %] &rsaquo;
[% END %]
[% tx("Identity provider domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %] &rsaquo;
[% t("Identity providers") | html %] &rsaquo;
[% t("Administration") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_identity_provider_domains" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
[% END %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/identity_providers.pl">Identity providers</a>
[% END %]
[% IF op == 'add_form' %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | uri -%]">[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>New identity provider domain</span>
[% END %]
[% ELSIF op == 'edit_form' %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | uri -%]">[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %]
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</span>
[% END %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'messages.inc' %]
[% FOREACH m IN messages %]
<div class="dialog [% m.type | html %]" id="identity_provider_domain_action_result_dialog">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
<span>An error occurred trying to open the identity provider domain for editing. The passed ID is invalid.</span>
[% CASE 'error_on_insert' %]
<span>An error occurred when adding a new identity provider domain. Check the logs for details.</span>
[% CASE 'success_on_update' %]
<span>Identity provider domain updated successfully.</span>
[% CASE 'success_on_insert' %]
<span>Identity provider domain added successfully.</span>
[% CASE %]
<span>[% m.code | html %]</span>
[% END %]
</div>
[% END %]
<div class="dialog message" id="identity_provider_domain_delete_success" style="display: none;"></div>
<div class="dialog alert" id="identity_provider_domain_delete_error" style="display: none;"></div>
[% IF op == 'add_form' %]
<h1>[% tx("New identity provider domain for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</h1>
<form action="/cgi-bin/koha/admin/identity_providers.pl" id="add" name="add" class="validated" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-add" />
<input type="hidden" name="domain_ops" value="1" />
<input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
<fieldset class="rows">
<ol>
<li>
<label for="domain">Domain: </label>
<input type="text" name="domain" id="domain" size="60" />
<div class="hint">Email domain to match this rule. <button class="more btn btn-ligth" data-target="domain"><i class="fa fa-caret-down"></i> More</button></div>
<div class="hint more-domain" style="display: none">
<p>If this field is empty, or '*' any email domain will match this rule.</p>
<p>You may enter a wildcard at the beginning of the domain. For example, the domain '*library.com' will match 'students.library.com' but will also match 'otherlibrary.com'</p>
<p>Exact matches have precedence over wildcard ones, so 'library.com' domain will take precedence over '*library.com' when the email is 'somebody@library.com'</p>
<p>The same way, the longest match will take precedence over the shorter one, so '*teacher.university.com' will take precedence over '*.university.com' if the email is 'user@math.teacher.university.com'</p>
</div>
</li>
<li>
<label for="update_on_auth">Update on login: </label>
<select name="update_on_auth" id="update_on_auth">
<option value="1">Update</option>
<option value="0" selected="selected">Don't update</option>
</select>
<span>user data on login</span>
</li>
<li>
<label for="auto_register">Auto register: </label>
<select name="auto_register" id="auto_register">
<option value="1">Allow</option>
<option value="0" selected="selected">Don't allow</option>
</select>
<span>users to auto register on login</span>
</li>
<li>
<label for="default_library_id">Default library: </label>
<select id="default_library_id" name="default_library_id">
<option value="">None</option>
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %]
</select>
<div class="hint">Use this library for the patron on auto register</div>
</li>
<li>
<label for="default_category_id">Default category: </label>
[% SET categories = Categories.all() %]
<select name="default_category_id" id="default_category_id">
<option value="">None</option>
[% FOREACH category IN categories %]
<option value="[% category.categorycode | html %]">[% category.description | html %]</option>
[% END %]
</select>
<div class="hint">Use this category for the patron on auto register</div>
</li>
<li>
<label for="allow_opac">Allow OPAC: </label>
<select name="allow_opac" id="allow_opac">
<option value="1" selected="selected">Allow</option>
<option value="0">Don't allow</option>
</select>
<span>OPAC users from this domain to login with this identity provider.</span>
</li>
<li>
<label for="allow_staff">Allow staff: </label>
<select name="allow_staff" id="allow_staff">
<option value="1">Allow</option>
<option value="0" selected="selected">Don't allow</option>
</select>
<span>of this domain to login with this identity provider</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'edit_form' %]
<h1>[% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %]</h1>
<form action="/cgi-bin/koha/admin/identity_providers.pl" id="edit_save" name="edit_save" class="validated" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-edit_save" />
<input type="hidden" name="domain_ops" value="1" />
<input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
<input type="hidden" name="identity_provider_domain_id" value="[%- identity_provider_domain.identity_provider_domain_id | html -%]" />
<fieldset class="rows">
<ol>
<li>
<label for="domain">Domain: </label>
<input type="text" name="domain" id="domain" size="60" value="[%- identity_provider_domain.domain | html -%]"/>
<div class="hint">Email domain to match this rule. <button class="more btn btn-ligth" data-target="domain"><i class="fa fa-caret-down"></i> More</button></div>
<div class="hint more-domain" style="display: none">
<p>If this field is empty, or '*' any email domain will match this rule.</p>
<p>You may enter a wildcard at the beginning of the domain. For example, the domain '*library.com' will match 'students.library.com' but will also match 'otherlibrary.com'</p>
<p>Exact matches have precedence over asterix ones, so 'library.com' will take precedence over '*library.com' when the email is 'somebody@library.com'</p>
<p>The same way, the longest match will take precedence over the shorter one, so '*teacher.university.com' will take precedence over '*.university.com' if the email is 'user@math.teacher.university.com'</p>
</div>
</li>
<li>
<label for="update_on_auth">Update on login: </label>
<select name="update_on_auth" id="update_on_auth">
[% IF identity_provider_domain.update_on_auth == "1" %]
<option value="1" selected="selected">Update</option>
<option value="0">Don't update</option>
[% ELSE %]
<option value="1">Update</option>
<option value="0" selected="selected">Don't update</option>
[% END %]
</select>
<span>user data on login</span>
</li>
<li>
<label for="auto_register">Auto register: </label>
<select name="auto_register" id="auto_register">
[% IF identity_provider_domain.auto_register == "1" %]
<option value="1" selected="selected">Allow</option>
<option value="0">Don't allow</option>
[% ELSE %]
<option value="1">Allow</option>
<option value="0" selected="selected">Don't allow</option>
[% END %]
</select>
<span>users to auto register on login</span>
</li>
<li>
<label for="default_library_id">Default library: </label>
<select id="default_library_id" name="default_library_id">
<option value="">None</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => identity_provider_domain.default_library_id, unfiltered => 1, do_not_select_my_library => 1 ) %]
</select>
<div class="hint">Use this library for the patron on auto register</div>
</li>
<li>
<label for="default_category_id">Default category: </label>
[% SET categories = Categories.all() %]
<select name="default_category_id" id="default_category_id">
<option value="">None</option>
[% FOREACH category IN categories %]
[% IF category.categorycode == identity_provider_domain.default_category_id %]
<option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option>
[% ELSE %]
<option value="[% category.categorycode | html %]">[% category.description | html %]</option>
[% END %]
[% END %]
</select>
<div class="hint">Use this category for the patron on auto register</div>
</li>
<li>
<label for="allow_opac">Allow OPAC: </label>
<select name="allow_opac" id="allow_opac">
[% IF identity_provider_domain.allow_opac == "1" %]
<option value="1" selected="selected">Allow</option>
<option value="0">Don't allow</option>
[% ELSE %]
<option value="1">Allow</option>
<option value="0" selected="selected">Don't allow</option>
[% END %]
</select>
<span>OPAC users of this domain to login with this identity provider</span>
</li>
<li>
<label for="allow_staff">Allow staff: </label>
<select name="allow_staff" id="allow_staff">
[% IF identity_provider_domain.allow_staff == "1" %]
<option value="1" selected="selected">Allow</option>
<option value="0">Don't allow</option>
[% ELSE %]
<option value="1">Allow</option>
<option value="0" selected="selected">Don't allow</option>
[% END %]
</select>
<span>staff users of this domain to login with this identity provider</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="new_identity_provider_domain" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | html -%]&amp;op=add_form"><i class="fa fa-plus"></i> New identity provider domain</a>
</div>
<h1>[% tx("Identity provider domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</h1>
<div class="page-section">
<table id="identity_provider_domains">
<thead>
<tr>
<th>Domain</th>
<th>Update on login</th>
<th>Auto register</th>
<th>Default library</th>
<th>Default category</th>
<th>Allow OPAC</th>
<th>Allow staff</th>
<th data-class-name="actions noExport">Actions</th>
</tr>
</thead>
</table>
</div>
[% END %]
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="delete_confirm_modal_label">Confirm deletion of identity provider domain</h3>
</div>
<div class="modal-body">
<div id="delete_confirm_dialog"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- #delete_confirm_modal -->
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
var identity_provider_domains_url = '/api/v1/auth/identity_providers/[%- identity_provider_id | html -%]/domains';
[% SET categories = Categories.all() %]
var categories = {
[% FOREACH category IN categories %]
"[% category.categorycode | html %]": "[% category.description | html %]",
[% END %]
};
[% SET libraries = Branches.all() %]
var libraries = {
[% FOREACH library IN libraries %]
"[% library.branchcode | html %]": "[% library.branchname | html %]",
[% END %]
};
window.identity_provider_domains = $("#identity_provider_domains").kohaTable({
"ajax": {
"url": identity_provider_domains_url
},
'language': {
'emptyTable': '<div class="dialog message">'+_("There are no identity provider domains defined.")+'</div>'
},
"columnDefs": [ {
"targets": [1],
"render": function (data, type, row, meta) {
if ( type == 'display' ) {
if ( data != null ) {
return data.escapeHtml();
}
else {
return "";
}
}
return data;
}
} ],
"columns": [
{
"data": "domain",
"searchable": true,
"orderable": true,
"render": function(data, type, row, meta) {
if ( data != null ) {
return data.escapeHtml();
}
else {
return "*";
}
}
},
{
"data": function( row, type, val, meta ) {
if (row.update_on_auth) {
return _("Yes");
} else {
return _("No");
}
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
if (row.auto_register) {
return _("Yes");
} else {
return _("No");
}
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
return libraries[row.default_library_id] || "";
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
return categories[row.default_category_id] || "";
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
if (row.allow_opac) {
return _("Yes");
} else {
return _("No");
}
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
if (row.allow_staff) {
return _("Yes");
} else {
return _("No");
}
},
"searchable": true,
"orderable": true
},
{
"data": function( row, type, val, meta ) {
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&amp;identity_provider_id=[%- identity_provider_id | html -%]&amp;op=edit_form&amp;identity_provider_domain_id='+ encodeURIComponent(row.identity_provider_domain_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
result += '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-auth-provider-domain-id="'+ encodeURIComponent(row.identity_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
return result;
},
"searchable": false,
"orderable": false
}
],
createdRow: function (row, data, dataIndex) {
if ( data.debug ) {
$(row).addClass('debug');
}
},
});
$('#identity_provider_domains').on( "click", '.delete_identity_provider_domain', function () {
var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
var identity_provider_domain = decodeURIComponent($(this).data('auth-provider-domain'));
$("#delete_confirm_dialog").html(
_("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain)
);
$("#delete_confirm_modal_button").data('auth-provider-domain-id', identity_provider_domain_id);
$("#delete_confirm_modal_button").data('auth-provider-domain', identity_provider_domain);
});
$("#delete_confirm_modal_button").on( "click", function () {
var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
var identity_provider_domain = $(this).data('auth-provider-domain');
$.ajax({
method: "DELETE",
url: identity_provider_domains_url+"/"+identity_provider_domain_id
}).success(function() {
window.identity_provider_domains.api().ajax.reload(function (data) {
$("#smtp_action_result_dialog").hide();
$("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show();
});
}).fail(function () {
$("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show();
}).done(function () {
$("#delete_confirm_modal").modal('hide');
});
});
$('button.more').on('click', function(event) {
event.preventDefault();
var target = $(this).hide().data('target');
$('.more-'+target).show();
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]