diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-01-11 09:51:09 +0700 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-01-11 21:33:35 -0500 |
commit | 409b6efa5f0d4149fb26513dd25259b9d0026840 (patch) | |
tree | 78eeb4cfc0c138ae4547656130554804e19511b8 /install/static/rule.js | |
parent | e79406a0f956dc827beb176d9a25d8b983f1fd23 (diff) | |
download | freeipa.git-409b6efa5f0d4149fb26513dd25259b9d0026840.tar.gz freeipa.git-409b6efa5f0d4149fb26513dd25259b9d0026840.tar.xz freeipa.git-409b6efa5f0d4149fb26513dd25259b9d0026840.zip |
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.
Diffstat (limited to 'install/static/rule.js')
-rwxr-xr-x | install/static/rule.js | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/install/static/rule.js b/install/static/rule.js index 96b5ab33..baf2652a 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<that.tables.length; i++) { + var table = that.tables[i]; + + var field = that.get_field(table.field_name); + field.set_enabled(enabled); + } + } + + var category = that.get_field(that.field_name); + category.reset = function() { + category.widget_reset(); + var values = category.save(); + if (values.length == 0) return; + var value = values[0]; + update_tables(value); + }; + + var inputs = $('input[name='+that.field_name+']', container); + inputs.change(function() { + var input = $(this); + var value = input.val(); + update_tables(value); + }); + }; + return that; } @@ -107,7 +140,7 @@ function ipa_rule_association_table_widget(spec) { var command; - if (that.category.save() != '') { + if (that.category) { command = ipa_command({ 'method': that.entity_name+'_mod', 'args': [pkey], @@ -115,7 +148,7 @@ function ipa_rule_association_table_widget(spec) { 'on_success': function() { var record = {}; record[that.category.name] = ['']; - that.category.load(['']); + that.category.load(record); } }); command.set_option(that.category.name, ''); |