{# 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 https://trac.edgewall.org/wiki/TracLicense.

  This software consists of voluntary contributions made by many
  individuals. For the exact contribution history, see the revision
  history and logs, available at https://trac.edgewall.org/.
#}

## Batch modification form for ticket queries

<form id="batchmod_form" method="post" action="${req.href + '/batchmodify'}">
  ${jmacros.form_token_input()}

  <script>
    jQuery(function($) {
      initializeBatch();
    });
  </script>

  <fieldset id="batchmod_fieldset">
    <legend class="foldable">${_("Batch Modify")}</legend>
    <table>
      <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"></textarea>
        </td>
      </tr>

      <tr id="add_batchmod_field_row">
        <td colspan="3">
          <label class="batchmod_label" for="add_batchmod_field">${
            _("Change:")
            }</label>
          <select id="add_batchmod_field">
            <option label="${_('field…')}"></option>
            # set non_modifiable_fields = (
                ('id', 'resolution', 'status', 'owner', 'time',
                 'changetime', 'summary', 'description') +
                (('reporter',) if 'TICKET_ADMIN' not in req.perm else ())
              )
            # for field_name in field_names if (field_name not in non_modifiable_fields and fields[field_name].type != 'textarea'):
            <option value="${field_name}">${fields[field_name].label}</option>
            # endfor
          </select>
          ## jinjacheck: "option CDATA option" OK
        </td>
      </tr>

      <tr>
        <td colspan="3">
          # include 'ticket_workflow.html'
        </td>
      </tr>
    </table>

    # call(note, page) jmacros.wikihelp('TracBatchModify'):
    #   trans note, page

    ${note} See ${page} for help on using batch modify.

    #   endtrans
    # endcall

    <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>
