help.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /********************************************************************************************************************************
  2. * Licensed Materials - Property of IBM *
  3. * *
  4. * IBM Cognos Products: AGS *
  5. * *
  6. * (C) Copyright IBM Corp. 2005, 2018 *
  7. * *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
  9. *********************************************************************************************************************************/
  10. //help and table of contents
  11. var HELP_CONTENTS_DEFAULT="ug_cr_es_a";
  12. //the help page with no table of contents
  13. var HELP_CONTENTS_WITH_HID="ug_cr_es";
  14. var QUICK_TOUR = "estour";
  15. var ES_GETTING_STARTED = "wig_cr_a";
  16. var ES_VIEW_CONTENTS = "ug_cr_es_a";
  17. /*
  18. document.onkeydown = test;
  19. function test(event) {
  20. if (window.event.keyCode==112) {
  21. alert(window.event.srcElement.outerHTML);
  22. window.event.cancelBubble=true;
  23. window.event.returnValue = false;
  24. }
  25. }
  26. */
  27. document.onhelp = parent.viewCSHelp;
  28. //Help->Help
  29. //fire the context sensitive help from the application menu bar
  30. function viewHelp() {
  31. //viewCSHelp('');
  32. // online link only as Help is not packaged
  33. getOnlineHelp();
  34. }
  35. function getOnlineHelp(topic) {
  36. //viewCSHelp('');
  37. var locale = "en";
  38. if (productLocale) {
  39. locale = productLocale;
  40. }
  41. // online link only as Help is not packaged
  42. var helpFilePrefix = "http://www.ibm.com/support/knowledgecenter/"; //The ES Help url, now hosted on IBM Knowledge Center.
  43. var helpFileSuffix = "SSEP7J_11.0.0/com.ibm.swg.ba.cognos.ug_cr_es.doc/";
  44. var _helpTopic = "c_ug_cr_es_wlcm.html";
  45. if(topic != null){
  46. _helpTopic = topic;
  47. }
  48. var helpFileFullURL = helpFilePrefix + helpFileSuffix + _helpTopic;
  49. openHelp(helpFileFullURL);
  50. }
  51. //Help->Contents
  52. function viewContents()
  53. {
  54. var locale = "en";
  55. if (productLocale) {
  56. locale = productLocale;
  57. }
  58. var helpTopic = '/c_event_studio.html#event_studio';
  59. getOnlineHelp( helpTopic );
  60. }
  61. //Help->Quick Tour
  62. function viewTour()
  63. {
  64. var locale;
  65. //set the locale
  66. if (productLocale) {
  67. locale = productLocale;
  68. }
  69. gotoTours(locale, QUICK_TOUR);
  70. }
  71. //Help->Contents
  72. function viewGetStarted()
  73. {
  74. var locale = "en";
  75. if (productLocale) {
  76. locale = productLocale;
  77. }
  78. gotoHelp( locale, ES_GETTING_STARTED, "" );
  79. }
  80. //Help->Cognos on the Web
  81. function onTheWeb()
  82. {
  83. var sFeatures = "toolbar=yes,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=750";
  84. sURL = "http://www-01.ibm.com/software/data/cognos";
  85. windowHelp = window.open(sURL, "Cognos_on_the_Web", sFeatures);
  86. windowHelp.focus();
  87. }
  88. //Help->About
  89. function showAbout() {
  90. dlgReset();
  91. //st in form vars
  92. initialiseDialog();
  93. dlgSetParm("m", '/ags/about.xts');
  94. dlgSetParm('popUpWidth',"658");
  95. dlgSetParm('popUpHeight',"511");
  96. dlgSubmit("popUpFrame");
  97. }
  98. //context sensitive help
  99. function viewCSHelp(hid)
  100. {
  101. var found = false;
  102. var locale = "en";
  103. var helpIndex = '';
  104. var helpFile=HELP_CONTENTS_WITH_HID;
  105. //assign the help index if one has been passed to this function
  106. if (hid && hid.length > 0) {
  107. helpIndex = hid;
  108. found=true;
  109. }
  110. //loop through the forms in the message frame
  111. //we are looking for a hidden input called 'hid' which defines
  112. //the help context
  113. else {
  114. helpIndex = getHelpId();
  115. if (helpIndex != '') {
  116. found = true;
  117. }
  118. }
  119. //set the locale
  120. if (productLocale) {
  121. locale = productLocale;
  122. }
  123. //no help id has been found so show the table of contents and introduction
  124. if (!found) {
  125. helpFile = HELP_CONTENTS_DEFAULT;
  126. }
  127. //alert("locale:"+locale+",file:"+helpFile+",id:"+helpIndex);
  128. //load the help page
  129. gotoHelp( locale,helpFile,helpIndex);
  130. //prevent the default windows explorer help file from loading
  131. if (window.event) {
  132. window.event.cancelBubble=true;
  133. window.event.returnValue = false;
  134. }
  135. return false;
  136. }
  137. //get the help id from the message frame form with the name 'hid'
  138. //return the help id or an empty string if it does not exist
  139. function getHelpId() {
  140. var popupFrame;
  141. var msgFrame = getMessageIFrame();
  142. var msgDoc = getFrameDocument(msgFrame);
  143. var forms = msgDoc.forms;
  144. var helpIndex = '';
  145. var found = false;
  146. //firstly check if the modal popup is visible and has an available hid
  147. if (typeof popUpIsOpen == "function" && popUpIsOpen() == true) {
  148. //alert('found open popup');
  149. popupFrame = document.frames['popUpFrame'];
  150. popupForm = popupFrame.pform;
  151. //check if the popup frame has a hid otherwise we will use the message frame hid
  152. if (popupForm != undefined && popupForm.hid) {
  153. //assign the forms available in the popup
  154. forms = popupFrame.document.forms;
  155. }
  156. }
  157. //loop through the forms. We are looking for a hidden input called 'hid' which defines the help context
  158. for (var i=0;i<forms.length;i++) {
  159. var form = forms[i];
  160. //loop through the controls in the form
  161. for (var j=0;(j<form.length && !found);j++) {
  162. var control = form.elements[j];
  163. if (control.getAttribute('type')=='hidden' && control.name=='hid') {
  164. helpIndex = control.value;
  165. found=true;
  166. }
  167. }
  168. }
  169. return helpIndex;
  170. }