Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tmpl
Galen Charlton bb770a8d9d granular permissions - setting user permissions
Adjusted the user permissions editing page as follows:

* Replaced table with a list
* Implemented a tree control using the jQuery Treeview plugin
* When CheckSpecificUserPermissions is ON, if a module
  flag has specific (i.e., children) permissions, allow
  them to be edited - this is where the tree control
  comes in.
* Added some hooks and an initial stab at the CSS
  to style the permissions editor tree.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-10 15:53:22 -05:00

139 lines
6 KiB
Cheetah

<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Patrons &rsaquo; Set Privileges for <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<link rel="stylesheet" href="<!-- TMPL_VAR NAME="themelang" -->/css/treeview/jquery.treeview.css"/>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.treeview.pack.js"></script>
<!-- set up tree -->
<script type="text/javascript">
$(document).ready(function() {
$("#permissionstree").treeview({animated: "fast", collapsed: true});
});
</script>
<!-- manage checking/unchecking parent permissions -->
<script type="text/javascript">
var originalChildStates = {}; /* keep track of subpermission checkbox values
so that user can recover from accidentally
toggling a parent/module permission */
function selectChildren(parentInput) {
var childListId = parentInput.id + '-children';
var list = document.getElementById(childListId);
var children = [];
if (list) {
var inputs = list.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == 'checkbox') {
children.push(inputs[i]);
}
}
}
return children;
}
function toggleChildren(parentInput) {
var children = selectChildren(parentInput);
if (children.length == 0) {
return;
}
var checked = parentInput.checked;
if (checked && parentInput.parentNode.className == 'expandable') {
/* expand the tree */
$(".hitarea", parentInput.parentNode).click();
}
for (var i = 0; i < children.length; i++) {
if (checked) {
originalChildStates[children[i].id] = children[i].checked;
children[i].checked = checked;
} else {
if (children[i].id in originalChildStates) {
children[i].checked = originalChildStates[children[i].id];
} else {
children[i].checked = checked;
}
}
}
}
function toggleParent(childInput) {
originalChildStates[childInput.id] = childInput.checked;
if (childInput.checked) {
return;
}
var parentId = childInput.parentNode.parentNode.id.replace(/-children$/, '');;
var parentInput = document.getElementById(parentId);
if (parentInput) {
parentInput.checked = false;
}
}
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="patron-search.inc" -->
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Set Privileges for <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<!-- TMPL_INCLUDE NAME="members-toolbar.inc" -->
<form method="post" action="/cgi-bin/koha/members/member-flags.pl">
<input type="hidden" name="member" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
<input type="hidden" name="newflags" value="1" />
<h1>Set Privileges for <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="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> -->
<!-- TMPL_LOOP NAME="loop" -->
<!-- TMPL_IF NAME="expand" -->
<li class="open">
<!-- TMPL_ELSE -->
<li>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="checked" -->
<input type="checkbox" id="flag-<!-- TMPL_VAR NAME="bit" -->" name="flag" value="<!-- TMPL_VAR NAME="flag" -->" checked="checked" onchange="toggleChildren(this)" />
<!-- TMPL_ELSE -->
<input type="checkbox" id="flag-<!-- TMPL_VAR NAME="bit" -->" name="flag" value="<!-- TMPL_VAR NAME="flag" -->" onchange="toggleChildren(this)" />
<!-- /TMPL_IF -->
<label class="permissioncode" for="flag-<!-- TMPL_VAR NAME="bit" -->"><!-- TMPL_VAR NAME="flag" --></label>
<span class="permissiondesc"><!-- TMPL_VAR NAME="flagdesc" --></span>
<!-- TMPL_IF NAME="sub_perm_loop" -->
<ul id="flag-<!-- TMPL_VAR NAME="bit" -->-children">
<!-- TMPL_LOOP NAME="sub_perm_loop" -->
<li>
<!-- TMPL_IF NAME="checked" -->
<input type="checkbox" id="<!-- TMPL_VAR NAME="id" -->"
name="flag" value="<!-- TMPL_VAR NAME="perm" -->" checked="checked" onchange="toggleParent(this)" />
<!-- TMPL_ELSE -->
<input type="checkbox" id="<!-- TMPL_VAR NAME="id" -->"
name="flag" value="<!-- TMPL_VAR NAME="perm" -->" onchange="toggleParent(this)" />
<!-- /TMPL_IF -->
<label class="permissioncode" for="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="code" --></label>
<span class="permissiondesc"><!-- TMPL_VAR NAME="description" --></span>
</li>
<!-- /TMPL_LOOP -->
</ul>
</li>
<!-- TMPL_ELSE -->
</li>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- </ul></li> -->
<!-- </ul></li></ul> -->
</ul>
<fieldset class="action"><input type="submit" value="Set Flags" /> <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Cancel</a></fieldset>
</form>
</div>
</div>
<div class="yui-b">
<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
</div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->