Fixed adding host without DNS reverse zone

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

Shows status dialog instead of error dialog (error 4304 is treated like success).

Refactored error dialog.
Added generic message dialog (IPA.message_dialog)
Modified core tests to work with dialog.
This commit is contained in:
Petr Vobornik
2011-08-05 17:12:21 +02:00
committed by Endi S. Dewata
parent 966fbd6485
commit 08905eb9a9
6 changed files with 163 additions and 67 deletions

View File

@@ -32,6 +32,7 @@ IPA.dialog = function(spec) {
that.entity = spec.entity;
that.name = spec.name;
that.id = spec.id;
that.title = spec.title;
that.width = spec.width || 400;
that.height = spec.height;
@@ -194,7 +195,7 @@ IPA.dialog = function(spec) {
*/
that.open = function(container) {
that.container = $('<div/>');
that.container = $('<div/>', { id : that.id });
if (container) {
container.append(that.container);
}
@@ -257,6 +258,7 @@ IPA.dialog = function(spec) {
that.dialog_create = that.create;
that.dialog_open = that.open;
that.dialog_close = that.close;
var fields = spec.fields || [];
for (var i=0; i<fields.length; i++) {
@@ -656,3 +658,31 @@ IPA.deleter_dialog = function (spec) {
return that;
};
IPA.message_dialog = function(spec) {
var that = IPA.dialog(spec);
var init = function() {
spec = spec || {};
that.message = spec.message || '';
that.on_ok = spec.on_ok;
};
that.create = function() {
$('<p/>', {
'text': that.message
}).appendTo(that.container);
};
that.add_button(IPA.messages.buttons.ok, function() {
that.close();
if(that.on_ok) {
that.on_ok();
}
});
init();
return that;
};