Changeset 559:eabfbad6aeb4 in documentViewer


Ignore:
Timestamp:
Sep 28, 2012, 4:50:59 PM (12 years ago)
Author:
casties
Branch:
default
Message:

"extended" layer for index view and some bugfixes.

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • MpdlXmlTextServer.py

    r554 r559  
    5151        url = self.serverUrl+method
    5252        return getHttpData(url,data,timeout=self.timeout)
     53
     54
     55    def getTextDownloadUrl(self, type='xml', docinfo=None):
     56        """returns a URL to download the current text"""
     57        docpath = docinfo.get('textURLPath', None)
     58        if not docpath:
     59            return None
     60
     61        docpath = docpath.replace('.xml','.'+type)
     62        url = '%sgetDoc?doc=%s'%(self.serverUrl.replace('interface/',''), docpath)
     63        return url
    5364
    5465
  • documentViewer.py

    r558 r559  
    137137    layer_text_gis = PageTemplateFile('zpt/layer_text_gis', globals())
    138138    layer_text_pundit = PageTemplateFile('zpt/layer_text_pundit', globals())
     139    layer_index_extended = PageTemplateFile('zpt/layer_index_extended', globals())
    139140    # toc templates
    140141    toc_thumbs = PageTemplateFile('zpt/toc_thumbs', globals())
     
    219220        return self.template.fulltextclient.getTocPage(**args)
    220221
     222    def getTextDownloadUrl(self, **args):
     223        """get list of gis places on one page"""
     224        return self.template.fulltextclient.getTextDownloadUrl(**args)
     225 
    221226    def getPlacesOnPage(self, **args):
    222227        """get list of gis places on one page"""
  • zpt/viewer_index.zpt

    r558 r559  
    88                  docpath docinfo/textURLPath | nothing;
    99                  query nothing;
    10                   numPages docinfo/numPages | nothing;">
     10                  numPages docinfo/numPages | nothing;
     11                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
    1112<head>
    1213<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    1314<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
    14 <link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
    15 <!--  layer headers (rendered always) -->
     15<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
     16<script type="text/javascript" tal:attributes="src string:$viewerUrl/template/jquery_js"></script>
     17<script type="text/javascript">
     18// <!--
     19  $(document).ready(function() {
     20    // autosubmit forms
     21    $('form.autosubmit').find('.autosubmit').change(function() {
     22      this.form.submit();
     23    });
     24    $('form.autosubmit input[type="submit"]').hide();
     25  });
     26// -->
     27</script>
     28<!--  layer headers (all available) -->
    1629<tal:block tal:repeat="layer availableLayers">
    17   <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
     30  <tal:block tal:define="mpath string:here/template/layer_index_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
    1831    <metal:block metal:use-macro="python:path(mpath)" />
    1932  </tal:block>
     
    3851
    3952    <div class="col main">
     53     <!-- main content column -->
    4054      <div class="index-info">
    4155        <h2>Bibliographic information</h2>
    42         <table border="0"
    43           tal:define="formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None),bibxdata=docinfo.get('bibx', None))">
     56        <table border="0">
    4457          <tal:x condition="python:formattedData">
    4558            <!-- wenn es bibinfo in docinfo gibt -->
     
    8295              <td class="content" tal:content="dri" />
    8396            </tr>
    84             <tr>
     97            <!-- <tr>
    8598              <td class="type">Permanent URL:</td>
    8699              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
    87100                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
    88             </tr>
     101            </tr> -->
    89102          </table>
    90103        </tal:block>
     
    114127        </tal:block>
    115128      </div>
    116     </div>
     129    </div> <!-- /main content column -->
     130   
    117131    <div class="col buttons">
    118       <div class="options">
    119         <h4>Metadata</h4>
    120         <form tal:attributes="action viewerUrl" class="autosubmit">
    121           <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})"
    122             tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
    123           <ul>
    124             <!-- text layer select buttons (rendered always) -->
    125             <tal:block tal:repeat="layer availableLayers">
    126               <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/layer_select_li"
    127                 tal:condition="python:exists(mpath)">
    128                 <li metal:use-macro="python:path(mpath)" />
    129               </tal:block>
    130             </tal:block>
    131           </ul>
    132           <input type="submit" value="Go!" />
    133         </form>
    134       </div>
    135 
     132      <!-- option block column -->
    136133      <div class="options">
    137134        <h4>Browse</h4>
     
    145142        Download full document
    146143        <ul class="list">
    147           <li><a target="_blank"
    148             tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath.replace('.xml','.html'))"
     144          <li><a target="_blank" rel="nofollow" class="download"
     145            tal:attributes="href python:here.getTextDownloadUrl(type='html',docinfo=docinfo)"
    149146            target="_blank">as HTML</a></li>
    150           <li><a target="_blank"
    151             tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">as
     147          <li><a target="_blank" rel="nofollow" class="download"
     148            tal:attributes="href python:here.getTextDownloadUrl(type='xml',docinfo=docinfo)" target="_blank">as
    152149              XML</a></li>
    153150        </ul>
     
    176173        </form>
    177174      </div>
    178       <!-- end search options-->
    179     </div>
     175
     176      <div class="options" tal:condition="availableLayers">
     177        <h4>Metadata</h4>
     178        <form tal:attributes="action viewerUrl" class="autosubmit">
     179          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
     180            tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
     181          <ul>
     182            <!-- text layer select buttons (rendered always) -->
     183            <tal:block tal:repeat="layer availableLayers">
     184              <tal:block tal:define="mpath string:here/template/layer_index_${layer}/macros/layer_select_li"
     185                tal:condition="python:exists(mpath)">
     186                <li metal:use-macro="python:path(mpath)" />
     187              </tal:block>
     188            </tal:block>
     189          </ul>
     190          <input type="submit" value="Go!" />
     191        </form>
     192      </div>
     193    </div> <!-- /option block column -->     
    180194  </div>
    181195  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
  • zpt/viewer_text.zpt

    r545 r559  
    7575      <div class="col buttons">
    7676        <!--"BEGIN TEXT DISPLAY"  -->
    77         <div class="options">
     77        <div class="options" tal:condition="availableLayers">
    7878          <h4>Text layer</h4>
    7979          <form tal:attributes="action viewerUrl" class="autosubmit">
    80             <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})"
     80            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
    8181              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
    8282            <ul>
Note: See TracChangeset for help on using the changeset viewer.