vtabs.xslt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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, 2015
  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:xts="http://developer.cognos.com/schemas/xts/" xmlns:encodingUtils="com.cognos.portal.utils.EncodingUtils">
  13. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:variable name="customs" select="/root/customs/param"/>
  15. <xsl:variable name="meta" select="/root/fragment/meta"/>
  16. <xsl:variable name="pages" select="/root/input[@name='pages']/pages"/>
  17. <xsl:variable name="header">
  18. <xsl:call-template name="get-custom">
  19. <xsl:with-param name="name">header</xsl:with-param>
  20. </xsl:call-template>
  21. </xsl:variable>
  22. <xsl:variable name="footer">
  23. <xsl:call-template name="get-custom">
  24. <xsl:with-param name="name">footer</xsl:with-param>
  25. </xsl:call-template>
  26. </xsl:variable>
  27. <xsl:variable name="fixed">
  28. <xsl:call-template name="get-custom">
  29. <xsl:with-param name="name">fixed</xsl:with-param>
  30. </xsl:call-template>
  31. </xsl:variable>
  32. <xsl:variable name="showicons">
  33. <xsl:call-template name="get-custom">
  34. <xsl:with-param name="name">showicons</xsl:with-param>
  35. </xsl:call-template>
  36. </xsl:variable>
  37. <xsl:variable name="vtabs-width">
  38. <xsl:call-template name="get-custom">
  39. <xsl:with-param name="name">vtabswidth</xsl:with-param>
  40. </xsl:call-template>
  41. </xsl:variable>
  42. <xsl:variable name="refresh" select="string(/root/interactions/param[@name='refresh'])"/>
  43. <xsl:variable name="updateState" select="string(/root/interactions/param[@name='updateState'])"/>
  44. <xsl:variable name="level1-selected-page" select="($pages/page[@selected='true'] | $pages/page[position() = 1 and not($pages/page[@selected='true'])])"/>
  45. <xsl:variable name="selected-page" select="($level1-selected-page/page[@selected='true'] | $level1-selected-page/page[position() = 1 and not($level1-selected-page/page[@selected='true'])] | $level1-selected-page[not(page)] )"/>
  46. <xsl:variable name="first-page" select="$selected-page[not($refresh = 'true' or $updateState = 'true')]"/>
  47. <xsl:variable name="has-icons" select="$pages//*[@icon != '']"/>
  48. <xsl:variable name="selected-tabs" select="/root/state/param[@name='selectedTabs']"/>
  49. <xsl:template match="/">
  50. <xsl:choose>
  51. <xsl:when test="$refresh!='true' and $updateState!='true'">
  52. <div id="_THIS_tabIncompatibilityWarning" class="cogstyle-portlet-error-frame" style="display:none;">
  53. <table cellpadding="3" role="presentation">
  54. <tr>
  55. <td>
  56. <img src="_THIS?frag-resource=/ps/portal/images/msg_warning.gif/THIS_">
  57. <xsl:attribute name="alt"><xts:string id="IDS_BV_INCOMPATIBLE_ENVIRONMENT"/></xsl:attribute>
  58. </img>
  59. </td>
  60. <td><xts:string id="IDS_BV_INCOMPATIBLE_ENVIRONMENT"/></td>
  61. </tr>
  62. </table>
  63. </div>
  64. <div id="_THIS_bvContainer">
  65. <xsl:if test="$header != ''">
  66. <div id="_THIS_headercontent" style="width:100%;overflow:hidden">_THIS?frag-subfragment=header&amp;frag-id=header/THIS_</div>
  67. </xsl:if>
  68. <xsl:choose>
  69. <xsl:when test="$pages/@unavailable = 'true'">
  70. <xsl:call-template name="render-error">
  71. <xsl:with-param name="message"><xts:string id="IDS_BV_PAGE_UNAVAILABLE"/></xsl:with-param>
  72. </xsl:call-template>
  73. </xsl:when>
  74. <xsl:when test="$pages/@no-source = 'true'">
  75. <xsl:call-template name="render-error">
  76. <xsl:with-param name="message"><xts:string id="IDS_VEW_CUSTOMIZE"/></xsl:with-param>
  77. </xsl:call-template>
  78. </xsl:when>
  79. <xsl:otherwise>
  80. <table id="_THIS_tabs_main" border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed" role="presentation">
  81. <tr>
  82. <td role="tablist" id="_THIS_tabs_area" valign="top" nowrap="nowrap" style="width:{$vtabs-width}px">
  83. <div id="_THIS_tabs_area_div" style="overflow-x:hidden;overflow-y:auto;width:100%;">
  84. <xsl:variable name="vtabslab"><xts:string id="IDS_VERTICLE_TABS_LABEL"/></xsl:variable>
  85. <div id="_THIS_tabs_control_div" class="cogstyle-vtabs-area" style="overflow-x:hidden;width:100%;" role="navigation" aria-label="{$vtabslab}" >
  86. <xsl:apply-templates select="$pages/*" mode="html"/>
  87. <script type="text/javascript">
  88. <xsl:text>&#10;var _THIS_tabs = </xsl:text>
  89. <xsl:apply-templates select="$pages" mode="script"/>
  90. <xsl:text>;</xsl:text>
  91. </script>
  92. </div>
  93. <div id="_THIS_filter_container" style="overflow:auto;">
  94. <xsl:if test="$first-page">
  95. <xsl:variable name="tab-id" select="concat($first-page/../@id, $first-page/@id)"/>
  96. <div id="_THIS_{$tab-id}filter" style="display:none" class="cogstyle-filter"/>
  97. </xsl:if>
  98. </div>
  99. </div>
  100. </td>
  101. <td id="_THIS_tabs_splitter" valign="top" nowrap="nowrap" class="cogstyle-splitter">
  102. <br/>
  103. </td>
  104. <td id="_THIS_tabs_container" valign="top">
  105. <xsl:if test="$first-page">
  106. <xsl:variable name="tab-id" select="concat($first-page/../@id, $first-page/@id)"/>
  107. <div id="_THIS_{$tab-id}page" role="tabpanel" aria-labelledby="_THIS_{$tab-id}tab_anchor">
  108. <xsl:attribute name="style">
  109. <xsl:text>width:100%;height:100%</xsl:text>
  110. </xsl:attribute>
  111. <div id="_THIS_{$tab-id}content">
  112. <xsl:attribute name="style">
  113. <xsl:text>width:100%;height:100%;overflow-x:auto;</xsl:text>
  114. </xsl:attribute>
  115. <xsl:attribute name="class">
  116. <xsl:choose>
  117. <xsl:when test="$fixed = 'true'">cogstyle-vtabs-page-content-fixed</xsl:when>
  118. <xsl:otherwise>cogstyle-vtabs-page-content</xsl:otherwise>
  119. </xsl:choose>
  120. </xsl:attribute>
  121. <xsl:text>_THIS?frag-subfragment=firstpage&amp;frag-id=</xsl:text>
  122. <xsl:value-of select="$tab-id"/>
  123. <xsl:text>/THIS_</xsl:text>
  124. </div>
  125. </div>
  126. </xsl:if>
  127. </td>
  128. </tr>
  129. </table>
  130. </xsl:otherwise>
  131. </xsl:choose>
  132. <xsl:if test="$footer != ''">
  133. <div id="_THIS_footercontent">_THIS?frag-subfragment=footer&amp;frag-id=footer/THIS_</div>
  134. </xsl:if>
  135. </div>
  136. <script type="text/javascript">
  137. <xsl:text>
  138. function _THIS_get_selected_tab() {
  139. var tab = _THIS_tabs.tabs[_THIS_tabs.activeTabID];
  140. while (tab &amp;&amp; tab.subtabs) {
  141. tab = tab.subtabs.tabs[tab.subtabs.activeTabID];
  142. }
  143. return tab;
  144. }
  145. function _THIS_refresh(evt) {
  146. if (evt.eventPhase == evt.AT_TARGET) {
  147. if (typeof _THIS_tabs != 'undefined') {
  148. var selectedTabs = _THIS_tabs.activeTabID;
  149. for (var tabID in _THIS_tabs.tabs) {
  150. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  151. if (subTab) {
  152. selectedTabs += "," + subTab.activeTabID;
  153. }
  154. }
  155. if (_F_getFragmentByID("_THIS_header")) {
  156. _F_getFragmentByID("_THIS_header").raiseEvent("fragment.refresh",null,null,false,true);
  157. }
  158. if (_F_getFragmentByID("_THIS_footer")) {
  159. _F_getFragmentByID("_THIS_footer").raiseEvent("fragment.refresh",null,null,false,true);
  160. }
  161. //Hide the current tab, as it may not exist after the refresh
  162. var currentTab = _THIS_get_selected_tab();
  163. if (currentTab) {
  164. currentTab.deselect();
  165. }
  166. evt.preventDefault();
  167. _THIS_.retrieve("refresh=true&amp;selectedTabs="+selectedTabs,"_THIS_tabs_control_div", false, true);
  168. }
  169. }
  170. }
  171. function _THIS_onload(evt) {
  172. if (evt.eventPhase == evt.CAPTURING_PHASE) {
  173. if (_THIS_.onresize)
  174. _THIS_.onresize();
  175. } else if (evt.eventPhase == evt.AT_TARGET) {
  176. </xsl:text>
  177. <xsl:if test="$first-page">
  178. <xsl:text>
  179. var firstChild = _F_getFragmentByID('</xsl:text><xsl:value-of select="concat('_THIS_',$first-page/../@id,$first-page/@id)"/><xsl:text>');
  180. if (firstChild != null)
  181. {
  182. firstChild.raiseEvent("fragment.load", null, "", false, false);
  183. }
  184. if (_F_getFragmentByID("_THIS_header")) {
  185. _F_getFragmentByID("_THIS_header").raiseEvent("fragment.load", null, "", false, false);
  186. }
  187. if (_F_getFragmentByID("_THIS_footer")) {
  188. _F_getFragmentByID("_THIS_footer").raiseEvent("fragment.load", null, "", false, false);
  189. }
  190. </xsl:text>
  191. </xsl:if>
  192. <xsl:text>
  193. if (_THIS_.parent.parent == null) {
  194. </xsl:text>
  195. <xsl:choose>
  196. <xsl:when test="$fixed = 'true'">
  197. <xsl:text>
  198. if (document.all) {
  199. document.body.scroll = "no";
  200. EventUtils.addEventListener(window,"beforeprint",function(event){document.body.style.overflow = "auto";document.body.scroll = "auto";document.getElementById("_THIS_tabs_area_div").style.overflowY="";var currentTab=_THIS_get_selected_tab();if(currentTab){var div=document.getElementById(currentTab.uniqueID()+"content");if(div){div.style.overflow="";}}});
  201. EventUtils.addEventListener(window,"afterprint",function(event){document.body.style.overflow = "";document.body.scroll = "no";document.getElementById("_THIS_tabs_area_div").style.overflowY="auto";var currentTab=_THIS_get_selected_tab();if(currentTab){var div=document.getElementById(currentTab.uniqueID()+"content");if(div){div.style.overflow="auto";}}scroll(0,0);});
  202. } else {
  203. document.body.style.overflow = "hidden";
  204. }
  205. scroll(0,0);
  206. </xsl:text>
  207. </xsl:when>
  208. <xsl:otherwise>
  209. <xsl:text>
  210. if (document.all) {
  211. document.body.scroll = "";
  212. } else {
  213. document.body.style.overflow = "auto";
  214. }
  215. </xsl:text>
  216. </xsl:otherwise>
  217. </xsl:choose>
  218. <xsl:text>
  219. }
  220. new ui_splitter({id: "_THIS_tabs_splitter", resizing: _THIS_tabs});
  221. _THIS_.onresize = function() {
  222. var firstChild = _F_getFragmentByID('</xsl:text><xsl:value-of select="concat('_THIS_',$first-page/../@id,$first-page/@id)"/><xsl:text>');
  223. if (firstChild != null) {
  224. var tabsContainer = $(firstChild.parent.id + "tabs_container");
  225. var firstChildParentDiv = $(firstChild.parent.div);
  226. var height = xClientHeight() - ui_calcAvailableHeight(firstChildParentDiv, document.body,true);
  227. tabsContainer.style.height= height+'px';
  228. }
  229. if (typeof _THIS_tabs != 'undefined') {
  230. _THIS_tabs.onresize();
  231. }
  232. return true;
  233. }
  234. _THIS_.onresize();
  235. }
  236. }
  237. function _THIS_modeChange(evt)
  238. {
  239. if ((evt.eventPhase == evt.AT_TARGET)&amp;&amp;(evt.payload["newMode"] == "edit")) {
  240. //Remove fragment.retrieve before and after event handlers
  241. _THIS_.removeEventListener("fragment.retrieve.before", "_THIS_monitor", true);
  242. _THIS_.removeEventListener("fragment.retrieve.after", "_THIS_monitor", true);
  243. </xsl:text>
  244. <xsl:if test="string(/root/controllerParams/param[@name='frag-portalAgent'])!='cognos'">
  245. <xsl:text>
  246. _THIS_.removeEventListener("fragment.reload", "_THIS_monitor", true);
  247. </xsl:text>
  248. </xsl:if>
  249. <xsl:text>
  250. //Clean up child fragments before opening the edit page
  251. var childFragments = _THIS_.getChildren();
  252. if (childFragments) {
  253. for (var i=0; i &lt; childFragments.length; i++) {
  254. childFragments[i].destroy();
  255. }
  256. }
  257. }
  258. }
  259. function _THIS_windowStateHandler(evt)
  260. {
  261. if (evt.eventPhase == evt.AT_TARGET) {
  262. evt.preventDefault();
  263. }
  264. }
  265. function _THIS_visibilityHandler(evt)
  266. {
  267. if (evt.eventPhase == evt.AT_TARGET) {
  268. var currentTab = _THIS_get_selected_tab();
  269. if (_F_getFragmentByID(currentTab.uniqueID()))
  270. _F_getFragmentByID(currentTab.uniqueID()).raiseEvent("fragment.visibility.change",
  271. {
  272. "setVisibility":evt.payload.newVisibility
  273. }
  274. , "params", false, false);
  275. }
  276. }
  277. if (typeof _THIS_tabs != 'undefined') {
  278. _THIS_tabs.attach(null);
  279. }
  280. _THIS_.addEventListener("fragment.visibility.change", "_THIS_visibilityHandler", false);
  281. _THIS_.addEventListener("fragment.windowstate.change", "_THIS_windowStateHandler", false);
  282. _THIS_.addEventListener("fragment.refresh", "_THIS_refresh", false);
  283. _THIS_.addEventListener("fragment.load", "_THIS_onload", true);
  284. _THIS_.addEventListener("fragment.mode.change", "_THIS_modeChange", false);
  285. </xsl:text>
  286. var _THIS_currentSelection = '<xsl:value-of select="encodingUtils:javascriptencode(string($selected-tabs))"/>';
  287. <xsl:choose>
  288. <xsl:when test="/root/controllerParams/param[@name='frag-portalAgent']='cognos'">
  289. <xsl:text>
  290. function _THIS_saveState(){
  291. if (typeof _THIS_tabs != 'undefined') {
  292. var selectedTabs = _THIS_tabs.activeTabID;
  293. for (var tabID in _THIS_tabs.tabs) {
  294. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  295. if (subTab) {
  296. selectedTabs += "," + subTab.activeTabID;
  297. }
  298. }
  299. if (_THIS_currentSelection != selectedTabs){
  300. _THIS_currentSelection = selectedTabs;
  301. var fragRequest = new _F_Ajax.Request(_THIS_.interactionURI("refresh=true&amp;selectedTabs="+selectedTabs),
  302. {
  303. requestHeaders:
  304. {
  305. "Connection": "keep-alive",
  306. "Accept": "text/xml,application/xml"
  307. },
  308. asynchronous : false
  309. });
  310. }
  311. }
  312. }
  313. _F_Document.addEventListener(window, "beforeunload", _THIS_saveState);
  314. </xsl:text>
  315. </xsl:when>
  316. <xsl:otherwise>
  317. <xsl:text>
  318. function _THIS_saveStateEvt(evt)
  319. {
  320. if (evt.eventPhase == evt.AT_TARGET) {
  321. if (typeof _THIS_tabs != 'undefined') {
  322. var selectedTabs = _THIS_tabs.activeTabID;
  323. for (var tabID in _THIS_tabs.tabs) {
  324. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  325. if (subTab) {
  326. selectedTabs += "," + subTab.activeTabID;
  327. }
  328. }
  329. if (_THIS_currentSelection != selectedTabs){
  330. _THIS_currentSelection = selectedTabs;
  331. _THIS_.retrieve("updateState=true&amp;selectedTabs="+selectedTabs,"_THIS_tabs_control_div",true, true);
  332. }
  333. }
  334. }
  335. }
  336. _THIS_.addEventListener("fragment.reload", "_THIS_saveStateEvt", false);
  337. </xsl:text>
  338. </xsl:otherwise>
  339. </xsl:choose>
  340. <xsl:text>
  341. //- Activity Indicators
  342. var _THIS_indicators = null;
  343. function _THIS_monitor(evt)
  344. {
  345. if (evt.eventPhase == evt.AT_TARGET) //only want to execute this on downstream events
  346. return;
  347. if (_THIS_indicators == null)
  348. _THIS_indicators = new ui_throbbers("_THIS_", "_THIS?frag-resource=/ps/portal/images/icon_loading.gif/THIS_");
  349. _THIS_indicators.handler(evt);
  350. }
  351. _THIS_.addEventListener("fragment.retrieve.before", "_THIS_monitor", true);
  352. _THIS_.addEventListener("fragment.retrieve.after", "_THIS_monitor", true);
  353. </xsl:text>
  354. </script>
  355. </xsl:when>
  356. <xsl:otherwise>
  357. <!-- We are doing a refresh. Only generate the tabs. -->
  358. <xsl:apply-templates select="$pages/*" mode="html"/>
  359. <script type="text/javascript">
  360. <xsl:text>&#10;var _THIS_tabs = </xsl:text>
  361. <xsl:apply-templates select="$pages" mode="script"/>
  362. <xsl:text>;
  363. _THIS_tabs.attach(null);
  364. </xsl:text>
  365. <xsl:if test="$refresh='true'">
  366. <xsl:text>
  367. var _THIS_visibleTab = _THIS_get_selected_tab();
  368. if (_THIS_visibleTab) {
  369. _THIS_visibleTab.select();
  370. }
  371. </xsl:text>
  372. </xsl:if>
  373. </script>
  374. </xsl:otherwise>
  375. </xsl:choose>
  376. </xsl:template>
  377. <xsl:template match="page" mode="html">
  378. <xsl:variable name="tabs-id" select="../@id"/>
  379. <xsl:variable name="tab-id" select="@id"/>
  380. <xsl:variable name="alt">
  381. <xsl:if test="parent::page">-alt</xsl:if>
  382. </xsl:variable>
  383. <xsl:variable name="more">
  384. <xsl:if test="page">-opened</xsl:if>
  385. <xsl:if test="(position() = 1 and not(../page[@selected='true'])) or @selected='true'">-active</xsl:if>
  386. </xsl:variable>
  387. <xsl:variable name="active" select="(position() = 1 and not(../page[@selected='true'])) or @selected='true'"/>
  388. <div id="_THIS_{$tabs-id}{$tab-id}tab">
  389. <xsl:if test="$active">
  390. <xsl:attribute name="class">cogstyle-vtabs-active-border</xsl:attribute>
  391. </xsl:if>
  392. <div class="cogstyle-vtabs{$alt}{$more}-left-edge">
  393. <div class="cogstyle-vtabs{$alt}{$more}-right-edge">
  394. <div class="cogstyle-vtabs{$alt}{$more}" style="padding-left: { 10 * count(ancestor::page) }px" title="{@title}">
  395. <xsl:variable name="spacer">_THIS?frag-resource=/ps/images/space.gif/THIS_</xsl:variable>
  396. <xsl:variable name="icon">
  397. <xsl:choose>
  398. <xsl:when test="$showicons = 'true' and starts-with(@icon, 'http://')">
  399. <xsl:value-of select="@icon"/>
  400. </xsl:when>
  401. <xsl:when test="$showicons = 'true' and @icon != ''">
  402. <xsl:text>_THIS?frag-resource=</xsl:text>
  403. <xsl:value-of select="@icon"/>
  404. <xsl:text>/THIS_</xsl:text>
  405. </xsl:when>
  406. <xsl:otherwise>
  407. <xsl:value-of select="$spacer"/>
  408. </xsl:otherwise>
  409. </xsl:choose>
  410. </xsl:variable>
  411. <img id="_THIS_{ $tabs-id }{ $tab-id }_throbber" src="{ $icon }" border="0">
  412. <xsl:if test="parent::page">
  413. <xsl:attribute name="parent"><xsl:value-of select="concat('_THIS_', ancestor::*[2]/@id, ancestor::*[1]/@id, '_throbber')"/></xsl:attribute>
  414. </xsl:if>
  415. <xsl:attribute name="alt"></xsl:attribute>
  416. <xsl:attribute name="class">
  417. <xsl:text>cogstyle-vtabs-icon</xsl:text>
  418. <xsl:if test="@hidden = 'true'"> cogstyle-img-faded</xsl:if>
  419. </xsl:attribute>
  420. </img>
  421. <a href="javascript:noop()" onclick="return false" role="tab" aria-selected="{$active}" id="_THIS_{$tabs-id}{$tab-id}tab_anchor">
  422. <xsl:if test="position() = 1">
  423. <xsl:choose>
  424. <xsl:when test="page"><xsl:attribute name="aria-controls">_THIS_<xsl:value-of select="$tabs-id"/><xsl:value-of select="$tab-id"/>subtabs</xsl:attribute></xsl:when>
  425. <xsl:otherwise><xsl:attribute name="aria-controls">_THIS_<xsl:value-of select="$tabs-id"/><xsl:value-of select="$tab-id"/>page</xsl:attribute></xsl:otherwise>
  426. </xsl:choose>
  427. </xsl:if>
  428. <xsl:value-of select="@title"/>
  429. </a>
  430. </div>
  431. </div>
  432. </div>
  433. <xsl:if test="page">
  434. <div id="_THIS_{$tabs-id}{$tab-id}subtabs" class="cogstyle-vtabs{$alt}{$more}-subtabs-area">
  435. <xsl:if test="not((position() = 1 and not(../page[@selected='true'])) or @selected='true')">
  436. <xsl:attribute name="style">display:none</xsl:attribute>
  437. </xsl:if>
  438. <xsl:apply-templates mode="html"/>
  439. </div>
  440. </xsl:if>
  441. </div>
  442. </xsl:template>
  443. <xsl:template match="pages|page" mode="script">
  444. <xsl:text>new ui_vtabs({ frag: _THIS_, id: "</xsl:text>
  445. <xsl:value-of select="@id"/>
  446. <xsl:text>"</xsl:text>
  447. <xsl:if test="self::pages">
  448. <xsl:text>, fixed: </xsl:text>
  449. <xsl:value-of select="$fixed"/>
  450. <xsl:text>, vtabsWidth: </xsl:text>
  451. <xsl:value-of select="number($vtabs-width)"/>
  452. </xsl:if>
  453. <xsl:text>, activeTabID: "</xsl:text>
  454. <xsl:choose>
  455. <xsl:when test="page[@selected='true']">
  456. <xsl:value-of select="page[@selected='true']/@id"/>
  457. </xsl:when>
  458. <xsl:otherwise>
  459. <xsl:value-of select="page[1]/@id"/>
  460. </xsl:otherwise>
  461. </xsl:choose>
  462. <xsl:text>", tabs: {&#10;</xsl:text>
  463. <xsl:for-each select="page">
  464. <xsl:variable name="tab-id" select="@id"/>
  465. <xsl:value-of select="substring('&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;',1,count(ancestor-or-self::page))"/>
  466. <xsl:text>"</xsl:text>
  467. <xsl:value-of select="$tab-id"/>
  468. <xsl:text>": new ui_vtab({id: "</xsl:text>
  469. <xsl:value-of select="$tab-id"/>
  470. <xsl:text>", </xsl:text>
  471. <xsl:choose>
  472. <xsl:when test="page">
  473. <xsl:text>subtabs: </xsl:text>
  474. <xsl:apply-templates select="self::page" mode="script"/>
  475. </xsl:when>
  476. <xsl:when test="@href">
  477. <xsl:text>href: "</xsl:text>
  478. <xsl:value-of select="@href"/>
  479. <xsl:text>"</xsl:text>
  480. </xsl:when>
  481. </xsl:choose>
  482. <xsl:if test ="custom/param">
  483. <xsl:text>, customProperties:{</xsl:text>
  484. <xsl:for-each select="custom/param">
  485. <xsl:value-of select="@name"/>
  486. <xsl:text>:"</xsl:text>
  487. <xsl:value-of select="encodingUtils:javascriptencode(string(.))"/>
  488. <xsl:text>"</xsl:text>
  489. <xsl:if test="position() &lt; last()">,&#10;</xsl:if>
  490. </xsl:for-each>
  491. <xsl:text>}</xsl:text>
  492. </xsl:if>
  493. <xsl:if test="@id = $first-page/@id and string($selected-tabs)=''">
  494. <xsl:text>, loaded: true</xsl:text>
  495. </xsl:if>
  496. <xsl:text>, target: { id: "</xsl:text>
  497. <xsl:value-of select="@id"/>
  498. <xsl:text>", type: "</xsl:text>
  499. <xsl:value-of select="@type"/>
  500. <xsl:if test="@target != ''">
  501. <xsl:text>", targetType: "</xsl:text>
  502. <xsl:value-of select="@target"/>
  503. </xsl:if>
  504. <xsl:text>", permissions: "</xsl:text>
  505. <xsl:value-of select="@permissions"/>
  506. <xsl:text>"}</xsl:text>
  507. <xsl:if test="string(/root/customs/param[@name='reportSavedOutputHeight']) != ''">
  508. <xsl:text>, height: </xsl:text><xsl:value-of select="/root/customs/param[@name='reportSavedOutputHeight']"/>
  509. </xsl:if>
  510. <xsl:text>})</xsl:text>
  511. <xsl:if test="position() &lt; last()">,&#10;</xsl:if>
  512. </xsl:for-each>
  513. <xsl:text>} } )</xsl:text>
  514. </xsl:template>
  515. <xsl:template name="get-custom">
  516. <xsl:param name="name"/>
  517. <xsl:choose>
  518. <xsl:when test="$customs[@name=$name]">
  519. <xsl:value-of select="$customs[@name=$name]"/>
  520. </xsl:when>
  521. <xsl:otherwise>
  522. <xsl:value-of select="$meta/customProperties[@name=$name]/default/value"/>
  523. </xsl:otherwise>
  524. </xsl:choose>
  525. </xsl:template>
  526. <xsl:template name="render-error">
  527. <xsl:param name="message" select="''"/>
  528. <table id="_THIS_default" border="0" cellspacing="0" cellpadding="0" width="100%">
  529. <tr>
  530. <td class="portlet-font" align="center" valign="middle" height="100">
  531. <xsl:value-of select="$message"/>
  532. </td>
  533. </tr>
  534. </table>
  535. </xsl:template>
  536. </xsl:stylesheet>