Changeset 525:70c3ae5eac7c in documentViewer for zpt


Ignore:
Timestamp:
Apr 5, 2012, 5:29:50 PM (12 years ago)
Author:
casties
Branch:
default
Message:

layers can have their own templates.
first version of annotations layer.

Location:
zpt
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • zpt/viewer_text.zpt

    r514 r525  
    44  tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
    55              tocMode pageinfo/tocMode; viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
     6              availableLayers python:here.getAvailableLayers().get('text', None);
    67              viewerUrl docinfo/viewerUrl;
    78              rootUrl here/getDocumentViewerURL;
    89              numPages docinfo/numPages | nothing;">
    910<head>
    10   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    11   <title
    12     tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
    13   <link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
    14   <script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
    15   <script type="text/javascript">
    16             // <!--
    17             $(document).ready(function() {
    18                 // autosubmit forms
    19                 $('form.autosubmit').find('.autosubmit').change(function() {
    20                     this.form.submit();
    21                 });
    22                 $('form.autosubmit input[type="submit"]').hide();
    23             });
    24         // -->
    25         </script>
     11<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     12<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
     13<link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
     14<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
     15<script type="text/javascript">
     16    // <!--
     17    $(document).ready(function() {
     18        // autosubmit forms
     19        $('form.autosubmit').find('.autosubmit').change(function() {
     20            this.form.submit();
     21        });
     22        $('form.autosubmit input[type="submit"]').hide();
     23    });
     24// -->
     25</script>
     26<!--  layer headers -->
     27<tal:block tal:repeat="layer viewLayers">
     28  <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/html_head"
     29    tal:condition="python:exists(mpath)">
     30    <metal:block metal:use-macro="python:path(mpath)" />
     31  </tal:block>
     32</tal:block>
     33
    2634</head>
    2735<body tal:condition="numPages">
     
    6876        <div class="options">
    6977          <h4>Search results</h4>
    70           <div metal:use-macro="here/template/search_template/macros/results_div"/>
     78          <div metal:use-macro="here/template/search_template/macros/results_div" />
    7179        </div>
    7280      </div>
     
    8795                  tal:attributes="checked python:viewMode=='text'" /> Text
    8896                <ul>
     97                  <!-- text layers -->
    8998                  <li>
    9099                    <input type="checkbox" class="autosubmit" name="viewLayer"
     
    95104                    <input type="checkbox" class="autosubmit" name="viewLayer"
    96105                      value="search"
    97                       tal:attributes="checked python:'search' in viewLayers" /> Search hits
     106                      tal:attributes="checked python:'search' in viewLayers" /> Search
     107                    hits
    98108                  </li>
    99                   <li tal:condition="python:docinfo.get('numPlaces',0)">
    100                     <input type="checkbox" class="autosubmit" name="viewLayer" value="gis"
    101                       tal:attributes="checked python:'gis' in viewLayers" /> Places<br />
    102                   </li>
     109                  <!-- auto-layer select buttons -->
     110                  <tal:block tal:repeat="layer availableLayers">
     111                    <tal:block
     112                      tal:define="mpath string:here/template/layer_text_${layer}/macros/layer_select_li"
     113                      tal:condition="python:exists(mpath)">
     114                      <li metal:use-macro="python:path(mpath)" />
     115                    </tal:block>
     116                  </tal:block>
    103117                </ul>
    104118              </li>
     
    123137            <!-- make sure we have one viewLayer=search -->
    124138            <tal:block tal:repeat="vl viewLayers">
    125                 <input type="hidden" name="viewLayer" tal:attributes="value vl" tal:condition="python:vl != 'search'"/>
     139              <input type="hidden" name="viewLayer" tal:attributes="value vl"
     140                tal:condition="python:vl != 'search'" />
    126141            </tal:block>
    127             <input type="hidden" name="viewLayer" value="search"/>
     142            <input type="hidden" name="viewLayer" value="search" />
    128143            <!-- query text -->
    129             <input type="text" name="query" tal:attributes="value query"/>
    130             <input type="submit" value="Search"/>
    131             <a tal:attributes="href python:here.getLink('query',None)">Clear</a>
    132             <ul>
    133                 <li>
    134                   <input type="radio" name="queryType" value="fulltext"
    135                     tal:attributes="checked python:queryType=='fulltext'"/> Exact
    136                 </li>
    137                 <li>
    138                   <input type="radio" name="queryType" value="fulltextMorph"
    139                     tal:attributes="checked python:queryType=='fulltextMorph'"/> All forms
    140                 </li>
    141                 <li>
    142                   <input type="radio" name="queryType" value="ftIndex"
    143                     tal:attributes="checked python:queryType=='ftIndex'"/> Fulltext index
    144                 </li>
    145                 <li>
    146                   <input type="radio" name="queryType" value="ftIndexMorph"
    147                     tal:attributes="checked python:queryType=='ftIndexMorph'"/> Morphological index
    148                 </li>
     144            <input type="text" name="query" tal:attributes="value query" /> <input
     145              type="submit" value="Search" /> <a
     146              tal:attributes="href python:here.getLink('query',None)">Clear</a>
     147            <ul>
     148              <li>
     149                <input type="radio" name="queryType" value="fulltext"
     150                  tal:attributes="checked python:queryType=='fulltext'" /> Exact
     151              </li>
     152              <li>
     153                <input type="radio" name="queryType" value="fulltextMorph"
     154                  tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms
     155              </li>
     156              <li>
     157                <input type="radio" name="queryType" value="ftIndex"
     158                  tal:attributes="checked python:queryType=='ftIndex'" /> Fulltext index
     159              </li>
     160              <li>
     161                <input type="radio" name="queryType" value="ftIndexMorph"
     162                  tal:attributes="checked python:queryType=='ftIndexMorph'" />
     163                Morphological index
     164              </li>
    149165            </ul>
    150166          </form>
     
    214230        <!--"END TEXT NORMALIZATION"-->
    215231
    216         <!--"BEGIN PLACES"-->
    217         <div class="options" tal:condition="python:'gis' in viewLayers">
    218           <tal:block tal:define="
    219             name docinfo/documentName;
    220             places python:here.getPlacesOnPage(docinfo=docinfo, pn=pn);
    221             pidlist python:','.join([p['id'] for p in places]);">
    222             <h4>Places</h4>
    223             <ul>
    224             <li><a
    225               tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?id=%s&format=gis'%(name,pidlist)"
    226               target="_blank">on this page</a>
    227             </li>
    228             <li>
    229               <a
    230               tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?format=gis'%(name)"
    231               target="_blank">in whole document</a>
    232             </li>
    233             </ul>
     232        <!--  auto-layer option boxes -->
     233        <tal:block tal:repeat="layer viewLayers">
     234          <tal:block
     235            tal:define="mpath string:here/template/layer_text_${layer}/macros/options_box"
     236            tal:condition="python:exists(mpath)">
     237            <metal:block metal:use-macro="python:path(mpath)" />
    234238          </tal:block>
    235         </div>
    236         <!--"END PLACES"-->
     239        </tal:block>
    237240      </div>
    238241      <!-- /col-right -->
Note: See TracChangeset for help on using the changeset viewer.