<!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">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>$path (log)</title>
  </head>

  <body>
    <div id="content" class="log">
      <h1>${browser_path_links(path_links)}</h1>

      <form id="prefs" action="" method="get">
        <div>
          <input type="hidden" name="action" value="$mode" />
          <input type="hidden" name="revs" value="${str(revranges)}" py:if="revranges" />
          <div class="choice">
            <fieldset>
              <legend>Revision Log Mode:</legend>
              <label>
                <input type="radio" id="stop_on_copy" name="mode"
                       value="stop_on_copy"
                       checked="${mode in (None, 'stop_on_copy') or None}" />
                Stop on copy
              </label>
              <label>
                <input type="radio" id="follow_copy" name="mode"
                       value="follow_copy"
                       checked="${mode == 'follow_copy' or None}" />
                Follow copies
              </label>
              <label>
                <input type="radio" id="path_history" name="mode"
                       value="path_history"
                       checked="${mode == 'path_history' or None}" />
                Show only adds and deletes
              </label>
            </fieldset>
          </div>
          <label>
            View log starting at
            <input type="text" id="rev" name="rev" value="$rev" size="5" />
          </label>
          <label>
            and back to
            <input type="text" id="stop_rev" name="stop_rev" value="$stop_rev" size="5" />
          </label>
          <br />
          <label>
            Show at most
            <input type="text" id="limit" name="limit" value="$limit" size="3" maxlength="3" />
            revisions per page.
          </label>
          <br />
          <label>
            <input type="checkbox" id="verbose" name="verbose" checked="${verbose and 'checked' or None}" />
            Show full log messages
          </label>
        </div>
        <div class="buttons">
          <input type="submit" value="Update" />
        </div>
      </form>

      <div class="diff">
        <div class="legend" id="file-legend">
          <h3>Legend:</h3>
          <dl>
            <dt class="add"></dt><dd>Added</dd>
            <py:if test="mode == 'path_history'">
              <dt class="rem" ></dt><dd>Removed</dd>
            </py:if>
            <dt class="mod"></dt><dd>Modified</dd>
            <dt class="cp"></dt><dd>Copied or renamed</dd>
          </dl>
        </div>
      </div>


      <form py:for="items in item_ranges" class="printableform" action="${href.changeset()}" method="get">
        <div class="buttons">
          <input type="submit" value="View changes"
            title="Diff from Old Revision to New Revision (select them below)" />
        </div>
        <table class="listing chglist">
          <thead>
            <tr>
              <th class="diff" title="Old / New">Diff</th>
              <th class="change"></th>
              <th class="rev">Rev</th>
              <th class="chgset">Chgset</th>
              <th class="date">Date</th>
              <th class="author">Author</th>
              <th class="summary"><py:if test="not verbose">Log Message</py:if></th>
            </tr>
          </thead>
          <tbody>
            <tr py:if="not items" class="even">
              <td />
              <td />
              <td class="copyfrom_path" colspan="6">
                No revisions found
              </td>
            </tr>
            
            <py:for each="idx, item in enumerate(items)">
              <py:with vars="change = changes[item.rev];
                             is_separator = item.change is None;
                             chgset_context = context('changeset', change.rev);
                             chgset_view = 'CHANGESET_VIEW' in perm(chgset_context.resource);
                             odd_even = idx % 2 and 'odd' or 'even'">
                <!--! highlight copy or rename operations -->
                <tr py:if="not is_separator and item.get('copyfrom_path')" class="$odd_even">
                  <td />
                  <td class="copyfrom_path" colspan="7" style="padding-left: ${item.depth - 1}em">
                    copied from <a href="${href.browser(item.path, rev=item.rev)}">$item.copyfrom_path</a>:
                  </td>
                </tr>

                <tr class="$odd_even" py:choose="">
                  <td class="diff" rowspan="${verbose and 2 or None}">
                    <input type="radio" name="old" value="${item.rev}@${item.path}"
                           checked="${idx == (len(items) - 1) or None}" title="From r${item.rev}" />
                    <input type="radio" name="new" value="${item.rev}@${item.path}"
                           checked="${idx == 0 or None}" title="To r${item.rev}" />
                  </td>
                  <py:when test="not is_separator">
                    <td class="change" style="padding-left: ${item.depth}em">
                      <a title="View log starting at this revision" href="${href.log(item.path, rev=item.rev)}">
                        <span class="$item.change"></span>
                        <span class="comment">($item.change)</span>
                      </a>
                    </td>
                    <td class="rev">
                      <a title="Browse at revision $item.existing_rev" href="${href.browser(item.path, rev=item.existing_rev)}">
                        @$item.existing_rev</a>
                    </td>
                    <td class="chgset" py:choose="item.change">
                      <a py:when="'delete'" title="View removal changeset [$item.rev]" href="${href.changeset(item.rev)}">
                        [$item.rev]</a>
                      <a py:otherwise="" title="View changeset [$item.rev] for $item.path" href="${href.changeset(item.rev, item.path)}">
                        [$item.rev]</a>
                    </td>
                    <td class="date" py:content="dateinfo(change.date)" />
                    <td class="author" py:content="authorinfo(change.author)" />
                    <td class="summary" py:choose="">
                      <py:when test="verbose or not chgset_view"></py:when>
                      <py:when test="wiki_format_messages">
                        ${wiki_to_oneliner(chgset_context, change.message, shorten=True)}
                      </py:when>
                      <py:otherwise>${shorten_line(change.message)}</py:otherwise>
                    </td>
                  </py:when>
                  <td colspan="6" class="separator" py:otherwise="" />
                </tr>

                <tr py:if="verbose and not is_separator" class="$odd_even verbose">
                  <py:choose> 
                    <td py:when="chgset_view" class="summary" colspan="6"
                        py:choose="" xml:space="preserve">
                      <py:when test="wiki_format_messages">
                        ${wiki_to_html(chgset_context, change.message, escape_newlines=True)}
                      </py:when>
                      <py:otherwise><pre>${change.message}</pre></py:otherwise>
                    </td>
                  </py:choose>
                </tr>

              </py:with>
            </py:for>
          </tbody>
        </table>

        <div py:if="len(items) &gt; 10 and len(item_ranges) == 1" class="buttons">
          <input type="submit" value="View changes"
            title="Diff from Old Revision to New Revision (select them above)" />
        </div>
      </form>

      <div id="help">
        <strong>Note:</strong> See <a href="${href.wiki('TracRevisionLog')}">TracRevisionLog</a>
        for help on using the revision log.
      </div>

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