diff zpt/layer_text_search.zpt @ 526:3f375a048402

moved search and dict into separate layers. removed search_template. added tocMode=concordance. fixed bug with paging tocs.
author casties
date Tue, 10 Apr 2012 19:41:44 +0200
parents
children 0b8bed1223ad
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/layer_text_search.zpt	Tue Apr 10 19:41:44 2012 +0200
@@ -0,0 +1,90 @@
+<!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 hits
+        </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">
+      <!--"BEGIN SEARCH RESULTS"  -->
+      <div class="options">
+        <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="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">
+    <!--"BEGIN SEARCH"-->
+    <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" /> <input
+          type="submit" value="Search" /> <a
+          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"-->
+  </metal:block>
+
+</body>
+
+</html>