Commit 4186b830 authored by bbaer's avatar bbaer
Browse files

added method createError, made all errors modal

parent de6db3e6
......@@ -378,6 +378,17 @@ var QfqNS = QfqNS || {};
this.bsTabs = bsTabs;
};
n.QfqForm.prototype.createError = function(message) {
var messageButtons = [{
label: "Ok",
eventName: 'close'
}];
var alert = new n.Alert(message, "error");
alert.isModal = true;
alert.buttons = messageButtons;
alert.show();
};
/**
* @private
*/
......@@ -387,8 +398,7 @@ var QfqNS = QfqNS || {};
}
if (obj.data.status === "error") {
var alert = new n.Alert(obj.data.message, "error");
alert.show();
this.createError(obj.data.message);
return;
}
......@@ -420,8 +430,7 @@ var QfqNS = QfqNS || {};
}
if (obj.data.status === "error") {
var alert = new n.Alert(obj.data.message, "error");
alert.show();
this.createError(obj.data.message);
return;
}
......@@ -487,9 +496,8 @@ var QfqNS = QfqNS || {};
}
if (data.status === "error") {
var alert = new n.Alert("Error while updating form:<br>" + (data.message ? data.message : "No reason" +
" given"), "error");
alert.show();
this.createError("Error while updating form:<br>" +
(data.message ? data.message : "No reason given"));
return;
}
......@@ -721,8 +729,7 @@ var QfqNS = QfqNS || {};
}
if (data.redirect === "no") {
var alert = new n.Alert("redirect=='no' not allowed", "error");
alert.show();
this.createError("redirect=='no' not allowed");
return;
}
......@@ -745,8 +752,7 @@ var QfqNS = QfqNS || {};
if (!data.message) {
throw Error("Status is 'error' but required 'message' attribute is missing.");
}
var alert = new n.Alert(data.message, "error");
alert.show();
this.createError(data.message);
this.setButtonEnabled(this.getDeleteButton(), false);
};
......@@ -881,8 +887,7 @@ var QfqNS = QfqNS || {};
if (!data.message) {
throw Error("Status is 'error' but required 'message' attribute is missing.");
}
var alert = new n.Alert(data.message, "error");
alert.show();
this.createError(data.message);
if (data["field-name"] && this.bsTabs) {
var tabId = this.bsTabs.getContainingTabIdForFormControl(data["field-name"]);
......@@ -904,8 +909,7 @@ var QfqNS = QfqNS || {};
this.setButtonEnabled(this.getDeleteButton(), false);
this.formImmutableDueToConcurrentAccess = true;
this.lockAcquired = false;
var alert = new n.Alert(data.message, "error");
alert.show();
this.createError(data.message);
};
n.QfqForm.prototype.handleOverrideableConflict = function (form, data) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment