<div id="bulk_update" class="bordered" {get_display_style element_name='bulk_update'}>
    <div class="title">{t}Bulk Update Tool{/t}</div>
    <div>
      <table class="grid">
        <tr>
          {assign var="colspan" value=3}
          <th>{t}Assignment{/t}</th>
          <th>{t}Status{/t}</th>
          {if $releases|@count > 0}
          {assign var="colspan" value=$colspan+1}
          <th>{t}Release{/t}</th>
          {/if}
          {if $priorities|@count > 0}
          {assign var="colspan" value=$colspan+1}
          <th>{t}Priority{/t}</th>
          {/if}
          {if $categories|@count > 0}
          {assign var="colspan" value=$colspan+1}
          <th>{t}Category{/t}</th>
          {/if}
          <th>{t}Close{/t}</th>
        </tr>
        <tr>
          <td>
              <select name="users[]" size="5" multiple data-placeholder="{t}Choose Assignees…{/t}" class="chosen-select">
              <option></option>
              {html_options options=$users}
              </select>
              {include file="error_icon.tpl.html" field="users[]"}
          </td>
          <td>
              <select name="status">
                <option value=""></option>
                {html_options options=$open_status}
              </select>
              {include file="error_icon.tpl.html" field="status"}
          </td>
          {if $releases|@count > 0}
          <td>
              <select name="release">
                <option value=""></option>
                {html_options options=$available_releases}
              </select>
              {include file="error_icon.tpl.html" field="release"}
          </td>
          {/if}
          {if $priorities|@count > 0}
          <td>
              <select name="priority">
                <option value=""></option>
                {html_options options=$priorities}
              </select>
              {include file="error_icon.tpl.html" field="priority"}
          </td>
          {/if}
          {if $categories|@count > 0}
          <td>
              <select name="category">
                <option value=""></option>
                {html_options options=$categories}
              </select>
              {include file="error_icon.tpl.html" field="category"}
          </td>
          {/if}
          <td>
              <span>{t}Select closed status to close issue{/t}</span><br />
              <select name="closed_status">
                <option value=""></option>
                {html_options options=$closed_status}
              </select>
              <br />
              <a class="link default" id="bulk_set_closed_message" href="#">{t}Set Close Message{/t}</a>
              <br />
              <span>
              {t}Send Notification To{/t}:<br />
              <input id="notification_internal" type="radio" name="notification_list" checked value="internal">
              <label for="notification_internal">{t}Internal Users{/t} ({t}Will save as a note{/t})</label><br />
              <input id="notification_all" type="radio" name="notification_list" value="all">
              <label for="notification_all">{t}All{/t}</label>
              <input type="hidden" name="closed_message" value="Issue Bulk closed" id="closed_message">
              </span>

              <div id="close_message_popup" style="display: none">
                  <label for="closed_message">{t}Closed Message{/t}</label><br />
                  <textarea id="closed_message_popup" name="closed_message_popup" rows="8" cols="80">Issue Bulk closed</textarea>
                  <br />
                  <input id="closed_set_message" type="button" value="{t}Set Message{/t}">
              </div>
          </td>
        </tr>
        <tr class="buttons">
          <td colspan="{$colspan}">
            <input type="button" value="{t}Bulk Update{/t}" id="bulk_update_button">
            <input type="button" value="{t}Reset{/t}" id="reset_bulk_update">
          </td>
        </tr>
      </table>
    </div>
</div>

<script type="text/javascript">

jQuery("#bulk_set_closed_message").bind("click", function (e) {
    jQuery.blockUI({
                message: jQuery("#close_message_popup"),
                css: {
                    width: '600px'
                }
                });
});
jQuery("#closed_set_message").bind("click", function () {
    jQuery("#closed_message").val(jQuery("#closed_message_popup").val());
    jQuery.unblockUI();
});

</script>
