<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 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="tracspamfilter">
  <xi:include href="admin.html" />
  <head>
    <title>Spam User Handling</title>
  </head>

  <body>
    <h2 i18n:msg="type, count">Spam Filtering: User handling (${usertype})
       <span class="entryinfo" py:if="stats">${entrytext}</span>
    </h2>

    <div class="nav">
      <ul>
        <li class="first"><a href="user?mode=overview">Overview</a></li>
        <li><a href="user?mode=all">All</a></li>
        <li><a href="user?mode=authorized">Registered</a></li>
        <li py:if="accmgr"><a href="user?mode=unusedmulti">Unused [multi selection]</a></li>
        <li class="last"><a href="user?mode=unused">Unused</a></li>
      </ul>
    </div>

    <div py:if="stats" i18n:msg="total, registered, unused">There are ${stats['numtotal']}
    different entries in the database, ${stats['numauthorized']} users are
    registered and ${stats['numunused']} have not been used.</div>

    <table class="listing" id="userinfo" py:if="username">
      <thead>
        <tr>
          <th>Date</th>
          <th i18n:msg="username">Action of user '${username}'</th>
        </tr>
      </thead>
      <tbody>
        <py:for each="date, link, action in user">
          <tr>
            <td>${format_datetime(date) if date else "-"}</td>
            <td py:if="link"><a href="${href(link)}">${action}</a></td>
            <td py:if="not link">${action}</td>
          </tr>
        </py:for>
      </tbody>
    </table>
    <py:choose test="accmgr and mode == 'unusedmulti'">
      <py:when test="True">
        <form action="${href.admin('accounts/users')}" method="post">
          <xi:include href="usertable.html" />
          <div class="buttons">
            <input type="hidden" name="mode" value="$mode" />
            <input class="dangerbutton" type="submit" name="remove"
                   value="${dgettext('tracspamfilter', 'Remove selected')}" />
          </div>
        </form>
      </py:when>
      <py:otherwise><xi:include href="usertable.html" /></py:otherwise>
    </py:choose>

    <form method="post" action="">
      <h4 py:if="encoded">Values must be URL encoded!</h4>
      <div class="buttons">
        <label>Old user:
          <input type="text" id="userold" name="userold" size="30" value="" />
        </label>
        <label>New user:
           <input type="text" id="usernew" name="usernew" size="30" value="" />
        </label>
        <input type="hidden" name="mode" value="$mode" />
        <input py:if="encoded" type="hidden" name="encoded" value="1" />
        <input py:if="auth" type="hidden" name="auth" value="$auth" />
        <input type="submit" name="changeuser" value="${dgettext('tracspamfilter', 'Change unauthorized user')
                                                        if not auth else dgettext('tracspamfilter', 'Change user')}" />
      </div>
    </form>

    <div class="buttons">
      <form method="post" action=""><div>
        <input type="hidden" name="mode" value="$mode" />
        <input type="submit" name="cleantemp" value="${dngettext('tracspamfilter', 'Remove %(num)s temporary session',
                                                                 'Remove %(num)s temporary sessions', tempcount)}" />
      </div></form>
      <form method="post" action=""><div>
        <input type="hidden" name="mode" value="$mode" />
        <input type="submit" name="fixemails" value="${dgettext('tracspamfilter', 'Convert emails to registered usernames')}" />
      </div></form>
    </div>

  </body>

</html>
