view zpt/layer_text_search.zpt @ 562:60f5a636bc57

bugfixes for stability.
author casties
date Tue, 02 Oct 2012 15:22:11 +0200
parents 4b43a57ad9b3
children
line wrap: on
line source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<metal:block metal:define-macro="html_head"
  tal:define="
    global query python:request.get('query', None); 
    global queryType python:request.get('queryType','fulltextMorph');
">
</metal:block>
</head>
<body>
  <!-- right-side options -->
  <div class="col buttons">
    <!-- LAYER DISPLAY OPTION  -->
    <ul>
      <metal:block metal:define-macro="layer_select_li">
        <li tal:condition="python:query"><input type="checkbox" class="autosubmit" name="viewLayer" value="search"
          tal:attributes="checked python:'search' in viewLayers" /> Search results</li>
      </metal:block>
    </ul>
  </div>

  <metal:block metal:define-macro="extra_column" tal:condition="python:'search' in viewLayers">
    <!-- right-side search results -->
    <div class="col results" tal:condition="query">
      <div class="result">
        <h4>Search results</h4>
        <div
          tal:define="start pageinfo/resultStart; resultsize python:docinfo.get('resultSize',0); grpsize pageinfo/resultPageSize;
                batch python:here.getBatch(start=start,size=grpsize,end=resultsize);">
          <div class="ruler" tal:define="startParam string:resultStart">
            <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
          </div>
          <div class="query">
            Searching "<span tal:content="query" />" (<span tal:content="queryType" />)
          </div>
          <div class="content"
            tal:content="structure python:here.getResultsPage(mode=queryType,query=query,start=start,size=grpsize,pageinfo=pageinfo,docinfo=docinfo)" />
        </div>
      </div>
    </div>
  </metal:block>

  <metal:block metal:define-macro="options_box">
    <!-- search options -->
    <div class="options">
      <h4>Search</h4>
      <form tal:attributes="action viewerUrl">
        <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewLayer':None})"
          tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
        <!-- make sure we have one viewLayer=search -->
        <tal:block tal:repeat="vl viewLayers">
          <input type="hidden" name="viewLayer" tal:attributes="value vl" tal:condition="python:vl != 'search'" />
        </tal:block>
        <input type="hidden" name="viewLayer" value="search" />
        <!-- query text -->
        <input type="text" name="query" tal:attributes="value query" /> <br /> <input type="submit" value="Search" /> <a
          tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a>
        <ul>
          <li><input type="radio" name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" />
            Exact</li>
          <li><input type="radio" name="queryType" value="fulltextMorph"
            tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms</li>
          <li><input type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" />
            Fulltext index</li>
          <li><input type="radio" name="queryType" value="ftIndexMorph"
            tal:attributes="checked python:queryType=='ftIndexMorph'" /> Morphological index</li>
        </ul>
      </form>
    </div>
    <!-- end search options-->
  </metal:block>

</body>

</html>