pre_submit.xts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2015
  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/AGS.xml,messages/portal.xml, messages/portalRL.xml" resolverBase="prompting" includeConfig="true" requiredCapability="canUseEventStudio">
  9. <!--
  10. ================================================================================
  11. decode the agent items
  12. ===============================================================================================
  13. -->
  14. <xts:block id="decode_agent_definition" processor="XSLT" type="exec">
  15. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  16. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  17. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  18. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  19. <xsl:template match="/">
  20. <xts:sequence>
  21. <xsl:choose>
  22. <xsl:when test="/root/env/param[@name = 'agent_definition_blob']">
  23. <!-- decode the agent items -->
  24. <xts:append select="/root">
  25. <xsl:value-of select="xtsext:web64decode( xtsext:cafaction('sign_unwrap_settemplatename_decodeagentdefinition_settemplateid_presave001', string( /root/env/param[@name = 'agent_definition_blob'])), true() )" disable-output-escaping="yes"/>
  26. </xts:append>
  27. <!-- delete the agent definition blob - we're putting it back later -->
  28. <xts:delete select="/root/env/param[@name='agent_definition_blob']"/>
  29. </xsl:when>
  30. </xsl:choose>
  31. </xts:sequence>
  32. </xsl:template>
  33. </xsl:stylesheet>
  34. </xts:block>
  35. <!--
  36. ===============================================================================================
  37. getPageData - create the request parameters for the content page
  38. ===============================================================================================
  39. -->
  40. <xts:block id="getPageData" dependency="decode_agent_definition" path="ags/navigator.xslt" processor="XSLT" type="exec"/>
  41. <!--
  42. ===============================================================================================
  43. Handle controller template results - some pages/condition/schedule/email are written in the controller_template form. This means
  44. we have to call them a second time to get the result
  45. ===============================================================================================
  46. -->
  47. <xts:block id="callControllerTemplateResults" path="/ags/callResultTemplate.xslt" dependency="getPageData" condition=".[/root/env/param[@name='tabSelectedID']!='AgentTask-condition']" mandatory="false" processor="XSLT" type="exec">
  48. <xts:logicsheet path="logicsheets/portal.xsl"/>
  49. </xts:block>
  50. <!--
  51. ===============================================================================================
  52. Handle controller template results - some pages/condition/schedule/email are written in the controller_template form. This means
  53. we have to call them a second time to get the result
  54. ===============================================================================================
  55. -->
  56. <xts:block id="handleControllerTemplateResults" path="/ags/handleResultTemplate.xslt" dependency="callControllerTemplateResults" condition=".[/root/env/param[@name='tabSelectedID']!='AgentTask-condition']" mandatory="false" processor="XSLT" type="exec">
  57. <xts:logicsheet path="logicsheets/portal.xsl"/>
  58. </xts:block>
  59. <!--
  60. ===============================================================================================
  61. Correct the task name if required ... the agent task action names which are now not specified by
  62. user and are taken from task property
  63. for Email it is subject, report .. report name, webservice - operation name, SQL - proc name etc.
  64. thus in order to avoid duplicate names we need to manage these names and we do it by putting a
  65. sequence number at the end of task name
  66. ===============================================================================================
  67. -->
  68. <xts:block id="manageTaskNameBlock" path="/ags/manageTaskName.xslt" dependency="handleControllerTemplateResults" mandatory="false" processor="XSLT" type="exec">
  69. <xts:logicsheet path="logicsheets/portal.xsl"/>
  70. </xts:block>
  71. <!--
  72. ===============================================================================================
  73. Save the agent action info. The encoded contents will be stored in /root/env/param[@name='<action>']. where the action is
  74. the contents of /root/env/param[@name='prevTabID'] which can be schedule/message/agent/job/report.
  75. Once the individual elements have been saved into the environment they will be removed.
  76. ===============================================================================================
  77. -->
  78. <xts:block id="storePreviousTab" path="/ags/storeTabTemplate.xslt" dependency="manageTaskNameBlock" mandatory="false" processor="XSLT" type="exec">
  79. <xts:logicsheet path="logicsheets/portal.xsl"/>
  80. </xts:block>
  81. <!--
  82. ================================================================================
  83. encode the agent items again
  84. ================================================================================
  85. -->
  86. <xts:block id="encode_agent_definition" dependency="storePreviousTab" processor="XSLT" type="exec">
  87. <xts:logicsheet path="logicsheets/portal.xsl"/>
  88. <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:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  89. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  90. <pf:serialize-xml/>
  91. <pf:variables/>
  92. <xsl:template match="/">
  93. <xts:sequence>
  94. <xsl:variable name="markup">
  95. <xsl:call-template name="serialize-xml">
  96. <xsl:with-param name="node-set" select="/root/agent_definition"/>
  97. </xsl:call-template>
  98. </xsl:variable>
  99. <xts:append select="/root/env">
  100. <param name="agent_definition_blob">
  101. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_encodeagentdefinition_settemplateid_presave002'), xtsext:web64encode( string( $markup ), true()))"/>
  102. </param>
  103. </xts:append>
  104. </xts:sequence>
  105. </xsl:template>
  106. </xsl:stylesheet>
  107. </xts:block>
  108. <!--
  109. ================================================================================
  110. rename all the save items
  111. ===============================================================================================
  112. -->
  113. <xts:block id="renameSaveParameters" dependency="encode_agent_definition" processor="XSLT" type="exec">
  114. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext">
  115. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  116. <xsl:template match="/">
  117. <xts:sequence>
  118. <!--xts:delete select="/root/env/param[@name='m_path' or @name='m_new_class']"/-->
  119. <xts:delete select="/root/env/param[@name='m_new_class']"/>
  120. <xts:append select="/root/env">
  121. <!-- copy all save as parameters into non save parameters -->
  122. <xsl:for-each select="/root/env/param[starts-with(@name, 'agsSave_')]">
  123. <param name="{substring-after(@name, 'agsSave_')}">
  124. <xsl:value-of select="."/>
  125. </param>
  126. </xsl:for-each>
  127. <!-- remove code to set m_path to the path of the agentDefinition - ie always force this to be myfolders. Cannot have path
  128. being the path of the agentDefinition now - as the agentDefinition path is held as a storeID - not a searchPath.
  129. this is actually wrong - but there it a bug logged 460608.0 which says that save location is always myfolders
  130. need to fix this when we fix that bug -->
  131. <!--param name="m_path">
  132. <xsl:value-of select="'~/folder'"/>
  133. </param-->
  134. </xts:append>
  135. <!-- get rid of the copies and blanks-->
  136. <xts:delete select="/root/env/param[starts-with(@name, 'agsSave_')]"/>
  137. <xts:delete select="/root/env/param[text() = '']"/>
  138. </xts:sequence>
  139. </xsl:template>
  140. </xsl:stylesheet>
  141. </xts:block>
  142. <!--
  143. ===============================================================================================
  144. render-page
  145. ===============================================================================================
  146. -->
  147. <xts:block id="renderPage" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="renameSaveParameters">
  148. <!-- portal specific information -->
  149. <xts:logicsheet path="logicsheets/portal.xsl"/>
  150. <!-- Get the new theme logicsheets. -->
  151. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  152. <!-- apply the form logic -->
  153. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  154. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="utml dp pf xtsext">
  155. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  156. <!-- add any theme variables -->
  157. <pf:variables/>
  158. <xsl:template match="/">
  159. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page>
  160. <!-- specify the style sheet(used to render the active/inactive hint text)
  161. todo move this into its own xslt file. Do not put it into the dp stuff because that is relevant to the whole portal
  162. -->
  163. <utml:form name="pform" method="post" action="{$gateway}">
  164. </utml:form>
  165. <dp:script>
  166. <script type="text/javascript">
  167. function init()
  168. {
  169. <xsl:choose>
  170. <xsl:when test="/root/env/param[@name='ifrmcmd'] = 'validate_condition'">
  171. var target = "/ags/submit.xts";
  172. </xsl:when>
  173. <xsl:when test="starts-with(/root/env/param[@name='ifrmcmd'], 'validate')">
  174. var target = "/ags/submit.xts";
  175. </xsl:when>
  176. <xsl:when test="(/root/env/param[@name='ifrmcmd'] = 'create') or not(/root/agent_definition/agentDefinition)">
  177. var path = parent.cfgGet("so.defaultLocation");
  178. if (path) {
  179. var location = document.createElement("input");
  180. location.setAttribute('type', 'hidden');
  181. location.setAttribute('name', "so.searchPath");
  182. location.value = path;
  183. document.pform.appendChild(location);
  184. }
  185. var target = "/portal/save_as.xts";
  186. </xsl:when>
  187. <xsl:otherwise>
  188. var target = "/ags/submit.xts";
  189. </xsl:otherwise>
  190. </xsl:choose>
  191. try{
  192. // forward to the correct location
  193. document.pform.m.value = target;
  194. document.pform.ps_nav_op.value = "maintain";
  195. document.pform.submit();
  196. }catch(e){
  197. var cf = parent.getConfigFrame();
  198. if(cf){
  199. cf.doClosePopUp();
  200. }
  201. }
  202. }
  203. </script>
  204. </dp:script>
  205. </dp:page>
  206. </xsl:template>
  207. </xsl:stylesheet>
  208. </xts:block>
  209. <!--
  210. ===============================================================================================
  211. render-fault page
  212. ===============================================================================================
  213. -->
  214. <xts:block id="faultHandler" processor="XSLT" type="fault" >
  215. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  216. <xsl:output method="xml"/>
  217. <xsl:template match="/root/fault">
  218. <xts:append select="/root">
  219. <error>
  220. <xsl:value-of select="//*[local-name() = 'messageString']"/>
  221. </error>
  222. </xts:append>
  223. </xsl:template>
  224. <xsl:template match="text()"/>
  225. </xsl:stylesheet>
  226. </xts:block>
  227. <!--
  228. ===============================================================================================
  229. debug - display debug information
  230. ===============================================================================================
  231. -->
  232. <xts:block id="debug" dependency="renderPage" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  233. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  234. <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">
  235. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  236. <xsl:template match="/">
  237. <dbg:dumpxml select="/root"/>
  238. </xsl:template>
  239. </xsl:stylesheet>
  240. </xts:block>
  241. </xts:morphlet>