[% WRAPPER _conf_frame.tt %]

<form action="conf.cgi" method="POST" onsubmit="multi_select_all(this)">
<input type="hidden" name="sub" value="[% sub %]">
<input type="hidden" name="action" value="store">
<input type="hidden" name="md5" value="[% md5 %]">
<div align="center">
[% IF readonly %]
<br><font color="orange">Readonly: Make sure the config file is writable!</font>
[% END %]
  <table border="0" class='data conftool'>
    [% FOREACH cat = keys %]
        [% UNLESS loop.first %]
        <tr><td colspan=2>&nbsp;</td></tr>
        [% END %]
        <tr>
            <th colspan=2 class='data conftoolheader' style="text-align:center">
                [% cat.0 %]
            </th>
        </tr>
        [% FOREACH key = cat.1 %]
        [% d = data.$key %]
        <tr>
          <td class='dataVar' align="left" valign="top">[% key %]</td>
          <td class='dataVal'>
          [% IF d.0 == 'BOOL' %]
            <input type="radio" name="data.[% key %]" value="0"[% IF d.1 == 0 %] checked[% END %]> No
            <input type="radio" name="data.[% key %]" value="1"[% IF d.1 == 1 %] checked[% END %]> Yes
          [% ELSIF d.0 == 'STRING' %]
            <input type="text" name="data.[% key %]" value="[% escape_js(d.1) %]" size=65>
          [% ELSIF d.0 == 'INT' %]
            <input type="text" name="data.[% key %]" value="[% d.1 %]" size=65>
          [% ELSIF d.0 == 'ARRAY' %]
            <input type="text" name="data.[% key %]" value="[% d.1.join(', ') %]" size=65>
          [% ELSIF d.0 == 'LIST' %]
            <select name="data.[% key %]">
                [% FOREACH opt = d.2 %]
                    <option value="[% opt.key %]"[% IF opt.key == d.1 %] selected[% END %]>[% opt.value %]</option>
                [% END %]
            </select>
          [% ELSIF d.0 == 'MULTI_LIST' %]
            <table border=0>
              <tr>
                <th>Available</th>
                <th></th>
                <th>Selected</th>
              </tr>
              <tr>
                <td>
                  <select id="avail.[% key %]" name="avail.[% key %]" size=6 multiple style="width:250px;" ondblclick="data_select_move('avail.[% key %]', 'data.[% key %]')">
                      [% test = {} %]
                      [% FOREACH t = d.1 %]
                        [% test.$t = t %]
                      [% END %]
                      [% FOREACH opt = d.2 %]
                        [% NEXT IF test.exists(opt.key) %]
                        <option value="[% opt.key %]">[% opt.value %]</option>
                      [% END %]
                  </select>
                </td>
                <td valign="middle">
                  <input type="button" value="&gt;&gt;" onclick="data_select_move('avail.[% key %]', 'data.[% key %]')">
                    <br>
                  <input type="button" value="&lt;&lt;" onclick="data_select_move('data.[% key %]', 'avail.[% key %]')">
                </td>
                <td>
                  <select id="data.[% key %]" name="data.[% key %]" size=6 multiple style="width:250px;" ondblclick="data_select_move('data.[% key %]', 'avail.[% key %]')">
                      [% FOREACH opt = d.1 %]
                        [% IF d.2.exists(opt) %]
                          <option value="[% opt %]">[% d.2.$opt %]</option>
                        [% ELSE %]
                          <option value="[% opt %]">[% opt %]</option>
                        [% END %]
                      [% END %]
                  </select>
                </td>
              </tr>
            </table>
          [% ELSE %]
          [% d.list.join(', ') %]
          [% END %]
          </td>
        </tr>
        [% END %]
    [% END %]
    <tr>
      <td colspan=2 class="data dataSubmit">
        <input type="button" name="cancel" value="cancel" style="width:60px" onclick="window.location='conf.cgi'">
        <input type="submit" name="send" value="save" style="width:80px"[% IF readonly %] disabled[% END %]>
      </td>
    </tr>
  </table>
</div>
</form>

[% END %]
