From 1d39ebf3851f9241895949620c834f3750e7261d Mon Sep 17 00:00:00 2001 From: Endi S. Dewata Date: Tue, 11 Jan 2011 09:51:09 +0700 Subject: [PATCH] Support for enabling/disabling table widget. The table widget now can be enabled/disabled. When disabled, the checkboxes and links/buttons are grayed out and non functional. The radio buttons in HBAC and SUDO details page have been modified to enable/disable the corresponding tables. --- install/static/associate.js | 19 ++++++++- install/static/ipa.css | 5 ++ install/static/rule.js | 37 ++++++++++++++++- install/static/sudorule.js | 92 ++++++++++++++++++++++++++++++++++++++++++- install/static/widget.js | 13 ++++++- 5 files changed, 159 insertions(+), 7 deletions(-) diff --git a/install/static/associate.js b/install/static/associate.js index 60e7c09ffabad85d2baddc80268cb1a7f14bf98c..12b5fab0413eb28b453d7e1d2947844280768d85 100644 --- a/install/static/associate.js +++ b/install/static/associate.js @@ -352,17 +352,32 @@ function ipa_association_table_widget(spec) { button.replaceWith(IPA.action_button({ 'label': button.val(), 'icon': 'ui-icon-trash', - 'click': function() { that.show_remove_dialog(); } + 'click': function() { + if ($(this).hasClass('action-button-disabled')) return false; + that.show_remove_dialog(); + } })); button = $('input[name=add]', container); button.replaceWith(IPA.action_button({ 'label': button.val(), 'icon': 'ui-icon-plus', - 'click': function() { that.show_add_dialog() } + 'click': function() { + if ($(this).hasClass('action-button-disabled')) return false; + that.show_add_dialog(); + } })); }; + that.set_enabled = function(enabled) { + that.table_set_enabled(enabled); + if (enabled) { + $('.action-button', that.table).removeClass('action-button-disabled'); + } else { + $('.action-button', that.table).addClass('action-button-disabled'); + } + }; + that.get_records = function(on_success, on_error) { if (!that.values.length) return; diff --git a/install/static/ipa.css b/install/static/ipa.css index c0fc863d60c5288ce315d1b9e228e57a4b3976b5..b89344263e8cbe4bbf175bd82a67ebcc0bf7d375 100644 --- a/install/static/ipa.css +++ b/install/static/ipa.css @@ -511,6 +511,11 @@ span.main-separator{ font-size: 0.9em; } +a.action-button-disabled { + color: gray; + cursor: default; +} + .action-controls { position: relative; display:inline; diff --git a/install/static/rule.js b/install/static/rule.js index 96b5ab338645f316b5f8b945e3c71b808d444a69..baf2652a526b8636a53cec579fe01620724b1173 100755 --- a/install/static/rule.js +++ b/install/static/rule.js @@ -85,6 +85,39 @@ function ipa_rule_details_section(spec){ } }; + that.setup = function(container) { + + that.section_setup(container); + + function update_tables(value) { + + var enabled = '' == value; + + for (var i=0; i