diff --git a/install/ui/certificate.js b/install/ui/certificate.js
index c5de56c1f..fea7448cd 100755
--- a/install/ui/certificate.js
+++ b/install/ui/certificate.js
@@ -78,39 +78,27 @@ IPA.cert.get_dialog = function(spec) {
spec = spec || {};
- var that = {};
+ var that = IPA.dialog(spec);
+
+ that.width = spec.width || 500;
+ that.height = spec.height || 400;
- that.title = spec.title || '';
that.usercertificate = spec.usercertificate || '';
- var dialog = $('
', {
- 'title': that.title
+ that.add_button(IPA.messages.buttons.close, function() {
+ that.close();
});
- var textarea = $('', {
- readonly: 'yes',
- style: 'width: 100%; height: 275px;'
- }).appendTo(dialog);
+ that.create = function() {
+ var textarea = $('', {
+ readonly: 'yes',
+ style: 'width: 100%; height: 275px;'
+ }).appendTo(that.container);
- textarea.val(
- IPA.cert.BEGIN_CERTIFICATE+'\n'+
- that.usercertificate+'\n'+
- IPA.cert.END_CERTIFICATE);
-
- that.open = function() {
-
- var buttons = {};
-
- buttons[IPA.messages.buttons.close] = function() {
- dialog.dialog('destroy');
- };
-
- dialog.dialog({
- modal: true,
- width: 500,
- height: 400,
- buttons: buttons
- });
+ textarea.val(
+ IPA.cert.BEGIN_CERTIFICATE+'\n'+
+ that.usercertificate+'\n'+
+ IPA.cert.END_CERTIFICATE);
};
return that;
@@ -120,64 +108,53 @@ IPA.cert.revoke_dialog = function(spec) {
spec = spec || {};
- var that = {};
+ var that = IPA.dialog(spec);
+
+ that.width = spec.width || 500;
+ that.height = spec.height || 300;
- that.title = spec.title || '';
that.revoke = spec.revoke;
- var dialog = $('', {
- 'title': that.title
+ that.add_button(IPA.messages.buttons.revoke, function() {
+ var values = {};
+ values['reason'] = that.select.val();
+ if (that.revoke) {
+ that.revoke(values);
+ }
+ that.close();
});
- var table = $('').appendTo(dialog);
+ that.add_button(IPA.messages.buttons.cancel, function() {
+ that.close();
+ });
- var tr = $('
').appendTo(table);
+ that.create = function() {
- var td = $(' | ').appendTo(tr);
- td.append(IPA.messages.objects.cert.note+':');
+ var table = $('').appendTo(that.container);
- td = $(' | ').appendTo(tr);
- td.append(IPA.messages.objects.cert.revoke_confirmation);
+ var tr = $('
').appendTo(table);
- tr = $('
').appendTo(table);
+ var td = $(' | ').appendTo(tr);
+ td.append(IPA.messages.objects.cert.note+':');
- td = $(' | ').appendTo(tr);
- td.append(IPA.messages.objects.cert.reason+':');
+ td = $(' | ').appendTo(tr);
+ td.append(IPA.messages.objects.cert.revoke_confirmation);
- td = $(' | ').appendTo(tr);
+ tr = $('
').appendTo(table);
- var select = $('').appendTo(td);
- for (var i=0; i', {
- 'value': i,
- 'html': IPA.cert.CRL_REASON[i]
- }).appendTo(select);
- }
+ td = $(' | ').appendTo(tr);
+ td.append(IPA.messages.objects.cert.reason+':');
- that.open = function() {
+ td = $(' | ').appendTo(tr);
- var buttons = {};
-
- buttons[IPA.messages.buttons.revoke] = function() {
- var values = {};
- values['reason'] = select.val();
- if (that.revoke) {
- that.revoke(values);
- }
- dialog.dialog('destroy');
- };
-
- buttons[IPA.messages.buttons.cancel] = function() {
- dialog.dialog('destroy');
- };
-
- dialog.dialog({
- modal: true,
- width: 500,
- height: 300,
- buttons: buttons
- });
+ that.select = $('').appendTo(td);
+ for (var i=0; i', {
+ 'value': i,
+ 'html': IPA.cert.CRL_REASON[i]
+ }).appendTo(that.select);
+ }
};
return that;
@@ -187,40 +164,28 @@ IPA.cert.restore_dialog = function(spec) {
spec = spec || {};
- var that = {};
+ var that = IPA.dialog(spec);
+
+ that.width = spec.width || 400;
+ that.height = spec.height || 200;
- that.title = spec.title || '';
that.restore = spec.restore;
- var dialog = $('', {
- 'title': that.title
+ that.add_button(IPA.messages.buttons.restore, function() {
+ var values = {};
+ if (that.restore) {
+ that.restore(values);
+ }
+ that.close();
});
- dialog.append(
- IPA.messages.objects.cert.restore_confirmation);
+ that.add_button(IPA.messages.buttons.cancel, function() {
+ that.close();
+ });
- that.open = function() {
-
- var buttons = {};
-
- buttons[IPA.messages.buttons.restore] = function() {
- var values = {};
- if (that.restore) {
- that.restore(values);
- }
- dialog.dialog('destroy');
- };
-
- buttons[IPA.messages.buttons.cancel] = function() {
- dialog.dialog('destroy');
- };
-
- dialog.dialog({
- modal: true,
- width: 400,
- height: 200,
- buttons: buttons
- });
+ that.create = function() {
+ that.container.append(
+ IPA.messages.objects.cert.restore_confirmation);
};
return that;
@@ -230,9 +195,11 @@ IPA.cert.view_dialog = function(spec) {
spec = spec || {};
- var that = {};
+ var that = IPA.dialog(spec);
+
+ that.width = spec.width || 600;
+ that.height = spec.height || 500;
- 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);
@@ -241,116 +208,103 @@ IPA.cert.view_dialog = function(spec) {
that.md5_fingerprint = spec.md5_fingerprint || '';
that.sha1_fingerprint = spec.sha1_fingerprint || '';
- var dialog = $('', {
- 'title': that.title
+ that.add_button(IPA.messages.buttons.close, function() {
+ that.close();
});
- var table = $('').appendTo(dialog);
+ that.create = function() {
- var tr = $('
').appendTo(table);
- $(' | ', {
- 'colspan': 2,
- 'html': ''+IPA.messages.objects.cert.issued_to+'
'
- }).appendTo(tr);
+ var table = $('').appendTo(that.container);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.common_name+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.subject.cn
- }).appendTo(tr);
+ var tr = $('
').appendTo(table);
+ $(' | ', {
+ 'colspan': 2,
+ 'html': ''+IPA.messages.objects.cert.issued_to+'
'
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.organization+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.subject.o
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.common_name+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.subject.cn
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.organizational_unit+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.subject.ou
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.organization+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.subject.o
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.serial_number+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.serial_number
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.organizational_unit+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.subject.ou
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(' | ', {
- 'colspan': 2,
- 'html': ''+IPA.messages.objects.cert.issued_by+'
'
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.serial_number+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.serial_number
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.common_name+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.issuer.cn
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(' | ', {
+ 'colspan': 2,
+ 'html': ''+IPA.messages.objects.cert.issued_by+'
'
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.organization+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.issuer.o
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.common_name+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.issuer.cn
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.organizational_unit+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.issuer.ou
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.organization+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.issuer.o
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(' | ', {
- 'colspan': 2,
- 'html': ''+IPA.messages.objects.cert.validity+'
'
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.organizational_unit+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.issuer.ou
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.issued_on+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.issued_on
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(' | ', {
+ 'colspan': 2,
+ 'html': ''+IPA.messages.objects.cert.validity+'
'
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.expires_on+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.expires_on
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.issued_on+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.issued_on
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(' | ', {
- 'colspan': 2,
- 'html': ''+IPA.messages.objects.cert.fingerprints+'
'
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.expires_on+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.expires_on
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.sha1_fingerprint+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.sha1_fingerprint
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(' | ', {
+ 'colspan': 2,
+ 'html': ''+IPA.messages.objects.cert.fingerprints+'
'
+ }).appendTo(tr);
- tr = $('
').appendTo(table);
- $(''+IPA.messages.objects.cert.md5_fingerprint+': | ').appendTo(tr);
- $(' | ', {
- 'html': that.md5_fingerprint
- }).appendTo(tr);
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.sha1_fingerprint+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.sha1_fingerprint
+ }).appendTo(tr);
- that.open = function() {
-
- var buttons = {};
-
- buttons[IPA.messages.buttons.close] = function() {
- dialog.dialog('destroy');
- };
-
- dialog.dialog({
- modal: true,
- width: 600,
- height: 500,
- buttons: buttons
- });
+ tr = $('
').appendTo(table);
+ $(''+IPA.messages.objects.cert.md5_fingerprint+': | ').appendTo(tr);
+ $(' | ', {
+ 'html': that.md5_fingerprint
+ }).appendTo(tr);
};
return that;
@@ -360,57 +314,45 @@ IPA.cert.request_dialog = function(spec) {
spec = spec || {};
- var that = {};
+ var that = IPA.dialog(spec);
+
+ that.width = spec.width || 500;
+ that.height = spec.height || 400;
- that.title = spec.title || '';
that.request = spec.request;
- var dialog = $('', {
- 'title': that.title
+ that.add_button(IPA.messages.buttons.issue, function() {
+ var values = {};
+ var request = that.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);
+ }
+ that.close();
});
- dialog.append(IPA.messages.objects.cert.enter_csr+':');
- dialog.append('
');
- dialog.append('
');
+ that.add_button(IPA.messages.buttons.cancel, function() {
+ that.close();
+ });
- dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
- dialog.append('
');
+ that.create = function() {
+ that.container.append(IPA.messages.objects.cert.enter_csr+':');
+ that.container.append('
');
+ that.container.append('
');
- var textarea = $('', {
- style: 'width: 100%; height: 225px;'
- }).appendTo(dialog);
+ that.container.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
+ that.container.append('
');
- dialog.append('
');
- dialog.append(IPA.cert.END_CERTIFICATE_REQUEST);
+ that.textarea = $('', {
+ style: 'width: 100%; height: 225px;'
+ }).appendTo(that.container);
- that.open = function() {
-
- var buttons = {};
-
- buttons[IPA.messages.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');
- };
-
- buttons[IPA.messages.buttons.cancel] = function() {
- dialog.dialog('destroy');
- };
-
- dialog.dialog({
- modal: true,
- width: 500,
- height: 400,
- buttons: buttons
- });
+ that.container.append('
');
+ that.container.append(IPA.cert.END_CERTIFICATE_REQUEST);
};
return that;
@@ -703,6 +645,7 @@ IPA.cert.status_widget = function(spec) {
'sha1_fingerprint': result['sha1_fingerprint']
});
+ dialog.init();
dialog.open();
}
@@ -725,6 +668,7 @@ IPA.cert.status_widget = function(spec) {
'usercertificate': entity_certificate
});
+ dialog.init();
dialog.open();
}
@@ -755,6 +699,7 @@ IPA.cert.status_widget = function(spec) {
}
});
+ dialog.init();
dialog.open();
}
@@ -791,6 +736,7 @@ IPA.cert.status_widget = function(spec) {
}
});
+ dialog.init();
dialog.open();
}
@@ -823,6 +769,7 @@ IPA.cert.status_widget = function(spec) {
}
});
+ dialog.init();
dialog.open();
}
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index c3efc25a8..1b2f3192a 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -36,6 +36,7 @@ IPA.dialog = function(spec) {
that._entity_name = spec.entity_name;
that.width = spec.width || '400px';
+ that.height = spec.height;
that.buttons = {};
@@ -173,7 +174,11 @@ IPA.dialog = function(spec) {
*/
that.open = function(container) {
- that.container = $('').appendTo(container);
+ that.container = $('');
+
+ if (container) {
+ container.append(that.container);
+ }
if (that.template) {
var template = IPA.get_template(that.template);