Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt
Owen Leonard 0c5261f4f1
Bug 33111: Use template wrapper for breadcrumbs: Administration part 4
This patch updates several administration templates so that they
use the new WRAPPER for displaying breadcrumbs.

To test, apply the patch and test each page and its variations.
Breadcrumbs should look correct, and each link should be correct.

Administration ->
  - Library EANs (list, new, edit, confirm delete)
  - Identity providers (list, new, edit)
    - Manage domains (list, new, edit)
  - Item circulation alerts
  - Item search fields (list, new, edit)
  - Item types (list, new, edit, delete confirm)
  - Koha to MARC mapping
  - Library groups
  - MARC frameworks ->
    -> Actions -> MARC structure (list, new, edit, delete confirm)
       -> View, edit, and delete confirm
  - Record matching rules (list, new, edit, delete confirm)

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-04-12 11:43:22 -03:00

500 lines
25 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 %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
[% IF op == 'add_form' %]
New identity provider domain &rsaquo; [% ELSIF op == 'edit_form' %]
Edit identity provider domain &rsaquo; [% END %]
Identity providers &rsaquo; Administration &rsaquo; Koha
</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 -%]">Domains for [%- identity_provider_code | html -%]</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>New 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 -%]">Domains for [%- identity_provider_code | html -%]</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Edit domain</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Domains for [%- 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>
[% 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.</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>New email domain</h1>
<div class="page-section">
<form action="/cgi-bin/koha/admin/identity_providers.pl" id="add" name="add" class="validated" method="post">
<input type="hidden" name="op" value="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">
<div>If this field is empty, or '*' any email domain will match this rule.</div>
<div>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'</div>
<div>Exact matches have presedence over wildcard ones, so 'library.com' domain will take presedence over '*library.com' when the email is 'somebody@library.com'</div>
<div>The same way, the longest match will take presedence over the shorter one, so '*teacher.university.com' will take presedence over '*.university.com' if the email is 'user@math.teacher.university.com'</div>
</div>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<ol>
<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>
</div>
[% END %]
[% IF op == 'edit_form' %]
<h1>Edit identity provider domain</h1>
<div class="page-section">
<form action="/cgi-bin/koha/admin/identity_providers.pl" id="edit_save" name="edit_save" class="validated" method="post">
<input type="hidden" name="op" value="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">
<div>If this field is empty, or '*' any email domain will match this rule.</div>
<div>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'</div>
<div>Exact matches have presedence over asterix ones, so if the 'library.com' domain will take presedence over '*library.com' when the email is 'somebody@library.com'</div>
<div>The same way, the longest match will take presedence over the shorter one, so '*teacher.university.com' will take presedence over '*.university.com' if the email is 'user@math.teacher.university.com'</div>
</div>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<ol>
<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>
</div>
[% 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 email domain</a>
</div>
<h1>Identity provider email domains</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">Delete 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 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" 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.").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' %]