From 8df520294048f8a286fc98205c7a672b08feb04c Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 29 Jan 2011 14:25:56 -0600 Subject: Fixed permission reset and is_dirty. The reset and is_dirty functionality for permission has been fixed. New widgets have been created for select and a collection of checkboxes. New test data files have been added for each target type. --- install/ui/details.js | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'install/ui/details.js') diff --git a/install/ui/details.js b/install/ui/details.js index 2fb3889b9..a5613b5ad 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -294,6 +294,11 @@ IPA.details_section = function (spec){ return field; }; + that.field = function(field) { + that.add_field(field); + return that; + }; + that.create_field = function(spec) { //TODO: replace IPA.details_field with class-specific implementation @@ -309,12 +314,24 @@ IPA.details_section = function (spec){ return field; }; + that.create_checkbox = function(spec) { + var field = IPA.checkbox_widget(spec); + that.add_field(field); + return field; + }; + that.create_radio = function(spec) { var field = IPA.radio_widget(spec); that.add_field(field); return field; }; + that.create_select = function(spec) { + var field = IPA.select_widget(spec); + that.add_field(field); + return field; + }; + that.create_textarea = function(spec) { var field = IPA.textarea_widget(spec); that.add_field(field); @@ -364,6 +381,8 @@ IPA.details_section = function (spec){ that.load = function(record) { + that.record = record; + var fields = that.fields; if (that.template) { @@ -412,6 +431,7 @@ IPA.details_section = function (spec){ that.section_create = that.create; that.section_setup = that.setup; that.section_load = that.load; + that.section_reset = that.reset; return that; }; @@ -759,22 +779,24 @@ IPA.details_refresh = function () { that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - function on_success(data, text_status, xhr) { + var command = IPA.command({ + 'method': that.entity_name+'_show', + 'args': [that.pkey], + 'options': { 'all': true, 'rights': true } + }); + + command.on_success = function(data, text_status, xhr) { that.load(data.result.result); - } + }; - function on_failure(xhr, text_status, error_thrown) { + command.on_error = function(xhr, text_status, error_thrown) { var details = $('.details', that.container).empty(); details.append('

Error: '+error_thrown.name+'

'); details.append('

'+error_thrown.title+'

'); details.append('

'+error_thrown.message+'

'); - } - - var params = []; - if (that.pkey) params.push(that.pkey); + }; - IPA.cmd( 'show', params, {all: true, rights: true}, on_success, on_failure, - that.entity_name ); + command.execute(); }; IPA.details_update = function (on_win, on_fail) -- cgit