packageConfiguration.xslt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2014
  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"
  13. xmlns:pkgcfg="http://developer.cognos.com/schemas/xts/pkgcfg"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  15. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:out="dummy-uri"
  18. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  19. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  20. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  21. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  22. xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xsl xts xtsext dp cp cf utml">
  23. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  24. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  25. <xsl:template match="pkgcfg:scripts">
  26. <out:variable name="maxXTabItem">60</out:variable>
  27. function storeSettings()
  28. {
  29. <out:for-each select="/root/pkgcfgSettings/*">
  30. document.pform.m_ppc_<out:value-of select="./name"/>.value = document.pform.<out:value-of select="./name"/>.value;
  31. </out:for-each>
  32. }
  33. function checkCrossTab()
  34. {
  35. var field;
  36. var isOk = 0;
  37. <out:for-each select="/root/pkgcfgSettings/*">
  38. <out:if test="contains(string(./name),'crosstabItem')">
  39. if ( isOk == 0 )
  40. {
  41. field = document.pform["<out:value-of select="./name"/>"];
  42. isOk = checkFieldValues(field,"true");
  43. }
  44. </out:if>
  45. </out:for-each>
  46. if (isOk == 0) return true;
  47. return false;
  48. }
  49. function checkOther()
  50. {
  51. var field;
  52. var isOk = 0;
  53. <out:for-each select="/root/pkgcfgSettings/*">
  54. <out:if test="not(contains(string(./name),'crosstabItem'))">
  55. if ( isOk == 0 )
  56. {
  57. field = document.pform["<out:value-of select="./name"/>"];
  58. isOk = checkFieldValues(field);
  59. }
  60. </out:if>
  61. </out:for-each>
  62. if( isOk == 0 ) return true;
  63. return false;
  64. }
  65. function checkFieldValues( field, hasLimit )
  66. {
  67. var isOk = 0;
  68. if (field.value &lt; 0 || isNaN(field.value) || parseInt(field.value, 10) != field.value)
  69. {
  70. field.value = '0';
  71. isOk = 1;
  72. alert("<xts:string id="IDS_VAL_ERR_UNSIGNED_INTEGER" encode="javascript"/>");
  73. field.focus();
  74. }
  75. //outside any applied limit cm will not like it if any of the values here are greater than 2147483647...so make sure we check for that
  76. if (field.value > 2147483647)
  77. {
  78. isOk = 2;
  79. alert("<xts:string id="IDS_PACKAGECONFIGURATION_XTABITEM_EXCEED_LIMIT" encode="javascript"><xts:param name="maxXTabItem">2147483647</xts:param></xts:string>");
  80. field.focus();
  81. }
  82. if (hasLimit)
  83. {
  84. var limit = <out:value-of select="$maxXTabItem"/>;
  85. if (field.value &gt; limit)
  86. {
  87. isOk = 2;
  88. alert("<xts:string id="IDS_PACKAGECONFIGURATION_XTABITEM_EXCEED_LIMIT" encode="javascript"><xts:param name="maxXTabItem"><out:value-of select="$maxXTabItem"/></xts:param></xts:string>");
  89. field.focus();
  90. }
  91. }
  92. return isOk;
  93. }
  94. function validatePkgCfg()
  95. {
  96. if ( checkCrossTab() ) {
  97. if (checkOther()) {
  98. storeSettings();
  99. document.pform.m_return.value = "";
  100. document.pform.m_path.value = document.pform.m_obj.value;
  101. document.pform.m_new_class.value = "packageConfiguration";
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. function selection()
  108. {
  109. if ( checkCrossTab() ) {
  110. if (checkOther()) {
  111. storeSettings();
  112. document.pform.ps_nav_op.value = "maintain";
  113. document.pform.m.value = "<out:value-of select="xtsext:javascriptencode($app)"/>/select/select.xts";
  114. document.pform.submit();
  115. }
  116. }
  117. }
  118. function resetToDefaults()
  119. {
  120. <out:for-each select="/root/pkgcfgSettings/*">
  121. <out:variable name="pos" select="position()"/>
  122. if(document.pform["checkbox_<out:value-of select="$pos"/>"].checked) {
  123. document.pform["checkbox_<out:value-of select="$pos"/>"].checked=false;
  124. document.pform["<out:value-of select="./name"/>"].value = <out:value-of select="./defaultValue"/>;
  125. }
  126. </out:for-each>
  127. var ccb = document.getElementById("controlCheckbox");
  128. if(ccb.checked) ccb.checked=false;
  129. }
  130. </xsl:template>
  131. <xsl:template match="pkgcfg:defaultAnalysis">
  132. <dp:list>
  133. <dp:section>
  134. <dp:label><xts:string id="IDS_PACKAGECONFIGURATION_DEFAULT_LABEL"/></dp:label>
  135. </dp:section>
  136. <dp:section>
  137. <dp:hint wrap="wrap" width="100%"><xts:string id="IDS_PACKAGECONFIGURATION_DEFAULT_HINT"/></dp:hint>
  138. </dp:section>
  139. <out:choose>
  140. <out:when test="/root/selectedAnalysis">
  141. <out:variable name="object-start-at-path">
  142. <out:choose>
  143. <out:when test="starts-with(/root/selectedAnalysis/cm:queryResponse/*/cm:searchPath, '~') or starts-with(/root/selectedAnalysis/cm:queryResponse/*/cm:searchPath,key('session-param', 'e_hp'))">
  144. <out:value-of select="concat(key('session-param', 'e_hp'), '/folder')"/>
  145. </out:when>
  146. <out:when test="starts-with(/root/selectedAnalysis/cm:queryResponse/*/cm:searchPath,'/content')">
  147. <out:value-of select="$defaultContentRoot"/>
  148. </out:when>
  149. </out:choose>
  150. </out:variable>
  151. <dp:section>
  152. <span lang="{'{$contentLocale}'}">
  153. <cf:do-the-path-link>
  154. <cf:param name="familytree">/root/selectedAnalysis/cm:queryResponse/*/cm:ancestors</cf:param>
  155. <cf:param name="familymember">/root/selectedAnalysis/cm:queryResponse/*/cm:defaultName</cf:param>
  156. <cf:param name="home">
  157. <out:value-of select="$object-start-at-path"/>
  158. </cf:param>
  159. </cf:do-the-path-link>
  160. </span>
  161. </dp:section>
  162. </out:when>
  163. <out:when test="(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis and not(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/@nil)) and (not(key('env-param','remove_m_ppc_defaultAnalysis')='true'))">
  164. <out:variable name="object-start-at-path">
  165. <out:choose>
  166. <out:when test="starts-with(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/*/cm:searchPath, '~') or starts-with(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/*/cm:searchPath,key('session-param', 'e_hp'))">
  167. <out:value-of select="concat(key('session-param', 'e_hp'), '/folder')"/>
  168. </out:when>
  169. <out:when test="starts-with(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/*/cm:searchPath,'/content')">
  170. <out:value-of select="$defaultContentRoot"/>
  171. </out:when>
  172. </out:choose>
  173. </out:variable>
  174. <dp:section>
  175. <span lang="{'{$contentLocale}'}">
  176. <cf:do-the-path-link>
  177. <cf:param name="familytree">/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/*/cm:ancestors</cf:param>
  178. <cf:param name="familymember">/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/*/cm:defaultName</cf:param>
  179. <cf:param name="home">
  180. <out:value-of select="$object-start-at-path"/>
  181. </cf:param>
  182. </cf:do-the-path-link>
  183. </span>
  184. </dp:section>
  185. </out:when>
  186. <out:otherwise>
  187. <dp:section>
  188. <dp:text nospace="nospace"><xts:string id="IDS_PACKAGECONFIGURATION_DEFAULT_VALUE"/></dp:text>
  189. </dp:section>
  190. </out:otherwise>
  191. </out:choose>
  192. <dp:section>
  193. <dp:link>
  194. <a href="javascript:selection()">
  195. <xts:string id="IDS_PACKAGECONFIGURATION_DEFAULT_LINK"/>
  196. </a>
  197. <out:if test="(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis and not(/root/cm:queryResponse/cm:packageConfiguration/cm:defaultAnalysis/@nil)) and (not(key('env-param','remove_m_ppc_defaultAnalysis')='true'))">
  198. <img height="3" width="10">
  199. <out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
  200. </img>
  201. <a href="javascript:removeAnalysis()">
  202. <xts:string id="IDS_CONTENT_TASK_REPORT_UPGRADE_REMOVE"/>
  203. </a>
  204. </out:if>
  205. </dp:link>
  206. </dp:section>
  207. </dp:list>
  208. </xsl:template>
  209. <xsl:template match="pkgcfg:settingsList">
  210. <dp:list>
  211. <dp:section>
  212. <dp:label><xts:string id="IDS_PACKAGECONFIGURATION_LIMITS_LABEL"/></dp:label>
  213. </dp:section>
  214. <dp:section>
  215. <dp:hint><xts:string id="IDS_PACKAGECONFIGURATION_LIMITS_HINT"/></dp:hint>
  216. </dp:section>
  217. <dp:section>
  218. <dp:text width="100%"/>
  219. <dp:text nospace="nospace" align="left"><xts:string id="IDS_ENTRIES"/> 1 - 2</dp:text>
  220. <img height="3" width="1">
  221. <out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
  222. </img>
  223. </dp:section>
  224. </dp:list>
  225. <cp:table name="pkgcfgsetting" iterate="/root/pkgcfgSettings/*" align="left" width="100%">
  226. <cp:tableHeader>
  227. <cp:columnHeader width="20" toggleName="checkbox_" id="controlCheckbox" noLabel="true"/>
  228. <cp:columnHeader width="16"/>
  229. <!-- Path-Name Column -->
  230. <cp:columnHeader width="100%">
  231. <!-- All of this is to align the header (...> Name) with the contents of the table-->
  232. <img height="5" width="1" border="0"><out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute></img>
  233. <out:text/><xts:string id="IDS_PACKAGECONFIGURATION_HEADING_NAME"/><out:text/>
  234. </cp:columnHeader>
  235. <cp:columnHeader>
  236. <span id="lbl_configValue"><xts:string id="IDS_PACKAGECONFIGURATION_HEADING_VALUE"/></span>
  237. </cp:columnHeader>
  238. </cp:tableHeader>
  239. <!-- Column contents -->
  240. <cp:tableContent>
  241. <cp:columnContent>
  242. <input type="checkbox">
  243. <out:attribute name="aria-label"><xts:string id="IDS_SELECTION_FOR_PAGER_ITEM" encode="html"><xts:param name="pagerItemName"><out:value-of select="./displayName"/></xts:param></xts:string></out:attribute>
  244. <out:attribute name="name">checkbox_<out:value-of select="position()"/></out:attribute>
  245. </input>
  246. </cp:columnContent>
  247. <cp:columnContent><img alt=""><out:attribute name="src"><out:value-of select="$image_root"/>icon_parameter.gif</out:attribute></img></cp:columnContent>
  248. <!-- Path-Name Column -->
  249. <cp:columnContent><out:value-of select="./displayName"/></cp:columnContent>
  250. <cp:columnContent>
  251. <input type="text">
  252. <out:attribute name="name">
  253. <out:value-of select="./name"/>
  254. </out:attribute>
  255. <out:attribute name="value">
  256. <out:choose>
  257. <out:when test="./name = 'memberDisplayCountDefault'">
  258. <out:choose>
  259. <out:when test="not(/root/env/param[@name='m_ppc_memberDisplayCountDefault'])"><out:value-of select="./value"/></out:when>
  260. <out:otherwise><out:value-of select="/root/env/param[@name='m_ppc_memberDisplayCountDefault']"/></out:otherwise>
  261. </out:choose>
  262. </out:when>
  263. <out:when test="./name = 'memberDisplayCountLimit'">
  264. <out:choose>
  265. <out:when test="not(/root/env/param[@name='m_ppc_memberDisplayCountLimit'])"><out:value-of select="./value"/></out:when>
  266. <out:otherwise><out:value-of select="/root/env/param[@name='m_ppc_memberDisplayCountLimit']"/></out:otherwise>
  267. </out:choose>
  268. </out:when>
  269. </out:choose>
  270. </out:attribute>
  271. <out:attribute name="aria-label">
  272. <xts:string id="IDS_PACKAGECONFIGURATION_HEADING_VALUE_ARIA"><xts:param name="settingName"><out:value-of select="./displayName"/></xts:param></xts:string>
  273. </out:attribute>
  274. </input>
  275. </cp:columnContent>
  276. </cp:tableContent>
  277. </cp:table>
  278. <dp:list>
  279. <dp:section>
  280. <dp:text width="100%"/>
  281. <dp:link>
  282. <a href="javascript:resetToDefaults()">
  283. <xts:string id="IDS_PACKAGECONFIGURATION_SETTINGS_RESET"/>
  284. </a>
  285. </dp:link>
  286. <img height="3" width="1">
  287. <out:attribute name="src"><out:value-of select="$webcontent"/>/images/space.gif</out:attribute>
  288. </img>
  289. </dp:section>
  290. </dp:list>
  291. </xsl:template>
  292. <xsl:template match="pkgcfg:settingsInput">
  293. <utml:input name="m_ppc_memberDisplayCountDefault" type="hidden" value="" utml:update="false"/>
  294. <utml:input name="m_ppc_memberDisplayCountLimit" type="hidden" value="" utml:update="false"/>
  295. </xsl:template>
  296. <xsl:template match="*">
  297. <xsl:copy>
  298. <xsl:copy-of select="@*"/>
  299. <xsl:apply-templates/>
  300. </xsl:copy>
  301. </xsl:template>
  302. </xsl:stylesheet>