toollogic2.xslt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2013
  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:pf="http://developer.cognos.com/schemas/xts/pf"
  15. xmlns:mt="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mt"
  16. xmlns:mf="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mf"
  17. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  18. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  19. xmlns:tool="http://developer.cognos.com/schemas/xts/logicsheets/xslt/toollogic/"
  20. xmlns:out="dummy-uri"
  21. exclude-result-prefixes="tool">
  22. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  23. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  24. <xsl:variable name="tool-namespace-uri" select="'http://developer.cognos.com/schemas/xts/logicsheets/xslt/toollogic/'"/>
  25. <!--
  26. ===============================================================================================
  27. tool:variables - define commonly used variables
  28. ===============================================================================================
  29. -->
  30. <xsl:template match="tool:variables" priority="1">
  31. <pf:variables/>
  32. <out:variable name="tool-search">
  33. <out:choose>
  34. <out:when test="/root/search">true</out:when>
  35. <out:otherwise>false</out:otherwise>
  36. </out:choose>
  37. </out:variable>
  38. <xsl:if test="@useEnvParams">
  39. <out:variable name="tool-stateEnvParams" select="{@useEnvParams}"/>
  40. </xsl:if>
  41. <out:variable name="tool-stateParams" select="'{concat(' ', @stateParams, ' backURL tool_tab ')}'"/>
  42. <mf:variables>
  43. <xsl:if test="string(@type)='drillthru'">
  44. <mf:toolsdrillthru>true</mf:toolsdrillthru>
  45. </xsl:if>
  46. <mf:stateParams>
  47. <out:choose>
  48. <xsl:if test="@useEnvParams">
  49. <out:when test="$tool-stateEnvParams != ''">
  50. <out:value-of select="concat(' ',string($tool-stateEnvParams),' backURL tool_tab ')"/>
  51. <out:if test="$tool-search = 'true'">
  52. <out:value-of select="'search stext sscope smethod sfield sstatus stype smodified sshortcuts stime m_searchsection m_pagerfromsearch m_pagertosearch '"/>
  53. </out:if>
  54. </out:when>
  55. </xsl:if>
  56. <out:when test="$tool-search = 'true'">
  57. <out:value-of select="concat($tool-stateParams, 'search stext sscope smethod sfield sstatus stype smodified sshortcuts stime m_searchsection m_pagerfromsearch m_pagertosearch ')"/>
  58. </out:when>
  59. <out:otherwise>
  60. <out:value-of select="$tool-stateParams"/>
  61. </out:otherwise>
  62. </out:choose>
  63. </mf:stateParams>
  64. </mf:variables>
  65. <out:variable name="tool-back-url"><out:value-of select="xtsext:protect(xtsext:urlencode(string(/root/env/param[@name = 'backURL'])),'url','url','getdata')"/></out:variable>
  66. <out:variable name="cmd-form" select="'{concat('c', @formName)}'"/>
  67. <out:variable name="edit-form" select="'{concat('p', @formName)}'"/>
  68. </xsl:template>
  69. <!--
  70. ===============================================================================================
  71. tool:head - generate the head of the HTML page
  72. ===============================================================================================
  73. -->
  74. <xsl:template match="tool:head" priority="1">
  75. <head>
  76. <!-- Standard meta tags -->
  77. <pf:meta/>
  78. <title>
  79. <xsl:choose>
  80. <xsl:when test="@title and @tab">
  81. <out:variable name="tab"><xts:string id="{@tab}"/></out:variable>
  82. <out:variable name="tool"><xts:string id="{@title}"/></out:variable>
  83. <xts:string id="IDS_TOOLS_TITLE">
  84. <xts:param name="toolTab"><out:value-of select="$tab"/></xts:param>
  85. <xts:param name="toolName"><out:value-of select="$tool"/></xts:param>
  86. </xts:string>
  87. </xsl:when>
  88. <xsl:when test="@title">
  89. <out:text><xts:string id="{@title}"/></out:text>
  90. </xsl:when>
  91. <xsl:otherwise>
  92. <out:text><xts:string id="IDS_COGNOS_REPORTS"/></out:text>
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. </title>
  96. <!-- add the theme style sheet -->
  97. <mt:stylesheet/>
  98. <!-- Common framework logic for Cognos Central main view -->
  99. <mf:head/>
  100. <!-- Help system -->
  101. <pf:help context="{@helpid}"/>
  102. <!-- adds functions to launch the studios.... -->
  103. <pf:launch/>
  104. <xsl:if test="tool:script">
  105. <script language="javascript">
  106. <xsl:copy-of select="tool:script/node()"/>
  107. </script>
  108. </xsl:if>
  109. </head>
  110. </xsl:template>
  111. <!--
  112. ===============================================================================================
  113. tool:banner - generate the top banner for tools
  114. ===============================================================================================
  115. -->
  116. <xsl:template match="tool:banner" priority="1">
  117. <xsl:if test="@hideHeaders!='true'">
  118. <mt:h1>
  119. <xsl:if test="@id != ''">
  120. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  121. </xsl:if>
  122. <mt:title>
  123. <xsl:if test="@title">
  124. <out:text><xts:string id="{@title}"/></out:text>
  125. </xsl:if>
  126. </mt:title>
  127. </mt:h1>
  128. <xsl:choose>
  129. <xsl:when test="tool:tabs">
  130. <out:variable name="tool-tab">
  131. <xsl:copy-of select="tool:tabs/child::node()"/>
  132. </out:variable>
  133. <xsl:call-template name="tool-gen-tabs">
  134. <xsl:with-param name="tabset-name" select="tool:tabs/@tabset-name"/>
  135. </xsl:call-template>
  136. </xsl:when>
  137. <xsl:otherwise>
  138. <mt:h3/>
  139. </xsl:otherwise>
  140. </xsl:choose>
  141. </xsl:if>
  142. <mt:h4 cogadmin="true">
  143. <mt:path>
  144. <xsl:apply-templates select="tool:path/child::node()"/>
  145. </mt:path>
  146. <xsl:apply-templates select="tool:actions/child::node()"/>
  147. </mt:h4>
  148. </xsl:template>
  149. <!--
  150. ===============================================================================================
  151. tool:banner - generate the top banner for tools
  152. ===============================================================================================
  153. -->
  154. <xsl:template match="tool:banner[@mode]" priority="1">
  155. <xsl:if test="@hideHeaders!='true'">
  156. <mt:h1 mode="{@mode}">
  157. <xsl:if test="@id != ''">
  158. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  159. </xsl:if>
  160. <mt:title>
  161. <xsl:if test="@title">
  162. <out:text><xts:string id="{@title}"/></out:text>
  163. </xsl:if>
  164. </mt:title>
  165. </mt:h1>
  166. <xsl:choose>
  167. <xsl:when test="tool:tabs">
  168. <out:variable name="tool-tab">
  169. <xsl:copy-of select="tool:tabs/child::node()"/>
  170. </out:variable>
  171. <xsl:call-template name="tool-gen-tabs">
  172. <xsl:with-param name="tabset-name" select="tool:tabs/@tabset-name"/>
  173. </xsl:call-template>
  174. </xsl:when>
  175. <xsl:otherwise>
  176. <mt:h3/>
  177. </xsl:otherwise>
  178. </xsl:choose>
  179. </xsl:if>
  180. <mt:h4>
  181. <xsl:if test="@jumpToMain != ''">
  182. <xsl:attribute name="jumpToMain"><xsl:value-of select="@jumpToMain"/></xsl:attribute>
  183. </xsl:if>
  184. <mt:path>
  185. <xsl:apply-templates select="tool:path/child::node()"/>
  186. </mt:path>
  187. <xsl:apply-templates select="tool:actions/child::node()"/>
  188. </mt:h4>
  189. </xsl:template>
  190. <!--
  191. ===============================================================================================
  192. tool:content - generate the main content for tools
  193. ===============================================================================================
  194. -->
  195. <xsl:template match="tool:content" priority="1">
  196. <xsl:variable name="evMode">
  197. <xsl:if test="not(@nomode)">tools</xsl:if>
  198. </xsl:variable>
  199. <form method="post" name="p{@formName}">
  200. <xsl:attribute name="action"><xsl:value-of select="'{$gateway}'"/></xsl:attribute>
  201. <xsl:copy-of select="*"/>
  202. <mf:edit-vars mode="{@evMode}">
  203. <xsl:if test="@tool:excludeVars">
  204. <xsl:attribute name="mf:excludeVars">
  205. <xsl:value-of select="@tool:excludeVars"/>
  206. </xsl:attribute>
  207. </xsl:if>
  208. </mf:edit-vars>
  209. <!-- standard set of form variables used to process commands like actions, new ... -->
  210. </form>
  211. <form method="post" name="c{@formName}">
  212. <xsl:attribute name="action"><xsl:value-of select="'{$gateway}'"/></xsl:attribute>
  213. <mf:cmd-vars/>
  214. <input type="hidden" name="from_tool" value="true"/>
  215. <xsl:choose>
  216. <xsl:when test="@tool='portaladmin'">
  217. <input type="hidden" name="m_p_canCustomize"/>
  218. </xsl:when>
  219. <xsl:when test="@tool='contentadmin'">
  220. <input type="hidden" name="m_deploymentWizardPage" value=""/>
  221. <input type="hidden" name="contentTaskType" value=""/>
  222. </xsl:when>
  223. <xsl:when test="@tool='schedule'">
  224. <!-- from_schedule_tool parameter is needed by the run schedule once dialog. -->
  225. <input type="hidden" name="from_schedule_tool" value="true"/>
  226. </xsl:when>
  227. <xsl:when test="@addViewOutput = 'true'">
  228. <input type="hidden" name="reportVersionPath" value=""/>
  229. <input type="hidden" name="runHistoryRequestedTime" value=""/>
  230. </xsl:when>
  231. </xsl:choose>
  232. </form>
  233. </xsl:template>
  234. <!--
  235. ===============================================================================================
  236. tool-gen-tabs: retrieve the name attribute or child tool:name element from the given node.
  237. ===============================================================================================
  238. -->
  239. <xsl:template name="tool-gen-tabs">
  240. <xsl:param name="selected"/>
  241. <xsl:param name="tabset-name"/>
  242. <out:variable name="selected">
  243. <xsl:value-of select="$selected"/>
  244. </out:variable>
  245. <xsl:if test="$tabset-name != ''">
  246. <mt:h3>
  247. <mt:tabs>
  248. <out:variable name="tabs">
  249. <xsl:choose>
  250. <!-- Schedule Tool tabs: (a) Activity; (s) Schedules. -->
  251. <xsl:when test="$tabset-name = 'schedule'">
  252. <out:variable name="scope">
  253. <out:choose>
  254. <out:when test="not(key('env-param','scope')) or key('env-param','scope')=''">own_entries</out:when>
  255. <out:otherwise>
  256. <out:value-of select="xtsext:protect(xtsext:urlencode(string(key('env-param','scope'))),'url','searchPath','getdata')"/>
  257. </out:otherwise>
  258. </out:choose>
  259. </out:variable>
  260. <tab>
  261. <out:choose>
  262. <out:when test="not($tool-tab) or $tool-tab='a'">
  263. <out:attribute name="selected">true</out:attribute>
  264. <xts:string id="IDS_SCHEDULE_ACTIVITY_TAB"/>
  265. </out:when>
  266. <out:otherwise>
  267. <a class="tabAnchor">
  268. <xsl:attribute name="href">
  269. <xsl:value-of select="'{$gateway}'"/>?b_action=xts.run<xsl:text/>
  270. <xsl:text/>&amp;m=<xsl:value-of select="'{$app}'"/><xsl:value-of select="'/tools_activity.xts'"/><xsl:text/>
  271. <xsl:text/>&amp;scope=<xsl:value-of select="'{$scope}'"/><xsl:text/>
  272. <xsl:text/>&amp;tool_tab=a&amp;backURL=<xsl:value-of select="'{$tool-back-url}'"/><xsl:text/>
  273. </xsl:attribute>
  274. <xts:string id="IDS_SCHEDULE_ACTIVITY_TAB"/>
  275. </a>
  276. </out:otherwise>
  277. </out:choose>
  278. </tab>
  279. <tab>
  280. <out:choose>
  281. <out:when test="$tool-tab='s'">
  282. <out:attribute name="selected">true</out:attribute>
  283. <xts:string id="IDS_SCHEDULE_SCHEDULE_TAB"/>
  284. </out:when>
  285. <out:otherwise>
  286. <a class="tabAnchor">
  287. <xsl:attribute name="href">
  288. <xsl:value-of select="'{$gateway}'"/>?b_action=xts.run<xsl:text/>
  289. <xsl:text/>&amp;m=<xsl:value-of select="'{$app}'"/><xsl:value-of select="'/tools_schedule.xts'"/><xsl:text/>
  290. <xsl:text/>&amp;scope=<xsl:value-of select="'{$scope}'"/><xsl:text/>
  291. <xsl:text/>&amp;tool_tab=s&amp;backURL=<xsl:value-of select="'{$tool-back-url}'"/><xsl:text/>
  292. </xsl:attribute>
  293. <xts:string id="IDS_SCHEDULE_SCHEDULE_TAB"/>
  294. </a>
  295. </out:otherwise>
  296. </out:choose>
  297. </tab>
  298. </xsl:when>
  299. <xsl:when test="$tabset-name = 'portalAdmin'">
  300. <tab>
  301. <out:choose>
  302. <out:when test="not($tool-tab) or $tool-tab='p'">
  303. <out:attribute name="selected">true</out:attribute>
  304. <xts:string id="IDS_TOOLS_PORTAL_ADMIN_PORTLETS_TAB"/>
  305. </out:when>
  306. <out:otherwise>
  307. <a class="tabAnchor">
  308. <xsl:attribute name="href">
  309. <xsl:value-of select="'{$gateway}'"/>?b_action=xts.run<xsl:text/>
  310. <xsl:text/>&amp;m=<xsl:value-of select="'{$app}'"/><xsl:value-of select="'/tools_portaladmin.xts'"/><xsl:text/>
  311. <xsl:text/>&amp;backURL=<xsl:value-of select="'{$tool-back-url}'"/><xsl:text/>
  312. </xsl:attribute>
  313. <xts:string id="IDS_TOOLS_PORTAL_ADMIN_PORTLETS_TAB"/>
  314. </a>
  315. </out:otherwise>
  316. </out:choose>
  317. </tab>
  318. <tab>
  319. <out:choose>
  320. <out:when test="$tool-tab='s'">
  321. <out:attribute name="selected">true</out:attribute>
  322. <xts:string id="IDS_TOOLS_PORTAL_ADMIN_STYLE_TAB"/>
  323. </out:when>
  324. <out:otherwise>
  325. <a class="tabAnchor">
  326. <xsl:attribute name="href">
  327. <xsl:value-of select="'{$gateway}'"/>?b_action=xts.run<xsl:text/>
  328. <xsl:text/>&amp;m=<xsl:value-of select="'{$app}'"/><xsl:value-of select="'/tools_skinadmin.xts'"/><xsl:text/>
  329. <xsl:text/>&amp;backURL=<xsl:value-of select="'{$tool-back-url}'"/><xsl:text/>
  330. </xsl:attribute>
  331. <xts:string id="IDS_TOOLS_PORTAL_ADMIN_STYLE_TAB"/>
  332. </a>
  333. </out:otherwise>
  334. </out:choose>
  335. </tab>
  336. </xsl:when>
  337. </xsl:choose>
  338. </out:variable>
  339. <out:call-template name="renderTabs">
  340. <out:with-param name="tabs" select="$tabs"/>
  341. <out:with-param name="scroll" select="false()"/>
  342. </out:call-template>
  343. </mt:tabs>
  344. </mt:h3>
  345. </xsl:if>
  346. </xsl:template>
  347. <!--
  348. ===============================================================================================
  349. The main engine
  350. ===============================================================================================
  351. -->
  352. <xsl:template match="*[namespace-uri() = $tool-namespace-uri]" priority="0">
  353. <xsl:comment>Ignoring <xsl:value-of select="name()"/> element.</xsl:comment>
  354. </xsl:template>
  355. <xsl:template match="*">
  356. <xsl:copy>
  357. <xsl:copy-of select="@*"/>
  358. <xsl:apply-templates/>
  359. </xsl:copy>
  360. </xsl:template>
  361. </xsl:stylesheet>