1 [% PROCESS 'permissions.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Patrons › Set permissions for [% surname %], [% firstname %]</title>
4 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/treeview/jquery.treeview.css"/>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.treeview.pack.js"></script>
8 <script type="text/javascript">
9 $(document).ready(function() {
10 $("#permissionstree").treeview({animated: "fast", collapsed: true});
12 // Enforce Superlibrarian Privilege Mutual Exclusivity
13 if($('input[id="flag-0"]:checked').length){
14 if ($('input[name="flag"]:checked').length > 1){
15 alert('Inconsistency Detected!\n\nThe superlibrarian privilege is mutually exclusive of other privileges, as it includes them all.\n\nThis patron\'s privileges will now be reset to include only superlibrarian.');
18 $('input[name="flag"]').each(function() {
19 if($(this).attr('id') != "flag-0"){
20 $(this).attr('disabled', 'disabled');
21 $(this).prop('checked', false);
26 $('input#flag-0').click(function() {
27 if($('input[id="flag-0"]:checked').length){
28 $('input[name="flag"]').each(function() {
29 if($(this).attr('id') != "flag-0"){
30 $(this).attr('disabled', 'disabled');
31 $(this).prop('checked', false);
36 $('input[name="flag"]').each(function() {
37 $(this).removeAttr('disabled', 'disabled');
44 <!-- manage checking/unchecking parent permissions -->
45 <script type="text/javascript">
46 var originalChildStates = {}; /* keep track of subpermission checkbox values
47 so that user can recover from accidentally
48 toggling a parent/module permission */
49 function selectChildren(parentInput) {
50 var childListId = parentInput.id + '-children';
51 var list = document.getElementById(childListId);
54 var inputs = list.getElementsByTagName('input');
55 for (var i = 0; i < inputs.length; i++) {
56 if (inputs[i].type == 'checkbox') {
57 children.push(inputs[i]);
65 function toggleChildren(parentInput) {
66 var children = selectChildren(parentInput);
67 if (children.length == 0) {
70 var checked = parentInput.checked;
71 if (checked && parentInput.parentNode.className == 'expandable') {
73 $(".hitarea", parentInput.parentNode).click();
75 for (var i = 0; i < children.length; i++) {
77 originalChildStates[children[i].id] = children[i].checked;
78 children[i].checked = checked;
80 if (children[i].id in originalChildStates) {
81 children[i].checked = originalChildStates[children[i].id];
83 children[i].checked = checked;
89 function toggleParent(childInput) {
90 originalChildStates[childInput.id] = childInput.checked;
91 if (childInput.checked) {
94 var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
95 var parentInput = document.getElementById(parentId);
97 parentInput.checked = false;
103 <body id="pat_member-flags" class="pat">
104 [% INCLUDE 'header.inc' %]
105 [% INCLUDE 'patron-search.inc' %]
107 <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>
109 <div id="doc3" class="yui-t2">
114 [% INCLUDE 'members-toolbar.inc' %]
116 <form method="post" action="/cgi-bin/koha/members/member-flags.pl">
117 <input type="hidden" name="member" id="borrowernumber" value="[% borrowernumber %]" />
118 <input type="hidden" name="newflags" value="1" />
119 <h1>Set permissions for [% surname %], [% firstname %]</h1>
120 <!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
121 <ul id="permissionstree" class="treeview-grey">
122 <!-- <li class="folder-close">One level down<ul> -->
123 [% FOREACH loo IN loop %]
124 [% IF ( loo.expand ) %]
129 [% IF ( loo.checked ) %]
130 <input type="checkbox" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" onclick="toggleChildren(this)" />
132 <input type="checkbox" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" onclick="toggleChildren(this)" />
134 <label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
135 <span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
136 [% IF ( loo.sub_perm_loop ) %]
137 <ul id="flag-[% loo.bit %]-children">
138 [% FOREACH sub_perm_loo IN loo.sub_perm_loop %]
140 [% IF ( sub_perm_loo.checked ) %]
141 <input type="checkbox" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" onclick="toggleParent(this)" />
143 <input type="checkbox" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" onclick="toggleParent(this)" />
145 <label class="permissioncode" for="[% sub_perm_loo.id %]">[% sub_perm_loo.code %]</label>
146 <span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
156 <!-- </ul></li></ul> -->
159 <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
166 [% INCLUDE 'circ-menu.inc' %]
169 [% INCLUDE 'intranet-bottom.inc' %]