diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-10-04 18:38:08 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-10-06 13:15:01 +0200 |
commit | 6f38cc42e73704f15c110c8bfbdffba8ea6f455a (patch) | |
tree | da8cf6c36714cf99e46f58de78f9f899c4581237 /install | |
parent | 526a39903a9d9136b7a2cef25cde59074ba1f39c (diff) | |
download | freeipa-6f38cc42e73704f15c110c8bfbdffba8ea6f455a.tar.gz freeipa-6f38cc42e73704f15c110c8bfbdffba8ea6f455a.tar.xz freeipa-6f38cc42e73704f15c110c8bfbdffba8ea6f455a.zip |
Disables gid field if not posix group in group adder dialog
https://fedorahosted.org/freeipa/ticket/1922
gidNumber is not an allowed attribute for a non-posix group. When adding a non-posix group from the UI, unchecking the "Is this a POSIX group?:" box should disable the "GID:" field.
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/group.js | 29 | ||||
-rw-r--r-- | install/ui/widget.js | 11 |
2 files changed, 39 insertions, 1 deletions
diff --git a/install/ui/group.js b/install/ui/group.js index ad705eb21..b4753a7eb 100644 --- a/install/ui/group.js +++ b/install/ui/group.js @@ -88,6 +88,7 @@ IPA.entity_factories.group = function () { }). standard_association_facets(). adder_dialog({ + factory: IPA.group_adder_dialog, fields: [ 'cn', 'description', @@ -115,4 +116,30 @@ IPA.group_nonposix_checkbox_widget = function (spec) { }; return that; -};
\ No newline at end of file +}; + +IPA.group_adder_dialog = function (spec) { + + spec = spec || {}; + + var that = IPA.add_dialog(spec); + + var init = function() { + + var posix_field = that.get_field('nonposix'); + posix_field.value_changed.attach(that.on_posix_change); + }; + + that.on_posix_change = function (value) { + + var gid_field = that.get_field('gidnumber'); + if(value) { + gid_field.reset(); + } + gid_field.set_enabled(!value); + }; + + init(); + + return that; +}; diff --git a/install/ui/widget.js b/install/ui/widget.js index f46d79e72..b86f6e04c 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -468,6 +468,15 @@ IPA.text_widget = function(spec) { } }; + that.set_enabled = function(value) { + + if(value) { + that.input.removeAttr('disabled'); + } else { + that.input.attr('disabled', 'disabled'); + } + }; + // methods that should be invoked by subclasses that.text_load = that.load; @@ -771,6 +780,7 @@ IPA.checkbox_widget = function (spec) { // default value that.checked = spec.checked || false; + that.value_changed = IPA.observer(); that.create = function(container) { @@ -785,6 +795,7 @@ IPA.checkbox_widget = function (spec) { title: that.tooltip, change: function() { that.set_dirty(that.test_dirty()); + that.value_changed.notify(that.save(), that); } }).appendTo(container); |