<!--!  Copyright (C) 2012-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/.
-->
<form 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"
     id="batchmod_form" method="post" action="${req.href + '/batchmodify'}">

<fieldset id="batchmod_fieldset">
  <legend class="foldable">Batch Modify</legend>
  <table summary="Batch modification fields">
    <tr id="batchmod_comment">
      <th colspan="2">
        <label for="batchmod_value_comment">Comment:</label>
      </th>
      <td class="fullrow"><textarea
          id="batchmod_value_comment" name="batchmod_value_comment" class="trac-fullwidth" cols="70" rows="5"/>
      </td>
    </tr>

    <tr id="add_batchmod_field_row">
      <td colspan="3">
        <label class="batchmod_label" for="add_batchmod_field">Add Field:</label>
        <select id="add_batchmod_field"
                py:with="field_names = sorted(fields.iterkeys(), key=lambda name: fields[name].label.lower())">
          <option></option>
          <option py:for="field_name in field_names" py:with="field = fields[field_name]"
                  py:if="field_name not in ('id', 'resolution', 'status', 'owner', 'time', 'changetime', 'summary',
                                            'reporter', 'description')
                         and fields[field_name].type != 'textarea'"
                  value="$field_name">${field.label}</option>
        </select>
      </td>
    </tr>

    <tr>
      <td colspan="3">
        <fieldset id="batchmod_action">
          <legend>Action</legend>
          <div py:for="key, label, controls, hints in action_controls">
            <input type="radio" id="action_$key" name="action" value="$key"
                   checked="${key == action or None}" />
            <label for="action_$key">$label</label>
            $controls
            <span class="hint" py:for="hint in hints">$hint</span>
          </div>
        </fieldset>
      </td>
    </tr>
  </table>

  <div id="batchmod_help" i18n:msg="">
    <strong>Note:</strong> See <a href="${href.wiki('TracBatchModify')}">TracBatchModify</a> for help on using batch modify.
  </div>

  <div>
    <input type="hidden" name="selected_tickets" value=""/>
    <input type="hidden" name="query_href" value="${query_href}"/>
    <input type="submit" id="batchmod_submit" name="batchmod_submit" class="trac-disable-on-submit" value="${_('Change tickets')}" />
  </div>

</fieldset>

</form>
