<tal:defs define="update view/update" />
<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
  <head>
    <title metal:fill-slot="title" tal:content="context/title" />
  </head>
  <body>
    <metal:block metal:fill-slot="body"
		 tal:define="batch view/available_table/batch">

      <form method="post" tal:attributes="action request/URL" class="standalone">
        <script>
          function invertSelection(pattern) {
            $("INPUT").each(function (index) {
                if (this.name.substr(0, pattern.length) == pattern) {
                  this.checked = !this.checked;
                }
             });
          }
        </script>
	<h3 tal:content="view/title" />
	<fieldset tal:define="items view/getSelectedItems">
	  <tal:if condition="items">
	    <legend tal:content="view/current_title" />
	    <tal:block replace="structure view/selected_table/render" />
	    <div class="controls">
	      <input type="submit" class="button-cancel" name="REMOVE_ITEMS"
		     value="Remove"
		     title="Shortcut: Alt-R" accesskey="R"
		     i18n:attributes="value; accesskey" />
	      <input onclick="invertSelection('remove_item')"
                     type="button" class="button-ok"
		     value="Invert Selection"
                     i18n:attributes="value invert-selection-button"
                     tal:condition="batch" />
	    </div>
	  </tal:if>
          <p tal:condition="not:items" i18n:translate="">
            There are none.
          </p>
	</fieldset>
	<fieldset>
	  <legend tal:content="view/available_title" />
	  <div class="item_list">
	    <tal:block replace="structure view/available_table/batch/render|nothing" />
	    <tal:block replace="structure view/available_table/filter_widget/render|nothing" />
	    <tal:block replace="structure view/available_table/render" />
	    <div class="controls">
	      <input type="submit" class="button-ok" name="ADD_ITEMS"
		     value="Add" tal:condition="batch"
		     title="Shortcut: Alt-A" accesskey="A"
		     i18n:attributes="value; accesskey" />
	      <input onclick="invertSelection('add_item')"
                     type="button" class="button-ok"
		     value="Invert Selection"
                     i18n:attributes="value invert-selection-button"
                     tal:condition="batch" />
	    </div>
	    <p tal:condition="not:batch" i18n:translate="">
	      There are none to add.
	    </p>
	  </div>
	</fieldset>

	<div class="controls">
          <input type="submit" class="button-ok" name="CANCEL" value="OK"
                 i18n:attributes="value ok-button" />
	</div>
      </form>

    </metal:block>
  </body>
</html>
