123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: ps
- //
- // (C) Copyright IBM Corp. 2005, 2018
- //
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- // Copyright (C) 2008 Cognos Incorporated. All rights reserved.
- // Cognos and the Cognos logo are trademarks of Cognos Incorporated.
- function init() {
- if (g_PS_isQS == 'true') {
- // For Query Studio, we want to open the dialog frame to display the error
- // However, if we're running a QS command (ie at startup or a executing a runspec), it doesn't need to be opened because
- // the error will be displayed in the main window.
- if (parent
- && typeof parent.showDialogFrame == "function"
- && typeof parent.goApplicationManager == "object"
- && ! parent.goApplicationManager.getReportManager().isCommandRunning())
- {
- parent.showDialogFrame(300);
- }
- }
- }
- function processCommand(cmd) {
- switch (cmd) {
- case 'ok' : doCommandOK(); break;
- case 'cancel' : doCommandOK(); break;
- case 'close' : doCommandOK(); break;
- case 'help' : help(); break;
- }
- }
- function doCommandOK() {
- if (g_PS_isQS == 'true') {
- if (parent && typeof parent.errorExit == "function") {
- parent.errorExit();
- }
- } else {
- if (g_PS_isModal == 'true') {
- modalExit();
- } else if (g_PS_errURL != '') {
- errURLExit();
- } else if (_isClassicViewerPerspective()) {
- _classicViewerExit();
- } else {
- defaultExit();
- }
- }
- }
-
- function defaultExit()
- {
- if (history.length > g_PS_emptyHistoryThreshold)
- history.back();
- // try to close a win32 window if we appear inside of one
- else if (window.external && window.external.HasOnClose)
- window.external.OnClose(1);
- else
- window.close();
- }
- function _classicViewerExit()
- {
- if (history.length > g_PS_emptyHistoryThreshold) {
- var currContentView = _getCurrContentView();
- if (currContentView) {
- window.top.__glassAppController.closeAppView(currContentView.perspective, currContentView.id);
- }
- else
- history.back();
- }
- // try to close a win32 window if we appear inside of one
- else if (window.external && window.external.HasOnClose)
- window.external.OnClose(1);
- else
- window.close();
- }
-
- function modalExit()
- {
- <!-- Set the right call back target -->
- if (g_PS_callBackTargetJSVar) {
- g_PS_callBackTargetJSVar.ccModalCallBack('error', null); <!-- TODO: add error details in the call back -->
- }
- }
-
- function errURLExit()
- {
- if (g_PS_errURLTooLong == 'true' && document.errURLForm) {
- document.errURLForm.submit();
- } else if (_isClassicViewerPerspective()) {
- _errURLClassicViewerExit();
- } else {
- location.href = g_PS_errURL;
- }
- }
- function _errURLClassicViewerExit()
- {
- var currContentView = _getCurrContentView();
- window.top.__glassAppController.closeAppView(currContentView.perspective, currContentView.id);
- }
- function _getCurrContentView()
- {
- if (window.top.__glassAppController) {
- return window.top.__glassAppController.getCurrentContentView();
- }
- return null;
- }
- function _isClassicViewerPerspective()
- {
- var currContentView = _getCurrContentView();
- return (currContentView && currContentView.perspective === 'classicviewer') ? true : false;
- }
|