view zpt/viewer_text.zpt @ 525:70c3ae5eac7c

layers can have their own templates. first version of annotations layer.
author casties
date Thu, 05 Apr 2012 19:29:50 +0200
parents c55e376be01b
children 3f375a048402
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"
  tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
              tocMode pageinfo/tocMode; viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
              availableLayers python:here.getAvailableLayers().get('text', None);
              viewerUrl docinfo/viewerUrl;
              rootUrl here/getDocumentViewerURL;
              numPages docinfo/numPages | nothing;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
<link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
<script type="text/javascript">
    // <!--
    $(document).ready(function() {
        // autosubmit forms
        $('form.autosubmit').find('.autosubmit').change(function() {
            this.form.submit();
        });
        $('form.autosubmit input[type="submit"]').hide();
    });
// -->
</script>
<!--  layer headers -->
<tal:block tal:repeat="layer viewLayers">
  <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/html_head"
    tal:condition="python:exists(mpath)">
    <metal:block metal:use-macro="python:path(mpath)" />
  </tal:block>
</tal:block>

</head>
<body tal:condition="numPages">
  <tal:block
    tal:define="docpath docinfo/textURLPath;
                pn pageinfo/pn; 
                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
                query python:request.get('query', None); 
                queryType python:request.get('queryType','fulltextMorph');
                textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
    <!-- header -->
    <div class="page-head">
      <metal:block metal:use-macro="here/template/common_template/macros/head" />
    </div>
    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
      <!--table of contents-->
      <div class="col toc">
        <metal:block
          metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
      </div>

      <!-- text page -->
      <div class="col main">
        <div class="ruler">
          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
        </div>
        <ul class="switcher">
          <li>
            <a tal:attributes="href python:here.getLink('viewMode','images')">Image</a>
          </li>
          <li class="sel">Text</li>
        </ul>
        <div class="content">
          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
            tal:content="structure pageinfo/pageHeaderTitle" />
          <tal:block tal:replace="structure textPage" />
        </div>
      </div>
      <!-- end of col-main -->

      <!-- right-side search results -->
      <div class="col results" tal:condition="query">
        <!--"BEGIN SEARCH RESULTS"  -->
        <div class="options">
          <h4>Search results</h4>
          <div metal:use-macro="here/template/search_template/macros/results_div" />
        </div>
      </div>

      <!-- right-side options -->
      <div class="col buttons">
        <!--"BEGIN TEXT DISPLAY"  -->
        <div class="options">
          <h4>Text display</h4>
          <form tal:attributes="action viewerUrl" class="autosubmit">
            <input type="hidden"
              tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})"
              tal:repeat="param params"
              tal:attributes="name param; value python:params[param]" />
            <ul>
              <li>
                <input class="autosubmit" type="radio" name="viewMode" value="text"
                  tal:attributes="checked python:viewMode=='text'" /> Text
                <ul>
                  <!-- text layers -->
                  <li>
                    <input type="checkbox" class="autosubmit" name="viewLayer"
                      value="dict" tal:attributes="checked python:'dict' in viewLayers" />
                    Dictionary
                  </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>
                  <!-- auto-layer select buttons -->
                  <tal:block tal:repeat="layer availableLayers">
                    <tal:block
                      tal:define="mpath string:here/template/layer_text_${layer}/macros/layer_select_li"
                      tal:condition="python:exists(mpath)">
                      <li metal:use-macro="python:path(mpath)" />
                    </tal:block>
                  </tal:block>
                </ul>
              </li>
              <li>
                <input type="radio" class="autosubmit" name="viewMode" value="xml"
                  tal:attributes="checked python:viewMode=='xml'" /> XML<br /> <input
                  type="submit" value="Go!" />
              </li>
            </ul>
          </form>
        </div>
        <!--"END TEXT DISPLAY"-->

        <!--"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"-->

        <!--"BEGIN TEXT SIZE"-->
        <div class="options">
          <h4>Text size</h4>
          <ul class="fsizer">
            <li>
              <a href="javascript:fontSize(12);" class="fs_sml">S</a>
            </li>
            <li>
              <a href="javascript:fontSize(14);" class="fs_med">M</a>
            </li>
            <li>
              <a href="javascript:fontSize(16);" class="fs_lrg">L</a>
            </li>
          </ul>
        </div>
        <!--"END TEXT SIZE"-->

        <!--"BEGIN DICTIONARY OVERVIEW"-->
        <div class="options" tal:condition="python:'dict' in viewLayers">
          <h4>Dictionary view</h4>
          <form name="f3" action="">
            <ul>
              <li>
                <input type="radio" name="r3" /> Tab
              </li>
              <li>
                <input type="radio" name="r3" /> Window
              </li>
            </ul>
          </form>
        </div>
        <!--"END DICTIONARY OVERVIEW"-->

        <!--"BEGIN TEXT NORMALIZATION"-->
        <div class="options">
          <h4>Text normalization</h4>
          <form tal:attributes="action viewerUrl" class="autosubmit"
            tal:define="norm python:pageinfo.get('characterNormalization','regPlusNorm');">
            <input type="hidden"
              tal:define="params python:here.getParams(params={'characterNormalization':None, 'viewLayer':viewLayer})"
              tal:repeat="param params"
              tal:attributes="name param; value python:params[param]" />
            <ul>
              <li>
                <input type="radio" class="autosubmit" name="characterNormalization"
                  value="orig" tal:attributes="checked python:norm=='orig'" /> Original
              </li>
              <li>
                <input type="radio" class="autosubmit" name="characterNormalization"
                  value="reg" tal:attributes="checked python:norm=='reg'" /> Regularized
              </li>
              <li>
                <input type="radio" class="autosubmit" name="characterNormalization"
                  value="regPlusNorm" tal:attributes="checked python:norm=='regPlusNorm'" />
                Normalized
              </li>
            </ul>
            <input type="submit" value="Go!" />
          </form>
        </div>
        <!--"END TEXT NORMALIZATION"-->

        <!--  auto-layer option boxes -->
        <tal:block tal:repeat="layer viewLayers">
          <tal:block
            tal:define="mpath string:here/template/layer_text_${layer}/macros/options_box"
            tal:condition="python:exists(mpath)">
            <metal:block metal:use-macro="python:path(mpath)" />
          </tal:block>
        </tal:block>
      </div>
      <!-- /col-right -->

    </div>
    <!-- /page-body -->

    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
      <div class="errortext">Sorry, access to this document is restricted.</div>
    </div>

  </tal:block>
</body>
<body tal:condition="not:numPages">
  <div class="errortext">Sorry, document doesn't exist.</div>
</body>
</html>