<!--!  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:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n">
  <xi:include href="admin.html" />
  <head>
    <title>Versions</title>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $("#verlist").addSelectAllCheckboxes();
      });
    </script>
  </head>

  <body>
    <h2>Manage Versions <span py:if="view == 'list'" class="trac-count">(${len(versions)})</span></h2>

    <py:choose test="view">
      <form py:when="'detail'" id="edit" class="mod" method="post" action="">
        <fieldset>
          <legend>Modify Version:</legend>
          <div class="field">
            <label>Name:<br />
              <input type="text" name="name" class="trac-autofocus" value="${version.name}" />
            </label>
          </div>
          <div class="field">
            <label>Released:<br />
              <input type="text" id="releaseddate" class="trac-datetimepicker"
                     name="time" size="${len(datetime_hint) + 1}"
                     value="${format_datetime(version.time)}"
                     title="${_('Format: %(datehint)s', datehint=datetime_hint)}" />
              <span class="trac-datetimehint" i18n:msg="datehint">Format: $datetime_hint</span>
            </label>
          </div>
          <div class="field description">
            <label for="description" i18n:msg="">
              Description: (you may use <a tabindex="42" href="${href.wiki('WikiFormatting')}">WikiFormatting</a> here)
            </label>
            <textarea id="description" name="description" class="wikitext trac-fullwidth trac-resizable"
                      rows="8" cols="78">$version.description</textarea>
          </div>
        </fieldset>
        <div class="buttons">
          <input type="submit" name="save" class="trac-disable-on-submit" value="${_('Submit changes')}"/>
          <input type="submit" name="cancel" value="${_('Cancel')}"/>
        </div>
      </form>

      <py:otherwise>
        <form class="addnew" id="addversion" method="post" action="">
          <fieldset>
            <legend>Add Version:</legend>
            <div class="field">
              <label>Name: <input type="text" name="name" id="name" size="22"/></label>
            </div>
            <div class="field">
              <label>
                Released:
                <input type="text" id="releaseddate" class="trac-datetimepicker"
                       name="time" size="${len(datetime_hint) + 1}"
                       title="${_('Format: %(datehint)s', datehint=datetime_hint)}"
                       value="${format_datetime()}"/>
                <span class="trac-datetimehint" i18n:msg="datehint">Format: $datetime_hint</span>
              </label>
            </div>
            <div class="buttons">
              <input type="submit" name="add" class="trac-disable-on-submit" value="${_('Add')}" />
            </div>
          </fieldset>
        </form>

        <py:choose>
          <form py:when="versions" id="version_table" method="post" action="">
            <table class="listing" id="verlist">
              <thead>
                <tr><th class="sel"></th>
                  <th>Name</th><th>Released</th><th>Default</th>
                </tr>
              </thead>
              <tbody>
                <tr py:for="version in versions">
                  <td class="sel">
                    <input type="checkbox" class="trac-disable-determinant"
                           name="sel" value="${version.name}"/>
                  </td>
                  <td><a href="${panel_href(version.name)}">${version.name}</a></td>
                  <td>${version.time and format_datetime(version.time)}</td>
                  <td class="default">
                    <input type="radio" name="default" value="${version.name}"
                           checked="${version.name==default or None}" />
                  </td>
                </tr>
              </tbody>
            </table>
            <div class="buttons">
              <input type="submit" name="apply" value="${_('Apply changes')}" />
              <input type="submit" name="remove" class="trac-disable trac-disable-on-submit" value="${_('Remove selected items')}" />
              <input type="submit" name="clear" value="${_('Clear default')}" />
            </div>
            <p class="help">
              You can remove all items from this list to completely hide this
              field from the user interface.
            </p>
          </form>

          <p py:otherwise="" class="help">
            As long as you don't add any items to the list, this field
            will remain completely hidden from the user interface.
          </p>
        </py:choose>
      </py:otherwise>
    </py:choose>
  </body>

</html>
