|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
经常有网友在坛子里问如何修改cognos默认的等待界面,之前我也在8.3下实现了,对默认等待和报错界面的修改,但是代码的入侵性较高,也有网友反映不好用。下午有看了一下,改写了一下cognos viewer所用的js文件,只是将默认的等待界面改了,出错界面还没有处理。
修改后的默认等待如下

如果CognosViewer的入口是CGI方式,请求的是c8_location\webcontent\rv文件夹下的文件
如果入口时Servlet方式是则请求的是c8_location\webapps\p2pd\rv文件夹下的文件
我是以p2pd为例,方法如下:
打开c8_location\webapps\p2pd\rv\CCognosViewer.js
首次生成的等待页面时调用的是processResponseState 函数
CCognosViewer.prototype.processResponseState = function(oState)
{
this.setStatus(oState.status);
this.setConversation(oState.conversation);
this.setTracking(oState.tracking);
this.setCAFContext(oState.caf);
this.setExecutionParameters(oState.parameters);
this.setSecondaryRequests(oState.secondaryRequests);
this.setSessionPrompts(oState.session_prompts);
this.setActionState(oState.action_state);
if(typeof oState.clientunencodedexecutionparameters != "undefined")
{
var formWarpRequest = document.getElementById("formWarpRequest" + this.getId());
if(formWarpRequest != null && typeof formWarpRequest["clientunencodedexecutionparameters"] != "undefined")
{
formWarpRequest["clientunencodedexecutionparameters"].value = oState.clientunencodedexecutionparameters;
}
if(typeof document.forms["formWarpRequest"] != "undefined" && typeof document.forms["formWarpRequest"]["clientunencodedexecutionparameters"] != "undefined")
{
document.forms["formWarpRequest"]["clientunencodedexecutionparameters"].value = oState.clientunencodedexecutionparameters;
}
}
if (oState.sResponseSpecification)
{
this.updateResponseSpecification(oState.sResponseSpecification);
}
if(typeof this.envParams != "undefined")
{
this.envParams["ui.primaryAction"] = oState.primary_action;
}
if(this.getStatus() == "complete")
{
this.m_undoStack.push(new CognosViewerSession(this));
}
//fengdong modify this to change default wait page
var oReportDiv = document.getElementById("CVReport" + this.getId());
if (oState.status == "working" || oState.status == "stillWorking" || oState.status == "default")
{
if (oState.status == "working" || oState.status == "default")
{
if (typeof oReportDiv != 'undefined' && oReportDiv != null)
{
var divs = oReportDiv.getElementsByTagName("DIV");
var hidDiv;
for(var i=0; i< divs.length; i++)
{
if(divs.className == "body_dialog_modal")
{
hidDiv = divs;
hidDiv.style.display = "none";
hidDiv.parentNode.parentNode.parentNode.parentNode.style.borderStyle = "none";
hidDiv.parentNode.innerHTML = "<img src='../rv/load_back.gif'/>" + hidDiv.parentNode.innerHTML;
break;
}
}
}
this.m_waitPage.show(this.bIsSavedReport);
}
// add a delay for this callback to allow the server request to clean up, and not block any futher server requests
setTimeout("oCV"+this.getId()+".executeCallback(\"wait\");",10);
}
else if(oState.status == "cancel")
{
this.executeCallback("cancel");
}
else if (oState.status == "fault")
{
this.setSoapFault(oState.soapFault);
this.m_waitPage.hide();
this.executeCallback("fault");
}
else
{
if (oState.status != "prompting" || !this.executeCallback("prompt"))
{
if (this.rvMainWnd)
{
this.writeNavLinks(oState.secondaryRequests.join(" "));
this.updateLayout(oState.status);
var oToolbar = this.rvMainWnd.getToolbar();
if (oToolbar)
{
this.rvMainWnd.updateToolbar(oState.outputFormat);
oToolbar.draw();
}
var oBannerToolber = this.rvMainWnd.getBannerToolbar();
if (oBannerToolber)
{
oBannerToolber.draw();
}
}
this.m_waitPage.hide();
this.executeCallback("done");
}
}
if (typeof oReportDiv != 'undefined' && oReportDiv != null)
{
oReportDiv.style.display = '';
}
};
找到createWaitPageDiv 方法,该方法是创建等待框的DVI,通过改写其DIV的生成内容实现对默认界面的修改
WaitPage.prototype.createWaitPageDiv = function(bSavedReport)
{
var oWaitDiv = document.createElement("DIV");
oWaitDiv.setAttribute("id", "CVWait" + this.getNamespace());
oWaitDiv.style.position = "absolute";
oWaitDiv.style.textAlign = "center";
oWaitDiv.style.zIndex = 100;
document.body.appendChild(oWaitDiv);
try
{
oWaitDiv.innerHTML = "<img src='../rv/load_back.gif'/><div style='display:none'>" + this.m_sHTML + "</div>";
}
catch (oExcpt) {}
return oWaitDiv;
};
将代码中红色的部分替换过去,再将等待的gif图片放到rv文件夹即可。
我将代码和图片上传到了论坛上,附件中包含了CCognosViewer.js和图片
如果用cgi方式将rv文件夹覆盖到c8_location\webcontent文件夹下
如果用servlet方式则将rv文件夹覆盖到c8_location\webapps\p2pd文件夹下
|
|