On Wed, 2011-02-16 at 10:46 -0500, Adam Young wrote:
> 
> Almost there.
> 
> I'd like to pull the sudo namespace out of ipa.js and put it into
> sudorule.js, then indicate  that the other sudo files depend on sudo
> rule.
> 
> 
> I guess I should have been clearer:  stuff like facets and widgets
> don't need to go into a sub, namespace, just custom code called by
> them.  I'm thinking that widgets and facets in the long term should
> become a sub-namespace of IPA themselseves:  so IPA.widget.text,
> IPA.facet.details, and then the more specific ones.  While I don't
> want to do that in this patch, keep that in mind when deciding which
> namespace to put something into.  A good rul of thumb is that an
> entity name should not be repeated in a function name, so something
> like IPA.sudo.sudorule_details_facet should be
> IPA.sudorule_details_facet  but any custom functions it calls should
> be in IPA.sudo.

I have prepared a next version of patch with the above comments applied.
Facets and widgets are in IPA namespace now. Still, I cannot do much of
a renaming with sub-namespace custom methods that are called by *_widget
or *_facet functions - they would collide. E.g.
IPA.sudo.sudorule_add_dialog cannot be renamed to IPA.sudo.add_dialog
because it would collide with renamed IPA.sudo.sudocmd_add_dialog.

> 
> I'm being a bit picky here as this is probably the last major cleanup
> we'll get to do before GA, and this is the code that people will look
> at.  I want it to be as understandable as possible.
> 

I know that since you have worked on WebUI for a long time, you have a
pretty clear picture what it should look like. I hope this patch version
is consistent with the plan.

Martin
>From 90fbbcbf5d5eeaad317666f2c347b90c21786b54 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Wed, 16 Feb 2011 14:26:35 +0100
Subject: [PATCH] Remove WebUI identifiers from global namespace

Many WebUI identifiers were defined in a global namespace. This is
not a good programming practice and may result in name clashes,
for example with other libraries.

This patch moves these variables to IPA namespace or its
sub-namespaces, when meaningful.

https://fedorahosted.org/freeipa/ticket/212
---
 install/ui/certificate.js            |  726 +++++++++++++++++-----------------
 install/ui/entity.js                 |    5 +-
 install/ui/host.js                   |   14 +-
 install/ui/ipa.js                    |    1 -
 install/ui/navigation.js             |  259 ++++++------
 install/ui/policy.js                 |   16 +-
 install/ui/search.js                 |   71 ----
 install/ui/service.js                |   14 +-
 install/ui/sudocmd.js                |    6 +-
 install/ui/sudocmdgroup.js           |    6 +-
 install/ui/sudorule.js               |   22 +-
 install/ui/test/certificate_tests.js |   36 +-
 install/ui/test/navigation_tests.js  |   60 ++--
 install/ui/webui.js                  |    6 +-
 14 files changed, 592 insertions(+), 650 deletions(-)

diff --git a/install/ui/certificate.js b/install/ui/certificate.js
index 3158d04883af8cb7eb1f9a0f02e936801f0ea358..56995282f29e36c3999535b811abed37225f589f 100755
--- a/install/ui/certificate.js
+++ b/install/ui/certificate.js
@@ -20,377 +20,379 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-var BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----';
-var END_CERTIFICATE   = '-----END CERTIFICATE-----';
-
-var BEGIN_CERTIFICATE_REQUEST = '-----BEGIN CERTIFICATE REQUEST-----';
-var END_CERTIFICATE_REQUEST   = '-----END CERTIFICATE REQUEST-----';
-
-var CRL_REASON = [
-    'Unspecified',
-    'Key Compromise',
-    'CA Compromise',
-    'Affiliation Changed',
-    'Superseded',
-    'Cessation of Operation',
-    'Certificate Hold',
-    null,
-    'Remove from CRL',
-    'Privilege Withdrawn',
-    'AA Compromise'
-];
-
-var CERTIFICATE_STATUS_MISSING = 0;
-var CERTIFICATE_STATUS_VALID   = 1;
-var CERTIFICATE_STATUS_REVOKED = 2;
-
-function certificate_parse_dn(dn) {
-
-    var result = {};
-    if (!dn) return result;
-
-    // TODO: Use proper LDAP DN parser
-    var rdns = dn.split(',');
-    for (var i=0; i<rdns.length; i++) {
-        var rdn = rdns[i];
-        if (!rdn) continue;
-
-        var parts = rdn.split('=');
-        var name = $.trim(parts[0].toLowerCase());
-        var value = $.trim(parts[1]);
-
-        var old_value = result[name];
-        if (!old_value) {
-            result[name] = value;
-        } else if (typeof old_value == "string") {
-            result[name] = [old_value, value];
-        } else {
-            result[name].push(value);
-        }
-    }
 
-    return result;
-}
-
-function certificate_get_dialog(spec) {
-    var that = {};
-    spec = spec || {};
-
-    that.title = spec.title || '';
-    that.usercertificate = spec.usercertificate || '';
-
-    var dialog = $('<div/>', {
-        'title': that.title
-    });
-
-    var textarea = $('<textarea/>', {
-        readonly: 'yes',
-        style: 'width: 100%; height: 275px;'
-    }).appendTo(dialog);
-
-    textarea.val(
-        BEGIN_CERTIFICATE+'\n'+
-        that.usercertificate+'\n'+
-        END_CERTIFICATE  );
-
-    that.open = function() {
-        dialog.dialog({
-            modal: true,
-            width: 500,
-            height: 400,
-            buttons: {
-                'Close': function() {
-                    dialog.dialog('destroy');
-                }
+IPA.cert = {
+    BEGIN_CERTIFICATE : '-----BEGIN CERTIFICATE-----',
+    END_CERTIFICATE   : '-----END CERTIFICATE-----',
+    BEGIN_CERTIFICATE_REQUEST : '-----BEGIN CERTIFICATE REQUEST-----',
+    END_CERTIFICATE_REQUEST   : '-----END CERTIFICATE REQUEST-----',
+    CRL_REASON : [
+        'Unspecified',
+        'Key Compromise',
+        'CA Compromise',
+        'Affiliation Changed',
+        'Superseded',
+        'Cessation of Operation',
+        'Certificate Hold',
+        null,
+        'Remove from CRL',
+        'Privilege Withdrawn',
+        'AA Compromise'
+    ],
+    CERTIFICATE_STATUS_MISSING : 0,
+    CERTIFICATE_STATUS_VALID   : 1,
+    CERTIFICATE_STATUS_REVOKED : 2,
+
+    parse_dn : function (dn) {
+
+        var result = {};
+        if (!dn) return result;
+
+        // TODO: Use proper LDAP DN parser
+        var rdns = dn.split(',');
+        for (var i=0; i<rdns.length; i++) {
+            var rdn = rdns[i];
+            if (!rdn) continue;
+
+            var parts = rdn.split('=');
+            var name = $.trim(parts[0].toLowerCase());
+            var value = $.trim(parts[1]);
+
+            var old_value = result[name];
+            if (!old_value) {
+                result[name] = value;
+            } else if (typeof old_value == "string") {
+                result[name] = [old_value, value];
+            } else {
+                result[name].push(value);
             }
+        }
+
+        return result;
+    },
+
+
+    get_dialog:    function (spec) {
+        var that = {};
+        spec = spec || {};
+
+        that.title = spec.title || '';
+        that.usercertificate = spec.usercertificate || '';
+
+        var dialog = $('<div/>', {
+            'title': that.title
         });
-    };
 
-    return that;
-}
+        var textarea = $('<textarea/>', {
+            readonly: 'yes',
+            style: 'width: 100%; height: 275px;'
+        }).appendTo(dialog);
+
+        textarea.val(
+            IPA.cert.BEGIN_CERTIFICATE+'\n'+
+                that.usercertificate+'\n'+
+                IPA.cert.END_CERTIFICATE  );
+
+        that.open = function() {
+            dialog.dialog({
+                modal: true,
+                width: 500,
+                height: 400,
+                buttons: {
+                    'Close': function() {
+                        dialog.dialog('destroy');
+                    }
+                }
+            });
+        };
 
-function certificate_revoke_dialog(spec) {
-    var that = {};
-    spec = spec || {};
+        return that;
+    },
 
-    that.title = spec.title || '';
-    that.revoke = spec.revoke;
 
-    var dialog = $('<div/>', {
-        'title': that.title
-    });
+    revoke_dialog: function (spec) {
+        var that = {};
+        spec = spec || {};
 
-    var table = $('<table/>').appendTo(dialog);
+        that.title = spec.title || '';
+        that.revoke = spec.revoke;
 
-    var tr = $('<tr/>').appendTo(table);
+        var dialog = $('<div/>', {
+            'title': that.title
+        });
 
-    var td = $('<td/>').appendTo(tr);
-    td.append('Note:');
+        var table = $('<table/>').appendTo(dialog);
 
-    td = $('<td/>').appendTo(tr);
-    td.append(
-        'To confirm your intention to revoke this certificate, '+
-        'select a reason from the pull-down list, and click '+
-        'the "Revoke" button.');
+        var tr = $('<tr/>').appendTo(table);
 
-    tr = $('<tr/>').appendTo(table);
+        var td = $('<td/>').appendTo(tr);
+        td.append('Note:');
 
-    td = $('<td/>').appendTo(tr);
-    td.append('Reason for Revocation:');
+        td = $('<td/>').appendTo(tr);
+        td.append(
+            'To confirm your intention to revoke this certificate, '+
+                'select a reason from the pull-down list, and click '+
+                'the "Revoke" button.');
 
-    td = $('<td/>').appendTo(tr);
+        tr = $('<tr/>').appendTo(table);
 
-    var select = $('<select/>').appendTo(td);
-    for (var i=0; i<CRL_REASON.length; i++) {
-        if (!CRL_REASON[i]) continue;
-        $('<option/>', {
-            'value': i,
-            'html': CRL_REASON[i]
-        }).appendTo(select);
-    }
+        td = $('<td/>').appendTo(tr);
+        td.append('Reason for Revocation:');
 
-    that.open = function() {
-        dialog.dialog({
-            modal: true,
-            width: 500,
-            height: 300,
-            buttons: {
-                'Revoke': function() {
-                    var values = {};
-                    values['reason'] = select.val();
-                    if (that.revoke) {
-                        that.revoke(values);
+        td = $('<td/>').appendTo(tr);
+
+        var select = $('<select/>').appendTo(td);
+        for (var i=0; i<IPA.cert.CRL_REASON.length; i++) {
+            if (!IPA.cert.CRL_REASON[i]) continue;
+            $('<option/>', {
+                'value': i,
+                'html': IPA.cert.CRL_REASON[i]
+            }).appendTo(select);
+        }
+
+        that.open = function() {
+            dialog.dialog({
+                modal: true,
+                width: 500,
+                height: 300,
+                buttons: {
+                    'Revoke': function() {
+                        var values = {};
+                        values['reason'] = select.val();
+                        if (that.revoke) {
+                            that.revoke(values);
+                        }
+                        dialog.dialog('destroy');
+                    },
+                    'Cancel': function() {
+                        dialog.dialog('destroy');
                     }
-                    dialog.dialog('destroy');
-                },
-                'Cancel': function() {
-                    dialog.dialog('destroy');
                 }
-            }
+            });
+        };
+
+        return that;
+    },
+
+    restore_dialog: function (spec) {
+        var that = {};
+        spec = spec || {};
+
+        that.title = spec.title || '';
+        that.restore = spec.restore;
+
+        var dialog = $('<div/>', {
+            'title': that.title
         });
-    };
-
-    return that;
-}
-
-function certificate_restore_dialog(spec) {
-    var that = {};
-    spec = spec || {};
-
-    that.title = spec.title || '';
-    that.restore = spec.restore;
-
-    var dialog = $('<div/>', {
-        'title': that.title
-    });
-
-    dialog.append(
-        'To confirm your intention to restore this certificate, '+
-        'click the "Restore" button.');
-
-    that.open = function() {
-        dialog.dialog({
-            modal: true,
-            width: 400,
-            height: 200,
-            buttons: {
-                'Restore': function() {
-                    var values = {};
-                    if (that.restore) {
-                        that.restore(values);
+
+        dialog.append(
+            'To confirm your intention to restore this certificate, '+
+                'click the "Restore" button.');
+
+        that.open = function() {
+            dialog.dialog({
+                modal: true,
+                width: 400,
+                height: 200,
+                buttons: {
+                    'Restore': function() {
+                        var values = {};
+                        if (that.restore) {
+                            that.restore(values);
+                        }
+                        dialog.dialog('destroy');
+                    },
+                    'Cancel': function() {
+                        dialog.dialog('destroy');
                     }
-                    dialog.dialog('destroy');
-                },
-                'Cancel': function() {
-                    dialog.dialog('destroy');
                 }
-            }
+            });
+        };
+
+        return that;
+    },
+
+    view_dialog: function (spec) {
+        var that = {};
+        spec = spec || {};
+
+        that.title = spec.title || '';
+        that.subject = IPA.cert.parse_dn(spec.subject);
+        that.serial_number = spec.serial_number || '';
+        that.issuer = IPA.cert.parse_dn(spec.issuer);
+        that.issued_on = spec.issued_on || '';
+        that.expires_on = spec.expires_on || '';
+        that.md5_fingerprint = spec.md5_fingerprint || '';
+        that.sha1_fingerprint = spec.sha1_fingerprint || '';
+
+        var dialog = $('<div/>', {
+            'title': that.title
         });
-    };
-
-    return that;
-}
-
-function certificate_view_dialog(spec) {
-    var that = {};
-    spec = spec || {};
-
-    that.title = spec.title || '';
-    that.subject = certificate_parse_dn(spec.subject);
-    that.serial_number = spec.serial_number || '';
-    that.issuer = certificate_parse_dn(spec.issuer);
-    that.issued_on = spec.issued_on || '';
-    that.expires_on = spec.expires_on || '';
-    that.md5_fingerprint = spec.md5_fingerprint || '';
-    that.sha1_fingerprint = spec.sha1_fingerprint || '';
-
-    var dialog = $('<div/>', {
-        'title': that.title
-    });
-
-    var table = $('<table/>').appendTo(dialog);
-
-    var tr = $('<tr/>').appendTo(table);
-    $('<td/>', {
-        'colspan': 2,
-        'html': '<h3>Issued To</h3>'
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Common Name:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.subject.cn
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Organization:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.subject.o
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Organizational Unit:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.subject.ou
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Serial Number:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.serial_number
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td/>', {
-        'colspan': 2,
-        'html': '<h3>Issued By</h3>'
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Common Name:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.issuer.cn
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Organization:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.issuer.o
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Organizational Unit:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.issuer.ou
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td/>', {
-        'colspan': 2,
-        'html': '<h3>Validity</h3>'
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Issued On:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.issued_on
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>Expires On:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.expires_on
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td/>', {
-        'colspan': 2,
-        'html': '<h3>Fingerprints</h3>'
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>SHA1 Fingerprint:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.sha1_fingerprint
-    }).appendTo(tr);
-
-    tr = $('<tr/>').appendTo(table);
-    $('<td>MD5 Fingerprint:</td>').appendTo(tr);
-    $('<td/>', {
-        'html': that.md5_fingerprint
-    }).appendTo(tr);
-
-    that.open = function() {
-        dialog.dialog({
-            modal: true,
-            width: 600,
-            height: 500,
-            buttons: {
-                'Close': function() {
-                    dialog.dialog('destroy');
+
+        var table = $('<table/>').appendTo(dialog);
+
+        var tr = $('<tr/>').appendTo(table);
+        $('<td/>', {
+            'colspan': 2,
+            'html': '<h3>Issued To</h3>'
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Common Name:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.subject.cn
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Organization:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.subject.o
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Organizational Unit:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.subject.ou
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Serial Number:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.serial_number
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td/>', {
+            'colspan': 2,
+            'html': '<h3>Issued By</h3>'
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Common Name:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.issuer.cn
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Organization:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.issuer.o
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Organizational Unit:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.issuer.ou
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td/>', {
+            'colspan': 2,
+            'html': '<h3>Validity</h3>'
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Issued On:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.issued_on
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>Expires On:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.expires_on
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td/>', {
+            'colspan': 2,
+            'html': '<h3>Fingerprints</h3>'
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>SHA1 Fingerprint:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.sha1_fingerprint
+        }).appendTo(tr);
+
+        tr = $('<tr/>').appendTo(table);
+        $('<td>MD5 Fingerprint:</td>').appendTo(tr);
+        $('<td/>', {
+            'html': that.md5_fingerprint
+        }).appendTo(tr);
+
+        that.open = function() {
+            dialog.dialog({
+                modal: true,
+                width: 600,
+                height: 500,
+                buttons: {
+                    'Close': function() {
+                        dialog.dialog('destroy');
+                    }
                 }
-            }
+            });
+        };
+
+        return that;
+    },
+
+    request_dialog: function (spec) {
+        var that = {};
+        spec = spec || {};
+
+        that.title = spec.title || '';
+        that.request = spec.request;
+
+        var dialog = $('<div/>', {
+            'title': that.title
         });
-    };
-
-    return that;
-}
-
-function certificate_request_dialog(spec) {
-    var that = {};
-    spec = spec || {};
-
-    that.title = spec.title || '';
-    that.request = spec.request;
-
-    var dialog = $('<div/>', {
-        'title': that.title
-    });
-
-    dialog.append('Copy and paste the Base64-encoded CSR below:');
-    dialog.append('<br/>');
-    dialog.append('<br/>');
-
-    dialog.append(BEGIN_CERTIFICATE_REQUEST);
-    dialog.append('<br/>');
-
-    var textarea = $('<textarea/>', {
-        style: 'width: 100%; height: 225px;'
-    }).appendTo(dialog);
-
-    dialog.append('<br/>');
-    dialog.append(END_CERTIFICATE_REQUEST);
-
-    that.open = function() {
-        dialog.dialog({
-            modal: true,
-            width: 500,
-            height: 400,
-            buttons: {
-                'Issue': function() {
-                    var values = {};
-                    var request = textarea.val();
-                    request =
-                        BEGIN_CERTIFICATE_REQUEST+'\n'+
-                        $.trim(request)+'\n'+
-                        END_CERTIFICATE_REQUEST+'\n';
-                    values['request'] = request;
-                    if (that.request) {
-                        that.request(values);
+
+        dialog.append('Copy and paste the Base64-encoded CSR below:');
+        dialog.append('<br/>');
+        dialog.append('<br/>');
+
+        dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
+        dialog.append('<br/>');
+
+        var textarea = $('<textarea/>', {
+            style: 'width: 100%; height: 225px;'
+        }).appendTo(dialog);
+
+        dialog.append('<br/>');
+        dialog.append(IPA.cert.END_CERTIFICATE_REQUEST);
+
+        that.open = function() {
+            dialog.dialog({
+                modal: true,
+                width: 500,
+                height: 400,
+                buttons: {
+                    'Issue': function() {
+                        var values = {};
+                        var request = textarea.val();
+                        request =
+                            IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+
+                            $.trim(request)+'\n'+
+                            IPA.cert.END_CERTIFICATE_REQUEST+'\n';
+                        values['request'] = request;
+                        if (that.request) {
+                            that.request(values);
+                        }
+                        dialog.dialog('destroy');
+                    },
+                    'Cancel': function() {
+                        dialog.dialog('destroy');
                     }
-                    dialog.dialog('destroy');
-                },
-                'Cancel': function() {
-                    dialog.dialog('destroy');
                 }
-            }
-        });
-    };
+            });
+        };
 
-    return that;
-}
+        return that;
+    }
+};
 
-function certificate_status_widget(spec) {
+IPA.certificate_status_widget = function(spec) {
 
     spec = spec || {};
 
@@ -614,18 +616,18 @@ function certificate_status_widget(spec) {
         if (entity_certificate) {
             check_status(that.result.serial_number);
         } else {
-            set_status(CERTIFICATE_STATUS_MISSING);
+            set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
         }
     };
 
     function set_status(status, revocation_reason) {
-        that.status_valid.css('display', status == CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
-        that.status_missing.css('display', status == CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
+        that.status_valid.css('display', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
+        that.status_missing.css('display', status == IPA.cert.CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
 
         if (!that.is_selfsign()) {
-            that.status_revoked.css('display', status == CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
-            that.revoke_button.css('visibility', status == CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden');
-            that.revocation_reason.html(revocation_reason == undefined ? '' : CRL_REASON[revocation_reason]);
+            that.status_revoked.css('display', status == IPA.cert.CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
+            that.revoke_button.css('visibility', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden');
+            that.revocation_reason.html(revocation_reason == undefined ? '' : IPA.cert.CRL_REASON[revocation_reason]);
             that.restore_button.css('visibility', revocation_reason == 6 ? 'visible' : 'hidden');
         }
     }
@@ -633,7 +635,7 @@ function certificate_status_widget(spec) {
     function check_status(serial_number) {
 
         if (that.is_selfsign()) {
-            set_status(CERTIFICATE_STATUS_VALID);
+            set_status(IPA.cert.CERTIFICATE_STATUS_VALID);
             return;
         }
 
@@ -644,9 +646,9 @@ function certificate_status_widget(spec) {
             function(data, text_status, xhr) {
                 var revocation_reason = data.result.result.revocation_reason;
                 if (revocation_reason == undefined) {
-                    set_status(CERTIFICATE_STATUS_VALID);
+                    set_status(IPA.cert.CERTIFICATE_STATUS_VALID);
                 } else {
-                    set_status(CERTIFICATE_STATUS_REVOKED, revocation_reason);
+                    set_status(IPA.cert.CERTIFICATE_STATUS_REVOKED, revocation_reason);
                 }
             }
         );
@@ -656,13 +658,13 @@ function certificate_status_widget(spec) {
 
         var entity_certificate = that.get_entity_certificate(result);
         if (!entity_certificate) {
-            set_status(CERTIFICATE_STATUS_MISSING);
+            set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
             return;
         }
 
         var entity_name = that.get_entity_name(result);
 
-        var dialog = certificate_view_dialog({
+        var dialog = IPA.cert.view_dialog({
             'title': 'Certificate for '+that.entity_label+' '+entity_name,
             'subject': result['subject'],
             'serial_number': result['serial_number'],
@@ -680,13 +682,13 @@ function certificate_status_widget(spec) {
 
         var entity_certificate = that.get_entity_certificate(result);
         if (!entity_certificate) {
-            set_status(CERTIFICATE_STATUS_MISSING);
+            set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
             return;
         }
 
         var entity_name = that.get_entity_name(result);
 
-        var dialog = certificate_get_dialog({
+        var dialog = IPA.cert.get_dialog({
             'title': 'Certificate for '+that.entity_label+' '+entity_name,
             'usercertificate': entity_certificate
         });
@@ -699,7 +701,7 @@ function certificate_status_widget(spec) {
         var entity_name = that.get_entity_name(result);
         var entity_principal = that.get_entity_principal(result);
 
-        var dialog = certificate_request_dialog({
+        var dialog = IPA.cert.request_dialog({
             'title': 'Issue New Certificate for '+that.entity_label+' '+entity_name,
             'request': function(values) {
                 var request = values['request'];
@@ -724,14 +726,14 @@ function certificate_status_widget(spec) {
 
         var entity_certificate = that.get_entity_certificate(result);
         if (!entity_certificate) {
-            set_status(CERTIFICATE_STATUS_MISSING);
+            set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
             return;
         }
 
         var entity_name = that.get_entity_name(result);
         var serial_number = result['serial_number'];
 
-        var dialog = certificate_revoke_dialog({
+        var dialog = IPA.cert.revoke_dialog({
             'title': 'Revoke Certificate for '+that.entity_label+' '+entity_name,
             'revoke': function(values) {
                 var reason = values['reason'];
@@ -756,14 +758,14 @@ function certificate_status_widget(spec) {
 
         var entity_certificate = that.get_entity_certificate(result);
         if (!entity_certificate) {
-            set_status(CERTIFICATE_STATUS_MISSING);
+            set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
             return;
         }
 
         var entity_name = that.get_entity_name(result);
         var serial_number = result['serial_number'];
 
-        var dialog = certificate_restore_dialog({
+        var dialog = IPA.cert.restore_dialog({
             'title': 'Restore Certificate for '+that.entity_label+' '+entity_name,
             'restore': function(values) {
                 IPA.cmd(
@@ -781,4 +783,4 @@ function certificate_status_widget(spec) {
     }
 
     return that;
-}
+};
diff --git a/install/ui/entity.js b/install/ui/entity.js
index 18839c940f48003615ebb87413c0406b4f44fc4a..a5aed0d7892e6b3b4ab3a56cef61161ad45e1c6e 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -242,9 +242,6 @@ IPA.entity = function (spec) {
 };
 
 
-/* use this to track individual changes between two hashchange events */
-var window_hash_cache = {};
-
 /*renamed to avoid clash with IPA.get_entity*/
 IPA.fetch_entity = function (entity_name) {
 
@@ -609,7 +606,7 @@ IPA. facet_create_action_panel = function(container) {
                     var state = {};
                     state[nested_tabs[0]+'-entity'] =
                         this.title;
-                    nav_push_state(state);
+                    IPA.nav.push_state(state);
                     return false;
                 }
             }).appendTo(ul);
diff --git a/install/ui/host.js b/install/ui/host.js
index 1f0a76dd5c28acec2c12d81b46a96512354dc3ea..943783e3b62fbc1dbd879b2db00d04d18ab14a41 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -198,7 +198,7 @@ IPA.host_details_facet = function (spec) {
         that.add_section(section);
 
         //TODO add label to messages
-        section.add_field(host_provisioning_status_widget({
+        section.add_field(IPA.host_provisioning_status_widget({
             'name': 'provisioning_status',
             'label': 'Status',
             'facet': that
@@ -210,7 +210,7 @@ IPA.host_details_facet = function (spec) {
         });
         that.add_section(section);
 
-        section.add_field(host_certificate_status_widget({
+        section.add_field(IPA.host_certificate_status_widget({
             'name': 'certificate_status',
             'label': 'Status'
         }));
@@ -247,7 +247,7 @@ IPA.host_details_facet = function (spec) {
 };
 
 
-function host_provisioning_status_widget(spec) {
+IPA.host_provisioning_status_widget = function (spec) {
 
     spec = spec || {};
 
@@ -430,13 +430,13 @@ function host_provisioning_status_widget(spec) {
     }
 
     return that;
-}
+};
 
-function host_certificate_status_widget(spec) {
+IPA.host_certificate_status_widget = function (spec) {
 
     spec = spec || {};
 
-    var that = certificate_status_widget(spec);
+    var that = IPA.certificate_status_widget(spec);
 
     that.init = function() {
 
@@ -463,7 +463,7 @@ function host_certificate_status_widget(spec) {
     };
 
     return that;
-}
+};
 
 IPA.host_managedby_host_facet = function (spec) {
 
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 64ee04b54382f53e73acf33b38c29ae7d5c42e6e..f51c4a25446641f922b4275a1b50695cac8c49fb 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -47,7 +47,6 @@ var IPA = ( function () {
     that.metadata = {};
     that.whoami = {};
 
-
     that.entities = [];
     that.entity_factories = {};
 
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 4a3fe6916689cf20ae6f09b3e21c681ad7396b68..04eb9ae9490d716704dab731bba1890aff46e669 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -20,138 +20,137 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-var nav_tabs_lists;
-var nav_container;
+IPA.nav = {
+    tabs_lists : {},
+    nav_container : {},
 
-
-
-function nav_push_state(params)
-{
-    if (!IPA.test_dirty()){
-        return false;
-    }
-    $.bbq.pushState(params);
-    return true;
-}
-
-function nav_get_state(key)
-{
-    return $.bbq.getState(key, true);
-}
-
-function nav_remove_state(key)
-{
-    $.bbq.removeState(key);
-}
-
-function nav_create(nls, container, tabclass)
-{
-    if (!container)
-        container = $('#navigation');
-    if (!tabclass)
-        tabclass = 'tabs';
-
-    nav_tabs_lists = nls;
-    nav_container = container;
-
-    nav_generate_tabs(nls, container, tabclass, 1);
-
-    var tabs = $('.' + tabclass);
-    tabs.tabs({
-        select: function(event, ui) {
-            var panel = $(ui.panel);
-            var parent = panel.parent();
-            var id = parent.attr('id');
-            var state = {};
-            state[id] = ui.index;
-            return nav_push_state(state);
+    push_state : function (params) {
+        if (!IPA.test_dirty()){
+            return false;
         }
-    });
-
-    nav_update_tabs();
-}
-
-function nav_generate_tabs(nls, container, tabclass, depth)
-{
-    container.addClass(tabclass);
-    container.addClass('tabs'+depth);
-
-    var ul = $('<ul/>');
-    container.append(ul);
-
-    for (var i = 0; i < nls.length; ++i) {
-        var tab = nls[i];
-
-        var label = tab.name;
-        if (tab.entity) {
-            var entity = IPA.get_entity(tab.entity);
-            label = entity.label;
+        $.bbq.pushState(params);
+        return true;
+    },
+
+    get_state : function (key)
+    {
+        return $.bbq.getState(key, true);
+    },
+    
+    remove_state : function (key)
+    {
+        $.bbq.removeState(key);
+    },
+    
+    create : function (nls, container, tabclass)
+    {
+        if (!container)
+            container = $('#navigation');
+        if (!tabclass)
+            tabclass = 'tabs';
+    
+        IPA.nav.tabs_lists = nls;
+        IPA.nav.nav_container = container;
+    
+        IPA.nav.generate_tabs(nls, container, tabclass, 1);
+    
+        var tabs = $('.' + tabclass);
+        tabs.tabs({
+            select: function(event, ui) {
+                var panel = $(ui.panel);
+                var parent = panel.parent();
+                var id = parent.attr('id');
+                var state = {};
+                state[id] = ui.index;
+                return IPA.nav.push_state(state);
+            }
+        });
+    
+        IPA.nav.update_tabs();
+    },
+    
+    generate_tabs : function (nls, container, tabclass, depth)
+    {
+        container.addClass(tabclass);
+        container.addClass('tabs'+depth);
+    
+        var ul = $('<ul/>');
+        container.append(ul);
+    
+        for (var i = 0; i < nls.length; ++i) {
+            var tab = nls[i];
+    
+            var label = tab.name;
+            if (tab.entity) {
+                var entity = IPA.get_entity(tab.entity);
+                label = entity.label;
+            }
+            if (tab.label){
+                label = tab.label;
+            }
+    
+            var li = IPA.nav.create_tab_li(tab.name, label);
+            ul.append(li);
+    
+            var div = IPA.nav.create_tab_div(tab.name);
+            container.append(div);
+    
+            if (tab.entity) {
+                div.addClass('entity-container');
+            }
+    
+            if (tab.children && depth === 1) {
+                IPA.nav.generate_tabs(tab.children, div, tabclass, depth +1 );
+            }
         }
-        if (tab.label){
-            label = tab.label;
+    },
+    
+    create_tab_li : function (id, name)
+    {
+        return $('<li/>').append($('<a/>', {
+            href: '#'+id,
+            title: id,
+            html: name
+        }));
+    },
+    
+    create_tab_div : function (id)
+    {
+        return $('<div/>', {
+            id: id
+        });
+    },
+    
+    update_tabs : function ()
+    {
+        IPA.nav._update_tabs(IPA.nav.tabs_lists, IPA.nav.nav_container,1);
+    },
+    
+    _update_tabs : function (nls, container,depth)
+    {
+        var id = container.attr('id');
+        var index = IPA.nav.get_state(id);
+        if (!index || index >= nls.length) index = 0;
+    
+        container.tabs('select', index);
+    
+        var tab = nls[index];
+        var container2 = $('#' + tab.name);
+    
+        if (tab.children   && depth === 1 ) {
+            IPA.nav._update_tabs(tab.children, container2,depth+1);
+    
+        } else if (tab.entity) {
+            var entity_name = tab.entity;
+    
+            var nested_entity = IPA.nav.get_state(entity_name+'-entity');
+    
+            if (nested_entity){
+                entity_name = nested_entity;
+            }
+    
+            var entity = IPA.get_entity(entity_name);
+            entity.setup(container2);
         }
-
-        var li = nav_create_tab_li(tab.name, label);
-        ul.append(li);
-
-        var div = nav_create_tab_div(tab.name);
-        container.append(div);
-
-        if (tab.entity) {
-            div.addClass('entity-container');
-        }
-
-        if (tab.children && depth === 1) {
-            nav_generate_tabs(tab.children, div, tabclass, depth +1 );
-        }
-    }
-}
-
-function nav_create_tab_li(id, name)
-{
-    return $('<li/>').append($('<a/>', {
-        href: '#'+id,
-        title: id,
-        html: name
-    }));
-}
-
-function nav_create_tab_div(id)
-{
-    return $('<div/>', {
-        id: id
-    });
-}
-
-function nav_update_tabs()
-{
-    _nav_update_tabs(nav_tabs_lists, nav_container,1);
-}
-
-function _nav_update_tabs(nls, container,depth)
-{
-    var id = container.attr('id');
-    var index = nav_get_state(id);
-    if (!index || index >= nls.length) index = 0;
-
-    container.tabs('select', index);
-
-    var tab = nls[index];
-    var container2 = $('#' + tab.name);
-
-    if (tab.children   && depth === 1 ) {
-        _nav_update_tabs(tab.children, container2,depth+1);
-
-    } else if (tab.entity) {
-        var entity_name = tab.entity;
-
-        var nested_entity = nav_get_state(entity_name+'-entity');
-
-        if (nested_entity){
-            entity_name = nested_entity;
-        }
-
-        var entity = IPA.get_entity(entity_name);
-        entity.setup(container2);
     }
-}
+};
diff --git a/install/ui/policy.js b/install/ui/policy.js
index f7e4761a3c6c0e73bc417ded0ac60cf83683bc59..0bfe6184c3b531f0cc0e9951ef91bc4651938c94 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -429,9 +429,23 @@ IPA.records_facet = function (spec){
 
 
     function generate_tr(thead, tbody, result){
+        function generate_checkbox_td(tr, pkey)
+        {
+            var checkbox = $('<input />', {
+                name: pkey,
+                title: pkey,
+                type: 'checkbox',
+                'class': 'search-selector'
+            });
+            var td = $('<td></td>');
+        
+            td.append(checkbox);
+            tr.append(td);
+        }
+
         var tr = $('<tr></tr>').appendTo(tbody);
 
-        search_generate_checkbox_td(tr, /*pkey_value*/ '');
+        generate_checkbox_td(tr, /*pkey_value*/ '');
 
         //TODO get this fixed on the back end.  For now, workaround
 
diff --git a/install/ui/search.js b/install/ui/search.js
index c2f41f7c394ae37c6c981bfa0a80e1e8e99d6fab..fe88d05ef3aa03117656561655fa92f4185dac6a 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -396,74 +396,3 @@ IPA.search_facet = function(spec) {
     return that;
 };
 
-function search_generate_tr(thead, tbody, entry_attrs)
-{
-    var obj_name = tbody.closest('.entity-container').attr('title');
-    var pkey = IPA.metadata[obj_name].primary_key;
-    var pkey_value = entry_attrs[pkey];
-
-    var entity = IPA.get_entity(obj_name);
-    var facet = entity ? entity.get_facet('search') : null;
-
-    tbody.append('<tr></tr>');
-    var tr = tbody.children().last();
-    search_generate_checkbox_td(tr, pkey_value);
-
-    var ths = thead.find('th');
-    for (var i = 1; i < ths.length; ++i) {
-        var jobj = $(ths[i]);
-        var attr = jobj.attr('abbr');
-        var value = entry_attrs[attr];
-
-        var column = facet ? facet.get_column(attr) : null;
-        var render_call = window[jobj.attr('title')];
-
-        if (column && column.setup) {
-            column.setup(tr, attr, value, entry_attrs);
-
-        } else if (typeof render_call == 'function') {
-            render_call(tr, attr, value, entry_attrs);
-
-        } else
-            search_generate_td(tr, attr, value, entry_attrs);
-    }
-
-    tbody.find('.search-a-pkey').click(function () {
-        var jobj = $(this);
-
-        var state = {};
-        state[obj_name + '-facet'] = 'details';
-        state[obj_name + '-pkey'] = $(this).text();
-        $.bbq.pushState(state);
-
-        return (false);
-    });
-}
-
-function search_generate_checkbox_td(tr, pkey)
-{
-    var checkbox = $('<input />', {
-        name: pkey,
-        title: pkey,
-        type: 'checkbox',
-        'class': 'search-selector'
-    });
-    var td = $('<td></td>');
-
-    td.append(checkbox);
-    tr.append(td);
-}
-
-var _search_td_template = '<td title="A">V</td>';
-var _search_a_pkey_template = '<a href="jslink" class="search-a-pkey">V</a>';
-
-function search_generate_td(tr, attr, value, entry_attrs)
-{
-    var obj_name = tr.closest('.entity-container').attr('title');
-
-    var param_info = IPA.get_param_info(obj_name, attr);
-    if (param_info && param_info['primary_key'])
-        value = _search_a_pkey_template.replace('V', value);
-
-    tr.append(_search_td_template.replace('A', attr).replace('V', value));
-}
diff --git a/install/ui/service.js b/install/ui/service.js
index 1d2a2485bb2dbabe984adb57ac9671aa82e09c98..001ec82118ee712af0dffde701fb722a08a1bb0e 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -151,7 +151,7 @@ IPA.service_details_facet = function(spec) {
                 name: 'provisioning',
                 label: 'Provisioning'
             }).
-                custom_input(service_provisioning_status_widget({
+                custom_input(IPA.service_provisioning_status_widget({
                     name: 'provisioning_status',
                     label: 'Status'
                 }))).
@@ -160,7 +160,7 @@ IPA.service_details_facet = function(spec) {
                 name: 'certificate',
                 label: 'Service Certificate'
             }).
-                custom_input((service_certificate_status_widget({
+                custom_input((IPA.service_certificate_status_widget({
                     name: 'certificate_status',
                     label: 'Status'
                 }))));
@@ -210,7 +210,7 @@ IPA.service_host_widget = function(spec) {
 };
 
 
-function service_provisioning_status_widget(spec) {
+IPA.service_provisioning_status_widget = function (spec) {
 
     spec = spec || {};
 
@@ -322,13 +322,13 @@ function service_provisioning_status_widget(spec) {
     }
 
     return that;
-}
+};
 
-function service_certificate_status_widget(spec) {
+IPA.service_certificate_status_widget = function (spec) {
 
     spec = spec || {};
 
-    var that = certificate_status_widget(spec);
+    var that = IPA.certificate_status_widget(spec);
 
     that.init = function() {
 
@@ -355,7 +355,7 @@ function service_certificate_status_widget(spec) {
     };
 
     return that;
-}
+};
 
 IPA.service_managedby_host_facet = function(spec) {
 
diff --git a/install/ui/sudocmd.js b/install/ui/sudocmd.js
index 88147b7860a2d8ef05fb550bfea93da46295f511..902c610e6edcdd54cb6a2e2f15bbe99d612c8ff6 100644
--- a/install/ui/sudocmd.js
+++ b/install/ui/sudocmd.js
@@ -20,7 +20,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js, sudorule.js */
 
 IPA.entity_factories.sudocmd = function () {
 
@@ -35,7 +35,7 @@ IPA.entity_factories.sudocmd = function () {
             'label': 'Search'
         });
 
-        var dialog = IPA.sudocmd_add_dialog({
+        var dialog = IPA.sudo.sudocmd_add_dialog({
             'name': 'add',
             'title': 'Add New SUDO Command'
         });
@@ -55,7 +55,7 @@ IPA.entity_factories.sudocmd = function () {
 };
 
 
-IPA.sudocmd_add_dialog = function (spec) {
+IPA.sudo.sudocmd_add_dialog = function (spec) {
 
     spec = spec || {};
 
diff --git a/install/ui/sudocmdgroup.js b/install/ui/sudocmdgroup.js
index d99bb61f553e4c75481d8ad7bae1763fa66e229c..3f5d8e65ff278fec329ed893e1533474395f6938 100644
--- a/install/ui/sudocmdgroup.js
+++ b/install/ui/sudocmdgroup.js
@@ -20,7 +20,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js, sudorule.js */
 
 IPA.entity_factories.sudocmdgroup = function () {
 
@@ -35,7 +35,7 @@ IPA.entity_factories.sudocmdgroup = function () {
             'label': 'Search'
         });
 
-        var dialog = IPA.sudocmdgroup_add_dialog({
+        var dialog = IPA.sudo.sudocmdgroup_add_dialog({
             'name': 'add',
             'title': 'Add New SUDO Command Group'
         });
@@ -55,7 +55,7 @@ IPA.entity_factories.sudocmdgroup = function () {
 };
 
 
-IPA.sudocmdgroup_add_dialog = function (spec) {
+IPA.sudo.sudocmdgroup_add_dialog = function (spec) {
 
     spec = spec || {};
 
diff --git a/install/ui/sudorule.js b/install/ui/sudorule.js
index 5f062e731528caf4c35fac084dd5c8d037175e9c..890a6e52f95495a1f554353fb496d4ed3ce5a9f4 100644
--- a/install/ui/sudorule.js
+++ b/install/ui/sudorule.js
@@ -22,6 +22,8 @@
 
 /* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
 
+IPA.sudo = {};
+
 IPA.entity_factories.sudorule = function () {
 
     var that = IPA.entity({
@@ -35,7 +37,7 @@ IPA.entity_factories.sudorule = function () {
             'label': 'Search'
         });
 
-        var dialog = IPA.sudorule_add_dialog({
+        var dialog = IPA.sudo.sudorule_add_dialog({
             'name': 'add',
             'title': 'Add New Rule'
         });
@@ -55,7 +57,7 @@ IPA.entity_factories.sudorule = function () {
 };
 
 
-IPA.sudorule_add_dialog = function (spec) {
+IPA.sudo.sudorule_add_dialog = function (spec) {
 
     spec = spec || {};
 
@@ -109,7 +111,7 @@ IPA.sudorule_details_facet = function (spec) {
             });
 
         } else {
-            section = IPA.sudorule_details_general_section({
+            section = IPA.sudo.sudorule_details_general_section({
                 'name': 'general',
                 'label': 'General'
             });
@@ -176,13 +178,13 @@ IPA.sudorule_details_facet = function (spec) {
             'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host'
         }));
 
-        section = IPA.sudorule_details_command_section({
+        section = IPA.sudo.sudorule_details_command_section({
             'name': 'command',
             'label': 'Run Commands'
         });
         that.add_section(section);
 
-        section = IPA.sudorule_details_runas_section({
+        section = IPA.sudo.sudorule_details_runas_section({
             'name': 'runas',
             'label': 'As Whom'
         });
@@ -379,7 +381,7 @@ IPA.sudorule_details_facet = function (spec) {
 };
 
 
-IPA.sudorule_details_general_section = function (spec){
+IPA.sudo.sudorule_details_general_section = function (spec){
 
     spec = spec || {};
 
@@ -516,7 +518,7 @@ IPA.sudorule_details_general_section = function (spec){
 };
 
 
-IPA.sudorule_details_command_section = function (spec){
+IPA.sudo.sudorule_details_command_section = function (spec){
 
     spec = spec || {};
 
@@ -688,7 +690,7 @@ IPA.sudorule_details_command_section = function (spec){
 };
 
 
-IPA.sudorule_details_runas_section = function (spec){
+IPA.sudo.sudorule_details_runas_section = function (spec){
 
     spec = spec || {};
 
@@ -915,7 +917,7 @@ IPA.sudorule_association_table_widget = function (spec) {
             template = 'sudorule-'+that.other_entity+'-dialog.html #contents';
         }
 
-        return IPA.sudorule_association_adder_dialog({
+        return IPA.sudo.sudorule_association_adder_dialog({
             'title': title,
             'entity_name': that.entity_name,
             'pkey': pkey,
@@ -938,7 +940,7 @@ IPA.sudorule_association_table_widget = function (spec) {
 };
 
 
-IPA.sudorule_association_adder_dialog = function (spec) {
+IPA.sudo.sudorule_association_adder_dialog = function (spec) {
 
     spec = spec || {};
 
diff --git a/install/ui/test/certificate_tests.js b/install/ui/test/certificate_tests.js
index c50ec18670677ad55e23dde297860c27060cf7dd..56bd4093887ca65239dbc6ed70207d58db222545 100755
--- a/install/ui/test/certificate_tests.js
+++ b/install/ui/test/certificate_tests.js
@@ -23,42 +23,42 @@ module('certificate');
 test("Testing certificate_parse_dn().", function() {
 
     same(
-        certificate_parse_dn(), {},
-        "Checking certificate_parse_dn()"
+        IPA.cert.parse_dn(), {},
+        "Checking IPA.cert.parse_dn()"
     );
 
     same(
-        certificate_parse_dn(''), {},
-        "Checking certificate_parse_dn('')"
+        IPA.cert.parse_dn(''), {},
+        "Checking IPA.cert.parse_dn('')"
     );
 
     same(
-        certificate_parse_dn('c=US'), {'c': 'US'},
-        "Checking certificate_parse_dn('c=US')"
+        IPA.cert.parse_dn('c=US'), {'c': 'US'},
+        "Checking IPA.cert.parse_dn('c=US')"
     );
 
     same(
-        certificate_parse_dn('st=TX,c=US'), {'st': 'TX','c': 'US'},
-        "Checking certificate_parse_dn('st=TX,c=US')"
+        IPA.cert.parse_dn('st=TX,c=US'), {'st': 'TX','c': 'US'},
+        "Checking IPA.cert.parse_dn('st=TX,c=US')"
     );
 
     same(
-        certificate_parse_dn('c=US,st=TX'), {'st': 'TX','c': 'US'},
-        "Checking certificate_parse_dn('c=US,st=TX')"
+        IPA.cert.parse_dn('c=US,st=TX'), {'st': 'TX','c': 'US'},
+        "Checking IPA.cert.parse_dn('c=US,st=TX')"
     );
 
     same(
-        certificate_parse_dn(' st = New Mexico , c = US '), {'st': 'New Mexico','c': 'US'},
-        "Checking certificate_parse_dn(' st = New Mexico , c = US ')"
+        IPA.cert.parse_dn(' st = New Mexico , c = US '), {'st': 'New Mexico','c': 'US'},
+        "Checking IPA.cert.parse_dn(' st = New Mexico , c = US ')"
     );
 
     same(
-        certificate_parse_dn('ST=TX,C=US'), {'st': 'TX','c': 'US'},
-        "Checking certificate_parse_dn('ST=TX,C=US')"
+        IPA.cert.parse_dn('ST=TX,C=US'), {'st': 'TX','c': 'US'},
+        "Checking IPA.cert.parse_dn('ST=TX,C=US')"
     );
 
     same(
-        certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US'),
+        IPA.cert.parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US'),
         {   'cn': 'dev.example.com',
             'ou': 'Engineering',
             'o': 'Example',
@@ -66,16 +66,16 @@ test("Testing certificate_parse_dn().", function() {
             'st': 'TX',
             'c': 'US'
         },
-        "Checking certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US')"
+        "Checking IPA.cert.parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US')"
     );
 
     same(
-        certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com'),
+        IPA.cert.parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com'),
         {
             'cn': 'John Smith',
             'ou': ['Developers','Users'],
             'dc': ['example', 'com']
         },
-        "Checking certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com')"
+        "Checking IPA.cert.parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com')"
     );
 });
diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js
index 9db0bb1cc3b0aa71d5dc705b873adf06188fb34f..29b1cfab9f1770feb37b190fb6571be82ea36d41 100644
--- a/install/ui/test/navigation_tests.js
+++ b/install/ui/test/navigation_tests.js
@@ -21,7 +21,7 @@
 
 module('navigation');
 
-test("Testing nav_create().", function() {
+test("Testing IPA.nav.create().", function() {
 
     var mock_tabs_lists =  [
         { name:'identity', label:'IDENTITY', children: [
@@ -56,7 +56,7 @@ test("Testing nav_create().", function() {
     var navigation = $('<div id="navigation"/>').appendTo(document.body);
     var user_mock_called = false;
     var group_mock_called = false;
-    nav_create(mock_tabs_lists, navigation, 'tabs');
+    IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
     ok(user_mock_called, "mock user setup was called");
     ok(!group_mock_called, "mock group setup was not called because the tab is inactive");
     same( navigation[0].children.length, 2, "Two Child tabs");
@@ -66,21 +66,21 @@ test("Testing nav_create().", function() {
     navigation.remove();
 });
 
-test("Testing nav_update_tabs() with valid index.", function() {
+test("Testing IPA.nav.update_tabs() with valid index.", function() {
 
-    var orig_push_state = nav_push_state;
-    var orig_get_state = nav_get_state;
-    var orig_remove_state = nav_remove_state;
+    var orig_push_state = IPA.nav.push_state;
+    var orig_get_state = IPA.nav.get_state;
+    var orig_remove_state = IPA.nav.remove_state;
 
     var state = {};
 
-    nav_push_state = function(params) {
+    IPA.nav.push_state = function(params) {
         $.extend(state, params);
     };
-    nav_get_state = function(key) {
+    IPA.nav.get_state = function(key) {
         return state[key];
     };
-    nav_remove_state = function(key) {
+    IPA.nav.remove_state = function(key) {
         delete state[key];
     };
 
@@ -93,10 +93,10 @@ test("Testing nav_update_tabs() with valid index.", function() {
 
     var navigation = $('<div id="navigation"/>').appendTo(document.body);
 
-    nav_create(mock_tabs_lists, navigation, 'tabs');
+    IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
 
-    nav_push_state({"identity":1});
-    nav_update_tabs();
+    IPA.nav.push_state({"identity":1});
+    IPA.nav.update_tabs();
 
     same(
         navigation.tabs('option', 'selected'), 0,
@@ -108,30 +108,30 @@ test("Testing nav_update_tabs() with valid index.", function() {
         "Active tab at level 2"
     );
 
-    nav_remove_state("identity");
+    IPA.nav.remove_state("identity");
 
     navigation.remove();
 
-    nav_push_state = orig_push_state;
-    nav_get_state = orig_get_state;
-    nav_remove_state = orig_remove_state;
+    IPA.nav.push_state = orig_push_state;
+    IPA.nav.get_state = orig_get_state;
+    IPA.nav.remove_state = orig_remove_state;
 });
 
-test("Testing nav_update_tabs() with out-of-range index.", function() {
+test("Testing IPA.nav.update_tabs() with out-of-range index.", function() {
 
-    var orig_push_state = nav_push_state;
-    var orig_get_state = nav_get_state;
-    var orig_remove_state = nav_remove_state;
+    var orig_push_state = IPA.nav.push_state;
+    var orig_get_state = IPA.nav.get_state;
+    var orig_remove_state = IPA.nav.remove_state;
 
     var state = {};
 
-    nav_push_state = function(params) {
+    IPA.nav.push_state = function(params) {
         $.extend(state, params);
     };
-    nav_get_state = function(key) {
+    IPA.nav.get_state = function(key) {
         return state[key];
     };
-    nav_remove_state = function(key) {
+    IPA.nav.remove_state = function(key) {
         delete state[key];
     };
 
@@ -144,10 +144,10 @@ test("Testing nav_update_tabs() with out-of-range index.", function() {
 
     var navigation = $('<div id="navigation"/>').appendTo(document.body);
 
-    nav_create(mock_tabs_lists, navigation, 'tabs');
+    IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
 
-    nav_push_state({"identity":2});
-    nav_update_tabs();
+    IPA.nav.push_state({"identity":2});
+    IPA.nav.update_tabs();
 
     same(
         navigation.tabs('option', 'selected'), 0,
@@ -159,11 +159,11 @@ test("Testing nav_update_tabs() with out-of-range index.", function() {
         "Active tab at level 2"
     );
 
-    nav_remove_state("identity");
+    IPA.nav.remove_state("identity");
 
     navigation.remove();
 
-    nav_push_state = orig_push_state;
-    nav_get_state = orig_get_state;
-    nav_remove_state = orig_remove_state;
+    IPA.nav.push_state = orig_push_state;
+    IPA.nav.get_state = orig_get_state;
+    IPA.nav.remove_state = orig_remove_state;
 });
diff --git a/install/ui/webui.js b/install/ui/webui.js
index 7d14f593f08631d61d3d3f2f61d6426359b695cc..fd33120d89f6daf849207e5541ab0b638f172e8e 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -118,7 +118,7 @@ $(function() {
 
     /* main loop (hashchange event handler) */
     function window_hashchange(evt){
-        nav_update_tabs();
+        IPA.nav.update_tabs();
     }
 
 
@@ -148,10 +148,10 @@ $(function() {
 
         if (should_show_all_ui()){
             IPA.tab_set = IPA.admin_tab_set();
-            nav_create(IPA.tab_set, navigation, 'tabs');
+            IPA.nav.create(IPA.tab_set, navigation, 'tabs');
         } else {
             IPA.tab_set = IPA.self_serv_tab_set();
-            nav_create(IPA.tab_set, navigation, 'tabs');
+            IPA.nav.create(IPA.tab_set, navigation, 'tabs');
 
             var state = {'user-pkey':IPA.whoami_pkey ,
                          'user-facet': $.bbq.getState('user-facet') ||
-- 
1.7.4

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

Reply via email to