From 885ffe5a3e2ef4d370c4fffa458ef44fd61c5250 Mon Sep 17 00:00:00 2001 From: Petr Voborník Date: Wed, 22 Feb 2012 09:21:56 +0100 Subject: Multiple fields for one attribute Current implementation has a limitation to have one field per one attribute. This is fine for most cases. For cases where an attribute can have two editor widgets which can be swapped a need for two different types of field may occur. This patch introduces 'param' option which supposes to contain attribute name. If 'param' is not specified it will contain field's name therefore backward compatibility is maintained. This extension allows to have two fields with different name and same param -> two fields get/supply value from/to the same attribute. Needed for: https://fedorahosted.org/freeipa/ticket/2372 --- install/ui/details.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'install/ui/details.js') diff --git a/install/ui/details.js b/install/ui/details.js index acd498aa0..d68ebd07c 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -493,7 +493,7 @@ IPA.details_facet = function(spec) { if (only_dirty && !field.is_dirty()) continue; - var values = record[field.name]; + var values = record[field.param]; if (require_value && !values) continue; update_info.append_field(field, values); @@ -838,23 +838,25 @@ IPA.command_builder = function() { that.add_field_option = function(command, field, values) { if (!field || !values) return; + var name = field.param; + if (field.metadata) { if (field.metadata.primary_key) return; if (values.length === 1) { - command.set_option(field.name, values[0]); + command.set_option(name, values[0]); } else if (field.join) { - command.set_option(field.name, values.join(',')); + command.set_option(name, values.join(',')); } else { - command.set_option(field.name, values); + command.set_option(name, values); } } else { if (values.length) { - command.add_option('setattr', field.name+'='+values[0]); + command.add_option('setattr', name+'='+values[0]); } else { - command.add_option('setattr', field.name+'='); + command.add_option('setattr', name+'='); } for (var k=1; k