<!--!  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 i18n:msg="name">Milestone ${milestone.name}</title>
    <link py:if="'MILESTONE_MODIFY' in perm(milestone.resource)" rel="alternate" type="application/x-wiki"
          title="Edit this milestone" href="${href.milestone(milestone.name, action='edit')}" />
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor("Link to this section");
        $(".foldable").enableFolding(true, true);
      });
    </script>
  </head>

  <body>
    <div id="content" class="milestone">
      <h1 i18n:msg="name">Milestone ${milestone.name}</h1>
      <div class="info trac-progress">
        <py:choose>
          <p py:when="milestone.completed" class="date">
            <i18n:msg params="duration, date">
              Completed ${dateinfo(milestone.completed)} ago (${format_datetime(milestone.completed)})
            </i18n:msg>
          </p>
          <p py:when="milestone.is_late" class="date">
            <i18n:msg params="duration, date">
              <strong>${dateinfo(milestone.due)} late</strong> (${format_datetime(milestone.due)})
            </i18n:msg>
          </p>
          <p py:when="milestone.due" class="date">
            <i18n:msg params="duration, date">
              Due in ${dateinfo(milestone.due)} (${format_datetime(milestone.due)})
            </i18n:msg>
          </p>
          <p py:otherwise="" class="date">
            No date set
          </p>
        </py:choose>
        <xi:include href="progress_bar.html" py:if="stats.count"/>
      </div>

      <form py:if="available_groups and stats.count" id="stats" class="trac-groupprogress" action="">
        <fieldset>
          <legend>
            <label for="by" i18n:msg="stat_title">${stats.title.capitalize()} by</label>
            <select id="by" name="by" onchange="this.form.submit()">
              <option py:for="group in available_groups"
                      value="${group.name}" py:content="group.label"
                      selected="${grouped_by == group.name or None}" />
            </select>
            <input type="submit" value="${_('Update')}" class="noscript" />
            <script type="text/javascript">
              jQuery(document).ready(function ($) { $(".noscript").attr("style", "display: none"); });
            </script>
          </legend>
          <xi:include href="progress_bar_grouped.html" py:if="groups"
                      py:with="summary = _('Shows the milestone completion status grouped by %(grouped_by)s',
                                           grouped_by=grouped_by)"/>
        </fieldset>
      </form>

      <div py:if="milestone.description" class="description trac-content" xml:space="preserve">
        ${wiki_to_html(context, milestone.description)}
      </div>

      <xi:include href="list_of_attachments.html"
                  py:with="alist = attachments; compact = True; foldable = True"/>

      <div py:if="'MILESTONE_MODIFY' in perm(milestone.resource) or
                  'MILESTONE_DELETE' in perm(milestone.resource) or
                  attachments.can_create"
           class="buttons">
        <form py:if="'MILESTONE_MODIFY' in perm(milestone.resource)" method="get" action="" id="editmilestone">
          <div>
            <input type="hidden" name="action" value="edit" />
            <input type="submit" value="${_('Edit milestone')}" />
          </div>
        </form>
        <form py:if="'MILESTONE_DELETE' in perm(milestone.resource)" method="get" action="" id="deletemilestone">
          <div>
            <input type="hidden" name="action" value="delete" />
            <input type="submit" value="${_('Delete milestone')}" />
          </div>
        </form>
        <xi:include href="attach_file_form.html" py:with="alist = attachments"/>
      </div>

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

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