table_control.xsl 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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, 2015
  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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl uic xtsext">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  14. <xsl:template match="uic:table">
  15. <xsl:variable name="isEmpty" select="not(uic:body/*)"/>
  16. <xsl:apply-templates select="uic:filterSummary">
  17. <xsl:with-param name="prefix" select="substring-before(uic:features/uic:name,'_')"/>
  18. </xsl:apply-templates>
  19. <xsl:apply-templates select="uic:paginations">
  20. <xsl:with-param name="pagerName" select="uic:features/uic:name"/>
  21. <xsl:with-param name="interactionParams" select="uic:interactionParams"/>
  22. <xsl:with-param name="sortParams" select="concat('sort_column=', uic:features/uic:sortColumn, '&amp;sort_order=', uic:features/uic:sortOrder)"/>
  23. </xsl:apply-templates>
  24. <span id="_THIS_metricGroupDescription" style="position:absolute;top:9999;left:9999;display:none"/>
  25. <div class="cogstyle-table-wrapper" aria-label="{uic:features/uic:aria-label}">
  26. <xsl:attribute name="style">
  27. <xsl:if test="@height != ''">height:<xsl:value-of select="@height"/>;</xsl:if>
  28. <xsl:choose>
  29. <xsl:when test="@width != ''">width:<xsl:value-of select="@width"/>;</xsl:when>
  30. <xsl:otherwise>width:100%;</xsl:otherwise>
  31. </xsl:choose>
  32. <!--
  33. for dialogs that show a pager, they're usually offset from the left borber. We want to keep
  34. all the dialogs the same, so uic:tablePadding value will get multiplied by a fixed number of pixels.
  35. -->
  36. <xsl:if test="uic:features/uic:tablePadding">margin:<xsl:value-of select="number(uic:features/uic:tablePadding) * 20"/>px;</xsl:if>
  37. </xsl:attribute>
  38. <xsl:if test="@id != ''">
  39. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  40. </xsl:if>
  41. <table id="_THIS_table" border="0" cellpadding="0" cellspacing="0" class="cogstyle-table" aria-label="{uic:features/uic:aria-label}" summary="{uic:features/uic:aria-label}">
  42. <xsl:if test="@lang!=''">
  43. <xsl:attribute name="lang"><xsl:value-of select="@lang"/></xsl:attribute>
  44. </xsl:if>
  45. <xsl:if test="@width">
  46. <xsl:attribute name="width"><xsl:value-of select="number(@width)-1"/></xsl:attribute>
  47. </xsl:if>
  48. <xsl:if test="uic:features/uic:summary != ''">
  49. <xsl:attribute name="summary"><xsl:value-of select="uic:features/uic:summary"/></xsl:attribute>
  50. </xsl:if>
  51. <thead class="cogstyle-table-header">
  52. <tr class="cogstyle-table-group" key="toggleHeader">
  53. <xsl:if test="uic:header/uic:row/@lang != ''">
  54. <xsl:attribute name="lang"><xsl:value-of select="uic:header/uic:row/@lang"/></xsl:attribute>
  55. </xsl:if>
  56. <xsl:if test="uic:features/uic:type = 'checkbox'">
  57. <th scope="col">
  58. <input type="checkbox" value="" tabIndex="0">
  59. <xsl:attribute name="onclick">toggleCheckboxes(this, '_THIS_table')</xsl:attribute>
  60. <xsl:attribute name="onkeyup">if (event.keyCode == 13) {{toggleCheckboxes(this, '_THIS_table')}}</xsl:attribute>
  61. <xsl:attribute name="aria-label"><xsl:value-of select="xtsext:htmlencode($pagerSelectAll)"/></xsl:attribute>
  62. </input>
  63. </th>
  64. <!-- column divider -->
  65. <th scope="col" height="15" width="1" role="separator" aria-orientation="vertical">
  66. <img height="15" width="1" style="background-color:#9C9C9C" src="{$serverWebcontentPath}images/space.gif" alt=""/>
  67. </th>
  68. </xsl:if>
  69. <xsl:if test="uic:features/uic:type = 'group'">
  70. <th style="vertical-align: middle;" scope="col">
  71. <!-- TODO: replace absolute image path with relative path -->
  72. <img id="_THIS_group_image_0" style="cursor:pointer" onclick="toggleAllGroups('_THIS_')" onkeyup="if (event.keyCode == 13) {{toggleAllGroups('_THIS_')}}" alt="" tabIndex="0">
  73. <xsl:attribute name="src">
  74. <xsl:choose>
  75. <xsl:when test="string(uic:features/uic:collapsed)='true'">
  76. <xsl:value-of select="$expandGif"/>
  77. </xsl:when>
  78. <xsl:otherwise>
  79. <xsl:value-of select="$collapseGif"/>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </xsl:attribute>
  83. <xsl:attribute name="aria-label">
  84. <xsl:choose>
  85. <xsl:when test="string(uic:features/uic:collapsed)='true'">
  86. <xsl:value-of select="$expandAllTooltip"/>
  87. </xsl:when>
  88. <xsl:otherwise>
  89. <xsl:value-of select="$collapseAllTooltip"/>
  90. </xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:attribute>
  93. <xsl:attribute name="aria-expanded">
  94. <xsl:value-of select="not(uic:features/uic:collapsed='true')"/>
  95. </xsl:attribute>
  96. </img>
  97. </th>
  98. <!-- column divider -->
  99. <th height="15" width="1" role="separator" scope="col" aria-orientation="vertical">
  100. <img height="15" width="1" style="background-color:#9C9C9C" src="{$serverWebcontentPath}images/space.gif" alt=""/>
  101. </th>
  102. </xsl:if>
  103. <xsl:apply-templates select="uic:header/uic:row/uic:column">
  104. <xsl:with-param name="type" select="'header'"/>
  105. <xsl:with-param name="tableFeatures">
  106. <xsl:copy-of select="uic:features/*"/>
  107. <xsl:copy-of select="uic:interactionParams"/>
  108. </xsl:with-param>
  109. </xsl:apply-templates>
  110. </tr>
  111. <!-- 1px white space under table header -->
  112. <tr role="separator">
  113. <td style="height:1px;background-color:white;border:0px;padding:0px">
  114. <xsl:attribute name="colspan"><xsl:value-of select="2*(count(uic:header/uic:row/uic:column) + number(uic:features/uic:type = 'group' or uic:features/uic:type = 'checkbox'))"/></xsl:attribute>
  115. </td>
  116. </tr>
  117. </thead>
  118. <xsl:if test="uic:footer">
  119. <tfoot class="cogstyle-table-footer">
  120. <tr>
  121. <xsl:if test="uic:footer/@lang != ''">
  122. <xsl:attribute name="lang"><xsl:value-of select="uic:footer/@lang"/></xsl:attribute>
  123. </xsl:if>
  124. <xsl:attribute name="id">_THIS_footer</xsl:attribute>
  125. <xsl:choose>
  126. <xsl:when test="uic:footer != ''">
  127. <xsl:apply-templates select="uic:footer/uic:row/uic:column">
  128. <xsl:with-param name="type" select="'footer'"/>
  129. <xsl:with-param name="tableFeatures">
  130. <xsl:copy-of select="uic:features/*"/>
  131. </xsl:with-param>
  132. </xsl:apply-templates>
  133. </xsl:when>
  134. <xsl:otherwise> <!--Default=Show TimeStamp-->
  135. <xsl:if test="uic:footer/@displayLastUpdate = 'true'">
  136. <td>
  137. <xsl:attribute name="colspan"><xsl:value-of select="2*(count(uic:header/uic:row/uic:column) + number(uic:features/uic:type = 'group' or uic:features/uic:type = 'checkbox'))"/></xsl:attribute>
  138. <xsl:copy-of select="$lastRefreshed"/>
  139. </td>
  140. </xsl:if>
  141. </xsl:otherwise>
  142. </xsl:choose>
  143. </tr>
  144. </tfoot>
  145. </xsl:if>
  146. <tbody class="cogstyle-table-body">
  147. <xsl:attribute name="id">_THIS_tbodyElement</xsl:attribute>
  148. <!-- if there's nothing to display in the table, then put the 'no items' message -->
  149. <xsl:choose>
  150. <xsl:when test="$isEmpty">
  151. <tr>
  152. <td class="cogstyle-table-text cogstyle-table-empty">
  153. <xsl:attribute name="colspan"><xsl:value-of select="2*(count(uic:header/uic:row/uic:column) + number(uic:features/uic:type = 'group' or uic:features/uic:type = 'checkbox'))"/></xsl:attribute>
  154. <xsl:value-of select="$pageItemNotFound"/>
  155. </td>
  156. </tr>
  157. </xsl:when>
  158. <xsl:otherwise>
  159. <xsl:apply-templates select="uic:body/*">
  160. <xsl:with-param name="tableFeatures">
  161. <xsl:copy-of select="uic:features/*"/>
  162. </xsl:with-param>
  163. <xsl:with-param name="withRowDetails" select="boolean(uic:body/uic:rowDetails)"/>
  164. </xsl:apply-templates>
  165. </xsl:otherwise>
  166. </xsl:choose>
  167. </tbody>
  168. </table>
  169. </div>
  170. <script language="javascript">
  171. <xsl:choose>
  172. <xsl:when test="uic:features/uic:scrollable">
  173. var _THIS_scrollable = true;
  174. </xsl:when>
  175. <xsl:otherwise>
  176. var _THIS_scrollable = false;
  177. </xsl:otherwise>
  178. </xsl:choose>
  179. <xsl:choose>
  180. <xsl:when test="uic:features/uic:listViewSeparator = 'background'">
  181. var _THIS_alternate = true;
  182. </xsl:when>
  183. <xsl:otherwise>
  184. var _THIS_alternate = false;
  185. </xsl:otherwise>
  186. </xsl:choose>
  187. </script>
  188. </xsl:template>
  189. <!--
  190. Creates a expandable/collapsible groups
  191. -->
  192. <xsl:template match="uic:group">
  193. <xsl:param name="tableFeatures"/>
  194. <xsl:variable name="group_number">
  195. <xsl:choose>
  196. <xsl:when test="@groupNum">
  197. <xsl:value-of select="@groupNum"/>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <xsl:value-of select="position()"/>
  201. </xsl:otherwise>
  202. </xsl:choose>
  203. </xsl:variable>
  204. <xsl:variable name="row_count" select="count(uic:row)"/>
  205. <xsl:variable name="collapsed" select="@collapsed"/>
  206. <xsl:variable name="collapsible" select="@collapsible"/>
  207. <xsl:variable name="groupLabel" select="uic:name/*[local-name()!='script'] | uic:name[not(*)]"/>
  208. <xsl:variable name="key" select="@key"/>
  209. <xsl:variable name="ariaOwns">
  210. <xsl:for-each select="uic:row">
  211. <xsl:value-of select="concat('_THIS_','group_',$group_number,'_',position(),' ')"/>
  212. </xsl:for-each>
  213. </xsl:variable>
  214. <tr class="cogstyle-table-group" role="rowgroup" aria-label="{$groupLabel}" id="_THIS_{$group_number}" aria-owns="{$ariaOwns}">
  215. <xsl:if test="$key">
  216. <xsl:attribute name="key"><xsl:value-of select="xtsext:urlencode($key)"/></xsl:attribute>
  217. </xsl:if>
  218. <td style="text-align: center;">
  219. <!-- TODO: replace absolute image path with relative path -->
  220. <img tabIndex="0" role="button">
  221. <xsl:attribute name="id">_THIS_group_image_<xsl:value-of select="$group_number"/></xsl:attribute>
  222. <xsl:if test="$collapsible">
  223. <xsl:attribute name="onclick">toggleGroup('_THIS_', '<xsl:value-of select="$group_number"/>')</xsl:attribute>
  224. <xsl:attribute name="onkeyup">if (event.keyCode == 13) {{toggleGroup('_THIS_', '<xsl:value-of select="$group_number"/>')}}</xsl:attribute>
  225. <xsl:attribute name="style">cursor:pointer</xsl:attribute>
  226. </xsl:if>
  227. <xsl:attribute name="src"><xsl:choose><xsl:when test="$collapsed = 'true'"><xsl:value-of select="$expandGif"/></xsl:when><xsl:otherwise><xsl:value-of select="$collapseGif"/></xsl:otherwise></xsl:choose></xsl:attribute>
  228. <xsl:attribute name="aria-labelledBy">
  229. <xsl:choose>
  230. <xsl:when test="$collapsed='true'">
  231. <xsl:value-of select="concat('_THIS_',$group_number,'_groupcaption',' _THIS_group_image_',$group_number)"/>
  232. </xsl:when>
  233. <xsl:otherwise>
  234. <xsl:value-of select="concat('_THIS_',$group_number,'_groupcaption',' _THIS_group_image_',$group_number)"/>
  235. </xsl:otherwise>
  236. </xsl:choose>
  237. </xsl:attribute>
  238. <xsl:attribute name="aria-expanded">
  239. <xsl:value-of select="not(uic:features/uic:collapsed='true')"/>
  240. </xsl:attribute>
  241. <xsl:attribute name="title">
  242. <xsl:choose>
  243. <xsl:when test="$collapsed='true'">
  244. <xsl:value-of select="$expandTooltip"/>
  245. </xsl:when>
  246. <xsl:otherwise>
  247. <xsl:value-of select="$collapseTooltip"/>
  248. </xsl:otherwise>
  249. </xsl:choose>
  250. </xsl:attribute>
  251. <xsl:attribute name="aria-expanded">
  252. <xsl:value-of select="not(uic:features/uic:collapsed='true')"/>
  253. </xsl:attribute>
  254. <xsl:attribute name="aria-expanded">
  255. <xsl:value-of select="not($collapsed = 'true')"/>
  256. </xsl:attribute>
  257. <xsl:attribute name="onfocus">if (_THIS_.getGroupDescription){document.getElementById('_THIS_metricGroupDescription').innerText=_THIS_.getGroupDescription(<xsl:value-of select="$group_number"/>)}</xsl:attribute>
  258. </img>
  259. </td>
  260. <!-- empty spacer column -->
  261. <td height="15" width="1" role="separator">
  262. <img height="15" width="1" src="{$serverWebcontentPath}images/space.gif" alt="" role="separator"/>
  263. </td>
  264. <td class="cogstyle-table-group-title" scope="row">
  265. <span id="{concat('_THIS_',$group_number,'_groupcaption')}">
  266. <xsl:apply-templates select="uic:name"/>
  267. </span>
  268. <xsl:apply-templates select="uic:icon"/>
  269. </td>
  270. <!-- empty spacer column -->
  271. <td height="15" width="1" role="separator">
  272. <img height="15" width="1" src="{$serverWebcontentPath}images/space.gif" alt=""/>
  273. </td>
  274. <td>
  275. <xsl:attribute name="colspan"><xsl:value-of select="2*(count(//uic:header/uic:row/uic:column))"/></xsl:attribute>
  276. <span>
  277. <xsl:if test="not($collapsed='true')">
  278. <xsl:attribute name="style">display:none</xsl:attribute>
  279. </xsl:if>
  280. <xsl:attribute name="id">_THIS_group_summary_<xsl:value-of select="$group_number"/></xsl:attribute>
  281. <xsl:apply-templates select="uic:summary"/>
  282. </span>
  283. </td>
  284. </tr>
  285. <xsl:apply-templates select="uic:row">
  286. <xsl:with-param name="groupPosition" select="$group_number"/>
  287. <xsl:with-param name="visible" select="not($collapsed='true')"/>
  288. <xsl:with-param name="tableFeatures">
  289. <xsl:copy-of select="$tableFeatures"/>
  290. </xsl:with-param>
  291. <xsl:with-param name="withRowDetails" select="boolean(./uic:rowDetails)"/>
  292. </xsl:apply-templates>
  293. </xsl:template>
  294. <!--
  295. Deals with rows and rowDetails
  296. -->
  297. <xsl:template match="uic:row | uic:rowDetails">
  298. <xsl:param name="groupPosition" select="''"/>
  299. <xsl:param name="visible" select="'true'"/>
  300. <xsl:param name="tableFeatures"/>
  301. <xsl:param name="withRowDetails" select="false()"/>
  302. <!--
  303. each item to be displayed has two elements in the DOM tree (a uic:row element and a uic:rowDetails element);
  304. we need to alternate row backgrounds between even (uic:row) elements only; hence the calculation below
  305. -->
  306. <xsl:variable name="curPos">
  307. <xsl:choose>
  308. <xsl:when test="$withRowDetails = 'true'">
  309. <xsl:value-of select="floor(((position()-1) div 2) mod 2)"/>
  310. </xsl:when>
  311. <xsl:otherwise>
  312. <xsl:value-of select="position() mod 2"/>
  313. </xsl:otherwise>
  314. </xsl:choose>
  315. </xsl:variable>
  316. <tr id="{concat($groupPosition,'_',position())}">
  317. <xsl:if test="@lang != ''">
  318. <xsl:attribute name="lang"><xsl:value-of select="@lang"/></xsl:attribute>
  319. </xsl:if>
  320. <xsl:attribute name="class">
  321. <xsl:choose>
  322. <xsl:when test="@selected = 'true'">cogstyle-table-row-selected</xsl:when>
  323. <xsl:when test="$tableFeatures/uic:listViewSeparator = 'background' and $curPos=1">cogstyle-table-row-alternate</xsl:when>
  324. </xsl:choose>
  325. </xsl:attribute>
  326. <xsl:attribute name="style">
  327. <xsl:if test="not($visible='true') or (local-name()='rowDetails' and @expanded != 'true')">display: none;</xsl:if>
  328. <xsl:if test="$tableFeatures/uic:type = 'selection'">cursor:pointer</xsl:if>
  329. </xsl:attribute>
  330. <!-- row id -->
  331. <xsl:choose>
  332. <xsl:when test="$groupPosition != ''">
  333. <xsl:attribute name="id">_THIS_group_<xsl:value-of select="concat($groupPosition, '_', position())"/></xsl:attribute>
  334. </xsl:when>
  335. <xsl:when test="@id">
  336. <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  337. </xsl:when>
  338. <xsl:when test="local-name()='rowDetails'">
  339. <xsl:attribute name="id">_THIS_rowDetails</xsl:attribute>
  340. </xsl:when>
  341. </xsl:choose>
  342. <xsl:if test="$tableFeatures/uic:type = 'selection'">
  343. <xsl:attribute name="onmouseover">if (this.className!='cogstyle-table-row-selected')this.className='cogstyle-table-row-alternate'</xsl:attribute>
  344. <xsl:attribute name="onmouseout">if (this.className!='cogstyle-table-row-selected') this.className = '<xsl:choose><xsl:when test="$tableFeatures/uic:listViewSeparator = 'background' and $curPos=1">cogstyle-table-row-alternate</xsl:when><xsl:otherwise>cogstyle-table-row-default</xsl:otherwise></xsl:choose>'</xsl:attribute>
  345. <xsl:attribute name="onclick">toggleHighlight('_THIS_', this, _THIS_alternate)</xsl:attribute>
  346. </xsl:if>
  347. <xsl:if test="@onmouseup">
  348. <xsl:attribute name="onmouseup"><xsl:value-of select="@onmouseup"/></xsl:attribute>
  349. </xsl:if>
  350. <!-- checkbox column -->
  351. <xsl:if test="$tableFeatures/uic:type = 'checkbox'">
  352. <td onclick="cancelBubble(event)" scope="col">
  353. <xsl:choose>
  354. <xsl:when test="$tableFeatures/uic:listViewSeparator = 'line'">
  355. <xsl:attribute name="class"><xsl:value-of select="'cogstyle-table-row-separator'"/></xsl:attribute>
  356. </xsl:when>
  357. <xsl:otherwise>
  358. <xsl:attribute name="class"><xsl:value-of select="'cogstyle-table-row-default'"/></xsl:attribute>
  359. </xsl:otherwise>
  360. </xsl:choose>
  361. <xsl:if test="@hideCheckbox != 'true' and local-name()!= 'rowDetails'">
  362. <xsl:call-template name="uic:genSelectRowCheckbox">
  363. <xsl:with-param name="tableName" select="$tableFeatures/uic:name"/>
  364. </xsl:call-template>
  365. </xsl:if>
  366. </td>
  367. <!-- empty spacer column -->
  368. <td height="15" width="1" role="separator">
  369. <img height="15" width="1" src="{$serverWebcontentPath}images/space.gif" alt=""/>
  370. </td>
  371. </xsl:if>
  372. <xsl:if test="$tableFeatures/uic:type = 'group'">
  373. <td role="presentation">
  374. <xsl:if test="$tableFeatures/uic:listViewSeparator = 'line'">
  375. <xsl:attribute name="class"><xsl:value-of select="'cogstyle-table-row-separator'"/></xsl:attribute>
  376. </xsl:if>
  377. <xsl:text>&#160;</xsl:text>
  378. </td>
  379. <!-- empty spacer column -->
  380. <td height="15" width="1" role="presentation">
  381. <img height="15" width="1" src="{$serverWebcontentPath}images/space.gif" alt=""/>
  382. </td>
  383. </xsl:if>
  384. <xsl:apply-templates select="*">
  385. <xsl:with-param name="tableFeatures">
  386. <xsl:copy-of select="$tableFeatures"/>
  387. </xsl:with-param>
  388. </xsl:apply-templates>
  389. </tr>
  390. </xsl:template>
  391. <!--
  392. creates a column in the table
  393. -->
  394. <xsl:template match="uic:column">
  395. <xsl:param name="type" select="''"/>
  396. <xsl:param name="tableFeatures"/>
  397. <xsl:variable name="tdType">
  398. <xsl:choose>
  399. <xsl:when test="$type='header'">th</xsl:when>
  400. <xsl:otherwise>td</xsl:otherwise>
  401. </xsl:choose>
  402. </xsl:variable>
  403. <xsl:element name="{$tdType}">
  404. <xsl:copy-of select="@*[not(contains(' nowrap colspan onclick ', concat(' ', local-name(), ' ')))]"/>
  405. <xsl:if test="$tdType='th' and not(@scope)">
  406. <xsl:attribute name="scope">col</xsl:attribute>
  407. </xsl:if>
  408. <xsl:if test="@nowrap">
  409. <xsl:attribute name="nowrap">nowrap</xsl:attribute>
  410. </xsl:if>
  411. <xsl:if test="@colspan">
  412. <xsl:attribute name="colspan"><xsl:value-of select="2*(number(@colspan))-1"/></xsl:attribute>
  413. </xsl:if>
  414. <xsl:if test="@onclick">
  415. <xsl:attribute name="onclick"><xsl:value-of select="@onclick"/></xsl:attribute>
  416. <xsl:attribute name="onkeyup">if (event.keyCode == 13) {<xsl:value-of select="@onclick"/>}</xsl:attribute>
  417. </xsl:if>
  418. <xsl:if test="$tableFeatures/uic:listViewSeparator = 'line' and $type != 'header' and $type != 'footer'">
  419. <xsl:attribute name="class"><xsl:value-of select="'cogstyle-table-row-separator'"/></xsl:attribute>
  420. </xsl:if>
  421. <xsl:attribute name="style">
  422. <xsl:value-of select="concat(@style, 'text-align:left;padding-right:5px;')"/>
  423. <xsl:choose>
  424. <xsl:when test="@indent != ''">padding-left:<xsl:value-of select="number(@indent) * 20"/>px;</xsl:when>
  425. <xsl:otherwise>padding-left:5px;</xsl:otherwise>
  426. </xsl:choose>
  427. </xsl:attribute>
  428. <xsl:choose>
  429. <!-- build the sort column header-->
  430. <xsl:when test="@sort and @sort !=''">
  431. <xsl:variable name="lbl_abbr">
  432. <xsl:apply-templates select="uic:text"/>
  433. </xsl:variable>
  434. <xsl:if test="$lbl_abbr != ''">
  435. <xsl:attribute name="abbr"><xsl:value-of select="xtsext:htmlencode($lbl_abbr)"/></xsl:attribute>
  436. </xsl:if>
  437. <xsl:variable name="imgSrc">
  438. <xsl:choose>
  439. <xsl:when test="$tableFeatures/uic:sortColumn and @sort = $tableFeatures/uic:sortColumn">
  440. <xsl:choose>
  441. <xsl:when test="$tableFeatures/uic:sortOrder and $tableFeatures/uic:sortOrder = 'descending'">list_sort_descending.gif</xsl:when>
  442. <xsl:when test="$tableFeatures/uic:sortOrder and $tableFeatures/uic:sortOrder = 'ascending'">list_sort_ascending.gif</xsl:when>
  443. <xsl:otherwise>list_sort_no.gif</xsl:otherwise>
  444. </xsl:choose>
  445. </xsl:when>
  446. <xsl:otherwise>list_sort_no.gif</xsl:otherwise>
  447. </xsl:choose>
  448. </xsl:variable>
  449. <xsl:variable name="tooltipMsg">
  450. <xsl:choose>
  451. <xsl:when test="$tableFeatures/uic:sortColumn and @sort = $tableFeatures/uic:sortColumn">
  452. <xsl:choose>
  453. <xsl:when test="$tableFeatures/uic:sortOrder and $tableFeatures/uic:sortOrder = 'descending'"><xsl:value-of select="$pagerSortDescendingTooltip"/></xsl:when>
  454. <xsl:when test="$tableFeatures/uic:sortOrder and $tableFeatures/uic:sortOrder = 'ascending'"><xsl:value-of select="$pagerSortAscendingTooltip"/></xsl:when>
  455. <xsl:otherwise><xsl:value-of select="$pagerSortDefaultTooltip"/></xsl:otherwise>
  456. </xsl:choose>
  457. </xsl:when>
  458. <xsl:otherwise><xsl:value-of select="$pagerSortDefaultTooltip"/></xsl:otherwise>
  459. </xsl:choose>
  460. </xsl:variable>
  461. <xsl:variable name="onclick"><xsl:value-of select="concat('sortGo(_THIS_,&quot;', @sort, '&quot;, &quot;', $tableFeatures/uic:sortColumn, '&quot;,&quot;' , $tableFeatures/uic:sortOrder, '&quot;,&quot;', $tableFeatures/uic:pageParams,'&quot;,evalParm(&quot;',$tableFeatures/uic:interactionParams,'&quot;))')"/></xsl:variable>
  462. <a href="#" onclick="{$onclick}" role="button">
  463. <span><xsl:apply-templates select="*"/></span>
  464. <img src="{$skinWebcontentPath}{$imgSrc}" style="vertical-align: middle; border: 0;">
  465. <xsl:attribute name="alt"><xsl:value-of select="$tooltipMsg"/></xsl:attribute>
  466. <xsl:attribute name="title"><xsl:value-of select="$tooltipMsg"/></xsl:attribute>
  467. </img>
  468. </a>
  469. </xsl:when>
  470. <!-- build the regular column header-->
  471. <xsl:otherwise>
  472. <xsl:apply-templates select="*"/>
  473. </xsl:otherwise>
  474. </xsl:choose>
  475. </xsl:element>
  476. <!-- column dividers: vertical lines for header and empty space for table body -->
  477. <xsl:if test="$type != 'footer'">
  478. <xsl:element name="{$tdType}">
  479. <xsl:attribute name="height">15</xsl:attribute>
  480. <xsl:attribute name="role">separator</xsl:attribute>
  481. <xsl:attribute name="aria-orientation">vertical</xsl:attribute>
  482. <xsl:if test="$tdType='th'">
  483. <xsl:attribute name="scope">col</xsl:attribute>
  484. </xsl:if>
  485. <xsl:if test="position() = last()">
  486. <xsl:attribute name="width">141px</xsl:attribute><!-- stops right-hand columns from expanding too wide -->
  487. </xsl:if>
  488. <table cellpadding="0" cellspacing="0" border="0" role="presentation">
  489. <tr>
  490. <td style="padding:0px">
  491. <img height="15" width="1" src="{$serverWebcontentPath}images/space.gif" alt="">
  492. <xsl:if test="$type = 'header' and position() != last()">
  493. <xsl:attribute name="style">background-color:#9C9C9C</xsl:attribute>
  494. </xsl:if>
  495. </img>
  496. </td>
  497. </tr>
  498. </table>
  499. </xsl:element>
  500. </xsl:if>
  501. </xsl:template>
  502. <xsl:template match="uic:filterSummary">
  503. <xsl:param name="prefix" select="''"/>
  504. <div style="float: left; vertical-align: text-top;">
  505. <img src="{$cogadminWebcontentPath}action_filter.gif">
  506. <xsl:attribute name="title"><xsl:value-of select="$filterTitle"/></xsl:attribute>
  507. <xsl:attribute name="alt"><xsl:value-of select="$filterTitle"/></xsl:attribute>
  508. </img>
  509. <xsl:for-each select="item">
  510. <span style="padding-left:0.6em;font-weight:bold;vertical-align:text-top;"><xsl:value-of select="label"/></span>
  511. <span style="padding-left:0.2em;vertical-align:text-top;"><xsl:value-of select="concat('[ ',value,' ]')"/></span>
  512. </xsl:for-each>
  513. </div>
  514. </xsl:template>
  515. <xsl:template match="uic:paginations">
  516. <xsl:param name="pagerName" select="''"/>
  517. <xsl:param name="interactionParams" select="''"/>
  518. <xsl:param name="sortParams" select="''"/>
  519. <xsl:variable name="javascriptEncodedPageName" select="xtsext:javascriptencode(string($pagerName))"/>
  520. <xsl:variable name="prev_skip">
  521. <xsl:choose>
  522. <xsl:when test="uic:from and uic:linesPerPage and (number(uic:from) - number(uic:linesPerPage) &gt; 0)">
  523. <xsl:value-of select="number(uic:from) - number(uic:linesPerPage) -1"/>
  524. </xsl:when>
  525. <xsl:otherwise>0</xsl:otherwise>
  526. </xsl:choose>
  527. </xsl:variable>
  528. <xsl:variable name="pageEnd">
  529. <xsl:choose>
  530. <xsl:when test="uic:to and number(uic:to)">
  531. <xsl:value-of select="number(uic:to)"/>
  532. </xsl:when>
  533. <xsl:otherwise>0</xsl:otherwise>
  534. </xsl:choose>
  535. </xsl:variable>
  536. <xsl:variable name="linesPerPage">
  537. <xsl:choose>
  538. <xsl:when test="uic:linesPerPage and number(uic:linesPerPage)">
  539. <xsl:value-of select="number(uic:linesPerPage)"/>
  540. </xsl:when>
  541. <xsl:otherwise>15</xsl:otherwise>
  542. </xsl:choose>
  543. </xsl:variable>
  544. <script>
  545. var pager_validation_msg_array = new Array();
  546. pager_validation_msg_array['IDS_PAGER_FROM_INVALID'] = '<xsl:value-of select="$pagerFromInvalid"/>';
  547. pager_validation_msg_array['IDS_PAGER_TO_INVALID'] = '<xsl:value-of select="$pagerToInvalid"/>';
  548. pager_validation_msg_array['IDS_PAGER_ENTRIES_INVALID'] = '<xsl:value-of select="$pagerEntriesInvalid"/>';
  549. pager_validation_msg_array['IDS_PAGER_ENTRIES_EMPTY'] = '<xsl:value-of select="$pagerEntriesEmpty"/>';
  550. </script>
  551. <div class="cogstyle-table-paginations">
  552. <table cellpadding="0" cellspacing="0" style="padding:1px;height:20px;" role="presentation">
  553. <tr>
  554. <td class="cogstyle-form-text" nowrap="nowrap" style="padding-right:5px;">
  555. <xsl:value-of select="$pagerItemsMsg"/>
  556. </td>
  557. <td>
  558. <input id="{$pagerName}_from" name="{$pagerName}_from" type="text" size="4" class="cogstyle-form-text" maxlength="9" aria-label="{uic:fromLabel}">
  559. <xsl:attribute name="value">
  560. <xsl:if test="number(uic:from) &gt; 0"><xsl:value-of select="number(uic:from)"/></xsl:if>
  561. </xsl:attribute>
  562. </input>
  563. </td>
  564. <td class="cogstyle-form-text" style="padding-right:5px; padding-left: 5px;">-</td>
  565. <td>
  566. <input id="{$pagerName}_to" name="{$pagerName}_to" type="text" size="4" class="cogstyle-form-text" maxlength="9" aria-label="{uic:toLabel}">
  567. <xsl:attribute name="value">
  568. <xsl:if test="number(uic:to) &gt; 0"><xsl:value-of select="number(uic:to)"/></xsl:if>
  569. </xsl:attribute>
  570. </input>
  571. </td>
  572. <td style="padding-right:8px;padding-left:2px;">
  573. <xsl:apply-templates select="uic:goto">
  574. <xsl:with-param name="imageEnabled" select="'action_go.gif'"/>
  575. <xsl:with-param name="defaultOnClickParams" select="$sortParams"/>
  576. <xsl:with-param name="interactionParams" select="$interactionParams"/>
  577. <xsl:with-param name="pagerName" select="$javascriptEncodedPageName"/>
  578. <xsl:with-param name="iconTooltip" select="$pagerGoto"/>
  579. </xsl:apply-templates>
  580. </td>
  581. <td nowrap="nowrap">
  582. <div style="height:13px;" class="rowDivider"/>
  583. </td>
  584. <td nowrap="nowrap" style="padding-left:8px;">
  585. <xsl:apply-templates select="uic:first">
  586. <xsl:with-param name="imageEnabled" select="'control_btn_top.gif'"/>
  587. <xsl:with-param name="imageDisabled" select="'control_btn_top_disabled.gif'"/>
  588. <xsl:with-param name="defaultOnClickParams" select="concat($javascriptEncodedPageName ,'_skip=0&amp;', $sortParams)"/>
  589. <xsl:with-param name="interactionParams" select="$interactionParams"/>
  590. <xsl:with-param name="iconTooltip" select="$pagerFirst"/>
  591. </xsl:apply-templates>
  592. <xsl:apply-templates select="uic:previous">
  593. <xsl:with-param name="imageEnabled" select="'control_btn_pageup.gif'"/>
  594. <xsl:with-param name="imageDisabled" select="'control_btn_pageup_disabled.gif'"/>
  595. <xsl:with-param name="defaultOnClickParams" select="concat($javascriptEncodedPageName ,'_skip=', number($prev_skip), '&amp;', $sortParams)"/>
  596. <xsl:with-param name="interactionParams" select="$interactionParams"/>
  597. <xsl:with-param name="iconTooltip" select="$pagerPrevious"/>
  598. </xsl:apply-templates>
  599. <xsl:apply-templates select="uic:next">
  600. <xsl:with-param name="imageEnabled" select="'control_btn_pagedown.gif'"/>
  601. <xsl:with-param name="imageDisabled" select="'control_btn_pagedown_disabled.gif'"/>
  602. <xsl:with-param name="defaultOnClickParams" select="concat($javascriptEncodedPageName ,'_skip=', number($pageEnd), '&amp;', $sortParams)"/>
  603. <xsl:with-param name="interactionParams" select="$interactionParams"/>
  604. <xsl:with-param name="iconTooltip" select="$pagerNext"/>
  605. </xsl:apply-templates>
  606. <xsl:apply-templates select="uic:last">
  607. <xsl:with-param name="imageEnabled" select="'control_btn_bottom.gif'"/>
  608. <xsl:with-param name="imageDisabled" select="'control_btn_bottom_disabled.gif'"/>
  609. <xsl:with-param name="defaultOnClickParams" select="concat($javascriptEncodedPageName ,'_skip=-', number($linesPerPage), '&amp;', $sortParams)"/>
  610. <xsl:with-param name="interactionParams" select="$interactionParams"/>
  611. <xsl:with-param name="iconTooltip" select="$pagerLast"/>
  612. </xsl:apply-templates>
  613. </td>
  614. </tr>
  615. </table>
  616. </div>
  617. <div style="clear:both; margin-bottom: 3px;"/>
  618. </xsl:template>
  619. <xsl:template match="uic:goto | uic:first | uic:previous | uic:next | uic:last">
  620. <xsl:param name="imageEnabled" select="''"/>
  621. <xsl:param name="imageDisabled" select="''"/>
  622. <xsl:param name="defaultOnClickParams" select="''"/>
  623. <xsl:param name="interactionParams" select="''"/>
  624. <xsl:param name="pagerName" select="''"/>
  625. <xsl:param name="iconTooltip" select="''"/>
  626. <xsl:variable name="isNavgoto">
  627. <xsl:choose>
  628. <xsl:when test="local-name(.) = 'goto'">true</xsl:when>
  629. <xsl:otherwise>false</xsl:otherwise>
  630. </xsl:choose>
  631. </xsl:variable>
  632. <xsl:choose>
  633. <xsl:when test="./uic:disabled">
  634. <img style="margin-right: 2px;" class="button" border="0" src="{$skinWebcontentPath}{$imageDisabled}">
  635. <xsl:attribute name="title"><xsl:value-of select="$iconTooltip"/></xsl:attribute>
  636. <xsl:attribute name="alt"><xsl:value-of select="$iconTooltip"/></xsl:attribute>
  637. </img>
  638. </xsl:when>
  639. <xsl:otherwise>
  640. <img style="margin-right: 2px; cursor: pointer;" tabindex="0" class="button" role="button" border="0" src="{$skinWebcontentPath}{$imageEnabled}" onmousedown="this.className='button_pressed'" onmouseover="this.className='button_hover'" onmouseout="this.className='button'">
  641. <xsl:attribute name="title"><xsl:value-of select="$iconTooltip"/></xsl:attribute>
  642. <xsl:attribute name="alt"><xsl:value-of select="$iconTooltip"/></xsl:attribute>
  643. <xsl:attribute name="onkeypress">
  644. <xsl:text>if (event.keyCode==13 || event.keyCode==32 || event.charCode==32){this.onclick();return false;}</xsl:text>
  645. </xsl:attribute>
  646. <xsl:attribute name="onclick">
  647. <xsl:choose>
  648. <xsl:when test="uic:link"><xsl:value-of select="uic:link"/></xsl:when>
  649. <!-- build the default action -->
  650. <xsl:when test="$isNavgoto = 'true'">
  651. <xsl:text/>
  652. <xsl:value-of select="concat('navGo(_THIS_,&quot;', $pagerName, '&quot;, &quot;', $defaultOnClickParams, '&quot;,evalParm(&quot;',$interactionParams,'&quot;));')"/>
  653. <xsl:text/>
  654. </xsl:when>
  655. <xsl:when test="$defaultOnClickParams != '' or $interactionParams != ''">
  656. <xsl:text/>
  657. <xsl:value-of select="concat('navOthers(_THIS_, &quot;', $defaultOnClickParams, '&quot;,evalParm(&quot;',$interactionParams,'&quot;));')"/>
  658. <xsl:text/>
  659. </xsl:when>
  660. </xsl:choose>
  661. </xsl:attribute>
  662. </img>
  663. </xsl:otherwise>
  664. </xsl:choose>
  665. </xsl:template>
  666. </xsl:stylesheet>