activities_upcoming.xslt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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, 2014
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  15. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  16. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  17. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  18. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  19. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  20. exclude-result-prefixes="ui uic xts xtsext admui xsi">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  22. <xsl:key name="secondary-requests" match="/root/asyncRequestResponse/response/*/*[local-name()='result']/*[local-name()='secondaryRequests']/*[contains(@xsi:type,':asynchSecondaryRequest')]/*[local-name()='name']" use="."/>
  23. <!-- display variables -->
  24. <admui:variables/>
  25. <xsl:variable name="asynchDetailEventRecord" select="/root/asyncRequestResponse/response/*/result/details/*[contains(@xsi:type, ':asynchDetailEventRecord')]"/>
  26. <xsl:variable name="personalOnly" select="key('env-param', 'personalOnly') ='true'"/>
  27. <ui:runnableTemplates/>
  28. <!-- action templates-->
  29. <ui:commonActions/>
  30. <xsl:template match="/root">
  31. <uic:fragment>
  32. <!-- add the reload event listener, and override the default fragment.refresh -->
  33. <ui:standardReloadListener/>
  34. <ui:leavingCogadminListener/>
  35. <script>
  36. <!-- create a json array of priority criteria for all the rows so that we can determine the priority of the selected entries in javascript-->
  37. var _THIS_entriesArray = [
  38. <xsl:for-each select="$asynchDetailEventRecord">
  39. {'priority':'<xsl:value-of select="priority"/>'}<xsl:if test="position()!=last()">,</xsl:if>
  40. </xsl:for-each>
  41. ];
  42. function _THIS_secondaryRequest(request) {
  43. _THIS_.retrieve('secondaryRequest=' + request);
  44. }
  45. </script>
  46. <uic:filterInitScript filterName="upcomingactivities"/>
  47. <xsl:choose>
  48. <xsl:when test="/root/asyncRequestResponse/status = 'working' or /root/asyncRequestResponse/status = 'stillWorking'">
  49. TODO
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <xsl:variable name="currentDateTime">
  53. <xsl:choose>
  54. <xsl:when test="key('env-param', 'upcoming_filter_date[]') and key('env-param', 'upcoming_filter_date[]') != ''">
  55. <xsl:value-of select="key('env-param', 'upcoming_filter_date[]')"/>
  56. </xsl:when>
  57. <xsl:otherwise>
  58. <xsl:value-of select="xtsext:getCurrentDateTime(string($timeZone))"/>
  59. </xsl:otherwise>
  60. </xsl:choose>
  61. </xsl:variable>
  62. <!-- Important notes:
  63. - Setting "" for the timezone means using GMT for the formatting
  64. - currentDateTime is a local date and time but GMT timezone is used for the formatting
  65. -->
  66. <xsl:variable name="currentDateDsp">
  67. <xsl:value-of select="xtsext:formatDateOnlyFromUTC( string( $currentDateTime ), number('3'), string(''), string( $productLocale ))"/>
  68. </xsl:variable>
  69. <xsl:variable name="currentTimeDsp">
  70. <xsl:value-of select="xtsext:formatDateFromUTC( string( $currentDateTime ), string('ha'), string(''), string( $productLocale ))"/>
  71. </xsl:variable>
  72. <uic:fragmentHeader>
  73. <uic:title><xts:string id="IDS_UAC_TITLE"/></uic:title>
  74. <uic:headerActions>
  75. <ui:groupActionMsgs/>
  76. <xsl:choose>
  77. <xsl:when test="key('env-param', 'frag-view') = 'details'">
  78. <ui:groupAction action="show_details" state="details"/>
  79. <ui:groupAction action="hide_details" state="details"/>
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <ui:groupAction action="show_details" state="hide"/>
  83. <ui:groupAction action="hide_details" state="hide"/>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. <uic:headerSeperator/>
  87. <xsl:if test="not(key('env-param', 'upcoming_filter_status[]')) or key('env-param', 'upcoming_filter_status[]') != 'cancelled'">
  88. <ui:groupAction action="cancel_upcoming" tablename="upcoming_activities" />
  89. </xsl:if>
  90. <xsl:if test="not(key('env-param', 'upcoming_filter_status[]')) or key('env-param', 'upcoming_filter_status[]') = 'scheduled'">
  91. <ui:groupAction action="suspend" dialog="true" tablename="upcoming_activities" setPriorityMode="updateCurrentActivities">
  92. <ui:fragmentLocation>cogadmin/controls/set_suspend.xts</ui:fragmentLocation>
  93. </ui:groupAction>
  94. </xsl:if>
  95. <xsl:if test="key('env-param', 'upcoming_filter_status[]') and key('env-param', 'upcoming_filter_status[]') = 'suspended'">
  96. <ui:groupAction action="release" tablename="upcoming_activities" />
  97. </xsl:if>
  98. <xsl:if test="key('env-param', 'upcoming_filter_status[]') and key('env-param', 'upcoming_filter_status[]') = 'cancelled'">
  99. <ui:groupAction action="schedule_upcoming" tablename="upcoming_activities" />
  100. </xsl:if>
  101. <ui:groupAction action="set_priority" tablename="upcoming_activities" setPriorityMode="updateCurrentActivities">
  102. <ui:fragmentLocation>cogadmin/controls/set_priority.xts</ui:fragmentLocation>
  103. </ui:groupAction>
  104. </uic:headerActions>
  105. </uic:fragmentHeader>
  106. <!-- bulid the chart -->
  107. <uic:barChart/>
  108. <uic:table>
  109. <uic:features>
  110. <uic:name>upcoming_activities</uic:name>
  111. <uic:scrollable/>
  112. <uic:type>checkbox</uic:type>
  113. <uic:summary><xts:string id="IDS_UAC_TABLE_SUMMARY"/></uic:summary>
  114. <ui:tableFeatures/>
  115. </uic:features>
  116. <uic:filterSummary>
  117. <!-- Day -->
  118. <item>
  119. <label><xts:string id="IDS_FLT_DAY"/></label>
  120. <value><xsl:value-of select="$currentDateDsp"/></value>
  121. </item>
  122. <!-- Time -->
  123. <xsl:if test="key('env-param','upcoming_filter_granularity[]') and key('env-param','upcoming_filter_granularity[]') = 'hour'">
  124. <item>
  125. <label><xts:string id="IDS_FLT_HOUR"/></label>
  126. <value><xsl:value-of select="$currentTimeDsp"/></value>
  127. </item>
  128. </xsl:if>
  129. <!-- Scheduled by -->
  130. <xsl:if test="key('env-param', 'upcoming_filter_scheduled_by[]') and key('env-param', 'upcoming_filter_scheduled_by[]') != ''">
  131. <item>
  132. <label><xts:string id="IDS_FLT_SCHEDULED"/></label>
  133. <value><xsl:value-of select="key('env-param', 'upcoming_filter_scheduled_by_dsp[]')"/></value>
  134. </item>
  135. </xsl:if>
  136. <!-- Status -->
  137. <item>
  138. <label><xts:string id="IDS_FLT_STATUS"/></label>
  139. <xsl:choose>
  140. <xsl:when test="key('env-param', 'upcoming_filter_status[]') and key('env-param', 'upcoming_filter_status[]') != ''">
  141. <value><xsl:value-of select="key('env-param', 'upcoming_filter_status_dsp[]')"/></value>
  142. </xsl:when>
  143. <xsl:otherwise>
  144. <value><xts:string id="IDS_ADM_STATUS_SCHEDULED"/></value>
  145. </xsl:otherwise>
  146. </xsl:choose>
  147. </item>
  148. <!-- Priority -->
  149. <xsl:if test="key('env-param', 'upcoming_filter_priority[]') and key('env-param', 'upcoming_filter_priority[]') != ''">
  150. <item>
  151. <label><xts:string id="IDS_FLT_PRIORITY"/></label>
  152. <value><xsl:value-of select="key('env-param', 'upcoming_filter_priority[]')"/></value>
  153. </item>
  154. </xsl:if>
  155. <!-- Tenant -->
  156. <xsl:if test="key('env-param', 'upcoming_filter_tenantid[]') and key('env-param', 'upcoming_filter_tenantid[]') != ''">
  157. <item>
  158. <label><xts:string id="IDS_FLT_TENANT"/></label>
  159. <value><xsl:value-of select="key('env-param', 'upcoming_filter_tenantidName[]')"/></value>
  160. </item>
  161. </xsl:if>
  162. <!-- Owned by -->
  163. <xsl:if test="key('env-param', 'upcoming_filter_owned_by[]') and key('env-param', 'upcoming_filter_owned_by[]') != ''">
  164. <item>
  165. <label><xts:string id="IDS_FLT_OWNED_BY3"/></label>
  166. <value><xsl:value-of select="key('env-param', 'upcoming_filter_owned_by_dsp[]')"/></value>
  167. </item>
  168. </xsl:if>
  169. <!-- Type -->
  170. <xsl:if test="key('env-param', 'upcoming_filter_type[]') and key('env-param', 'upcoming_filter_type[]') != ''">
  171. <item>
  172. <label><xts:string id="IDS_FLT_TYPE"/></label>
  173. <value><xsl:value-of select="key('env-param', 'upcoming_filter_type_dsp[]')"/></value>
  174. </item>
  175. </xsl:if>
  176. <!-- Scope -->
  177. <xsl:if test="key('env-param', 'upcoming_filter_scope[]') and key('env-param', 'upcoming_filter_scope[]') != ''">
  178. <item>
  179. <label><xts:string id="IDS_FLT_SCOPE"/></label>
  180. <value><xsl:value-of select="key('env-param', 'upcoming_filter_scope_dsp[]')"/></value>
  181. </item>
  182. </xsl:if>
  183. </uic:filterSummary>
  184. <uic:paginations>
  185. <uic:title>
  186. <xts:string id="IDS_PAG_ITEMS"/>
  187. </uic:title>
  188. <uic:fromLabel><xts:string id="IDS_PAGER_FROM"/></uic:fromLabel>
  189. <uic:from><xsl:value-of select="$asynchDetailEventRecord[1]/runnable/*/position/value"/></uic:from>
  190. <uic:toLabel><xts:string id="IDS_PAGER_TO"/></uic:toLabel>
  191. <uic:to><xsl:value-of select="$asynchDetailEventRecord[position()=last()]/runnable/*/position/value"/></uic:to>
  192. <uic:goto/>
  193. <uic:first>
  194. <xsl:if test="not(key('secondary-requests','firstPage'))">
  195. <uic:disabled>true</uic:disabled>
  196. </xsl:if>
  197. <uic:link>_THIS_secondaryRequest('firstPage');</uic:link>
  198. </uic:first>
  199. <uic:previous>
  200. <xsl:if test="not(key('secondary-requests','previousPage'))">
  201. <uic:disabled>true</uic:disabled>
  202. </xsl:if>
  203. <uic:link>_THIS_secondaryRequest('previousPage');</uic:link>
  204. </uic:previous>
  205. <uic:next>
  206. <xsl:if test="not(key('secondary-requests','nextPage'))">
  207. <uic:disabled>true</uic:disabled>
  208. </xsl:if>
  209. <uic:link>_THIS_secondaryRequest('nextPage');</uic:link>
  210. </uic:next>
  211. <uic:last>
  212. <xsl:if test="not(key('secondary-requests','lastPage'))">
  213. <uic:disabled>true</uic:disabled>
  214. </xsl:if>
  215. <uic:link>_THIS_secondaryRequest('lastPage');</uic:link>
  216. </uic:last>
  217. </uic:paginations>
  218. <xsl:variable name="sortTooltip"><xts:string id="IDS_SORT_TOOLTIP"/></xsl:variable>
  219. <uic:header>
  220. <uic:row>
  221. <uic:column align="center" nowrap="nowrap"/>
  222. <uic:column width="100%">
  223. <uic:text>
  224. <xts:string id="IDS_UAC_TABLE_NAME"/>
  225. </uic:text>
  226. </uic:column>
  227. <uic:column nowrap="nowrap" sort="startTime" iconTooltip="{$sortTooltip}">
  228. <uic:text>
  229. <xsl:choose>
  230. <xsl:when test="key('env-param', 'upcoming_filter_status') = 'suspended'">
  231. <xts:string id="IDS_UAC_TABLE_ORIGINAL_REQUEST_TIME"/>
  232. </xsl:when>
  233. <xsl:otherwise>
  234. <xts:string id="IDS_UAC_TABLE_REQUEST_TIME"/>
  235. </xsl:otherwise>
  236. </xsl:choose>
  237. </uic:text>
  238. </uic:column>
  239. <xsl:if test="not($personalOnly)">
  240. <uic:column nowrap="nowrap">
  241. <uic:text>
  242. <xts:string id="IDS_UAC_TABLE_SCHEDULED_BY"/>
  243. </uic:text>
  244. </uic:column>
  245. </xsl:if>
  246. <uic:column nowrap="nowrap" sort="priority" iconTooltip="{$sortTooltip}">
  247. <uic:text>
  248. <xts:string id="IDS_UAC_TABLE_PRIORITY"/>
  249. </uic:text>
  250. </uic:column>
  251. </uic:row>
  252. </uic:header>
  253. <uic:body>
  254. <!-- loop through the asynchDetailEventRecord -->
  255. <xsl:for-each select="$asynchDetailEventRecord">
  256. <xsl:variable name="runnable" select="*[local-name()='runnable']/*"/>
  257. <!-- extract the last Execution time value from the activityHistory where the paths match -->
  258. <xsl:variable name="lastExecutionTime" select="/root/*[local-name()='activityHistory']/*[local-name()='schedule'][*[local-name()='path']=$runnable/searchPath/value]/*[local-name()='lastExecutionTime']"/>
  259. <uic:row label="{xtsext:htmlencode($runnable/*[local-name()='defaultName']))}">
  260. <xsl:attribute name="value">
  261. <xsl:value-of select="*[local-name()='eventID']"/>
  262. </xsl:attribute>
  263. <uic:column>
  264. <admui:gen-runnable-icon>
  265. <admui:objectClass><xsl:value-of select="$runnable/*[local-name()='objectClass']/*[local-name()='value']"/></admui:objectClass>
  266. <!-- todo: need to pass in the iconURI once the API supports getting it -->
  267. <admui:iconURI/>
  268. <admui:defaultName><xsl:value-of select="$runnable/defaultName/value"/></admui:defaultName>
  269. <admui:screenTip><xsl:value-of select="$runnable/defaultScreenTip/value"/></admui:screenTip>
  270. <admui:disabled><xsl:value-of select="$runnable/hidden/value"/></admui:disabled>
  271. </admui:gen-runnable-icon>
  272. </uic:column>
  273. <!-- name -->
  274. <uic:column scope="row" abbr="{xtsext:htmlencode($runnable/*[local-name()='defaultName'])}">
  275. <uic:text>
  276. <xsl:value-of select="$runnable/*[local-name()='defaultName']"/>
  277. </uic:text>
  278. <xsl:call-template name="ui:menuActions">
  279. <xsl:with-param name="obj-class" select="$runnable/*[local-name()='objectClass']/*[local-name()='value']"/>
  280. <xsl:with-param name="obj-id" select="$runnable/*[local-name()='storeID']/*[local-name()='value']"/>
  281. <xsl:with-param name="obj-name" select="$runnable/*[local-name()='defaultName']/*[local-name()='value']"/>
  282. <xsl:with-param name="obj-path" select="$runnable/*[local-name()='storeID']/*[local-name()='value']"/>
  283. <xsl:with-param name="status" select="*[local-name()='status']"/>
  284. <xsl:with-param name="priority" select="*[local-name()='priority']"/>
  285. <xsl:with-param name="setPriorityMode">updateCurrentActivities</xsl:with-param>
  286. <xsl:with-param name="event-id" select="*[local-name()='eventID']"/>
  287. <xsl:with-param name="supportSetPriority" select="true()"/>
  288. <xsl:with-param name="supportSetProperties" select="false()"/>
  289. <xsl:with-param name="supportCancelUpcoming" select="true()"/>
  290. <xsl:with-param name="supportScheduleUpcoming" select="true()"/>
  291. <xsl:with-param name="supportSuspendUpcoming" select="true()"/>
  292. </xsl:call-template>
  293. </uic:column>
  294. <!-- request time -->
  295. <uic:column nowrap="nowrap">
  296. <uic:text>
  297. <xsl:variable name="scheduledStartTime" select="xtsext:formatDateFromUTC(string(*[local-name()='scheduledStartTime']), number( '2' ), number( '3' ), string( $timeZone ), string( $contentLocale ) )"/>
  298. <xsl:variable name="requestedStartTime" select="xtsext:formatDateFromUTC(string(*[local-name()='requestedStartTime']), number( '2' ), number( '3' ), string( $timeZone ), string( $contentLocale ) )"/>
  299. <xsl:choose>
  300. <xsl:when test="key('env-param', 'upcoming_filter_status') = 'suspended'">
  301. <xsl:value-of select="$scheduledStartTime"/>
  302. </xsl:when>
  303. <xsl:otherwise>
  304. <span>
  305. <xsl:value-of select="$requestedStartTime"/>
  306. <xsl:if test="not($scheduledStartTime = $requestedStartTime)">
  307. <xsl:variable name="scheduledStartTimeMsg">
  308. <xts:string id="IDS_UAC_TABLE_ORIGINAL_REQUEST_TIME_TIP">
  309. <xts:param name="origTime"><xsl:value-of select="$scheduledStartTime"/></xts:param>
  310. </xts:string>
  311. </xsl:variable>
  312. <img style="vertical-align:middle" alt="{normalize-space($scheduledStartTimeMsg)}" title="{normalize-space($scheduledStartTimeMsg)}" src="{$webRoot}/ps/portal/images/msg_information_8.gif"/>
  313. </xsl:if>
  314. </span>
  315. </xsl:otherwise>
  316. </xsl:choose>
  317. </uic:text>
  318. </uic:column>
  319. <!-- scheduled by -->
  320. <xsl:if test="not($personalOnly)">
  321. <uic:column nowrap="nowrap">
  322. <uic:text>
  323. <xsl:variable name="userInfo" select="*[local-name()='user']/*[contains(@xsi:type,':account')]"/>
  324. <xsl:choose>
  325. <xsl:when test="$userInfo/*[local-name()='userName' or local-name()='defaultName']/*[local-name()='value'] != ''">
  326. <xsl:value-of select="$userInfo/*[local-name()='defaultName']/*[local-name()='value']"/>
  327. <xsl:if test="$userInfo/*[local-name()='userName']/*[local-name()='value'] != ''">
  328. <xsl:value-of select="concat(' (', $userInfo/*[local-name()='userName']/*[local-name()='value'], ')')"/>
  329. </xsl:if>
  330. </xsl:when>
  331. <xsl:otherwise>
  332. <xts:string id="IDS_ADM_USER_UNAVAILABLE"/>
  333. </xsl:otherwise>
  334. </xsl:choose>
  335. </uic:text>
  336. </uic:column>
  337. </xsl:if>
  338. <!-- priority -->
  339. <uic:column>
  340. <uic:text><xsl:value-of select="*[local-name()='priority']"/></uic:text>
  341. </uic:column>
  342. </uic:row>
  343. <uic:rowDetails>
  344. <xsl:if test="key('env-param', 'frag-view') = 'details'">
  345. <xsl:attribute name="expanded">true</xsl:attribute>
  346. </xsl:if>
  347. <uic:column/>
  348. <uic:column colspan="1">
  349. <xsl:call-template name="ui:myFolderShortPath">
  350. <xsl:with-param name="myFolderStoreID" select="/root/session/param[@name = 'mrootid']"/>
  351. <xsl:with-param name="ancestors" select="$runnable/ancestors/value/*[contains(@xsi:type,':ancestorInfo')]"/>
  352. </xsl:call-template>
  353. </uic:column>
  354. <uic:column colspan="4">
  355. <uic:disabledText>
  356. <xts:string id="IDS_SCH_TABLE_LAST_EXECUTION_TIME"/><xsl:value-of select="$lastExecutionTime"/>
  357. </uic:disabledText>
  358. </uic:column>
  359. </uic:rowDetails>
  360. </xsl:for-each>
  361. </uic:body>
  362. <uic:footer displayLastUpdate="true" />
  363. </uic:table>
  364. </xsl:otherwise>
  365. </xsl:choose>
  366. </uic:fragment>
  367. </xsl:template>
  368. </xsl:stylesheet>