dynamicExpandArea.xslt 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:out="dummy-uri"
  11. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  12. xmlns:hts="http://developer.cognos.com/myinbox/common/hts_ui"
  13. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl hts xtsext">
  14. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  15. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  16. <xsl:template match="hts:dynamicexpandcontrol">
  17. <xsl:variable name="tabIndexAttr" select="string(@tabindex)"/>
  18. <xsl:variable name="decNameAttr" select="string(@name)"/>
  19. <xsl:variable name="decName">
  20. <xsl:choose>
  21. <xsl:when test="starts-with(string($decNameAttr),'_THIS_')">
  22. <xsl:value-of select="substring-after(string($decNameAttr),'_THIS_')"/>
  23. </xsl:when>
  24. <xsl:otherwise><xsl:value-of select="$decNameAttr"/></xsl:otherwise>
  25. </xsl:choose>
  26. </xsl:variable>
  27. <xsl:variable name="decFormname">
  28. <xsl:choose>
  29. <xsl:when test="./hts:controlparameters/formname">
  30. <xsl:value-of select="./hts:controlparameters/formname"/></xsl:when>
  31. <xsl:when test="ancestor::hts:form/@name">
  32. <xsl:value-of select="ancestor::hts:form/@name"/>
  33. </xsl:when>
  34. <xsl:otherwise>pform</xsl:otherwise>
  35. </xsl:choose>
  36. </xsl:variable>
  37. <xsl:variable name="decShortName">
  38. <xsl:choose>
  39. <xsl:when test="starts-with(string($decFormname),'_THIS_')">
  40. <xsl:value-of select="substring-after(string($decFormname),'_THIS_')"/>
  41. </xsl:when>
  42. <xsl:otherwise><xsl:value-of select="$decFormname"/></xsl:otherwise>
  43. </xsl:choose>
  44. <xsl:value-of select="$decName"/>
  45. </xsl:variable>
  46. <xsl:variable name="decId">
  47. <xsl:choose>
  48. <xsl:when test="starts-with(string($decFormname),'_THIS_')">
  49. <xsl:value-of select="$decFormname"/>
  50. </xsl:when>
  51. <xsl:otherwise><xsl:value-of select="concat('_THIS_',$decFormname)"/></xsl:otherwise>
  52. </xsl:choose>
  53. <xsl:value-of select="$decName"/>
  54. </xsl:variable>
  55. <out:variable name="useDecId">
  56. <xsl:value-of select="$decId"/>
  57. </out:variable>
  58. <out:variable name="useDecFormname">
  59. <xsl:value-of select="$decShortName"/>
  60. </out:variable>
  61. <out:variable name="useTabIndexAttr">
  62. <xsl:value-of select="$tabIndexAttr"/>
  63. </out:variable>
  64. <out:variable name="useDecState">
  65. <xsl:choose>
  66. <xsl:when test="./hts:controlparameters/state">
  67. <xsl:copy-of select="./hts:controlparameters/state/*"/></xsl:when>
  68. <xsl:otherwise>
  69. <out:copy-of select="/root/state/*"/>
  70. </xsl:otherwise>
  71. </xsl:choose>
  72. </out:variable>
  73. <out:variable name="useDecCustoms">
  74. <xsl:choose>
  75. <xsl:when test="./hts:controlparameters/customs">
  76. <xsl:copy-of select="./hts:controlparameters/customs/*"/>
  77. </xsl:when>
  78. <xsl:otherwise>
  79. <out:copy-of select="/root/customs/*"/>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </out:variable>
  83. <out:variable name="useDecDisplaySetting">
  84. <out:choose>
  85. <out:when test="string($useDecState/param[@name={$decName}]) != ''">
  86. <out:value-of select="$useDecState/param[@name={$decName}]"/>
  87. </out:when>
  88. <out:when test="string($useDecCustoms/param[@name={$decName}]) != ''">
  89. <out:value-of select="$useDecCustoms/param[@name={$decName}]"/>
  90. </out:when>
  91. </out:choose>
  92. </out:variable>
  93. <out:variable name="useDecSkin">
  94. <xsl:choose>
  95. <xsl:when test="./hts:controlparameters/preferences"><xsl:copy-of select="./hts:controlparameters/preferences/param[@name='skin']"/></xsl:when>
  96. <xsl:otherwise><out:copy-of select="/root/preferences/param[@name='skin']"/></xsl:otherwise>
  97. </xsl:choose>
  98. </out:variable>
  99. <hts:section format="dynamicexpand">
  100. <out:attribute name="id"><xsl:value-of select="$decId"/></out:attribute>
  101. <out:attribute name="name"><xsl:value-of select="$decShortName"/></out:attribute>
  102. <out:attribute name="defaultview">
  103. <out:choose>
  104. <out:when test="$useDecDisplaySetting !=''"><out:value-of select="$useDecDisplaySetting"/></out:when>
  105. <out:otherwise>none</out:otherwise>
  106. </out:choose>
  107. </out:attribute>
  108. <hts:script>
  109. var _THIS_imgUp_<out:value-of select="$useDecFormname"/> = new Image();
  110. var _THIS_imgDown_<out:value-of select="$useDecFormname"/> = new Image();
  111. _THIS_imgUp_<out:value-of select="$useDecFormname"/>.src = "_THIS?frag-resource=/skins/<out:value-of select="xtsext:javascriptencode(string($useDecSkin))"/>/fragments/images/action_collapse.gif/THIS_";
  112. _THIS_imgDown_<out:value-of select="$useDecFormname"/>.src = "_THIS?frag-resource=/skins/<out:value-of select="xtsext:javascriptencode(string($useDecSkin))"/>/fragments/images/action_expand.gif/THIS_";
  113. function _THIS_displayArea_<out:value-of select="$useDecFormname"/>()
  114. {
  115. var eDiv = document.getElementById("<out:value-of select="$useDecId"/>");
  116. var eLink = document.getElementById("<out:value-of select="$useDecFormname"/>_linkId");
  117. <xsl:if test="hts:dynamicareacollapsed">
  118. var eDivCollapsed = document.getElementById("<out:value-of select="concat($useDecId,'_collapsed')"/>")
  119. </xsl:if>
  120. var cImg = document.getElementById("_THIS_expandimg_<out:value-of select="$useDecFormname"/>");
  121. if (eDiv.style.display == "block")
  122. {
  123. eDiv.style.display="none";
  124. <xsl:if test="hts:dynamicareacollapsed">
  125. eDivCollapsed.style.display="block";
  126. </xsl:if>
  127. eLink.setAttribute('aria-expanded',false);
  128. cImg.src = _THIS_imgDown_<out:value-of select="$useDecFormname"/>.src;
  129. cImg.setAttribute('alt','<xts:string id="IDS_PROP_EXPAND_IMG_TITLE" encode="javascript"/>');
  130. cImg.setAttribute('title','<xts:string id="IDS_PROP_EXPAND_IMG_TITLE" encode="javascript"/>');
  131. }
  132. else
  133. {
  134. eDiv.style.display="block";
  135. <xsl:if test="hts:dynamicareacollapsed">
  136. eDivCollapsed.style.display="none";
  137. </xsl:if>
  138. eLink.setAttribute('aria-expanded',true);
  139. cImg.src = _THIS_imgUp_<out:value-of select="$useDecFormname"/>.src;
  140. cImg.setAttribute('alt','<xts:string id="IDS_PROP_COLLAPSE_IMG_TITLE" encode="javascript"/>');
  141. cImg.setAttribute('title','<xts:string id="IDS_PROP_COLLAPSE_IMG_TITLE" encode="javascript"/>');
  142. }
  143. }
  144. </hts:script>
  145. <hts:link role="button">
  146. <out:attribute name="href">javascript:_THIS_displayArea_<out:value-of select="$useDecFormname"/>()</out:attribute>
  147. <out:attribute name="id"><out:value-of select="$useDecFormname"/>_linkId</out:attribute>
  148. <out:if test="$useTabIndexAttr!=''">
  149. <out:attribute name="tabindex"><out:value-of select="$useTabIndexAttr"/></out:attribute>
  150. </out:if>
  151. <xsl:copy-of select="hts:text"/>
  152. </hts:link>
  153. <hts:img class="cogstyle-layout-static-expand-img">
  154. <out:attribute name="id">_THIS_expandimg_<out:value-of select="$useDecFormname"/></out:attribute>
  155. <out:attribute name="onclick">javascript:_THIS_displayArea_<out:value-of select="$useDecFormname"/>()</out:attribute>
  156. <out:choose>
  157. <out:when test="$useDecDisplaySetting!='' and $useDecDisplaySetting='block'">
  158. <out:attribute name="alt"><xts:string id="IDS_PROP_COLLAPSE_IMG_TITLE"/></out:attribute>
  159. <out:attribute name="title"><xts:string id="IDS_PROP_COLLAPSE_IMG_TITLE"/></out:attribute>
  160. </out:when>
  161. <out:otherwise>
  162. <out:attribute name="alt"><xts:string id="IDS_PROP_EXPAND_IMG_TITLE"/></out:attribute>
  163. <out:attribute name="title"><xts:string id="IDS_PROP_EXPAND_IMG_TITLE"/></out:attribute>
  164. </out:otherwise>
  165. </out:choose>
  166. <out:attribute name="src">
  167. <out:choose>
  168. <out:when test="$useDecDisplaySetting='block'">_THIS?frag-resource=/skins/<out:value-of select="$useDecSkin"/>/fragments/images/action_collapse.gif/THIS_</out:when>
  169. <out:otherwise>_THIS?frag-resource=/skins/<out:value-of select="$useDecSkin"/>/fragments/images/action_expand.gif/THIS_</out:otherwise>
  170. </out:choose>
  171. </out:attribute>
  172. </hts:img>
  173. <xsl:copy-of select="hts:hint"/>
  174. <xsl:copy-of select="hts:dynamicarea"/>
  175. <xsl:copy-of select="hts:dynamicareacollapsed"/>
  176. </hts:section>
  177. </xsl:template>
  178. <xsl:template match="*">
  179. <xsl:copy>
  180. <xsl:copy-of select="@*"/>
  181. <xsl:apply-templates/>
  182. </xsl:copy>
  183. </xsl:template>
  184. </xsl:stylesheet>