showStandalonePrompts.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE HTML>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: Viewer
  5. (C) Copyright IBM Corp. 2001, 2011
  6. US Government Users Restricted Rights - Use, duplication or
  7. disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <html>
  10. <head>
  11. <title>&nbsp;</title>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  13. <meta name="Copyright" content="(C) Copyright IBM Corporation and its licensors 2001, 2015.">
  14. <meta name="Trademark" content="IBM, the IBM logo, and Cognos are trademarks of IBM Corp., registered in many jurisdictions worldwide.">
  15. <meta name="Trademark" content="Cognos and the Cognos logo are trademarks of Cognos Incorporated.">
  16. <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
  17. <script type="text/javascript" src="../common/framework/notification/CObserver.js"></script>
  18. <script type="text/javascript" src="../common/framework/util/CDictionary.js"></script>
  19. <script type="text/javascript" src="./common.js"></script>
  20. <script type="text/javascript" src="./CCognosViewerUtilities.js"></script>
  21. <script type="text/javascript" src="./viewer.standalone.core.js"></script>
  22. <script type="text/javascript">
  23. <!--
  24. var sLocation = document.location.search;
  25. var cvId = "";
  26. if (sLocation.match(/\bcv\.id=([^&?]*)/))
  27. {
  28. cvId = RegExp.$1;
  29. }
  30. window.viewerId = cvId;
  31. var gAsynchRequest = window.parent["AsynchRequestObject"];
  32. var gScriptLoader = new CScriptLoader(gAsynchRequest.m_webContentRoot);
  33. window["oCV" + cvId] = new CCognosViewer(cvId, gAsynchRequest.m_gateway);
  34. // set the conversation - needed by a tree prompt to expand the tree nodes
  35. window["oCV" + cvId].setConversation(gAsynchRequest.getConversation());
  36. // hijack the send request, and redirect back to the asynch request object with the prompt values
  37. window["oCV" + cvId].dispatchRequest = function(request) {
  38. var promptParameters = {};
  39. var aParameters = request.getFormFields().keys();
  40. for (var idxParameter = 0; idxParameter < aParameters.length; idxParameter++) {
  41. if(aParameters[idxParameter].indexOf("p_") == 0) {
  42. promptParameters[aParameters[idxParameter]] = request.getFormField(aParameters[idxParameter]);
  43. }
  44. }
  45. gAsynchRequest.promptPageOkCallback(promptParameters);
  46. };
  47. window["oCV" + cvId].cancel = function() {
  48. gAsynchRequest.promptPageCancelCallback({});
  49. };
  50. window["oCVSC" + cvId] = new CSelectionController(cvId, window["oCV" + cvId]);
  51. function isIE() {
  52. return (navigator.userAgent.indexOf('MSIE') != -1 || navigator.userAgent.indexOf('Trident') != -1);
  53. }
  54. function showPromptPage() {
  55. try {
  56. var form = document.createElement("form");
  57. form.setAttribute("action", "");
  58. form.setAttribute("id", "formWarpRequest" + window.viewerId);
  59. form.setAttribute("name", "formWarpRequest" + window.viewerId);
  60. form.setAttribute("method", "POST");
  61. form.style.height = "100%";
  62. form.style.margin = "0px";
  63. document.body.appendChild(form);
  64. var promptDiv = document.createElement("div");
  65. promptDiv.setAttribute("id", "promptDiv");
  66. form.appendChild(promptDiv);
  67. var sHtml = gAsynchRequest.getPromptHTMLFragment();
  68. sHtml = gScriptLoader.loadCSS(sHtml, promptDiv, false);
  69. if (isIE()) {
  70. // IE specific 'fix' where if sHTML has script tags at the beginning they won't be loaded into the DOM. Adding
  71. // a valid tag first causes all subsequent scripts to be loaded into the DOM.
  72. sHtml = "<span style='display:none'>&nbsp;</span>" + sHtml;
  73. }
  74. promptDiv.innerHTML = sHtml;
  75. gScriptLoader.loadAll(promptDiv, null, window.viewerId, false);
  76. // add the tracking information to the form where the prompting toolkit looks for it
  77. var oTracking = document.createElement("input");
  78. oTracking.setAttribute("type", "hidden");
  79. oTracking.setAttribute("name", "m_tracking");
  80. oTracking.setAttribute("value", gAsynchRequest.getTracking());
  81. document.getElementById("formWarpRequest").appendChild(oTracking);
  82. } catch(exception) {
  83. if (console) {
  84. console.log("error: %o", exception);
  85. }
  86. }
  87. };
  88. function gVWEvent(sId, evt, sEvent) {
  89. var oCV = window['oCV' + sId];
  90. if (oCV && typeof oCV.getViewerWidget != "undefined") {
  91. var iWidget = oCV.getViewerWidget();
  92. if (iWidget) {
  93. iWidget[sEvent](evt);
  94. }
  95. }
  96. }
  97. //-->
  98. </script>
  99. </head>
  100. <body onload="showPromptPage();">
  101. </body>
  102. </html>