<!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">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>${'/'.join(part.name for part in path_links[1:]) or '/'}</title>
    <meta py:if="file and file.annotate" name="ROBOTS" content="NOINDEX, NOFOLLOW" />
    <meta py:if="dir" name="ROBOTS" content="NOINDEX" />
    <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $(".trac-toggledeleted").show().click(function() {
                  $(this).siblings().find(".trac-deleted").toggle();
                  return false;
        }).click();
        $("#jumploc input").hide();
        $("#jumploc select").change(function () {
          this.parentNode.parentNode.submit();
        });

        <py:if test="dir or repo">
          /* browsers using old WebKits have issues with expandDir... */
          var webkit_rev = /AppleWebKit\/(\d+)/.exec(navigator.userAgent);
          if ( !webkit_rev || (521 - webkit_rev[1]).toString()[0] == "-" )
            enableExpandDir(null, $("table.dirlist tr"), {
                action: 'inplace',
                range_min_secs: '$dir.range_min_secs',
                range_max_secs: '$dir.range_max_secs'
            });
        </py:if>
        <py:if test="file">
          <py:if test="file.annotate">
            enableBlame("${href.changeset()}/", "${reponame}", "${path}");
            enableBlame("${href.changeset()}/", "${path}");
          </py:if>
          $('#preview table.code').enableCollapsibleColumns($('#preview table.code thead th.content')); 
        </py:if>
      });
    </script>
  </head>

  <body>
    <div id="content" class="browser">

      <py:if test="dir or file">
        <py:choose>
          <h1 py:when="repo">Default Repository</h1>
          <h1 py:otherwise=""><xi:include href="path_links.html" /></h1>
        </py:choose>
  
        <div id="jumprev">
          <form action="" method="get">
            <div>
              <label for="rev" title="${stickyrev and 'Hint: clear the field to view latest revision' or None}">
                View revision:</label>
              <input type="text" id="rev" name="rev" value="$stickyrev" size="6" />
            </div>
          </form>
        </div>
  
        <div py:if="quickjump_entries" id="jumploc">
          <form action="" method="get">
            <div class="buttons">
              <label for="preselected">Visit:</label>
              <select id="preselected" name="preselected">
                <option selected="selected" />
                <optgroup py:for="category, locations in groupby(quickjump_entries, key=lambda q: q[0])"
                  label="${category}">
                  <option py:for="_, name, path, rev in locations" value="${href.browser(reponame, path, rev=rev)}">$name</option>
                </optgroup>
              </select>
              <input type="submit" value="${_('Go!')}" title="${_('Jump to the chosen preselected path')}" />
            </div>
          </form>
        </div>
      </py:if>

      <py:if test="dir">
        <table class="listing dirlist" id="dirlist">
          <xi:include href="dirlist_thead.html" />
          <tbody>
            <py:if test="'up' in chrome.links">
              <tr class="even">
                <td class="name" colspan="5">
                  <a class="parent" title="Parent Directory" href="${chrome.links.up[0].href}">../</a>
                </td>
              </tr>
            </py:if>
            <xi:include href="dir_entries.html" />
            <tr py:if="'up' not in chrome.links and not dir.entries" class="even">
              <td class="name" colspan="5">
                No files found
              </td>
            </tr>
          </tbody>
        </table>
      </py:if>

      <table py:if="properties or file" id="info" summary="Revision info">
        <tr py:if="file">
          <th scope="col" i18n:msg="rev, size, author, date">
            Revision <a href="${href.changeset(rev, reponame)}">$rev</a>, ${sizeinfo(file.size)}
            (checked in by ${authorinfo(file.changeset.author)}, ${dateinfo(file.changeset.date)} ago)
          </th>
        </tr>
        <tr py:if="file">
          <td class="message searchable" py:choose="">
            <py:when test="wiki_format_messages" xml:space="preserve">
              ${wiki_to_html(context('changeset', (reponame, file.changeset.rev)), file.changeset.message, escape_newlines=True)}
            </py:when>
            <py:otherwise>${file.changeset.message}</py:otherwise>
          </td>
        </tr>
        <tr py:if="properties">
          <td colspan="2">
            <ul class="props">
              <li py:for="prop in properties" py:choose="">
                <py:when test="prop.rendered">
                   <span py:if="prop.rendered.name"
                         py:attrs="prop.rendered.name_attributes" py:content="prop.rendered.name" />
                   <div py:attrs="prop.rendered.content_attributes" py:content="prop.rendered.content" />
                </py:when>
                <py:otherwise>
                  Property <strong>$prop.name</strong> set to
                  <py:choose>
                    <em py:when="istext(prop.value)"><code>$prop.value</code></em>
                    <py:otherwise>$prop.value</py:otherwise>
                  </py:choose>
                </py:otherwise>
              </li>
            </ul>
          </td>
        </tr>
      </table>

      <py:if test="repo and repo.repositories">
        <hr py:if="dir"/>
        <h1>Repository Index</h1>
        <py:with vars="repoindex = 'repoindex'">
          <xi:include href="repository_index.html" />
        </py:with>
      </py:if>

      <div py:if="file and file.preview" id="preview" class="searchable">
        ${preview_file(file.preview)}
      </div>

      <div id="help" i18n:msg="">
        <strong>Note:</strong> See <a href="${href.wiki('TracBrowser')}">TracBrowser</a>
        for help on using the browser.
      </div>

      <div id="anydiff">
        <form action="${href.diff()}" method="get">
          <div class="buttons">
            <input type="hidden" name="new_path" value="$reponame/$path" />
            <input type="hidden" name="old_path" value="$reponame/$path" />
            <input type="hidden" name="new_rev" value="$stickyrev" />
            <input type="hidden" name="old_rev" value="$stickyrev" />
            <input type="submit" value="${_('View changes...')}" title="${_('Select paths and revs for Diff')}" />
          </div>
        </form>
      </div>

    </div>
  </body>
</html>
