faultlogin.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: ps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2013
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. // Copyright (C) 2008 Cognos Incorporated. All rights reserved.
  9. // Cognos and the Cognos logo are trademarks of Cognos Incorporated.
  10. function init()
  11. {
  12. if (document.pform != null) {
  13. <!-- Give focus to the first visible control -->
  14. var nFormFields = document.pform.elements.length;
  15. for (var i=0; i < nFormFields; i++) {
  16. if( document.pform.elements[i].type != 'hidden' ) {
  17. //Handle a timing error in IE which can prevent setting the focus
  18. //the timeout is set to 750m specifically to ensure that the jaws screen reader virtual
  19. //cursor and the visible cusrsor does not get out of sync.
  20. setTimeout('document.pform.elements[' + i + '].focus()',750);
  21. break;
  22. }
  23. }
  24. }
  25. if(document.getElementById('cmdOK')) {
  26. if (document.getElementById('cmdOK').offsetWidth < 70) {
  27. document.getElementById('cmdOK').style.width = '4.9em';
  28. }
  29. }
  30. if(document.getElementById('cmdCancel')) {
  31. if (document.getElementById('cmdCancel').offsetWidth < 70) {
  32. document.getElementById('cmdCancel').style.width = '4.9em';
  33. }
  34. }
  35. cmdOK_enable();
  36. return true;
  37. }
  38. function processCommand(cmd) {
  39. switch (cmd) {
  40. case 'ok' : doCommandOK(); break;
  41. case 'cancel' : doCloseAction('cancel'); break;
  42. case 'close' : doCloseAction('close'); break;
  43. case 'help' : help(); break;
  44. case 'yes' :
  45. case 'no' :
  46. if (g_PS_isPasswordResetConfirmation) {
  47. g_PS_enablePasswordResetAction = (cmd == 'yes') ? true : false;
  48. doCommandOK();
  49. }
  50. break;
  51. }
  52. }
  53. function doCloseAction(event)
  54. {
  55. if (g_PS_externalBack != '') {
  56. setTimeout("document.location.href = g_PS_externalBack", 100);
  57. } else if (g_PS_isModal == 'true') {
  58. <!-- Set the right call back target -->
  59. if (g_PS_callBackTargetJSVar) {
  60. g_PS_callBackTargetJSVar.ccModalCallBack(event, null); <!-- TODO: add error details in the call back -->
  61. }
  62. } else if (g_PS_errURL != '') {
  63. errURLExit();
  64. } else {
  65. if (parent && parent.closeErrorPage)
  66. parent.closeErrorPage();
  67. else if (window.external && window.external.HasOnClose) {
  68. window.external.OnClose(1);
  69. return;
  70. } else if (window.opener) {
  71. try {
  72. if (window.opener.closePSLogin){
  73. window.opener.closePSLogin();
  74. return;
  75. }
  76. } catch (e){
  77. window.close();
  78. return;
  79. }
  80. }
  81. if (g_PS_isCloseMorphlet)
  82. window.close();
  83. else if ( history.length > g_PS_emptyHistoryThreshold )
  84. history.back();
  85. else
  86. window.close();
  87. }
  88. }
  89. function validate()
  90. {
  91. <!-- Only care to validate a password change. If that is the case then do it, otherwise, return true. -->
  92. if (document.pform.elements[g_PS_sVerifyTextNoEcho]) {
  93. if (document.pform.elements[g_PS_sVerifyTextNoEcho][0].value != document.pform.elements[g_PS_sVerifyTextNoEcho][1].value) {
  94. alert(g_PS_msg_PasswordVerifyFailed);
  95. return false;
  96. }
  97. }
  98. if (g_PS_isPasswordResetConfirmation) {
  99. if (document.pform.elements["CAMChangePwd"]) {
  100. document.pform.elements["CAMChangePwd"].value = g_PS_enablePasswordResetAction ? "true" : "false";
  101. }
  102. }
  103. return true;
  104. }
  105. function doCommandOK() {
  106. if (validate()) {
  107. if (typeof g_PS_mvc_enabled != "undefined" && g_PS_mvc_enabled) {
  108. mvcDoSimultaneousLogin(document.pform); // MVC
  109. } else {
  110. document.pform.submit();
  111. }
  112. cmdOK_disable();
  113. return true;
  114. }
  115. else {
  116. return false;
  117. }
  118. }
  119. function cmdOK_enable()
  120. {
  121. g_PS_cmdOK_enabled = true;
  122. if (document.getElementById('cmdOK')) {
  123. document.getElementById('cmdOK').disabled = false;
  124. }
  125. }
  126. function cmdOK_disable()
  127. {
  128. g_PS_cmdOK_enabled = false;
  129. if (document.getElementById('cmdOK')) {
  130. document.getElementById('cmdOK').disabled = true;
  131. }
  132. }
  133. function cmdOK_isEnabled()
  134. {
  135. return g_PS_cmdOK_enabled;
  136. }
  137. function errURLExit()
  138. {
  139. if (g_PS_errURLTooLong == 'true' && document.errURLForm) {
  140. document.errURLForm.submit();
  141. } else {
  142. location.href = g_PS_errURL;
  143. }
  144. }