user-index.xsl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:eat="http://msqr.us/xsd/ieat"
  4. xmlns:xweb="http://msqr.us/xsd/jaxb-web"
  5. exclude-result-prefixes="eat xweb">
  6. <!-- imports -->
  7. <xsl:import href="tmpl/default-layout.xsl"/>
  8. <!-- layout variables -->
  9. <xsl:variable name="layout.global.nav.page" select="''"/>
  10. <xsl:template match="xweb:x-data" mode="page-title">
  11. <xsl:value-of select="key('i18n','user-index.title')"/>
  12. </xsl:template>
  13. <xsl:template match="xweb:x-data" mode="page-head-content">
  14. <script type="text/javascript" xml:space="preserve">
  15. <xsl:comment>
  16. var W3CDOM = (document.getElementById &amp;&amp; true);
  17. function handlePaginationChange(event) {
  18. if ( event.target.form) {
  19. event.target.form.submit();
  20. }
  21. }
  22. function init() {
  23. if ( !W3CDOM ) {
  24. alert("Your browser does not support DOM");
  25. return;
  26. }
  27. var pageSelect = document.getElementById("pagination-select");
  28. if ( pageSelect ) {
  29. pageSelect.onchange = handlePaginationChange;
  30. }
  31. }
  32. window.onload = init;
  33. //</xsl:comment>
  34. </script>
  35. </xsl:template>
  36. <xsl:template match="xweb:x-data" mode="page-body">
  37. <xsl:apply-templates select="xweb:x-model/eat:search-results"/>
  38. </xsl:template>
  39. <xsl:template match="eat:search-results">
  40. <xsl:call-template name="render-ui-index">
  41. <xsl:with-param name="ui-index" select="eat:ui-index"/>
  42. <xsl:with-param name="link" select="'/users.do'"/>
  43. </xsl:call-template>
  44. <xsl:variable name="total-count" select="eat:ui-index/eat:index-section[@selected]/@count"/>
  45. <xsl:if test="@pageSize &gt; 0 and $total-count &gt; @pageSize">
  46. <div class="page-navigation">
  47. <xsl:value-of select="key('i18n','user-index.pages.displayName')"/>
  48. <xsl:text>: </xsl:text>
  49. <xsl:call-template name="render-index-navigation">
  50. <xsl:with-param name="search-results" select="."/>
  51. <xsl:with-param name="max-page" select="ceiling($total-count div @pageSize)"/>
  52. <xsl:with-param name="link" select="'/users.do'"/>
  53. </xsl:call-template>
  54. </div>
  55. </xsl:if>
  56. <!-- Render <select> menu for pagination support -->
  57. <xsl:apply-templates select="." mode="render-index-pagination-menu"/>
  58. <ol class="recipe-index" start="{(@pageStart * @pageSize) + 1}">
  59. <xsl:apply-templates select="eat:user"/>
  60. </ol>
  61. </xsl:template>
  62. <xsl:template match="eat:search-results/eat:user">
  63. <li>
  64. <span class="recipe-title">
  65. <a class="go">
  66. <xsl:attribute name="href">
  67. <xsl:value-of select="$web-context"/>
  68. <xsl:text>/user.do?userId=</xsl:text>
  69. <xsl:value-of select="@userId"/>
  70. <xsl:text>&amp;index.displaySection=</xsl:text>
  71. <xsl:value-of select="../eat:ui-index/eat:index-section[@selected='true']/@index-key"/>
  72. <xsl:if test="../@pageSize">
  73. <xsl:text>&amp;index.pageSize=</xsl:text>
  74. <xsl:value-of select="../@pageSize"/>
  75. </xsl:if>
  76. <xsl:if test="../@pageStart">
  77. <xsl:text>&amp;index.pageStart=</xsl:text>
  78. <xsl:value-of select="../@pageStart"/>
  79. </xsl:if>
  80. </xsl:attribute>
  81. <xsl:value-of select="eat:name"/>
  82. </a>
  83. </span>
  84. <xsl:text> (</xsl:text>
  85. <xsl:value-of select="@login"/>
  86. <xsl:text>)</xsl:text>
  87. <p>
  88. <xsl:value-of select="eat:email"/>
  89. </p>
  90. </li>
  91. </xsl:template>
  92. </xsl:stylesheet>