+[% PROCESS 'permissions.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Patrons › Set Privileges for [% surname %], [% firstname %]</title>
+<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' %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/treeview/jquery.treeview.css"/>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.treeview.pack.js"></script>
+<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);
+ }
+ });
+
});
-</script>
-<!-- manage checking/unchecking parent permissions -->
-<script type="text/javascript">
+
+ // 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 */
</script>
</head>
-<body>
+<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 Privileges for [% surname %], [% firstname %]</div>
+<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">
<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 Privileges for [% surname %], [% firstname %]</h1>
+ <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> -->
<li>
[% END %]
[% IF ( loo.checked ) %]
- <input type="checkbox" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" onclick="toggleChildren(this)" />
+ <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
[% ELSE %]
- <input type="checkbox" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" onclick="toggleChildren(this)" />
+ <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">[% loo.flagdesc %]</span>
+ <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" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" onclick="toggleParent(this)" />
+ <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" />
[% ELSE %]
- <input type="checkbox" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" onclick="toggleParent(this)" />
+ <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">[% sub_perm_loo.description %]</span>
+ <span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
</li>
[% END %]
</ul>
<!-- </ul></li></ul> -->
</ul>
-<fieldset class="action"><input type="submit" value="Set Flags" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
+<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>