/**
* Class BX.Scale.ActionResultDialog
*/
;(function(window) {
if (BX.Scale.ActionResultDialog) return;
/**
* Class BX.Scale.ActionResultDialog
* @constructor
*/
BX.Scale.ActionResultDialog = function (params)
{
this.dialogWindow = null;
this.result = params.result;
this.actionName = params.actionName;
this.pageRefresh = params.pageRefresh;
};
BX.Scale.ActionResultDialog.prototype.buildContent = function()
{
var result = "";
if(this.result.ACTION_RESULT)
{
result = "
";
result += "| "+BX.message("SCALE_PANEL_JS_ARD_NAME")+
" | "+BX.message("SCALE_PANEL_JS_ARD_RESULT")+
" | "+BX.message("SCALE_PANEL_JS_ARD_MESSAGE")+
" |
";
for(var actId in this.result.ACTION_RESULT)
{
var message = "",
actionResult = this.result.ACTION_RESULT[actId];
if(actionResult.ERROR)
message += actionResult.ERROR;
else if(actionResult.OUTPUT && actionResult.OUTPUT.DATA && actionResult.OUTPUT.DATA.message)
message = actionResult.OUTPUT.DATA.message;
result += "";
result += "| "+this.result.ACTION_RESULT[actId].NAME+" | ";
if(actionResult.RESULT == "OK")
result += "OK | ";
else
result += ""+BX.message("SCALE_PANEL_JS_ERROR")+" | ";
result += ""+BX.util.htmlspecialchars(message)+" | ";
result += "
";
}
result += "
";
}
return result;
};
BX.Scale.ActionResultDialog.prototype.show = function()
{
var content = this.buildContent();
BX.Scale.currentActionResultDialogContext = this;
var btnClose = BX.CAdminDialog.btnClose;
if(this.pageRefresh)
{
btnClose.action = function ()
{
this.parentWindow.Close();
BX.Scale.AdminFrame.waitForPageRefreshing();
window.location.reload(true);
};
}
this.dialogWindow = new BX.CDialog({
title: BX.message("SCALE_PANEL_JS_ARD_RES"),
content: content,
resizable: true,
height: 500,
width: 600,
buttons: [ btnClose ]
});
this.dialogWindow.Show();
this.dialogWindow.adjustSizeEx();
};
})(window);