The permission target section has been modified to use widgets
to create the target selection and handle multiple fields.

Ticket #2098

--
Endi S. Dewata
From 13696b14ea5b9369d7ee7f8b13647f4d3bacef34 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Fri, 11 Nov 2011 22:33:05 -0600
Subject: [PATCH] Refactored permission target section.

The permission target section has been modified to use widgets
to create the target selection and handle multiple fields.

Ticket #2098
---
 install/ui/aci.js                                 |  547 ++++++++-------------
 install/ui/details.js                             |   35 ++-
 install/ui/test/aci_tests.js                      |    2 +-
 install/ui/test/data/ipa_init.json                |    6 +-
 install/ui/test/data/permission_show_filter.json  |    6 +-
 install/ui/test/data/permission_show_subtree.json |    6 +-
 install/ui/test/data/permission_show_type.json    |    6 +-
 install/ui/widget.js                              |    5 +-
 ipalib/plugins/internal.py                        |    4 -
 9 files changed, 258 insertions(+), 359 deletions(-)

diff --git a/install/ui/aci.js b/install/ui/aci.js
index 5d66bfb2bb2542dc57e2a2ac8fe0547948c57ed2..cae0670405d6553951b2d5e927ef3cbda7e876e0 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -33,31 +33,32 @@ IPA.aci.permission_entity = function(spec) {
 
         params.builder.facet_groups([ 'privilege' , 'settings' ]).
         search_facet({
-            columns:['cn']
+            columns: [ 'cn' ]
+        }).
+        details_facet({
+            sections: [
+                {
+                    name: 'identity',
+                    fields: [ 'cn' ]
+                },
+                {
+                    name: 'rights',
+                    label: IPA.messages.objects.permission.rights,
+                    fields: [
+                        {
+                            factory: IPA.rights_widget,
+                            name: 'permissions',
+                            join: true
+                        }
+                    ]
+                },
+                {
+                    factory: IPA.permission_target_section,
+                    name: 'target',
+                    label: IPA.messages.objects.permission.target
+                }
+            ]
         }).
-        details_facet({sections:[
-            {
-                name: 'identity',
-                fields: [
-                    'cn'
-                ]
-            },
-            {
-                name: 'rights',
-                label: IPA.messages.objects.permission.rights,
-                fields: [
-                    {
-                        factory: IPA.rights_widget,
-                        name: 'permissions',
-                        join: true
-                    }
-                ]
-            },
-            {
-                factory: IPA.target_section,
-                name: 'target',
-                label: IPA.messages.objects.permission.target
-            }]}).
         association_facet({
             name: 'member_privilege',
             facet_group: 'privilege'
@@ -77,9 +78,10 @@ IPA.aci.permission_entity = function(spec) {
                     ]
                 },
                 {
-                    factory: IPA.target_section,
+                    factory: IPA.permission_target_section,
                     name: 'target',
-                    label: IPA.messages.objects.permission.target
+                    label: IPA.messages.objects.permission.target,
+                    show_target: true
                 }
             ]
         });
@@ -124,10 +126,10 @@ IPA.aci.privilege_entity = function(spec) {
             associator: IPA.serial_associator
         }).
         association_facet({
-                name: 'memberof_permission',
-                facet_group: 'permission',
-                add_method: 'add_permission',
-                remove_method: 'remove_permission'
+            name: 'memberof_permission',
+            facet_group: 'permission',
+            add_method: 'add_permission',
+            remove_method: 'remove_permission'
         }).
         standard_association_facets().
         adder_dialog({
@@ -173,10 +175,10 @@ IPA.aci.role_entity = function(spec) {
             ]
         }).
         association_facet({
-                name: 'memberof_privilege',
-                facet_group: 'privilege',
-                add_method: 'add_privilege',
-                remove_method: 'remove_privilege'
+            name: 'memberof_privilege',
+            facet_group: 'privilege',
+            add_method: 'add_privilege',
+            remove_method: 'remove_privilege'
         }).
         standard_association_facets().
         adder_dialog({
@@ -201,25 +203,33 @@ IPA.aci.selfservice_entity = function(spec) {
 
         params.builder.search_facet({
             pagination: false,
-            columns:['aciname']}).
+            columns: [ 'aciname' ]
+        }).
         details_facet({
-            sections:[{
-                name:'general',
-                label: IPA.messages.details.general,
-                fields: [
-                    'aciname',
-                    {
-                        factory:IPA.attributes_widget,
-                        object_type:'user',
-                        name:'attrs'
-                    }]}]}).
+            sections: [
+                {
+                    name: 'general',
+                    label: IPA.messages.details.general,
+                    fields: [
+                        'aciname',
+                        {
+                            factory: IPA.attributes_widget,
+                            object_type: 'user',
+                            name: 'attrs'
+                        }
+                    ]
+                }
+            ]
+        }).
         adder_dialog({
-            fields:[
+            fields: [
                 'aciname',
-                {factory:IPA.attributes_widget,
-                 object_type:'user',
-                 name:'attrs'
-                }]
+                {
+                    factory: IPA.attributes_widget,
+                    object_type: 'user',
+                    name: 'attrs'
+                }
+            ]
         });
     };
 
@@ -234,34 +244,40 @@ IPA.aci.delegation_entity = function(spec) {
 
         params.builder.search_facet({
             pagination: false,
-            columns:['aciname']}).
-        details_facet({sections:[
-            {
-                name:'general',
-                label: IPA.messages.details.general,
-                fields:[
-                    'aciname',
-                    {
-                        factory: IPA.entity_select_widget,
-                        name: 'group',
-                        other_entity: 'group',
-                        other_field: 'cn'
-                    },
-                    {
-                        factory: IPA.entity_select_widget,
-                        name: 'memberof',
-                        other_entity: 'group',
-                        other_field: 'cn',
-                        join: true
-                    },
-                    {
-                        factory:IPA.attributes_widget,
-                        name: 'attrs', object_type: 'user',
-                        join: true
-                    }]}]}).
+            columns: [ 'aciname' ]
+        }).
+        details_facet({
+            sections: [
+                {
+                    name: 'general',
+                    label: IPA.messages.details.general,
+                    fields: [
+                        'aciname',
+                        {
+                            factory: IPA.entity_select_widget,
+                            name: 'group',
+                            other_entity: 'group',
+                            other_field: 'cn'
+                        },
+                        {
+                            factory: IPA.entity_select_widget,
+                            name: 'memberof',
+                            other_entity: 'group',
+                            other_field: 'cn',
+                            join: true
+                        },
+                        {
+                            factory: IPA.attributes_widget,
+                            name: 'attrs', object_type: 'user',
+                            join: true
+                        }
+                    ]
+                }
+            ]
+        }).
         standard_association_facets().
         adder_dialog({
-            fields:[
+            fields: [
                 'aciname',
                 {
                     factory: IPA.entity_select_widget,
@@ -281,7 +297,8 @@ IPA.aci.delegation_entity = function(spec) {
                     name: 'attrs',
                     object_type: 'user',
                     join: true
-                }]
+                }
+            ]
         });
     };
 
@@ -450,311 +467,161 @@ IPA.rights_widget = function(spec) {
     return that;
 };
 
-IPA.target_section = function(spec) {
+IPA.permission_target_section = function(spec) {
 
     spec = spec || {};
 
-    var that = IPA.details_section(spec);
+    var that = IPA.details_table_section(spec);
 
-    var target_types = [
-        {
-            name: 'filter',
-            label: IPA.messages.objects.permission.filter,
-            create: function(container) {
-                that.filter_text.create(container);
-            },
-            load: function(record) {
-                that.filter_text.load(record);
-            },
-            save: function(record) {
-                record.filter = that.filter_text.save();
-            }
-        },
-        {
-            name: 'subtree',
-            label: IPA.messages.objects.permission.subtree,
-            create: function(container) {
-                that.subtree_textarea.create(container);
-            },
-            load: function(record) {
-                that.subtree_textarea.load(record);
-            },
-            save: function(record) {
-                record.subtree = that.subtree_textarea.save();
-            }
-        },
-        {
-            name: 'targetgroup',
-            label: IPA.messages.objects.permission.targetgroup,
-            create: function(container) {
-                that.group_select.create(container);
-            },
-            load: function(record) {
-                that.group_select.list.val(record.targetgroup);
-            },
-            save: function(record) {
-                record.targetgroup = that.group_select.save();
-            }
-        },
-        {
-            name: 'type',
-            label: IPA.messages.objects.permission.type,
-            create: function(container) {
-
-                var span = $('<span/>', {
-                    name: 'type'
-                }).appendTo(container);
-
-                that.type_select.create(span);
-
-                span = $('<span/>', {
-                    name: 'attrs'
-                }).appendTo(container);
-
-                that.attribute_table.create(span);
-
-                var select = that.type_select.select;
-
-                select.change(function() {
-                    that.attribute_table.object_type =
-                        that.type_select.save()[0];
-                    that.attribute_table.reset();
-                });
-
-                select.append($('<option/>', {
-                    value: '',
-                    text: ''
-                }));
-
-                var type_params = IPA.get_entity_param('permission', 'type');
-
-                for (var i=0; i<type_params.values.length; i++) {
-                    select.append($('<option/>', {
-                        value: type_params.values[i],
-                        text: type_params.values[i]
-                    }));
-                }
-
-                that.type_select.update = function() {
-                    that.type_select.select_update();
-                    that.attribute_table.object_type =
-                        that.type_select.save()[0];
-                    that.attribute_table.reset();
-                };
-            },
-            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();
-                record.attrs = that.attribute_table.save();
-            }
-        }] ;
-
-    var target_type = target_types[0];
+    that.targets = [ 'filter', 'subtree', 'targetgroup', 'type' ];
+    that.target = that.targets[0];
+    that.show_target = spec.show_target;
 
     var init = function() {
+
+        that.target_select = IPA.select_widget({
+            entity: that.entity,
+            name: 'target',
+            label: IPA.messages.objects.permission.target,
+            hidden: !that.show_target
+        });
+
+        for (var i=0; i<that.targets.length; i++) {
+            var target = that.targets[i];
+            var target_param = IPA.get_entity_param('permission', target);
+
+            that.target_select.options.push({
+                label: target_param.label,
+                value: target
+            });
+        }
+
+        that.target_select.value_changed.attach(function(value) {
+            that.select_target(value);
+        });
+
+        that.add_field(that.target_select);
+
         that.filter_text = IPA.text_widget({
+            entity: that.entity,
             name: 'filter',
-            entity: spec.entity
+            hidden: true
         });
+
+        that.add_field(that.filter_text);
+
         that.subtree_textarea = IPA.textarea_widget({
-            entity: spec.entity,
+            entity: that.entity,
             name: 'subtree',
-            cols: 30, rows: 1
+            cols: 30,
+            rows: 1,
+            hidden: true
         });
+
+        that.add_field(that.subtree_textarea);
+
         that.group_select = IPA.entity_select_widget({
-            entity: spec.entity,
+            entity: that.entity,
             name: 'targetgroup',
             other_entity: 'group',
-            other_field: 'cn'
+            other_field: 'cn',
+            hidden: true
         });
+
+        that.add_field(that.group_select);
+
         that.type_select = IPA.select_widget({
-            entity: spec.entity,
-            name: 'type'
+            entity: that.entity,
+            name: 'type',
+            hidden: true
         });
-        that.attribute_table = IPA.attributes_widget({
-            entity: spec.entity,
-            name: 'attrs'
+
+        var type_param = IPA.get_entity_param('permission', 'type');
+
+        for (var j=0; j<type_param.values.length; j++) {
+            var type_name = type_param.values[j];
+            var type_label = IPA.metadata.objects[type_name].label_singular;
+
+            that.type_select.options.push({
+                label: type_label,
+                value: type_name
+            });
+        }
+
+        that.type_select.value_changed.attach(function(value) {
+            that.attribute_table.object_type = value;
+            that.attribute_table.reset();
         });
 
-        that.add_field(that.filter_text);
-        that.add_field(that.subtree_textarea);
-        that.add_field(that.group_select );
         that.add_field(that.type_select);
+
+        that.attribute_table = IPA.attributes_widget({
+            entity: that.entity,
+            name: 'attrs',
+            object_type: type_param.values[0],
+            hidden: true
+        });
+
         that.add_field(that.attribute_table);
+    };
+
+    that.select_target = function(target) {
+        that.set_target_visible(that.target, false);
+        that.target = target;
+        that.set_target_visible(that.target, true);
+    };
 
-        /*TODO these next two functions are work arounds for missing attribute
-          permissions for the filter text.  Remove them once that has been fixed */
-        that.filter_text.update = function() {
-            var value = that.filter_text.values && that.filter_text.values.length ?
-                that.filter_text.values[0] : '';
-            $('input[name="'+that.filter_text.name+'"]',
-              that.filter_text.container).val(value);
+    that.set_target_visible = function(target, visible) {
 
-            var label = $('label[name="'+that.filter_text.name+'"]',
-                          that.filter_text.container);
-            var input = $('input[name="'+that.filter_text.name+'"]',
-                          that.filter_text.container);
-            label.css('display', 'none');
-            input.css('display', 'inline');
-        };
+        var field = that.get_field(that.target);
+        field.hidden = !visible;
+        that.set_row_visible(that.target, visible);
 
-        that.filter_text.save = function(){
-            var input = $('input[name="'+that.filter_text.name+'"]',
-                          that.filter_text.container);
-            var value = input.val();
-            return value === '' ? [] : [value];
-        };
-    };
+        if (that.target == 'type') {
+            field = that.get_field('attrs');
+            field.hidden = !visible;
+            that.set_row_visible('attrs', visible);
 
-    function show_target_type(type_to_show) {
-        for (var i=0; i<target_types.length; i++) {
-            if (target_types[i].name === type_to_show) {
-                target_type = target_types[i];
-                target_type.container.css('display', '');
-            } else {
-                target_types[i].container.css('display', 'none');
-            }
+        } else {
+            field.set_required(visible);
         }
-    }
+    };
 
     that.create = function(container) {
-        that.container = container;
-
-        var table = $('<table/>', {
-            'class': 'section-table'
-        }).appendTo(that.container);
-
-        var tr = $('<tr/>').appendTo(table);
-
-        var td = $('<td/>', {
-            'class': 'section-cell-label'
-        }).appendTo(tr);
-
-        $('<label/>', {
-            name: 'target',
-            title: IPA.messages.objects.permission.target,
-            'class': 'field-label',
-            text: IPA.messages.objects.permission.target+':'
-        }).appendTo(td);
-
-        if (that.undo) {
-            tr.css('display', 'none');
-        }
-
-        td = $('<td/>', {
-            'class': 'section-cell-field'
-        }).appendTo(tr);
-
-        var field_container = $('<div/>', {
-            name: 'target',
-            'class': 'field'
-        }).appendTo(td);
-
-        that.target_type_select = $('<select/>', {
-            change: function() {
-                show_target_type(this.value);
-            }
-        }).appendTo(field_container);
-
-        for (var i=0 ; i<target_types.length; i++) {
-            target_type = target_types[i];
-
-            $('<option/>', {
-                text: target_type.name,
-                value : target_type.name
-            }).appendTo(that.target_type_select);
-
-            tr = $('<tr/>', {
-                style: 'display: none'
-            }).appendTo(table);
-
-            td = $('<td/>', {
-                'class': 'section-cell-label'
-            }).appendTo(tr);
-
-            $('<label/>', {
-                name: target_type.name,
-                title: target_type.label,
-                'class': 'field-label',
-                text: target_type.label+':'
-            }).appendTo(td);
-
-            td = $('<td/>', {
-                'class': 'section-cell-field'
-            }).appendTo(tr);
-
-            field_container = $('<div/>', {
-                name: target_type.name,
-                title: target_type.label,
-                'class': 'field'
-            }).appendTo(td);
-
-            target_type.create(field_container);
-            target_type.container = tr;
-        }
+        that.table_section_create(container);
+        that.select_target(that.targets[0]);
     };
 
-    function reset_target_widgets() {
-        that.filter_text.record = null;
-        that.subtree_textarea.record = null;
-        that.group_select.record = null;
-        that.type_select.record = null;
-        that.attribute_table.record = null;
-
-        that.filter_text.reset();
-        that.subtree_textarea.reset();
-        that.group_select.reset();
-        that.type_select.reset();
-        that.attribute_table.reset();
-    }
-
-    function set_target_type(record) {
-
-        reset_target_widgets();
-
-        var target_type_name ;
-        for (var i=0; i<target_types.length; i++) {
-            target_type = target_types[i];
-            if (record[target_type.name]) {
-                target_type_name = target_type.name;
+    that.load = function(record) {
+
+        var options = that.target_select.options;
+        for (var i=0; i<options.length; i++) {
+            var option = options[i];
+            var target = option.value;
+            if (record[target]) {
+                record.target = target;
                 break;
             }
         }
-        if (!target_type_name) {
+
+        if (!record.target) {
             alert(IPA.messages.objects.permission.invalid_target);
             return;
         }
 
-        that.target_type_select.val(target_type_name);
-        show_target_type(target_type_name);
-        target_type.load(record);
-    }
-
-    that.load = function(record){
+        that.select_target(record.target);
         that.section_load(record);
-        that.reset();
-    };
-
-    that.reset = function() {
-        that.section_reset();
-
-        if (that.record) {
-            set_target_type(that.record);
-            that.attribute_table.object_type = that.record.type;
-
-        } else {
-            reset_target_widgets();
-            that.target_type_select.val(target_types[0].name);
-            show_target_type(target_types[0].name);
-        }
     };
 
     that.save = function(record) {
-        target_type.save(record);
+
+        var field = that.get_field(that.target);
+        record[field.name] = field.save();
+
+        if (that.target == 'type') {
+            field = that.get_field('attrs');
+            record[field.name] = field.save();
+        }
     };
 
     init();
diff --git a/install/ui/details.js b/install/ui/details.js
index d17e06f4717c9414e535aed26801a793718a861f..fd3570e1c79911bd62cfe2eee52ec9b4f7c7a71c 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -118,13 +118,19 @@ IPA.details_section = function(spec) {
         var fields = that.fields.values;
         for (var i=0; i<fields.length; i++) {
             var field = fields[i];
-            if (field.hidden) continue;
 
             var field_container = $('<div/>', {
                 name: field.name,
                 title: field.label,
                 'class': 'field'
-            }).appendTo(container);
+            });
+
+            if (field.hidden) {
+                field_container.css('display', 'none');
+            }
+
+            field_container.appendTo(container);
+
             field.create(field_container);
         }
     };
@@ -237,6 +243,8 @@ IPA.details_table_section = function(spec) {
 
     var that = IPA.details_section(spec);
 
+    that.rows = $.ordered_map();
+
     that.create = function(container) {
         that.container = container;
 
@@ -249,9 +257,15 @@ IPA.details_table_section = function(spec) {
         var fields = that.fields.values;
         for (var i=0; i<fields.length; i++) {
             var field = fields[i];
-            if (field.hidden) continue;
 
-            var tr = $('<tr/>').appendTo(table);
+            var tr = $('<tr/>');
+            that.add_row(field.name, tr);
+
+            if (field.hidden) {
+                tr.css('display', 'none');
+            }
+
+            tr.appendTo(table);
 
             var td = $('<td/>', {
                 'class': 'section-cell-label',
@@ -280,6 +294,19 @@ IPA.details_table_section = function(spec) {
         }
     };
 
+    that.add_row = function(name, row) {
+        that.rows.put(name, row);
+    };
+
+    that.get_row = function(name) {
+        return that.rows.get(name);
+    };
+
+    that.set_row_visible = function(name, visible) {
+        var row = that.get_row(name);
+        row.css('display', visible ? '' : 'none');
+    };
+
     that.table_section_create = that.create;
 
     return that;
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index 10b76aefcecba6ebbfea855900bab36e3ddb10aa..2ff1acddd50706f69946a5e493735060879ec9e0 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -37,7 +37,7 @@ module('aci',{
            );
 
            target_container = $('<div id="target"/>').appendTo(document.body);
-           target_section = IPA.target_section({
+           target_section = IPA.permission_target_section({
                name: 'target',
                label: 'Target',
                entity:entity
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 830b2d6334b8032afe774455625d877f27531ad7..abaf4a78f7f89eebf42d858dfc3cbbb6d8995f3c 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -253,14 +253,10 @@
                             "identity": "Netgroup Settings"
                         },
                         "permission": {
-                            "filter": "Filter",
                             "identity": "Identity",
                             "invalid_target": "Permission with invalid target specification",
                             "rights": "Rights",
-                            "subtree": "By Subtree",
-                            "target": "Target",
-                            "targetgroup": "Target Group",
-                            "type": "Object By Type"
+                            "target": "Target"
                         },
                         "privilege": {
                             "identity": "Privilege Settings"
diff --git a/install/ui/test/data/permission_show_filter.json b/install/ui/test/data/permission_show_filter.json
index a7390b4dd7e208a77b8b7574e871cc38757f29cf..c32bfb7b8c2f89c5bf5a73bc31a205fdcf6ae49c 100644
--- a/install/ui/test/data/permission_show_filter.json
+++ b/install/ui/test/data/permission_show_filter.json
@@ -8,13 +8,17 @@
                 "businesscategory": "rscwo",
                 "cn": "rscwo",
                 "description": "rscwo",
+                "filter": "rscwo",
                 "member": "rscwo",
                 "nsaccountlock": "rscwo",
                 "o": "rscwo",
                 "objectclass": "rscwo",
                 "ou": "rscwo",
                 "owner": "rscwo",
-                "seealso": "rscwo"
+                "seealso": "rscwo",
+                "subtree": "rscwo",
+                "targetgroup": "rscwo",
+                "type": "rscwo"
             },
             "cn": [
                 "filter"
diff --git a/install/ui/test/data/permission_show_subtree.json b/install/ui/test/data/permission_show_subtree.json
index 24255d4e938fc03af0f3ab066cdc034de1b8d61e..af39e45b20080c2cfc2f9c45779a2db2ba9e05f2 100644
--- a/install/ui/test/data/permission_show_subtree.json
+++ b/install/ui/test/data/permission_show_subtree.json
@@ -8,13 +8,17 @@
                 "businesscategory": "rscwo",
                 "cn": "rscwo",
                 "description": "rscwo",
+                "filter": "rscwo",
                 "member": "rscwo",
                 "nsaccountlock": "rscwo",
                 "o": "rscwo",
                 "objectclass": "rscwo",
                 "ou": "rscwo",
                 "owner": "rscwo",
-                "seealso": "rscwo"
+                "seealso": "rscwo",
+                "subtree": "rscwo",
+                "targetgroup": "rscwo",
+                "type": "rscwo"
             },
             "cn": [
                 "subtree"
diff --git a/install/ui/test/data/permission_show_type.json b/install/ui/test/data/permission_show_type.json
index 5407ed29c4a647fceae3b418ef5174d00a3863bf..4ddbcfa686dd413a0b56247bf0856ec9ec3153a5 100644
--- a/install/ui/test/data/permission_show_type.json
+++ b/install/ui/test/data/permission_show_type.json
@@ -8,13 +8,17 @@
                 "businesscategory": "rscwo",
                 "cn": "rscwo",
                 "description": "rscwo",
+                "filter": "rscwo",
                 "member": "rscwo",
                 "nsaccountlock": "rscwo",
                 "o": "rscwo",
                 "objectclass": "rscwo",
                 "ou": "rscwo",
                 "owner": "rscwo",
-                "seealso": "rscwo"
+                "seealso": "rscwo",
+                "subtree": "rscwo",
+                "targetgroup": "rscwo",
+                "type": "rscwo"
             },
             "attrs": [
                 "unmatched",
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 2a3b952b05ad3e7ea33f3bc03db0f0f1876feb86..e9fffaf1981552740cea41841da6e29b29c6618b 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -66,6 +66,7 @@ IPA.widget = function(spec) {
     that.valid = true;
 
     that.dirty_changed = IPA.observer();
+    that.value_changed = IPA.observer();
 
     var init = function() {
         if (!that.metadata && that.entity) {
@@ -820,7 +821,6 @@ IPA.checkbox_widget = function (spec) {
 
     // default value
     that.checked = spec.checked || false;
-    that.value_changed = IPA.observer();
 
     that.create = function(container) {
 
@@ -1109,6 +1109,7 @@ IPA.select_widget = function(spec) {
         that.select = $('select[name="'+that.name+'"]', that.container);
         that.select.change(function() {
             that.set_dirty(that.test_dirty());
+            that.value_changed.notify(that.save(), that);
         });
 
         that.create_error_link(container);
@@ -1141,7 +1142,7 @@ IPA.select_widget = function(spec) {
     };
 
     that.clear = function() {
-        that.empty();
+        $('option', that.select).attr('selected', '');
     };
 
     // methods that should be invoked by subclasses
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index ec17d5a8b277767c19eba58408404db744a64fe6..4c64527e977be6ed5af54a07b926bef4e4efcf5e 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -346,14 +346,10 @@ class i18n_messages(Command):
                 "identity": _("Netgroup Settings"),
                 },
             "permission": {
-                "filter": _("Filter"),
                 "identity": _("Identity"),
                 "invalid_target": _("Permission with invalid target specification"),
                 "rights": _("Rights"),
-                "subtree": _("By Subtree"),
                 "target": _("Target"),
-                "targetgroup": _("Target Group"),
-                "type": _("Object By Type"),
             },
             "privilege": {
                 "identity": _("Privilege Settings"),
-- 
1.7.5.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to