Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update the permission restrictions so that disabled ones aren't chang…

…ed when switching a column.
  • Loading branch information...
commit 20b363f93bf8044addd79a4f9f7d2d199856cad0 1 parent 5a728f2
Matthew Buckett buckett authored
80 authz-tool/tool/src/webapp/js/authz.js
View
@@ -1,88 +1,48 @@
$(document).ready(function(){
+ // When the checkboxes change update the cell.
+ $('input:checkbox').change(function(){
+ $(this).parents('td').toggleClass('active', this.checked);
+ }).change();
$("table.checkGrid tr:even").addClass("evenrow");
- $(':checked').parents('td').addClass('active');
+ // Save the default selected
$(':checked').parents('td').addClass('defaultSelected');
- $('input:checkbox').click(function(){
- if (this.checked) {
- $(this).parents('td').addClass('active');
- }
- else {
- $(this).parents('td').removeClass('active');
- }
- });
- $('.permissionDescription').mouseenter(function(){
- $(this).parents('tr').children('td').addClass('rowHover');
- }).mouseleave(function(){
- $(this).parents('tr').children('td').removeClass('rowHover');
+ $('.permissionDescription').hover(function(e){
+ $(this).parents('tr').children('td').toggleClass('rowHover', e.type == "mouseenter");
});
- $('th').mouseenter(function(){
- var col = ($(this).prevAll().size());
- $(this).addClass('rowHover');
- $('.' + col).addClass('rowHover');
- }).mouseleave(function(){
- var col = ($(this).prevAll().size());
- $(this).removeClass('rowHover');
- $('.' + col).removeClass('rowHover');
+ $('th').hover(function(event){
+ var col = ($(this).prevAll().size());
+ $('.' + col).add(this).toggleClass('rowHover', event.type == "mouseenter");
});
- $('th#permission').mouseenter(function(){
- $('.checkGrid td.checkboxCell').addClass('rowHover');
- }).mouseleave(function(){
- $('.checkGrid td.checkboxCell').removeClass('rowHover');
+
+ $('th#permission').hover(function(event){
+ $('.checkGrid td.checkboxCell').toggleClass('rowHover', event.type == "mouseenter");
});
$('th#permission a').click(function(e){
- if ($('.checkGrid :checked').length > 0) {
- $('.checkGrid input').attr('checked', '');
- $('.checkGrid td.checkboxCell').removeClass('active');
- }
- else {
- $('.checkGrid input').attr('checked', 'checked');
- $('.checkGrid td.checkboxCell').addClass('active');
-
- }
+ $('.checkGrid input').attr('checked', ($('.checkGrid :checked').length > 0)?'':'checked').change();
e.preventDefault();
-
});
$('.permissionDescription a').click(function(e){
- if ($(this).parents('tr').children('td').children('label').children('input:checked').length > 0) {
- $(this).parents('tr').children('td').children('label').children('input').attr('checked', '');
- $(this).parents('tr').children('td').removeClass('active');
-
- }
- else {
- $(this).parents('tr').children('td').children('label').children('input').attr('checked', 'checked');
- $(this).parents('tr').children('td').addClass('active');
- $(this).removeClass('active');
- }
+ var anyChecked = $(this).parents('tr').find('input:checked').length > 0;
+ $(this).parents('tr').find('input:checkbox').not('[disabled]').attr('checked', anyChecked?"":"checked").change();
e.preventDefault();
-
});
$('th.role a').click(function(e){
var col = ($(this).parent('th').prevAll().size());
- if ($('.' + col + ' label input:checked').length > 0) {
- $('.' + col + ' label input').attr('checked', '');
- $('.' + col).removeClass('active');
- }
- else {
- $('.' + col + ' label input').attr('checked', 'checked');
- $('.' + col).addClass('active');
- }
+ var anyChecked = $('.' + col + ' input:checked').length > 0;
+ $('.' + col + ' input').not('[disabled]').attr('checked', anyChecked?"":"checked").change();
e.preventDefault();
-
});
$('#clearall').click(function(e){
- $("input").attr("checked", "");
- $('td').removeClass('active');
+ $("input").attr("checked", "").change();
e.preventDefault();
});
$('#restdef').click(function(e){
$("input").attr("checked", "");
- $('td').removeClass('active');
- $(".defaultSelected").addClass("active");
- $(".defaultSelected input ").attr("checked", "checked");
+ $(".defaultSelected input").attr("checked", "checked").change();
e.preventDefault();
});
2  authz-tool/tool/src/webapp/vm/helper/chef_permissions.vm
View
@@ -1,7 +1,7 @@
##<!-- $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/helper/chef_permissions.vm,v 1.4 2005/05/28 03:04:36 ggolden.umich.edu Exp $ -->
<div class="portletBody">
<link href="/sakai-authz-tool/css/authz.css" type="text/css" rel="stylesheet" media="all" />
-<script type="text/javascript" src="/library/js/jquery-ui-latest/js/jquery.min.js"></script>
+<script type="text/javascript" src="/library/js/jquery/1.4.2/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/sakai-authz-tool/js/authz.js"></script>
#if($menu)
Please sign in to comment.
Something went wrong with that request. Please try again.