view.xslt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:encodingUtils="com.cognos.portal.utils.EncodingUtils" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="encodingUtils xtsext">
  13. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:template match="/">
  15. <xsl:apply-templates select="root/logic/header"/>
  16. <xsl:apply-templates select="root/logic/impersonateTenantHeader"/>
  17. </xsl:template>
  18. <xsl:template match="header">
  19. <div class="cogstyle-header-back">
  20. <table id="_THIS_bannerTable" class="cogstyle-header-main" cellpadding="0" cellspacing="0" border="0" role="banner">
  21. <xsl:if test="string(@background) != ''">
  22. <xsl:attribute name="style">
  23. background-image:url(<xsl:value-of select="@background"/>);
  24. </xsl:attribute>
  25. </xsl:if>
  26. <tr>
  27. <td class="cogstyle-header-logo-section">
  28. <div class="cogstyle-header-logo"/>
  29. </td>
  30. <td class="cogstyle-header-title">
  31. <xsl:value-of select="@title"/>
  32. </td>
  33. <td class="cogstyle-header-middle-section"></td>
  34. <td class="cogstyle-header-right-section" >
  35. <div class="cogstyle-header-right-section-container">
  36. <table cellpadding="0" cellspacing="0" border="0" role="presentation">
  37. <tr>
  38. <xsl:apply-templates/>
  39. <td class="cogstyle-header-section-item-padding"/>
  40. </tr>
  41. </table>
  42. </div>
  43. </td>
  44. <td class="cogstyle-header-ibm-logo"></td>
  45. </tr>
  46. </table>
  47. <div class="cogstyle-header-banner-lip"></div>
  48. <script type="text/javascript">
  49. doImpersonateTenant = function(op,id) {
  50. var _THIS_reload = function() {
  51. <!--
  52. Note1: Only to be used in the Go Search UI context at this point.
  53. Note2: This reload is still a kludge - the Go Search fragment UI fragment manages to gobble up the refresh event (thru stopPropagation?).
  54. -->
  55. location.reload();
  56. }
  57. _THIS_.impersonateTenantFrag = createFragment('_THIS_impersonateTenant', '_THIS_impersonateTenant_div', '/cogadmin/controls/group_actions.xts?group_action=impersonateTenant');
  58. _THIS_.impersonateTenantFrag.addEventListener('fragment.retrieve.after', _THIS_.id.indexOf('search') == 0 ? _THIS_reload : _THIS_refreshAll);
  59. id='checkbox_1='+id;
  60. impersonateTenantImpl(_THIS_.impersonateTenantFrag,id,op);
  61. }
  62. </script>
  63. </div>
  64. </xsl:template>
  65. <xsl:template match="impersonateTenantHeader">
  66. <link id="themeStyles" rel="stylesheet" href="_THIS?frag-resource=/ps/portal/js/impersonate.css/THIS_" />
  67. <link id="themeStyles" rel="stylesheet" href="_THIS?frag-resource=/dojo16/dijit/themes/tundra/tundra.css/THIS_" />
  68. <!-- Needs to appear twice to overcome css issues with IE 9+ and impersonate banner-->
  69. <link id="themeStyles" rel="stylesheet" href="_THIS?frag-resource=/ps/portal/js/impersonate.css/THIS_" />
  70. <script type="text/javascript">
  71. dojo.addOnLoad(function() {
  72. var context = {
  73. onChange : doImpersonateTenant,
  74. <xsl:if test="boolean(/root/logic/session/param[@name='e_readTenantID'])">
  75. readAs : '<xsl:value-of select="xtsext:javascriptencode(string(readAs))"/>',
  76. </xsl:if>
  77. writeAs : '<xsl:value-of select="xtsext:javascriptencode(string(writeAs))"/>',
  78. listSize : '<xsl:value-of select="xtsext:javascriptencode(string(/root/logic/session/param[@name='linesPerPage']))"/>'
  79. }
  80. _THIS_.impersonateTenant = new impersonateTenantSelector(context);
  81. });
  82. </script>
  83. <div class="impersonate-banner impersonate" id="impersonateBanner">
  84. <table id="_THIS_impersonateTenantBannerTable" cellpadding="0" cellspacing="0" border="0" role="banner">
  85. <tr>
  86. <td class="impersonate-icon">
  87. <img src="_THIS?frag-resource=/ps/portal/images/mt/impersonate_icon_banner.gif/THIS_" alt=""/>
  88. </td>
  89. <td class="cogstyle-header-title">
  90. <xsl:value-of select="@title"/>
  91. </td>
  92. <td class="cogstyle-header-section">
  93. <label for="impersonatedTenant" style="position: absolute;margin-left: -9999px; margin-top: -9999px;"><xts:string id="IDS_PROP_TENANT_NAME"/></label>
  94. <input name="impersonatedTenant" id="impersonatedTenant" style="display:none"/>
  95. </td>
  96. <td class="cogstyle-header-section" >
  97. <input id="showTenantContentOnly" onclick="doImpersonateTenant(this.checked ? 'read' : 'write',impersonateTenant.filteringSelect.item.id);" style="display:none">
  98. <label for="showTenantContentOnly" class="impersonate-show-tenants-content-only-text"><xsl:value-of select="@showTenantContentOnlyLabel"/></label>
  99. </input>
  100. </td>
  101. <td class="cogstyle-header-middle-section"/>
  102. <td class="cogstyle-header-right-section">
  103. <img class="dialogClose" width="25px" height="25px" alt="{@closeLabel}" title="{@closeLabel}" src="_THIS?frag-resource=/ps/portal/images/mt/close_icon.gif/THIS_" role="button" onmouseout="this.className = 'dialogClose'" onmouseover="this.className = 'dialogCloseOver'" onclick="doImpersonateTenant('cancel','');"/>
  104. </td>
  105. </tr>
  106. </table>
  107. </div>
  108. </xsl:template>
  109. <xsl:template match="section">
  110. <xsl:if test="descendant::*"> <!-- Skip the section entirely if it is empty -->
  111. <xsl:if test="local-name(preceding-sibling::*[1]) = 'section'">
  112. <td class="cogstyle-header-separator">
  113. <img align="top" border="0" height="16px" width="1px" alt="">
  114. <xsl:attribute name="src">
  115. <xsl:text>_THIS?frag-resource=/skins/</xsl:text>
  116. <xsl:value-of select="/root/logic/session/param[@name='skin']"/>
  117. <xsl:text>/shared/images/tool_sep_dot_line_banner.gif/THIS_</xsl:text>
  118. </xsl:attribute>
  119. </img>
  120. </td>
  121. </xsl:if>
  122. <td class="cogstyle-header-section">
  123. <table cellpadding="0" cellspacing="0" border="0" role="presentation">
  124. <tr>
  125. <xsl:for-each select="./*">
  126. <xsl:variable name="cell-class">
  127. <xsl:text>cogstyle-header-section-item</xsl:text>
  128. <xsl:if test="position()!=1">
  129. <xsl:text> cogstyle-header-section-item-padding</xsl:text>
  130. </xsl:if>
  131. </xsl:variable>
  132. <td class="{$cell-class}">
  133. <xsl:apply-templates select="."/>
  134. </td>
  135. </xsl:for-each>
  136. </tr>
  137. </table>
  138. </td>
  139. <xsl:apply-templates select="writeAs"/>
  140. <xsl:apply-templates select="readAs"/>
  141. </xsl:if>
  142. </xsl:template>
  143. <xsl:template match="username">
  144. <div class="cogstyle-header-user-id" role="region">
  145. <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
  146. <xsl:attribute name="aria-label"><xts:string id="IDS_PROP_BANNER_LOGON_USER"/></xsl:attribute>
  147. <xsl:value-of select="."/>
  148. </div>
  149. </xsl:template>
  150. <xsl:template match="icon">
  151. <div tabindex="0" class="cogstyle-header-btn-normal" role="button" onmouseover="this.className='cogstyle-header-btn-over';" onmouseout="this.className='cogstyle-header-btn-normal';" onkeypress="if(event.keyCode==9)return true;{action}" onclick="{action}">
  152. <img align="top" border="0">
  153. <xsl:attribute name="src">
  154. <xsl:text>_THIS?frag-resource=</xsl:text>
  155. <xsl:value-of select="image"/>
  156. <xsl:text>/THIS_</xsl:text>
  157. </xsl:attribute>
  158. <xsl:if test="string(tooltip) != ''">
  159. <xsl:attribute name="alt">
  160. <xsl:value-of select="tooltip"/>
  161. </xsl:attribute>
  162. <xsl:attribute name="title">
  163. <xsl:value-of select="tooltip"/>
  164. </xsl:attribute>
  165. </xsl:if>
  166. </img>
  167. </div>
  168. </xsl:template>
  169. <xsl:template match="search">
  170. <form name="_THIS_searchForm" action="javascript:{action}">
  171. <span style="padding-right: 3px;">
  172. <input style="margin-top: -3px;" class="cogstyle-input-text" name="_THIS_searchText" value="" size="20" type="text"/>
  173. </span>
  174. <xsl:apply-templates/>
  175. </form>
  176. </xsl:template>
  177. <xsl:template match="action">
  178. <!-- Swallow action tags as they are processed by their parents. -->
  179. </xsl:template>
  180. <xsl:template match="link">
  181. <a class="cogstyle-header-link cogstyle-header-menu-label" href="javascript:noop();" onClick="{action};return false;" onmouseover="window.status='';return true;">
  182. <xsl:if test="string(@id) != ''">
  183. <xsl:attribute name="id">_THIS_<xsl:value-of select="@id"/></xsl:attribute>
  184. </xsl:if>
  185. <xsl:value-of select="label"/>
  186. </a>
  187. </xsl:template>
  188. <xsl:template match="menu">
  189. <xsl:variable name="menuName" select="concat('_THIS_',string(@id))"/>
  190. <xsl:variable name="hasAction" select="string(action) != ''"/>
  191. <xsl:variable name="defaultAction">
  192. <xsl:choose>
  193. <xsl:when test="$hasAction">
  194. <xsl:value-of select="action"/>
  195. </xsl:when>
  196. <xsl:otherwise>
  197. <xsl:text>ui_menuShow(event,</xsl:text><xsl:value-of select="$menuName"/><xsl:text>);</xsl:text>
  198. </xsl:otherwise>
  199. </xsl:choose>
  200. </xsl:variable>
  201. <div style="cursor: pointer;">
  202. <xsl:if test="not($hasAction)">
  203. <xsl:attribute name="class">cogstyle-header-btn-normal</xsl:attribute>
  204. <xsl:attribute name="onmouseover">this.className='cogstyle-header-btn-over';</xsl:attribute>
  205. <xsl:attribute name="onmouseout">this.className='cogstyle-header-btn-normal';</xsl:attribute>
  206. <xsl:attribute name="role">button</xsl:attribute>
  207. <xsl:attribute name="tabindex">0</xsl:attribute>
  208. <xsl:attribute name="onkeyup">if((event.keyCode==13)||(event.keyCode==40)){<xsl:value-of select="$defaultAction"/>}</xsl:attribute>
  209. <xsl:attribute name="onclick"><xsl:value-of select="$defaultAction"/></xsl:attribute>
  210. <xsl:attribute name="title"><xsl:value-of select="tooltip"/></xsl:attribute>
  211. </xsl:if>
  212. <table cellpadding="0" border="0" cellspacing="0" role="presentation">
  213. <tr>
  214. <xsl:choose>
  215. <xsl:when test="icon">
  216. <td>
  217. <xsl:if test="$hasAction">
  218. <xsl:attribute name="class">cogstyle-header-btn-normal</xsl:attribute>
  219. <xsl:attribute name="onmouseover">this.className='cogstyle-header-btn-over';</xsl:attribute>
  220. <xsl:attribute name="onmouseout">this.className='cogstyle-header-btn-normal';</xsl:attribute>
  221. <xsl:attribute name="tabindex">0</xsl:attribute>
  222. <xsl:attribute name="role">button</xsl:attribute>
  223. <xsl:attribute name="onkeyup">if((event.keyCode==13)||(event.keyCode==40)){<xsl:value-of select="$defaultAction"/>}</xsl:attribute>
  224. <xsl:attribute name="onclick"><xsl:value-of select="$defaultAction"/></xsl:attribute>
  225. <xsl:attribute name="title"><xsl:value-of select="icon/tooltip"/></xsl:attribute>
  226. </xsl:if>
  227. <img align="top" border="0" alt="" title="">
  228. <xsl:attribute name="src">
  229. <xsl:text>_THIS?frag-resource=</xsl:text>
  230. <xsl:value-of select="icon/image"/>
  231. <xsl:text>/THIS_</xsl:text>
  232. </xsl:attribute>
  233. </img>
  234. </td>
  235. <xsl:if test="not($hasAction)">
  236. <td class="cogstyle-header-menu-spacer"/>
  237. </xsl:if>
  238. </xsl:when>
  239. <xsl:otherwise>
  240. <td nowrap="">
  241. <div class="cogstyle-header-menu-label-link">
  242. <xsl:if test="$hasAction">
  243. <xsl:attribute name="onclick"><xsl:value-of select="$defaultAction"/></xsl:attribute>
  244. <xsl:attribute name="role">link</xsl:attribute>
  245. </xsl:if>
  246. <xsl:attribute name="title"><xsl:value-of select="label"/></xsl:attribute>
  247. <xsl:value-of select="label"/>
  248. </div>
  249. </td>
  250. <td class="cogstyle-header-menu-spacer"/>
  251. </xsl:otherwise>
  252. </xsl:choose>
  253. <xsl:if test="not($hasAction)">
  254. <td class="cogstyle-header-menu-spacer"/>
  255. </xsl:if>
  256. <td>
  257. <xsl:if test="string(@id) != ''">
  258. <xsl:attribute name="id"><xsl:value-of select="$menuName"/></xsl:attribute>
  259. </xsl:if>
  260. <xsl:if test="$hasAction">
  261. <xsl:attribute name="class">cogstyle-header-btn-normal</xsl:attribute>
  262. <xsl:attribute name="onmouseover">this.className='cogstyle-header-btn-over';</xsl:attribute>
  263. <xsl:attribute name="onmouseout">this.className='cogstyle-header-btn-normal';</xsl:attribute>
  264. <xsl:attribute name="tabindex">0</xsl:attribute>
  265. <xsl:attribute name="role">button</xsl:attribute>
  266. <xsl:attribute name="onkeyup">if((event.keyCode==13)||(event.keyCode==40)){ui_menuShow(event,<xsl:value-of select="$menuName"/>);}</xsl:attribute>
  267. <xsl:attribute name="onclick">ui_menuShow(event,<xsl:value-of select="$menuName"/>);</xsl:attribute>
  268. <xsl:attribute name="title"><xsl:value-of select="tooltip"/></xsl:attribute>
  269. </xsl:if>
  270. <img align="top" border="0" height="16" width="7" alt="" title="">
  271. <xsl:attribute name="src">
  272. <xsl:text>_THIS?frag-resource=/skins/</xsl:text>
  273. <xsl:value-of select="/root/logic/session/param[@name='skin']"/>
  274. <xsl:text>/shared/images/dropdown_arrow_banner.gif/THIS_</xsl:text>
  275. </xsl:attribute>
  276. </img>
  277. </td>
  278. </tr>
  279. </table>
  280. </div>
  281. <script type="text/javascript">
  282. var <xsl:value-of select="$menuName"/> = new ui_menu({id: "<xsl:value-of select="$menuName"/>", items:[
  283. <xsl:for-each select="item">
  284. <xsl:if test="position() > 1">,</xsl:if>
  285. <xsl:text>{title: "</xsl:text><xsl:value-of select="xtsext:javascriptencode(label)"/><xsl:text>"</xsl:text>
  286. <xsl:if test="position() > 1 and local-name(preceding-sibling::*[1]) = 'separator'">
  287. <xsl:text>, separatorBefore: true</xsl:text>
  288. </xsl:if>
  289. <xsl:if test="string(image) != ''">
  290. <xsl:text>, image: "</xsl:text><xsl:value-of select="xtsext:javascriptencode(image)"/><xsl:text>"</xsl:text>
  291. </xsl:if>
  292. <xsl:text>, action: function(evt) { </xsl:text>
  293. <xsl:value-of select="action"/>
  294. <xsl:text> } }</xsl:text>
  295. </xsl:for-each>
  296. ]
  297. });
  298. </script>
  299. </xsl:template>
  300. <xsl:template match="script">
  301. <script type="text/javascript">
  302. <xsl:value-of select="."/>
  303. </script>
  304. </xsl:template>
  305. <xsl:template match="form">
  306. <xsl:copy>
  307. <xsl:copy-of select="@*"/>
  308. <xsl:copy-of select="*"/>
  309. </xsl:copy>
  310. </xsl:template>
  311. </xsl:stylesheet>