| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: ps
- //
- // (C) Copyright IBM Corp. 2005, 2013
- //
- // 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 (document.pform != null) {
- <!-- Give focus to the first visible control -->
- var nFormFields = document.pform.elements.length;
- for (var i=0; i < nFormFields; i++) {
- if( document.pform.elements[i].type != 'hidden' ) {
- //Handle a timing error in IE which can prevent setting the focus
- //the timeout is set to 750m specifically to ensure that the jaws screen reader virtual
- //cursor and the visible cusrsor does not get out of sync.
- setTimeout('document.pform.elements[' + i + '].focus()',750);
- break;
- }
- }
- }
-
- if(document.getElementById('cmdOK')) {
- if (document.getElementById('cmdOK').offsetWidth < 70) {
- document.getElementById('cmdOK').style.width = '4.9em';
- }
- }
- if(document.getElementById('cmdCancel')) {
- if (document.getElementById('cmdCancel').offsetWidth < 70) {
- document.getElementById('cmdCancel').style.width = '4.9em';
- }
- }
-
- cmdOK_enable();
- return true;
- }
- function processCommand(cmd) {
- switch (cmd) {
- case 'ok' : doCommandOK(); break;
- case 'cancel' : doCloseAction('cancel'); break;
- case 'close' : doCloseAction('close'); break;
- case 'help' : help(); break;
- case 'yes' :
- case 'no' :
- if (g_PS_isPasswordResetConfirmation) {
- g_PS_enablePasswordResetAction = (cmd == 'yes') ? true : false;
- doCommandOK();
- }
- break;
- }
- }
-
- function doCloseAction(event)
- {
- if (g_PS_externalBack != '') {
- setTimeout("document.location.href = g_PS_externalBack", 100);
- } else if (g_PS_isModal == 'true') {
- <!-- Set the right call back target -->
- if (g_PS_callBackTargetJSVar) {
- g_PS_callBackTargetJSVar.ccModalCallBack(event, null); <!-- TODO: add error details in the call back -->
- }
- } else if (g_PS_errURL != '') {
- errURLExit();
- } else {
- if (parent && parent.closeErrorPage)
- parent.closeErrorPage();
- else if (window.external && window.external.HasOnClose) {
- window.external.OnClose(1);
- return;
- } else if (window.opener) {
- try {
- if (window.opener.closePSLogin){
- window.opener.closePSLogin();
- return;
- }
- } catch (e){
- window.close();
- return;
- }
- }
-
- if (g_PS_isCloseMorphlet)
- window.close();
- else if ( history.length > g_PS_emptyHistoryThreshold )
- history.back();
- else
- window.close();
- }
-
- }
-
- function validate()
- {
- <!-- Only care to validate a password change. If that is the case then do it, otherwise, return true. -->
- if (document.pform.elements[g_PS_sVerifyTextNoEcho]) {
- if (document.pform.elements[g_PS_sVerifyTextNoEcho][0].value != document.pform.elements[g_PS_sVerifyTextNoEcho][1].value) {
- alert(g_PS_msg_PasswordVerifyFailed);
- return false;
- }
- }
-
- if (g_PS_isPasswordResetConfirmation) {
- if (document.pform.elements["CAMChangePwd"]) {
- document.pform.elements["CAMChangePwd"].value = g_PS_enablePasswordResetAction ? "true" : "false";
- }
- }
-
- return true;
- }
- function doCommandOK() {
- if (validate()) {
- if (typeof g_PS_mvc_enabled != "undefined" && g_PS_mvc_enabled) {
- mvcDoSimultaneousLogin(document.pform); // MVC
- } else {
- document.pform.submit();
- }
- cmdOK_disable();
- return true;
- }
- else {
- return false;
- }
- }
- function cmdOK_enable()
- {
- g_PS_cmdOK_enabled = true;
- if (document.getElementById('cmdOK')) {
- document.getElementById('cmdOK').disabled = false;
- }
- }
- function cmdOK_disable()
- {
- g_PS_cmdOK_enabled = false;
- if (document.getElementById('cmdOK')) {
- document.getElementById('cmdOK').disabled = true;
- }
- }
- function cmdOK_isEnabled()
- {
- return g_PS_cmdOK_enabled;
- }
- function errURLExit()
- {
- if (g_PS_errURLTooLong == 'true' && document.errURLForm) {
- document.errURLForm.submit();
- } else {
- location.href = g_PS_errURL;
- }
- }
|