diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-05-16 14:40:09 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-05-16 21:05:49 -0400 |
commit | a7f9814ab702cfa42988e47e80f44b57a195ad1e (patch) | |
tree | 6ea1bb746d3a28cb39906f11b744cc26293a2363 /install/ui/associate.js | |
parent | f9a8d772e35982bed1c39b286b3120b9b5f64c0c (diff) | |
download | freeipa.git-a7f9814ab702cfa42988e47e80f44b57a195ad1e.tar.gz freeipa.git-a7f9814ab702cfa42988e47e80f44b57a195ad1e.tar.xz freeipa.git-a7f9814ab702cfa42988e47e80f44b57a195ad1e.zip |
Read-only association facet.
The IPA.association_facet has been modified to take a read_only parameters.
If the parameter is set to true, the Enroll and Delete buttons will not be
shown. All facets under the memberindirect and memberofindirect facet groups
are marked as read-only.
Ticket #1030
Diffstat (limited to 'install/ui/associate.js')
-rw-r--r-- | install/ui/associate.js | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/install/ui/associate.js b/install/ui/associate.js index 679e0070..9d04b0c8 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -668,7 +668,6 @@ IPA.association_facet = function (spec) { that.other_entity = spec.other_entity; that.facet_group = spec.facet_group; - that.label = that.label ? that.label : (IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity); that.read_only = spec.read_only; that.associator = spec.associator || IPA.bulk_associator; @@ -734,18 +733,15 @@ IPA.association_facet = function (spec) { var column; var i; - - - var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; var pkey_name = IPA.metadata.objects[that.other_entity].primary_key; that.table = IPA.table_widget({ - 'id': that.entity_name+'-'+that.other_entity, - 'name': pkey_name, - 'label': label, - 'entity_name': that.entity_name, - 'other_entity': that.other_entity + id: that.entity_name+'-'+that.other_entity, + name: pkey_name, + label: label, + entity_name: that.entity_name, + other_entity: that.other_entity }); if (that.columns.length) { @@ -801,47 +797,34 @@ IPA.association_facet = function (spec) { that.facet_create_header(container); that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - - var relationships = IPA.metadata.objects[that.entity_name].relationships; - var relationship = relationships[that.attribute_member]; - if (!relationship) { - relationship = ['', '', '']; - } - var other_label = IPA.metadata.objects[that.other_entity].label; - /* TODO: generic handling of different relationships */ - var title = ''; - if (relationship[0] == 'Member') { - title = IPA.messages.association.member; - - } else if (relationship[0] == 'Member Of') { - title = IPA.messages.association.parent; - } - + var title = that.title; title = title.replace('${entity}', that.entity_name); title = title.replace('${primary_key}', that.pkey); title = title.replace('${other_entity}', other_label); that.set_title(container, title); - that.remove_button = IPA.action_button({ - label: IPA.messages.buttons.remove, - icon: 'ui-icon-trash', - click: function() { - that.show_remove_dialog(); - return false; - } - }).appendTo(that.controls); + if (!that.read_only) { + that.remove_button = IPA.action_button({ + label: IPA.messages.buttons.remove, + icon: 'ui-icon-trash', + click: function() { + that.show_remove_dialog(); + return false; + } + }).appendTo(that.controls); - that.add_button = IPA.action_button({ - label: IPA.messages.buttons.enroll, - icon: 'ui-icon-plus', - click: function() { - that.show_add_dialog(); - return false; - } - }).appendTo(that.controls); + that.add_button = IPA.action_button({ + label: IPA.messages.buttons.enroll, + icon: 'ui-icon-plus', + click: function() { + that.show_add_dialog(); + return false; + } + }).appendTo(that.controls); + } }; that.create_content = function(container) { |