On 02/15/2011 08:25 AM, Martin Kosek wrote:
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, if required.

https://fedorahosted.org/freeipa/ticket/212



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



Martin, he is the patch I did for the cert portion. I'll toss it, but you can see what I was thinking as far as hoe to shorten the names:

BTW, you should reverse the names of your patch so that they start with freeipa, and then your user id.
From f7f1007a60938f98156ca5ab73a713c315f288a4 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Mon, 14 Feb 2011 11:17:10 -0500
Subject: [PATCH] certificate into IPA namespace
 Cleans up the certificate handling code such that all the identifiers fall within the IPA namespace

---
 install/ui/certificate.js            |  725 +++++++++++++++++-----------------
 install/ui/host.js                   |    2 +-
 install/ui/service.js                |    2 +-
 install/ui/test/certificate_tests.js |   36 +-
 4 files changed, 383 insertions(+), 382 deletions(-)

diff --git a/install/ui/certificate.js b/install/ui/certificate.js
index 3158d04883af8cb7eb1f9a0f02e936801f0ea358..c286231a8dc1d1adb68fb61e209f257161187cb1 100755
--- a/install/ui/certificate.js
+++ b/install/ui/certificate.js
@@ -20,377 +20,378 @@
  * 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:');
+
+        td = $('<td/>').appendTo(tr);
 
-    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);
+        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 = parse_dn(spec.subject);
+        that.serial_number = spec.serial_number || '';
+        that.issuer = 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');
-                }
-            }
-        });
-    };
-
-    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);
+
+        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');
                     }
-                    dialog.dialog('destroy');
-                },
-                'Cancel': 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;
-}
+        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');
+                    }
+                }
+            });
+        };
 
-function certificate_status_widget(spec) {
+        return that;
+    }
+};
+IPA.certificate_status_widget = function(spec) {
 
     spec = spec || {};
 
@@ -614,18 +615,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 +634,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 +645,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 +657,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 +681,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 +700,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 +725,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 +757,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(
diff --git a/install/ui/host.js b/install/ui/host.js
index 7f56aeee46d4764b0df7ab133830e42006517173..93221ea4ebd010ca250df654a0aed9142c340f9e 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -430,7 +430,7 @@ function host_certificate_status_widget(spec) {
 
     spec = spec || {};
 
-    var that = certificate_status_widget(spec);
+    var that = IPA.certificate_status_widget(spec);
 
     that.init = function() {
 
diff --git a/install/ui/service.js b/install/ui/service.js
index 7fc1547223c08d8bc574284764ae2e4886ed8b46..be2c69060cf0e4f8c7dfe20316cee8ba3f852c51 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -333,7 +333,7 @@ function service_certificate_status_widget(spec) {
 
     spec = spec || {};
 
-    var that = certificate_status_widget(spec);
+    var that = IPA.certificate_status_widget(spec);
 
     that.init = function() {
 
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')"
     );
 });
-- 
1.7.3.5

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

Reply via email to