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>
This commit is contained in:
parent
a7e852794c
commit
bb770a8d9d
|
|
@ -1549,4 +1549,19 @@ tr.transfered td {
|
|||
}
|
||||
.waitinghere {
|
||||
color : #669900;
|
||||
}
|
||||
}
|
||||
|
||||
/* Permissions Labels */
|
||||
label.permissioncode:before {
|
||||
content: "(";
|
||||
}
|
||||
label.permissioncode:after {
|
||||
content: ")";
|
||||
}
|
||||
label.permissioncode {
|
||||
font-style : italic;
|
||||
}
|
||||
span.permissiondesc {
|
||||
font-weight : normal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,72 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
<title>Koha › Patrons › 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" -->
|
||||
|
|
@ -19,26 +85,46 @@
|
|||
<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>
|
||||
<table>
|
||||
<tr><th scope="col">Flag</th><th scope="col">Name</th><th scope="col">Description</th></tr>
|
||||
<!-- <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" -->
|
||||
<tr>
|
||||
<td>
|
||||
<!-- 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-<!-- TMPL_VAR NAME="bit" -->" checked="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-<!-- TMPL_VAR NAME="bit" -->" />
|
||||
<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 -->
|
||||
</td>
|
||||
<td>
|
||||
<label for="flag-<!-- TMPL_VAR NAME="bit" -->"><!-- TMPL_VAR NAME="flag" --></label>
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_VAR NAME="flagdesc" -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
<!-- </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>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,57 +14,87 @@
|
|||
|
||||
<div class="yui-u first">
|
||||
<dl>
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_news" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></dt>
|
||||
<dd>Write news for the OPAC and staff interfaces</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_label_creator" -->
|
||||
<dt><a href="/cgi-bin/koha/labels/label-home.pl">Label and Patron Card Creator</a></dt>
|
||||
<dd>Create printable labels and barcodes from catalog data and patron cards from patron data</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_calendar" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></dt>
|
||||
<dd>Define days when the library is closed</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_moderate_comments" -->
|
||||
<dt><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments</a></dt>
|
||||
<dd>Moderate patron comments</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
</dl>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<dl>
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_notices" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/letter.pl">Notices</a></dt>
|
||||
<dd>Define notices (print and email notification messages for overdues, etc.)</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_notice_status_triggers" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></dt>
|
||||
<dd>Set notice/status triggers for overdue items</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_view_system_logs" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></dt>
|
||||
<dd>Browse the system logs</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_inventory" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/inventory.pl">Inventory/stocktaking</a></dt>
|
||||
<dd>Perform inventory (stocktaking) of your catalogue</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<dl>
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_stage_marc_import" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC Records For Import</a></dt>
|
||||
<dd>Stage MARC records into the reservoir.</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_manage_staged_marc" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/manage-marc-import.pl">Manage Staged MARC Records</a></dt>
|
||||
<dd>Managed staged MARC records, including completing and reversing imports</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_export_catalog" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/export.pl">Export bibliographic and holdings</a></dt>
|
||||
<dd>Export bibliographic and holdings data</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_import_patrons" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></dt>
|
||||
<dd>Import patron data</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_delete_anonymize_patrons" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Patrons (anonomize, bulk-delete)</a></dt>
|
||||
<dd>Delete old borrowers and anonymize circulation history (deletes borrower reading history)</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_batch_upload_patron_images" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a></dt>
|
||||
<dd>Upload patron images in batch or one at a time</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_schedule_tasks" -->
|
||||
<dt><a href="/cgi-bin/koha/tools/scheduler.pl">Task Scheduler</a></dt>
|
||||
<dd>Schedule tasks to run</dd>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue