bux.xsl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: Viewer
  5. (C) Copyright IBM Corp. 2001, 2013
  6. US Government Users Restricted Rights - Use, duplication or
  7. disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rsext="xalan://com.cognos.reportserver.ext.RSExt" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" version="1.0" exclude-result-prefixes="xsl rsext bus">
  10. <xsl:include href="qrsvpCommon.xsl"/>
  11. <xsl:include href="V5drillthru.xsl"/>
  12. <xsl:param name="CVDisableSelection" select="''"/>
  13. <xsl:param name="CVDisableDrill" select="''"/>
  14. <xsl:param name="genIntermediateXML" select="''"/>
  15. <xsl:param name="CVObjectRef" select="'window.oCV'"/>
  16. <xsl:param name="CVSCObjectRef" select="'window.oCVSC'"/>
  17. <xsl:param name="disableTabs" select="'false'"/>
  18. <xsl:param name="container" select="''"/>
  19. <xsl:variable name="CVJSObjectRef" select="concat($CVObjectRef, $CognosViewerID)" />
  20. <xsl:variable name="CVSCJSObjectRef" select="concat($CVSCObjectRef, $CognosViewerID)" />
  21. <xsl:variable name="IWidgetEvent">gVWEvent('<xsl:value-of select="$CognosViewerID"/>',event,</xsl:variable>
  22. <xsl:variable name="webFlexDirectory" select="concat($webRoot,'/flex/')"/>
  23. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  24. <!-- only run these in Query Studio -->
  25. <xsl:template name="startPage"/>
  26. <xsl:template name="dropIndicators"/>
  27. <xsl:template name="drillTargetsSetup">
  28. <xsl:if test="$drillSupport!='no'">
  29. <xsl:call-template name="addDrillThroughContext">
  30. <xsl:with-param name="closeScript" select="'no'"/>
  31. </xsl:call-template>
  32. <xsl:value-of select="$CVJSObjectRef"/>.addDrillTargets(drillTargets);
  33. <xsl:text disable-output-escaping="yes">&lt;/script&gt;</xsl:text>
  34. </xsl:if>
  35. </xsl:template>
  36. <!-- used in selection -->
  37. <xsl:template name="GenEventHandlers">
  38. <xsl:if test="./drillTargets or /Document/META-DATA">
  39. <xsl:if test="@layoutClass='listColumnBody' or @layoutClass='listColumnTitle' or @layoutClass='rowCell' or @layoutClass='crosstabFactCell' or @layoutClass='crosstabNodeMember' or @layoutClass='crosstabCorner' or @layoutClass='repeaterTableCell' or name()='OCHART'">
  40. <xsl:if test="@cid != ''">
  41. <xsl:attribute name="cid"><xsl:value-of select="@cid"/></xsl:attribute>
  42. </xsl:if>
  43. <xsl:if test="@uid != ''">
  44. <xsl:attribute name="uid"><xsl:value-of select="@uid"/></xsl:attribute>
  45. <xsl:attribute name="name">c<xsl:value-of select="$CognosViewerID"/><xsl:value-of select="@uid"/></xsl:attribute>
  46. </xsl:if>
  47. <xsl:if test="@type != ''">
  48. <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
  49. <xsl:choose>
  50. <xsl:when test="@layoutClass='crosstabCorner'">
  51. <xsl:attribute name="CC">true</xsl:attribute>
  52. </xsl:when>
  53. <xsl:when test="@layoutClass='crosstabNodeMember'">
  54. <xsl:attribute name="CTNM">true</xsl:attribute>
  55. </xsl:when>
  56. </xsl:choose>
  57. </xsl:if>
  58. <xsl:if test="@ctx != ''">
  59. <xsl:attribute name="ctx"><xsl:value-of select="@ctx"/></xsl:attribute>
  60. </xsl:if>
  61. <xsl:if test="./HA/@rp_name !=''">
  62. <xsl:attribute name="onmouseover"><xsl:value-of select="$IWidgetEvent"/>'onMouseOverRenamedItem');</xsl:attribute>
  63. <xsl:attribute name="onmouseout"><xsl:value-of select="$IWidgetEvent"/>'onMouseOutRenamedItem');</xsl:attribute>
  64. <xsl:variable name="genId"><xsl:value-of select="generate-id()"/></xsl:variable>
  65. <xsl:variable name="uniqueItemId" select="concat($genId, $CognosViewerID)"/>
  66. <xsl:attribute name="id"><xsl:value-of select="$uniqueItemId"/></xsl:attribute>
  67. </xsl:if>
  68. <xsl:if test="@class">
  69. <xsl:attribute name="class">
  70. <xsl:if test="$CVDisableSelection != 'true'">
  71. <xsl:text>c</xsl:text><xsl:value-of select="$CognosViewerID"/><xsl:value-of select="@uid"/><xsl:text> </xsl:text>
  72. </xsl:if>
  73. <xsl:value-of select="@class" disable-output-escaping="yes"/>
  74. </xsl:attribute>
  75. </xsl:if>
  76. </xsl:if>
  77. </xsl:if>
  78. <xsl:if test="name() = 'OCHART'">
  79. <xsl:attribute name="rsvpChart">true</xsl:attribute>
  80. </xsl:if>
  81. <xsl:if test="$container = 'mobile'">
  82. <xsl:attribute name="onmouseover"></xsl:attribute>
  83. </xsl:if>
  84. </xsl:template>
  85. <!-- used to add events to the main page for selection -->
  86. <xsl:template match="*[@layoutClass='page']" priority="1">
  87. <xsl:if test="/Document/ReportPageSet and $disableTabs != 'true'">
  88. <script type="text/javascript">
  89. <xsl:value-of select="$CVJSObjectRef"/><xsl:text>.setTabInfo(</xsl:text>
  90. <xsl:call-template name="createJsonTabset">
  91. <xsl:with-param name="node" select="/Document/ReportPageSet"/>
  92. </xsl:call-template>
  93. <xsl:text>);</xsl:text>
  94. </script>
  95. </xsl:if>
  96. <xsl:if test="$genIntermediateXML = 'true'">####intermediateStart####<xsl:copy-of select="/"/>####intermediateEnd####</xsl:if>
  97. <xsl:call-template name="preProcess"/>
  98. <table id="rt{$CognosViewerID}" cellpadding="0" cellspacing="0" border="0">
  99. <xsl:if test="$accessible='true'">
  100. <xsl:attribute name="role">presentation</xsl:attribute>
  101. </xsl:if>
  102. <xsl:attribute name="onmouseover"><xsl:value-of select="$IWidgetEvent"/>'onMouseOver');</xsl:attribute>
  103. <xsl:attribute name="onmouseout"><xsl:value-of select="$IWidgetEvent"/>'onMouseOut');</xsl:attribute>
  104. <xsl:attribute name="ondblclick"><xsl:value-of select="$IWidgetEvent"/>'onDoubleClick');</xsl:attribute>
  105. <xsl:attribute name="onmousedown"><xsl:value-of select="$IWidgetEvent"/>'onMouseDown');</xsl:attribute>
  106. <xsl:attribute name="onmouseup"><xsl:value-of select="$IWidgetEvent"/>'onMouseUp');</xsl:attribute>
  107. <xsl:attribute name="oncontextmenu"><xsl:value-of select="$IWidgetEvent"/>'onContextMenu');</xsl:attribute>
  108. <xsl:attribute name="onkeydown"><xsl:value-of select="$CVJSObjectRef"/>.onKeyDown(event);</xsl:attribute>
  109. <xsl:call-template name="GenCommonAttributes"/>
  110. <xsl:apply-templates select="*"/>
  111. </table>
  112. <xsl:call-template name="postProcess">
  113. <xsl:with-param name="elementID" select="concat('rt', $CognosViewerID)"/>
  114. </xsl:call-template>
  115. </xsl:template>
  116. <xsl:template match="*[local-name()='OCHART' and string(@useFlash) != 'true']" priority="1">
  117. <xsl:variable name="uniqueId"><xsl:value-of select="concat($CognosViewerID, generate-id(.))"/></xsl:variable>
  118. <div>
  119. <xsl:attribute name="role">presentation</xsl:attribute>
  120. <xsl:attribute name="class">dijitInline</xsl:attribute>
  121. <xsl:attribute name="style">vertical-align:top;</xsl:attribute>
  122. <xsl:variable name="tag">
  123. <xsl:choose>
  124. <xsl:when test="@layoutClass='viz'">div</xsl:when>
  125. <xsl:otherwise>span</xsl:otherwise>
  126. </xsl:choose>
  127. </xsl:variable>
  128. <xsl:element name="{$tag}">
  129. <xsl:attribute name="tabIndex">0</xsl:attribute>
  130. <xsl:attribute name="chartContainer">true</xsl:attribute>
  131. <xsl:attribute name="style">position:relative; left:0; top:0;</xsl:attribute>
  132. <xsl:attribute name="class">dijitInline</xsl:attribute>
  133. <xsl:attribute name="viewerId"><xsl:value-of select="$CognosViewerID"/></xsl:attribute>
  134. <xsl:if test="@layoutClass='viz'">
  135. <xsl:attribute name="vizChart">true</xsl:attribute>
  136. </xsl:if>
  137. <xsl:if test="$accessible='true'">
  138. <xsl:attribute name="role">img</xsl:attribute>
  139. <xsl:if test="@altText != ''">
  140. <xsl:attribute name="aria-labelledby"><xsl:value-of select="$uniqueId"/></xsl:attribute>
  141. <span style="visibility:hidden; display:none" id="{$uniqueId}"><xsl:value-of select="@altText"/></span>
  142. </xsl:if>
  143. </xsl:if>
  144. <xsl:call-template name="GenChartImage"/>
  145. </xsl:element>
  146. </div>
  147. </xsl:template>
  148. <xsl:template match="*[@layoutClass='list'] | *[@layoutClass='crosstab']" priority="1">
  149. <div>
  150. <xsl:call-template name="GenReportLayout"/>
  151. </div>
  152. </xsl:template>
  153. <xsl:template match="*[@layoutClass='textItem']" priority="1">
  154. <span>
  155. <xsl:call-template name="GenTabIndexAttribute"/>
  156. <xsl:call-template name="GenCommonAttributes"/>
  157. <xsl:call-template name="AddAccessibleTagsForSpan"/>
  158. <!--
  159. First cell in a list or crosstab has a tabIndex of 0. We need the onfocus for those cells
  160. to fix up the aria-labelled before JAWS kicks in.
  161. -->
  162. <xsl:if test="$accessible='true' and (parent::node()/@layoutClass = 'crosstabCorner' or (parent::node()/@layoutClass = 'listColumnTitle' and count(parent::node()/preceding-sibling::node())=0))">
  163. <xsl:attribute name="onfocus"><xsl:value-of select="$CVJSObjectRef"/>.onFocus(event);</xsl:attribute>
  164. </xsl:if>
  165. <xsl:if test="@ctx != ''">
  166. <xsl:attribute name="ctx"><xsl:value-of select="@ctx"/></xsl:attribute>
  167. </xsl:if>
  168. <xsl:value-of select="rsext:htmlencode(string(.))" disable-output-escaping="yes"/>
  169. </span>
  170. </xsl:template>
  171. <!-- Flash Charts -->
  172. <xsl:template match="*[@useFlash]">
  173. <xsl:variable name="uniqueId"><xsl:value-of select="generate-id()"/></xsl:variable>
  174. <xsl:variable name="genId"><xsl:value-of select="concat(substring-before(string($uniqueId), '.'), substring-after(string($uniqueId), '.'))"/></xsl:variable>
  175. <xsl:variable name="width">
  176. <xsl:choose>
  177. <xsl:when test="number(@width) &lt; 250">
  178. <xsl:text>250</xsl:text>
  179. </xsl:when>
  180. <xsl:otherwise><xsl:value-of select="@width"/></xsl:otherwise>
  181. </xsl:choose>
  182. </xsl:variable>
  183. <xsl:variable name="height">
  184. <xsl:choose>
  185. <xsl:when test="number(@height) &lt; 175">
  186. <xsl:text>175</xsl:text>
  187. </xsl:when>
  188. <xsl:otherwise><xsl:value-of select="@height"/></xsl:otherwise>
  189. </xsl:choose>
  190. </xsl:variable>
  191. <xsl:variable name="a11yuniqueId"><xsl:value-of select="concat($CognosViewerID, generate-id(.))"/></xsl:variable>
  192. <div flashChartContainer="true">
  193. <xsl:variable name="errorCallback"><xsl:value-of select="$CVJSObjectRef"/><xsl:text>.flashChartError</xsl:text></xsl:variable>
  194. <xsl:variable name="ldxString">&lt;cgs&gt;<xsl:value-of select="normalize-space(.)" disable-output-escaping="no"/>&lt;/cgs&gt;</xsl:variable>
  195. <xsl:variable name="flashVarsUrl"><xsl:text>loadpath=</xsl:text><xsl:value-of select="$webFlexDirectory"/><xsl:text>&amp;messageurl=</xsl:text><xsl:value-of select="$webFlexDirectory"/><xsl:text>exdFlex_en.xml&amp;errorCallback=</xsl:text><xsl:value-of select="rsext:urlencode($errorCallback)"/><xsl:text>&amp;ldx=</xsl:text><xsl:value-of select="rsext:urlencode($ldxString)"/></xsl:variable>
  196. <xsl:choose>
  197. <xsl:when test="parent::node()/@layoutClass != 'crosstabFactCell'">
  198. <xsl:attribute name="tabIndex">0</xsl:attribute>
  199. <xsl:attribute name="onfocus">onFlashChartRightClick(event);</xsl:attribute>
  200. </xsl:when>
  201. <xsl:otherwise>
  202. <xsl:attribute name="tabIndex">-1</xsl:attribute>
  203. </xsl:otherwise>
  204. </xsl:choose>
  205. <xsl:attribute name="id"><xsl:text>flashContainer</xsl:text><xsl:value-of select="$genId"/></xsl:attribute>
  206. <xsl:if test="$accessible='true' and string(@altText) != ''">
  207. <xsl:attribute name="role">presentation</xsl:attribute>
  208. <xsl:attribute name="aria-labelledby"><xsl:value-of select="$a11yuniqueId"/></xsl:attribute>
  209. <span style="visibility:hidden; display:none" id="{$a11yuniqueId}"><xsl:value-of select="@altText"/></span>
  210. </xsl:if>
  211. <xsl:choose>
  212. <xsl:when test="$isIE">
  213. <object flashChart="true" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
  214. <xsl:attribute name="viewerId"><xsl:value-of select="$CognosViewerID"/></xsl:attribute>
  215. <xsl:attribute name="lid"><xsl:value-of select="@name"/><xsl:value-of select="$CognosViewerID"/></xsl:attribute>
  216. <xsl:attribute name="id"><xsl:value-of select="$genId"/></xsl:attribute>
  217. <xsl:attribute name="width"><xsl:value-of select="$width"/>px</xsl:attribute>
  218. <xsl:attribute name="height"><xsl:value-of select="$height"/>px</xsl:attribute>
  219. <param name="quality" value="high"/>
  220. <param name="bgcolor" value="#869ca7"/>
  221. <param name="allowScriptAccess" value="sameDomain"/>
  222. <param name="play" value="true"/>
  223. <param name="wmode" value="transparent"/>
  224. <param name="menu" value="false"/>
  225. <param name="movie">
  226. <xsl:attribute name="value"><xsl:value-of select="$webFlexDirectory"/><xsl:text>CGSChartLauncher.swf</xsl:text></xsl:attribute>
  227. </param>
  228. <param name="FlashVars">
  229. <xsl:attribute name="value"><xsl:value-of select="$flashVarsUrl"/></xsl:attribute>
  230. </param>
  231. </object>
  232. </xsl:when>
  233. <xsl:otherwise>
  234. <embed flashChart="true">
  235. <xsl:attribute name="viewerId"><xsl:value-of select="$CognosViewerID"/></xsl:attribute>
  236. <xsl:attribute name="lid"><xsl:value-of select="@name"/><xsl:value-of select="$CognosViewerID"/></xsl:attribute>
  237. <xsl:attribute name="id"><xsl:value-of select="$genId"/></xsl:attribute>
  238. <xsl:attribute name="name"><xsl:value-of select="$genId"/></xsl:attribute>
  239. <xsl:attribute name="width"><xsl:value-of select="$width"/>px</xsl:attribute>
  240. <xsl:attribute name="height"><xsl:value-of select="$height"/>px</xsl:attribute>
  241. <xsl:attribute name="src"><xsl:value-of select="$webFlexDirectory"/><xsl:text>CGSChartLauncher.swf</xsl:text></xsl:attribute>
  242. <xsl:attribute name="quality">high</xsl:attribute>
  243. <xsl:attribute name="menu">false</xsl:attribute>
  244. <xsl:attribute name="bgcolor">#869ca7</xsl:attribute>
  245. <xsl:attribute name="wmode">transparent</xsl:attribute>
  246. <xsl:attribute name="align">middle</xsl:attribute>
  247. <xsl:attribute name="play">true</xsl:attribute>
  248. <xsl:attribute name="loop">false</xsl:attribute>
  249. <xsl:attribute name="allowScriptAccess">always</xsl:attribute>
  250. <xsl:attribute name="type">application/x-shockwave-flash</xsl:attribute>
  251. <xsl:attribute name="pluginspage">http://www.adobe.com/go/getflashplayer</xsl:attribute>
  252. <xsl:attribute name="FlashVars"><xsl:value-of select="$flashVarsUrl"/></xsl:attribute>
  253. </embed>
  254. </xsl:otherwise>
  255. </xsl:choose>
  256. </div>
  257. <xsl:call-template name="startScript"/>
  258. <xsl:value-of select="$CVJSObjectRef"/><xsl:text>.addFlashChart('</xsl:text><xsl:value-of select="rsext:javascriptencode($genId)"/><xsl:text>');</xsl:text>
  259. <xsl:call-template name="endScript"/>
  260. </xsl:template>
  261. <xsl:template match="OAREA" priority="2">
  262. <xsl:if test="./MEMBER or ./drillTargets or ./MEASURE">
  263. <xsl:if test="./MEMBER or ./MEASURE">
  264. <xsl:attribute name="ctx"><xsl:value-of select="./@ctx"/></xsl:attribute>
  265. </xsl:if>
  266. <xsl:choose>
  267. <xsl:when test="./@type='legendTitle'">
  268. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  269. </xsl:when>
  270. </xsl:choose>
  271. <xsl:choose>
  272. <xsl:when test="./@type='ordinalAxisTitle'">
  273. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  274. </xsl:when>
  275. </xsl:choose>
  276. <xsl:if test="./drillTargets">
  277. <xsl:attribute name="dtTargets">
  278. <xsl:apply-templates select="./drillTargets/*" mode="drillTargets"/>
  279. </xsl:attribute>
  280. </xsl:if>
  281. </xsl:if>
  282. </xsl:template>
  283. </xsl:stylesheet>