Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions src/webui/www_source/config/js/cp_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ showNewFirmwareDownload = function() {
CreateCPPopup("/config/cp_maintenance.cgi", "downloadOnly=1");
};

CreateCPPopup = function(src, pb) {
dlgPopup = new cpMessageBox(src, pb);
CreateCPPopup = function(src, pb, errorLbl) {
dlgPopup = new cpMessageBox(src, pb, errorLbl);

PopupClose = function() {
dlgPopup.close();
Expand Down Expand Up @@ -100,7 +100,7 @@ cpMessageBox = Class.create();

cpMessageBox.prototype =
{
initialize: function(src, pb)
initialize: function(src, pb, errorLbl)
{
if ( $('messagebox') ){
$("messagebox").hide();
Expand All @@ -112,7 +112,7 @@ cpMessageBox.prototype =
this.setWidth(800);

this.createMessagebox();
this.LoadFromFile(src, pb);
this.LoadFromFile(src, pb, errorLbl);
},

getViewPortDim : function()
Expand Down Expand Up @@ -236,22 +236,39 @@ cpMessageBox.prototype =
this.removeMessagebox();
},

LoadFromFile: function(src, pb) {
LoadFromFile: function(src, pb, errorLbl) {
var url = src;
if(url.indexOf('?sid=') === -1)
{
url = url+'?sid='+SessionId;
}
var t = this;
var showLoadError = function(statusText) {
$('centerbox').hide();
$('trlayer').hide();
if(typeof errorLbl != 'undefined') {
MessageBox.show(translateKey('lblError'), translateKey(errorLbl), '', 480,120);
} else {
Ajax_failure(url, statusText);
}
};
var opt =
{
method: 'post',
evalScripts: true,
postBody: pb,
sendXML: false,
onComplete: function(trans) {
// Prototype treats status 0 (e.g. a network error) as success and does not call onFailure
if(trans.status == 0) {
showLoadError(trans.statusText);
return;
}
centerMessageBox();
$('messagebox').style.display="";
},
onFailure: function(response) {
showLoadError(response.statusText);
}
};
new Ajax.Updater('messagebox',url,opt);
Expand Down