123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Viewer
- *| (C) Copyright IBM Corp. 2013
- *|
- *| US Government Users Restricted Rights - Use, duplication or
- *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *|
- *+------------------------------------------------------------------------+
- */
-
- function ViewerBaseWorkingDialog( cognosViewer )
- {
- if( !cognosViewer )
- {
- return;
- }
-
- this.setCognosViewer( cognosViewer );
- this.m_oCV = cognosViewer;
- this.m_sNamespace = cognosViewer.getId();
- this.m_sGateway = cognosViewer.getGateway();
- this.m_UIBlacklist = null;
- this.m_bUse = true;
- this.m_bCancelSubmitted = false;
- }
- ViewerBaseWorkingDialog.prototype = new IRequestIndicator();
-
- ViewerBaseWorkingDialog.prototype.setCognosViewer = function(oCV)
- {
- this.m_oCV = oCV;
- };
- ViewerBaseWorkingDialog.prototype.getCognosViewer = function()
- {
- return this.m_oCV;
- };
-
- ViewerBaseWorkingDialog.prototype.getGateway = function()
- {
- return this.m_sGateway;
- };
- /**
- * Returns the unique namespace
- * @return (string)
- */
- ViewerBaseWorkingDialog.prototype.getNamespace = function()
- {
- return this.m_sNamespace;
- };
-
- /**
- * Used by lineage action.
- * TODO: should be deprecated when moving to new framework. This is specific to lineage action and is
- * used to suppress fault response if the request is cancelled. This should be handled
- * outside of this class.
- * the wait page when getting lineage
- * @deprecated
- */
- ViewerBaseWorkingDialog.prototype.cancelSubmitted = function()
- {
- return this.m_bCancelSubmitted;
- };
- /**
- * @deprecated - see comments for cancelSubmitted().
- */
- ViewerBaseWorkingDialog.prototype.setCancelSubmitted = function(bSubmitted)
- {
- this.m_bCancelSubmitted = bSubmitted;
- };
- /**
- * Will initialize and draw the wait page. This method should be used to render the page
- */
- ViewerBaseWorkingDialog.prototype.show = function()
- {
- var waitPageContainer = document.getElementById(this.getContainerId());
- if(waitPageContainer) {
- waitPageContainer.style.display = "block";
- this.enableCancelButton();
- } else {
- this.create();
- }
- var blocker = document.getElementById("reportBlocker" + this.m_oCV.getId());
- if (blocker) {
- blocker.style.display = "block";
- }
- };
-
- /**
- * Initializes the wait page div
- * @private
- */
- ViewerBaseWorkingDialog.prototype.create = function()
- {
- if (typeof document.body != "undefined") {
- if(this.isModal()) {
- this.createModalWaitDialog();
- } else {
- this.createInlineWaitDialog();
- }
- }
- };
- ViewerBaseWorkingDialog.prototype.createContainer = function(isModal) {
- var waitPageContainer = document.createElement("div");
- waitPageContainer.setAttribute("id", this.getContainerId());
- waitPageContainer.className = isModal ? "modalWaitPage" : "inlineWaitPage";
- return waitPageContainer;
- };
- ViewerBaseWorkingDialog.prototype.createModalWaitDialog = function(){
- this._createBlocker();
-
- var waitPageContainer = this.createContainer(true);
- waitPageContainer.innerHTML = this.renderHTML();
- waitPageContainer.style.zIndex = "7002";
- waitPageContainer.setAttribute("role", "region");
- waitPageContainer.setAttribute("aria-label", RV_RES.GOTO_WORKING);
- document.body.appendChild(waitPageContainer);
- var iframeBackground = this.createModalIframeBackground();
- document.body.appendChild(iframeBackground);
-
-
- var iBottom = 0;
- var iLeft = 0;
- if (typeof window.innerHeight != "undefined") {
- iBottom = Math.round((window.innerHeight/2) - (waitPageContainer.offsetHeight/2));
- iLeft = Math.round((window.innerWidth/2) - (waitPageContainer.offsetWidth/2));
- }
- else {
- iBottom = Math.round((document.body.clientHeight/2) - (waitPageContainer.offsetHeight/2));
- iLeft = Math.round((document.body.clientWidth/2) - (waitPageContainer.offsetWidth/2));
- }
- waitPageContainer.style.bottom = iBottom + "px";
- waitPageContainer.style.left = iLeft + "px";
- iframeBackground.style.left = iLeft - 1 + "px";
- iframeBackground.style.bottom = iBottom - 1 + "px";
- iframeBackground.style.width = waitPageContainer.offsetWidth + 2 + "px";
- iframeBackground.style.height = waitPageContainer.offsetHeight + 2 + "px";
- };
- ViewerBaseWorkingDialog.prototype._createBlocker = function() {
- var blocker = document.getElementById("reportBlocker" + this.m_oCV.getId());
- if (blocker) {
- return;
- }
-
- var mainTd = document.getElementById("mainViewerTable" + this.m_oCV.getId());
- if (mainTd) {
- blocker = document.createElement("div");
- mainTd.parentNode.appendChild(blocker);
-
- blocker.id = "reportBlocker" + this.m_oCV.getId();
- blocker.style.zIndex = "6001";
- blocker.style.position = "absolute";
- blocker.style.top = "0px";
- blocker.style.left = "0px";
- blocker.style.width = "100%";
- blocker.style.height = "100%";
- blocker.style.display = "none";
- blocker.style.opacity = "0";
- blocker.style.backgroundColor = "#FFFFFF";
- blocker.style.filter = "alpha(opacity:0)";
- }
- };
- ViewerBaseWorkingDialog.prototype.createInlineWaitDialog = function(){
- var sNamespace = this.m_oCV.getId();
- var cvReportDiv = document.getElementById("CVReport" + sNamespace);
- if(cvReportDiv) {
- var waitPageContainer = this.createContainer(false);
- waitPageContainer.innerHTML = "<table width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" align=\"center\" role=\"presentation\">" + this.renderHTML() + "</td></tr></table>";
- cvReportDiv.appendChild(waitPageContainer);
- }
- };
- /**
- * Builds the wait page hidden iframe (used so the wait page draws over iframes)
- * @param bSavedReport (boolean) Indicates whether or not the wait page should render the delivery options
- * @private
- */
- ViewerBaseWorkingDialog.prototype.createModalIframeBackground = function()
- {
- var hiddenIframe = document.createElement("iframe");
- var sWebContentRoot = "..";
- var oCV = this.getCognosViewer();
- if (oCV !== null)
- {
- sWebContentRoot = oCV.getWebContentRoot();
- }
- hiddenIframe.setAttribute("id", this.getContainerId() + "Iframe");
- hiddenIframe.setAttribute("title", "Empty iframe");
- hiddenIframe.setAttribute("src",sWebContentRoot + '/common/images/spacer.gif');
- hiddenIframe.setAttribute("scrolling",'no');
- hiddenIframe.setAttribute("frameborder",'0');
- hiddenIframe.style.position="absolute";
- hiddenIframe.style.zIndex="6002";
- hiddenIframe.style.display="block";
- return hiddenIframe;
- };
- ViewerBaseWorkingDialog.prototype.updateCoords = function(waitPageDiv, waitPageIFrame)
- {
- if(this.m_container !== null && m_iframeBackground !== null) {
- // position the wait page in the middle of the report
- var iBottom = 0;
- var iLeft = 0;
- if (typeof window.innerHeight != "undefined") {
- iBottom = Math.round((window.innerHeight/2) - (waitPageDiv.offsetHeight/2));
- iLeft = Math.round((window.innerWidth/2) - (waitPageDiv.offsetWidth/2));
- }
- else {
- iBottom = Math.round((document.body.clientHeight/2) - (waitPageDiv.offsetHeight/2));
- iLeft = Math.round((document.body.clientWidth/2) - (waitPageDiv.offsetWidth/2));
- }
-
- waitPageDiv.style.bottom = iBottom + "px";
- waitPageDiv.style.left = iLeft + "px";
-
- waitPageIFrame.style.left = waitPageDiv.style.left;
- waitPageIFrame.style.bottom = waitPageDiv.style.bottom;
- waitPageIFrame.style.width = waitPageDiv.offsetWidth + "px";
- waitPageIFrame.style.height = waitPageDiv.offsetHeight + "px";
- }
- };
- /**
- * Will hide the wait page
- */
- ViewerBaseWorkingDialog.prototype.hide = function()
- {
- var waitPageContainer = document.getElementById(this.getContainerId());
- if(waitPageContainer) {
- waitPageContainer.parentNode.removeChild(waitPageContainer);
- }
- var waitIframe = document.getElementById(this.getContainerId() + "Iframe");
- if(waitIframe) {
- waitIframe.parentNode.removeChild(waitIframe);
- }
-
- var blocker = document.getElementById("reportBlocker" + this.m_oCV.getId());
- if (blocker) {
- blocker.parentNode.removeChild(blocker);
- }
- };
- ViewerBaseWorkingDialog.prototype.isModal = function() {
- var sNamespace = this.m_oCV.getId();
- var cvReportDiv = document.getElementById("CVReport" + sNamespace);
- var isModal = true;
- if(cvReportDiv && cvReportDiv.innerHTML === "") {
- isModal = false;
- }
-
- return isModal;
- };
- ViewerBaseWorkingDialog.prototype.disableCancelButton = function(cancelLink) {};
- ViewerBaseWorkingDialog.prototype.enableCancelButton = function() {};
-
-
|