[%# Enable/disable field values for a selected value of its controlling value_field
  # License: Dual-license GPL 3.0+ or MPL 1.1+
  # Authors: Vitaliy Filippov <vitalif@mail.ru>, Vladimir Koptev <vladimir.koptev@gmail.com>
  #%]

[% SET title = "Select Active " _ field.description _ " Objects For " _ field.value_field.description _ ' ' _ visibility_value.name | html %]

[% PROCESS global/header.html.tmpl %]

<h3>[% title | none %]</h3>

<form action="editvisibility.cgi?field=[% field.name | html %]&visibility_value_id=[% visibility_value.id %]" method="POST">
  <input type="hidden" name="token" value="[% token | html %]" />
  <input type="hidden" name="action" value="save" />
  <table id="admin_table" class="admin_table">
    <tbody>
      <tr>
        <th align="left">Active</th>
        <th align="left">Value</th>
      </tr>
      [% FOREACH value = field.legal_values %]
      <tr class="[% loop.index % 2 == 1 ? 'odd' : 'even' +%]_row">
        <td align="center">
          <input type="checkbox" id="val_[% value.id %]" value="[% value.id %]" name="values"
            [% ' checked="checked"' IF field.is_value_enabled(value.id, visibility_value.id) %]/>
        </td>
        <td>
          <label for="val_[% value.id %]">[% value.name | html %]</label>
          <a title="Edit this value" href="editvalues.cgi?action=edit&field=[% field.name %]&value=[% value.name | uri %]">&rarr;</a>
        </td>
      </tr>
      [% END %]
    </tbody>
  </table>
  <br />
  <input type="submit" value="Save" />
</form>

<p>
  <a href="editvalues.cgi?field=[% field.name %]">Edit or add [% field.description | html %] objects</a> |
  [% IF field.value_field.name == 'product' %]
  <a href="editproducts.cgi?action=edit&product=[% visibility_value.name | uri %]">Edit product [% visibility_value.name | html %]</a>
  [% ELSIF field.value_field.name == 'classification' %]
  <a href="editclassifications.cgi?action=edit&classification=[% visibility_value.name | uri %]">Edit classification [% visibility_value.name | html %]</a>
  [% ELSIF field.value_field.name == 'target_milestone' %]
  <a href="editmilestones.cgi?action=edit&product=[% visibility_value.product_obj.name | uri %]&milestone=[% visibility_value.name | uri %]">Edit milestone [% visibility_value.name | html %]</a>
  [% ELSIF field.value_field.name == 'version' %]
  <a href="editversions.cgi?action=edit&product=[% visibility_value.product_obj.name | uri %]&version=[% visibility_value.name | uri %]">Edit version [% visibility_value.name | html %]</a>
  [% ELSIF field.value_field.name == 'component' %]
  <a href="editcomponents.cgi?action=edit&product=[% visibility_value.product_obj.name | uri %]&component=[% visibility_value.name | uri %]">Edit component [% visibility_value.name | html %]</a>
  [% ELSE %]
  <a href="editvalues.cgi?action=edit&field=[% field.value_field.name %]&value=[% visibility_value.name | uri %]">Edit [% field.value_field.description | html %] [% visibility_value.name | html %]</a>
  [% END %]
</p>

[% PROCESS global/footer.html.tmpl %]
