From 390d017e321fd5ed56af094cf1f1c74f64e95735 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 10 Sep 2011 11:54:02 -0500 Subject: Modified dialog to use sections. The IPA.dialog has been modified to store sections instead of fields. If there is no sections specified, it will create a default section. The adder dialog for automount map has been modified such that the fields related to indirect map are stored in a section which will only be visible when the map type is set to indirect. The adder dialog for host has been modified such that it uses a custom section for hostname and DNS zone and standard section for the other fields. Ticket #1394 --- install/ui/aci.js | 41 +++++---- install/ui/add.js | 69 +++++--------- install/ui/association.js | 2 +- install/ui/automount.js | 106 +++++++++++++--------- install/ui/details.js | 90 +++++++++++++++--- install/ui/dialog.js | 211 +++++++++++++------------------------------ install/ui/dns.js | 3 +- install/ui/entitle.js | 8 +- install/ui/entity.js | 19 ---- install/ui/host.js | 158 +++++++++++++++----------------- install/ui/ipa.css | 14 ++- install/ui/ipa.js | 4 + install/ui/service.js | 22 ++--- install/ui/test/aci_tests.js | 4 +- install/ui/user.js | 4 +- install/ui/widget.js | 30 +++--- 16 files changed, 378 insertions(+), 407 deletions(-) (limited to 'install/ui') diff --git a/install/ui/aci.js b/install/ui/aci.js index 5dcd69d44..13fbc7d13 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -65,12 +65,20 @@ IPA.entity_factories.permission = function() { adder_dialog({ width: 500, height: 400, - fields: [ - 'cn', + sections: [ { - factory: IPA.rights_widget, - name: 'permissions', - join: true, undo: false + name: 'general', + fields: [ + { + name: 'cn', + undo: false + }, + { + factory: IPA.rights_widget, + name: 'permissions', + join: true, undo: false + } + ] }, { factory: IPA.target_section, @@ -274,7 +282,7 @@ IPA.attributes_widget = function(spec) { } if (that.object_type){ - that.populate (that.object_type); + that.populate(that.object_type); } }; @@ -392,7 +400,6 @@ IPA.target_section = function(spec) { spec = spec || {}; var that = IPA.details_section(spec); - that.section = true; that.undo = typeof spec.undo == 'undefined' ? true : spec.undo; var target_types = [ @@ -406,7 +413,7 @@ IPA.target_section = function(spec) { that.filter_text.load(record); }, save: function(record) { - record.filter = that.filter_text.save()[0]; + record.filter = that.filter_text.save(); } }, { @@ -419,7 +426,7 @@ IPA.target_section = function(spec) { that.subtree_textarea.load(record); }, save: function(record) { - record.subtree = that.subtree_textarea.save()[0]; + record.subtree = that.subtree_textarea.save(); } }, { @@ -432,7 +439,7 @@ IPA.target_section = function(spec) { that.group_select.list.val(record.targetgroup); }, save: function(record) { - record.targetgroup = that.group_select.save()[0]; + record.targetgroup = that.group_select.save(); } }, { @@ -478,17 +485,17 @@ IPA.target_section = function(spec) { that.type_select.select_update(); that.attribute_table.object_type = that.type_select.save()[0]; - that.attribute_table.reset(); - }; + that.attribute_table.reset(); + }; }, - load: function(record){ + load: function(record) { that.type_select.load(record); that.attribute_table.object_type = record.type; that.attribute_table.reset(); }, - save: function(record){ - record.type = that.type_select.save()[0]; - record.attrs = that.attribute_table.save().join(','); + save: function(record) { + record.type = that.type_select.save(); + record.attrs = that.attribute_table.save(); } }] ; @@ -507,12 +514,14 @@ IPA.target_section = function(spec) { undo: that.undo }); that.group_select = IPA.entity_select_widget({ + entity: spec.entity, name: 'targetgroup', other_entity: 'group', other_field: 'cn', undo: that.undo }); that.type_select = IPA.select_widget({ + entity: spec.entity, name: 'type', undo: that.undo }); diff --git a/install/ui/add.js b/install/ui/add.js index b4f1228f0..21707df13 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -46,9 +46,8 @@ IPA.add_dialog = function (spec) { that.show_edit_page = spec.show_edit_page || show_edit_page; - that.add = function(record, on_success, on_error) { + that.add = function(on_success, on_error) { - var field, value, pkey_prefix; var pkey_name = that.entity.metadata.primary_key; var command = IPA.command({ @@ -60,46 +59,36 @@ IPA.add_dialog = function (spec) { }); that.command = command; - pkey_prefix = that.entity.get_primary_key_prefix(); + command.add_args(that.entity.get_primary_key_prefix()); - for (var h=0; h', { name: field.name, title: field.label, @@ -102,7 +129,6 @@ IPA.details_section = function(spec) { } }; - that.load = function(record) { that.record = record; @@ -114,6 +140,14 @@ IPA.details_section = function(spec) { } }; + that.save = function(record) { + var fields = that.fields.values; + for (var i=0; i', { - 'class': 'section-table' - }).appendTo(that.container); + if (name) { + return that.sections.get(name); - var fields = that.fields.values; - for (var i=0; i').appendTo(table); - - var td = $('', { - 'class': 'section-cell-label' - }).appendTo(tr); - - $('