submit.xts 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  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/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" messageBase="messages/portal.xml,messages/portalRL.xml,messages/AGS.xml" requiredCapability="canUseEventStudio">
  9. <!--
  10. ===============================================================================================
  11. getCredentials - get credentials from Content Manager. This is for schedule only. If they are not there then we create
  12. h_CAM_action so that the credentials can be generated.
  13. ===============================================================================================
  14. -->
  15. <xts:block id="getCredentials" processor="XSLT" type="exec">
  16. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  17. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  18. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" 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/">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:template match="/">
  21. <xts:sequence>
  22. <xts:append>
  23. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  24. <send:request provider="cm" requester="AGS:submit">
  25. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  26. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  27. <cm:requests>
  28. <cm:query>
  29. <cm:search>~/credential</cm:search>
  30. <cm:properties>
  31. <cm:property name="searchPath"/>
  32. </cm:properties>
  33. </cm:query>
  34. </cm:requests>
  35. </cm:query>
  36. </xts:transform>
  37. </send:request>
  38. </xts:transform>
  39. </xts:append>
  40. </xts:sequence>
  41. </xsl:template>
  42. </xsl:stylesheet>
  43. </xts:block>
  44. <!--
  45. ===============================================================================================
  46. doFrmCommand - submit the from command (create, save, move, copy, delete)
  47. ===============================================================================================
  48. -->
  49. <xts:block id="doFrmCommand" processor="XSLT" type="exec" dependency="getCredentials">
  50. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  51. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  52. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  53. <xsl:template match="/root">
  54. <xts:sequence>
  55. <xts:append>
  56. <xsl:variable name="params" select="/root/env/param"/>
  57. <!--xsl:variable name="credentialPath" select="/root/header/*[local-name()='biBusHeader']/*[local-name()='CAM']/*[local-name() = 'CAMCredentialPath']"/-->
  58. <xsl:variable name="the-credential" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='credential']"/>
  59. <send:request provider="xts" faultBlock="faultHandler">
  60. <!--<send:request provider="xts" faultBlock="faultHandler">-->
  61. <xsl:element name="{/root/env/param[@name='ifrmcmd']}" namespace="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/">
  62. <!-- call the template to build the env variables -->
  63. <xsl:call-template name="build_form_env"/>
  64. <!-- have to give the credential path the correct namespace too -->
  65. <xsl:if test="$the-credential and $the-credential/*[local-name()='searchPath'] != '' ">
  66. <credentialPath xmlns="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/">
  67. <xsl:value-of select="$the-credential/*[local-name()='searchPath']"/>
  68. </credentialPath>
  69. </xsl:if>
  70. </xsl:element>
  71. </send:request>
  72. </xts:append>
  73. <xts:delete select="/root/env/param[starts-with( @name, 'm_t_default_')]"/>
  74. <!--xts:delete select="/root/env/param[starts-with( @name, 'stack_') and @name != 'stack_0']"/>
  75. < xts:replace select="/root/env/param[@name = 'ps_nav_op']">
  76. <param name="ps_nav_op">stack-down</param>
  77. </xts:replace -->
  78. <!-- Agent Name must be set -->
  79. <xsl:if test="/root/env/param[@name='m_p_defaultName']!=''">
  80. <xts:append>
  81. <env>
  82. <param name="agentName">
  83. <xsl:value-of select="/root/env/param[@name='m_p_defaultName']"/>
  84. </param>
  85. </env>
  86. </xts:append>
  87. </xsl:if>
  88. </xts:sequence>
  89. </xsl:template>
  90. <!--
  91. Build the form variables which we are going to send in to XTS
  92. -->
  93. <xsl:template name="build_form_env">
  94. <xsl:variable name="the-credential" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='credential']"/>
  95. <env xmlns="http://developer.cognos.com/schemas/xts/ags/iFrmCmd/1/">
  96. <!--xsl:if test="not($the-credential) and $the-credential/*[local-name()='searchPath'] != '' "-->
  97. <!--param name="h_CAM_action"><xsl:text>generateTC</xsl:text></param-->
  98. <!--/xsl:if-->
  99. <!-- copy anything in env -->
  100. <xsl:choose>
  101. <xsl:when test="/root/env/param[starts-with(@name,'m_t_default_')]">
  102. <xsl:for-each select="/root/env/param">
  103. <xsl:if test="not(@name='m_p_defaultName') and not(@name='m_p_defaultDescription') and not(@name='m_p_defaultScreenTip')">
  104. <param name="{@name}">
  105. <xsl:value-of select="."/>
  106. </param>
  107. </xsl:if>
  108. </xsl:for-each>
  109. </xsl:when>
  110. <xsl:otherwise>
  111. <xsl:for-each select="/root/env/param">
  112. <xsl:if test="not(starts-with(@name, 'checkbox_'))">
  113. <xsl:choose>
  114. <xsl:when test="not(starts-with(@name,'m_p_defaultDescription') or starts-with(@name,'m_p_defaultScreenTip'))">
  115. <param name="{@name}">
  116. <xsl:value-of select="."/>
  117. </param>
  118. </xsl:when>
  119. <xsl:otherwise>
  120. <xsl:if test="(/root/env/param[@name='ifrmcmd']!='create' or (/root/env/param[@name='ifrmcmd']='create' and child::node() != ''))">
  121. <param name="{@name}">
  122. <xsl:value-of select="."/>
  123. </param>
  124. </xsl:if>
  125. </xsl:otherwise>
  126. </xsl:choose>
  127. </xsl:if>
  128. </xsl:for-each>
  129. </xsl:otherwise>
  130. </xsl:choose>
  131. <!-- if we have a group of object from the sort to save-->
  132. <!-- <xsl:for-each select="/root/env/param[@name='containerSortOrder' or @name='entriesSortOrder' or @name='containerDefaultOrder' or @name='entriesDefaultOrder']">
  133. <objs>
  134. <param name="m_obj">
  135. <xsl:value-of select="substring-after(., ',')"/>
  136. </param>
  137. <param name="m_p_displaySequence">
  138. <xsl:value-of select="substring-before(., ',')"/>
  139. </param>
  140. </objs>
  141. </xsl:for-each> -->
  142. <!-- handle inputs from the multilingual property page -->
  143. <xsl:if test="/root/env/param[starts-with(@name, 'm_t_default_')]">
  144. <!--
  145. Determine if there is NOT a description that has a value.
  146. If there are none, then create an empty description so CM will clear all locale entries.
  147. Note: The opposite test condition would not be correct here - to see if there is
  148. a screenTip that has a blank value.
  149. -->
  150. <xsl:if test="not(/root/env/param[starts-with(@name, 'm_t_default_description')] != '') and not(/root/env/param[@name='pty_desc'] != '')">
  151. <param>
  152. <xsl:attribute name="name"><xsl:value-of select="'m_p_description'"/></xsl:attribute>
  153. </param>
  154. </xsl:if>
  155. <!--
  156. Determine if there is NOT a screenTip that has a value.
  157. If there are none, then create an empty screenTip so CM will clear all locale entries.
  158. Note: The opposite test condition would not be correct here - to see if there is
  159. a screenTip that has a blank value.
  160. -->
  161. <xsl:if test="not(/root/env/param[starts-with(@name, 'm_t_default_screenTip')] != '') and not(/root/env/param[@name='pty_scrt'] != '')">
  162. <param>
  163. <xsl:attribute name="name"><xsl:value-of select="'m_p_screenTip'"/></xsl:attribute>
  164. </param>
  165. </xsl:if>
  166. </xsl:if>
  167. <xsl:variable name="ptyn">
  168. <xsl:value-of select="/root/env/param[@name='pty_name']"/>
  169. </xsl:variable>
  170. <xsl:variable name="ptyd">
  171. <xsl:value-of select="/root/env/param[@name='pty_desc']"/>
  172. </xsl:variable>
  173. <xsl:variable name="ptys">
  174. <xsl:value-of select="/root/env/param[@name='pty_scrt']"/>
  175. </xsl:variable>
  176. <xsl:for-each select="/root/env/param[starts-with(@name, 'm_t_default_')]">
  177. <xsl:variable name="localeVal">
  178. <xsl:value-of select="xtsext:substringAfterLast(string(@name), '_')"/>
  179. </xsl:variable>
  180. <xsl:choose>
  181. <xsl:when test="$localeVal != string(/root/env/param[@name='pty_activeLang'])">
  182. <!--
  183. Handle the case where the user has just cleared all the fields, so don't pass it along for update.
  184. -->
  185. <xsl:if test="string(/root/env/param[@name=concat('m_t_default_name_',$localeVal)]) != '' or string(/root/env/param[@name=concat('m_t_default_description_',$localeVal)]) != '' or string(/root/env/param[@name=concat('m_t_default_screenTip_',$localeVal)]) != ''">
  186. <xsl:if test="string(.) != ''">
  187. <param>
  188. <xsl:attribute name="name"><xsl:value-of select="concat('m_p_', xtsext:substringBeforeLast(substring-after(string(@name), 'm_t_default_'), '_'))"/></xsl:attribute>
  189. <xsl:attribute name="locale"><xsl:value-of select="$localeVal"/></xsl:attribute>
  190. <xsl:value-of select="."/>
  191. </param>
  192. </xsl:if>
  193. </xsl:if>
  194. </xsl:when>
  195. <xsl:otherwise>
  196. <!--
  197. Special processing required for the property page information - in case the user has pressed ok
  198. when a new language is in presentation.
  199. -->
  200. <xsl:variable name="theName">
  201. <xsl:value-of select="xtsext:substringBeforeLast(substring-after(string(@name), 'm_t_default_'),'_')"/>
  202. </xsl:variable>
  203. <xsl:variable name="theValue">
  204. <xsl:choose>
  205. <xsl:when test="$theName='name'">
  206. <xsl:if test="$ptyn != ''">
  207. <xsl:value-of select="$ptyn"/>
  208. </xsl:if>
  209. </xsl:when>
  210. <xsl:when test="$theName='description'">
  211. <xsl:if test="$ptyd != ''">
  212. <xsl:value-of select="$ptyd"/>
  213. </xsl:if>
  214. </xsl:when>
  215. <xsl:otherwise>
  216. <xsl:if test="$ptys != ''">
  217. <xsl:value-of select="$ptys"/>
  218. </xsl:if>
  219. </xsl:otherwise>
  220. </xsl:choose>
  221. </xsl:variable>
  222. <!--
  223. Only create the parameter when all the values are available - otherwise they will be removed.
  224. -->
  225. <xsl:if test="$ptyn != '' or $ptyd != '' or $ptys != ''">
  226. <xsl:if test="$theValue != ''">
  227. <param>
  228. <xsl:attribute name="name"><xsl:value-of select="concat('m_p_',$theName)"/></xsl:attribute>
  229. <xsl:attribute name="locale"><xsl:value-of select="$localeVal"/></xsl:attribute>
  230. <xsl:value-of select="$theValue"/>
  231. </param>
  232. </xsl:if>
  233. </xsl:if>
  234. </xsl:otherwise>
  235. </xsl:choose>
  236. </xsl:for-each>
  237. <!-- if we dont have m_p_path and we have m_path create m_p_path to always be consistent -->
  238. <xsl:if test="not(/root/env/param[@name='m_p_path']) and (/root/env/param[@name='m_path'])">
  239. <param name="m_p_path">
  240. <xsl:value-of select="/root/env/param[@name='m_path']"/>
  241. </param>
  242. </xsl:if>
  243. </env>
  244. </xsl:template>
  245. </xsl:stylesheet>
  246. </xts:block>
  247. <!--
  248. ===============================================================================================
  249. formlogic_init - standard form logic initialization
  250. ===============================================================================================
  251. -->
  252. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" dependency="doFrmCommand"/>
  253. <!--
  254. ===============================================================================================
  255. reload - reload the user preferences
  256. ===============================================================================================
  257. -->
  258. <xts:block id="reload" condition=".[/root/env/param[@name='m_class'] = 'account']" mandatory="false" processor="XML" type="exec" dependency="formlogic_init">
  259. <xts:sequence>
  260. <xts:append select="/root/env">
  261. <param name="m_reload">userPreference</param>
  262. </xts:append>
  263. </xts:sequence>
  264. </xts:block>
  265. <!--
  266. ================================================================================
  267. encode the agent items again
  268. ================================================================================
  269. -->
  270. <xts:block id="encodeResponseAgentDefinition" dependency="doFrmCommand" processor="XSLT" type="exec">
  271. <xts:logicsheet path="logicsheets/portal.xsl"/>
  272. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  273. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  274. <pf:serialize-xml/>
  275. <pf:variables/>
  276. <xsl:template match="/">
  277. <xts:sequence>
  278. <xsl:variable name="markup">
  279. <xsl:call-template name="serialize-xml">
  280. <xsl:with-param name="node-set" select="/root/response/agent_definition"/>
  281. </xsl:call-template>
  282. </xsl:variable>
  283. <xts:delete select="/root/env/param[@name='agent_response_definition_blob']"/>
  284. <xts:append select="/root/env">
  285. <param name="agent_response_definition_blob">
  286. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_encoderesponseagentdefinition_settemplateid_submit001'), xtsext:web64encode( string( $markup ), true()))"/>
  287. </param>
  288. </xts:append>
  289. </xts:sequence>
  290. </xsl:template>
  291. </xsl:stylesheet>
  292. </xts:block>
  293. <!--
  294. Verify the type of object we have a duplicate of
  295. -->
  296. <xts:block id="verifyAgentType" type="exec" mode="interpret" processor="XSLT" dependency="encodeResponseAgentDefinition formlogic_init reload" condition="/root/SoapFault" mandatory="false">
  297. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  298. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  299. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  300. <xsl:template match="/">
  301. <xts:sequence>
  302. <xsl:variable name="singleQuote">'</xsl:variable>
  303. <xts:append>
  304. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  305. <send:request provider="cm" requester="AGS:submit">
  306. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  307. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  308. <cm:requests>
  309. <cm:query>
  310. <cm:search>
  311. <xsl:value-of select="/root/env/param[@name='m_path']"/>
  312. <xsl:text>/*[@name=</xsl:text>
  313. <xsl:choose>
  314. <xsl:when test="contains(/root/env/param[@name='agentName'], '&quot;')">'</xsl:when>
  315. <xsl:otherwise>"</xsl:otherwise>
  316. </xsl:choose>
  317. <xsl:value-of select="/root/env/param[@name='agentName']"/>
  318. <xsl:choose>
  319. <xsl:when test="contains(/root/env/param[@name='agentName'], '&quot;')">'</xsl:when>
  320. <xsl:otherwise>"</xsl:otherwise>
  321. </xsl:choose>
  322. <xsl:text>]</xsl:text>
  323. </cm:search>
  324. <cm:properties>
  325. <cm:property name="objectClass"/>
  326. </cm:properties>
  327. </cm:query>
  328. </cm:requests>
  329. </cm:query>
  330. </xts:transform>
  331. </send:request>
  332. </xts:transform>
  333. </xts:append>
  334. </xts:sequence>
  335. </xsl:template>
  336. </xsl:stylesheet>
  337. </xts:block>
  338. <!--
  339. ===============================================================================================
  340. Process Response
  341. ===============================================================================================
  342. -->
  343. <xts:block id="save_redirect" dependency="verifyAgentType" mode="output" processor="XSLT" type="exec" mimeType="text/html" mandatory="false">
  344. <!-- get the debug logic sheet -->
  345. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  346. <!-- get the new theme stuff -->
  347. <xts:logicsheet path="logicsheets/portal.xsl"/>
  348. <xts:logicsheet path="ags/logicsheets/dialogs.xsl"/>
  349. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  350. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  351. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  352. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  353. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  354. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  355. <!-- apply the form logic -->
  356. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  357. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" 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:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="xts lyt pf dp df cp cf xtsext SOAP-ENV bus cm SOAP-ENC dbg">
  358. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  359. <!-- current file name -->
  360. <xsl:variable name="mname" select="'/submit.xts'"/>
  361. <!-- add any theme variables -->
  362. <df:variables/>
  363. <pf:variables/>
  364. <!-- start the output -->
  365. <xsl:template match="/root">
  366. <xsl:choose>
  367. <xsl:when test="/root/SoapFault">
  368. <!-- Save Failed -->
  369. <xsl:apply-templates select="/root/SoapFault"/>
  370. </xsl:when>
  371. <xsl:otherwise>
  372. <!-- Save succeeded, hide dialog -->
  373. <html>
  374. <head>
  375. <script type="text/javascript" src="../ags/layout.js">//</script>
  376. <script type="text/javascript">
  377. //initialise function
  378. function initialiseSubmit(){
  379. var cf = parent.getConfigFrame();
  380. with (cf) {
  381. //just in case
  382. doClosePopUp();
  383. hideDialogFrame();
  384. <xsl:if test="/root/env/param[@name='m_path']">
  385. cf.cfgSet("so.defaultLocation", "<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='m_path'])"/>");
  386. </xsl:if>
  387. // Save the path
  388. <xsl:if test="/root/env/param[@name='path']!=''">
  389. <xsl:text/>if (cfgSet) cfgSet("ReportFolder","<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='path']))"/>");<xsl:text/>
  390. </xsl:if>
  391. // update the window title
  392. <xsl:if test="/root/env/param[@name='agentName']!=''">
  393. <xsl:text/>if (cfgSet) cfgSet("ReportName", "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='agentName']))"/>");<xsl:text/>
  394. </xsl:if>
  395. parent.messageIFrame.document.forms[0].agent_definition_blob.value = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='agent_response_definition_blob']))"/>";
  396. // we aren't dealing with a new report now
  397. cfgSet("NewReport", false);
  398. agentHasChanged(false);
  399. // do the name of agent
  400. setWindowTitle();
  401. //do the next command whatever it is
  402. getCommandStackManager().processCommandStack();
  403. }
  404. }
  405. </script>
  406. </head>
  407. <body onload="initialiseSubmit()">&#160;<!--dbg:dumpxml select="/"/-->
  408. </body>
  409. </html>
  410. </xsl:otherwise>
  411. </xsl:choose>
  412. </xsl:template>
  413. <xsl:template match="/root/SoapFault">
  414. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page>
  415. <dp:script>
  416. <script type="text/javascript" src="../ags/layout.js">//</script>
  417. <script type="text/javascript">
  418. function stringReplace(origString, valToReplace, newString){
  419. var strRegExp = new RegExp();
  420. strRegExp.compile(valToReplace, "g");
  421. return origString.replace(strRegExp, newString);
  422. }
  423. function saveOverwrite(){
  424. var cf = getConfigFrame();
  425. if (cf)
  426. {
  427. cf.hideDialogFrame();
  428. cf.dlgReset();
  429. <xsl:for-each select="/root/env/param">
  430. cf.dlgSetParm("<xsl:value-of select="xtsext:javascriptencode(string(@name))"/>", "<xsl:value-of select="xtsext:javascriptencode(string(.))"/>");
  431. </xsl:for-each>
  432. <!-- have to add the trusted Credential generation if it's not already in there -->
  433. <xsl:if test="not(/root/env/param[@name = 'm_sp_credential'])">
  434. cf.dlgSetParm("h_CAM_action", "generateTC");
  435. </xsl:if>
  436. cf.dlgSetParm("action", "add");
  437. cf.dlgSetParm("overwrite", "true");
  438. cf.dlgSubmit();
  439. }
  440. }
  441. function init(){
  442. var cf=null;
  443. if (this.getConfigFrame &amp;&amp; (cf=this.getConfigFrame())!=null &amp;&amp; cf.showDialogFrame) {
  444. cf.showDialogFrame(200);
  445. }
  446. //just in case
  447. getConfigFrame().doClosePopUp();
  448. if (document.getElementById("exists_string"))
  449. document.getElementById("exists_string").appendChild(document.createTextNode(stringReplace(&quot;<xts:string id="SAVE_ERROR_AGENT_EXISTS"/>&quot;, "\\^0", "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='m_p_defaultName']))"/>")));
  450. }
  451. function toggleExceptionDetailVisibility(name) {
  452. var element = document.getElementById(name);
  453. if(element){
  454. if(element.style.display=='none'){
  455. element.style.display='';
  456. }else{
  457. element.style.display='none';
  458. }
  459. }
  460. }
  461. /*
  462. * A previously saved agent has been removed from the content store. In this case
  463. * give the user the option to save it
  464. */
  465. function handleDeletedAgent(yesPressed) {
  466. //set the agent properties
  467. var cf = parent.getConfigFrame();
  468. with(cf) {
  469. var manager = getCommandStackManager();
  470. if (yesPressed) {
  471. //push 'save as' onto the command stack
  472. manager.getCommandStack().push("saveas()");
  473. }
  474. else {
  475. hideDialogFrame();
  476. }
  477. //process command stack
  478. manager.processCommandStack();
  479. }
  480. }
  481. </script>
  482. </dp:script>
  483. <!-- dialog header -->
  484. <dp:header help="false">
  485. <!-- header titles -->
  486. <dp:title>
  487. <xts:string id="SAVE_ERROR_TITLE"/>
  488. </dp:title>
  489. <!-- close link for the header -->
  490. <dp:close>
  491. <a href="#" onclick="getConfigFrame().hideDialogFrame()">
  492. <dp:closeMarker/>
  493. </a>
  494. </dp:close>
  495. </dp:header>
  496. <!-- layout -->
  497. <lyt:layout style="1" border="no">
  498. <lyt:section>
  499. <xsl:choose>
  500. <!-- the agent has been deleted and it is still open in ES-->
  501. <xsl:when test=".//bus:exception/errorCode='cmEmptySelection'">
  502. <dp:box valign="top">
  503. <dp:boxSection hgap="20">
  504. <img width="32" height="32" align="top" hspace="10">
  505. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  506. </img>
  507. </dp:boxSection>
  508. <dp:boxSection>
  509. <dp:description>
  510. <br/>
  511. <xts:string id="BROKEN_AGENT_LINK_WARNING"/>
  512. </dp:description>
  513. </dp:boxSection>
  514. </dp:box>
  515. </xsl:when>
  516. <!-- an agent exists with the same name-->
  517. <xsl:when test=".//bus:exception/errorCode='cmDuplicateName'">
  518. <xsl:choose>
  519. <xsl:when test="/root/*[local-name()='queryResponse']/queryResult/item/objectClass/value='agentDefinition'">
  520. <dp:box valign="top">
  521. <dp:boxSection hgap="20">
  522. <img width="32" height="32" align="top" hspace="10">
  523. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  524. </img>
  525. </dp:boxSection>
  526. <dp:boxSection>
  527. <dp:description>
  528. <div id="exists_string"/>
  529. <br/>
  530. <xts:string id="SAVE_ERROR_AGENT_EXISTS_QUESTION"/>
  531. </dp:description>
  532. </dp:boxSection>
  533. </dp:box>
  534. </xsl:when>
  535. <xsl:otherwise>
  536. <dp:box valign="top">
  537. <dp:boxSection hgap="20">
  538. <img width="32" height="32" align="top" hspace="10">
  539. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  540. </img>
  541. </dp:boxSection>
  542. <dp:boxSection>
  543. <dp:description>
  544. <div id="exists_string"/>
  545. <br/>
  546. <xts:string id="SAVE_ERROR_AGENT_OVERWRITE_QUESTION"/>
  547. </dp:description>
  548. </dp:boxSection>
  549. </dp:box>
  550. </xsl:otherwise>
  551. </xsl:choose>
  552. </xsl:when>
  553. <!-- an agent exists with same name but different credentials -->
  554. <xsl:when test=".//bus:exception/errorCode='cmNoWrite'">
  555. <dp:box valign="top">
  556. <dp:boxSection hgap="20">
  557. <img width="32" height="32" align="top" hspace="10">
  558. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  559. </img>
  560. </dp:boxSection>
  561. <dp:boxSection>
  562. <dp:description>
  563. <div id="exists_string"/>
  564. <br/>
  565. <xsl:value-of select=".//bus:exception/bus:message"/>
  566. </dp:description>
  567. </dp:boxSection>
  568. </dp:box>
  569. </xsl:when>
  570. <!-- an agent exists with same name but different credentials -->
  571. <xsl:when test=".//bus:exception/errorCode='cmUpdateFailed1'">
  572. <dp:box valign="top">
  573. <dp:boxSection hgap="20">
  574. <img width="32" height="32" align="top" hspace="10">
  575. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  576. </img>
  577. </dp:boxSection>
  578. <dp:boxSection>
  579. <dp:description>
  580. <xsl:for-each select=".//bus:exception/bus:message">
  581. <xsl:value-of select="./messageString"/>
  582. <br/>
  583. </xsl:for-each>
  584. </dp:description>
  585. </dp:boxSection>
  586. </dp:box>
  587. </xsl:when>
  588. <xsl:otherwise>
  589. <dp:list>
  590. <dp:section>
  591. <dp:text>
  592. <xsl:text>status : </xsl:text>
  593. <b style="color:red">request failed</b>
  594. <br/>
  595. <xsl:text>faultcode : </xsl:text>
  596. <tt style="color:blue">
  597. <xsl:value-of select=".//SOAP-ENV:Fault/faultcode"/>
  598. </tt>
  599. <br/>
  600. <xsl:text>faultstring : </xsl:text>
  601. <tt style="color:blue">
  602. <xsl:value-of select=".//SOAP-ENV:Fault/faultstring"/>
  603. </tt>
  604. <br/>
  605. <xsl:for-each select=".//xts:exception">
  606. <b>xts:exception</b>
  607. <br/>
  608. <xsl:text>code </xsl:text>
  609. <tt style="color:blue">
  610. <xsl:value-of select=".//xts:exceptionCode"/>
  611. </tt>
  612. <br/>
  613. <xsl:text>msg </xsl:text>
  614. <tt style="color:blue">
  615. <xsl:value-of select=".//xts:exceptionMsg"/>
  616. </tt>
  617. <br/>
  618. <xsl:text>exception </xsl:text>
  619. <a href="#" onclick="toggleExceptionDetailVisibility('exception_detail_{position()}')">detail</a>
  620. <div id="exception_detail_{position()}" style="display:none">
  621. <tt style="color:blue">
  622. <xsl:value-of select=".//xts:exceptionDetail"/>
  623. </tt>
  624. </div>
  625. <br/>
  626. </xsl:for-each>
  627. <xsl:for-each select=".//bus:exception/*">
  628. <xsl:if test="name()!='bus:message'">
  629. <xsl:value-of select="name()"/>
  630. <xsl:text> : </xsl:text>
  631. </xsl:if>
  632. <tt style="color:blue">
  633. <xsl:value-of select="."/>
  634. </tt>
  635. <br/>
  636. </xsl:for-each>
  637. </dp:text>
  638. </dp:section>
  639. </dp:list>
  640. </xsl:otherwise>
  641. </xsl:choose>
  642. </lyt:section>
  643. </lyt:layout>
  644. <lyt:layout style="2">
  645. <lyt:section/>
  646. <lyt:section>
  647. <xsl:choose>
  648. <xsl:when test=".//bus:exception/errorCode='cmDuplicateName'">
  649. <xsl:choose>
  650. <xsl:when test="/root/*[local-name()='queryResponse']/queryResult/item/objectClass/value='agentDefinition'">
  651. <dp:buttonGroup>
  652. <df:button df:id="DIALOG_YES_BUTTON" df:style="href" df:href="#" onclick="saveOverwrite();"/>
  653. <df:button df:id="DIALOG_NO_BUTTON" df:style="href" df:href="#" onclick="getConfigFrame().saveas();"/>
  654. <df:button df:id="DIALOG_CANCEL_BUTTON" df:style="href" df:href="#" onclick="getConfigFrame().hideDialogFrame();"/>
  655. </dp:buttonGroup>
  656. </xsl:when>
  657. <xsl:otherwise>
  658. <dp:buttonGroup>
  659. <df:button df:id="IDS_OK" df:style="href" df:href="#" onclick="getConfigFrame().saveas();"/>
  660. <df:button df:id="DIALOG_CANCEL_BUTTON" df:style="href" df:href="#" onclick="getConfigFrame().hideDialogFrame();"/>
  661. </dp:buttonGroup>
  662. </xsl:otherwise>
  663. </xsl:choose>
  664. </xsl:when>
  665. <xsl:when test=".//bus:exception/errorCode='cmNoWrite'">
  666. <dp:buttonGroup>
  667. <df:button df:id="IDS_OK" df:style="href" df:href="#" onclick="getConfigFrame().saveas();"/>
  668. <df:button df:id="DIALOG_CANCEL_BUTTON" df:style="href" df:href="#" onclick="getConfigFrame().hideDialogFrame();"/>
  669. </dp:buttonGroup>
  670. </xsl:when>
  671. <xsl:when test=".//bus:exception/errorCode='cmEmptySelection'">
  672. <dp:buttonGroup>
  673. <df:button df:id="DIALOG_YES_BUTTON" df:style="href" df:href="#" onclick="handleDeletedAgent(true);"/>
  674. <df:button df:id="DIALOG_NO_BUTTON" df:style="href" df:href="#" onclick="handleDeletedAgent(false);"/>
  675. </dp:buttonGroup>
  676. </xsl:when>
  677. <xsl:otherwise>
  678. <dp:buttonGroup>
  679. <df:button df:id="IDS_OK" df:style="href" df:href="#" onclick="getConfigFrame().hideDialogFrame();"/>
  680. </dp:buttonGroup>
  681. </xsl:otherwise>
  682. </xsl:choose>
  683. </lyt:section>
  684. </lyt:layout>
  685. </dp:page>
  686. </xsl:template>
  687. </xsl:stylesheet>
  688. </xts:block>
  689. <!--
  690. ===============================================================================================
  691. Soap Faults handler
  692. ===============================================================================================
  693. -->
  694. <xts:block id="faultHandler" type="fault" processor="XSLT">
  695. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" version="1.0">
  696. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  697. <xsl:template match="/">
  698. <SoapFault>
  699. <xsl:copy>
  700. <xsl:copy-of select="/root/fault"/>
  701. </xsl:copy>
  702. </SoapFault>
  703. </xsl:template>
  704. </xsl:stylesheet>
  705. </xts:block>
  706. </xts:morphlet>