4 [% PROCESS 'permissions.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Patrons › Set permissions for [% patron.surname %], [% patron.firstname %]</title>
7 [% Asset.css("css/treeview/jquery.treeview.css") %]
8 [% INCLUDE 'doc-head-close.inc' %]
11 <body id="pat_member-flags" class="pat">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'patron-search.inc' %]
15 <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 [% patron.surname %], [% patron.firstname %]</div>
17 <div id="doc3" class="yui-t2">
22 [% INCLUDE 'members-toolbar.inc' %]
24 <form method="post" action="/cgi-bin/koha/members/member-flags.pl">
25 <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
26 <input type="hidden" name="member" id="borrowernumber" value="[% patron.borrowernumber %]" />
27 <input type="hidden" name="newflags" value="1" />
28 <h1>Set permissions for [% patron.surname %], [% patron.firstname %]</h1>
29 <!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
30 <ul id="permissionstree" class="treeview-grey">
31 <!-- <li class="folder-close">One level down<ul> -->
32 [% FOREACH loo IN loop %]
33 [% IF ( loo.expand ) %]
38 [% IF ( loo.checked ) %]
39 [% IF disable_superlibrarian_privs && loo.bit == 0 %]
40 <input type="checkbox" disabled="disabled" class="flag parent superlib" id="flag-[% loo.bit %]_disabled" name="flag" value="[% loo.flag %]" checked="checked" title="The system preference ProtectSuperlibrarianPrivileges is enabled" />
41 <input type="hidden" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" >
43 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
46 [% IF disable_superlibrarian_privs && loo.bit == 0 %]
47 <input type="checkbox" disabled="disabled" class="flag parent" id="flag-[% loo.bit %]_disabled" name="flag" value="[% loo.flag %]" title="The system preference ProtectSuperlibrarianPrivileges is enabled" />
49 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
52 <label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
53 <span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
54 [% IF ( loo.sub_perm_loop ) %]
55 <ul id="flag-[% loo.bit %]-children">
56 [% FOREACH sub_perm_loo IN loo.sub_perm_loop %]
58 [% IF ( sub_perm_loo.checked ) %]
59 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" />
61 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" />
63 <label class="permissioncode" for="[% sub_perm_loo.id %]">[% sub_perm_loo.code %]</label>
64 <span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
74 <!-- </ul></li></ul> -->
77 <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
84 [% INCLUDE 'circ-menu.inc' %]
88 [% MACRO jsinclude BLOCK %]
89 [% Asset.js("js/members-menu.js") %]
90 [% Asset.js("lib/jquery/plugins/jquery.treeview.pack.js") %]
92 <script type="text/javascript">
93 $(document).ready(function() {
94 $("#permissionstree").treeview({animated: "fast", collapsed: true});
96 // Enforce Superlibrarian Privilege Mutual Exclusivity
97 if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){
98 if ($('input[name="flag"]:checked').length > 1){
99 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."));
102 $('input[name="flag"]').each(function() {
103 if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){
104 $(this).prop('disabled', true);
105 $(this).prop('checked', false);
110 $('input#flag-0').click(function() {
111 if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){
112 $('input[name="flag"]').each(function() {
113 if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){
114 $(this).prop('disabled', true);
115 $(this).prop('checked', false);
120 $('input[name="flag"]').each(function() {
121 $(this).prop('disabled', false);
126 $(".flag").on("change",function(){
127 if( $(this).hasClass("parent") ){
128 toggleChildren(this);
136 // manage checking/unchecking parent permissions
137 var originalChildStates = {}; /* keep track of subpermission checkbox values
138 so that user can recover from accidentally
139 toggling a parent/module permission */
140 function selectChildren(parentInput) {
141 var childListId = parentInput.id + '-children';
142 var list = document.getElementById(childListId);
145 var inputs = list.getElementsByTagName('input');
146 for (var i = 0; i < inputs.length; i++) {
147 if (inputs[i].type == 'checkbox') {
148 children.push(inputs[i]);
155 function toggleChildren(parentInput) {
156 var children = selectChildren(parentInput);
157 if (children.length == 0) {
160 var checked = parentInput.checked;
161 if (checked && parentInput.parentNode.className == 'expandable') {
162 /* expand the tree */
163 $(".hitarea", parentInput.parentNode).click();
165 for (var i = 0; i < children.length; i++) {
167 originalChildStates[children[i].id] = children[i].checked;
168 children[i].checked = checked;
170 if (children[i].id in originalChildStates) {
171 children[i].checked = originalChildStates[children[i].id];
173 children[i].checked = checked;
179 function toggleParent(childInput) {
180 originalChildStates[childInput.id] = childInput.checked;
181 if (childInput.checked) {
184 var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
185 var parentInput = document.getElementById(parentId);
187 parentInput.checked = false;
194 [% INCLUDE 'intranet-bottom.inc' %]