get_prompt.xts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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" includeConfig="true">
  13. <!--
  14. ===============================================================================================
  15. getExistingPrompt - if an existing promptID was passed in, go get the prompt information from CM
  16. ===============================================================================================
  17. -->
  18. <xts:block id="getExistingPrompt" 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">
  19. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  20. <xsl:stylesheet version="1.0"
  21. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22. xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/"
  23. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  25. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  26. <xsl:template match="/">
  27. <!-- get any existing promptID from the URL -->
  28. <xsl:variable name="promptID">
  29. <xsl:value-of select="key('env-param','promptID')"/>
  30. </xsl:variable>
  31. <!-- Get the prompt information from CM using the provide promptID -->
  32. <xts:sequence>
  33. <xts:append>
  34. <promptData>
  35. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  36. <send:request provider="cm">
  37. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  38. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  39. <search>
  40. <xsl:text>storeID("</xsl:text>
  41. <xsl:value-of select="$promptID"/>
  42. <xsl:text>")</xsl:text>
  43. </search>
  44. <properties>
  45. <property name="state"/>
  46. </properties>
  47. </query>
  48. </xts:transform>
  49. </send:request>
  50. </xts:transform>
  51. </promptData>
  52. </xts:append>
  53. </xts:sequence>
  54. </xsl:template>
  55. </xsl:stylesheet>
  56. </xts:block>
  57. <!--
  58. ===============================================================================================
  59. execute-method - begine the process to collect the prompt information from the user
  60. ===============================================================================================
  61. -->
  62. <xts:block id="execute-method" processor="XSLT" type="exec" dependency="getExistingPrompt" condition=".[not(/root/env/param[@name='method']='cancel')]" mandatory="false">
  63. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  64. <xsl:stylesheet version="1.0"
  65. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  66. xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/"
  67. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  68. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  69. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  70. <xsl:template match="/">
  71. <!-- get the report object from the URL -->
  72. <xsl:variable name="reportObject">
  73. <xsl:value-of select="key('env-param','ui.object')"/>
  74. </xsl:variable>
  75. <!-- collect the prompt information from the report server -->
  76. <xts:sequence>
  77. <xts:append>
  78. <promptRequest>
  79. <send:request provider="xts" option="xml-multipart">
  80. <xsl:choose>
  81. <xsl:when test=" not(/root/env/param[@name='method'])">
  82. <prompt:collect>
  83. <returnMorphlet>portal/get_prompt.xts</returnMorphlet>
  84. <ps_nav_op>maintain</ps_nav_op>
  85. <runAsync>true</runAsync>
  86. <forcePrompting>true</forcePrompting>
  87. <showNoPromptsWarning>false</showNoPromptsWarning>
  88. <promptObject>
  89. <xsl:value-of select="$reportObject"/>
  90. </promptObject>
  91. <!-- check if prompt values were passed into morphlet -->
  92. <xsl:if test="/root/promptData">
  93. <parameterValues>
  94. <xsl:copy-of select="/root/promptData/*[local-name()='queryResponse']/*[local-name()='runTimeState']/*[local-name()='state']/*[local-name()='parameterValues']"/>
  95. </parameterValues>
  96. </xsl:if>
  97. </prompt:collect>
  98. </xsl:when>
  99. <xsl:otherwise>
  100. <xsl:element name="{key('env-param', 'method')}" namespace="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/">
  101. <returnMorphlet>portal/get_prompt.xts</returnMorphlet>
  102. <ps_nav_op>maintain</ps_nav_op>
  103. <callFinish>true</callFinish>
  104. </xsl:element>
  105. </xsl:otherwise>
  106. </xsl:choose>
  107. </send:request>
  108. </promptRequest>
  109. </xts:append>
  110. </xts:sequence>
  111. </xsl:template>
  112. </xsl:stylesheet>
  113. </xts:block>
  114. <!--
  115. ===============================================================================================
  116. check-state -
  117. ===============================================================================================
  118. -->
  119. <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">
  120. <xts:logicsheet path="logicsheets/portal.xsl"/>
  121. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  122. </xts:block>
  123. <!--
  124. ===============================================================================================
  125. saveParameters - save the prompt values to CM and get the storeID
  126. ===============================================================================================
  127. -->
  128. <xts:block id="saveParameters" dependency="check-state execute-method" processor="XSLT" type="exec" mandatory="false" condition=".[/root/view='properties' or /root/promptRequest/*[local-name()='collectResponse']/*[local-name()='status']='conversationComplete']">
  129. <xts:logicsheet path="logicsheets/portal.xsl"/>
  130. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  131. <xsl:stylesheet version="1.0"
  132. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  133. xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/"
  134. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  135. xmlns:prompt="http://developer.cognos.com/schemas/xts/portal/iPrompting/1/"
  136. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  137. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  138. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  139. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  140. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  141. exclude-result-prefixes="cms xts send cm pf form xtsext">
  142. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  143. <pf:variables/>
  144. <!-- global application variables -->
  145. <xsl:template match="/">
  146. <!-- save the new prompt information to CM -->
  147. <xts:sequence>
  148. <!-- if there are parameter values, save them to CM and get a storeID -->
  149. <xsl:if test="/root/*[local-name()='promptRequest']/*/*[local-name()='parameters']">
  150. <xts:append select="/root">
  151. <promptIDResponse>
  152. <!-- prepare and send the add request to add the prompt data to cm -->
  153. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  154. <send:request provider="cm">
  155. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  156. <cm:add>
  157. <cm:search>~~</cm:search>
  158. <cm:objects>
  159. <cm:runTimeState>
  160. <cm:state>
  161. <!-- result may be returned in "prompt:forwardResponse" or "collectRepsonse" -->
  162. <xts:transform src="transforms/portal/parameters/pre-WARP-process.xslt" processor="XSLT">
  163. <xsl:element name="parameters" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
  164. <xsl:copy-of select="/root/*[local-name()='promptRequest']/*/*[local-name()='parameters']/*"/>
  165. </xsl:element>
  166. </xts:transform>
  167. </cm:state>
  168. </cm:runTimeState>
  169. </cm:objects>
  170. </cm:add>
  171. </xts:transform>
  172. </send:request>
  173. </xts:transform>
  174. </promptIDResponse>
  175. </xts:append>
  176. </xsl:if>
  177. </xts:sequence>
  178. </xsl:template>
  179. </xsl:stylesheet>
  180. </xts:block>
  181. <!--
  182. ===============================================================================================
  183. renderPage - render the page
  184. ===============================================================================================
  185. -->
  186. <xts:block id="renderPage" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="saveParameters check-state" 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">
  187. <xts:logicsheet path="logicsheets/portal.xsl"/>
  188. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  189. <xts:logicsheet path="logicsheets/presentation/dialog/ui-templates.xsl"/>
  190. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  191. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  192. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  193. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  194. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  195. <xts:logicsheet path="logicsheets/presentation/dialog/confirm.xslt"/>
  196. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  197. <xts:logicsheet path="logicsheets/validation.xslt"/>
  198. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  199. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  200. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  201. <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">
  202. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  203. <!-- current file name -->
  204. <xsl:variable name="mname" select="'get_prompt.xts'"/>
  205. <xsl:variable name="has_write_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]/cm:permissions, ' '), ' write ')"/>
  206. <xsl:variable name="has_execute_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]/cm:permissions, ' '), ' execute ')"/>
  207. <xsl:variable name="has_policy_permission" select="contains(concat(' ', /root/cm:queryResponse/*[position()=1]//cm:permissions, ' '), ' setPolicy ')"/>
  208. <pf:variables/>
  209. <xsl:variable name="the-object" select="/root/cm:queryResponse/*[position()=1]"/>
  210. <xsl:variable name="showOKCancel" select="$has_write_permission or $has_policy_permission"/>
  211. <!-- start the output -->
  212. <xsl:template match="/root">
  213. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page>
  214. <dp:meta>
  215. <pf:meta/>
  216. <!-- Standard meta tags -->
  217. </dp:meta>
  218. <!-- storeID will be blank if the report did not contain prompts or the provided promptID was invalid -->
  219. <xsl:variable name="storeID">
  220. <xsl:value-of select="/root/promptIDResponse/*[local-name()='addResponse']/*[local-name()='runTimeState']/*[local-name()='storeID']"/>
  221. </xsl:variable>
  222. <!-- return the promptID to the calling page -->
  223. <script language="javascript">
  224. try {
  225. window.external.SetPromptId("<xsl:value-of select="$storeID"/>");
  226. }
  227. catch (e) {
  228. try {
  229. parent.SetPromptId("<xsl:value-of select="$storeID"/>");
  230. }
  231. catch (e2) {
  232. try {
  233. window.opener.SetPromptId("<xsl:value-of select="$storeID"/>");
  234. }
  235. catch (e3) {}
  236. }
  237. }
  238. try {
  239. window.external.OnClose(0);
  240. }
  241. catch (e) {
  242. try {
  243. parent.OnClose(0);
  244. }
  245. catch (e2) {
  246. try {
  247. window.opener.OnClose(0);
  248. }
  249. catch (e3) {window.close();}
  250. }
  251. }
  252. </script>
  253. </dp:page>
  254. </xsl:template>
  255. </xsl:stylesheet>
  256. </xts:block>
  257. <!--
  258. ===============================================================================================
  259. debug - display debug information
  260. ===============================================================================================
  261. -->
  262. <xts:block id="debug" dependency="renderPage" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  263. <!-- get the debug logic sheet -->
  264. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  265. <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">
  266. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  267. <xsl:template match="/">
  268. <dbg:dumpxml select="/root"/>
  269. </xsl:template>
  270. </xsl:stylesheet>
  271. </xts:block>
  272. </xts:morphlet>