From 1f3d8003f7ccb7793be6452942f62d10433e7f27 Mon Sep 17 00:00:00 2001 From: Petr Voborník Date: Thu, 19 Jan 2012 10:28:44 +0100 Subject: Modifying DNS UI to benefit from new DNS API DNS UI was modified to offer structured way of defining DNS records. https://fedorahosted.org/freeipa/ticket/2208 --- install/ui/widget.js | 59 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 11 deletions(-) (limited to 'install/ui/widget.js') diff --git a/install/ui/widget.js b/install/ui/widget.js index a7dd81e6..21259ff8 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -744,6 +744,7 @@ IPA.radio_widget = function(spec) { var that = IPA.input_widget(spec); + that.default_value = spec.default_value; that.options = spec.options; that.create = function(container) { @@ -802,6 +803,9 @@ IPA.radio_widget = function(spec) { var input = $(that.selector+'[value="'+value+'"]', that.container); if (input.length) { input.attr('checked', true); + } else if (that.default_value) { + input = $(that.selector+'[value="'+that.default_value+'"]', that.container); + input.attr('checked', true); } that.value_changed.notify([that.save()], that); @@ -809,6 +813,11 @@ IPA.radio_widget = function(spec) { that.clear = function() { $(that.selector, that.container).attr('checked', false); + + if (that.default_value) { + var input = $(that.selector+'[value="'+that.default_value+'"]', that.container); + input.attr('checked', true); + } }; // methods that should be invoked by subclasses @@ -1118,6 +1127,7 @@ IPA.table_widget = function (spec) { that.multivalued = spec.multivalued === undefined ? true : spec.multivalued; that.columns = $.ordered_map(); + that.value_attr_name = spec.value_attribute || that.name; that.get_columns = function() { return that.columns.values; @@ -1430,13 +1440,27 @@ IPA.table_widget = function (spec) { that.empty(); - that.values = result[that.name] || []; + that.values = result[that.value_attr_name] || []; for (var i=0; i