From 409b6efa5f0d4149fb26513dd25259b9d0026840 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 11 Jan 2011 09:51:09 +0700 Subject: 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(-) (limited to 'install') diff --git a/install/static/associate.js b/install/static/associate.js index 60e7c09ff..12b5fab04 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 c0fc863d6..b89344263 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 96b5ab338..baf2652a5 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