calculationSummary.xts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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">
  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. <xsl:key name="param-name" match="/root/env/param" use="@name"/>
  33. <!-- start the output -->
  34. <xsl:template match="/root">
  35. <xsl:variable name="dlgAdv" select="key('param-name','xxSummaryDlgAdvanced')"/>
  36. <xsl:variable name="footerOptionTwo" select="key('param-name','xxColType') = 'numeric' or key('param-name','xxColType') = 'interval'"/>
  37. <dp:page>
  38. <dp:script>
  39. <script type="text/javascript">
  40. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  41. <xsl:text/>//<xsl:text/>
  42. </script>
  43. <script type="text/javascript">
  44. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/dialogs/executeButton.js</xsl:attribute>
  45. <xsl:text/>//<xsl:text/>
  46. </script>
  47. <script type="text/javascript">
  48. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  49. <xsl:text/>//<xsl:text/>
  50. </script>
  51. <script type="text/javascript">&lt;!--
  52. var cf = getConfigFrame();
  53. var currentDetailAgg = cf.dlgGlobalGetParm('xxCurrentDetailAgg');
  54. var currentSummaryAgg = cf.dlgGlobalGetParm('xxCurrentSummaryAgg');
  55. var goDialogManager = new CDialogManager();
  56. function execute()
  57. {
  58. var oMQMgr = cf.goApplicationManager.getMiniQueryManager();
  59. var regularAggregation = "none";
  60. var n = cf.cfgSize("SelColumns");
  61. for (var idxCt = 0; idxCt &lt; n; idxCt++)
  62. {
  63. var col = cf.cfgGetAt("SelColumns", idxCt);
  64. regularAggregation = oMQMgr.getRegularAggregate(col);
  65. }
  66. var detailAgg = "none";
  67. var footerAgg = "none";
  68. if ("<xsl:value-of select="xtsext:javascriptencode(string($dlgAdv))"/>" == "true")
  69. {
  70. if (cf.dlgGlobalGetParm("CanUseCellAggregation") == true)
  71. {
  72. if(document.f.cells[0].checked == true)
  73. detailAgg = "calculated";
  74. else if(document.f.cells[1].checked == true)
  75. detailAgg = document.f.detailAggType[document.f.detailAggType.selectedIndex].value;
  76. }
  77. else if(currentDetailAgg != 'none')
  78. {
  79. detailAgg = currentDetailAgg;
  80. }
  81. if(document.f.footers[1].checked == true)
  82. footerAgg = "calculated";
  83. else if(document.f.footers[2].checked == true)
  84. footerAgg = document.f.summaryAggType[document.f.summaryAggType.selectedIndex].value;
  85. }
  86. else
  87. {
  88. if(currentDetailAgg != 'none')
  89. detailAgg = currentDetailAgg;
  90. if(document.f.footerSummaries.checked == true)
  91. {
  92. if(currentSummaryAgg != 'none')
  93. footerAgg = currentSummaryAgg;
  94. if(regularAggregation != 'none')
  95. {
  96. footerAgg = regularAggregation;
  97. }
  98. else
  99. {
  100. footerAgg = "default";
  101. }
  102. }
  103. }
  104. getConfigFrame().doSummary(footerAgg, detailAgg);
  105. }
  106. function updateDlgLists(selection)
  107. {
  108. if ((selection == "none" || selection == "count" || selection == "countDistinct") &amp;&amp; cf.dlgGlobalGetParm("xxIsMeasure") == "nonMeasuresOnly")
  109. getConfigFrame().summarizeNonMeasure(selection);
  110. }
  111. function advancedDlg(toAdvancedMode)
  112. {
  113. getConfigFrame().summarize(toAdvancedMode);
  114. }
  115. function validateOption(colType, turnOn)
  116. {
  117. if (colType == "cells")
  118. document.f.detailAggType.disabled = !turnOn;
  119. else
  120. document.f.summaryAggType.disabled = !turnOn;
  121. }
  122. function createNewOptAddToSelect(optStr, optType, currentAgg, selectObj)
  123. {
  124. var newOpt = new Option(optStr, optType);
  125. if (cf.dlgGlobalGetParm(currentAgg) == optType)
  126. newOpt.selected = true;
  127. selectObj.options[selectObj.options.length] = newOpt;
  128. }
  129. function init()
  130. {
  131. attachMouseEvents();
  132. var select;
  133. if (cf.dlgGlobalGetParm("CanUseCellAggregation") == true)
  134. {
  135. select = document.f.detailAggType;
  136. if (typeof select == "object")
  137. {
  138. var detailAggTypeOptions = cf.dlgGlobalGetParm("xxDetailAggTypeOptions");
  139. if (cf.dlgGlobalGetParm("xxCurrentDetailAgg") == 'mixed')
  140. {
  141. var newOpt = new Option("", "mixed");
  142. newOpt.selected = true;
  143. select.options[select.options.length] = newOpt;
  144. }
  145. for (var i=0; i &lt; detailAggTypeOptions.length; i++)
  146. {
  147. createNewOptAddToSelect(detailAggTypeOptions[i].text, detailAggTypeOptions[i].value, "xxCurrentDetailAgg", select);
  148. }
  149. }
  150. }
  151. select = document.f.summaryAggType
  152. if (typeof select == "object")
  153. {
  154. if (cf.dlgGlobalGetParm("xxShowMixed") == true)
  155. {
  156. var newOpt = new Option("", "mixed");
  157. newOpt.selected = true;
  158. select.options[select.options.length] = newOpt;
  159. }
  160. var summaryAggTypeOptions = cf.dlgGlobalGetParm("xxSummaryAggTypeOptions");
  161. for (var i=0; i &lt; summaryAggTypeOptions.length; i++)
  162. {
  163. setTimeout('createNewOptAddToSelect("'+summaryAggTypeOptions[i].text+'", "'+summaryAggTypeOptions[i].value+'", "xxCurrentSummaryAgg", document.f.summaryAggType);', (1+i)*5);
  164. }
  165. }
  166. if ("<xsl:value-of select="xtsext:javascriptencode(string($dlgAdv))"/>" == "true")
  167. {
  168. if (cf.dlgGlobalGetParm("CanUseCellAggregation") == true)
  169. {
  170. if (currentDetailAgg == 'calculated')
  171. {
  172. document.f.cells[0].checked = true;
  173. document.f.detailAggType.disabled = true;
  174. }
  175. else
  176. {
  177. document.f.cells[1].checked = true;
  178. }
  179. }
  180. if (currentSummaryAgg == 'calculated' || currentSummaryAgg == 'none')
  181. {
  182. if (currentSummaryAgg == 'none')
  183. document.f.footers[0].checked = true;
  184. else if (currentSummaryAgg == 'calculated')
  185. document.f.footers[1].checked = true;
  186. document.f.summaryAggType.disabled = true;
  187. }
  188. else
  189. {
  190. document.f.footers[2].checked = true;
  191. }
  192. if (cf.dlgGlobalGetParm("xxDisableAdvLink") != true)
  193. {
  194. var adv = document.getElementById("advLink");
  195. adv.href = "javascript:advancedDlg(false)";
  196. adv.appendChild(document.createTextNode("<xts:string id="DIALOG_BASIC" encode="javascript"/>"));
  197. }
  198. }
  199. else
  200. {
  201. if (currentSummaryAgg != 'none')
  202. document.f.footerSummaries.checked = true;
  203. if (cf.dlgGlobalGetParm("xxDisableAdvLink") != true)
  204. {
  205. var adv = document.getElementById("advLink");
  206. adv.href = "javascript:advancedDlg(true)";
  207. adv.appendChild(document.createTextNode("<xts:string id="DIALOG_ADVANCED" encode="javascript"/>"));
  208. }
  209. }
  210. if (cf &amp;&amp; cf.showDialogFrame)
  211. cf.showDialogFrame(<xsl:choose>
  212. <xsl:when test="$dlgAdv ='true' and /root/env/param[@name='CanUseCellAggregation']='false'">270</xsl:when>
  213. <xsl:when test="$dlgAdv ='true'">395</xsl:when>
  214. <xsl:otherwise>220</xsl:otherwise>
  215. </xsl:choose>);
  216. }
  217. //--&gt;</script>
  218. </dp:script>
  219. <form style="margin:0px" name="f" method="POST" onsubmit="return false;">
  220. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  221. <tr>
  222. <td width="100%" height="0%">
  223. <!-- dialog header -->
  224. <dp:header help="false">
  225. <!-- header titles -->
  226. <dp:title>
  227. <xsl:choose>
  228. <xsl:when test="$dlgAdv ='true'">
  229. <xts:string id="SUMMARY_TITLE_ADVANCED"/>
  230. </xsl:when>
  231. <xsl:otherwise>
  232. <xts:string id="SUMMARY_TITLE"/>
  233. </xsl:otherwise>
  234. </xsl:choose>
  235. </dp:title>
  236. <!-- close link for the header -->
  237. <dp:close>
  238. <a href="javascript:getConfigFrame().hideDialogFrame()">
  239. <dp:closeMarker/>
  240. </a>
  241. </dp:close>
  242. <!-- description (hint text) -->
  243. <dp:description>
  244. <xsl:choose>
  245. <xsl:when test="$dlgAdv='false' or /root/env/param[@name='CanUseCellAggregation']='false'">
  246. <xts:string id="SUMMARY_CALCULATE_DESCRIPTION_NO_CELLS"/>
  247. </xsl:when>
  248. <xsl:otherwise>
  249. <xts:string id="SUMMARY_CALCULATE_DESCRIPTION"/>
  250. </xsl:otherwise>
  251. </xsl:choose>
  252. </dp:description>
  253. <!-- header links -->
  254. <dp:headerLinks>
  255. <dp:headerLink>
  256. <dp:hl_attribute name="id">advLink</dp:hl_attribute>
  257. </dp:headerLink>
  258. </dp:headerLinks>
  259. </dp:header>
  260. </td>
  261. </tr>
  262. <tr>
  263. <td width="100%" height="100%" valign="top">
  264. <!-- layout -->
  265. <lyt:layout style="1" border="no">
  266. <lyt:section height="100">
  267. <xsl:choose>
  268. <xsl:when test="$dlgAdv='true'">
  269. <xsl:if test="/root/env/param[@name='CanUseCellAggregation']='true'">
  270. <dp:choice>
  271. <dp:section1>
  272. <table height="100%">
  273. <tr>
  274. <td valign="top">
  275. <img>
  276. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/summarize_cell_list.gif</xsl:attribute>
  277. </img>
  278. </td>
  279. </tr>
  280. </table>
  281. </dp:section1>
  282. <dp:section2>
  283. <dp:choice title="SUMMARY_CELL_VALUES">
  284. <dp:section1>
  285. <input type="radio" name="cells" value="1" onClick="validateOption('cells', false);"/>
  286. </dp:section1>
  287. <dp:section2>
  288. <xts:string id="SUMMARY_SUMMARIZE_FIRST"/>
  289. </dp:section2>
  290. <dp:section1>
  291. <input type="radio" name="cells" value="2" onClick="validateOption('cells', true);"/>
  292. </dp:section1>
  293. <dp:section2>
  294. <xts:string id="SUMMARY_CALCULATE_FIRST"/>
  295. </dp:section2>
  296. <dp:section1/>
  297. <dp:section2>
  298. <dp:input>
  299. <dp:section1>
  300. <xts:string id="SUMMARY_FOR_CELLS"/>
  301. </dp:section1>
  302. <dp:section2>
  303. <select name="detailAggType" onChange="updateDlgLists(this.options[this.selectedIndex].value)"/>
  304. </dp:section2>
  305. </dp:input>
  306. </dp:section2>
  307. </dp:choice>
  308. </dp:section2>
  309. </dp:choice>
  310. </xsl:if>
  311. <dp:choice>
  312. <dp:section1>
  313. <table height="100%">
  314. <tr>
  315. <td valign="top">
  316. <img>
  317. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/summarize_footer_list.gif</xsl:attribute>
  318. </img>
  319. </td>
  320. </tr>
  321. </table>
  322. </dp:section1>
  323. <dp:section2>
  324. <dp:choice title="SUMMARY_FOOTERS">
  325. <dp:section1>
  326. <input type="radio" name="footers" value="1" onClick="validateOption('footers', false);"/>
  327. </dp:section1>
  328. <dp:section2>
  329. <xts:string id="SUMMARY_NO_SUMMARY"/>
  330. </dp:section2>
  331. <xsl:if test="$footerOptionTwo">
  332. <dp:section1>
  333. <input type="radio" name="footers" value="2" onClick="validateOption('footers', false);"/>
  334. </dp:section1>
  335. <dp:section2>
  336. <xts:string id="SUMMARY_SUMMARIZE_FIRST"/>
  337. </dp:section2>
  338. </xsl:if>
  339. <dp:section1>
  340. <xsl:if test="$footerOptionTwo = false()">
  341. <input type="radio" name="footers" value="2" style="display:none;"/>
  342. </xsl:if>
  343. <input type="radio" name="footers" value="3" onClick="validateOption('footers', true);"/>
  344. </dp:section1>
  345. <dp:section2>
  346. <xts:string id="SUMMARY_CALCULATE_FIRST"/>
  347. </dp:section2>
  348. <dp:section1/>
  349. <dp:section2>
  350. <dp:input>
  351. <dp:section1>
  352. <xts:string id="SUMMARY_FOR_FOOTERS"/>
  353. </dp:section1>
  354. <dp:section2>
  355. <select name="summaryAggType"/>
  356. </dp:section2>
  357. </dp:input>
  358. </dp:section2>
  359. </dp:choice>
  360. </dp:section2>
  361. </dp:choice>
  362. </xsl:when>
  363. <xsl:otherwise>
  364. <img>
  365. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/summarize_footer_list.gif</xsl:attribute>
  366. </img>
  367. <dp:choice>
  368. <dp:section1>
  369. <input type="checkbox" name="footerSummaries"/>
  370. </dp:section1>
  371. <dp:section2>
  372. <xts:string id="SUMMARY_SHOW_SUMMARIES"/>
  373. </dp:section2>
  374. </dp:choice>
  375. </xsl:otherwise>
  376. </xsl:choose>
  377. </lyt:section>
  378. </lyt:layout>
  379. </td>
  380. </tr>
  381. <tr>
  382. <td width="100%" height="0%">
  383. <!-- Use default buttons [ OK = execute() and CANCEL = hideDialogFrame() ] -->
  384. <qsdlg:defaultButtons/>
  385. </td>
  386. </tr>
  387. <!-- <dbg:dumpxml select="/"/> -->
  388. </table>
  389. </form>
  390. </dp:page>
  391. </xsl:template>
  392. </xsl:stylesheet>
  393. </xts:block>
  394. </xts:morphlet>