dialogs.xsl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  14. xmlns:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/"
  15. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  16. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  17. xmlns:out="dummy-uri"
  18. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  19. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  20. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  21. <pf:variables/>
  22. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  23. <xsl:template match="qsdlg:buttons">
  24. <table cellspacing="0" cellpadding="1" border="0">
  25. <tr>
  26. <xsl:apply-templates/>
  27. </tr>
  28. </table>
  29. </xsl:template>
  30. <xsl:template match="qsdlg:button">
  31. <dp:button>
  32. <a href="{./qsdlg:href}">
  33. <span class="commandButtonActive">
  34. <xts:string id="{./qsdlg:text}"/>
  35. </span>
  36. </a>
  37. </dp:button>
  38. </xsl:template>
  39. <xsl:template match="qsdlg:defaultOKButton">
  40. <dp:footer>
  41. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:executeCancel(event)" df:href="javascript:executeCancel(null)" df:defaultKey="active"/>
  42. </dp:footer>
  43. </xsl:template>
  44. <xsl:template match="qsdlg:defaultOKUpgradeModelButton">
  45. <dp:footer>
  46. <df:button df:id="IDS_OK" df:style="href" id="executeButton" df:href="javascript:getConfigFrame().upgradeModelCancel()" df:defaultKey="active"/>
  47. </dp:footer>
  48. </xsl:template>
  49. <xsl:template match="qsdlg:defaultOKCloseLinkButton">
  50. <dp:footer>
  51. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:getConfigFrame().defaultCloseLinkButton(event)" df:href="javascript:getConfigFrame().defaultCloseLinkButton(null)" df:defaultKey="active"/>
  52. </dp:footer>
  53. </xsl:template>
  54. <xsl:template match="qsdlg:promptOKCloseLinkButton">
  55. <dp:footer>
  56. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:getConfigFrame().promptCloseLinkButton(event)" df:href="javascript:getConfigFrame().promptCloseLinkButton(null)" df:defaultKey="active"/>
  57. </dp:footer>
  58. </xsl:template>
  59. <xsl:template match="qsdlg:defaultFormatNumButtons">
  60. <dp:footer>
  61. <span id="formatOK">
  62. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:executeOk(event)" df:href="javascript:executeOk(null)" df:defaultKey="active"/>
  63. </span>
  64. <df:button df:id="IDS_CANCEL" df:style="href" onkeypress="javascript:executeCancel(event)" df:href="javascript:executeCancel(null)"/>
  65. </dp:footer>
  66. </xsl:template>
  67. <xsl:template match="qsdlg:defaultButtons">
  68. <dp:footer>
  69. <xsl:choose>
  70. <xsl:when test="@preventActive">
  71. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:executeOk(event)" df:href="javascript:executeOk(null)"/>
  72. </xsl:when>
  73. <xsl:otherwise>
  74. <df:button df:id="IDS_OK" df:style="href" id="executeButton" onkeypress="javascript:executeOk(event)" df:href="javascript:executeOk(null)" df:defaultKey="active"/>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. <df:button df:id="IDS_CANCEL" df:style="href" onkeypress="javascript:executeCancel(event)" df:href="javascript:executeCancel(null)"/>
  78. </dp:footer>
  79. </xsl:template>
  80. <xsl:template match="qsdlg:option">
  81. <xsl:variable name="paramSel" select="ancestor::node()[@selectedParam]/@selectedParam"/>
  82. <option value="{./qsdlg:value}">
  83. <!-- Add a <xsl:if> to set "selected" value if it's the selected option -->
  84. <xsl:if test="$paramSel">
  85. <xsl:element name="xsl:if">
  86. <xsl:attribute name="test"><xsl:value-of select="$paramSel"/>='<xsl:value-of select="./qsdlg:value"/>'</xsl:attribute>
  87. <xsl:element name="xsl:attribute">
  88. <xsl:attribute name="name">selected</xsl:attribute>
  89. </xsl:element>
  90. </xsl:element>
  91. </xsl:if>
  92. <xsl:choose>
  93. <xsl:when test="./qsdlg:label">
  94. <xts:string id="{./qsdlg:label}"/>
  95. </xsl:when>
  96. <xsl:otherwise>
  97. <xsl:value-of select="./qsdlg:value"/>
  98. </xsl:otherwise>
  99. </xsl:choose>
  100. </option>
  101. </xsl:template>
  102. <xsl:template match="qsdlg:promptBox">
  103. <span nocOnly="disabled">
  104. <dp:choice>
  105. <!-- add a xsl:attribute to the generated XSL -->
  106. <xsl:element name="xsl:attribute">
  107. <xsl:attribute name="name">style</xsl:attribute>border:1px solid #999999;</xsl:element>
  108. <dp:section1>
  109. <input type="checkbox" name="promptBox" id="promptBox"/>
  110. </dp:section1>
  111. <dp:section2>
  112. <div style="padding:3px;">
  113. <label for="promptBox"><xts:string id="DIALOG_PROMPT"/></label>
  114. </div>
  115. </dp:section2>
  116. </dp:choice>
  117. </span>
  118. </xsl:template>
  119. <xsl:template match="qsdlg:conditionBox">
  120. <out:choose>
  121. <out:when test="/root/system/param[@name='enableFilterNOT']='true'">
  122. <dp:input>
  123. <dp:section1>
  124. <xts:string id="FILTER_CONDITION"/>
  125. </dp:section1>
  126. <dp:section2>
  127. <select name="oExcludeSelectedValues">
  128. <option value="false"><xts:string id="FILTER_SHOW_ONLY"/></option>
  129. <option value="true"><xts:string id="FILTER_DO_NOT_SHOW"/></option>
  130. </select>
  131. </dp:section2>
  132. </dp:input>
  133. </out:when>
  134. <out:otherwise>
  135. <dp:input>
  136. <dp:section1>
  137. <xts:string id="FILTER_SHOW_ONLY_WITH_COLON"/>
  138. </dp:section1>
  139. <dp:section2/>
  140. </dp:input>
  141. </out:otherwise>
  142. </out:choose>
  143. </xsl:template>
  144. <xsl:template match="qsdlg:nullOptions">
  145. <div id="QsdlgHiddenNullOptions" style="padding-left:6px; padding-top:2px; display:none;">
  146. <table border="0" cellpadding="0" cellspacing="0">
  147. <tr onclick="showNullOptions(true)">
  148. <td class="formText">
  149. <a href="#"><xts:string id="MISSINGVALUES_LINK"/></a>
  150. </td>
  151. <td align="left">
  152. <img border="0" width="3" height="1">
  153. <out:attribute name="src"><out:value-of select="$webRoot"/>/common/images/spacer.gif</out:attribute>
  154. </img>
  155. </td>
  156. <td>
  157. <img border="0">
  158. <out:attribute name="src"><out:value-of select="$qsdlgskin"/>/prompting/images/prompt_option_expand.gif</out:attribute>
  159. </img>
  160. </td>
  161. </tr>
  162. </table>
  163. <table border="0" cellpadding="0" cellspacing="0" style="padding-top:2px;">
  164. <tr>
  165. <td class="formText">
  166. <span id="nullOptionText"></span>
  167. </td>
  168. </tr>
  169. </table>
  170. </div>
  171. <div id="QsdlgVisibleNullOptions" style="padding-left:6px; padding-top:2px; display:none;">
  172. <table border="0" cellpadding="0" cellspacing="0">
  173. <tr onclick="showNullOptions(false)">
  174. <td class="formText">
  175. <a href="#"><xts:string id="MISSINGVALUES_LINK"/></a>
  176. </td>
  177. <td align="left">
  178. <img border="0" width="3" height="1">
  179. <out:attribute name="src"><out:value-of select="$webRoot"/>/common/images/spacer.gif</out:attribute>
  180. </img>
  181. </td>
  182. <td>
  183. <img border="0">
  184. <out:attribute name="src"><out:value-of select="$qsdlgskin"/>/prompting/images/prompt_option_collapse.gif</out:attribute>
  185. </img>
  186. </td>
  187. </tr>
  188. </table>
  189. <table border="0" cellpadding="0" cellspacing="0">
  190. <tr>
  191. <td class="dialogHeaderText" style="padding-top:2px;">
  192. <xts:string id="MISSINGVALUES_HINT"/>
  193. </td>
  194. </tr>
  195. <tr>
  196. <td class="formText" style="padding-top:2px;">
  197. <select name="QsdlgNullOptions" class="clsNullOptions" onchange="updateNullOptionText()">
  198. <option value=""><xts:string id="MISSINGVALUES_OPTION_DEFAULT"/></option>
  199. <option value="include"><xts:string id="MISSINGVALUES_OPTION_INCLUDE_NULL"/></option>
  200. <option value="exclude"><xts:string id="MISSINGVALUES_OPTION_REMOVE_NULL"/></option>
  201. <option value="only"><xts:string id="MISSINGVALUES_OPTION_NULL_ONLY"/></option>
  202. </select>
  203. </td>
  204. </tr>
  205. </table>
  206. </div>
  207. </xsl:template>
  208. <!-- Default variables for all dialogs-->
  209. <xsl:template match="qsdlg:variables">
  210. <out:variable name="skin" select="/root/user/param[@name='skin']"/>
  211. <out:variable name="qsdlgskin" select="concat($webRoot, '/skins/' , $skin)"/>
  212. </xsl:template>
  213. <!-- Prompt Control Variables -->
  214. <xsl:template match="qsdlg:promptVariables">
  215. <out:variable name="cnLocale" select="/root/env/param[@name='contentLocale']"/>
  216. <out:variable name="prLocale" select="/root/env/param[@name='productLocale']"/>
  217. <out:variable name="promptLocale">
  218. <out:choose>
  219. <out:when test="$cnLocale != '' and (substring($cnLocale,1,2)= $prLocale)">
  220. <out:value-of select="$cnLocale"/>
  221. </out:when>
  222. <out:otherwise>
  223. <out:value-of select="$prLocale"/>
  224. </out:otherwise>
  225. </out:choose>
  226. </out:variable>
  227. <out:variable name="promptFormName" select="'f'"/>
  228. </xsl:template>
  229. <!-- Load prompting toolkit files. -->
  230. <xsl:template match ="qsdlg:promptInit">
  231. <out:call-template name="getPromptIncludes">
  232. <out:with-param name="skinFolder" select="concat($webRoot,'/skins/', $skin)"/>
  233. <out:with-param name="webRootURI" select="$webRoot"/>
  234. </out:call-template>
  235. </xsl:template>
  236. <!-- Color Swatch -->
  237. <xsl:template match="qsdlg:colorSwatch">
  238. <table border="0" cellspacing="0" cellpadding="0">
  239. <tr>
  240. <td>
  241. <input type="hidden" name="{./@id}" value=""/>
  242. <table border="0" cellpadding="0" cellspacing="1" class="colorSwatch" style="width:50px;height:20px;margin-right:3px;">
  243. <tr>
  244. <td id="selectColorSwatch{./@id}" height="100%" width="100%" class="color_default">
  245. <img width="1" height="1">
  246. <out:attribute name="src"><out:value-of select="$webRoot"/>/common/images/spacer.gif</out:attribute>
  247. </img>
  248. </td>
  249. </tr>
  250. </table>
  251. </td>
  252. <td>
  253. <div id="selectColor{./@id}"/>
  254. <script>
  255. var <xsl:value-of select="./@jsObjId"/> = new CColorPicker('<xsl:value-of select="xtsext:javascriptencode(string(./@id))"/>', '<xsl:value-of select="xtsext:javascriptencode(string(./@jsObjId))"/>', '<xsl:value-of select="xtsext:javascriptencode(string(./@fct))"/>', null, null, '<xsl:value-of select="xtsext:javascriptencode(string(./@type))"/>', null, false);
  256. </script>
  257. </td>
  258. </tr>
  259. </table>
  260. </xsl:template>
  261. <!--
  262. Shows a checkbox to use the filter against the individual records in the data source.
  263. Checked by default.
  264. -->
  265. <xsl:template match="qsdlg:filterBasedOnDSBox">
  266. <div id="displayBasedOn" style="display:none;">
  267. <dp:choice noSpace="true">
  268. <!-- add a xsl:attribute to the generated XSL -->
  269. <dp:section1>
  270. <input type="checkbox" id="filterBasedOnDS" name="filterBasedOnDS" checked="true" onchange="updateBasedOn()"/>
  271. </dp:section1>
  272. <dp:section2>
  273. <label for="filterBasedOnDS"><xts:string id="FILTER_ON_DATASOURCE"/></label>
  274. </dp:section2>
  275. <dp:section3>
  276. <div id="filterBasedOnInfoMessage" style="display:none;">
  277. <xts:string id="FILTER_ON_DATASOURCE_INFO_MESSAGE"/>
  278. </div>
  279. </dp:section3>
  280. </dp:choice>
  281. </div>
  282. </xsl:template>
  283. <!--
  284. Adds in the header before calling the template to show the drop down list
  285. for the operation selection in the type in filter dialogs
  286. -->
  287. <xsl:template match="qsdlg:filterTypeInOperationSelectWithTitle">
  288. <out:if test="/root/env/param[@name='xxShowTypeInDropDown']='true'">
  289. <dp:input>
  290. <dp:section1>
  291. <xts:string id="FILTER_TYPE_IN_OPERATION_WITH_COLON"/>
  292. </dp:section1>
  293. <dp:section2>
  294. <xsl:call-template name="filterTypeInOperationSelect">
  295. <xsl:with-param name="selectedOption"><xsl:value-of select="@selectedOption"/></xsl:with-param>
  296. </xsl:call-template>
  297. </dp:section2>
  298. </dp:input>
  299. </out:if>
  300. </xsl:template>
  301. <!--
  302. Shows the type in filter drop down select choices picker
  303. -->
  304. <xsl:template name="filterTypeInOperationSelect" match="qsdlg:filterTypeInOperationSelect">
  305. <xsl:param name="selectedOption"/>
  306. <xsl:variable name="realSelectedOption">
  307. <xsl:choose>
  308. <xsl:when test="$selectedOption!=''">
  309. <xsl:value-of select="$selectedOption"/>
  310. </xsl:when>
  311. <xsl:otherwise>
  312. <xsl:value-of select="@selectedOption"/>
  313. </xsl:otherwise>
  314. </xsl:choose>
  315. </xsl:variable>
  316. <out:if test="/root/env/param[@name='xxShowTypeInDropDown']='true'">
  317. <select name="operation" id="operation" onchange="javascript:changeDialog(this)">
  318. <option value="filterTypeInExactlyMatches">
  319. <xsl:if test="$realSelectedOption='filterTypeInExactlyMatches'">
  320. <xsl:attribute name="selected">selected</xsl:attribute>
  321. </xsl:if>
  322. <xts:string id="FILTER_TYPE_IN_EXACTLY_MATCHES"/>
  323. </option>
  324. <option value="filterTypeInStartsWith">
  325. <xsl:if test="$realSelectedOption='filterTypeInStartsWith'">
  326. <xsl:attribute name="selected">selected</xsl:attribute>
  327. </xsl:if>
  328. <xts:string id="FILTER_TYPE_IN_STARTS_WITH"/>
  329. </option>
  330. <option value="filterTypeInEndsWith">
  331. <xsl:if test="$realSelectedOption='filterTypeInEndsWith'">
  332. <xsl:attribute name="selected">selected</xsl:attribute>
  333. </xsl:if>
  334. <xts:string id="FILTER_TYPE_IN_ENDS_WITH"/>
  335. </option>
  336. <option value="filterTypeInContains">
  337. <xsl:if test="$realSelectedOption='filterTypeInContains'">
  338. <xsl:attribute name="selected">selected</xsl:attribute>
  339. </xsl:if>
  340. <xts:string id="FILTER_TYPE_IN_CONTAINS"/>
  341. </option>
  342. <option value="filterTypeInMatchesSQLPattern">
  343. <xsl:if test="$realSelectedOption='filterTypeInMatchesSQLPattern'">
  344. <xsl:attribute name="selected">selected</xsl:attribute>
  345. </xsl:if>
  346. <xts:string id="FILTER_TYPE_IN_MATCHES_SQL_PATTERN"/>
  347. </option>
  348. <!-- Fix for bug COGCQ00202676
  349. Do not allow advanced type-in functions for non-string data items.
  350. These are not supported.
  351. -->
  352. <out:if test="/root/env/param[@name='xxFilterIsString']='true'">
  353. <option value="filterTypeInRange">
  354. <xsl:if test="$realSelectedOption='filterTypeInRange'">
  355. <xsl:attribute name="selected">selected</xsl:attribute>
  356. </xsl:if>
  357. <xts:string id="FILTER_TYPE_IN_IS_IN_RANGE"/>
  358. </option>
  359. </out:if>
  360. </select>
  361. </out:if>
  362. </xsl:template>
  363. <!--
  364. Shows the date drop down select choices picker
  365. -->
  366. <xsl:template match="qsdlg:filterDateRangeSelect">
  367. <out:if test="/root/env/param[@name='xxShowTypeInDropDown']='true'">
  368. <dp:input>
  369. <dp:section1>
  370. <xts:string id="FILTER_TYPE_IN_OPERATION_WITH_COLON"/>
  371. </dp:section1>
  372. <dp:section2>
  373. <select name="operation" id="operation" onchange="javascript:changeDateRangeDialog(this);">
  374. <option value="filterDateRange">
  375. <xsl:if test="@selectedOption='filterDateRange'">
  376. <xsl:attribute name="selected">selected</xsl:attribute>
  377. </xsl:if>
  378. <xts:string id="COND_STYLE_HEADER_RANGE"/>
  379. </option>
  380. <option value="filterDaysBeforeToday">
  381. <xsl:if test="@selectedOption='filterDaysBeforeToday'">
  382. <xsl:attribute name="selected">selected</xsl:attribute>
  383. </xsl:if>
  384. <xts:string id="FILTER_LAST_NUMBER_OF_DAYS"/>
  385. </option>
  386. </select>
  387. </dp:section2>
  388. </dp:input>
  389. </out:if>
  390. </xsl:template>
  391. <!--
  392. * - This next template is required to copy all other elements into the result.
  393. -->
  394. <xsl:template match="*">
  395. <xsl:copy>
  396. <xsl:copy-of select="@*"/>
  397. <xsl:apply-templates/>
  398. </xsl:copy>
  399. </xsl:template>
  400. </xsl:stylesheet>