forward.xts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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, 2011
  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. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  13. <!--
  14. ===============================================================================================
  15. copy-prompts - If we are coming from a prompt page (method = forward) remember the prompt values then drop them from the
  16. environment parameters. This assumes that all parameters that begin with p_ belong to prompts.
  17. ===============================================================================================
  18. -->
  19. <xts:block id="copy-prompts" mode="interpret" processor="XSLT" type="exec" condition=".[/root/env/param[@name='method'] = 'forward']" mandatory="false">
  20. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  21. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  22. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  23. xmlns:cm="http://developer.cognos.com/schemas/cm/1/"
  24. xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope"
  25. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="send cml cm SOAP-ENV xtsext">
  26. <xsl:template match="/">
  27. <xts:sequence>
  28. <xts:append>
  29. <PromptValues>
  30. <xsl:apply-templates select="/root/env/param[starts-with(@name, 'p_')]" mode="prmtVals"/>
  31. </PromptValues>
  32. </xts:append>
  33. <xsl:if test="/root/env/param[starts-with(@name, 'p_credential')]">
  34. <xsl:variable name="creds" select="/root/env/param[starts-with(@name, 'p_credential')]"/>
  35. <xts:delete select="/root/encodedRptSvcParam"/>
  36. <xts:append>
  37. <encodedRptSvcParam>
  38. <xts:function name="web64encode">
  39. <xts:param name="source">
  40. <xts:transform name="XMLEncode">
  41. <rptSvcParam name="{substring-after($creds/@name,'_')}">
  42. <xsl:if test="string($creds) != ''">
  43. <xts:transform name="XMLDecode">
  44. <xsl:value-of select="string($creds)"/>
  45. </xts:transform>
  46. </xsl:if>
  47. </rptSvcParam>
  48. </xts:transform>
  49. </xts:param>
  50. </xts:function>
  51. </encodedRptSvcParam>
  52. </xts:append>
  53. <xts:delete select="/root/env/param[@name='encodedRptSvcParam']"/>
  54. </xsl:if>
  55. <xts:delete select="/root/env/param[starts-with(@name, 'p_')]"/>
  56. </xts:sequence>
  57. </xsl:template>
  58. <xsl:template match="/root/env/param" mode="prmtVals">
  59. <PromptValue name="{substring-after(@name,'_')}">
  60. <xsl:if test="string(.) != ''">
  61. <xts:transform name="XMLDecode">
  62. <xsl:value-of select="string(.)"/>
  63. </xts:transform>
  64. </xsl:if>
  65. </PromptValue>
  66. </xsl:template>
  67. </xsl:stylesheet>
  68. </xts:block>
  69. <!--
  70. ===============================================================================================
  71. request - We depend on the caller passing in the form fields from their request header. As a
  72. result there are no input parameters to the forward request.
  73. ===============================================================================================
  74. -->
  75. <xts:block id="request" dependency="copy-prompts" mode="interpret" processor="XSLT" type="exec">
  76. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  77. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  78. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  79. xmlns:rs="http://developer.cognos.com/schemas/reportService/1"
  80. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  81. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  82. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  83. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  84. xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope"
  85. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  86. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  87. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  88. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  89. <xsl:template match="/">
  90. <xts:sequence>
  91. <xts:append>
  92. <response>
  93. <send:request provider="warp" option="xml-multipart" outputHeader="true" responseEnvelope="true" affinity=".high">
  94. <rs:forward xmlns:xs="http://www.w3.org/2001/XMLSchema">
  95. <conversation xsi:type="bus:asynchRequest">
  96. <xts:transform name="XMLDecode">
  97. <xsl:value-of select="xtsext:web64decode(string(xtsext:cafaction('sign_unwrap', string(key('env-param','web64conversation')))), true())"/>
  98. </xts:transform>
  99. </conversation>
  100. <xsl:call-template name="SetParameters"/>
  101. <xsl:choose>
  102. <xsl:when test="key('env-param', 'prompt') != ''">
  103. <bus:options xsi:type="bus:optionArray" SOAP-ENC:arrayType="bus:option[]">
  104. <!-- prompt will be false with Finish button, true with Next button -->
  105. <item xsi:type="bus:runOptionBoolean">
  106. <bus:name xsi:type="bus:runOptionEnum">prompt</bus:name>
  107. <bus:value xsi:type="xs:boolean">
  108. <xsl:value-of select="key('env-param', 'prompt')"/>
  109. </bus:value>
  110. </item>
  111. </bus:options>
  112. </xsl:when>
  113. <xsl:otherwise>
  114. <bus:options xsi:type="bus:optionArray" SOAP-ENC:arrayType="bus:option[]"/>
  115. </xsl:otherwise>
  116. </xsl:choose>
  117. </rs:forward>
  118. </send:request>
  119. </response>
  120. </xts:append>
  121. <xts:append>
  122. <encodedTracking>
  123. <xts:function name="web64encode">
  124. <xts:param name="source">
  125. <xts:transform name="XMLEncode">
  126. <xts:queryNode select="/root/response/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='biBusHeader']/*[local-name() = 'tracking']"/>
  127. </xts:transform>
  128. </xts:param>
  129. <xts:param name="compress">true</xts:param>
  130. </xts:function>
  131. </encodedTracking>
  132. <encodedUIConversation>
  133. <xts:function name="web64encode">
  134. <xts:param name="source">
  135. <xts:transform name="XMLEncode">
  136. <xts:queryNode select="/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='result']/*[local-name()='primaryRequest']"/>
  137. </xts:transform>
  138. </xts:param>
  139. <xts:param name="compress">true</xts:param>
  140. </xts:function>
  141. </encodedUIConversation>
  142. <encodedConversation>
  143. <xts:function name="web64encode">
  144. <xts:param name="source">
  145. <xts:transform name="XMLEncode">
  146. <xts:queryNode select="/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='result']/*[local-name()='primaryRequest']/*"/>
  147. </xts:transform>
  148. </xts:param>
  149. <xts:param name="compress">true</xts:param>
  150. </xts:function>
  151. </encodedConversation>
  152. <conversationStatus>
  153. <xts:queryNode select="/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='result']/*[local-name()='details']/*[local-name()='item' and contains(@*[local-name()='type'], 'asynchDetailReportStatus')]/*[local-name()='status']"/>
  154. </conversationStatus>
  155. <resultStatus>
  156. <xts:queryNode select="/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='result']/*[local-name()='status']"/>
  157. </resultStatus>
  158. </xts:append>
  159. </xts:sequence>
  160. </xsl:template>
  161. <xsl:include href="/portal/iPrompting/setParameters.xslt"/>
  162. </xsl:stylesheet>
  163. </xts:block>
  164. <!--
  165. ===============================================================================================
  166. release conversation -
  167. ===============================================================================================
  168. -->
  169. <xts:block id="release-conversation" dependency="request" type="exec" mode="interpret" processor="XSLT" condition=".[(string(/root/resultStatus)='conversationComplete' or string(/root/resultStatus)='complete') and not(/root/response/*/*/*/*/*[local-name() = 'details']/*/*[local-name()='status'] = 'prompting') and /root/env/param[@name='web64conversation']]" mandatory="false">
  170. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  171. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  172. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  173. xmlns:rs="http://developer.cognos.com/schemas/reportService/1"
  174. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  175. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  176. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  177. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  178. xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope"
  179. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  180. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  181. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  182. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  183. <xsl:template match="/">
  184. <xts:sequence>
  185. <xts:append>
  186. <releaseConversation>
  187. <send:request provider="warp" option="xml-multipart" outputHeader="true" responseEnvelope="true" affinity=".absolute">
  188. <xsl:element name="release" namespace="http://developer.cognos.com/schemas/reportService/1">
  189. <conversation xsi:type="bus:asynchRequest">
  190. <xts:transform name="XMLDecode">
  191. <xsl:value-of select="xtsext:web64decode(string(xtsext:cafaction('sign_unwrap', string(key('env-param','web64conversation')))), true())"/>
  192. </xts:transform>
  193. </conversation>
  194. </xsl:element>
  195. </send:request>
  196. </releaseConversation>
  197. </xts:append>
  198. </xts:sequence>
  199. </xsl:template>
  200. </xsl:stylesheet>
  201. </xts:block>
  202. <!--
  203. ===============================================================================================
  204. render-parameters -
  205. ===============================================================================================
  206. -->
  207. <xts:block id="render-parameters" dependency="request release-conversation" type="exec" mode="interpret" processor="XSLT" condition=".[(/root/resultStatus='conversationComplete' or /root/resultStatus='complete') and not(/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*[contains(local-name(), 'Response')]/*[local-name()='result']/*[local-name()='details']/*/*[local-name()='status']='prompting')]" mandatory="false">
  208. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="xsl bus">
  209. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  210. <!-- Ouptut a response containing the parameter values -->
  211. <xsl:template match="/root">
  212. <xsl:variable name="forwardResponse">
  213. <prompt:forwardResponse>
  214. <xsl:choose>
  215. <xsl:when test="/root/command/*/getParametersRequest">
  216. <xsl:copy-of select="/root/response/*/*/*[local-name()='forwardResponse']/*[local-name()='result']/*[local-name()='details']/*[local-name()='item' and contains(@xsi:type, 'asynchDetailParameters')]/*"/>
  217. </xsl:when>
  218. <xsl:when test="/root/command/*/metaDataRequest and string(/root/env/param[@name='execMethod'])='metadata' and /root/response/*/*/*[contains(local-name(),'Response')]/*[local-name()='result']/*[local-name()='details']/*[local-name()='item']/*[local-name()='metadata']">
  219. <xsl:if test="/root/env/param[@name='startScopeAt'] or /root/env/param[@name='startBMItemAt'] or /root/env/param[starts-with(@name,'startDataItemAt_')]">
  220. <metadataResponse>
  221. <xts:transform name="XMLDecode">
  222. <xsl:value-of select="/root/response/*/*/*[contains(local-name(),'Response')]/*[local-name()='result']/*[local-name()='details']/*[local-name()='item']/*[local-name()='metadata']"/>
  223. </xts:transform>
  224. </metadataResponse>
  225. </xsl:if>
  226. </xsl:when>
  227. <xsl:otherwise>
  228. <parameters>
  229. <xsl:if test="/root/response/*/*/*[local-name()='forwardResponse']/*[local-name()='result']/*[local-name()='details']/*[local-name()='item' and contains(@xsi:type, 'asynchDetailParameterValues')]">
  230. <xts:transform src="transforms/portal/parameters/post-WARP-process.xslt" processor="XSLT">
  231. <xsl:copy-of select="/root/response/*/*/*[local-name()='forwardResponse']/*[local-name()='result']/*[local-name()='details']/*[local-name()='item' and contains(@xsi:type, 'asynchDetailParameterValues')]"/>
  232. </xts:transform>
  233. </xsl:if>
  234. </parameters>
  235. </xsl:otherwise>
  236. </xsl:choose>
  237. </prompt:forwardResponse>
  238. </xsl:variable>
  239. <xsl:choose>
  240. <!-- pack the response and unpack it in Finish -->
  241. <xsl:when test="/root/command/*/*[local-name()='callFinish']='true'">
  242. <xts:sequence>
  243. <xts:append>
  244. <encodedParameters>
  245. <xts:function name="web64encode">
  246. <xts:param name="source">
  247. <xts:transform name="XMLEncode">
  248. <xsl:copy-of select="$forwardResponse"/>
  249. </xts:transform>
  250. </xts:param>
  251. <xts:param name="compress">true</xts:param>
  252. </xts:function>
  253. </encodedParameters>
  254. </xts:append>
  255. </xts:sequence>
  256. </xsl:when>
  257. <xsl:otherwise>
  258. <xts:sequence>
  259. <xts:append select="/root/output">
  260. <xos:part>
  261. <xos:entityHeader>
  262. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  263. </xos:entityHeader>
  264. <xos:entityBody>
  265. <xsl:copy-of select="$forwardResponse"/>
  266. </xos:entityBody>
  267. </xos:part>
  268. </xts:append>
  269. </xts:sequence>
  270. </xsl:otherwise>
  271. </xsl:choose>
  272. </xsl:template>
  273. </xsl:stylesheet>
  274. </xts:block>
  275. <!--
  276. ===============================================================================================
  277. wait - This block generates the contents of the wait page
  278. ===============================================================================================
  279. -->
  280. <xts:block id="waitPage" type="exec" mode="output" processor="XSLT" dependency="request release-conversation"
  281. mimeType="text/html" contentId="waitPage" partId="1"
  282. path="/portal/iPrompting/page-parts/wait.xslt"
  283. condition=".[contains(' working stillWorking ', concat(' ', /root/resultStatus, ' '))]"
  284. mandatory="false">
  285. <xts:logicsheet path="logicsheets/portal.xsl"/>
  286. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  287. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  288. </xts:block>
  289. <!--
  290. ===============================================================================================
  291. head - This block generates the HTML <head> tag.
  292. ===============================================================================================
  293. -->
  294. <xts:block id="head" type="exec" mode="output" processor="XSLT" dependency="request release-conversation"
  295. mimeType="text/html" contentId="head" partId="1"
  296. path="/portal/iPrompting/page-parts/head.xslt"
  297. condition=".[/root/conversationStatus='prompting' or (((/root/resultStatus='conversationComplete' or /root/resultStatus='complete') and not(/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*[contains(local-name(), 'Response')]/*[local-name()='result']/*[local-name()='details']/*/*[local-name()='status']='prompting')) and /root/command/*/*[local-name()='callFinish']='true') or contains(' working stillWorking ', concat(' ', /root/resultStatus, ' '))]"
  298. mandatory="false">
  299. <xts:logicsheet path="logicsheets/portal.xsl"/>
  300. <xts:logicsheet path="portal/iPrompting/logicsheets/common.xslt"/>
  301. <xts:logicsheet path="logicsheets/presentation/main/presentation.xsl"/>
  302. </xts:block>
  303. <!--
  304. ===============================================================================================
  305. bottomRow - This block generates the bottom row of the main table.
  306. ===============================================================================================
  307. -->
  308. <xts:block id="bottomRow" type="exec" mode="output" processor="XSLT" dependency="request release-conversation render-parameters"
  309. mimeType="text/html" contentId="bottomRow" partId="1"
  310. path="/portal/iPrompting/page-parts/tail.xslt"
  311. condition=".[/root/conversationStatus='prompting' or (((/root/resultStatus='conversationComplete' or /root/resultStatus='complete') and not(/root/response/*[local-name()='Envelope']/*[local-name()='Body']/*[contains(local-name(), 'Response')]/*[local-name()='result']/*[local-name()='details']/*/*[local-name()='status']='prompting')) and /root/command/*/*[local-name()='callFinish']='true') or contains(' working stillWorking ', concat(' ', /root/resultStatus, ' '))]"
  312. mandatory="false">
  313. <xts:logicsheet path="logicsheets/portal.xsl"/>
  314. </xts:block>
  315. <!--
  316. ===============================================================================================
  317. render-page - Main page rendering block. Combines the "content" blocks generated in the blocks
  318. above with the report itself which is returned in a multi-part message from report server.
  319. ===============================================================================================
  320. -->
  321. <xts:block id="render-page" type="exec" mode="interpret" processor="XSLT"
  322. dependency="head bottomRow waitPage"
  323. path="/portal/iPrompting/page-parts/page.xslt"
  324. condition=".[/root/conversationStatus='prompting' or ((/root/resultStatus='conversationComplete' or /root/resultStatus='complete') and /root/command/*/*[local-name()='callFinish']='true') or contains(' working stillWorking ', concat(' ', /root/resultStatus, ' '))]"
  325. mandatory="false">
  326. <xts:logicsheet path="logicsheets/portal.xsl"/>
  327. <xts:logicsheet path="logicsheets/presentation/main/framework.xsl"/>
  328. <xts:logicsheet path="logicsheets/presentation/main/presentation.xsl"/>
  329. </xts:block>
  330. </xts:morphlet>