<script>ST.state.push()</script>
<tal:script
    tal:replace="structure scriptlocal:container_id view/manager/html_id" />
<tal:block i18n:domain="schooltool.cando"
           define="batch nocall:view/manager/batch|nothing;
                   search_id view/search_id">
  <tal:if condition="batch">
    <div class="count" i18n:translate="">
      Showing
      <span i18n:name="count" tal:content="batch/length"/>
      of
      <span i18n:name="total" tal:content="batch/full_size"/>
      items
    </div>
  </tal:if>
  <fieldset>
    <legend><span tal:content="view/legend">Search</span></legend>
    <div class="row" tal:define="title_id view/search_title_id">
      <div class="label">
        <label tal:attributes="for title_id">
          <span tal:content="view/search_title">[title]</span>
        </label>
      </div>
      <div class="widget">
        <input type="text" class="text-widget"
               tal:attributes="id title_id;
                               name title_id;
                               value python:request.get(title_id)"
               />
      </div>
    </div>
    <div class="row" tal:define="layer_ids view/search_layer_ids">
      <div class="label">
        <span i18n:translate="">Layers</span>
      </div>
      <div class="widget">
        <div tal:repeat="layer view/layers">
          <tal:block define="id string:${view/search_layer_ids}-${layer/id}">
            <input tal:attributes="value layer/id;
                                   id id;
                                   name layer_ids;
                                   checked layer/checked"
                   type="checkbox" />
            <label tal:attributes="for id">
              <span class="label" tal:content="layer/title" />
            </label>
          </tal:block>
        </div>
      </div>
    </div>
  </fieldset>
  <div class="buttons">
    <input type="submit" name="SEARCH_BUTTON" value="Search"
           tal:attributes="id search_id"
           class="button-ok" i18n:attributes="value" />
    <tal:script replace="structure scriptlocal: search_id" />
    <script>
      $(ST.dialogs.jquery_id(ST.local.search_id)).click(
         function(){
             var search_id = ST.local.search_id;
             var container_id = ST.local.container_id;
             return function(button) {
                  return ST.table.on_form_submit(container_id, button);
             }}());
    </script>
  </div>
</tal:block>
<script>ST.state.pop()</script>
