<!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" />
  <head>
    <py:choose test="milestone.exists">
      <title py:when="True">${_('Edit Milestone %(name)s', name=milestone.name)}</title>
      <title py:otherwise="">${_('New Milestone')}</title>
    </py:choose>
    <link rel="stylesheet" type="text/css"
          href="${chrome.htdocs_location}css/roadmap.css" />
    <script type="text/javascript" src="${chrome.htdocs_location}js/wikitoolbar.js"></script>
    <script type="text/javascript">/*<![CDATA[*/
      jQuery(document).ready(function($) {
        function updateCompletedDate() {
          var checked = $("#completed").checked();
          $("#completeddate").enable(checked);
          var retarget = $("#retarget");
          retarget.enable(checked);
          $("#target").enable(checked && retarget.checked());
        }
        $("#completed").click(updateCompletedDate);
        updateCompletedDate();
        $("#retarget").click(function(){ $("#target").enable(this.checked) });
        $("#name").get(0).focus()
      });
    /*]]>*/</script>
  </head>

  <body>
    <div id="content" class="milestone">
      <py:choose test="milestone.exists">
        <h1 py:when="True">${_('Edit Milestone %(name)s', name=milestone.name)}</h1>
        <h1 py:otherwise="">${_('New Milestone')}</h1>
      </py:choose>

      <form id="edit" action="" method="post">
        <div class="field">
          <input type="hidden" name="id" value="${milestone.name}" />
          <input type="hidden" name="action" value="edit" />
          <label>${_('Name of the milestone')}:<br />
            <input type="text" id="name" name="name" size="32" value="${milestone.name or req.args.get('name')}" />
          </label>
        </div>
        <fieldset>
          <legend>${_('Schedule')}</legend>
          <label>${_('Due')}:<br />
            <input type="text" id="duedate" name="duedate" size="${len(date_hint)}"
                   value="${milestone.due and format_date(milestone.due)}" title="${_('Format: %(time)s', time=date_hint)}" />
            <em>${_('Format')}: ${date_hint}</em>
          </label>
          <div class="field">
            <label>
              <input type="checkbox" id="completed" name="completed"
                     checked="${milestone.completed or None}" />
              ${_('Completed:')}<br />
            </label>
            <label>
              <input type="text" id="completeddate" name="completeddate"
                     size="${len(datetime_hint)}" title="${_('Format: %(time)s', time=datetime_hint)}"
                     value="${format_datetime(milestone.completed)}" />
              <em>${_('Format')}: ${datetime_hint}</em>
            </label>
            <py:if test="milestone_groups">
              <br/>
              <input type="checkbox" id="retarget" name="retarget" checked="${not milestone.completed or None}" />
              <label for="retarget">${_('Retarget associated open tickets to milestone')}:</label>
              <select id="target" name="target">
                <option value="">None</option>
                <optgroup py:for="(label, milestones) in milestone_groups"
                          py:if="milestones" label="${label}">
                  <option py:for="milestone in milestones"
                          py:content="milestone.name"></option>
                </optgroup>
              </select>
            </py:if>
          </div>
        </fieldset>
        <div class="field">
          <fieldset class="iefix">
            <!--! FIXME: message_contains_tag --> 
            <label for="description">マイルストーンについての説明 (<a tabindex="42"
                   href="${href.wiki('WikiFormatting')}">WikiFormatting</a> を使用できます):</label>
            <p><textarea id="description" name="description" class="wikitext" rows="10" cols="78">
${milestone.description}</textarea></p>
          </fieldset>
        </div>
        <div class="buttons" py:choose="milestone.exists">
          <input py:when="True" type="submit" value="${_('Submit changes')}" />
          <input py:otherwise="" type="submit" value="${_('Add milestone')}" />
          <input type="submit" name="cancel" value="${_('Cancel')}" />
        </div>
      </form>

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

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