htabs.xslt 26 KB

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