addJob.xts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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="false" requiredCapability="canUseEventStudio">
  9. <!--
  10. ===============================================================================================
  11. get the information for the agent - we only need the defaultName thought for the time being
  12. ===============================================================================================
  13. -->
  14. <xts:block id="getJob" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'selected_path']!='' and /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup'] " mandatory="false">
  15. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  16. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" exclude-result-prefixes="cm xts send xtsext">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  19. <xsl:template match="/">
  20. <xts:sequence>
  21. <xts:append>
  22. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  23. <send:request provider="cm" requester="AGS:addJob">
  24. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  25. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  26. <search>
  27. <!-- Get the report - we know only it's search path now -->
  28. <xsl:value-of select="/root/env/param[@name = 'selected_path']"/>
  29. </search>
  30. <properties>
  31. <property name="defaultName"/>
  32. <property name="searchPath"/>
  33. </properties>
  34. </query>
  35. </xts:transform>
  36. </send:request>
  37. </xts:transform>
  38. </xts:append>
  39. <xsl:if test="/root/env/param[@name='m_path']">
  40. <xts:append>
  41. <jobPath>
  42. <!--we have to delete m_path to not allow users to save agent in Admiinstrator folder-->
  43. <xsl:attribute name="job_path"><xsl:value-of select="/root/env/param[@name='m_path']"/></xsl:attribute>
  44. <xts:delete select="/root/env/param[@name='m_path']"/>
  45. </jobPath >
  46. </xts:append>
  47. </xsl:if>
  48. </xts:sequence>
  49. </xsl:template>
  50. </xsl:stylesheet>
  51. </xts:block>
  52. <!--
  53. ===============================================================================================
  54. returnResult - We're done with the email options morphlet, so return the appropriate response
  55. ===============================================================================================
  56. -->
  57. <xts:block id="returnResult" path="/ags/tabResultTemplate.xslt" type="exec" processor="XSLT" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished']" mandatory="false">
  58. <xts:logicsheet path="logicsheets/portal.xsl"/>
  59. </xts:block>
  60. <!--
  61. ===============================================================================================
  62. Get report - get the report spec so we can check for parameters
  63. ===============================================================================================
  64. -->
  65. <xts:block id="getContent" dependency="getJob" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'selected_path']!='' and /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup'] " mandatory="false">
  66. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  67. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  68. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  69. <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/">
  70. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  71. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  72. <xsl:template match="/">
  73. <xts:sequence>
  74. <xsl:if test="key('env-param','emailToRunOptions')">
  75. <xts:append>
  76. <xsl:value-of select="xtsext:web64decode( string( key('env-param','emailToRunOptions') ), true() )" disable-output-escaping="yes"/>
  77. </xts:append>
  78. </xsl:if>
  79. <xsl:if test="key('env-param','m_rp_parameters')">
  80. <xts:append>
  81. <xts:transform src="transforms/portal/parameters/group-parameters.xslt" processor="XSLT">
  82. <xsl:value-of select="xtsext:web64decode(string(key('env-param','m_rp_parameters')), true())" disable-output-escaping="yes"/>
  83. </xts:transform>
  84. </xts:append>
  85. </xsl:if>
  86. <xts:append>
  87. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  88. <send:request provider="cm" requester="AGS:addJob">
  89. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  90. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  91. <cm:requests>
  92. <!-- Page definitions -->
  93. <cm:query>
  94. <cm:search>/configuration/pageDefinition</cm:search>
  95. <cm:properties>
  96. <cm:property name="displaySequence"/>
  97. <cm:property name="defaultName"/>
  98. <cm:property name="searchPath"/>
  99. </cm:properties>
  100. <cm:sortBy>
  101. <cm:sort name="displaySequence" order="descending"/>
  102. </cm:sortBy>
  103. </cm:query>
  104. </cm:requests>
  105. </cm:query>
  106. </xts:transform>
  107. </send:request>
  108. </xts:transform>
  109. </xts:append>
  110. </xts:sequence>
  111. <xsl:if test="key('env-param','jobSteps')">
  112. <xts:sequence>
  113. <xts:append>
  114. <!-- unpack the job steps -->
  115. <xsl:value-of select="xtsext:web64decode( string( key('env-param','jobSteps') ), true() )" disable-output-escaping="yes"/>
  116. </xts:append>
  117. </xts:sequence>
  118. </xsl:if>
  119. </xsl:template>
  120. </xsl:stylesheet>
  121. </xts:block>
  122. <!--
  123. ===============================================================================================
  124. genMarkup -
  125. ===============================================================================================
  126. -->
  127. <xts:block id="genMarkup" type="exec" processor="XSLT" dependency="getContent" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup' or /root/*[local-name()='morphletResponse']]" mandatory="false">
  128. <!-- logicsheets -->
  129. <!-- portal specific information -->
  130. <xts:logicsheet path="logicsheets/portal.xsl"/>
  131. <!-- agent studio logicsheets -->
  132. <xts:logicsheet path="ags/logicsheets/dialogs.xsl"/>
  133. <!-- Dialog specific logicsheets -->
  134. <xts:logicsheet path="logicsheets/presentation/dialog/ui-templates.xsl"/>
  135. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  136. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  137. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  138. <!-- Generic logicsheets -->
  139. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  140. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  141. <!-- apply the form logic -->
  142. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  143. <!-- Prevent the href from appearing in the status bar. -->
  144. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  145. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" 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:xts="http://developer.cognos.com/schemas/xts/" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" exclude-result-prefixes="xts xsl cm pf xtsext lyt dp df cf cp xos utml agsdlg">
  146. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  147. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  148. <pf:variables/>
  149. <xsl:variable name="ags_image_root">../ags/images/summary/</xsl:variable>
  150. <xsl:variable name="jobDefinition" select="true()"/>
  151. <xsl:variable name="spacer">
  152. <img height="10" width="10">
  153. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/images/space.gif</xsl:attribute>
  154. </img>
  155. </xsl:variable>
  156. <!-- SEC_INFO hasTask is not javascript encoded, it is always a boolean value true|false-->
  157. <xsl:variable name="hasTask">
  158. <xsl:choose>
  159. <xsl:when test="key('env-param','selected_path') != ''"><xsl:text>true</xsl:text></xsl:when>
  160. <xsl:otherwise><xsl:text>false</xsl:text></xsl:otherwise>
  161. </xsl:choose>
  162. </xsl:variable>
  163. <xsl:template match="/">
  164. <xts:sequence>
  165. <xts:append select="/root/output">
  166. <xos:part>
  167. <xos:entityHeader>
  168. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  169. </xos:entityHeader>
  170. <xos:entityBody>
  171. <xsl:element name="{key('request-param','resultNode')}" namespace="">
  172. <markup>
  173. <xts:transform name="XMLEncode">
  174. <utml:form name="pform">
  175. <utml:exclusion-list><xsl:value-of select="' pageitem '"/></utml:exclusion-list>
  176. <agsdlg:header>
  177. <dp:image>
  178. <img alt="" border="0">
  179. <xsl:attribute name="src"><xsl:value-of select="$ags_image_root"/>icon_job_24.gif</xsl:attribute>
  180. </img>
  181. </dp:image>
  182. <dp:title>
  183. <xts:string id="DIALOG_JOB_TITLE"/>
  184. </dp:title>
  185. <dp:description>
  186. <xts:string id="DIALOG_JOB_DESCRIPTION"/>
  187. </dp:description>
  188. </agsdlg:header>
  189. <utml:input type="hidden" name="report_visited" id="report_visited" value="true"/>
  190. <utml:input type="hidden" name="taskName" id="taskName" utml:update="false">
  191. <utml:value>
  192. <xsl:choose>
  193. <xsl:when test="$hasTask='true' and /root/cm:queryResponse/cm:jobDefinition/cm:defaultName != '' ">
  194. <xsl:value-of select="/root/cm:queryResponse/cm:jobDefinition/cm:defaultName"/>
  195. </xsl:when>
  196. <xsl:when test="key('env-param', 'taskName') and string-length(string(key('env-param', 'taskName'))) > 0">
  197. <xsl:value-of select="key('env-param', 'taskName')"/>
  198. </xsl:when>
  199. </xsl:choose>
  200. </utml:value>
  201. </utml:input>
  202. <!-- ================================================================ -->
  203. <!-- B O D Y -->
  204. <!-- ================================================================ -->
  205. <!-- Define a new layout-->
  206. <lyt:layout style="2">
  207. <!-- create a new row, each row includes a spacer -->
  208. <lyt:section>
  209. <dp:textarea section3_align="left">
  210. <!-- the job name label-->
  211. <dp:section1>
  212. <xts:string id="DIALOG_JOB_LABEL"/>
  213. </dp:section1>
  214. <!-- the job name input-->
  215. <dp:section2>
  216. <xsl:choose>
  217. <xsl:when test="$hasTask='true' and /root/cm:queryResponse/cm:jobDefinition/cm:defaultName != '' ">
  218. <xsl:copy-of select="$spacer"/>
  219. <xsl:value-of select="/root/cm:queryResponse/cm:jobDefinition/cm:defaultName"/>
  220. </xsl:when>
  221. <xsl:otherwise>
  222. <xts:string id="DIALOG_MESSAGE_NONE"/>
  223. </xsl:otherwise>
  224. </xsl:choose>
  225. </dp:section2>
  226. <dp:section3>
  227. <a href="#" onclick="doSelectObject('jobs.es', '{xtsext:javascriptencode(/root/env/param[@name = 'selected_path'])}')">
  228. <xts:string id="SELECT_AN_JOB"/>
  229. </a>
  230. </dp:section3>
  231. </dp:textarea>
  232. </lyt:section>
  233. <lyt:section>
  234. <xsl:value-of select="key('request-param','suppressionDetails')" disable-output-escaping="yes"/>
  235. </lyt:section>
  236. </lyt:layout>
  237. <dp:emptyFooter/>
  238. <script type="text/javascript">
  239. function init() {
  240. <xsl:if test="/root/env/param[@name='selected_path']">
  241. parent.getConfigFrame().cfgSet("so.defaultLocation", "<xsl:value-of select="xtsext:javascriptencode(/root/env/param[@name='selected_path'])"/>/..");
  242. </xsl:if>
  243. <xsl:if test="not(/root/env/param[@name='report_visited'])">
  244. <xsl:if test="not(/root/env/param[@name='selected_path'])">
  245. doSelectObject('jobs.es')
  246. </xsl:if>
  247. </xsl:if>
  248. }
  249. /*
  250. * validate the report page and popup an appropriate alert message
  251. */
  252. function validate() {
  253. var hasTask = <xsl:value-of select="string($hasTask)"/>;
  254. var isValid = true;
  255. if (hasTask==false) {
  256. isValid = false;
  257. alert(&quot;<xts:string id="DIALOG_JOB_NO_JOB_NAME" encode="javascript"/>&quot;);
  258. }
  259. return isValid;
  260. }
  261. </script>
  262. </utml:form>
  263. </xts:transform>
  264. </markup>
  265. </xsl:element>
  266. </xos:entityBody>
  267. </xos:part>
  268. </xts:append>
  269. </xts:sequence>
  270. </xsl:template>
  271. </xsl:stylesheet>
  272. </xts:block>
  273. <!--
  274. ===============================================================================================
  275. debug - special debug block for nested requests
  276. ===============================================================================================
  277. -->
  278. <xts:block id="debug" type="exec" processor="XSLT" mimeType="text/html" dependency="genMarkup" condition=".[/root/session/param[@name='debug']='1']" mandatory="false">
  279. <!-- Get the debug logic sheet -->
  280. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  281. <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">
  282. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  283. <xsl:template match="/">
  284. <dbg:dumpxml select="/root"/>
  285. </xsl:template>
  286. </xsl:stylesheet>
  287. </xts:block>
  288. </xts:morphlet>