cmSaveQuery.xts 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  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/QSRVUITextPL.xml,messages/portal.xml,messages/portalRL.xml" requiredCapability="canUseQueryStudio">
  13. <!--
  14. Do request to CM
  15. -->
  16. <xts:block id="saveQuery" mode="interpret" processor="XSLT" type="exec"> <!-- dependency="readPrompts"> -->
  17. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  18. <xsl:stylesheet version="1.0"
  19. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  21. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  22. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  23. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  24. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  25. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  26. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  27. <xsl:template name="duplicate-apos">
  28. <xsl:param name="original"/>
  29. <xsl:param name="character"/>
  30. <xsl:choose>
  31. <xsl:when test="contains($original,$character)">
  32. <xsl:value-of select="substring-before($original,$character)"/>
  33. <xsl:value-of select="$character"/>
  34. <xsl:value-of select="$character"/>
  35. <xsl:call-template name="duplicate-apos">
  36. <xsl:with-param name="original" select="substring-after($original,$character)"/>
  37. <xsl:with-param name="character" select="$character"/>
  38. </xsl:call-template>
  39. </xsl:when>
  40. <xsl:otherwise>
  41. <xsl:value-of select="$original"/>
  42. </xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:template>
  45. <xsl:template match="/">
  46. <xts:sequence>
  47. <xsl:if test="key('env-param','overwrite')='true' and key('env-param','reportType')">
  48. <xts:append>
  49. <send:request provider="warp" asText="true" soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201404/" faultBlock="faultHandler" responseEnvelope="true">
  50. <!-- delete query specification -->
  51. <cm:delete xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  52. <search xsi:type="xsd:string">
  53. <xsl:value-of select="xtsext:urldecode(string(key('env-param','path')))"/>/<xsl:value-of select="key('env-param','reportType')"/>[@name=<xsl:text/>
  54. <xsl:choose>
  55. <xsl:when test="contains(xtsext:urldecode(string(key('env-param','queryName'))), '&quot;')">'</xsl:when>
  56. <xsl:otherwise>"</xsl:otherwise>
  57. </xsl:choose>
  58. <xsl:value-of select="xtsext:urldecode(string(key('env-param','queryName')))"/>
  59. <xsl:choose>
  60. <xsl:when test="contains(xtsext:urldecode(string(key('env-param','queryName'))), '&quot;')">'</xsl:when>
  61. <xsl:otherwise>"</xsl:otherwise>
  62. </xsl:choose><xsl:text>]</xsl:text>
  63. </search>
  64. <options xsi:type="cm:deleteOptions">
  65. <force xsi:type="xsd:boolean">true</force>
  66. <recursive xsi:type="xsd:boolean">true</recursive>
  67. </options>
  68. </cm:delete>
  69. </send:request>
  70. </xts:append>
  71. </xsl:if>
  72. <xts:append>
  73. <send:request provider="warp" asText="true" soapAction="http://www.ibm.com/xmlns/prod/cognos/reportService/201404/" faultBlock="faultHandler" responseEnvelope="true">
  74. <xsl:choose>
  75. <xsl:when test="key('env-param','action')='update'">
  76. <!-- update query specification -->
  77. <xsl:choose>
  78. <xsl:when test="key('env-param','reportName')!=' ' and key('env-param','reportName')!=' '">
  79. <cm:update xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  80. <object xsi:type="cm:query">
  81. <searchPath xsi:type="bus:stringProp"><value><xsl:value-of select="xtsext:urldecode(string(key('env-param','reportFolder')))"/>/query[@name='<xsl:text/>
  82. <xsl:variable name="singleApos">'</xsl:variable>
  83. <!-- duplicate every &apos; -->
  84. <xsl:call-template name="duplicate-apos">
  85. <xsl:with-param name="original" select="xtsext:urldecode(string(key('env-param','reportName')))"/>
  86. <xsl:with-param name="character" select="$singleApos" />
  87. </xsl:call-template>']</value>
  88. </searchPath>
  89. <specification>
  90. <schemaInfo xsi:nil="true"/>
  91. <value xsi:type="xsd:string">
  92. <xsl:value-of select="key('env-param','xxSpec')"/>
  93. </value>
  94. </specification>
  95. </object>
  96. <options xsi:type="bus:updateOptions">
  97. <returnProperties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[]">
  98. <item xsi:type="bus:propEnum">searchPath</item>
  99. </returnProperties>
  100. </options>
  101. </cm:update>
  102. </xsl:when>
  103. <xsl:otherwise>
  104. <cm:add xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  105. <search xsi:type="xsd:string"><xsl:value-of select="xtsext:urldecode(string(key('env-param','reportFolder')))"/></search>
  106. <object xsi:type="cm:query">
  107. <defaultName>
  108. <schemaInfo xsi:nil="true"/>
  109. <value xsi:type="xsd:string"><xsl:value-of select="xtsext:urldecode(string(key('env-param','reportName')))"/></value>
  110. </defaultName>
  111. <specification>
  112. <schemaInfo xsi:nil="true"/>
  113. <value xsi:type="xsd:string">
  114. <xsl:value-of select="key('env-param','xxSpec')"/>
  115. </value>
  116. </specification>
  117. </object>
  118. <options xsi:type="cm:addOptions">
  119. <updateAction xsi:type="bus:updateActionEnum">update</updateAction>
  120. </options>
  121. </cm:add>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. </xsl:when>
  125. <xsl:otherwise>
  126. <!-- add a new query in CM -->
  127. <cm:add xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  128. <search xsi:type="xsd:string">
  129. <xsl:value-of select="xtsext:urldecode(string(key('env-param','path')))"/>
  130. </search>
  131. <object xsi:type="cm:query">
  132. <defaultName>
  133. <schemaInfo xsi:nil="true"/>
  134. <value xsi:type="xsd:string">
  135. <xsl:value-of select="xtsext:urldecode(string(key('env-param','queryName')))"/>
  136. </value>
  137. </defaultName>
  138. <defaultDescription>
  139. <schemaInfo xsi:nil="true"/>
  140. <value xsi:type="xsd:string">
  141. <xsl:value-of select="xtsext:urldecode(string(key('env-param','desc')))"/>
  142. </value>
  143. </defaultDescription>
  144. <defaultScreenTip xsi:type="cm:stringProp">
  145. <schemaInfo xsi:nil="true"/>
  146. <value xsi:type="xsd:string">
  147. <xsl:value-of select="xtsext:urldecode(string(key('env-param','tip')))"/>
  148. </value>
  149. </defaultScreenTip>
  150. <specification>
  151. <schemaInfo xsi:nil="true"/>
  152. <value xsi:type="xsd:string">
  153. <xsl:value-of select="key('env-param','xxSpec')"/>
  154. </value>
  155. </specification>
  156. </object>
  157. <options xsi:type="cm:addOptions">
  158. <updateAction xsi:type="bus:updateActionEnum">
  159. <xsl:choose>
  160. <xsl:when test="/root/env/param[@name='overwrite']='true'">replace</xsl:when>
  161. <xsl:otherwise>fail</xsl:otherwise>
  162. </xsl:choose>
  163. </updateAction>
  164. </options>
  165. </cm:add>
  166. </xsl:otherwise>
  167. </xsl:choose>
  168. </send:request>
  169. </xts:append>
  170. </xts:sequence>
  171. </xsl:template>
  172. </xsl:stylesheet>
  173. </xts:block>
  174. <!--
  175. Verify the type of object we have a duplicate of
  176. -->
  177. <xts:block id="verifyReportType" type="exec" mode="interpret" processor="XSLT" dependency="saveQuery" condition="/root/SoapFault" mandatory="false">
  178. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  179. <xsl:stylesheet version="1.0"
  180. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  181. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  182. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  183. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  184. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  185. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  186. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  187. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  188. <xsl:template match="/">
  189. <xts:sequence>
  190. <xsl:variable name="singleQuote">'</xsl:variable>
  191. <xsl:if test="not((contains(/root/env/param[@name='queryName'], '&quot;') or contains(/root/env/param[@name='queryName'], '%22')) and contains(/root/env/param[@name='queryName'], $singleQuote))">
  192. <xts:append>
  193. <send:request provider="warp" asText="true" soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201404/">
  194. <cm:query xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  195. <search xsi:type="xsd:string">
  196. <xsl:text/><xsl:value-of select="xtsext:urldecode(string(/root/env/param[@name='path']))"/>/*[@name=<xsl:text/>
  197. <xsl:choose>
  198. <xsl:when test="contains(xtsext:urldecode(string(/root/env/param[@name='queryName'])), '&quot;')">'</xsl:when>
  199. <xsl:otherwise>"</xsl:otherwise>
  200. </xsl:choose>
  201. <xsl:value-of select="xtsext:urldecode(string(/root/env/param[@name='queryName']))"/>
  202. <xsl:choose>
  203. <xsl:when test="contains(xtsext:urldecode(string(/root/env/param[@name='queryName'])), '&quot;')">'</xsl:when>
  204. <xsl:otherwise>"</xsl:otherwise>
  205. </xsl:choose>]<xsl:text/>
  206. </search>
  207. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[1]">
  208. <item xsi:type="cm:propEnum">objectClass</item>
  209. </properties>
  210. </cm:query>
  211. </send:request>
  212. </xts:append>
  213. </xsl:if>
  214. </xts:sequence>
  215. </xsl:template>
  216. </xsl:stylesheet>
  217. </xts:block>
  218. <!--
  219. Process Response
  220. -->
  221. <xts:block id="format" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="saveQuery verifyReportType">
  222. <!-- get the debug logic sheet -->
  223. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  224. <!-- get the new theme stuff -->
  225. <xts:logicsheet path="logicsheets/portal.xsl"/>
  226. <xts:logicsheet path="qs/logicsheets/dialogs.xsl"/>
  227. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  228. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  229. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  230. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  231. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  232. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  233. <!-- apply the form logic -->
  234. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  235. <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:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/" 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/bibus/3/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="xsl xts lyt pf dp df cp cf qsdlg xtsext bus cm SOAP-ENC dbg">
  236. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  237. <!-- add any theme variables -->
  238. <df:variables/>
  239. <pf:variables/>
  240. <!-- start the output -->
  241. <xsl:template match="/root">
  242. <xsl:choose>
  243. <xsl:when test="/root/SoapFault">
  244. <!-- Save Failed -->
  245. <xsl:apply-templates select="/root/SoapFault"/>
  246. </xsl:when>
  247. <xsl:when test="/root/logonFault">
  248. <!-- Save Failed -->
  249. <xsl:apply-templates select="/root/logonFault"/>
  250. </xsl:when>
  251. <xsl:otherwise>
  252. <!-- Save succeeded, hide dialog -->
  253. <html>
  254. <head>
  255. <script type="text/javascript">
  256. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  257. <xsl:text/>//<xsl:text/>
  258. </script>
  259. <script type="text/javascript"><![CDATA[function saveOK(){var cf=null;if (this.getConfigFrame && (cf=this.getConfigFrame())!=null && cf.hideDialogFrame) {]]><xsl:if test="/root/env/param[@name='queryName']!=''">
  260. <xsl:text/>if (cf.cfgSet) cf.cfgSet("ReportName", "<xsl:value-of select="xtsext:javascriptencode(xtsext:urldecode(string(/root/env/param[@name='queryName'])))"/>");<xsl:text/>
  261. </xsl:if>
  262. <xsl:text/>cf.cfgSet("NewReport", false);<xsl:text/>
  263. <xsl:if test="/root/env/param[@name='path']!=''">
  264. <xsl:text/>if (cf.cfgSet) cf.cfgSet("ReportFolder","<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='path']))"/>");<xsl:text/>
  265. </xsl:if>
  266. <xsl:if test="/root/cm:addResponse/addResult/searchPath/value!=''">
  267. <xsl:text/>if (cf.cfgSet) cf.cfgSet("SearchPath", cf.cEscape("<xsl:value-of select="xtsext:javascriptencode(string(/root/cm:addResponse/addResult/searchPath/value))"/>"));<xsl:text/>
  268. </xsl:if>
  269. <xsl:if test="/root/env/param[@name='leaveAfterSave']='true'">
  270. <xsl:text/>if (cf.closeLink) cf.closeLink(true);<xsl:text/>
  271. </xsl:if>
  272. <xsl:if test="/root/env/param[@name='newAfterSave']='true'">
  273. <xsl:text/>cf.goApplicationManager.getFeatureManager().launchFeature('NewReport', ['direct']);<xsl:text/>
  274. </xsl:if>
  275. <xsl:text/>cf.cfgRemove("LAST_SAVE_DIALOG");<xsl:text/>
  276. <xsl:text/>cf.cfgRemove("ACTION_AFTER_SAVE");<xsl:text/>
  277. <xsl:text/>cf.updateReportHasChanged(false);<xsl:text/>
  278. <xsl:if test="not(/root/env/param[@name='newAfterSave']='true')">
  279. <xsl:text/>cf.setWindowTitle();<xsl:text/>
  280. </xsl:if>
  281. <xsl:text/>cf.hideDialogFrame();<xsl:text/>
  282. <xsl:if test="/root/env/param[@name='goBack']='true'">
  283. <xsl:text/>cf.window.history.back();<xsl:text/>
  284. </xsl:if>
  285. <xsl:if test="/root/env/param[@name='open']='true'">
  286. <xsl:text/>cf.goApplicationManager.getFeatureManager().launchFeature('OpenReport', ['continueOpen']);
  287. </xsl:if>
  288. <xsl:text/><![CDATA[}else setTimeout(this.saveOK, 100);}]]></script>
  289. </head>
  290. <body>&#160;<!--dbg:dumpxml select="/"/-->
  291. <script type="text/javascript">
  292. saveOK();
  293. </script>
  294. </body>
  295. </html>
  296. </xsl:otherwise>
  297. </xsl:choose>
  298. </xsl:template>
  299. <xsl:template match="/root/logonFault" priority="1">
  300. <dp:page>
  301. <dp:script>
  302. <script type="text/javascript">
  303. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  304. <xsl:text/>//<xsl:text/>
  305. </script>
  306. <script type="text/javascript">
  307. var cf = getConfigFrame();
  308. cf.cfgSet("SAVE_REPORT", true);
  309. cf.pptFaultHandler();
  310. cf.hideDialogFrame();
  311. </script>
  312. </dp:script>
  313. </dp:page>
  314. </xsl:template>
  315. <xsl:template match="/root/SoapFault" priority="1">
  316. <dp:page>
  317. <dp:script>
  318. <script type="text/javascript">
  319. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  320. <xsl:text/>//<xsl:text/>
  321. </script>
  322. <script type="text/javascript">
  323. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  324. <xsl:text/>//<xsl:text/>
  325. </script>
  326. <script type="text/javascript">
  327. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CWindowManager.js</xsl:attribute>
  328. <xsl:text/>//<xsl:text/>
  329. </script>
  330. <script type="text/javascript">
  331. var goDialogManager = new CDialogManager();
  332. function stringReplace(origString, valToReplace, newString)
  333. {
  334. var strRegExp = new RegExp();
  335. strRegExp.compile(valToReplace, "g");
  336. return origString.replace(strRegExp, newString);
  337. }
  338. function saveNoOverwrite()
  339. {
  340. var cf = getConfigFrame();
  341. if (cf)
  342. {
  343. <xsl:choose>
  344. <xsl:when test="/root/env/param[@name='leaveAfterSave']='true'">goDialogManager.getFeatureManager().launchFeature('SaveAs', new Array("leave"));</xsl:when>
  345. <xsl:when test="/root/env/param[@name='newAfterSave']='true'">goDialogManager.getFeatureManager().launchFeature('SaveAs', new Array("new"));</xsl:when>
  346. <xsl:otherwise>goDialogManager.getFeatureManager().launchFeature('SaveAs');</xsl:otherwise>
  347. </xsl:choose>
  348. }
  349. }
  350. function saveOverwrite()
  351. {
  352. var cf = getConfigFrame();
  353. if (cf)
  354. {
  355. cf.dlgReset();
  356. <xsl:for-each select="/root/env/param">
  357. cf.dlgSetParm("<xsl:value-of select="xtsext:javascriptencode(string(@name))"/>", "<xsl:value-of select="xtsext:javascriptencode(string(.))"/>");
  358. </xsl:for-each>
  359. <!-- Re-Caf sign the xxSpec -->
  360. <xsl:if test="/root/env/param[@name='xxSpec']!=''">
  361. cf.dlgSetParm("xxSpec", "<xsl:value-of select="xtsext:javascriptencode(string(key('env-param','xxSpec')))"/>");
  362. </xsl:if>
  363. if (document.pform.currentActionValue.value == "rename")
  364. {
  365. var newName = cf.cEscape(document.pform.err_rename.value);
  366. cf.dlgRemoveParm("overwrite");
  367. cf.dlgRemoveParm("action");
  368. cf.dlgRemoveParm("reportType");
  369. cf.dlgSetParm("queryName", newName);
  370. }
  371. else
  372. {
  373. cf.dlgSetParm("overwrite", "true");
  374. cf.dlgSetParm("action", "add");
  375. cf.dlgSetParm("reportType", "<xsl:value-of select="xtsext:javascriptencode(string(/root/cm:queryResponse/queryResult/item/objectClass/value))"/>");
  376. }
  377. cf.hideDialogFrame();
  378. cf.dlgSubmit(null, true);
  379. }
  380. }
  381. function init()
  382. {
  383. attachMouseEvents();
  384. var cf=null;
  385. if (this.getConfigFrame &amp;&amp; (cf=this.getConfigFrame())!=null &amp;&amp; cf.showDialogFrame)
  386. <xsl:choose>
  387. <xsl:when test="/root/cm:queryResponse/queryResult/item/objectClass/value='query' or /root/cm:queryResponse/queryResult/item/objectClass/value='report' or /root/cm:queryResponse/queryResult/item/objectClass/value='reportView' or .//bus:exception/errorCode='cmDuplicateObject'">cf.showDialogFrame(220);</xsl:when>
  388. <xsl:otherwise>cf.showDialogFrame(150);</xsl:otherwise>
  389. </xsl:choose>
  390. if (document.getElementById("exists_string"))
  391. {
  392. if (<xsl:choose><xsl:when test="/root/cm:queryResponse/queryResult/item/objectClass/value='query' or /root/cm:queryResponse/queryResult/item/objectClass/value='report' or /root/cm:queryResponse/queryResult/item/objectClass/value='reportView'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose>)
  393. document.getElementById("exists_string").appendChild(document.createTextNode(stringReplace("<xts:string id="SAVE_ERROR_REPORT_EXISTS" encode="javascript"/>", "\\^0", "<xsl:value-of select="xtsext:javascriptencode(xtsext:urldecode(string(/root/env/param[@name='queryName'])))"/>")));
  394. else
  395. {
  396. var errMsg = '<xts:string id="SAVE_ERROR_REPORT_EXISTS_CANNOT_REPLACE" encode="javascript"/>';
  397. errMsg = stringReplace(errMsg, "\\^0", "<xsl:value-of select="xtsext:javascriptencode(xtsext:urldecode(string(/root/env/param[@name='queryName'])))"/>")
  398. errMsg = stringReplace(errMsg, "\\^1", "<xsl:value-of select="xtsext:javascriptencode(string(/root/cm:queryResponse/queryResult/item/objectClass/value))"/>")
  399. document.getElementById("exists_string").appendChild(document.createTextNode(errMsg));
  400. }
  401. }
  402. else if (document.getElementById("bad_string"))
  403. {
  404. var tempStr = stringReplace("<xts:string id="SAVE_ERROR_BAD_NAME" encode="javascript"/>", "\\^0", "<xsl:value-of select="xtsext:javascriptencode(xtsext:urldecode(string(/root/env/param[@name='queryName'])))"/>");
  405. tempStr = stringReplace(tempStr,"\\^1", '"');
  406. tempStr = stringReplace(tempStr,"\\^2", "'");
  407. document.getElementById("bad_string").appendChild(document.createTextNode(tempStr));
  408. }
  409. }
  410. function setCurrentAction(str)
  411. {
  412. document.pform.currentActionValue.value = str;
  413. }
  414. </script>
  415. </dp:script>
  416. <form style="margin:0px" name="pform" method="POST" onsubmit="return false;">
  417. <input type="hidden" name="currentActionValue" value="overwrite"/>
  418. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  419. <tr>
  420. <td width="100%" height="0%">
  421. <!-- dialog header -->
  422. <dp:header help="false">
  423. <!-- header titles -->
  424. <dp:title>
  425. <xts:string id="SAVE_ERROR_TITLE"/>
  426. </dp:title>
  427. <!-- close link for the header -->
  428. <dp:close>
  429. <a href="javascript:getConfigFrame().hideDialogFrame()">
  430. <dp:closeMarker/>
  431. </a>
  432. </dp:close>
  433. </dp:header>
  434. </td>
  435. </tr>
  436. <tr>
  437. <td width="100%" height="100%" valign="top">
  438. <!-- layout -->
  439. <lyt:layout style="1" border="no">
  440. <lyt:section>
  441. <xsl:choose>
  442. <xsl:when test=".//bus:exception/bus:errorCode='cmDuplicateName' or .//bus:exception/bus:errorCode='cmDuplicateObject'">
  443. <xsl:choose>
  444. <xsl:when test="/root/cm:queryResponse/queryResult/item/objectClass/value='query' or /root/cm:queryResponse/queryResult/item/objectClass/value='report' or /root/cm:queryResponse/queryResult/item/objectClass/value='reportView'">
  445. <dp:group>
  446. <dp:groupItem valign="top">
  447. <img height="32" width="32" border="0">
  448. <xsl:attribute name="src">
  449. <xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>
  450. <xsl:text/>/images/msg_warning.gif<xsl:text/>
  451. </xsl:attribute>
  452. </img>
  453. </dp:groupItem>
  454. <dp:groupItem>
  455. <!-- used for alignment -->
  456. <dp:text/><xsl:text>&#160;</xsl:text>
  457. </dp:groupItem>
  458. <dp:groupItem valign="top">
  459. <dp:text nospace="nospace" wrap="wrap">
  460. <xts:string id="IDS_DUPLICATE_ERROR_RENAME_REPLACE_ERROR"><xts:param name="entryName"><xsl:value-of select="xtsext:urldecode(string(/root/env/param[@name='queryName']))"/></xts:param></xts:string>
  461. <!-- Multiple actions. Render the choices -->
  462. <br/>
  463. <table border="0" cellspacing="0" cellpadding="1">
  464. <tr>
  465. <td class="formText">
  466. <input type="radio" name="currentAction" value="overwrite" checked="true" onClick="javascript:setCurrentAction('overwrite')"/>
  467. </td>
  468. <td class="formText">
  469. <xts:string id="IDS_DUPLICATE_ERROR_REPLACE_ENTRY_OPTION"/>
  470. </td>
  471. </tr>
  472. <tr>
  473. <td valign="top" class="formText">
  474. <input type="radio" name="currentAction" value="rename" onClick="javascript:setCurrentAction('rename')"/>
  475. </td>
  476. <td class="formText">
  477. <xts:string id="IDS_DUPLICATE_ERROR_RENAME_ENTRY_OPTION"/><br/>
  478. <input name="err_rename" size='45' onFocus="javascript:document.pform.currentAction[1].checked = true;setCurrentAction('rename');">
  479. <xsl:attribute name="value">
  480. <xsl:value-of select="xtsext:urldecode(string(/root/env/param[@name='queryName']))"/>
  481. </xsl:attribute>
  482. </input>
  483. </td>
  484. </tr>
  485. <tr>
  486. <td>
  487. <img height="5" width="1">
  488. <xsl:attribute name="src"><xsl:value-of select="'{$webcontent}'"/>/images/space.gif</xsl:attribute>
  489. </img>
  490. </td>
  491. </tr>
  492. <tr>
  493. <td colspan='2' class="formText"><xts:string id="IDS_DUPLICATE_ERROR_CONTINUE"/><br/></td>
  494. </tr>
  495. </table>
  496. </dp:text>
  497. </dp:groupItem>
  498. </dp:group>
  499. </xsl:when>
  500. <xsl:otherwise>
  501. <dp:box valign="top">
  502. <dp:boxSection hgap="20">
  503. <img width="32" height="32" align="top" hspace="10">
  504. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  505. </img>
  506. </dp:boxSection>
  507. <dp:boxSection>
  508. <dp:description>
  509. <div id="exists_string"/>
  510. </dp:description>
  511. </dp:boxSection>
  512. </dp:box>
  513. </xsl:otherwise>
  514. </xsl:choose>
  515. </xsl:when>
  516. <xsl:when test=".//bus:exception/bus:message/bus:messageString[starts-with(.,'CM-REQ-4244')]">
  517. <dp:box valign="top">
  518. <dp:boxSection hgap="20">
  519. <img width="32" height="32" align="top" hspace="10">
  520. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/<xsl:value-of select="$app"/>/images/msg_warning.gif</xsl:attribute>
  521. </img>
  522. </dp:boxSection>
  523. <dp:boxSection>
  524. <dp:description>
  525. <div id="bad_string"/>
  526. </dp:description>
  527. </dp:boxSection>
  528. </dp:box>
  529. </xsl:when>
  530. <xsl:otherwise>
  531. <dp:list>
  532. <dp:section>
  533. <dp:text>
  534. <xsl:for-each select=".//bus:exception/*">
  535. <xsl:choose>
  536. <xsl:when test="name()!='bus:message'">
  537. <xsl:value-of select="name()"/>
  538. <xsl:text> : </xsl:text>
  539. <tt style="color:blue">
  540. <xsl:value-of select="."/>
  541. </tt>
  542. </xsl:when>
  543. <xsl:when test="name()='bus:message'">
  544. <xsl:for-each select="./bus:messageString">
  545. <br/>
  546. <xsl:value-of select="."/>
  547. </xsl:for-each>
  548. </xsl:when>
  549. </xsl:choose>
  550. <br/>
  551. </xsl:for-each>
  552. </dp:text>
  553. </dp:section>
  554. </dp:list>
  555. </xsl:otherwise>
  556. </xsl:choose>
  557. </lyt:section>
  558. </lyt:layout>
  559. </td>
  560. </tr>
  561. <tr>
  562. <td width="100%" height="0%">
  563. <dp:footer>
  564. <xsl:choose>
  565. <xsl:when test=".//bus:exception/bus:errorCode='cmDuplicateName'">
  566. <xsl:choose>
  567. <xsl:when test="/root/cm:queryResponse/queryResult/item/objectClass/value='query' or /root/cm:queryResponse/queryResult/item/objectClass/value='report' or /root/cm:queryResponse/queryResult/item/objectClass/value='reportView'">
  568. <df:button df:id="IDS_OK" df:style="href" df:href="javascript:saveOverwrite();" df:defaultKey="active"/>
  569. </xsl:when>
  570. <xsl:otherwise>
  571. <df:button df:id="IDS_OK" df:style="href" df:href="javascript:saveNoOverwrite();" df:defaultKey="active"/>
  572. </xsl:otherwise>
  573. </xsl:choose>
  574. <df:button df:id="DIALOG_CANCEL_BUTTON" df:style="href" df:href="javascript:getConfigFrame().hideDialogFrame();"/>
  575. </xsl:when>
  576. <xsl:otherwise>
  577. <df:button df:id="IDS_OK" df:style="href" df:href="javascript:saveNoOverwrite();" df:defaultKey="active"/>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. </dp:footer>
  581. </td>
  582. </tr>
  583. </table>
  584. </form>
  585. <!--dbg:dumpxml select="/"/-->
  586. </dp:page>
  587. </xsl:template>
  588. </xsl:stylesheet>
  589. </xts:block>
  590. <!--
  591. Soap Faults handler
  592. -->
  593. <xts:block id="faultHandler" type="fault" processor="XSLT">
  594. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
  595. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  596. <xsl:template match="/">
  597. <xsl:choose>
  598. <xsl:when test="//*[local-name()='CAM']/*[local-name()='exception']//*[local-name()='promptInfo']">
  599. <logonFault>timeout</logonFault>
  600. </xsl:when>
  601. <xsl:otherwise>
  602. <SoapFault>
  603. <xsl:copy>
  604. <xsl:copy-of select="/root/fault"/>
  605. </xsl:copy>
  606. </SoapFault>
  607. </xsl:otherwise>
  608. </xsl:choose>
  609. </xsl:template>
  610. </xsl:stylesheet>
  611. </xts:block>
  612. </xts:morphlet>