<!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>${_('Milestone')}</title>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor("${_('Link to this section')}");
      });
    </script>
    <link rel="stylesheet" type="text/css"
          href="${chrome.htdocs_location}css/roadmap.css" />
  </head>

  <body>
    <div id="content" class="milestone">
      <h1>${_('Milestone %(name)s', name=milestone.name)}</h1>
      <div class="info">
        <py:choose>
          <!--! FIXME: message_contains_tag --> 
          <p py:when="milestone.completed" class="date">
            ${dateinfo(milestone.completed)} 前に完了
            (${format_datetime(milestone.completed)})
          </p>
          <!--! FIXME: message_contains_tag -->
          <p py:when="milestone.is_late" class="date">
            <strong>完了期限から ${dateinfo(milestone.due)} 遅れ</strong>
            (${format_date(milestone.due)})
          </p>
          <!--! FIXME: message_contains_tag -->
          <p py:when="milestone.due" class="date">
            あと ${dateinfo(milestone.due)} で完了期限 
            (${format_date(milestone.due)})
          </p>
          <p py:otherwise="" class="date">
            ${_('No date set')} 
          </p>
        </py:choose>
        <py:if test="stats.count">${progress_bar(stats, interval_hrefs, stats_href=stats_href)}</py:if>
      </div>

      <form py:if="available_groups and stats.count" id="stats" action="">
        <fieldset>
          <legend>
            <!--! FIXME: message_contains_tag -->
            <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>
            <!--! FIXME: message_contains_tag -->
            <label for="by">別${stats.title.capitalize()}</label>
            <input type="submit" value="${_('Update')}" class="noscript" />
            <script type="text/javascript">
              jQuery(document).ready(function ($) { $(".noscript").attr("style", "display: none"); });
            </script>
          </legend>
          <table py:if="groups" summary="Shows the milestone completion status grouped by ${grouped_by}">
            <tr py:for="group in groups">
              <th scope="row" py:choose="">
                <i py:when="not group.name"><a href="${group.stats_href}">(none)</a></i>
                <a py:when="grouped_by in ['owner', 'reporter']"
                        py:with="obfus_name = format_author(group.name)"
                        py:strip="obfus_name != group.name"
                        href="${group.stats_href}">${obfus_name}</a>
                <a py:otherwise="" href="${group.stats_href}">${group.name}</a>
              </th>
              <td>
                ${progress_bar(group.stats, (group.interval_hrefs, None)
                               [grouped_by in ['owner', 'reporter'] 
                                  and group.name != format_author(group.name)],
                               '%d / %d' % (group.stats.done_count, group.stats.count),
                               legend=False, style="width: %d%%" % (group.percent_of_max_total * 0.8))}
              </td>
            </tr>
          </table>
        </fieldset>
      </form>

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

      ${list_of_attachments(attachments, compact=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>
        ${attach_file_form(attachments)}
      </div>

      <!--! FIXME: message_contains_tag -->
      <div id="help"><strong>Note:</strong> ロードマップについてのヘルプは
        <a href="${href.wiki('TracRoadmap')}">TracRoadmap</a> を参照
        して下さい。
      </div>

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