<!--!  Copyright (C) 2006-2014 Edgewall Software

  This software is licensed as described in the file COPYING, which
  you should have received as part of this distribution. The terms
  are also available at http://trac.edgewall.com/license.html.

  This software consists of voluntary contributions made by many
  individuals. For the exact contribution history, see the revision
  history and logs, available at http://trac.edgewall.org/.
-->
<!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:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <head>
    <title>${'/'.join(part.name for part in path_links[1:]) or '/'} (log)</title>
    <script py:if="graph" type="text/javascript">//<![CDATA[
      jQuery(document).ready(function($) {
        $('th.trac-graph, td.trac-graph').show();
        var canvas = $('<canvas>').css({width: '${graph.columns * 2}em',
                                        height: '${len(items) * 2}em'})
                                  .appendTo('td.trac-graph')[0];
        canvas.width = $(canvas).width();
        canvas.height = $(canvas).height();
        if (typeof(G_vmlCanvasManager) != 'undefined')
          canvas = G_vmlCanvasManager.initElement(canvas);
        $.paintLogGraph(graph, canvas);
      });
    //]]></script>
  </head>

  <body>
    <div id="content" class="log">
      <h1><xi:include href="path_links.html" /></h1>

      <form id="prefs" action="" method="get">
        <div>
          <input type="hidden" name="action" value="$mode" />
          <input type="hidden" name="revs" value="${unicode(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>
          <i18n:msg>
            <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>
          </i18n:msg><br />
          <i18n:msg>
            <label>
              Show at most
              <input type="text" id="limit" name="limit" value="$limit" size="3" maxlength="3" />
              revisions per page.
            </label>
          </i18n:msg><br />
          <label>
            <input type="checkbox" id="verbose" name="verbose" checked="${verbose 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="hidden" name="reponame" value="$reponame" />
          <input type="submit" value="${_('View changes')}"
            title="Diff from Old Revision to New Revision (as selected in the Diff column)" />
        </div>
        <table class="listing chglist${' trac-graph' if graph else None}">
          <thead>
            <tr>
              <th py:if="graph" class="trac-graph">Graph</th>
              <th class="diff" title="Old / New">Diff</th>
              <th class="change"></th>
              <th class="rev">Rev</th>
              <th class="age">Age</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 py:if="graph" class="trac-graph"/>
              <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.child('changeset', change.rev, parent=repos.resource);
                             odd_even = 'odd' if idx % 2 else '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="6" style="padding-left: ${item.depth - 1}em">
                    <i18n:msg params="path">copied from <a href="${href.browser(reponame, item.path, rev=item.rev)}">$item.copyfrom_path</a>:</i18n:msg>
                  </td>
                </tr>

                <tr class="${classes(odd_even,verbose=verbose)}" py:choose="">
                  <td py:if="graph and idx == 0" class="trac-graph" rowspan="${len(items)}"/>
                  <td class="diff">
                    <input type="radio" name="old" value="${item.rev}@${item.path}"
                           checked="${idx == (len(items) - 1) or None}"
                           title="${_('From [%(rev)s]', rev=display_rev(item.rev))}" />
                    <input type="radio" name="new" value="${item.rev}@${item.path}"
                           checked="${idx == 0 or None}"
                           title="${_('To [%(rev)s]', rev=display_rev(item.rev))}" />
                  </td>
                  <py:when test="not is_separator">
                    <td class="change" style="padding-left: ${item.depth}em">
                      <a href="${href.log(reponame, item.path, rev=item.rev)}"
                         title="View log starting at this revision">
                        <span class="$item.change"></span>
                        <span class="comment">($item.change)</span>
                      </a>
                    </td>
                    <td class="rev">
                      <a href="${href.browser(reponame, item.path, rev=item.existing_rev)}"
                         title="${_('Browse at revision %(rev)s', rev=display_rev(item.existing_rev))}">
                        @${display_rev(item.existing_rev)}</a>
                      <py:choose test="item.change">
                        <a py:when="'delete'" class="chgset" href="${href.changeset(item.rev)}"
                           title="${_('View removal changeset [%(rev)s]', rev=display_rev(item.rev))}">&nbsp;</a>
                        <a py:otherwise="" class="chgset" href="${href.changeset(item.rev, reponame, item.path)}"
                           title="${_('View changeset [%(rev)s] restricted to %(path)s',
                                      rev=display_rev(item.rev), path=item.path or '/')}">&nbsp;</a>
                      </py:choose>
                    </td>
                    <td class="age" py:content="pretty_dateinfo(change.date, dateonly=True)" />
                    <td class="author" py:content="authorinfo_short(change.author)" />
                    <td class="summary" py:choose=""
                        style="${graph and ('border-left: 2px solid '
                                            + graph.colors[graph.vertices[idx][1] % len(graph.colors)]) or None}">
                      <py:when test="verbose"></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>
                      <span py:for="branch, head in change.get_branches()" py:if="branch not in ('default', 'master')"
                            class="branch${' head' if head else ''}"
                            title="${_('Branch head') if head else _('Branch')}">${branch}</span>
                      <span py:for="tag in change.get_tags()" class="tag" title="Tag">${tag}</span>
                      <span py:for="bookmark in change.get_bookmarks()" class="trac-bookmark" title="Bookmark">${bookmark}</span>
                    </td>
                  </py:when>
                  <td colspan="5" py:otherwise="" />
                </tr>

                <tr py:if="verbose and not is_separator" class="summary verbose $odd_even">
                  <td class="filler" colspan="2" />
                  <td class="log" colspan="4" 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>
                </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 (as selected in the Diff column)" />
        </div>
      </form>

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

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