set_priority.xts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2012
  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/cogadminuimsgs.xml" resolverBase="cogadmin" requiredCapability="canUseSchedulingPriority">
  13. <!--
  14. clickedOk to update schedules - executed once the user hit the OK button on the Set the priority popup dialog to update the schedules
  15. -->
  16. <xts:block id="frag_init" nodelist="env, credential" type="exec" mode="interpret" processor="XSLT" path="cogadmin/logicsheets/fragment_init.xslt" condition=".[not(/root/env/param[@name='frag-directive']='meta-only')]" mandatory="true"/>
  17. <xts:block id="clickedOkUpdateSchedules" dependency="frag_init" type="exec" nodelist="env, header, user, system" processor="XSLT" mandatory="false" condition=".[/root/env/param[@name='userClickedOk']='true' and /root/env/param[@name='setPriorityMode']='updateSchedules']">
  18. <xts:logicsheet path="/cogadmin/logicsheets/presentation/common.xslt"/>
  19. <xts:logicsheet path="/cogadmin/logicsheets/buslogic.xslt"/>
  20. <xsl:stylesheet version="1.0"
  21. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  23. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  24. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  25. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  26. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  27. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  28. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  29. xmlns:es="http://developer.cognos.com/schemas/eventManagementService/1"
  30. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  33. exclude-result-prefixes="xsl ui SOAP-ENC SOAP-ENV xos send xsd cm es xtsext xsi uic">
  34. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  35. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  36. <xsl:template match="/">
  37. <!-- update the schedules with the selected priority (from Schedules) -->
  38. <xts:sequence>
  39. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  40. <send:request provider="cm">
  41. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  42. <cm:update>
  43. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  44. <xsl:for-each select="/root/env/param[contains(@name, '_checkbox_')]">
  45. <cm:schedule>
  46. <cm:searchPath>
  47. <xsl:value-of select="string(.)"/>
  48. </cm:searchPath>
  49. <cm:priority><xsl:value-of select="key('env-param', 'priority')"/></cm:priority>
  50. </cm:schedule>
  51. </xsl:for-each>
  52. </cm:objects>
  53. </cm:update>
  54. </xts:transform>
  55. </send:request>
  56. </xts:transform>
  57. </xts:sequence>
  58. </xsl:template>
  59. </xsl:stylesheet>
  60. </xts:block>
  61. <!--
  62. clickedOk to update current background activities - executed once the user hit the OK button on the Set the priority popup dialog to update the current background activities
  63. -->
  64. <xts:block id="clickedOkUpdateCurrentActivities" dependency="frag_init" type="exec" nodelist="env, header, user, system" processor="XSLT" mandatory="false" condition=".[/root/env/param[@name='userClickedOk']='true' and /root/env/param[@name='setPriorityMode']='updateCurrentActivities']">
  65. <xts:logicsheet path="/cogadmin/logicsheets/presentation/common.xslt"/>
  66. <xts:logicsheet path="/cogadmin/logicsheets/buslogic.xslt"/>
  67. <xsl:stylesheet version="1.0"
  68. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  69. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  70. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  71. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  72. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  73. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  74. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  75. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  76. xmlns:es="http://developer.cognos.com/schemas/eventManagementService/1"
  77. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  78. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  79. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  80. exclude-result-prefixes="xsl ui SOAP-ENC SOAP-ENV xos send xsd cm es xtsext xsi uic">
  81. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  82. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  83. <xsl:template match="/">
  84. <!-- update the upcoming_activities with the slected priority (from upcoming_activities) -->
  85. <xts:sequence>
  86. <xts:append>
  87. <result>
  88. <send:request provider="eventManagementService" faultBlock="faultHandler">
  89. <updateEvents>
  90. <events xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:eventRecord[{count(/root/env/param[contains(@name, '_checkbox_')])}]" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  91. <xsl:for-each select="/root/env/param[contains(@name, '_checkbox_')]">
  92. <item type="tns:eventRecord">
  93. <eventID xsi:type="xsd:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  94. <xsl:value-of select="xtsext:urldecode(string(.))"/>
  95. </eventID>
  96. <priority xsi:type="xsd:int" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  97. <xsl:value-of select="key('env-param', 'priority')"/>
  98. </priority>
  99. </item>
  100. </xsl:for-each>
  101. </events>
  102. </updateEvents>
  103. </send:request>
  104. </result>
  105. </xts:append>
  106. </xts:sequence>
  107. </xsl:template>
  108. </xsl:stylesheet>
  109. </xts:block>
  110. <!--
  111. checkResult - check result of request
  112. -->
  113. <xts:block id="checkResult" type="exec" dependency="frag_init clickedOkUpdateCurrentActivities clickedOkUpdateSchedules" nodelist="env, header, user, system, result" processor="XSLT" mandatory="false" condition=".[/root/env/param[@name='userClickedOk']='true' ]">
  114. <xts:logicsheet path="/cogadmin/logicsheets/presentation/common.xslt"/>
  115. <xts:logicsheet path="/cogadmin/logicsheets/buslogic.xslt"/>
  116. <xsl:stylesheet version="1.0"
  117. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  118. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  119. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  120. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  121. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  122. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  123. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  124. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  125. xmlns:es="http://developer.cognos.com/schemas/eventManagementService/1"
  126. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  127. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  128. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  129. exclude-result-prefixes="xsl ui SOAP-ENC SOAP-ENV xos send xsd cm es xtsext xsi uic">
  130. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  131. <xsl:template match="/">
  132. <xts:sequence>
  133. <!-- create an empty fragment to run javascript -->
  134. <xts:append select="/root/output">
  135. <xos:part>
  136. <xos:entityHeader>
  137. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  138. </xos:entityHeader>
  139. <xos:entityBody>
  140. <fragment>
  141. <markup>
  142. <mimeType>text/html</mimeType>
  143. <markupXml>
  144. <script>
  145. <!-- Display alert when a fault was returned -->
  146. <xsl:if test="/root/result/actionFault">
  147. alert('<xts:string id="IDS_SPD_PRIORITY_INFO" encode="javascript"/>');
  148. </xsl:if>
  149. _THIS_.uiDialog.destroy();
  150. raiseReloadEvent(_THIS_);
  151. </script>
  152. </markupXml>
  153. </markup>
  154. </fragment>
  155. </xos:entityBody>
  156. </xos:part>
  157. </xts:append>
  158. </xts:sequence>
  159. </xsl:template>
  160. </xsl:stylesheet>
  161. </xts:block>
  162. <xts:block id="getMeta" type="exec" mode="interpret" nodelist="env" processor="XSLT" condition=".[not(/root/env/param[@name='userClickedOk']='true')]">
  163. <xsl:stylesheet version="1.0"
  164. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  165. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  166. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  167. exclude-result-prefixes="xsl xts xos xtsext">
  168. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  169. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  170. <xsl:template match="/">
  171. <xts:sequence>
  172. <xts:append select="/root/output">
  173. <xos:part>
  174. <xos:entityHeader>
  175. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  176. </xos:entityHeader>
  177. <xos:entityBody>
  178. <fragment>
  179. <info>
  180. <title>IDS_SPD_TITLE</title>
  181. </info>
  182. <globalValidator>
  183. <parameter>
  184. <name>userClickedOk</name>
  185. <ruleRef id="fragment-cogadmin:boolean"/>
  186. </parameter>
  187. <parameter>
  188. <name>setPriorityMode</name>
  189. <ruleRef id="fragment-cogadmin:priorityMode"/>
  190. </parameter>
  191. </globalValidator>
  192. <meta/>
  193. </fragment>
  194. </xos:entityBody>
  195. </xos:part>
  196. </xts:append>
  197. </xts:sequence>
  198. </xsl:template>
  199. </xsl:stylesheet>
  200. </xts:block>
  201. <!--
  202. render - renders the Set the priority popup dialog
  203. -->
  204. <xts:block id="renderMarkup" type="exec" dependency="frag_init getMeta clickedOkUpdateSchedules checkResult" nodelist="env, header, user, system" processor="XSLT" mandatory="false" condition=".[not(/root/env/param[@name='userClickedOk'])]">
  205. <xts:logicsheet path="cogadmin/logicsheets/presentation/filters.xslt"/>
  206. <xsl:stylesheet version="1.0"
  207. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  208. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  209. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  210. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  211. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  212. xmlns:flt="http://developer.cognos.com/schemas/uic/presentation/filters/"
  213. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  214. xmlns:val="http://developer.cognos.com/schemas/validator/1/"
  215. xmlns:fragment="urn:cognos:fragments:validator"
  216. xmlns:fragment-cogadmin="urn:cognos:fragments:validator:cogadmin"
  217. exclude-result-prefixes="xsl ui xos xtsext SOAP-ENV uic">
  218. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  219. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  220. <xsl:template match="/">
  221. <xts:sequence>
  222. <xts:append select="/root/output/*[local-name()='part']/*[local-name()='entityBody']/fragment">
  223. <markup>
  224. <mimeType>text/html</mimeType>
  225. <markupXml>
  226. <!-- render the HTML -->
  227. <xts:transform src="/cogadmin/transforms/presentation/renderFragment.xslt" processor="XSLT">
  228. <xts:param name="messageBase">/messages/cogadminuimsgs.xml</xts:param>
  229. <xts:param name="logicsheet">/cogadmin/logicsheets/admin.xslt</xts:param>
  230. <root>
  231. <uic:fragment>
  232. <uic:header modal="false">
  233. <uic:width>500</uic:width>
  234. <uic:height>100</uic:height>
  235. <uic:title><xts:string id="IDS_SPD_TITLE"/></uic:title>
  236. <uic:description><xts:string id="IDS_SPD_DESCRIPTION"/></uic:description>
  237. </uic:header>
  238. <!-- body -->
  239. <uic:body>
  240. <!-- priority filter -->
  241. <flt:priorityFilter prefix="_SP" showAny="false"/>
  242. </uic:body>
  243. <!-- add the selected checkboxes to a variable for passing into the retrieve() function-->
  244. <xsl:variable name="selectedItems">
  245. <xsl:for-each select="/root/env/param[contains(@name, '_checkbox_')]">
  246. <xsl:value-of select="concat(@name,'=',xtsext:urlencode(.),'&amp;')"/>
  247. </xsl:for-each>
  248. </xsl:variable>
  249. <!-- show ourselves -->
  250. <script>
  251. _THIS_.unload = function(evt) {
  252. _THIS_.removeEventListener("cognos.ui.dialog.ok", "_THIS_.onDialogOK");
  253. _THIS_.removeEventListener("fragment.unload", _THIS_.unload);
  254. }
  255. _THIS_.onDialogOK = function(evt) {
  256. //round trip all the values of the checkboxes after checking that a priority has been selected
  257. if(document.getElementById('_SPfilter_priority').value=='') {
  258. alert('<xts:string id="IDS_SPD_NO_PRIORITY_WARNING" encode="javascript"/>');
  259. evt.preventDefault();
  260. return false;
  261. };
  262. _THIS_.retrieve('<xsl:value-of select="xtsext:javascriptencode(string($selectedItems))"/>' + 'userClickedOk=true&amp;priority=' + document.getElementById('_SPfilter_priority').value + '&amp;setPriorityMode=<xsl:value-of select="key('env-param','setPriorityMode')"/>');
  263. return true;
  264. }
  265. _THIS_.addEventListener("cognos.ui.dialog.ok", "_THIS_.onDialogOK");
  266. _THIS_.addEventListener("fragment.unload", _THIS_.unload);
  267. </script>
  268. </uic:fragment>
  269. <xts:queryNode select="/root/system | /root/session"/>
  270. </root>
  271. </xts:transform>
  272. </markupXml>
  273. </markup>
  274. </xts:append>
  275. </xts:sequence>
  276. </xsl:template>
  277. </xsl:stylesheet>
  278. </xts:block>
  279. <!--
  280. Fault handler: If a fault happens during an action, then we need to catch it and process it.
  281. -->
  282. <xts:block id="faultHandler" type="fault" processor="XSLT">
  283. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  284. <xsl:output method="xml"/>
  285. <xsl:template match="/root/fault">
  286. <actionFault>
  287. <xsl:copy-of select="."/>
  288. </actionFault>
  289. </xsl:template>
  290. <xsl:template match="text()"/>
  291. </xsl:stylesheet>
  292. </xts:block>
  293. </xts:morphlet>