Owen Leonard
0336f32b65
This patch removes the use of "onclick" attributes from some patron pages. To test, apply the patch and: - In Patrons, perform any search which will return multiple results. Confirm that the "select all" and "clear all" links work as expected. Font Awesome icons have been added to these links. In the left-hand sidebar, change any of the filters and click the "Clear" button. The form (and your search results) should reset. - Open the 'Set permissions' page for any patron. Checking any permission with sub-permissions should correctly expand the tree and select all sub-permissions. The reverse should also work. Also changed in this file: The "Inconsistency detected" alert has been reformatted to make it translatable. - View the detail page for a patron with one or more restrictions. Clicking the "View restrictions" link at the top of the page should jump you to and activate the restrictions tab. - View the 'Notices' tab for a patron who has been sent one or more notices. Click any notice title to expand the notice. Clicking the "resend" button should resend the notice. - Create a new patron with the same first and last name as an existing patron. This should trigger a duplicate warning message. Click the "View existing record" link to trigger a pop-up window with a patron detail brief view. In this window an "email" class has been added to the primary and secondary email lines so that long email addresses don't overlap the second column of data. Confirm that clicking the "close" button in this window closes the window. The changes to staff-global.css are included in this patch to prevent the close button from having an incorrect color change on hover. Signed-off-by: FILIPPOS KOLOVOS <f.kolovos@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
176 lines
6.9 KiB
Text
176 lines
6.9 KiB
Text
[% PROCESS 'permissions.inc' %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Patrons › Set permissions for [% surname %], [% firstname %]</title>
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/treeview/jquery.treeview.css"/>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.treeview.pack.js"></script>
|
|
<!-- set up tree -->
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$("#permissionstree").treeview({animated: "fast", collapsed: true});
|
|
|
|
// Enforce Superlibrarian Privilege Mutual Exclusivity
|
|
if($('input[id="flag-0"]:checked').length){
|
|
if ($('input[name="flag"]:checked').length > 1){
|
|
alert(_("Inconsistency detected! The superlibrarian privilege is mutually exclusive of other privileges, as it includes them all. This patron's privileges will now be reset to include only superlibrarian."));
|
|
}
|
|
|
|
$('input[name="flag"]').each(function() {
|
|
if($(this).attr('id') != "flag-0"){
|
|
$(this).prop('disabled', true);
|
|
$(this).prop('checked', false);
|
|
}
|
|
});
|
|
}
|
|
|
|
$('input#flag-0').click(function() {
|
|
if($('input[id="flag-0"]:checked').length){
|
|
$('input[name="flag"]').each(function() {
|
|
if($(this).attr('id') != "flag-0"){
|
|
$(this).prop('disabled', true);
|
|
$(this).prop('checked', false);
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
$('input[name="flag"]').each(function() {
|
|
$(this).prop('disabled', false);
|
|
});
|
|
}
|
|
});
|
|
|
|
$(".flag").on("change",function(){
|
|
if( $(this).hasClass("parent") ){
|
|
toggleChildren(this);
|
|
} else {
|
|
toggleParent(this);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
// manage checking/unchecking parent permissions
|
|
var originalChildStates = {}; /* keep track of subpermission checkbox values
|
|
so that user can recover from accidentally
|
|
toggling a parent/module permission */
|
|
function selectChildren(parentInput) {
|
|
var childListId = parentInput.id + '-children';
|
|
var list = document.getElementById(childListId);
|
|
var children = [];
|
|
if (list) {
|
|
var inputs = list.getElementsByTagName('input');
|
|
for (var i = 0; i < inputs.length; i++) {
|
|
if (inputs[i].type == 'checkbox') {
|
|
children.push(inputs[i]);
|
|
}
|
|
}
|
|
|
|
}
|
|
return children;
|
|
}
|
|
|
|
function toggleChildren(parentInput) {
|
|
var children = selectChildren(parentInput);
|
|
if (children.length == 0) {
|
|
return;
|
|
}
|
|
var checked = parentInput.checked;
|
|
if (checked && parentInput.parentNode.className == 'expandable') {
|
|
/* expand the tree */
|
|
$(".hitarea", parentInput.parentNode).click();
|
|
}
|
|
for (var i = 0; i < children.length; i++) {
|
|
if (checked) {
|
|
originalChildStates[children[i].id] = children[i].checked;
|
|
children[i].checked = checked;
|
|
} else {
|
|
if (children[i].id in originalChildStates) {
|
|
children[i].checked = originalChildStates[children[i].id];
|
|
} else {
|
|
children[i].checked = checked;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function toggleParent(childInput) {
|
|
originalChildStates[childInput.id] = childInput.checked;
|
|
if (childInput.checked) {
|
|
return;
|
|
}
|
|
var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
|
|
var parentInput = document.getElementById(parentId);
|
|
if (parentInput) {
|
|
parentInput.checked = false;
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body id="pat_member-flags" class="pat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Set permissions for [% surname %], [% firstname %]</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'members-toolbar.inc' %]
|
|
|
|
<form method="post" action="/cgi-bin/koha/members/member-flags.pl">
|
|
<input type="hidden" name="member" id="borrowernumber" value="[% borrowernumber %]" />
|
|
<input type="hidden" name="newflags" value="1" />
|
|
<h1>Set permissions for [% surname %], [% firstname %]</h1>
|
|
<!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
|
|
<ul id="permissionstree" class="treeview-grey">
|
|
<!-- <li class="folder-close">One level down<ul> -->
|
|
[% FOREACH loo IN loop %]
|
|
[% IF ( loo.expand ) %]
|
|
<li class="open">
|
|
[% ELSE %]
|
|
<li>
|
|
[% END %]
|
|
[% IF ( loo.checked ) %]
|
|
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
|
|
[% END %]
|
|
<label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
|
|
<span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
|
|
[% IF ( loo.sub_perm_loop ) %]
|
|
<ul id="flag-[% loo.bit %]-children">
|
|
[% FOREACH sub_perm_loo IN loo.sub_perm_loop %]
|
|
<li>
|
|
[% IF ( sub_perm_loo.checked ) %]
|
|
<input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" />
|
|
[% END %]
|
|
<label class="permissioncode" for="[% sub_perm_loo.id %]">[% sub_perm_loo.code %]</label>
|
|
<span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
</li>
|
|
[% ELSE %]
|
|
</li>
|
|
[% END %]
|
|
[% END %]
|
|
<!-- </ul></li> -->
|
|
<!-- </ul></li></ul> -->
|
|
</ul>
|
|
|
|
<fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-b">
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|