Changeset 543:6cdc31e9ed8e in documentViewer


Ignore:
Timestamp:
Aug 22, 2012, 2:25:38 PM (12 years ago)
Author:
casties
Branch:
default
Message:

fixed problem with dict-mode in default view.
added configurable footer and logo in site_template.pt

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • css/docuviewer.css

    r542 r543  
    253253        line-height: 1.3;
    254254}
    255 
     255div.col.main div.content.text div.emptyPage {
     256    font-family: Verdana,Arial,sans-serif;
     257    font-size: 12px;
     258}
    256259/*
    257260 * search results
     
    326329}
    327330
    328 
    329 
    330331/*
    331332 * thumbnail overview
     
    338339        text-align: center;
    339340}
     341
     342/*
     343 * footer
     344 */
     345div.footer {
     346    max-width: 68em;
     347        margin-top: 1em;
     348        border-top: 1px solid silver;
     349        margin-left: 28px;
     350        margin-right: 28px;
     351        text-align: center;
     352}
     353div.footer div.content {
     354        font-size: 10px;
     355        color: grey;   
     356}
     357div.footer div.content a:link,
     358div.footer div.content a:visited {
     359        color: grey;
     360}
  • documentViewer.py

    r541 r543  
    261261    def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode="thumbs",start=1,pn=1):
    262262        """
    263         view page
     263        show page
    264264        @param url: url which contains display information
    265265        @param mode: defines how to access the document behind url
    266266        @param viewMode: 'images': display images, 'text': display text, 'xml': display xml, default is 'auto'
    267         @param viewLayer: sub-type of viewMode, e.g. 'dict' for viewMode='text'
     267        @param viewLayer: sub-type of viewMode, e.g. layer 'dict' for viewMode='text'
    268268        @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)
    269269        """
     
    279279            self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary"
    280280           
     281        # docinfo: information about document (cached)
    281282        docinfo = self.getDocinfo(mode=mode,url=url,tocMode=tocMode)
     283       
     284        # userinfo: user settings (cached)
     285        userinfo = self.getUserinfo()
    282286       
    283287        # auto viewMode: text if there is a text else images
     
    286290                # docinfo.get('textURL', None) not implemented yet
    287291                viewMode = "text"
    288                 if viewLayer is None:
     292                if viewLayer is None and 'viewLayer' not in userinfo:
     293                    # use layer dict as default
    289294                    viewLayer = "dict"
    290295            else:
     
    296301            viewLayer = "dict"
    297302           
    298         pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
     303        # safe viewLayer in userinfo
     304        userinfo['viewLayer'] = viewLayer
     305       
     306        # pageinfo: information about page (not cached)
     307        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, userinfo=userinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
    299308                   
    300309        # get template /template/viewer_$viewMode
     
    495504
    496505
     506    def getUserinfo(self):
     507        """returns userinfo object"""
     508        logging.debug("getUserinfo")
     509        userinfo = {}
     510        # look for cached userinfo in session
     511        if self.REQUEST.SESSION.has_key('userinfo'):
     512            userinfo = self.REQUEST.SESSION['userinfo']
     513            # check if its still current?
     514        else:
     515            # store in session
     516            self.REQUEST.SESSION['userinfo'] = userinfo
     517           
     518        return userinfo
     519
    497520    def getDocinfo(self, mode, url, tocMode=None):
    498521        """returns docinfo depending on mode"""
     
    772795   
    773796
    774     def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, viewMode=None, viewLayer=None, tocMode=None):
     797    def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, userinfo=None, viewMode=None, viewLayer=None, tocMode=None):
    775798        """returns pageinfo with the given parameters"""
    776799        logging.debug("getPageInfo(current=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewLayer=%s, tocMode=%s)"%(current,start,rows,cols,viewMode,viewLayer,tocMode))
  • version.txt

    r535 r543  
    1 DocumentViewer 2.2.0
     1DocumentViewer 2.2.2
  • zpt/common_template.zpt

    r536 r543  
    1212                bib docinfo/bib | nothing; bibType docinfo/bibType | nothing;
    1313                formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);">
    14     <div class="logo" tal:condition="exists:here/template/logo.png">
    15       <img tal:attributes="src here/template/logo.png/absolute_url" />
     14    <div class="logo" tal:condition="exists:here/template/site_template.pt/macros/logo">
     15      <metal:block metal:use-macro="here/template/site_template.pt/macros/logo"/>
    1616    </div>
    1717    <div class="title-block">
  • zpt/layer_text_gis.zpt

    r526 r543  
    3131            pidlist python:','.join([p['id'] for p in places]);">
    3232        <h4>Places</h4>
    33         <ul>
     33        Show all places
     34        <ul class="list">
    3435          <li>
    3536            <a
  • zpt/viewer_images.zpt

    r540 r543  
    111111      <div class="errortext">Sorry, access to this document is restricted.</div>
    112112    </div>
     113    <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     114      <!-- footer -->
     115      <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     116    </tal:block>
     117   
    113118  </tal:block>
    114119</body>
    115120<body tal:condition="not:numPages">
    116121  <div class="errortext">Sorry, document doesn't exist.</div>
     122  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     123    <!-- footer -->
     124    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     125  </tal:block>
    117126</body>
    118127</html>
  • zpt/viewer_index.zpt

    r542 r543  
    128128      </div>
    129129
    130       <div class="options">
     130      <div class="options" tal:condition="docpath">
    131131        <h4>Search</h4>
    132132        <form tal:define="queryType string:fulltextMorph" tal:condition="docpath" tal:attributes="action viewerUrl">
    133           <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':None})"
    134             tal:repeat="param params" tal:attributes="name param; value python:params[param]" /> <input type="hidden"
    135             name="viewLayer" value="search" />
     133          <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':'search'})"
     134            tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
    136135          <!-- query text -->
    137136          <input type="text" name="query" tal:attributes="value query" /> <br /> <input type="submit" value="Search" /> <a
     
    150149      </div>
    151150      <!-- end search options-->
    152       <!--BEGIN search
    153           <form tal:define="queryType string:fulltextMorph" tal:condition="docpath" tal:attributes="action python:here.getLink()">
    154             <input type="hidden" tal:define="params python:here.getParams('viewMode', None)" tal:repeat="param params"
    155               tal:attributes="name param; value python:params[param]" /> <input type="hidden" name="viewLayer" value="search" />
    156             <input type="text" name="query" tal:attributes="value query" /> <input type="submit" value="Search full document" /> <a
    157               tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a><br /> <input type="radio"
    158               name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" /> Exact <input type="radio"
    159               name="queryType" value="fulltextMorph" tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms <input
    160               type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" /> Fulltext index
    161             <input type="radio" name="queryType" value="ftIndexMorph" tal:attributes="checked python:queryType=='ftIndexMorph'" />
    162             Morphological index
    163           </form>
    164           END search-->
    165151    </div>
    166152  </div>
     153  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     154    <!-- footer -->
     155    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     156  </tal:block>
     157 
    167158</body>
    168159<body tal:condition="not:numPages">
    169160  <div class="errortext">Sorry, document doesn't exist.</div>
     161  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     162    <!-- footer -->
     163    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     164  </tal:block>
    170165</body>
    171166</html>
  • zpt/viewer_text.zpt

    r540 r543  
    1515<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
    1616<script type="text/javascript">
    17         // <!--
     17// <!--
    1818        $(document).ready(function() {
    1919                // autosubmit forms
     
    3838                pn pageinfo/pn;
    3939                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
    40                 textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
     40                textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo);">
    4141    <!-- header -->
    4242    <div class="page-head">
     
    5555          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
    5656        </div>
    57         <div class="content text">
     57        <div class="content text" tal:condition="textPage">
    5858          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
    5959            tal:content="structure pageinfo/pageHeaderTitle" />
    60           <tal:block tal:replace="structure textPage" />
     60          <tal:block tal:condition="textPage" tal:replace="structure textPage"/>
     61          <div class="emptyPage" tal:condition="not:textPage">[Empty page]</div>
    6162        </div>
    6263      </div>
     
    140141      <div class="errortext">Sorry, access to this document is restricted.</div>
    141142    </div>
    142 
     143   
     144    <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     145      <!-- footer -->
     146      <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     147    </tal:block>
    143148  </tal:block>
    144149</body>
    145150<body tal:condition="not:numPages">
    146151  <div class="errortext">Sorry, document doesn't exist.</div>
     152    <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     153      <!-- footer -->
     154      <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     155    </tal:block>
    147156</body>
    148157</html>
  • zpt/viewer_thumbs.zpt

    r540 r543  
    9696      <div class="errortext">Sorry, access to this document is restricted.</div>
    9797    </div>
     98    <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     99      <!-- footer -->
     100      <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     101    </tal:block>
    98102  </tal:block>
    99103</body>
    100104<body tal:condition="not:numPages">
    101105  <div class="errortext">Sorry, document doesn't exist.</div>
     106  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     107    <!-- footer -->
     108    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     109  </tal:block>
    102110</body>
    103111</html>
  • zpt/viewer_xml.zpt

    r540 r543  
    8383    </div>
    8484
     85    <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     86      <!-- footer -->
     87      <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     88    </tal:block>
    8589  </tal:block>
    8690</body>
    8791<body tal:condition="not:numPages">
    8892  <div class="errortext">Sorry, document doesn't exist.</div>
     93  <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     94    <!-- footer -->
     95    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
     96  </tal:block>
    8997</body>
    9098</html>
Note: See TracChangeset for help on using the changeset viewer.