ccs_prompt.xts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: CCS
  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. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml" includeConfig="true">
  9. <!--
  10. ===============================================================================================
  11. getExistingPrompt - if an existing promptID was passed in, go get the prompt information from CM
  12. ===============================================================================================
  13. -->
  14. <xts:block id="getExistingPrompt" processor="XSLT" type="exec" dependency="getExistingPromptTDS" condition=".[/root/env/param[@name = 'promptID'] and /root/env/param[@name = 'promptID']!='' and not(/root/env/param[@name='method'])]" mandatory="false">
  15. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  16. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  19. <xsl:template match="/">
  20. <!-- get any existing promptID from the URL -->
  21. <xsl:variable name="promptID">
  22. <xsl:value-of select="key('env-param','promptID')"/>
  23. </xsl:variable>
  24. <xts:sequence>
  25. <xsl:if test="count(/root/promptData/*) = 0">
  26. <!-- promptData element with no children (probably because the prompt answers entry was "evicted" from the TDS/PDC caches),
  27. get the prompt information from CM using the provide promptID -->
  28. <xts:append select="/root/promptData">
  29. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  30. <send:request provider="cm">
  31. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  32. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  33. <search>
  34. <xsl:text>storeID("</xsl:text>
  35. <xsl:value-of select="$promptID"/>
  36. <xsl:text>")</xsl:text>
  37. </search>
  38. <properties>
  39. <property name="state"/>
  40. </properties>
  41. </query>
  42. </xts:transform>
  43. </send:request>
  44. </xts:transform>
  45. </xts:append>
  46. </xsl:if>
  47. </xts:sequence>
  48. </xsl:template>
  49. </xsl:stylesheet>
  50. </xts:block>
  51. <xts:block id="getExistingPromptTDS" processor="XSLT" type="exec" condition=".[/root/env/param[@name = 'promptID'] and /root/env/param[@name = 'promptID']!='' and not(/root/env/param[@name='method'])]" mandatory="false">
  52. <xts:logicsheet path="logicsheets/portal.xsl"/>
  53. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  54. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  55. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  56. <pf:sessionpassport/>
  57. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  58. <xsl:template match="/">
  59. <!-- get any existing promptID from the URL -->
  60. <xsl:variable name="promptID">
  61. <xsl:value-of select="key('env-param','promptID')"/>
  62. </xsl:variable>
  63. <!-- Get the prompt information from TDS using the provide promptID -->
  64. <xts:sequence>
  65. <xts:append>
  66. <promptData>
  67. <xts:function name="TDSRequest">
  68. <xts:param name="action">get</xts:param>
  69. <xts:param name="session-id">
  70. <xsl:value-of select="$passport"/>
  71. </xts:param>
  72. <xts:param name="map-id">
  73. <xsl:value-of select="'cmsPromptAnswers'"/>
  74. </xts:param>
  75. <xts:param name="name">
  76. <xsl:value-of select="$promptID"/>
  77. </xts:param>
  78. </xts:function>
  79. </promptData>
  80. </xts:append>
  81. </xts:sequence>
  82. </xsl:template>
  83. </xsl:stylesheet>
  84. </xts:block>
  85. <!--
  86. ===============================================================================================
  87. execute-method - begin the process to collect the prompt information from the user
  88. ===============================================================================================
  89. -->
  90. <xts:block id="execute-method" processor="XSLT" type="exec" dependency="getExistingPrompt" condition=".[not(/root/env/param[@name='method']='cancel')]" mandatory="false">
  91. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  92. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  93. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  94. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  95. <xsl:template match="/">
  96. <!-- get the report object from the URL -->
  97. <xsl:variable name="reportObject">
  98. <xsl:value-of select="key('env-param','ui.object')"/>
  99. </xsl:variable>
  100. <xsl:variable name="promptID">
  101. <xsl:value-of select="key('env-param','promptID')"/>
  102. </xsl:variable>
  103. <!-- collect the prompt information from the report server -->
  104. <xts:sequence>
  105. <xts:append>
  106. <promptRequest>
  107. <send:request provider="xts" option="xml-multipart">
  108. <xsl:choose>
  109. <xsl:when test=" not(/root/env/param[@name='method'])">
  110. <prompt:collect>
  111. <returnMorphlet>portal/get_prompt.xts</returnMorphlet>
  112. <ps_nav_op>maintain</ps_nav_op>
  113. <runAsync>true</runAsync>
  114. <forcePrompting>true</forcePrompting>
  115. <showNoPromptsWarning>false</showNoPromptsWarning>
  116. <promptObject>
  117. <xsl:value-of select="$reportObject"/>
  118. </promptObject>
  119. <!-- check if prompt values are available from the cache -->
  120. <xsl:variable name="promptData" select="/root/promptData/*[local-name()='parameterValues'] | /root/promptData/*[local-name()='queryResponse']/*[local-name()='runTimeState']/*[local-name()='state']/*[local-name()='parameterValues']"/>
  121. <xsl:if test="count($promptData) &gt; 0">
  122. <parameterValues>
  123. <xsl:copy-of select="$promptData"/>
  124. </parameterValues>
  125. </xsl:if>
  126. </prompt:collect>
  127. </xsl:when>
  128. <xsl:otherwise>
  129. <xsl:element name="{key('env-param', 'method')}" namespace="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/">
  130. <returnMorphlet>ccs/ccs_prompt.xts</returnMorphlet>
  131. <ps_nav_op>maintain</ps_nav_op>
  132. <callFinish>true</callFinish>
  133. </xsl:element>
  134. </xsl:otherwise>
  135. </xsl:choose>
  136. </send:request>
  137. </promptRequest>
  138. </xts:append>
  139. </xts:sequence>
  140. </xsl:template>
  141. </xsl:stylesheet>
  142. </xts:block>
  143. <!--
  144. ===============================================================================================
  145. check-state -
  146. ===============================================================================================
  147. -->
  148. <xts:block id="check-state" path="/portal/iPrompting/logicsheets/check-state.xslt" processor="XSLT" type="exec" dependency="execute-method" condition=".[not(/root/env/param[@name='method']='cancel')]" mandatory="false">
  149. <xts:logicsheet path="logicsheets/portal.xsl"/>
  150. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  151. </xts:block>
  152. <!--
  153. ===============================================================================================
  154. updateID - updates the passed-in prompt ID with the saved parameter values
  155. ===============================================================================================
  156. -->
  157. <xts:block id="updateID" processor="XSLT" type="exec" dependency="check-state execute-method" mandatory="false" condition=".[/root/view='properties' or /root/promptRequest/*[local-name()='collectResponse']/*[local-name()='status']='conversationComplete']">
  158. <xts:logicsheet path="logicsheets/portal.xsl"/>
  159. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  160. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cms xts send cm pf form xtsext">
  161. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  162. <pf:variables/>
  163. <xsl:template match="/">
  164. <xsl:variable name="storeID">
  165. <xsl:value-of select="key('env-param','promptID')"/>
  166. </xsl:variable>
  167. <xts:sequence>
  168. <!-- Update CM RuntimeState, its output will be returned -->
  169. <!-- get the prompt information from CM using the provide promptID -->
  170. <xts:append>
  171. <updateIDResponse>
  172. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  173. <send:request provider="cm">
  174. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  175. <cm:update>
  176. <cm:objects>
  177. <cm:runTimeState>
  178. <cm:searchPath>
  179. <xsl:value-of select="concat('storeID(&quot;', $storeID, '&quot;)')"/>
  180. </cm:searchPath>
  181. <cm:state>
  182. <xts:transform xmlns:xts="http://developer.cognos.com/schemas/xts/" name="XMLEncode">
  183. <xts:transform src="transforms/portal/parameters/pre-WARP-process.xslt" processor="XSLT">
  184. <xsl:element name="parameters" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  185. <xsl:copy-of select="/root/*[local-name()='promptRequest']/*/*[local-name()='parameters']/*"/>
  186. </xsl:element>
  187. </xts:transform>
  188. </xts:transform>
  189. </cm:state>
  190. </cm:runTimeState>
  191. </cm:objects>
  192. </cm:update>
  193. </xts:transform>
  194. </send:request>
  195. </xts:transform>
  196. </updateIDResponse>
  197. </xts:append>
  198. </xts:sequence>
  199. <!-- Update TDS, its output (if any) will be ignored -->
  200. <xts:sequence>
  201. <xts:append>
  202. <TDSRequest_updatedID>
  203. <xts:function name="TDSRequest">
  204. <xts:param name="action">set</xts:param>
  205. <xts:param name="session-id">
  206. <xsl:value-of select="$passport"/>
  207. </xts:param>
  208. <xts:param name="map-id">
  209. <xsl:value-of select="'cmsPromptAnswers'"/>
  210. </xts:param>
  211. <xts:param name="name">
  212. <xsl:value-of select="$storeID"/>
  213. </xts:param>
  214. <xts:param name="source">
  215. <xts:transform xmlns:xts="http://developer.cognos.com/schemas/xts/" name="XMLEncode">
  216. <xts:transform src="transforms/portal/parameters/pre-WARP-process.xslt" processor="XSLT">
  217. <xsl:element name="parameters" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  218. <xsl:copy-of select="/root/*[local-name()='promptRequest']/*/*[local-name()='parameters']/*"/>
  219. </xsl:element>
  220. </xts:transform>
  221. </xts:transform>
  222. </xts:param>
  223. </xts:function>
  224. </TDSRequest_updatedID>
  225. </xts:append>
  226. </xts:sequence>
  227. </xsl:template>
  228. </xsl:stylesheet>
  229. </xts:block>
  230. <!--
  231. ===============================================================================================
  232. renderPage - render the page
  233. ===============================================================================================
  234. -->
  235. <xts:block id="renderPage" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="check-state updateID" condition=".[/root/view='properties' or /root/promptRequest/*[local-name()='collectResponse']/*[local-name()='status']='conversationComplete' or (/root/env/param[@name='method'] and /root/env/param[@name='method']='cancel')]" mandatory="false">
  236. <xts:logicsheet path="logicsheets/portal.xsl"/>
  237. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  238. <xts:logicsheet path="logicsheets/presentation/dialog/ui-templates.xsl"/>
  239. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  240. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  241. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  242. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  243. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  244. <xts:logicsheet path="logicsheets/presentation/dialog/confirm.xslt"/>
  245. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  246. <xts:logicsheet path="logicsheets/validation.xslt"/>
  247. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  248. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  249. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  250. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:ut="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/ui-templates/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:thm="http://developer.cognos.com/schemas/xts/logicsheets/xslt/theme/" exclude-result-prefixes="xsl cf cp df dp dc lyt cm cml thm utml xtsext ut">
  251. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  252. <!-- current file name -->
  253. <xsl:variable name="mname" select="'get_prompt.xts'"/>
  254. <xsl:variable name="has_write_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]/cm:permissions, ' '), ' write ')"/>
  255. <xsl:variable name="has_execute_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]/cm:permissions, ' '), ' execute ')"/>
  256. <xsl:variable name="has_policy_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]//cm:permissions, ' '), ' setPolicy ')"/>
  257. <pf:variables/>
  258. <xsl:variable name="the-object" select="/root/cm:queryResponse/*[position()=1]"/>
  259. <xsl:variable name="showOKCancel" select="$has_write_permission or $has_policy_permission"/>
  260. <!-- start the output -->
  261. <xsl:template match="/root">
  262. <dp:page>
  263. <dp:meta>
  264. <pf:meta/>
  265. <!-- Standard meta tags -->
  266. </dp:meta>
  267. <!-- storeID will be blank if the report did not contain prompts or the provided promptID was invalid -->
  268. <xsl:variable name="storeID">
  269. <xsl:value-of select="/root/promptIDResponse/*[local-name()='addResponse']/*[local-name()='runTimeState']/*[local-name()='storeID']"/>
  270. </xsl:variable>
  271. <!-- return the promptID to the calling page -->
  272. <script language="javascript">
  273. var success = 1;
  274. <xsl:if test="/root/env/param[@name='method']='cancel'">
  275. success = 0;
  276. </xsl:if>
  277. try
  278. {
  279. window.external.FinishCollectPrompts(success);
  280. }
  281. catch(e1)
  282. {
  283. try
  284. {
  285. parent.FinishCollectPrompts(success);
  286. }
  287. catch(e2)
  288. {
  289. try
  290. {
  291. window.opener.FinishCollectPrompts(success)
  292. }
  293. catch (e3)
  294. {
  295. window.close();
  296. }
  297. }
  298. }
  299. </script>
  300. </dp:page>
  301. </xsl:template>
  302. </xsl:stylesheet>
  303. </xts:block>
  304. <!--
  305. ===============================================================================================
  306. debug - display debug information
  307. ===============================================================================================
  308. -->
  309. <xts:block id="debug" dependency="renderPage" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  310. <!-- get the debug logic sheet -->
  311. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  312. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
  313. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  314. <xsl:template match="/">
  315. <dbg:dumpxml select="/root"/>
  316. </xsl:template>
  317. </xsl:stylesheet>
  318. </xts:block>
  319. </xts:morphlet>