<!--!
Table style account/user list.

Arguments:
 - accounts:
 - delete_enabled:
 - cls:
 - cols:
-->
<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:py="http://genshi.edgewall.org/" 
     xmlns:i18n="http://genshi.edgewall.org/i18n"
     i18n:domain="acct_mgr"
     id="accountlist">
  <table class="$cls" id="accountlist">
    <thead>
      <tr>
        <th class="sel" py:if="delete_enabled">&nbsp;</th>
        <th>Account</th>
        <th py:if="'name' in cols">Name</th>
        <th py:if="'email' in cols">Email</th>
        <th>Last Login</th>
      </tr>
    </thead>
    <tbody>
      <py:for each="idx, acct in enumerate(accounts)">
        <py:with vars="odd_even = ('even', 'odd')[idx % 2]">
          <tr class="$odd_even">
            <td py:if="delete_enabled">
              <input type="checkbox" name="sel"
                     value="${acct.username}" />
            </td>
            <td>
              <a href="${acct.review_url}">${acct.username}</a>
              <!--! Additional account status icons -->
              <py:choose py:if="acct.locked">
                <img src="${href.chrome('/acct_mgr/time-locked.png')}"
                     py:when="acct.release_hint" alt="Account locked"
                     title="${acct.release_hint}" />
                <img src="${href.chrome('/acct_mgr/locked.png')}"
                     py:otherwise="" alt="Permanently locked"
                     title="${dgettext('acct_mgr', 'Permanently locked')}" />
              </py:choose>
            </td>
            <td py:if="'name' in cols">${acct.name}</td>
            <td py:if="'email' in cols">${acct.email}</td>
            <!--! Trac >= 0.13: 'pretty_dateinfo' calls 'user_time' here -->
            <py:if test="pretty_dateinfo">
              <td>${acct.last_visit and pretty_date(acct.last_visit) or ''}</td>
            </py:if>
            <!--! pre-trac-0.13 fallback: always show absolute time here -->
            <py:if test="not pretty_dateinfo">
              <td>${acct.last_visit and \
                    pretty_date(acct.last_visit, format='absolute') or ''}</td>
            </py:if>
          </tr>
        </py:with>
      </py:for>
    </tbody>
  </table>
</div>
