htabs.xslt 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  10. xmlns:encodingUtils="com.cognos.portal.utils.EncodingUtils"
  11. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  12. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  13. <xsl:variable name="customs" select="/root/customs/param"/>
  14. <xsl:variable name="customMsgs" select="/root/input[@name='customMsgs']/customMsgs"/>
  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="folder">
  38. <xsl:call-template name="get-custom">
  39. <xsl:with-param name="name">folder</xsl:with-param>
  40. </xsl:call-template>
  41. </xsl:variable>
  42. <xsl:variable name="include-page-menu">
  43. <xsl:call-template name="get-custom">
  44. <xsl:with-param name="name">include-page-menu</xsl:with-param>
  45. </xsl:call-template>
  46. </xsl:variable>
  47. <xsl:variable name="refresh" select="string(/root/interactions/param[@name='refresh'])"/>
  48. <xsl:variable name="updateState" select="string(/root/interactions/param[@name='updateState'])"/>
  49. <xsl:variable name="level1-selected-page" select="($pages/page[@selected='true'] | $pages/page[position() = 1 and not($pages/page[@selected='true'])])"/>
  50. <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)] )"/>
  51. <xsl:variable name="first-page" select="$selected-page[not($refresh = 'true' or $updateState = 'true')]"/>
  52. <xsl:variable name="has-icons" select="$pages//*[@icon != '']"/>
  53. <xsl:variable name="selected-tabs" select="/root/state/param[@name='selectedTabs']"/>
  54. <xsl:template match="/">
  55. <xsl:choose>
  56. <xsl:when test="$refresh!='true' and $updateState!='true'">
  57. <div id="_THIS_tabIncompatibilityWarning" class="cogstyle-portlet-error-frame" style="display:none;">
  58. <table cellpadding="3">
  59. <tr>
  60. <td>
  61. <img src="_THIS?frag-resource=/ps/portal/images/msg_warning.gif/THIS_">
  62. <xsl:attribute name="alt"><xts:string id="IDS_BV_INCOMPATIBLE_ENVIRONMENT"/></xsl:attribute>
  63. </img>
  64. </td>
  65. <td><xts:string id="IDS_BV_INCOMPATIBLE_ENVIRONMENT"/></td>
  66. </tr>
  67. </table>
  68. </div>
  69. <div id="_THIS_bvContainer">
  70. <xsl:if test="$header != ''">
  71. <div id="_THIS_headercontent">_THIS?frag-subfragment=header&amp;frag-id=header/THIS_</div>
  72. </xsl:if>
  73. <xsl:choose>
  74. <xsl:when test="$pages/@unavailable = 'true'">
  75. <xsl:call-template name="render-error">
  76. <xsl:with-param name="message"><xts:string id="IDS_BV_PAGE_UNAVAILABLE"/></xsl:with-param>
  77. </xsl:call-template>
  78. </xsl:when>
  79. <xsl:when test="$pages/@no-source = 'true'">
  80. <xsl:call-template name="render-error">
  81. <xsl:with-param name="message"><xts:string id="IDS_VEW_CUSTOMIZE"/></xsl:with-param>
  82. </xsl:call-template>
  83. </xsl:when>
  84. <xsl:otherwise>
  85. <div id="_THIS_tabs_control_div">
  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. <xsl:if test="$first-page">
  94. <xsl:variable name="tab-id" select="concat($first-page/../@id, $first-page/@id)"/>
  95. <div id="_THIS_{$tab-id}page">
  96. <div id="_THIS_{$tab-id}content">
  97. <xsl:attribute name="class">
  98. <xsl:choose>
  99. <xsl:when test="$fixed = 'true'">cogstyle-htabs-page-content-fixed</xsl:when>
  100. <xsl:otherwise>cogstyle-htabs-page-content</xsl:otherwise>
  101. </xsl:choose>
  102. </xsl:attribute>
  103. <xsl:text>_THIS?frag-subfragment=firstpage&amp;frag-id=</xsl:text>
  104. <xsl:value-of select="$tab-id"/>
  105. <xsl:text>/THIS_</xsl:text>
  106. </div>
  107. </div>
  108. </xsl:if>
  109. </xsl:otherwise>
  110. </xsl:choose>
  111. <xsl:if test="$footer != ''">
  112. <div id="_THIS_footercontent">_THIS?frag-subfragment=footer&amp;frag-id=footer/THIS_</div>
  113. </xsl:if>
  114. </div>
  115. <script type="text/javascript">
  116. <xsl:text>
  117. function _THIS_get_selected_tab() {
  118. var tab = _THIS_tabs.tabs[_THIS_tabs.activeTabID];
  119. while (tab &amp;&amp; tab.subtabs) {
  120. tab = tab.subtabs.tabs[tab.subtabs.activeTabID];
  121. }
  122. return tab;
  123. }
  124. function _THIS_refresh(evt) {
  125. if (evt.eventPhase == evt.AT_TARGET) {
  126. if (typeof _THIS_tabs != 'undefined') {
  127. var selectedTabs = _THIS_tabs.activeTabID;
  128. for (var tabID in _THIS_tabs.tabs) {
  129. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  130. if (subTab) {
  131. selectedTabs += "," + subTab.activeTabID;
  132. }
  133. }
  134. if (_F_getFragmentByID("_THIS_header")) {
  135. _F_getFragmentByID("_THIS_header").raiseEvent("fragment.refresh",null,null,false,true);
  136. }
  137. if (_F_getFragmentByID("_THIS_footer")) {
  138. _F_getFragmentByID("_THIS_footer").raiseEvent("fragment.refresh",null,null,false,true);
  139. }
  140. //Hide the current tab, as it may not exist after the refresh
  141. var currentTab = _THIS_get_selected_tab();
  142. if (currentTab) {
  143. currentTab.deselect();
  144. }
  145. evt.preventDefault();
  146. _THIS_.retrieve("refresh=true&amp;selectedTabs="+selectedTabs,"_THIS_tabs_control_div", false, true);
  147. }
  148. }
  149. }
  150. function _THIS_onload(evt) {
  151. if (evt.eventPhase == evt.CAPTURING_PHASE) {
  152. if (_THIS_.onresize)
  153. _THIS_.onresize();
  154. } else if (evt.eventPhase == evt.AT_TARGET) {
  155. </xsl:text>
  156. <xsl:if test="$first-page">
  157. <xsl:text>
  158. var firstChild = _F_getFragmentByID('</xsl:text><xsl:value-of select="xtsext:javascriptencode(string(concat('_THIS_',$first-page/../@id,$first-page/@id)))"/><xsl:text>');
  159. if (firstChild != null)
  160. {
  161. firstChild.raiseEvent("fragment.load", null, "", false, false);
  162. }
  163. if (_F_getFragmentByID("_THIS_header")) {
  164. _F_getFragmentByID("_THIS_header").raiseEvent("fragment.load", null, "", false, false);
  165. }
  166. if (_F_getFragmentByID("_THIS_footer")) {
  167. _F_getFragmentByID("_THIS_footer").raiseEvent("fragment.load", null, "", false, false);
  168. }
  169. </xsl:text>
  170. </xsl:if>
  171. if (_THIS_.parent.parent == null)
  172. {
  173. <xsl:choose>
  174. <xsl:when test="$fixed = 'true'">
  175. <xsl:text>
  176. if (document.all) {
  177. document.body.scroll = "no";
  178. EventUtils.addEventListener(window,"beforeprint",function(event){document.body.style.overflow = "auto";document.body.scroll = "auto";var currentTab=_THIS_get_selected_tab();if(currentTab){var div=document.getElementById(currentTab.uniqueID()+"content");if(div){div.style.overflow="";}}});
  179. EventUtils.addEventListener(window,"afterprint",function(event){document.body.style.overflow = "";document.body.scroll = "no";var currentTab=_THIS_get_selected_tab();if(currentTab){var div=document.getElementById(currentTab.uniqueID()+"content");if(div){div.style.overflow="auto";}}scroll(0,0);});
  180. } else {
  181. document.body.style.overflow = "hidden";
  182. }
  183. scroll(0,0);
  184. </xsl:text>
  185. </xsl:when>
  186. <xsl:otherwise>
  187. <xsl:text>
  188. if (document.all) {
  189. document.body.scroll = "";
  190. } else {
  191. document.body.style.overflow = "auto";
  192. }
  193. </xsl:text>
  194. </xsl:otherwise>
  195. </xsl:choose>
  196. <xsl:text>
  197. }
  198. _THIS_.onresize = function() {
  199. if (typeof _THIS_tabs != 'undefined') {
  200. _THIS_tabs.onresize();
  201. }
  202. return true;
  203. }
  204. _THIS_.onresize();
  205. }
  206. }
  207. function _THIS_modeChange(evt)
  208. {
  209. if ((evt.eventPhase == evt.AT_TARGET)&amp;&amp;(evt.payload["newMode"] == "edit")) {
  210. _THIS_.removeEventListener("fragment.retrieve.before", "_THIS_monitor", true);
  211. _THIS_.removeEventListener("fragment.retrieve.after", "_THIS_monitor", true);
  212. </xsl:text>
  213. <xsl:if test="string(/root/controllerParams/param[@name='frag-portalAgent'])!='cognos'">
  214. <xsl:text>
  215. _THIS_.removeEventListener("fragment.reload", "_THIS_monitor", true);
  216. </xsl:text>
  217. </xsl:if>
  218. <xsl:text>
  219. //Clean up child fragments before opening the edit page
  220. var childFragments = _THIS_.getChildren();
  221. if (childFragments) {
  222. for (var i=0; i &lt; childFragments.length; i++) {
  223. childFragments[i].destroy();
  224. }
  225. }
  226. }
  227. }
  228. function _THIS_windowStateHandler(evt)
  229. {
  230. if (evt.eventPhase == evt.AT_TARGET) {
  231. evt.preventDefault();
  232. }
  233. }
  234. function _THIS_visibilityHandler(evt)
  235. {
  236. if (evt.eventPhase == evt.AT_TARGET) {
  237. var currentTab = _THIS_get_selected_tab();
  238. if (_F_getFragmentByID(currentTab.uniqueID()))
  239. _F_getFragmentByID(currentTab.uniqueID()).raiseEvent("fragment.visibility.change",
  240. {
  241. "setVisibility":evt.payload.newVisibility
  242. }
  243. , "params", false, false);
  244. }
  245. }
  246. if (typeof _THIS_tabs != 'undefined') {
  247. _THIS_tabs.attach(null);
  248. }
  249. _THIS_.addEventListener("fragment.visibility.change", "_THIS_visibilityHandler", false);
  250. _THIS_.addEventListener("fragment.windowstate.change", "_THIS_windowStateHandler", false);
  251. _THIS_.addEventListener("fragment.refresh", "_THIS_refresh", false);
  252. _THIS_.addEventListener("fragment.load", "_THIS_onload", true);
  253. _THIS_.addEventListener("fragment.mode.change", "_THIS_modeChange", false);
  254. </xsl:text>
  255. var _THIS_currentSelection = '<xsl:value-of select="encodingUtils:javascriptencode(string($selected-tabs))"/>';
  256. <xsl:choose>
  257. <xsl:when test="/root/controllerParams/param[@name='frag-portalAgent']='cognos'">
  258. <xsl:text>
  259. function _THIS_saveState(){
  260. if (typeof _THIS_tabs != 'undefined') {
  261. var selectedTabs = _THIS_tabs.activeTabID;
  262. for (var tabID in _THIS_tabs.tabs) {
  263. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  264. if (subTab) {
  265. selectedTabs += "," + subTab.activeTabID;
  266. }
  267. }
  268. if (_THIS_currentSelection != selectedTabs){
  269. _THIS_currentSelection = selectedTabs;
  270. var fragRequest = new _F_Ajax.Request(_THIS_.interactionURI("refresh=true&amp;selectedTabs="+selectedTabs),
  271. {
  272. requestHeaders:
  273. {
  274. "Connection": "keep-alive",
  275. "Accept": "text/xml,application/xml"
  276. },
  277. asynchronous : false
  278. });
  279. }
  280. }
  281. }
  282. _F_Document.addEventListener(window, "beforeunload", _THIS_saveState);
  283. </xsl:text>
  284. </xsl:when>
  285. <xsl:otherwise>
  286. <xsl:text>
  287. function _THIS_saveStateEvt(evt)
  288. {
  289. if (evt.eventPhase == evt.AT_TARGET) {
  290. if (typeof _THIS_tabs != 'undefined') {
  291. var selectedTabs = _THIS_tabs.activeTabID;
  292. for (var tabID in _THIS_tabs.tabs) {
  293. var subTab = _THIS_tabs.tabs[tabID].subtabs;
  294. if (subTab) {
  295. selectedTabs += "," + subTab.activeTabID;
  296. }
  297. }
  298. if (_THIS_currentSelection != selectedTabs){
  299. _THIS_currentSelection = selectedTabs;
  300. _THIS_.retrieve("updateState=true&amp;selectedTabs="+selectedTabs,"_THIS_tabs_control_div",true,true);
  301. }
  302. }
  303. }
  304. }
  305. _THIS_.addEventListener("fragment.reload", "_THIS_saveStateEvt", false);
  306. </xsl:text>
  307. </xsl:otherwise>
  308. </xsl:choose>
  309. <xsl:text>
  310. //- Activity Indicators
  311. var _THIS_indicators = null;
  312. function _THIS_monitor(evt)
  313. {
  314. if (evt.eventPhase == evt.AT_TARGET) //only want to execute this on downstream events
  315. return;
  316. if (_THIS_indicators == null)
  317. _THIS_indicators = new ui_throbbers("_THIS_", "_THIS?frag-resource=/ps/portal/images/icon_loading.gif/THIS_");
  318. _THIS_indicators.handler(evt);
  319. }
  320. _THIS_.addEventListener("fragment.retrieve.before", "_THIS_monitor", true);
  321. _THIS_.addEventListener("fragment.retrieve.after", "_THIS_monitor", true);
  322. </xsl:text>
  323. </script>
  324. </xsl:when>
  325. <xsl:otherwise>
  326. <xsl:apply-templates select="$pages" mode="html"/>
  327. <script type="text/javascript">
  328. <xsl:text>&#10;var _THIS_tabs = </xsl:text>
  329. <xsl:apply-templates select="$pages" mode="script"/>
  330. <xsl:text>;
  331. _THIS_tabs.attach(null);
  332. </xsl:text>
  333. <xsl:if test="$refresh='true'">
  334. <xsl:text>
  335. var _THIS_visibleTab = _THIS_get_selected_tab();
  336. if (_THIS_visibleTab) {
  337. _THIS_visibleTab.select();
  338. }
  339. </xsl:text>
  340. </xsl:if>
  341. </script>
  342. </xsl:otherwise>
  343. </xsl:choose>
  344. </xsl:template>
  345. <xsl:template match="pages | page" mode="html">
  346. <xsl:variable name="tabs-id" select="@id"/>
  347. <xsl:variable name="alt">
  348. <xsl:if test="local-name()='page'">-alt</xsl:if>
  349. </xsl:variable>
  350. <table id="_THIS_{$tabs-id}tabs" class="cogstyle-htabs{$alt}-bar" style="table-layout:fixed;padding-bottom:2px;" cellpadding="0" cellspacing="0" width="100%">
  351. <tr>
  352. <xsl:if test="count(ancestor::page) = 0 and count(ancestor::pages) = 0 and string($include-page-menu)='true'">
  353. <td width="24" height="20" align="center" valign="middle">
  354. <script language="javascript">
  355. function ccModalCallBack(){}
  356. function _THIS_page_action(cmd) {
  357. var currentTab = _THIS_get_selected_tab();
  358. var pageId = (currentTab != null) ? currentTab.target.id : null;
  359. var objectClass = (currentTab != null) ? currentTab.target.type : null;
  360. var sBackURL = encodeURIComponent(_F_Config.gateway + "?b_action=xts.run&amp;m=/portal/modal.xts&amp;m_reload=");
  361. switch (cmd) {
  362. case "create":
  363. ccModalCallBack = function() {
  364. ui_modal_dialog.close();
  365. var currentTab = _THIS_get_selected_tab();
  366. if (currentTab) {
  367. currentTab.deselect();
  368. }
  369. _THIS_.raiseEvent("fragment.refresh",null,null,false,true);
  370. }
  371. var url = _F_Config.gateway + "?b_action=xts.run" +
  372. "&amp;m=portal/new_general.xts" +
  373. "&amp;m_new_class=pagelet" +
  374. "&amp;showViewPage=false" +
  375. "&amp;backURL=" + sBackURL;
  376. <xsl:variable name="cmFolder">
  377. <xsl:choose>
  378. <xsl:when test="starts-with($folder, 'path:')">
  379. <xsl:value-of select="substring-after($folder,'path:')"/>
  380. </xsl:when>
  381. <xsl:when test="starts-with($folder, 'storeID(')">
  382. <xsl:value-of select="$folder"/>
  383. </xsl:when>
  384. <xsl:when test="string($folder) != ''">
  385. <xsl:text>storeID('</xsl:text>
  386. <xsl:value-of select="$folder"/>
  387. <xsl:text>')</xsl:text>
  388. </xsl:when>
  389. </xsl:choose>
  390. </xsl:variable>
  391. var path = "<xsl:value-of select="xtsext:urlencode(string($cmFolder))"/>";
  392. url += "&amp;m_path=" + path;
  393. ui_modal_dialog.open(url,null,null,null,true,_THIS_.div);
  394. break;
  395. case "edit":
  396. ccModalCallBack = function() {
  397. ui_modal_dialog.close();
  398. var currentTab = _THIS_get_selected_tab();
  399. if (currentTab) {
  400. //Delete and re-create current edited page
  401. currentTab.loaded=false;
  402. currentTab.refreshRequired=false;
  403. _F_getFragmentByID(currentTab.uniqueID()).destroy();
  404. var tabContainer = $(currentTab.parent.frag.id + "bvContainer");
  405. var pageDiv = $(currentTab.pageID);
  406. tabContainer.removeChild(pageDiv);
  407. currentTab.select();
  408. }
  409. }
  410. var url = _F_Config.gateway + "?b_action=xts.run" +
  411. "&amp;m=portal/properties_pagelet_layout.xts" +
  412. "&amp;m_class=pagelet" +
  413. "&amp;m_obj=" + "storeID('" + pageId + "')" +
  414. "&amp;backURL=" + sBackURL;
  415. ui_modal_dialog.open(url,null,null,null,true,_THIS_.div);
  416. break;
  417. }
  418. }
  419. function _THIS_page_menu_item_getItemState(menudef, item) {
  420. var currentTab = _THIS_get_selected_tab();
  421. if (menudef.items[item].actionname == 'create') {
  422. return "show";
  423. } else if (currentTab) {
  424. var objectClass = currentTab.target.type;
  425. var permissions = currentTab.target.permissions;
  426. var isPagelet = (objectClass == 'pagelet');
  427. var canEditPage = (permissions.indexOf("write") != -1 &amp;&amp; permissions.indexOf("read") != -1 &amp;&amp; permissions.indexOf("traverse") != -1);
  428. if ((!isPagelet || (isPagelet &amp;&amp; !canEditPage)) &amp;&amp; menudef.items[item].actionname == 'edit') {
  429. return "hide";
  430. }
  431. return "show";
  432. } else
  433. return "hide";
  434. }
  435. _THIS_menu_page_manager=new ui_menu({id: "tools", items: [
  436. {actionname: 'create', title: '<xts:string id="IDS_BV_PAGE_MENU_CREATE_PAGE" encode="javascript"/>', action: function(evt) { _THIS_page_action('create'); }, getItemState: function(menudef, i) {return _THIS_page_menu_item_getItemState(menudef, i); } }
  437. ,{actionname: 'edit', title: '<xts:string id="IDS_BV_PAGE_MENU_EDIT_PAGE" encode="javascript"/>', action: function(evt) { _THIS_page_action('edit'); }, getItemState: function(menudef, i) {return _THIS_page_menu_item_getItemState(menudef, i); } }
  438. ]
  439. });
  440. </script>
  441. <div class="_THIS_pageMenu">
  442. <div onclick="if(_THIS_menu_page_manager) ui_menuUpdate(_THIS_menu_page_manager); ui_menuShow(event,_THIS_menu_page_manager);">
  443. <img class="frag-btn-normal"
  444. onmouseover="toolbarButtonMouseOver(this)"
  445. onmouseout="toolbarButtonMouseOut(this)" src="_THIS?frag-resource=/fragments/common/images/menu.gif/THIS_" style="align:center"/>
  446. </div>
  447. </div>
  448. </td>
  449. </xsl:if>
  450. <td id="_THIS_{$tabs-id}tabscell" nowrap="nowrap" valign="bottom" role="application" wairole="application">
  451. <div class="cogstyle-htabs-last" role="tablist" wairole="tablist">
  452. <table id="_THIS_{$tabs-id}table" class="cogstyle-htabs{$alt}-table" cellpadding="0" cellspacing="0" role="presentation" wairole="presentation">
  453. <tr role="presentation" wairole="presentation">
  454. <xsl:for-each select="page">
  455. <xsl:variable name="tab-id" select="@id"/>
  456. <xsl:variable name="active">
  457. <xsl:if test="(position() = 1 and not(../page[@selected='true'])) or @selected='true'">-active</xsl:if>
  458. </xsl:variable>
  459. <xsl:variable name="ariaSelected" select="$active = '-active'"/>
  460. <td id="_THIS_{$tabs-id}{$tab-id}tab" valign="bottom" nowrap="nowrap" role="tab" wairole="tab" aria-selected="{$ariaSelected}">
  461. <div class="cogstyle-htabs{$alt}{$active}-left-edge" role="presnetation" wairole="presentation">
  462. <div class="cogstyle-htabs{$alt}{$active}-right-edge" role="presentation" wairole="presentation">
  463. <div class="cogstyle-htabs{ $alt }{ $active }" role="presentation" wairole="presentation">
  464. <xsl:variable name="spacer">_THIS?frag-resource=/ps/images/space.gif/THIS_</xsl:variable>
  465. <xsl:variable name="icon">
  466. <xsl:choose>
  467. <xsl:when test="$showicons = 'true' and starts-with(@icon, 'http://')">
  468. <xsl:value-of select="@icon"/>
  469. </xsl:when>
  470. <xsl:when test="$showicons = 'true' and @icon != ''">
  471. <xsl:text>_THIS?frag-resource=</xsl:text>
  472. <xsl:value-of select="@icon"/>
  473. <xsl:text>/THIS_</xsl:text>
  474. </xsl:when>
  475. <xsl:otherwise>
  476. <xsl:value-of select="$spacer"/>
  477. </xsl:otherwise>
  478. </xsl:choose>
  479. </xsl:variable>
  480. <img id="_THIS_{ $tabs-id }{ $tab-id }_throbber" src="{ $icon }" border="0" role="presentation" wairole="presentation">
  481. <xsl:if test="parent::page">
  482. <xsl:attribute name="parent"><xsl:value-of select="concat('_THIS_', ancestor::*[2]/@id, ancestor::*[1]/@id, '_throbber')"/></xsl:attribute>
  483. </xsl:if>
  484. <xsl:if test="contains($icon,'/space.gif/')" >
  485. <xsl:attribute name="alt"></xsl:attribute>
  486. </xsl:if>
  487. <xsl:attribute name="class">
  488. <xsl:text>cogstyle-vtabs-icon</xsl:text>
  489. <xsl:if test="@hidden = 'true'"> cogstyle-img-faded</xsl:if>
  490. </xsl:attribute>
  491. </img>
  492. <xsl:variable name="tabName">
  493. <xsl:choose>
  494. <xsl:when test="@title='Archive'">
  495. <xts:string id="IDS_FRAG_TAB_TITLE_ARCHIVE"/>
  496. </xsl:when>
  497. <xsl:when test="@title='Inbox'">
  498. <xts:string id="IDS_FRAG_TAB_TITLE_INBOX"/>
  499. </xsl:when>
  500. <xsl:when test="@title='Details'">
  501. <xts:string id="IDS_FRAG_TAB_TITLE_DETAILS"/>
  502. </xsl:when>
  503. <xsl:when test="@title='Comments'">
  504. <xts:string id="IDS_FRAG_TAB_TITLE_COMMENTS"/>
  505. </xsl:when>
  506. <xsl:when test="@title='Notification Options'">
  507. <xts:string id="IDS_FRAG_TAB_TITLE_NOTE_OPTIONS"/>
  508. </xsl:when>
  509. <xsl:otherwise>
  510. <xsl:value-of select="@title"/>
  511. </xsl:otherwise>
  512. </xsl:choose>
  513. </xsl:variable>
  514. <a href="javascript:noop()" onclick="return false" role="tab" wairole="tab" aria-selected="{$ariaSelected}">
  515. <xsl:if test="position() != 1">
  516. <xsl:attribute name="tabindex">-1</xsl:attribute>
  517. </xsl:if>
  518. <xsl:value-of select="$tabName"/>
  519. </a>
  520. <img style="height:16px; width:16px; vertical-align:text-bottom;" alt="" src="{ $spacer }" border="0" role="presentation" wairole="presentation"/>
  521. </div>
  522. </div>
  523. </div>
  524. </td>
  525. </xsl:for-each>
  526. </tr>
  527. </table>
  528. </div>
  529. </td>
  530. <td class="cogstyle-htabs-scroll-button-container" nowrap="nowrap" align="right" valign="bottom">
  531. <table cellpadding="0" cellspacing="1">
  532. <tr>
  533. <td valign="bottom" id="_THIS_{$tabs-id}leftbutton" class="cogstyle-htabs-scroll-button-disabled cogstyle-htabs-scroll-button-left-disabled">
  534. <div class="cogstyle-htabs-scroll-button-imageplaceholder">
  535. <img id="_THIS_{$tabs-id}leftbuttonimg" class="cogstyle-img-faded">
  536. <xsl:attribute name="src">
  537. <xsl:text>_THIS?frag-resource=/skins/</xsl:text>
  538. <xsl:value-of select="xtsext:javascriptencode(string(/root/preferences/param[@name='skin']))"/>
  539. <xsl:text>/shared/images/action_scroll_left.gif/THIS_</xsl:text>
  540. </xsl:attribute>
  541. <xsl:attribute name="alt"><xsl:value-of select="$customMsgs/param[@name='IDS_PROP_MULTIPAGE_SCROLL_LEFT']"/></xsl:attribute>
  542. </img>
  543. </div>
  544. </td>
  545. <td valign="bottom" id="_THIS_{$tabs-id}rightbutton" class="cogstyle-htabs-scroll-button-disabled cogstyle-htabs-scroll-button-right-disabled">
  546. <div class="cogstyle-htabs-scroll-button-imageplaceholder">
  547. <img id="_THIS_{$tabs-id}rightbuttonimg" class="cogstyle-img-faded">
  548. <xsl:attribute name="src">
  549. <xsl:text>_THIS?frag-resource=/skins/</xsl:text>
  550. <xsl:value-of select="xtsext:javascriptencode(string(/root/preferences/param[@name='skin']))"/>
  551. <xsl:text>/shared/images/action_scroll_right.gif/THIS_</xsl:text>
  552. </xsl:attribute>
  553. <xsl:attribute name="alt"><xsl:value-of select="$customMsgs/param[@name='IDS_PROP_MULTIPAGE_SCROLL_RIGHT']"/></xsl:attribute>
  554. </img>
  555. </div>
  556. </td>
  557. </tr>
  558. </table>
  559. </td>
  560. </tr>
  561. </table>
  562. <xsl:for-each select="page">
  563. <xsl:variable name="tab-id" select="concat($tabs-id, @id)"/>
  564. <xsl:if test="page">
  565. <div id="_THIS_{$tab-id}page">
  566. <xsl:if test="not((position() = 1 and not(../page[@selected='true'])) or @selected='true')">
  567. <xsl:attribute name="style">display:none</xsl:attribute>
  568. </xsl:if>
  569. <xsl:apply-templates select="self::page" mode="html"/>
  570. </div>
  571. </xsl:if>
  572. </xsl:for-each>
  573. </xsl:template>
  574. <xsl:template match="pages|page" mode="script">
  575. <xsl:text>new ui_htabs({frag: _THIS_, id: "</xsl:text>
  576. <xsl:value-of select="@id"/>
  577. <xsl:text>", activeTabID: "</xsl:text>
  578. <xsl:choose>
  579. <xsl:when test="page[@selected='true']">
  580. <xsl:value-of select="page[@selected='true']/@id"/>
  581. </xsl:when>
  582. <xsl:otherwise>
  583. <xsl:value-of select="page[1]/@id"/>
  584. </xsl:otherwise>
  585. </xsl:choose>
  586. <xsl:text>", fixed: </xsl:text>
  587. <xsl:value-of select="$fixed"/>
  588. <xsl:text>, tabs: {&#10;</xsl:text>
  589. <xsl:for-each select="page">
  590. <xsl:variable name="tab-id" select="@id"/>
  591. <xsl:value-of select="substring('&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;',1,count(ancestor-or-self::page))"/>
  592. <xsl:text>"</xsl:text>
  593. <xsl:value-of select="$tab-id"/>
  594. <xsl:text>": new ui_htab({id: "</xsl:text>
  595. <xsl:value-of select="$tab-id"/>
  596. <xsl:text>", </xsl:text>
  597. <xsl:choose>
  598. <xsl:when test="page">
  599. <xsl:text>subtabs: </xsl:text>
  600. <xsl:apply-templates select="self::page" mode="script"/>
  601. </xsl:when>
  602. <xsl:when test="@href">
  603. <xsl:text>href: "</xsl:text>
  604. <xsl:value-of select="@href"/>
  605. <xsl:text>"</xsl:text>
  606. </xsl:when>
  607. </xsl:choose>
  608. <xsl:if test="@id = $first-page/@id and string($selected-tabs)=''">
  609. <xsl:text>, loaded: true</xsl:text>
  610. </xsl:if>
  611. <xsl:text>, target: { id: "</xsl:text>
  612. <xsl:value-of select="@id"/>
  613. <xsl:text>", type: "</xsl:text>
  614. <xsl:value-of select="@type"/>
  615. <xsl:text>", permissions: "</xsl:text>
  616. <xsl:value-of select="@permissions"/>
  617. <xsl:text>"}</xsl:text>
  618. <xsl:if test="@type = 'report'">
  619. <xsl:text>, height: </xsl:text><xsl:value-of select="/root/customs/param[@name='reportSavedOutputHeight']"/>
  620. </xsl:if>
  621. <xsl:text>})</xsl:text>
  622. <xsl:if test="position() &lt; last()">,&#10;</xsl:if>
  623. </xsl:for-each>
  624. <xsl:text>} })</xsl:text>
  625. </xsl:template>
  626. <xsl:template name="get-custom">
  627. <xsl:param name="name"/>
  628. <xsl:choose>
  629. <xsl:when test="$customs[@name=$name]">
  630. <xsl:value-of select="$customs[@name=$name]"/>
  631. </xsl:when>
  632. <xsl:otherwise>
  633. <xsl:value-of select="$meta/customProperties[@name=$name]/default/value"/>
  634. </xsl:otherwise>
  635. </xsl:choose>
  636. </xsl:template>
  637. <xsl:template name="render-error">
  638. <xsl:param name="message" select="''"/>
  639. <table id="_THIS_default" border="0" cellspacing="0" cellpadding="0" width="100%">
  640. <tr>
  641. <td class="portlet-font" align="center" valign="middle" height="100">
  642. <xsl:value-of select="xtsext:javascriptencode(string($message))"/>
  643. </td>
  644. </tr>
  645. </table>
  646. </xsl:template>
  647. </xsl:stylesheet>