2 [% PROCESS 'permissions.inc' %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Patrons › Set permissions for [% surname %], [% firstname %]</title>
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/treeview/jquery.treeview.css"/>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.treeview.pack.js"></script>
9 <script type="text/javascript">
10 $(document).ready(function() {
11 $("#permissionstree").treeview({animated: "fast", collapsed: true});
13 // Enforce Superlibrarian Privilege Mutual Exclusivity
14 if($('input[id="flag-0"]:checked').length){
15 if ($('input[name="flag"]:checked').length > 1){
16 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."));
19 $('input[name="flag"]').each(function() {
20 if($(this).attr('id') != "flag-0"){
21 $(this).prop('disabled', true);
22 $(this).prop('checked', false);
27 $('input#flag-0').click(function() {
28 if($('input[id="flag-0"]:checked').length){
29 $('input[name="flag"]').each(function() {
30 if($(this).attr('id') != "flag-0"){
31 $(this).prop('disabled', true);
32 $(this).prop('checked', false);
37 $('input[name="flag"]').each(function() {
38 $(this).prop('disabled', false);
43 $(".flag").on("change",function(){
44 if( $(this).hasClass("parent") ){
53 // manage checking/unchecking parent permissions
54 var originalChildStates = {}; /* keep track of subpermission checkbox values
55 so that user can recover from accidentally
56 toggling a parent/module permission */
57 function selectChildren(parentInput) {
58 var childListId = parentInput.id + '-children';
59 var list = document.getElementById(childListId);
62 var inputs = list.getElementsByTagName('input');
63 for (var i = 0; i < inputs.length; i++) {
64 if (inputs[i].type == 'checkbox') {
65 children.push(inputs[i]);
73 function toggleChildren(parentInput) {
74 var children = selectChildren(parentInput);
75 if (children.length == 0) {
78 var checked = parentInput.checked;
79 if (checked && parentInput.parentNode.className == 'expandable') {
81 $(".hitarea", parentInput.parentNode).click();
83 for (var i = 0; i < children.length; i++) {
85 originalChildStates[children[i].id] = children[i].checked;
86 children[i].checked = checked;
88 if (children[i].id in originalChildStates) {
89 children[i].checked = originalChildStates[children[i].id];
91 children[i].checked = checked;
97 function toggleParent(childInput) {
98 originalChildStates[childInput.id] = childInput.checked;
99 if (childInput.checked) {
102 var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
103 var parentInput = document.getElementById(parentId);
105 parentInput.checked = false;
111 <body id="pat_member-flags" class="pat">
112 [% INCLUDE 'header.inc' %]
113 [% INCLUDE 'patron-search.inc' %]
115 <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>
117 <div id="doc3" class="yui-t2">
122 [% INCLUDE 'members-toolbar.inc' %]
124 <form method="post" action="/cgi-bin/koha/members/member-flags.pl">
125 <input type="hidden" name="member" id="borrowernumber" value="[% borrowernumber %]" />
126 <input type="hidden" name="newflags" value="1" />
127 <h1>Set permissions for [% surname %], [% firstname %]</h1>
128 <!-- <ul id="permissionstree"><li class="root">All privileges<ul> -->
129 <ul id="permissionstree" class="treeview-grey">
130 <!-- <li class="folder-close">One level down<ul> -->
131 [% FOREACH loo IN loop %]
132 [% IF ( loo.expand ) %]
137 [% IF ( loo.checked ) %]
138 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
140 <input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
142 <label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
143 <span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
144 [% IF ( loo.sub_perm_loop ) %]
145 <ul id="flag-[% loo.bit %]-children">
146 [% FOREACH sub_perm_loo IN loo.sub_perm_loop %]
148 [% IF ( sub_perm_loo.checked ) %]
149 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" checked="checked" />
151 <input type="checkbox" class="flag child" id="[% sub_perm_loo.id %]" name="flag" value="[% sub_perm_loo.perm %]" />
153 <label class="permissioncode" for="[% sub_perm_loo.id %]">[% sub_perm_loo.code %]</label>
154 <span class="permissiondesc">[% PROCESS sub_permissions name=sub_perm_loo.code %]</span>
164 <!-- </ul></li></ul> -->
167 <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
174 [% INCLUDE 'circ-menu.inc' %]
177 [% INCLUDE 'intranet-bottom.inc' %]