/* *+------------------------------------------------------------------------+ *| 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 WorkingDialog( cognosViewer ) { if (cognosViewer) { this.m_bSimpleWorkingDialog = false; this.m_bShowCancelButton = (cognosViewer.getAdvancedServerProperty("VIEWER_JS_HIDE_CANCEL_BUTTON") == "true") ? false : true; WorkingDialog.baseConstructor.call( this, cognosViewer ); this.m_secondaryRequests = cognosViewer.getSecondaryRequests(); } } WorkingDialog.prototype = new ViewerBaseWorkingDialog(); WorkingDialog.baseConstructor = ViewerBaseWorkingDialog; WorkingDialog.prototype.setSecondaryRequests = function( aSecRequests ) { this.m_secondaryRequests = aSecRequests; } WorkingDialog.prototype._getSecondaryRequests = function(){ return this.m_secondaryRequests; }; WorkingDialog.prototype.getIsSavedReport = function() { return this.getCognosViewer().bIsSavedReport; }; /** * Required only by lineage action. * TODO: ideally, the lineage action class need not set this flag but * can be figured out based on the cognos viewer object */ WorkingDialog.prototype.setSimpleWorkingDialogFlag = function( flag ) { this.m_bSimpleWorkingDialog = flag; }; WorkingDialog.prototype.getSimpleWorkingDialogFlag = function() { return this.m_bSimpleWorkingDialog; }; /** * Will hide/show the delivery options toolbar buttons within the wait page * @param bShow (boolean) Boolean which dictates whether to show the delivery option toolbar buttons */ WorkingDialog.prototype.showDeliveryOptions = function(bShow) { var namespace = this.getNamespace(); var htmlElement = document.getElementById("DeliveryOptionsVisible" + namespace); if (htmlElement) { htmlElement.style.display = (bShow === false ? "none" : "block"); if (bShow) { var links = htmlElement.getElementsByTagName("a"); for (var i=links.length; i > 0; i--) { if (links[i] && links[i].getAttribute("tabIndex") == "0") { links[i].focus(); } } } } htmlElement = document.getElementById("OptionsLinkSelected" + namespace); if (htmlElement) { htmlElement.style.display = (bShow === false ? "none" : "block"); } htmlElement = document.getElementById("OptionsLinkUnselected" + namespace); if (htmlElement) { htmlElement.style.display = (bShow === false ? "block" : "none"); } }; WorkingDialog.prototype.renderHTML = function() { var sNamespace = this.getNamespace(); var ariaLabelledby = sNamespace + '_workingMsg ' + sNamespace + '_workingMsg2'; var html = ''; html += ('' + '' + '' + ''); return html; }; WorkingDialog.prototype.renderFirstInnerTable = function() { var bSimpleWaitPage = this.getSimpleWorkingDialogFlag(); var workingMsg = bSimpleWaitPage ? RV_RES.GOTO_WORKING : RV_RES.RV_RUNNING; var sNamespace = this.m_sNamespace; var output = '' + '' + ''; return output; }; WorkingDialog.prototype.optionLinkSelectedDiv = function() { var sbOutput = ''; sbOutput += ''; return sbOutput; }; WorkingDialog.prototype.optionLinkUnselectedDiv = function() { var sbOutput = ''; var sNamespace = this.getNamespace(); var sWaitPageObject = 'window.oCV' + sNamespace + '.getWorkingDialog()'; sbOutput += '
'; sbOutput += ''; sbOutput += RV_RES.RV_BUSY_OPTIONS_UNSELECTED; sbOutput += '
'; sbOutput += ''; sbOutput += RV_RES.RV_BUSY_OPTIONS_LINK; sbOutput += '
'; return sbOutput; }; WorkingDialog.prototype.canShowDeliveryOptions = function() { var sAction = this.getCognosViewer().envParams['ui.primaryAction']; if( 'saveAs' !== sAction && 'email' !== sAction && this.getIsSavedReport() ) { return true; } return false; }; WorkingDialog.prototype.isUIBlacklisted = function( item ) { var aUIBlacklist = this.getUIBlacklist(); for( var index in aUIBlacklist ) { if( aUIBlacklist[index] === item ) { return true; } } return false; }; WorkingDialog.prototype.getUIBlacklist = function() { if( !this.m_UIBlacklist && this.getCognosViewer().UIBlacklist ) { this.m_UIBlacklist = this.getCognosViewer().UIBlacklist.split( ' ' ); } return this.m_UIBlacklist; }; WorkingDialog.prototype.deliverySectionIsNeeded = function() { return !this._isSaveBlackListed() || !this._isSaveAsBlackListed() || !this._isEmailBlackListed(); }; WorkingDialog.prototype._isSaveBlackListed = function() { return this.isUIBlacklisted("RV_TOOLBAR_BUTTONS_SAVE") || this.isUIBlacklisted("RV_WORKING_DIALOG_SAVE") || !this._hasSecondaryRequest("save"); }; WorkingDialog.prototype._isSaveAsBlackListed = function() { return this.isUIBlacklisted("RV_TOOLBAR_BUTTONS_SAVEAS") || this.isUIBlacklisted("RV_WORKING_DIALOG_SAVEAS") || !this._hasSecondaryRequest("saveAs"); }; WorkingDialog.prototype._isEmailBlackListed = function() { return this.isUIBlacklisted("RV_TOOLBAR_BUTTONS_SEND") || this.isUIBlacklisted("RV_WORKING_DIALOG_SEND") || !this._hasSecondaryRequest("email"); }; WorkingDialog.prototype.showCancelButton = function() { return this.m_bShowCancelButton; }; WorkingDialog.prototype._hasSecondaryRequest = function(request) { var secondaryRequests = this._getSecondaryRequests(); if (secondaryRequests) { var arrayLength = secondaryRequests.length; for (var i = 0; i < arrayLength; i++) { if (secondaryRequests[i] == request) { return true; } } } return false; }; WorkingDialog.prototype.renderSecondInnerTable = function() { var sbOutput = ''; var sWebRoot = this.getCognosViewer().getWebContentRoot(); sbOutput += ''; sbOutput += ''; sbOutput += ' '; sbOutput += ' '; sbOutput += ' '; sbOutput += '
'; sbOutput += ''; var bCanShowDeliveryOptions = this.canShowDeliveryOptions(); if( bCanShowDeliveryOptions && this.deliverySectionIsNeeded() ) { if (!this._isSaveBlackListed()) { sbOutput += this.addDeliverOption('/rv/images/action_save_report_output.gif', RV_RES.RV_SAVE_REPORT, 'SaveReport(true);'); } if( 'reportView' !== this.getCognosViewer().envParams['ui.objectClass'] && !this._isSaveAsBlackListed() ) { sbOutput += this.addDeliverOption('/rv/images/action_save_report_view.gif', RV_RES.RV_SAVE_AS_REPORT_VIEW, 'SaveAsReportView(true);'); } if( !this.isUIBlacklisted('CC_RUN_OPTIONS_EMAIL_ATTACHMENT') && !this._isEmailBlackListed()) { sbOutput += this.addDeliverOption('/rv/images/action_send_report.gif', RV_RES.RV_EMAIL_REPORT, 'SendReport(true);'); } } sbOutput += '
'; if(this.showCancelButton()){ sbOutput += this.addCancelButton(); } sbOutput += '
'; return sbOutput; }; WorkingDialog.prototype.addDeliverOption = function( sImage, sText, sOptionHandler ) { var sbOutput = ''; var sWebRoot = this.getCognosViewer().getWebContentRoot(); var sRvObject = 'javascript: window.oCV' + this.getNamespace() + '.getRV().'; var s_onClick = sRvObject + sOptionHandler; sbOutput += ' '; sbOutput += ' '; sbOutput += ' ' + html_encode(sText) + ' '; sbOutput += ' '; sbOutput += ' '; sbOutput += ( sText + ''); return sbOutput; }; WorkingDialog.prototype.addCancelButton = function() { var sbOutput = ''; var sWebContent = this.getCognosViewer().getWebContentRoot(); sbOutput += ' '; sbOutput += ' '; sbOutput += '
'; sbOutput += ' '; sbOutput += ' '; sbOutput += '
'; return sbOutput; }; WorkingDialog.prototype.disableCancelButton = function(cancelLink) { this.cancelButtonDisabled = true; var workingDialogTable = document.getElementById('cvWorkingDialog' + this.getNamespace()); if (workingDialogTable) { workingDialogTable.style.cursor="default"; workingDialogTable.className = "commandButtonOver"; workingDialogTable.removeAttribute("onmouseover"); workingDialogTable.removeAttribute("onmouseout"); } if (cancelLink) { cancelLink.removeAttribute("href"); cancelLink.removeAttribute("onclick"); cancelLink.style.cursor="default"; } }; WorkingDialog.prototype.enableCancelButton = function() { if (this.cancelButtonDisabled) { var cancelButtonContainer = document.getElementById("cancelButtonContainer" + this.getNamespace()); if (cancelButtonContainer) { cancelButtonContainer.innerHTML = this.addCancelButton(); } this.cancelButtonDisabled = false; } }; WorkingDialog.prototype.getContainerId = function() { return "CVWait" + this.getNamespace(); };