3 [% PROCESS 'permissions.inc' %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Patrons › Set permissions for [% patron.surname %], [% patron.firstname %]</title>
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/treeview/jquery.treeview_[% KOHA_VERSION %].css"/>
7 [% INCLUDE 'doc-head-close.inc' %]
10 <body id="pat_member-flags" class="pat">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'patron-search.inc' %]
14 <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>
16 <div id="doc3" class="yui-t2">
21 [% INCLUDE 'members-toolbar.inc' %]
23 <form method="post" action="/cgi-bin/koha/members/member-flags.pl">
24 <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
25 <input type="hidden" name="member" id="borrowernumber" value="[% patron.borrowernumber %]" />
26 <input type="hidden" name="newflags" value="1" />
27 <h1>Set permissions for [% patron.surname %], [% patron.firstname %]</h1>
28 <!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
29 <ul id="permissionstree" class="treeview-grey">
30 <!-- <li class="folder-close">One level down<ul> -->
31 [% FOREACH loo IN loop %]
32 [% IF ( loo.expand ) %]
37 [% IF ( loo.checked ) %]
38 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
40 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
42 <label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
43 <span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
44 [% IF ( loo.sub_perm_loop ) %]
45 <ul id="flag-[% loo.bit %]-children">
46 [% FOREACH sub_perm_loo IN loo.sub_perm_loop %]
48 [% IF ( sub_perm_loo.checked ) %]
49 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" />
51 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" />
53 <label class="permissioncode" for="[% sub_perm_loo.id %]">[% sub_perm_loo.code %]</label>
54 <span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
64 <!-- </ul></li></ul> -->
67 <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></fieldset>
74 [% INCLUDE 'circ-menu.inc' %]
78 [% MACRO jsinclude BLOCK %]
79 <script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu_[% KOHA_VERSION %].js"></script>
80 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.treeview.pack_[% KOHA_VERSION %].js"></script>
82 <script type="text/javascript">
83 $(document).ready(function() {
84 $("#permissionstree").treeview({animated: "fast", collapsed: true});
86 // Enforce Superlibrarian Privilege Mutual Exclusivity
87 if($('input[id="flag-0"]:checked').length){
88 if ($('input[name="flag"]:checked').length > 1){
89 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."));
92 $('input[name="flag"]').each(function() {
93 if($(this).attr('id') != "flag-0"){
94 $(this).prop('disabled', true);
95 $(this).prop('checked', false);
100 $('input#flag-0').click(function() {
101 if($('input[id="flag-0"]:checked').length){
102 $('input[name="flag"]').each(function() {
103 if($(this).attr('id') != "flag-0"){
104 $(this).prop('disabled', true);
105 $(this).prop('checked', false);
110 $('input[name="flag"]').each(function() {
111 $(this).prop('disabled', false);
116 $(".flag").on("change",function(){
117 if( $(this).hasClass("parent") ){
118 toggleChildren(this);
126 // manage checking/unchecking parent permissions
127 var originalChildStates = {}; /* keep track of subpermission checkbox values
128 so that user can recover from accidentally
129 toggling a parent/module permission */
130 function selectChildren(parentInput) {
131 var childListId = parentInput.id + '-children';
132 var list = document.getElementById(childListId);
135 var inputs = list.getElementsByTagName('input');
136 for (var i = 0; i < inputs.length; i++) {
137 if (inputs[i].type == 'checkbox') {
138 children.push(inputs[i]);
145 function toggleChildren(parentInput) {
146 var children = selectChildren(parentInput);
147 if (children.length == 0) {
150 var checked = parentInput.checked;
151 if (checked && parentInput.parentNode.className == 'expandable') {
152 /* expand the tree */
153 $(".hitarea", parentInput.parentNode).click();
155 for (var i = 0; i < children.length; i++) {
157 originalChildStates[children[i].id] = children[i].checked;
158 children[i].checked = checked;
160 if (children[i].id in originalChildStates) {
161 children[i].checked = originalChildStates[children[i].id];
163 children[i].checked = checked;
169 function toggleParent(childInput) {
170 originalChildStates[childInput.id] = childInput.checked;
171 if (childInput.checked) {
174 var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
175 var parentInput = document.getElementById(parentId);
177 parentInput.checked = false;
184 [% INCLUDE 'intranet-bottom.inc' %]