addSql.xts 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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, 2014
  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. whip out the parameters that were saved off previously
  12. ===============================================================================================
  13. -->
  14. <xts:block id="decodeExistingParameters" path="/ags/parameters/decodeExistingParameters.xslt" processor="XSLT" type="exec" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished' ]" mandatory="false">
  15. <xts:logicsheet path="logicsheets/portal.xsl"/>
  16. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  17. </xts:block>
  18. <!--
  19. ================================================================================
  20. We also may have just come back from a jauort server, so update this info with any new parameter values
  21. ===============================================================================================
  22. -->
  23. <xts:block id="mergeLiteralParameters" path="/ags/parameters/mergeLiteralParameters.xslt" dependency="decodeExistingParameters" processor="XSLT" type="exec" mandatory="false" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished'] ">
  24. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  25. </xts:block>
  26. <!--
  27. ================================================================================
  28. decode the the model item parameters from the form fields and update the parameters block
  29. ===============================================================================================
  30. -->
  31. <xts:block id="mergeModelParameters" path="/ags/parameters/mergeModelParameters.xslt" processor="XSLT" type="exec" mode="interpret" dependency="mergeLiteralParameters" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished'] " mandatory="false"/>
  32. <!--
  33. ================================================================================
  34. if We have just come back from a jaunt round the report server, update the agent task blob
  35. ===============================================================================================
  36. -->
  37. <xts:block id="createParametersBlob" path="/ags/parameters/createParametersBlob.xslt" dependency="mergeModelParameters" processor="XSLT" type="exec" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished'] " mandatory="false">
  38. <xts:logicsheet path="logicsheets/portal.xsl"/>
  39. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  40. </xts:block>
  41. <!--
  42. ===============================================================================================
  43. returnResult - We're done with the email options morphlet, so return the appropriate response
  44. ===============================================================================================
  45. -->
  46. <xts:block id="returnResult" path="/ags/tabResultTemplate.xslt" dependency="createParametersBlob" type="exec" processor="XSLT" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished']" mandatory="false">
  47. <xts:logicsheet path="logicsheets/portal.xsl"/>
  48. </xts:block>
  49. <!--
  50. ===============================================================================================
  51. Get the package content and the model details from CM
  52. ===============================================================================================
  53. -->
  54. <xts:block id="getDetails" processor="XSLT" type="exec" dependency="returnResult" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup']" mandatory="false">
  55. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  56. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  57. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  58. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  59. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  60. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  61. <xsl:template match="/">
  62. <xsl:variable name="selectedpack">
  63. <xsl:choose>
  64. <xsl:when test="/root/env/param[@name='sql_package']">
  65. <xsl:value-of select="/root/env/param[@name='sql_package']"/>
  66. </xsl:when>
  67. <xsl:otherwise>
  68. <xsl:value-of select="/root/env/param[@name='packRoot']"/>
  69. </xsl:otherwise>
  70. </xsl:choose>
  71. </xsl:variable>
  72. <xsl:variable name="modelBase">
  73. <xsl:value-of select="$selectedpack"/>/model[last()]
  74. </xsl:variable>
  75. <xsl:if test="$selectedpack != ''">
  76. <xts:sequence>
  77. <xts:delete select="/root/procedureDetails" mandatory="false"/>
  78. <xts:append>
  79. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  80. <send:request provider="cm" responseEnvelope="true" outputHeader="true" option="xml-multipart" requester="AGS:addSql">
  81. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT" faultBlock="faultHandler">
  82. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  83. <cm:requests>
  84. <!-- Package content -->
  85. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  86. <cm:search>//package</cm:search>
  87. <cm:properties>
  88. <cm:property name="defaultName"/>
  89. <cm:property name="searchPath"/>
  90. <cm:property name="permissions"/>
  91. <cm:property name="ancestors"/>
  92. </cm:properties>
  93. </cm:query>
  94. <!-- Model from CM -->
  95. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  96. <cm:search>
  97. <xsl:value-of select="$modelBase"/>
  98. </cm:search>
  99. <cm:properties>
  100. <cm:property name="defaultName"/>
  101. <cm:property name="searchPath"/>
  102. <cm:property name="permissions"/>
  103. <cm:property name="ancestors"/>
  104. </cm:properties>
  105. </cm:query>
  106. </cm:requests>
  107. </cm:query>
  108. </xts:transform>
  109. </send:request>
  110. </xts:transform>
  111. </xts:append>
  112. <xsl:if test="not(/root/env/param[@name='sql_package'])">
  113. <xts:append select="/root/env">
  114. <param name="sql_package"><xsl:value-of select="/root/env/param[@name='packRoot']"/></param>
  115. </xts:append>
  116. </xsl:if>
  117. </xts:sequence>
  118. </xsl:if>
  119. </xsl:template>
  120. </xsl:stylesheet>
  121. </xts:block>
  122. <!-- check whether the model reference we have is the latest.... if not, then warn the user that we have updated
  123. <xsl:when test="/root/env/param[@name='sql_model'][. != '']">
  124. <xsl:value-of select="/root/env/param[@name='sql_model']"/>
  125. </xsl:when>
  126. -->
  127. <xts:block id="checkForModelUpdate" processor="XSLT" type="exec" dependency="getDetails" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup' and /root/env/param[@name='sql_package'] != '']" mandatory="false">
  128. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  129. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  130. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  131. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  132. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  133. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  134. <xsl:template match="/">
  135. <xsl:variable name="latestModel" select="/root/*[local-name()='queryResponse']/cm:queryReply/*[local-name()='model']/*[local-name()='searchPath']"/>
  136. <xsl:variable name="currentModel" select="/root/env/param[@name='sql_model']"/>
  137. <xts:sequence>
  138. <xsl:if test="not($latestModel = $currentModel) and $currentModel != ''">
  139. <xts:append>
  140. <updatedModel/>
  141. </xts:append>
  142. </xsl:if>
  143. <xsl:choose>
  144. <xsl:when test="/root/env/param[@name='sql_model']">
  145. <xts:replace select="/root/env/param[@name='sql_model']">
  146. <param name="sql_model"><xsl:value-of select="$latestModel"/></param>
  147. </xts:replace>
  148. </xsl:when>
  149. <xsl:otherwise>
  150. <xts:append select="/root/env">
  151. <param name="sql_model"><xsl:value-of select="$latestModel"/></param>
  152. </xts:append>
  153. </xsl:otherwise>
  154. </xsl:choose>
  155. </xts:sequence>
  156. </xsl:template>
  157. </xsl:stylesheet>
  158. </xts:block>
  159. <!--
  160. ================================================================================
  161. encode the agent items again
  162. ================================================================================
  163. -->
  164. <xts:block id="buildContext" dependency="checkForModelUpdate" processor="XSLT" type="exec" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState' and /root/env/param[@name='sql_package'] != ''] = 'markup']" mandatory="false">
  165. <xts:logicsheet path="logicsheets/portal.xsl"/>
  166. <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:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl pf cm xts xtsext">
  167. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  168. <pf:serialize-xml/>
  169. <pf:variables/>
  170. <xsl:template match="/">
  171. <xts:sequence>
  172. <xsl:variable name="markup">
  173. <xsl:call-template name="serialize-xml">
  174. <xsl:with-param name="node-set">
  175. <xsl:call-template name="buildContext"/>
  176. </xsl:with-param>
  177. </xsl:call-template>
  178. </xsl:variable>
  179. <xts:append select="/root/env">
  180. <param name="context">
  181. <xsl:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport, '_settemplatename_buildcontext_settemplateid_dialogadapter003'), xtsext:web64encode( string( $markup ), true()))"/>
  182. </param>
  183. </xts:append>
  184. </xts:sequence>
  185. </xsl:template>
  186. <!-- build the context -->
  187. <xsl:template name="buildContext">
  188. <context>
  189. <env>
  190. <!-- the actual path to the report - which is needed in the call to getParameters -->
  191. <xsl:copy-of select="/root/env/param[@name='sql_procedure_name']"/>
  192. <xsl:copy-of select="/root/env/param[@name='taskParameters']"/>
  193. <!-- the pv_ items - which is all the settings for parameters in the UI/drop down/input box -->
  194. <xsl:copy-of select="/root/env/param[starts-with(@name, 'pv_')]"/>
  195. </env>
  196. </context>
  197. </xsl:template>
  198. </xsl:stylesheet>
  199. </xts:block>
  200. <!--
  201. ===============================================================================================
  202. genMarkup
  203. ===============================================================================================
  204. -->
  205. <xts:block id="genMarkup" type="exec" processor="XSLT" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup' or /root/*[local-name()='morphletResponse']]" mandatory="false" dependency="buildContext">
  206. <!-- logicsheets -->
  207. <!-- portal specific information -->
  208. <xts:logicsheet path="logicsheets/portal.xsl"/>
  209. <!-- agent studio logicsheets -->
  210. <xts:logicsheet path="ags/logicsheets/arguments.xslt"/>
  211. <xts:logicsheet path="ags/logicsheets/dialogs.xsl"/>
  212. <!-- Dialog specific logicsheets -->
  213. <xts:logicsheet path="logicsheets/presentation/dialog/ui-templates.xsl"/>
  214. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  215. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  216. <!-- Generic logicsheets -->
  217. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  218. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  219. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  220. <!-- apply the form logic -->
  221. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  222. <!-- Prevent the href from appearing in the status bar. -->
  223. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  224. <xsl:stylesheet version="1.0" xmlns:agsarg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/arguments/" xmlns:req-params="http://developer.cognos.com/schemas/request/params" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agspmt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/promptValues/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" 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: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:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:x="x" exclude-result-prefixes="agsarg xts xsl cm pf xtsext lyt dp df cf cp xos utml agsdlg x">
  225. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  226. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  227. <pf:variables/>
  228. <xsl:variable name="ags_image_root">../ags/images/summary/</xsl:variable>
  229. <!-- These elements will insert the templates needed to generate the displayable object type and icons. -->
  230. <pf:gen-icon/>
  231. <xsl:variable name="back-url" select="key('env-param','ui.backURL')"/>
  232. <xsl:variable name="mname" select="'dialogAdapter.xts'"/>
  233. <xsl:variable name="spacer">
  234. <img height="10" width="10">
  235. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/images/space.gif</xsl:attribute>
  236. </img>
  237. </xsl:variable>
  238. <xsl:variable name="default_package">
  239. <xsl:choose>
  240. <xsl:when test="/root/env/param[@name='sql_package']">
  241. <xsl:value-of select="/root/env/param[@name='sql_package']"/>
  242. </xsl:when>
  243. <xsl:otherwise>
  244. <xsl:value-of select="/root/env/param[@name='packRoot']"/>
  245. </xsl:otherwise>
  246. </xsl:choose>
  247. </xsl:variable>
  248. <xsl:template match="/">
  249. <xts:sequence>
  250. <xts:append select="/root/output">
  251. <xos:part>
  252. <xos:entityHeader>
  253. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  254. </xos:entityHeader>
  255. <xos:entityBody>
  256. <xsl:element name="{key('request-param','resultNode')}" namespace="">
  257. <markup>
  258. <xts:transform name="XMLEncode">
  259. <utml:form name="pform">
  260. <!-- we're taking control of all the all the pv_ params ourselves -->
  261. <utml:exclude-prefix>pv_</utml:exclude-prefix>
  262. <utml:exclusion-list>
  263. <xsl:value-of select="' packRoot cleared_prompts m_obj method cleared_prompts pageitem context m_rp_parameters has_prompts updatedTaskParameters sql_procedure_name '"/>
  264. </utml:exclusion-list>
  265. <!-- need this to be included by default -->
  266. <script type="text/javascript" src="../ags/dragDropHandler.js"/>
  267. <utml:input type="hidden" id="taskParameters" name="taskParameters"/>
  268. <utml:input type="hidden" id="AgentTask-condition" name="AgentTask-condition"/>
  269. <utml:input type="hidden" name="taskName" utml:update="false" id="taskName">
  270. <input type="hidden" name="cleared_prompts" id="cleared_prompts" value="false"/>
  271. <utml:value>
  272. <xsl:choose>
  273. <xsl:when test="key('env-param', 'taskName') and string-length(string(key('env-param', 'taskName'))) > 0">
  274. <xsl:value-of select="key('env-param', 'taskName')"/>
  275. </xsl:when>
  276. <xsl:when test="key('env-param', 'SQL_x_p_report')">
  277. <xsl:value-of select="/root/agentList/*/cm:defaultName"/>
  278. </xsl:when>
  279. </xsl:choose>
  280. </utml:value>
  281. </utml:input>
  282. <agsdlg:header>
  283. <dp:image>
  284. <img alt="" border="0">
  285. <xsl:attribute name="src"><xsl:value-of select="$ags_image_root"/>icon_SQL_writeback_24.gif</xsl:attribute>
  286. </img>
  287. </dp:image>
  288. <dp:title>
  289. <xts:string id="DIALOG_SQL_TITLE"/>
  290. </dp:title>
  291. <dp:description>
  292. <xts:string id="DIALOG_SQL_DESCRIPTION"/>
  293. </dp:description>
  294. </agsdlg:header>
  295. <!-- ================================================================ -->
  296. <!-- B O D Y -->
  297. <!-- ================================================================ -->
  298. <!-- Define a new layout-->
  299. <lyt:layout style="2">
  300. <!-- create a new row, each row includes a spacer -->
  301. <lyt:section>
  302. <dp:list width="100%">
  303. <dp:section>
  304. <dp:label>
  305. <xts:string id="DIALOG_SQL_PACKAGE"/>
  306. </dp:label>
  307. </dp:section>
  308. <dp:section>
  309. <xsl:choose>
  310. <xsl:when test="/root/cm:queryResponse/cm:queryReply/cm:package">
  311. <utml:select name="sql_package" style="width:80%" onchange="reloadPackage();">
  312. <xsl:for-each select="/root/cm:queryResponse/cm:queryReply/cm:package">
  313. <xsl:variable name="has_read_permission" select="contains(concat(' ', ./cm:permissions, ' '), ' read ')"/>
  314. <xsl:if test="$has_read_permission = 'true'">
  315. <utml:option>
  316. <xsl:if test="string(cm:searchPath) = $default_package">
  317. <xsl:attribute name="selected">selected</xsl:attribute>
  318. </xsl:if>
  319. <utml:value>
  320. <xsl:value-of select="./cm:searchPath"/>
  321. </utml:value>
  322. <xsl:variable name="path" select="./cm:searchPath"/>
  323. <xsl:variable name="isPersonalPath" select="starts-with($path, '~') or ( key('session-param', 'e_hp') and starts-with($path, key('session-param', 'e_hp')) )"/>
  324. <xsl:variable name="rootPath">
  325. <xsl:choose>
  326. <xsl:when test="$isPersonalPath">
  327. <xsl:value-of select="concat(key('session-param', 'e_hp'), '/folder')"/>
  328. </xsl:when>
  329. <xsl:when test="starts-with($path, '/content')">
  330. <xsl:value-of select="$defaultContentRoot"/>
  331. </xsl:when>
  332. </xsl:choose>
  333. </xsl:variable>
  334. <cf:do-the-path-link>
  335. <cf:param name="familytree">./cm:ancestors</cf:param>
  336. <cf:param name="familymember">./cm:defaultName</cf:param>
  337. <cf:param name="home">
  338. <xsl:value-of select="$rootPath"/>
  339. </cf:param>
  340. </cf:do-the-path-link>
  341. </utml:option>
  342. </xsl:if>
  343. </xsl:for-each>
  344. </utml:select>
  345. <utml:input name="sql_model" id="sql_model" type="hidden" utml:update="false">
  346. <utml:value>
  347. <xsl:value-of select="/root/*[local-name()='queryResponse']/cm:queryReply/*[local-name()='model']/*[local-name()='searchPath']"/>
  348. </utml:value>
  349. </utml:input>
  350. </xsl:when>
  351. <xsl:otherwise>
  352. <xsl:text>
  353. <xts:string id="DIALOG_MESSAGE_NONE"/>
  354. </xsl:text>
  355. </xsl:otherwise>
  356. </xsl:choose>
  357. </dp:section>
  358. </dp:list>
  359. </lyt:section>
  360. <lyt:section>
  361. <xsl:value-of select="key('request-param','suppressionDetails')" disable-output-escaping="yes"/>
  362. </lyt:section>
  363. </lyt:layout>
  364. <!--sp select drop down and asynch generated arguments list will be here -->
  365. <lyt:layout style="2">
  366. <lyt:section width="100%">
  367. <div id="promptValuesDiv" class="text"/>
  368. </lyt:section>
  369. </lyt:layout>
  370. <dp:emptyFooter/>
  371. <script language="javascript">
  372. var loading= false;
  373. function reloadPackage()
  374. {
  375. if(loading==false)
  376. {
  377. // Reset the proc name.
  378. var sqlProcSel = document.getElementById('sql_procedure_name');
  379. clearSelect(sqlProcSel);
  380. // Reset model so that it is recalculated by the xts.
  381. document.getElementById('sql_model').value="";
  382. document.getElementById('cleared_prompts').value="true";
  383. loading = true;
  384. parent.getConfigFrame().loadPage('ags/dialogAdapter.xts', 'maintain');
  385. }
  386. }
  387. function clearSelect(objSelect){
  388. if(objSelect!=null &amp;&amp; objSelect.options){
  389. objSelect.options.length = 0;
  390. }
  391. }
  392. /*
  393. call the asych code to get the parameters for the stored procedure specification
  394. */
  395. function loadParameters() {
  396. var promptDiv = document.getElementById('promptValuesDiv');
  397. if (promptDiv) {
  398. var imgHTML = '&lt;img src="' + '<xsl:value-of select="xtsext:javascriptencode(string($skin_root))"/>' + '/prompting/images/loading_timed.gif"/&gt;';
  399. // SEC_INFO: loading_string values retrieved from AGS_language.xml messages file from the server
  400. promptDiv.innerHTML = imgHTML + parent.htmlEncode( parent.getConfigFrame().loading_string );
  401. }
  402. var taskId = "<xsl:value-of select="xtsext:javascriptencode(/root/req-params:requestParams/req-params:param[@name='tabSelectedID'])"/>";
  403. var sql_package = document.pform.sql_package.value;
  404. //var sql_model = document.pform.sql_model.value;
  405. var sp_name = '<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='sql_procedure_name'])"/>';
  406. var context = "<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='context'])"/>";
  407. <xsl:choose>
  408. <!-- I removed and contains(., 'read') from this condition. This is
  409. because if you have no read permissions you will not be able to
  410. select the package or see it anyway.
  411. -->
  412. <xsl:when test="not(/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='package'][./*[local-name()='searchPath' and . = /root/env/param[@name='sql_package']]]/*[local-name()='permissions'][contains(., 'execute')])">
  413. var request = parent.getConfigFrame().getGetParametersQfSpecificationRequestString(sql_package, sp_name, context, taskId);
  414. request += "&amp;doSkip=true";
  415. parent.getConfigFrame().startGetParametersRequest(request, parent.getConfigFrame().getGetParametersQfSpecificationRequestString);
  416. </xsl:when>
  417. <xsl:otherwise>
  418. // do the request
  419. parent.getConfigFrame().startGetSpParametersRequest(sql_package, context, sp_name, taskId);
  420. </xsl:otherwise>
  421. </xsl:choose>
  422. }
  423. function reload()
  424. {
  425. document.getElementById('cleared_prompts').value="true";
  426. parent.getConfigFrame().loadPage('ags/dialogAdapter.xts', 'maintain');
  427. }
  428. function init() {
  429. var cf=parent.getConfigFrame?parent.getConfigFrame():null;
  430. <xsl:if test="/root/updatedModel">
  431. var message_string = parent.packageUpdatedMessage1_string + "\n" + parent.sqlPackageUpdatedMessage_string;
  432. alert(message_string);
  433. </xsl:if>
  434. var fault = "<xsl:value-of select="xtsext:javascriptencode(string(/root/soapFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message'][1]/*[local-name()='messageString']))"/>";
  435. <xsl:for-each select="/root/soapFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message']">
  436. cf.pageErrors[<xsl:value-of select="position()"/>-1] = "<xsl:value-of select="xtsext:javascriptencode(string(./*[local-name()='messageString']))"/>";
  437. </xsl:for-each>
  438. var selPackage = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='sql_package']))"/>";
  439. if(fault != "" ){
  440. parent.showErrorPage();
  441. }else if(selPackage.length &lt; 1){
  442. alert("<xts:string id='DIALOG_SQL_PACKAGE_ERROR'/>");
  443. }else {
  444. loadParameters();
  445. }
  446. }
  447. // submit the operation and service name
  448. function leavingDialog(){
  449. if(window.argumentsLeavingDialog){
  450. argumentsLeavingDialog();
  451. }
  452. var list = document.getElementById("sql_procedure_name");
  453. if(null != list &amp;&amp; list.selectedIndex !=-1){
  454. if (window.clipboardData) {
  455. document.getElementById("taskName").value = list.options[list.selectedIndex].text;
  456. }else{
  457. document.getElementById("taskName").value = list.options[list.selectedIndex].textContent;
  458. }
  459. }else{
  460. document.getElementById("taskName").value = '<xts:string id="AGS_SQL_WTASK" encode="javascript"/>' ;
  461. }
  462. }
  463. </script>
  464. <!-- build the scripts needed for prompting -->
  465. <agsarg:argumentsScript/>
  466. </utml:form>
  467. </xts:transform>
  468. </markup>
  469. </xsl:element>
  470. </xos:entityBody>
  471. </xos:part>
  472. </xts:append>
  473. <xts:delete select="/root/env/param[@name='sql_model']" mandatory="false"/>
  474. </xts:sequence>
  475. </xsl:template>
  476. </xsl:stylesheet>
  477. </xts:block>
  478. <!--
  479. ===============================================================================================
  480. debug - special debug block for nested requests
  481. ===============================================================================================
  482. -->
  483. <xts:block id="debug" type="exec" processor="XSLT" mimeType="text/html" dependency="genMarkup" condition=".[/root/session/param[@name='debug']='1']" mandatory="false">
  484. <!-- Get the debug logic sheet -->
  485. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  486. <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">
  487. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  488. <xsl:template match="/">
  489. <dbg:dumpxml select="/root"/>
  490. </xsl:template>
  491. </xsl:stylesheet>
  492. </xts:block>
  493. <xts:block id="faultHandler" type="fault" processor="XSLT">
  494. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
  495. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  496. <xsl:template match="/">
  497. <xsl:choose>
  498. <xsl:when test="contains(//*, 'CAM-AAA-0055')">
  499. <fault>
  500. <passport>timeout</passport>
  501. </fault>
  502. </xsl:when>
  503. <xsl:when test="contains(//*, 'CM-SYS-5027')">
  504. <fault>
  505. <xsl:copy>
  506. <xsl:copy-of select="/root/fault"/>
  507. </xsl:copy>
  508. </fault>
  509. </xsl:when>
  510. <xsl:otherwise>
  511. <soapFault>
  512. <xsl:copy>
  513. <xsl:copy-of select="/root/fault"/>
  514. </xsl:copy>
  515. </soapFault>
  516. </xsl:otherwise>
  517. </xsl:choose>
  518. </xsl:template>
  519. <xsl:template match="text()"/>
  520. </xsl:stylesheet>
  521. </xts:block>
  522. </xts:morphlet>