renderFragment.xslt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  15. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  16. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  19. exclude-result-prefixes="xsl ui uic admui xts xtsext">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  21. <!-- bring in all the UI rendering variables -->
  22. <admui:variables/>
  23. <!-- include all the transforms -->
  24. <xsl:include href="../cogadmin/transforms/presentation/common.xsl"/>
  25. <xsl:include href="../cogadmin/transforms/presentation/breadcrumb.xsl"/>
  26. <xsl:include href="../cogadmin/transforms/presentation/dialog.xsl"/>
  27. <xsl:include href="../cogadmin/transforms/presentation/table_control.xsl"/>
  28. <xsl:include href="../cogadmin/transforms/presentation/menu.xsl"/>
  29. <!--
  30. ********** WORK AROUND FOR AN XTS BUG 517642 ************
  31. XTS won't evaluate xts:string if they're in a stylesheet that's getting included. Define strings as variables in the
  32. root stylesheet so they can be used in the ones that are being included.
  33. ***** NEEDS TO CHANGED ONCE XTS BUG IS FIXED *****
  34. -->
  35. <xsl:variable name="pageItemNotFound">
  36. <xts:string id="IDS_PAGER_ITEMS_FOUND"/>
  37. </xsl:variable>
  38. <xsl:variable name="pagerItemsMsg">
  39. <xts:string id="IDS_PAGER_ITEMS"/>
  40. </xsl:variable>
  41. <xsl:variable name="time_now" select="xtsext:getCurrentDateTime(string(/root/user/param[@name='timeZoneID']))"/>
  42. <xsl:variable name="lastRefreshed">
  43. <xts:string id="IDS_LAST_UPDATED">
  44. <xts:param name="0">
  45. <span>
  46. <xsl:if test="$productLocale != $contentLocale">
  47. <xsl:attribute name="lang"><xsl:value-of select="$contentLocale"/></xsl:attribute>
  48. </xsl:if>
  49. <xsl:value-of select="xtsext:formatDateFromUTC(string($time_now), number('2'), number('3'), '', string($contentLocale))"/>
  50. </span>
  51. </xts:param>
  52. </xts:string>
  53. </xsl:variable>
  54. <xsl:variable name="tenantLabel">
  55. <xts:string id="IDS_ADM_TENANT"/>
  56. </xsl:variable>
  57. <xsl:variable name="expandAllTooltip"><xts:string id="IDS_ADM_SECTION_EXPAND_ALL"/></xsl:variable>
  58. <xsl:variable name="collapseAllTooltip"><xts:string id="IDS_ADM_SECTION_COLLAPSE_ALL"/></xsl:variable>
  59. <xsl:variable name="expandTooltip"><xts:string id="IDS_ADM_SECTION_EXPAND"/></xsl:variable>
  60. <xsl:variable name="collapseTooltip"><xts:string id="IDS_ADM_SECTION_COLLAPSE"/></xsl:variable>
  61. <xsl:variable name="dialogClose"><xts:string id="IDS_ADM_DIALOG_CLOSE"/></xsl:variable>
  62. <xsl:variable name="pagerFromInvalid"><xts:string id="IDS_PAGER_FROM_INVALID" encode="javascript"/></xsl:variable>
  63. <xsl:variable name="pagerToInvalid"><xts:string id="IDS_PAGER_TO_INVALID" encode="javascript"/></xsl:variable>
  64. <xsl:variable name="pagerEntriesInvalid"><xts:string id="IDS_PAGER_ENTRIES_INVALID" encode="javascript"/></xsl:variable>
  65. <xsl:variable name="pagerEntriesEmpty"><xts:string id="IDS_PAGER_ENTRIES_EMPTY" encode="javascript"/></xsl:variable>
  66. <xsl:variable name="pagerGoto"><xts:string id="IDS_PAGER_GO_TO" encode="javascript"/></xsl:variable>
  67. <xsl:variable name="pagerFirst"><xts:string id="IDS_PAGER_FIRST" encode="javascript"/></xsl:variable>
  68. <xsl:variable name="pagerPrevious"><xts:string id="IDS_PAGER_PREVIOUS" encode="javascript"/></xsl:variable>
  69. <xsl:variable name="pagerNext"><xts:string id="IDS_PAGER_NEXT" encode="javascript"/></xsl:variable>
  70. <xsl:variable name="pagerLast"><xts:string id="IDS_PAGER_LAST" encode="javascript"/></xsl:variable>
  71. <xsl:variable name="pagerSelectAll"><xts:string id="IDS_PAGER_SELECT_ALL" encode="javascript"/></xsl:variable>
  72. <xsl:variable name="pagerSelectRow"><xts:string id="IDS_PAGER_SELECT_ROW" encode="javascript"/></xsl:variable>
  73. <xsl:variable name="lastUpdated"><xts:string id="IDS_LAST_UPDATED" encode="javascript"/></xsl:variable>
  74. <xsl:variable name="helpLabel"><xts:string id="IDS_HELP" encode="javascript"/></xsl:variable>
  75. <xsl:variable name="filterTitle"><xts:string id="IDS_FLT_TITLE" encode="javascript"/></xsl:variable>
  76. <xsl:variable name="menuNoActions"><xts:string id="IDS_ADM_ACT_NO_ACTIONS" encode="javascript"/></xsl:variable>
  77. <xsl:variable name="pagerSortDefaultTooltip"><xts:string id="IDS_PAGER_SORT_DEFAULT_TOOLTIP" encode="javascript"/></xsl:variable>
  78. <xsl:variable name="pagerSortAscendingTooltip"><xts:string id="IDS_PAGER_SORT_ASCENDING_TOOLTIP" encode="javascript"/></xsl:variable>
  79. <xsl:variable name="pagerSortDescendingTooltip"><xts:string id="IDS_PAGER_SORT_DESCENDING_TOOLTIP" encode="javascript"/></xsl:variable>
  80. <!--
  81. TODO: should be able to use a call template inside the include stylesheet. If not, then we should have a set of
  82. variables for the URL roots (skin, cogadmin, portal, ...) and we'd just append the gif to those.
  83. -->
  84. <xsl:variable name="collapseGif">
  85. <admui:imageURL image="collapse.gif" type="cogadmin"/>
  86. </xsl:variable>
  87. <xsl:variable name="expandGif">
  88. <admui:imageURL image="expand.gif" type="cogadmin"/>
  89. </xsl:variable>
  90. <xsl:variable name="skinWebcontentPath">
  91. <admui:imageURL type="skin"/>
  92. </xsl:variable>
  93. <xsl:variable name="cogadminWebcontentPath">
  94. <admui:imageURL type="cogadmin"/>
  95. </xsl:variable>
  96. <xsl:variable name="serverWebcontentPath">
  97. <admui:imageURL type="server"/>
  98. </xsl:variable>
  99. <xsl:template match="/root" priority="2">
  100. <script>
  101. _THIS_callBack = function(skipRefresh) {
  102. ui_modal_dialog.close();
  103. if (!skipRefresh) {
  104. raiseReloadEvent(_THIS_);
  105. }
  106. }
  107. </script>
  108. <xsl:apply-templates select="uic:fragment/*"/>
  109. </xsl:template>
  110. <xsl:template match="*[namespace-uri() = 'http://developer.cognos.com/schemas/uic/presentation/markup/']" priority="-1">
  111. <xsl:apply-templates/>
  112. </xsl:template>
  113. <!--
  114. uic:fragmentHeader: renders the header for the fragments
  115. uic:title - will be placed in the left part of the header
  116. uic:pathControl - used if we need to show breadcrumbs in the header
  117. uic:headerActions - actions to be places at the right of the fragment
  118. -->
  119. <xsl:template match="uic:fragmentHeader">
  120. <table class="cogstyle-fragmentHeader-main" role="presentation">
  121. <tbody>
  122. <tr>
  123. <td class="cogstyle-fragmentHeader-title">
  124. <xsl:choose>
  125. <xsl:when test="uic:title">
  126. <span class="cogstyle-fragmentHeader-titleText"><xsl:apply-templates select="uic:title"/></span>
  127. </xsl:when>
  128. <xsl:when test="uic:pathControl">
  129. <!-- Note: this span is required by IE to get the table cell
  130. to expand fully when the width is specified in the CSS file -->
  131. <span><xsl:apply-templates select="uic:pathControl"/></span>
  132. </xsl:when>
  133. </xsl:choose>
  134. </td>
  135. <xsl:variable name="toolbarLabel"><xts:string id="IDS_TOOL_TOOLBAR_LABEL"><xts:param name="toolName"><xsl:value-of select="uic:title"/></xts:param></xts:string></xsl:variable>
  136. <td nowrap="nowrap" valign="middle" role="toolbar" aria-label="{$toolbarLabel}">
  137. <xsl:apply-templates select="uic:headerActions"/>
  138. </td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. </xsl:template>
  143. <xsl:template match="uic:headerSeperator" name="uic:headerSeperator">
  144. <img style="margin-left:3px;margin-right:3px" alt="">
  145. <xsl:attribute name="src">
  146. <admui:imageURL image="divider.gif" type="cogadmin"/>
  147. </xsl:attribute>
  148. </img>
  149. </xsl:template>
  150. <xsl:template match="uic:filterInitScript">
  151. <script>
  152. function _THIS_onload() {
  153. setTimeout(function(){
  154. var filterDIV = _THIS_.parent.id + "filter";
  155. var filterFragId = _THIS_.parent.id + "<xsl:value-of select="xtsext:javascriptencode(string(@filterName))"/>";
  156. if (!_F_getFragmentByID(filterFragId)) {
  157. var _THIS_filterFrag = new fragment("/cogadminFragments/filter/<xsl:value-of select="@filterName"/>", _THIS_.parent.id + "<xsl:value-of select="xtsext:javascriptencode(string(@filterName))"/>", filterDIV);
  158. if (!isHidden($(_THIS_.div))) {
  159. $(filterDIV).style.display = "block";
  160. }
  161. _THIS_filterFrag.retrieve('personalOnly=<xsl:value-of select="/root/env/param[@name='personalOnly']='true'"/>');
  162. }
  163. },0);
  164. }
  165. //the setTimeout function is set to address the issue #568418
  166. _THIS_.setOnloadHandler(_THIS_onload);
  167. </script>
  168. </xsl:template>
  169. <xsl:template name="uic:genSelectRowCheckbox">
  170. <xsl:param name="tableName"/>
  171. <xsl:variable name="id">_THIS_<xsl:value-of select="$tableName"/>
  172. <xsl:text>_checkbox_</xsl:text><xsl:value-of select="position()"/>
  173. </xsl:variable>
  174. <xsl:variable name="value">
  175. <xsl:if test="@value">
  176. <xsl:value-of select="@value"/>
  177. </xsl:if>
  178. </xsl:variable>
  179. <input type="checkbox" name="{$id}" id="{$id}" onclick="cancelBubble(event)">
  180. <xsl:attribute name="aria-label">
  181. <xsl:choose>
  182. <xsl:when test="@label != ''"><xts:string id="IDS_PAGER_SELECT_ROW_WITH_NAME" encode="html"><xts:param name="name"><xsl:value-of select="@label"/></xts:param></xts:string></xsl:when>
  183. <xsl:otherwise><xts:string id="IDS_PAGER_SELECT_ROW" encode="html"/></xsl:otherwise>
  184. </xsl:choose>
  185. </xsl:attribute>
  186. <xsl:attribute name="value">
  187. <xsl:value-of select="xtsext:urlencode(string($value))"/>
  188. </xsl:attribute>
  189. </input>
  190. </xsl:template>
  191. <xsl:template match="node()" priority="-2">
  192. <xsl:copy>
  193. <xsl:copy-of select="@*"/>
  194. <xsl:apply-templates/>
  195. </xsl:copy>
  196. </xsl:template>
  197. <xsl:template match="text()" priority="-2">
  198. <xsl:value-of select="."/>
  199. </xsl:template>
  200. </xsl:stylesheet>