schedule.xslt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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:xsi="http://www.w3.org/2001/XMLSchema-instance"
  18. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  19. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  20. xmlns:pgr="http://developer.cognos.com/schemas/uic/presentation/cogadminpager/"
  21. xmlns:cm="http://developer.cognos.com/schemas/bibus/3/"
  22. xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
  23. exclude-result-prefixes="ui uic xts xtsext admui nav cm">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  25. <xsl:key name="scheduledBy" match="/root/scheduledBy/*[local-name()='queryResponse']/returns/item" use="queryResult/item/searchPath/value"/>
  26. <xsl:key name="eventStateList" match="/root/mostRecentEvent/*[local-name()='queryResponse']/returns/item/queryResult/item[contains(@xsi:type, ':agentState')]" use="definition/value/item/storeID/value"/>
  27. <xsl:key name="eventOutputList" match="/root/mostRecentEvent/*[local-name()='queryResponse']/returns/item/queryResult/item[contains(@xsi:type, ':output')]/ancestors/value/item" use="storeID"/>
  28. <!-- display variables -->
  29. <admui:variables/>
  30. <!-- common pager variables -->
  31. <admui:pagerVariables pagerName="schedules"/>
  32. <xsl:variable name="personalOnly" select="key('env-param', 'personalOnly') ='true'"/>
  33. <!-- pager templates -->
  34. <pgr:cogadminPagerTemplates/>
  35. <!-- action templates-->
  36. <ui:commonActions/>
  37. <xsl:template match="/root">
  38. <uic:fragment>
  39. <!-- add the reload event listener -->
  40. <ui:standardReloadListener/>
  41. <uic:filterInitScript filterName="schedules"/>
  42. <uic:fragmentHeader>
  43. <uic:title><xts:string id="IDS_SCH_TITLE"/></uic:title>
  44. <uic:headerActions>
  45. <ui:groupActionMsgs/>
  46. <xsl:choose>
  47. <xsl:when test="key('env-param', 'frag-view') = 'details'">
  48. <ui:groupAction action="show_details" state="details"/>
  49. <ui:groupAction action="hide_details" state="details"/>
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <ui:groupAction action="show_details" state="hide"/>
  53. <ui:groupAction action="hide_details" state="hide"/>
  54. </xsl:otherwise>
  55. </xsl:choose>
  56. <uic:headerSeperator/>
  57. <ui:groupAction action="enable_schedule" tablename="schedules" />
  58. <ui:groupAction action="disable_schedule" tablename="schedules" />
  59. <ui:groupAction action="set_priority" tablename="schedules" setPriorityMode="updateSchedules">
  60. <ui:fragmentLocation>cogadmin/controls/set_priority.xts</ui:fragmentLocation>
  61. </ui:groupAction>
  62. </uic:headerActions>
  63. </uic:fragmentHeader>
  64. <script>
  65. <!-- create a json array of priority criteria for all the rows so that we can determine the priority of the selected entries in javascript-->
  66. var _THIS_entriesArray = [
  67. <xsl:for-each select="/root/nav:searchResponse/nav:content/nav:item">
  68. {'priority':'<xsl:value-of select="nav:priority"/>'}<xsl:if test="position()!=last()">,</xsl:if>
  69. </xsl:for-each>
  70. ];
  71. </script>
  72. <!-- display the chart at the top -->
  73. <uic:barChart/>
  74. <uic:table width="100%">
  75. <uic:features>
  76. <uic:name>schedules</uic:name>
  77. <uic:scrollable/>
  78. <uic:type>checkbox</uic:type>
  79. <uic:summary><xts:string id="IDS_SCH_TABLE_SUMMARY"/></uic:summary>
  80. <ui:tableFeatures/>
  81. </uic:features>
  82. <!-- pager: entries, goto, first, previous, next, last-->
  83. <xsl:call-template name="pgr:cogadminPager">
  84. <xsl:with-param name="pagerName" select="$pagerName"/>
  85. <xsl:with-param name="pageStart" select="nav:searchResponse/nav:content/@start"/>
  86. <xsl:with-param name="pageEnd" select="nav:searchResponse/nav:content/@end"/>
  87. <xsl:with-param name="pageMax" select="nav:searchResponse/nav:content/@max"/>
  88. <xsl:with-param name="pageMore" select="nav:searchResponse/nav:content/@more"/>
  89. <xsl:with-param name="linesPerPage" select="$linesPerPage"/>
  90. </xsl:call-template>
  91. <uic:header>
  92. <uic:row>
  93. <!-- TODO: replace style with CSS class -->
  94. <uic:column nowrap="nowrap"/>
  95. <uic:column width="100%" nowrap="nowrap">
  96. <uic:text>
  97. <xts:string id="IDS_HEADING_NAME"/>
  98. </uic:text>
  99. </uic:column>
  100. <uic:column nowrap="nowrap" sort="lastModifiedDate">
  101. <uic:text>
  102. <xts:string id="IDS_HEADING_MODIFIED"/>
  103. </uic:text>
  104. </uic:column>
  105. <xsl:if test="not($personalOnly)">
  106. <uic:column nowrap="nowrap">
  107. <uic:text>
  108. <xts:string id="IDS_UAC_TABLE_SCHEDULED_BY"/>
  109. </uic:text>
  110. </uic:column>
  111. </xsl:if>
  112. <uic:column nowrap="nowrap" sort="active">
  113. <uic:text>
  114. <xts:string id="IDS_SCH_TABLE_STATUS"/>
  115. </uic:text>
  116. </uic:column>
  117. <uic:column nowrap="nowrap" sort="priority">
  118. <uic:text>
  119. <xts:string id="IDS_SCH_TABLE_PRIORITY"/>
  120. </uic:text>
  121. </uic:column>
  122. </uic:row>
  123. </uic:header>
  124. <uic:body>
  125. <xsl:for-each select="/root/nav:searchResponse/nav:content/nav:item">
  126. <uic:row label="{xtsext:htmlencode(string(nav:item/nav:name))}">
  127. <xsl:attribute name="value">
  128. <xsl:value-of select="nav:searchPath"/>
  129. </xsl:attribute>
  130. <uic:column align="center">
  131. <uic:icon>
  132. <xsl:if test="nav:item/nav:hidden='true'">
  133. <xsl:attribute name="disabled">true</xsl:attribute>
  134. </xsl:if>
  135. <uic:src>
  136. <admui:imageURL type="nav">
  137. <admui:image><xsl:value-of select="nav:imgURL"/></admui:image>
  138. </admui:imageURL>
  139. </uic:src>
  140. <uic:tooltip>
  141. <xsl:value-of select="nav:item/nav:screenTip"/>
  142. </uic:tooltip>
  143. </uic:icon>
  144. </uic:column>
  145. <uic:column scope="row" abbr="{xtsext:htmlencode(nav:item/nav:name)}">
  146. <uic:text>
  147. <xsl:value-of select="nav:item/nav:name"/>
  148. </uic:text>
  149. <!-- add the drop down menu -->
  150. <xsl:variable name="permissions" select="nav:item/nav:permissions"/>
  151. <xsl:variable name="eventStateId">
  152. <xsl:value-of select="key('eventStateList', nav:item/nav:internalId)/storeID/value"/>
  153. </xsl:variable>
  154. <xsl:variable name="hasEventOutput">
  155. <xsl:choose>
  156. <xsl:when test="$eventStateId != '' and key('eventOutputList', $eventStateId)/objectClass != ''">true</xsl:when>
  157. <xsl:otherwise>false</xsl:otherwise>
  158. </xsl:choose>
  159. </xsl:variable>
  160. <xsl:call-template name="ui:menuActions">
  161. <xsl:with-param name="obj-class" select="nav:item/nav:type"/>
  162. <xsl:with-param name="obj-id" select="nav:item/nav:internalId"/>
  163. <xsl:with-param name="obj-name" select="nav:item/nav:name"/>
  164. <xsl:with-param name="obj-path" select="nav:searchPath"/>
  165. <xsl:with-param name="obj-parent" select="nav:item/nav:searchPath"/>
  166. <xsl:with-param name="priority" select="nav:priority"/>
  167. <xsl:with-param name="setPriorityMode">updateSchedules</xsl:with-param>
  168. <xsl:with-param name="active" select="nav:active"/>
  169. <xsl:with-param name="supportViewRunHistory" select="true()"/>
  170. <xsl:with-param name="supportViewMostRecentEventList" select="$hasEventOutput = 'true'"/>
  171. <xsl:with-param name="supportRunOnce" select="true()"/>
  172. <xsl:with-param name="supportEditSchedule" select="true()"/>
  173. <xsl:with-param name="supportSetPriority" select="true()"/>
  174. <xsl:with-param name="supportEnableDisable" select="true()"/>
  175. <xsl:with-param name="canRead" select="contains($permissions, 'read')"/>
  176. <xsl:with-param name="canWrite" select="contains($permissions, 'write')"/>
  177. <xsl:with-param name="canExecute" select="contains($permissions, 'execute')"/>
  178. <xsl:with-param name="canTraverse" select="contains($permissions, 'traverse')"/>
  179. </xsl:call-template>
  180. </uic:column>
  181. <uic:column nowrap="nowrap">
  182. <uic:text>
  183. <xsl:value-of select="nav:lastModifiedDate"/>
  184. </uic:text>
  185. </uic:column>
  186. <xsl:if test="not($personalOnly)">
  187. <uic:column nowrap="nowrap">
  188. <!-- We really shouldn't be picking apart the searchPath like this, but we have no choice given the current model. -->
  189. <xsl:variable name="userInfo" select="key('scheduledBy',substring-before(nav:credential/nav:searchPath, '/credential'))/queryResult/item"/>
  190. <xsl:variable name="isDefaultNameCAMID" select="($userInfo/defaultName != '') and contains($userInfo/searchPath, normalize-space($userInfo/defaultName))"/>
  191. <uic:text>
  192. <xsl:choose>
  193. <xsl:when test="$userInfo/userName/value != '' or ($userInfo/defaultName/value != '' and not($isDefaultNameCAMID))">
  194. <xsl:value-of select="$userInfo/defaultName/value"/>
  195. <xsl:if test="$userInfo/userName/value != ''">
  196. <xsl:value-of select="concat(' (', $userInfo/userName/value, ')')"/>
  197. </xsl:if>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <xts:string id="IDS_ADM_USER_UNAVAILABLE"/>
  201. </xsl:otherwise>
  202. </xsl:choose>
  203. </uic:text>
  204. </uic:column>
  205. </xsl:if>
  206. <uic:column nowrap="nowrap">
  207. <uic:text>
  208. <xsl:choose>
  209. <xsl:when test="nav:active='true'">
  210. <xts:string id="IDS_SCH_TABLE_STATUS_ENABLED"/>
  211. </xsl:when>
  212. <xsl:otherwise>
  213. <xts:string id="IDS_SCH_TABLE_STATUS_DISABLED"/>
  214. </xsl:otherwise>
  215. </xsl:choose>
  216. </uic:text>
  217. </uic:column>
  218. <uic:column nowrap="nowrap">
  219. <uic:text>
  220. <xsl:value-of select="nav:priority"/>
  221. </uic:text>
  222. </uic:column>
  223. </uic:row>
  224. <xsl:if test="nav:item/nav:fullPath != ''">
  225. <uic:rowDetails>
  226. <xsl:if test="key('env-param', 'frag-view') = 'details'">
  227. <xsl:attribute name="expanded">true</xsl:attribute>
  228. </xsl:if>
  229. <uic:column/>
  230. <uic:column colspan="5">
  231. <uic:disabledText>
  232. <xts:string id="IDS_TABLE_DETAILS_PATH">
  233. <xts:param name="path">
  234. <xsl:for-each select="nav:item/nav:fullPath/nav:pathStep//nav:pathStep">
  235. <uic:breadcrumb type="plaintext">
  236. <uic:text><xsl:value-of select="nav:name"/></uic:text>
  237. </uic:breadcrumb>
  238. </xsl:for-each>
  239. </xts:param>
  240. </xts:string>
  241. </uic:disabledText>
  242. </uic:column>
  243. </uic:rowDetails>
  244. </xsl:if>
  245. </xsl:for-each>
  246. </uic:body>
  247. <uic:footer displayLastUpdate="true" />
  248. </uic:table>
  249. </uic:fragment>
  250. </xsl:template>
  251. </xsl:stylesheet>