common.xsl 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  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:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  15. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  16. exclude-result-prefixes="xsl uic xtsext">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  18. <xsl:template match="uic:icon">
  19. <xsl:param name="valign" select="''"/>
  20. <!-- figure out if we should be putting the rollover effect -->
  21. <xsl:variable name="doRollOver" select="boolean(@rollOver) or uic:onclick"/>
  22. <!-- build up the style attribute of the img -->
  23. <xsl:variable name="imgStyle">
  24. <xsl:choose>
  25. <xsl:when test="$valign != ''">vertical-align:<xsl:value-of select="$valign"/>;</xsl:when>
  26. <xsl:when test="@valign != ''">vertical-align:<xsl:value-of select="@valign"/>;</xsl:when>
  27. </xsl:choose>
  28. <xsl:if test="not($doRollOver) and uic:onclick != ''">cursor:pointer;</xsl:if>
  29. <xsl:if test="@style != ''">
  30. <xsl:value-of select="@style"/>
  31. </xsl:if>
  32. </xsl:variable>
  33. <xsl:if test="position() &gt; 1 and @uic:noSpace != 'true'">&#160;</xsl:if>
  34. <img src="{uic:src}" border="0">
  35. <xsl:variable name="class">
  36. <xsl:value-of select="uic:class"/>
  37. <xsl:if test="$doRollOver">
  38. <xsl:value-of select="' cogstyle-toolbar-imageNormal'"/>
  39. </xsl:if>
  40. <xsl:if test="@disabled='true'">
  41. <xsl:value-of select="' hiddenEntryIcon'"/>
  42. </xsl:if>
  43. </xsl:variable>
  44. <xsl:if test="$class">
  45. <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
  46. </xsl:if>
  47. <xsl:choose>
  48. <xsl:when test="uic:tooltip != ''">
  49. <xsl:attribute name="title">
  50. <xsl:value-of select="normalize-space(uic:tooltip)"/>
  51. </xsl:attribute>
  52. <xsl:attribute name="alt">
  53. <xsl:value-of select="normalize-space(uic:tooltip)"/>
  54. </xsl:attribute>
  55. </xsl:when>
  56. <xsl:otherwise>
  57. <xsl:attribute name="alt"/>
  58. </xsl:otherwise>
  59. </xsl:choose>
  60. <xsl:if test="uic:onclick">
  61. <xsl:attribute name="onclick"><xsl:apply-templates select="uic:onclick"/></xsl:attribute>
  62. <xsl:attribute name="onkeypress">if (event.keyCode == 13) {{<xsl:apply-templates select="uic:onclick"/>}}</xsl:attribute>
  63. </xsl:if>
  64. <xsl:if test="@width">
  65. <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
  66. </xsl:if>
  67. <xsl:if test="@height">
  68. <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
  69. </xsl:if>
  70. <xsl:if test="@id">
  71. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  72. </xsl:if>
  73. <xsl:if test="$imgStyle != ''">
  74. <xsl:attribute name="style"><xsl:value-of select="$imgStyle"/></xsl:attribute>
  75. </xsl:if>
  76. <xsl:choose>
  77. <xsl:when test="@role">
  78. <xsl:attribute name="role"><xsl:value-of select="@role"/></xsl:attribute>
  79. </xsl:when>
  80. <xsl:when test="$doRollOver">
  81. <xsl:attribute name="role">button</xsl:attribute>
  82. <xsl:attribute name="tabindex">0</xsl:attribute>
  83. </xsl:when>
  84. </xsl:choose>
  85. <xsl:if test="@aria-haspopup">
  86. <xsl:attribute name="aria-haspopup"><xsl:value-of select="@aria-haspopup"/></xsl:attribute>
  87. </xsl:if>
  88. <xsl:if test="@aria-labelledBy">
  89. <xsl:attribute name="aria-labelledBy"><xsl:value-of select="@aria-labelledBy"/></xsl:attribute>
  90. </xsl:if>
  91. <xsl:if test="@title">
  92. <xsl:attribute name="title"><xsl:value-of select="@title"/></xsl:attribute>
  93. </xsl:if>
  94. <xsl:if test="@tabIndex">
  95. <xsl:attribute name="tabIndex"><xsl:value-of select="@tabIndex"/></xsl:attribute>
  96. </xsl:if>
  97. <xsl:choose>
  98. <xsl:when test="uic:onmouseout">
  99. <xsl:attribute name="onmouseout"><xsl:value-of select="uic:onmouseout"/></xsl:attribute>
  100. </xsl:when>
  101. <xsl:when test="$doRollOver">
  102. <xsl:attribute name="onmouseout">mouseoutImage(this);</xsl:attribute>
  103. </xsl:when>
  104. </xsl:choose>
  105. <xsl:choose>
  106. <xsl:when test="uic:onmouseover">
  107. <xsl:attribute name="onmouseover"><xsl:value-of select="uic:onmouseover"/></xsl:attribute>
  108. </xsl:when>
  109. <xsl:when test="$doRollOver">
  110. <xsl:attribute name="onmouseover">mouseoverImage(this);</xsl:attribute>
  111. </xsl:when>
  112. </xsl:choose>
  113. <xsl:if test="uic:onmousemove">
  114. <xsl:attribute name="onmousemove"><xsl:value-of select="uic:onmousemove"/></xsl:attribute>
  115. </xsl:if>
  116. </img>
  117. </xsl:template>
  118. <!--
  119. hyperlink
  120. -->
  121. <xsl:template match="uic:link">
  122. <xsl:variable name="href">
  123. <xsl:choose>
  124. <xsl:when test="@href and @href!=''">
  125. <xsl:value-of select="@href"/>
  126. </xsl:when>
  127. <xsl:when test="uic:href">
  128. <xsl:apply-templates select="./uic:href"/>
  129. </xsl:when>
  130. <xsl:otherwise>
  131. <xsl:text>#</xsl:text>
  132. </xsl:otherwise>
  133. </xsl:choose>
  134. </xsl:variable>
  135. <a href="{$href}">
  136. <xsl:copy-of select="@*[local-name() != 'class' and local-name() != 'style']"/>
  137. <xsl:if test="uic:onclick != ''">
  138. <xsl:attribute name="onclick"><xsl:value-of select="xtsext:xmldecode(string(uic:onclick))"/></xsl:attribute>
  139. <xsl:attribute name="onkeyup">if (event.keyCode == 13) {{<xsl:value-of select="xtsext:xmldecode(string(uic:onclick))"/>}}</xsl:attribute>
  140. </xsl:if>
  141. <xsl:choose>
  142. <xsl:when test="@class"><xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute></xsl:when>
  143. <xsl:otherwise><xsl:attribute name="class">cogstyle-form-link</xsl:attribute></xsl:otherwise>
  144. </xsl:choose>
  145. <xsl:apply-templates select="uic:text | uic:icon"/>
  146. </a>
  147. </xsl:template>
  148. <xsl:template match="uic:text">
  149. <xsl:choose>
  150. <xsl:when test="@lang != ''">
  151. <span>
  152. <xsl:if test="@lang != ''">
  153. <xsl:attribute name="lang"><xsl:value-of select="@lang"/></xsl:attribute>
  154. </xsl:if>
  155. <xsl:call-template name="uic:text-workhorse"/>
  156. </span>
  157. </xsl:when>
  158. <xsl:otherwise>
  159. <xsl:call-template name="uic:text-workhorse"/>
  160. </xsl:otherwise>
  161. </xsl:choose>
  162. </xsl:template>
  163. <xsl:template name="uic:text-workhorse">
  164. <xsl:if test="position() &gt; 1 and @uic:noSpace != 'true'">&#160;</xsl:if>
  165. <xsl:apply-templates/>
  166. </xsl:template>
  167. <xsl:template match="uic:tooltipText">
  168. <xsl:if test="position() &gt; 1 and @uic:noSpace != 'true'">&#160;</xsl:if>
  169. <span style="cursor:default;" role="presentation">
  170. <xsl:if test="@id">
  171. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  172. </xsl:if>
  173. <xsl:if test="@onmouseover">
  174. <xsl:attribute name="onmouseover"><xsl:value-of select="@onmouseover"/></xsl:attribute>
  175. </xsl:if>
  176. <xsl:if test="@onmouseout">
  177. <xsl:attribute name="onmouseout"><xsl:value-of select="@onmouseout"/></xsl:attribute>
  178. </xsl:if>
  179. <xsl:if test="@onmousemove">
  180. <xsl:attribute name="onmousemove"><xsl:value-of select="@onmousemove"/></xsl:attribute>
  181. </xsl:if>
  182. <xsl:apply-templates/>
  183. </span>
  184. </xsl:template>
  185. <!--
  186. uic:disabledText - used to show disabled text
  187. -->
  188. <xsl:template match="uic:disabledText">
  189. <xsl:if test="position() &gt; 1 and @uic:noSpace != 'true'">&#160;</xsl:if>
  190. <span class="cogstyle-disabledText"><xsl:apply-templates/></span>
  191. </xsl:template>
  192. <xsl:template match="uic:label">
  193. <span class="cogstyle-form-label">
  194. <xsl:if test="@id!=''">
  195. <xsl:attribute name="id">
  196. <xsl:value-of select="@id"/>
  197. </xsl:attribute>
  198. </xsl:if>
  199. <xsl:choose>
  200. <xsl:when test="@for != ''">
  201. <label for="{@for}">
  202. <xsl:apply-templates/>
  203. </label>
  204. </xsl:when>
  205. <xsl:otherwise>
  206. <xsl:apply-templates/>
  207. </xsl:otherwise>
  208. </xsl:choose>
  209. </span>
  210. </xsl:template>
  211. <!-- shows a bar chart -->
  212. <xsl:template match="uic:barChart">
  213. <div id="_THIS_cogadminChartcontent" style="padding-left:20px; width:100%;">_THIS?frag-subfragment=cogadminChart/THIS_</div>
  214. </xsl:template>
  215. <!--
  216. Template - uic:help:
  217. This template defines the javascript to execute CogAdmin help when web page help hyperlink pressed.
  218. Operation:
  219. Generate the function help() javascript.
  220. -->
  221. <xsl:template match="uic:help">
  222. <xsl:variable name="mappedProductLocale">
  223. <xts:function name="mapProductLocale" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  224. <xts:param name="locale"><xsl:value-of select="$productLocale"/></xts:param>
  225. </xts:function>
  226. </xsl:variable>
  227. <script language="javascript">
  228. function help(sContext)
  229. {
  230. if (!sContext)
  231. sContext = "";
  232. var sLocale = "<xsl:value-of select="$mappedProductLocale"/>";
  233. var sBook = "ug_cra";
  234. if (sContext == "")
  235. sBook += "_a";
  236. gotoHelp(sLocale, sBook, sContext);
  237. }
  238. </script>
  239. </xsl:template>
  240. </xsl:stylesheet>