filterActions.xts 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/QSRVUITextPL.xml,messages/portal.xml,messages/portalRL.xml" requiredCapability="canUseQueryStudio">
  13. <xts:block id="page" type="exec" mode="output" processor="XSLT" mimeType="text/html" nodelist="env, debug, http, command, system, session, user, actions, tabs, configProps, credential, cookies, setCookies, accountOptions, newSession, gatewayURI, cm:queryResponse, objectClass">
  14. <!-- get the debug logic sheet -->
  15. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  16. <!-- get the new theme stuff -->
  17. <xts:logicsheet path="logicsheets/portal.xsl"/>
  18. <xts:logicsheet path="qs/logicsheets/dialogs.xsl"/>
  19. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  20. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  21. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  22. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  23. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  24. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  25. <!-- apply the form logic -->
  26. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  27. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg qsdlg xtsext">
  28. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  29. <!-- add any theme variables -->
  30. <df:variables/>
  31. <pf:variables/>
  32. <!-- start the output -->
  33. <xsl:template match="/root">
  34. <!--Get HTML output for the HEAD section -->
  35. <dp:page>
  36. <dp:script>
  37. <script type="text/javascript">
  38. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  39. <xsl:text/>//<xsl:text/>
  40. </script>
  41. <script type="text/javascript">
  42. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  43. <xsl:text/>//<xsl:text/>
  44. </script>
  45. <script type="text/javascript">
  46. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CWindowManager.js</xsl:attribute>
  47. <xsl:text/>//<xsl:text/>
  48. </script>
  49. <script type="text/javascript">&lt;!--
  50. var goDialogManager = new CDialogManager();
  51. var cf = getConfigFrame();
  52. function executeOk(evt)
  53. {
  54. if(goDialogManager.isSpaceOrEnterKeyEvent(evt))
  55. {
  56. execute();
  57. }
  58. }
  59. function executeCancel(evt)
  60. {
  61. if(goDialogManager.isSpaceOrEnterKeyEvent(evt))
  62. {
  63. typeof this.cancelDialog == 'function' ? this.cancelDialog() : getConfigFrame().hideDialogFrame();
  64. }
  65. }
  66. function execute()
  67. {
  68. var sValue = "_COMBINED_";
  69. for (var i = 0; i &lt; document.f.fcAction.length; i++)
  70. {
  71. if (document.f.fcAction[i].checked)
  72. {
  73. sValue = document.f.fcAction[i].value;
  74. break;
  75. }
  76. }
  77. if (cf)
  78. {
  79. if (sValue == "_COMBINED_")
  80. {
  81. var oCC = cf.cfgGet("combinedFilters");
  82. var sTab = "";
  83. if (oCC &amp;&amp; oCC.getRawFilter().getSize() > 0) {
  84. sTab = (oCC.getCurrentFilterGroup() == oCC.getSummaryFilter() ? "s": "r");
  85. }
  86. goDialogManager.getFeatureManager().launchFeature('FilterComplex');
  87. }
  88. else if (sValue == "_NEW_")
  89. {
  90. cf.dlgGlobalReset();
  91. cf.setFilterMode(cf.giFILTERCPLXMODE_PRE_WIZARD);
  92. cf.dlgGlobalSetParm("xxNewFilter", true);
  93. goDialogManager.getFeatureManager().launchFeature('FilterSimple');
  94. }
  95. else
  96. {
  97. cf.dlgGlobalReset();
  98. goDialogManager.getFeatureManager().launchFeature('FilterSimple', [sValue]);
  99. }
  100. }
  101. }
  102. function cancelDialog()
  103. {
  104. if (cf)
  105. {
  106. cf.dlgReset();
  107. cf.dlgGlobalReset();
  108. cf.hideDialogFrame();
  109. }
  110. }
  111. function init()
  112. {
  113. attachMouseEvents();
  114. var oCC = null;
  115. var oCCtemp = null;
  116. if (cf &amp;&amp; cf.showDialogFrame)
  117. {
  118. cf.showDialogFrame(300);
  119. oCCtemp = oCC = cf.cfgGet("combinedFilters");
  120. <!-- Use a copy of a combinedFilter objects in case we stick with basic filters. -->
  121. if (!oCCtemp) {
  122. oCCtemp = cf.convertToCombinedFilter();
  123. <!-- replace old 'combinedFilters' -->
  124. cf.cfgSet("combinedFilters", oCC);
  125. }
  126. }
  127. var content = document.getElementById('content');
  128. if (oCCtemp)
  129. {
  130. var sID = null;
  131. var oF = null;
  132. <xsl:for-each select="/root/env/param[@name='xxFilterId']">
  133. sID = "<xsl:value-of select="xtsext:javascriptencode(string(.))"/>";
  134. oF = oCCtemp.getFilterById(sID);
  135. if (oF) { addAction(content,sID,"<xts:string id="FILTER_CHOOSE_FILTER" encode="javascript"/>",oF.getText()); }
  136. </xsl:for-each>
  137. }
  138. addAction(content,"_NEW_","<xts:string id="FILTER_CHOOSE_NEW" encode="javascript"/>", "<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='xxName'])"/>");
  139. addAction(content,"_COMBINED_","<xts:string id="FILTER_CHOOSE_COMBINED" encode="javascript"/>");
  140. document.f.fcAction[0].checked = true;
  141. }
  142. function addAction(oContainer,sValue,sText,sArg0)
  143. {
  144. var table = document.createElement("table");
  145. var tbody = document.createElement("tbody");
  146. var tr = document.createElement("tr");
  147. var td = document.createElement("td");
  148. td.className = "formText";
  149. var radio = document.createElement("input");
  150. radio.type = "radio";
  151. radio.id = "fcAction";
  152. radio.name = "fcAction";
  153. radio.value = sValue;
  154. td.appendChild(radio);
  155. if (sArg0 != null) {
  156. sText = sText.replace(/\^0/g, sArg0);
  157. }
  158. td.appendChild(document.createTextNode(" " + sText));
  159. tr.appendChild(td);
  160. tbody.appendChild(tr);
  161. table.appendChild(tbody);
  162. oContainer.appendChild(table);
  163. if (radio.attachEvent)
  164. {
  165. radio.attachEvent("onmousedown", function(e) {setAction(e.srcElement.value);});
  166. }
  167. else {
  168. radio.addEventListener("mousedown", function(e) {setAction(this.value);}, true);
  169. }
  170. }
  171. function setAction(sValue)
  172. {
  173. for (var i=0; i &lt; document.f.fcAction.length; i++) {
  174. document.f.fcAction[i].checked = (document.f.fcAction[i].value == sValue);
  175. }
  176. }
  177. //--&gt;</script>
  178. </dp:script>
  179. <form style="margin:0px" name="f" method="POST" onsubmit="execute();return false;">
  180. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  181. <tr>
  182. <td width="100%" height="0%">
  183. <!-- dialog header -->
  184. <dp:header help="false">
  185. <!-- header titles -->
  186. <dp:title>
  187. <xts:string id="FILTER_CHOOSE_TITLE"/>
  188. </dp:title>
  189. <!-- close link for the header -->
  190. <dp:close>
  191. <a href="javascript:this.cancelDialog()">
  192. <dp:closeMarker/>
  193. </a>
  194. </dp:close>
  195. <!-- description (hint text) -->
  196. <dp:description>
  197. <xts:string id="FILTER_CHOOSE_DESC"/>
  198. </dp:description>
  199. </dp:header>
  200. </td>
  201. </tr>
  202. <tr>
  203. <td width="100%" height="100%" valign="top">
  204. <!-- layout -->
  205. <lyt:layout style="1" border="no">
  206. <lyt:section id="content">
  207. <dp:input>
  208. <dp:section1>
  209. <xts:string id="FILTER_CHOOSE_LABEL"/>
  210. </dp:section1>
  211. </dp:input>
  212. </lyt:section>
  213. </lyt:layout>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td width="100%" height="0%">
  218. <!-- Use default buttons [ OK = execute() and CANCEL = hideDialogFrame() ] -->
  219. <qsdlg:defaultButtons/>
  220. </td>
  221. </tr>
  222. <!-- <dbg:dumpxml select="/"/> -->
  223. </table>
  224. </form>
  225. </dp:page>
  226. </xsl:template>
  227. </xsl:stylesheet>
  228. </xts:block>
  229. </xts:morphlet>