<!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>Captcha handling</title>
  </head>

  <body>
    <h2>Spam Filtering: Captcha handling</h2>

    <form class="mod" id="spamconfig" method="post" action="">

      <div class="field">
        <label>
          <input id="captcha_enabled" type="checkbox" name="captcha_enabled"
                 checked="${captcha_enabled or None}" />
          Enable captcha usage
        </label>
      </div>

      <div id="captcha_block">

        <div class="field">
          Captcha type:
          <select name="captcha">
            <option py:for="captcha_type in captcha_types"
                    selected="${'selected' if captcha == captcha_type else None}"
                    value="${captcha_type}">${captcha_type}</option>
          </select>
        </div>

        <div class="field">
          <label>Maximum captcha lifetime in seconds
            <input id="captcha_karma_lifetime" type="text"
                   name="captcha_karma_lifetime" size="7"
                   value="${captcha_karma_lifetime}" />
          </label>
        </div>

        <fieldset py:if="recaptcha_enabled">
          <legend>reCAPTCHA</legend>
          <p class="hint" i18n:msg="">
            The reCAPTCHA system provides a very good captcha system based on
            scanned books. See
            <a class="ext-link" href="http://www.google.com/recaptcha">Google
            reCAPTCHA</a> page. You need to obtain
            API keys to use the service, which is freely available for personal use.
          </p>
          <div class="field">
            <table>
              <tr>
                <td>Public key:</td>
                <td><input id="recaptcha_public_key" type="text"
                           name="recaptcha_public_key" size="50"
                           value="${recaptcha_public_key}" />
                </td>
              </tr>
              <tr>
                <td>Private key:</td>
                <td><input id="recaptcha_private_key" type="text"
                           name="recaptcha_private_key" size="50"
                           value="${recaptcha_private_key}" />
                </td>
              </tr>
            </table>
          </div>

          <div py:if="recaptcha_error" class="system-message">
            <strong>Key validation failed:</strong> ${recaptcha_error}
          </div>
        </fieldset>

        <fieldset py:if="keycaptcha_enabled">
          <legend>KeyCaptcha</legend>
          <p class="hint" i18n:msg="">
            The KeyCatcha system provides a captcha system based on JavaScript
            functions to reassemble a picture. See
            <a class="ext-link" href="http://www.keycaptcha.com">KeyCaptcha</a>
            page. You need to obtain an API key to use the service, which is
            freely available for limited use.
          </p>
          <div class="field">
            <table>
              <tr>
                <td>User ID:</td>
                <td><input id="keycaptcha_user_id" type="text"
                           name="keycaptcha_user_id" size="50"
                           value="${keycaptcha_user_id}" /></td>
              </tr>
              <tr>
                <td>Private key:</td>
                <td><input id="keycaptcha_private_key" type="text"
                           name="keycaptcha_private_key" size="50"
                           value="${keycaptcha_private_key}" /></td>
              </tr>
            </table>
          </div>

          <div py:if="keycaptcha_error" class="system-message">
            <strong>Key validation failed:</strong> ${keycaptcha_error}
          </div>
        </fieldset>

        <fieldset py:if="expressioncaptcha_enabled">
          <legend>Text captcha</legend>
          <p class="hint">
            The text captcha constructs easy text questions. They can be
            broken relatively easy.
          </p>
          <div class="field">
            <table>
              <tr>
                <td>Maximum value in a term:</td>
                <td><input id="expressioncaptcha_ceiling" type="text"
                           name="expressioncaptcha_ceiling" size="7"
                           value="${expressioncaptcha_ceiling}" /></td>
              </tr>
              <tr>
                <td>Number of terms:</td>
                <td><input id="expressioncaptcha_terms" type="text"
                           name="expressioncaptcha_terms" size="7"
                           value="${expressioncaptcha_terms}" /></td>
              </tr>
            </table>
          </div>
        </fieldset>

        <fieldset py:if="imagecaptcha_enabled">
          <legend>Image captcha</legend>
          <p class="hint">
            The image captcha constructs obstructed images using Python
            imaging library.
          </p>
          <div class="field">
            <table>
              <tr>
                <td>Number of letters:</td>
                <td><input id="imagecaptcha_letters" type="text"
                           name="imagecaptcha_letters" size="7"
                           value="${imagecaptcha_letters}" /></td>
              </tr>
              <tr>
                <td>Font size:</td>
                <td><input id="imagecaptcha_font_size" type="text"
                           name="imagecaptcha_font_size" size="7"
                           value="${imagecaptcha_font_size}" /></td>
              </tr>
              <tr>
                <td>Alphabet:</td>
                <td><input id="imagecaptcha_alphabet" type="text"
                           name="imagecaptcha_alphabet" size="100"
                           value="${imagecaptcha_alphabet}" /></td>
              </tr>
              <tr>
                <td>Fonts:</td>
                <td><input id="imagecaptcha_fonts" type="text"
                           name="imagecaptcha_fonts" size="100"
                           value="${imagecaptcha_fonts}" /></td>
              </tr>
            </table>
          </div>
        </fieldset>

      </div>

      <div class="buttons">
        <input type="submit" value="${dgettext('tracspamfilter', 'Apply changes')}" />
        <input py:if="error" type="submit" name="cancel" value="${dgettext('tracspamfilter', 'Revert changes')}" />
      </div>
    </form>

  </body>

</html>
