<!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:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"      
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      i18n:domain="tractags">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <?python
    from tractags.api import _
  ?>

  <head>
    <title py:if="title">$title</title>
  </head>

  <body>
    <div id="content" class="tags">
      <form id="query" action="${href.tags()}" method="get">
        <div>
          <input type="text" id="tag-query" name="q" size="40" accesskey="t"
            value="${tag_query}"/>
          <input type="submit" value="${_('Filter Tags')}"/>
        </div>
        <div>
          <py:for each="realm in tag_realms">
            <input type="checkbox" id="${realm.name}" name="${realm.name}"
              checked="${realm.checked or None}"/>
            <label for="${realm.name}">${realm.name}</label>
          </py:for>
        </div>
        <div py:if="tag_query_error" id="query-error">
          <strong>Error:</strong> ${tag_query_error}
        </div>
        <div>
          <p><strong>Query syntax:</strong></p>
          <ul i18n:msg="">
            <li>Use <strong>tag1 tag2</strong> to match <em>all</em> tags.</li>
            <li><strong>tag1 or tag2</strong> will match <em>any</em> tag.</li>
            <li>Negate a tag with <strong>-tag1</strong>.</li>
            <li>Group sub-queries with <strong>(tag1 or tag2)</strong>.</li>
            <li>Quote strings to include special characters.</li>
            <li>Restrict search to a specific realm with <strong>realm:wiki</strong>.</li>
          </ul>
        </div>
      </form>

      <div id="tag_body">
        <h1 py:if="tag_title">
          ${tag_title}
          <py:if test="tag_page and 'WIKI_VIEW' in perm">
            <py:choose test="tag_page.exists">
              <py:when test="True"><span i18n:msg="name>">(go to <a
                href="${href.wiki(tag_page.name)}">Wiki page</a>)</span>
              </py:when>
              <py:when test="False">
                <py:if test="'WIKI_CREATE' in perm"><span i18n:msg="name">
                  (<a href="${href.wiki(tag_page.name, action='edit',
                    text='= %s =\n\n[[ListTagged(%s)]]' % (tag_page.name,
                    tag_page.name))}">Create Wiki page</a> for this tag)
                  </span>
                </py:if>
              </py:when>
            </py:choose>
          </py:if>
        </h1>
        ${tag_body}
        <p py:if="mincount > 1" i18n:msg="mincount">
              Showing only tags with ${mincount} or more occurrences
              (<a href="${href.tags(mincount=1)}">view all tags</a>).
        </p>
      </div>
    </div>
  </body>
</html>
