arguments.xslt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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, 2018
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsarg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/arguments/" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:out="dummy-uri" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" 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/"
  9. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  10. xmlns:ags="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/ags/"
  11. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:agsad="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agentDefinition/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" xmlns:req-params="http://developer.cognos.com/schemas/request/params" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="agsarg xtscm xsi cf bus pf xtsext lyt dp df cp cm agsad utml agsdlg req-params xts xos ags">
  12. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  13. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  14. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  15. <!--pf:variables/>
  16. <pf:serialize-xml/-->
  17. <!-- start the output -->
  18. <xsl:template match="agsarg:arguments">
  19. <xsl:variable name="colheader1">
  20. <xsl:choose>
  21. <xsl:when test="./displayedPage = 'sql'">20%</xsl:when>
  22. <xsl:otherwise>25%</xsl:otherwise>
  23. </xsl:choose>
  24. </xsl:variable>
  25. <xsl:variable name="colheader2">
  26. <xsl:choose>
  27. <xsl:when test="./displayedPage = 'sql'">10%</xsl:when>
  28. <xsl:otherwise>15%</xsl:otherwise>
  29. </xsl:choose>
  30. </xsl:variable>
  31. <xsl:variable name="colheader3">
  32. <xsl:choose>
  33. <xsl:when test="./displayedPage = 'sql'">15%</xsl:when>
  34. <xsl:otherwise>20%</xsl:otherwise>
  35. </xsl:choose>
  36. </xsl:variable>
  37. <xsl:variable name="colheader4">
  38. <xsl:choose>
  39. <xsl:when test="./displayedPage = 'sql'">35%</xsl:when>
  40. <xsl:otherwise>40%</xsl:otherwise>
  41. </xsl:choose>
  42. </xsl:variable>
  43. <dp:list width="100%" section3_align="right">
  44. <dp:section width="100%">
  45. <dp:label>
  46. <xts:string id="DIALOG_SQL_BODY_LABEL"/>
  47. </dp:label>
  48. <dp:text align="right">
  49. <out:if test="count(/root/parametersDisplay/parameter)>0">
  50. <xts:string align="right" id="IDS_ENTRIES"/>1 - <out:value-of select="count(/root/parametersDisplay/parameter)"/>
  51. </out:if>
  52. </dp:text>
  53. </dp:section>
  54. </dp:list>
  55. <!-- taskParameters is stored in here too but as an updated mirror of taskParameters
  56. this is because we must capture them in the parent page and update them here
  57. so that if you move off the page quickly..... you dont loose the saved task parameter values-->
  58. <input type="hidden" id="updatedTaskParameters" name="updatedTaskParameters">
  59. <out:attribute name="value">
  60. <out:value-of select="/root/env/param[@name='taskParameters']"/>
  61. </out:attribute>
  62. </input>
  63. <cp:table name="parameterTable" width="100%" showEmptyMsg="true" iterate="/root/parametersDisplay/parameter">
  64. <cp:tableHeader>
  65. <cp:columnHeader width="1%"/>
  66. <cp:columnHeader width="{$colheader1}">
  67. <xts:string id="DIALOG_SQL_ARG_NAME"/>
  68. </cp:columnHeader>
  69. <cp:columnHeader width="{$colheader2}">
  70. <xts:string id="DIALOG_SQL_ARG_TYPE"/>
  71. </cp:columnHeader>
  72. <xsl:if test="./displayedPage = 'sql'">
  73. <cp:columnHeader width="20%">
  74. <xts:string id="DIALOG_SQL_ARG_FORMAT"/>
  75. </cp:columnHeader>
  76. </xsl:if>
  77. <cp:columnHeader width="{$colheader3}">
  78. <xts:string id="DIALOG_SQL_ARG_METHOD"/>
  79. </cp:columnHeader>
  80. <cp:columnHeader width="{$colheader4}">
  81. <xts:string id="DIALOG_SQL_ARG_VALUE"/>
  82. </cp:columnHeader>
  83. </cp:tableHeader>
  84. <cp:tableContent style="linedRows">
  85. <cp:common-render-variables>
  86. <out:variable name="quote">'</out:variable>
  87. <out:variable name="paramName">
  88. <out:choose>
  89. <out:when test="contains(@value, '?')">
  90. <out:value-of select="substring-before(substring-after(@value, '?'),'?')"/>
  91. </out:when>
  92. <out:otherwise>
  93. <out:value-of select="@name"/>
  94. </out:otherwise>
  95. </out:choose>
  96. </out:variable>
  97. <out:variable name="drop_zone_name" select="concat('pv_dz_', $paramName, '_pv_dz')"/>
  98. <out:variable name="ndrop_zone_name" select="concat('pv_ndz_', $paramName, '_pv_ndz')"/>
  99. <out:variable name="selectionName" select="concat('pv_cb_',$paramName,'_pv_cb')"/>
  100. <out:variable name="literalDiv" select="concat('literalDiv', position())"/>
  101. <out:variable name="modelDiv" select="concat('modelDiv', position())"/>
  102. <out:variable name="selection">
  103. <out:choose>
  104. <!-- If both are there then model takes over.-->
  105. <out:when test="@modelValue">
  106. <modelSelected>selected</modelSelected>
  107. <displayLiteral>display:none;</displayLiteral>
  108. <displayModel>display:block;</displayModel>
  109. </out:when>
  110. <out:otherwise>
  111. <literalSelected>selected</literalSelected>
  112. <displayModel>display:none;</displayModel>
  113. <displayLiteral>display:block;</displayLiteral>
  114. </out:otherwise>
  115. </out:choose>
  116. <!--item><out:value-of select="/root/env/param[@name=$drop_zone_name]"/></item>
  117. <literal><out:value-of select="/root/env/param[@name=$ndrop_zone_name]"/></literal-->
  118. <item>
  119. <out:value-of select="@modelValue"/>
  120. </item>
  121. <literal>
  122. <out:choose>
  123. <out:when test="./displayedPage = 'sql' and @sqlCredentialValue != ''">
  124. <out:value-of select="@sqlCredentialValue"/>
  125. </out:when>
  126. <out:otherwise>
  127. <out:value-of select="@literalValue"/>
  128. </out:otherwise>
  129. </out:choose>
  130. </literal>
  131. </out:variable>
  132. </cp:common-render-variables>
  133. <out:choose>
  134. <out:when test="/root/displayedPage = 'web' and @simplejavatype = 'false'">
  135. <!--cp:columnContent>
  136. <out:value-of select="@caption"/>
  137. </cp:columnContent>
  138. <cp:columnContent/>
  139. <cp:columnContent/>
  140. <cp:columnContent/>
  141. <cp:columnContent/-->
  142. <xsl:call-template name="doParameter"/>
  143. </out:when>
  144. <out:otherwise>
  145. <cp:columnContent/>
  146. <cp:columnContent>
  147. <out:value-of select="@name"/>
  148. </cp:columnContent>
  149. <cp:columnContent>
  150. <out:value-of select="@type"/>
  151. </cp:columnContent>
  152. <xsl:if test="./displayedPage = 'sql'">
  153. <cp:columnContent>
  154. <out:value-of select="@format"/>
  155. </cp:columnContent>
  156. </xsl:if>
  157. <cp:columnContent>
  158. <select name="{'{$selectionName}'}" id="{'{$selectionName}'}" onchange="toggleDiv({'{position() - 1}'})">
  159. <out:if test="@disabled='true'">
  160. <out:attribute name="disabled">
  161. <out:value-of select="@disabled"/>
  162. </out:attribute>
  163. </out:if>
  164. <option value="1">
  165. <!-- select this option is the value of the select is the value of the option -->
  166. <out:if test="$selection/modelSelected">
  167. <out:attribute name="{'{$selection/modelSelected}'}"/>
  168. </out:if>
  169. <xts:string id="DIALOG_PARAMETER_USE_ITEM"/>
  170. </option>
  171. <option value="2">
  172. <out:if test="$selection/literalSelected">
  173. <out:attribute name="{'{$selection/literalSelected}'}"/>
  174. </out:if>
  175. <xts:string id="DIALOG_PARAMETER_USE_VALUE"/>
  176. </option>
  177. </select>
  178. <img height="15" width="5" border="0" src="{'{$webcontent}'}/images/space.gif"/>
  179. </cp:columnContent>
  180. <cp:columnContent>
  181. <div id="{'{$literalDiv}'}" name="{'{$literalDiv}'}" style="{'{$selection/displayLiteral}'}">
  182. <input type="text" id="{{$ndrop_zone_name}}" name="{{$ndrop_zone_name}}" onblur="validateType('{{@type}}', this.value)" value="{'{$selection/literal}'}">
  183. <out:if test="@disabled='true'">
  184. <out:attribute name="disabled">
  185. <out:value-of select="@disabled"/>
  186. </out:attribute>
  187. </out:if>
  188. </input>
  189. </div>
  190. <div id="{'{$modelDiv}'}" name="{'{$modelDiv}'}" style="{'{$selection/displayModel}'}">
  191. <agsdlg:insertButton targetId="{'{$drop_zone_name}'}" value="{'{@modelValue}'}">
  192. <input type="text" width="80%" oncontextmenu="event.cancelBubble=true;event.returnValue=false;return false;" closePrevious="true" onKeyPress="event.cancelBubble=true;event.returnValue=false;return false;" onblur="event.cancelBubble=true;event.returnValue=false;return false;" onkeydown="event.cancelBubble=true;event.returnValue=false;return false;" name="{'{$drop_zone_name}'}" id="{'{$drop_zone_name}'}" value="{'{$selection/item}'}">
  193. <out:if test="@disabled='true'">
  194. <out:attribute name="disabled">
  195. <out:value-of select="@disabled"/>
  196. </out:attribute>
  197. </out:if>
  198. </input>
  199. </agsdlg:insertButton>
  200. </div>
  201. </cp:columnContent>
  202. </out:otherwise>
  203. </out:choose>
  204. </cp:tableContent>
  205. </cp:table>
  206. </xsl:template>
  207. <!-- kkm -->
  208. <xsl:template name="doParameter">
  209. <!--td> <out:value-of select="@caption"/> </td-->
  210. <!--div>
  211. <table><tr><td>
  212. hello
  213. </td></tr></table>
  214. </div-->
  215. <tr>
  216. <td><img id="{'{@name}'}_button" height="9" width="9" border="0" src="../ags/images/expand_minus.gif" onclick="hideComplex('{'{@name}'}')"/></td>
  217. <td/>
  218. <td height="10" class="tableText" nowrap="true" ><out:value-of select="@caption"/></td></tr>
  219. <tr>
  220. <td/>
  221. <td colspan="8">
  222. <div id="{'{@name}'}_id" style="width:auto;display:inline">
  223. <cp:table name="subParameterTable" width="100%" showEmptyMsg="true" iterate="./parameter">
  224. <cp:tableHeader>
  225. <!--cp:columnHeader width="20%">
  226. <out:value-of select="@caption"/>
  227. </cp:columnHeader-->
  228. <!--cp:columnHeader width="20%">
  229. <xts:string id="DIALOG_SQL_ARG_TYPE"/>
  230. </cp:columnHeader>
  231. <xsl:if test="/root/displayedPage = 'sql'">
  232. <cp:columnHeader width="20%">
  233. <xts:string id="DIALOG_SQL_ARG_FORMAT"/>
  234. </cp:columnHeader>
  235. </xsl:if>
  236. <cp:columnHeader width="20%">
  237. <xts:string id="DIALOG_SQL_ARG_METHOD"/>
  238. </cp:columnHeader>
  239. <cp:columnHeader width="20%">
  240. <xts:string id="DIALOG_SQL_ARG_VALUE"/>
  241. </cp:columnHeader-->
  242. </cp:tableHeader>
  243. <cp:tableContent>
  244. <cp:common-render-variables>
  245. <out:variable name="quote1">'</out:variable>
  246. <out:variable name="paramName1">
  247. <out:choose>
  248. <out:when test="contains(@value, '?')">
  249. <out:value-of select="substring-before(substring-after(@value, '?'),'?')"/>
  250. </out:when>
  251. <out:otherwise>
  252. <out:value-of select="@name"/>
  253. </out:otherwise>
  254. </out:choose>
  255. </out:variable>
  256. <out:variable name="drop_zone_name1" select="concat('pv_dz_', $paramName,'/',$paramName1, '_pv_dz')"/>
  257. <out:variable name="ndrop_zone_name1" select="concat('pv_ndz_', $paramName,'/', $paramName1, '_pv_ndz')"/>
  258. <out:variable name="selectionName1" select="concat('pv_cb_', $paramName,'/', $paramName1,'_pv_cb')"/>
  259. <out:variable name="literalDiv1" select="concat('literalDiv', position())"/>
  260. <out:variable name="modelDiv1" select="concat('modelDiv', position())"/>
  261. <out:variable name="selection1">
  262. <out:choose>
  263. <!-- If both are there then model takes over.-->
  264. <out:when test="@modelValue">
  265. <modelSelected>selected</modelSelected>
  266. <displayLiteral>display:none;</displayLiteral>
  267. <displayModel>display:block;</displayModel>
  268. </out:when>
  269. <out:otherwise>
  270. <literalSelected>selected</literalSelected>
  271. <displayModel>display:none;</displayModel>
  272. <displayLiteral>display:block;</displayLiteral>
  273. </out:otherwise>
  274. </out:choose>
  275. <!--item><out:value-of select="/root/env/param[@name=$drop_zone_name]"/></item>
  276. <literal><out:value-of select="/root/env/param[@name=$ndrop_zone_name]"/></literal-->
  277. <item>
  278. <out:value-of select="@modelValue"/>
  279. </item>
  280. <literal>
  281. <out:choose>
  282. <out:when test="/root/displayedPage = 'sql' and @sqlCredentialValue != ''">
  283. <out:value-of select="@sqlCredentialValue"/>
  284. </out:when>
  285. <out:otherwise>
  286. <out:value-of select="@literalValue"/>
  287. </out:otherwise>
  288. </out:choose>
  289. </literal>
  290. </out:variable>
  291. </cp:common-render-variables>
  292. <cp:columnContent width="25%">
  293. <out:value-of select="@name"/>
  294. </cp:columnContent>
  295. <cp:columnContent width="14%">
  296. <out:value-of select="@type"/>
  297. </cp:columnContent>
  298. <xsl:if test="/root/displayedPage = 'sql'">
  299. <cp:columnContent>
  300. <out:value-of select="@format"/>
  301. </cp:columnContent>
  302. </xsl:if>
  303. <cp:columnContent width="20%">
  304. <select name="{'{$selectionName1}'}" id="{'{$selectionName1}'}" onchange="toggleDiv({'{position() - 1}'})">
  305. <out:if test="@disabled='true'">
  306. <out:attribute name="disabled">
  307. <out:value-of select="@disabled"/>
  308. </out:attribute>
  309. </out:if>
  310. <option value="1">
  311. <!-- select this option is the value of the select is the value of the option -->
  312. <out:if test="$selection1/modelSelected">
  313. <out:attribute name="{'{$selection1/modelSelected}'}"/>
  314. </out:if>
  315. <xts:string id="DIALOG_PARAMETER_USE_ITEM"/>
  316. </option>
  317. <option value="2">
  318. <out:if test="$selection1/literalSelected">
  319. <out:attribute name="{'{$selection/literalSelected}'}"/>
  320. </out:if>
  321. <xts:string id="DIALOG_PARAMETER_USE_VALUE"/>
  322. </option>
  323. </select>
  324. <img height="15" width="5" border="0" src="{'{$webcontent}'}/images/space.gif"/>
  325. </cp:columnContent>
  326. <cp:columnContent>
  327. <div id="{'{$literalDiv1}'}" name="{'{$literalDiv1}'}" style="{'{$selection1/displayLiteral}'}">
  328. <input type="text" id="{{$ndrop_zone_name1}}" name="{{$ndrop_zone_name1}}" onblur="validateType('{{@type}}', this.value)" value="{'{$selection1/literal}'}">
  329. <out:if test="@disabled='true'">
  330. <out:attribute name="disabled">
  331. <out:value-of select="@disabled"/>
  332. </out:attribute>
  333. </out:if>
  334. </input>
  335. </div>
  336. <div id="{'{$modelDiv1}'}" name="{'{$modelDiv1}'}" style="{'{$selection1/displayModel}'}">
  337. <agsdlg:insertButton targetId="{'{drop_zone_name1}'}" value="{'{@modelValue}'}">
  338. <input type="text" width="80%" oncontextmenu="event.cancelBubble=true;event.returnValue=false;return false;" closePrevious="true" onKeyPress="event.cancelBubble=true;event.returnValue=false;return false;" onblur="event.cancelBubble=true;event.returnValue=false;return false;" onkeydown="event.cancelBubble=true;event.returnValue=false;return false;" id="{'{$drop_zone_name1}'}" name="{'{$drop_zone_name1}'}" value="{'{$selection1/item}'}">
  339. <out:if test="@disabled='true'">
  340. <out:attribute name="disabled">
  341. <out:value-of select="@disabled"/>
  342. </out:attribute>
  343. </out:if>
  344. </input>
  345. </agsdlg:insertButton>
  346. </div>
  347. </cp:columnContent>
  348. </cp:tableContent>
  349. </cp:table>
  350. </div>
  351. </td></tr>
  352. </xsl:template>
  353. <xsl:template match="agsarg:argumentsScript">
  354. <script type="text/javascript" src="{'{$webcontent}/{$app}/js/utilities.js'}"/>
  355. <script type="text/javascript" src="../ags/dragDropHandler.js"/>
  356. <script type="text/javascript">
  357. var literal_v_model = new Array();
  358. function hideComplex(divId){
  359. var theDiv = document.getElementById(divId+'_id');
  360. var theButton = document.getElementById(divId+'_button');
  361. theDiv.setAttribute("style", "z-index:100");
  362. if(theDiv.style.display == "none")
  363. {
  364. theDiv.style.display = "inline"
  365. theButton.src="../ags/images/expand_minus.gif";
  366. }else{
  367. // theDiv.style.display='hidden';
  368. theDiv.style.display = "none";
  369. theButton.src="../ags/images/expand_plus.gif";
  370. }
  371. }
  372. function initPromptPage(parameterArray)
  373. {
  374. <out:choose>
  375. <out:when test="/root/parametersDisplay/parameter">
  376. <out:for-each select="/root/parametersDisplay/parameter">
  377. <out:variable name="param_namekk">
  378. <out:choose>
  379. <out:when test="contains(@value, '?')">
  380. <out:value-of select="substring-before(substring-after(@value, '?'),'?')"/>
  381. </out:when>
  382. <out:otherwise>
  383. <out:value-of select="@name"/>
  384. </out:otherwise>
  385. </out:choose>
  386. </out:variable>
  387. <out:choose>
  388. <out:when test="@simplejavatype = 'false' and not($param_namekk='parameters')">
  389. <out:for-each select="./parameter">
  390. <out:variable name="param_name1">
  391. <out:value-of select="concat($param_namekk,'/',@name)"/>
  392. </out:variable>
  393. literal_v_model.push(new LiteralModelManager('<out:value-of select="xtsext:javascriptencode(string($param_name1))"/>', '<out:value-of select="position()"/>'));
  394. </out:for-each>
  395. </out:when>
  396. <out:otherwise>
  397. <out:variable name="param_name">
  398. <out:choose>
  399. <out:when test="contains(@value, '?')">
  400. <out:value-of select="substring-before(substring-after(@value, '?'),'?')"/>
  401. </out:when>
  402. <out:otherwise>
  403. <out:value-of select="@name"/>
  404. </out:otherwise>
  405. </out:choose>
  406. </out:variable>
  407. literal_v_model.push(new LiteralModelManager('<out:value-of select="xtsext:javascriptencode(string($param_name))"/>', '<out:value-of select="position()"/>'));
  408. </out:otherwise>
  409. </out:choose>
  410. </out:for-each>
  411. </out:when>
  412. <out:otherwise>
  413. for(var i = 0; parameterArray!=null &amp;&amp; i &lt; parameterArray.length; i++){
  414. literal_v_model.push(new LiteralModelManager(parameterArray[i].sqlValue, i + 1));
  415. }
  416. </out:otherwise>
  417. </out:choose>
  418. var dropZones = new Array();
  419. var dropZone;
  420. for(var i = 0; i &lt; literal_v_model.length; i++){
  421. dropZone = new DropZone(literal_v_model[i].getDropZoneName(),"","",'true',"<out:value-of select="/root/req-params:requestParams/req-params:param[@name='tabSelectedID']"/>",true);
  422. droppy.registerDropZoneObject(dropZone);
  423. dropZones.push(dropZone);
  424. // define a function which is going to handle the data from the drop
  425. //droppy.registerPreEventHandler(literal_v_model[i].getDropZoneName(),"ondrop", clearBeforeDrop);
  426. //droppy.registerPreEventHandler(literal_v_model[i].getDropZoneName(),"ondrop", checkBeforeDrop);
  427. }
  428. //pass the group to a listener in case number of members dynamically changes
  429. //droppy.registerDropZoneGroup(dropZones, "{key('request-param','resultNode')}");
  430. droppy.registerDropZoneGroup(dropZones, "<out:value-of select="/root/req-params:requestParams/req-params:param[@name='tabSelectedID']"/>");
  431. }
  432. /*
  433. // only the last item dropped visible but previous selections left in the agent tree
  434. function clearBeforeDrop()
  435. {
  436. //the id is a global generated by the drag drop handler before this method is called
  437. //and is the correct id for whatever dropzone is being used
  438. droppy.setDropZoneValue("");
  439. }
  440. */
  441. /* This is to validate the type that is passed to the storeprocedure
  442. as the validation has not been turned on from server side. his method should
  443. be ignored once the validation has been turned */
  444. function validateType(type, value) {
  445. <out:variable name="wrongSqlDataType">
  446. <xts:string id="DIALOG_SQL_WRONG_SQL_TYPE"/>
  447. </out:variable>
  448. if(value){
  449. if(type == 'int32' || type == 'int') {
  450. var intValue = parseInt(value);
  451. if(isNaN(intValue)) {
  452. alert('<out:value-of select="xtsext:javascriptencode(string($wrongSqlDataType))"/>');
  453. this.focus();
  454. }
  455. }
  456. else if (type == 'float64' || type == 'float32') {
  457. var floatValue = parseFloat(value);
  458. if( isNaN(floatValue)) {
  459. alert('<out:value-of select="xtsext:javascriptencode(string($wrongSqlDataType))"/>');
  460. this.focus();
  461. }
  462. }
  463. /*else if (type =='dateTime' || type =='datetime') {
  464. // we should leave date validation to the server components
  465. var date = new Date(value);
  466. if( isNaN(date)){
  467. alert('<out:value-of select="xtsext:javascriptencode(string($wrongSqlDataType))"/>');
  468. this.focus();
  469. }
  470. }*/
  471. }
  472. }
  473. /*
  474. this is called afetr the asynch get parameters html is injected into the waiting div
  475. the asynch getParametersResponse has an updated value for taskParameters that must
  476. be used to change the original value that is stored in the parent page.
  477. */
  478. function initInjectedHtml(){
  479. var cf = parent.getConfigFrame();
  480. cf.showDialogFrame(0);
  481. if(document.pform.updatedTaskParameters){
  482. var tps = document.getElementById('taskParameters');
  483. var utps = document.getElementById('updatedTaskParameters');
  484. //update the real task parameters
  485. if (tps &amp;&amp; utps) {
  486. tps.value = utps.value;
  487. utps.parentNode.removeChild(utps);
  488. }
  489. //update the event handlers
  490. cf.attachHandlers(document.forms);
  491. }
  492. }
  493. function validatePromptPage()
  494. {
  495. return true;
  496. }
  497. function toggleDiv(position)
  498. {
  499. literal_v_model[position].toggleDiv();
  500. }
  501. function argumentsLeavingDialog(){
  502. //clean up literal values lurking behind a model item
  503. for(var i = 0; i &lt; literal_v_model.length; i++){
  504. literal_v_model[i].clearUpOldLiterals();
  505. }
  506. }
  507. function LiteralModelManager(param_name, position){
  508. this.param_name = param_name;
  509. this.position = position;
  510. }
  511. LiteralModelManager.prototype.getDropZoneName = function(){
  512. return 'pv_dz_' + this.param_name + '_pv_dz';
  513. }
  514. LiteralModelManager.prototype.getDropZoneDivName = function(){
  515. return 'modelDiv' + this.position;
  516. }
  517. LiteralModelManager.prototype.getLiteralInputDivName = function(){
  518. return 'literalDiv' + this.position;
  519. }
  520. LiteralModelManager.prototype.getLiteralInputName = function(){
  521. return 'pv_ndz_' + this.param_name + '_pv_ndz';
  522. }
  523. LiteralModelManager.prototype.getSelectionName = function(){
  524. return 'pv_cb_' + this.param_name + '_pv_cb';
  525. }
  526. LiteralModelManager.prototype.toggleDiv = function()
  527. {
  528. var displayName;
  529. var hideName;
  530. if(document.getElementById(this.getDropZoneDivName()).style.display == 'none')
  531. {
  532. displayName = this.getDropZoneDivName();
  533. hideName = this.getLiteralInputDivName();
  534. }
  535. else
  536. {
  537. displayName = this.getLiteralInputDivName();
  538. hideName = this.getDropZoneDivName();
  539. //model item div is being hidden, clear it
  540. droppy.setDropZoneValue("",this.getDropZoneName());
  541. }
  542. document.getElementById(displayName).style.display='block';
  543. document.getElementById(hideName).style.display='none';
  544. }
  545. LiteralModelManager.prototype.clearUpOldLiterals = function(){
  546. var literal_input = document.getElementById(this.getLiteralInputName());
  547. var literal_div = document.getElementById(this.getLiteralInputDivName());
  548. if(literal_div &amp;&amp; literal_input){
  549. if(literal_div.style.display == 'none'){
  550. //its hidden... clear it
  551. literal_input.value = "";
  552. }
  553. }else{
  554. //alert("cant find " + this.getLiteralInputName() + " or " + this.getLiteralInputDivName());
  555. }
  556. }
  557. </script>
  558. </xsl:template>
  559. <!--
  560. * - This next template is required to copy all other elements into the result.
  561. -->
  562. <xsl:template match="*">
  563. <xsl:copy>
  564. <xsl:copy-of select="@*"/>
  565. <xsl:apply-templates/>
  566. </xsl:copy>
  567. </xsl:template>
  568. </xsl:stylesheet>