Changeset 501:29c6d09a506c in documentViewer for zpt/viewer_index.zpt


Ignore:
Timestamp:
Feb 15, 2012, 4:57:02 PM (12 years ago)
Author:
casties
Branch:
elementtree
Message:

more cleanup.
viewMode=index works now.
moved common template parts in common_template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zpt/viewer_index.zpt

    r499 r501  
    44  tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
    55                  tocMode pageinfo/tocMode; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
     6                  docpath docinfo/textURLPath | nothing;
     7                  query nothing;
    68                  numPages docinfo/numPages | nothing;">
    79<head>
     
    1113</head>
    1214<body tal:condition="numPages">
    13   <tal:block
    14     tal:define="docpath docinfo/textURLPath;
    15                 query nothing;">
    16     <table width="98%">
    17       <tr>
    18         <td valign="top">
    19               <a href="http://echo.mpiwg-berlin.mpg.de/content">
    20                 <img border="0" src="images/logo.png" align="top" alt=""/>
    21               </a>
    22             </td>
    23         <td valign="top" align="right">
    24           <!--<b><span>home</span>&nbsp;&nbsp;&nbsp;<span>contact</span>&nbsp;&nbsp;&nbsp;<span>help</span></b>-->
    25         </td>
    26         <td valign="top" align="right">
    27           <!--BEGIN search -->
    28           <form tal:condition="docpath" tal:attributes="action python:here.getLink()">
    29                 <input type="hidden" tal:define="params python:here.getParams('viewMode', None)" tal:repeat="param params" tal:attributes="name param; value python:params[param]"/>
    30         <input class="textMain" name="query" onfocus="this.select();"  type="text" tal:attributes="value query"/>
    31         <input type="submit" class="buttonMain" value="Search in Book"/>           
    32           </form>
    33           <!-- END search-->
    34         </td>
    35       </tr>
    36     </table>
    37     <table border="0">
    38       <tr>
    39         <td valign="top">
    40           <a tal:define="tp docinfo/titlePage | nothing" tal:attributes="href python:context.getLink('viewMode','auto')">
    41         <img tal:condition="tp" border="0" tal:attributes="src string:${docinfo/imageURL}&pn=$tp&dw=300&dh=500"/>
    42         <img tal:condition="not:tp" border="0" src="images/oldbook.png"/>
    43           </a>
    44         </td>
    45         <td valign="top">
    46               <table border=0 id="bibinfo" tal:define="formattedData python:here.metadata.getFormattedMetaDataExtended(bibdata=docinfo.get('bib', None))">
    47             <!-- wenn es bibinfo in docinfo gibt -->
     15  <h1>Document information</h1>
    4816
    49             <tal:x condition="python:formattedData">
    50               <div tal:replace="structure python:formattedData"/>
    51               <!-- <div><a href="javascript:showExtendedMetadata(1)">extended</a></div> -->
    52                   <div tal:condition="exists:docinfo/attribution" tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=docinfo['attribution'])"/>
    53                   <div tal:condition="exists:docinfo/copyright" tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=docinfo['copyright'])"/>
    54             </tal:x>
     17  <div class="index-image">
     18    <!-- image -->
     19    <a tal:define="tp docinfo/titlePage | nothing"
     20      tal:attributes="href python:context.getLink('viewMode','auto')"><img
     21      tal:condition="tp" border="0"
     22      tal:attributes="src string:${docinfo/imageURL}&pn=$tp&dw=300&dh=500" /><img
     23      tal:condition="not:tp" border="0" src="images/oldbook.png" /></a>
     24  </div>
    5525
    56             <!-- kein template fuer die daten -->
    57             <tal:x condition="python:formattedData==None">
    58               <tal:x condition="exists:docinfo/bib">
    59                 <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
    60                   <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'"/>
    61                   <td class="content" tal:content="bibinfo/bib"/>
    62                 </tr>
    63               </tal:x>
    64              
    65               <!-- wenn es keine bibinfo gibt (archimedes-texte) -->
    66               <tal:y condition="not:exists:docinfo/bib">
    67                 <tr>
    68                   <td class="type">Author:</td>
    69                   <td class="content" tal:content="python:docinfo['creator']"/>
    70                 </tr>
    71                 <tr>
    72                   <td class="type">Title:</td>
    73                   <td class="content" tal:content="python:docinfo['title']"/>
    74                 </tr>
    75                 <tr>
    76                   <td class="type">Year:</td>
    77                   <td class="content" tal:content="python:docinfo['date']"/>
    78                 </tr>
    79               </tal:y>
    80             </tal:x> <!-- ende kein template fuer die daten -->
    81               </table>
     26  <div class="index-info">
     27    <table border="0"
     28      tal:define="formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None))">
     29      <tal:x condition="python:formattedData">
     30        <!-- wenn es bibinfo in docinfo gibt -->
     31        <tr tal:replace="structure python:formattedData" />
     32      </tal:x>
    8233
    83           <br/><br/><br/><br/><br/><br/>
    84           <table border="0" width="100%">
    85         <tr>
    86           <td>
    87             <a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">Access Book</a>
    88           </td>
    89         </tr>
    90        
    91         <tr tal:condition="docpath">
    92           <td class="openbutton1">Download:
    93             <a tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s.html'%(docpath.replace('.xml','.html'))" target="_blank">html</a>
    94             /
    95             <a tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">xml</a>
    96           </td>
    97         </tr>
    98           </table>
    99         </td>
    100       </tr>
     34      <tal:x condition="python:formattedData==None">
     35        <!-- kein template fuer die daten -->
     36        <tal:x condition="exists:docinfo/bib">
     37          <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
     38            <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
     39            <td class="content" tal:content="bibinfo/bib" />
     40          </tr>
     41        </tal:x>
     42
     43        <tal:y condition="not:exists:docinfo/bib">
     44          <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
     45          <tr>
     46            <td class="type">Author:</td>
     47            <td class="content" tal:content="docinfo/creator" />
     48          </tr>
     49          <tr>
     50            <td class="type">Title:</td>
     51            <td class="content" tal:content="docinfo/title" />
     52          </tr>
     53          <tr>
     54            <td class="type">Date:</td>
     55            <td class="content" tal:content="docinfo/date" />
     56          </tr>
     57        </tal:y>
     58      </tal:x>
     59      <!-- ende kein template fuer die daten -->
    10160    </table>
    10261
    103 </tal:block>
     62    <table border="0">
     63      <!-- attribution -->
     64      <tr tal:condition="exists:docinfo/attribution"
     65        tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=docinfo['attribution'])" />
     66      <!-- copyright -->
     67      <tr tal:condition="exists:docinfo/copyright"
     68        tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=docinfo['copyright'])" />
     69    </table>
     70  </div>
     71
     72  <div>
     73    <div>
     74      <a class="openbutton"
     75        tal:attributes="href python:context.getLink('viewMode','auto')">Access Book</a>
     76    </div>
     77    <div tal:condition="docpath">
     78      Download: <a
     79        tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath.replace('.xml','.html'))"
     80        target="_blank">html</a> / <a
     81        tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)"
     82        target="_blank">xml</a>
     83    </div>
     84    <div>
     85      <!--BEGIN search -->
     86      <form tal:condition="docpath" tal:attributes="action python:here.getLink()">
     87        <input type="hidden" tal:define="params python:here.getParams('viewMode', None)"
     88          tal:repeat="param params"
     89          tal:attributes="name param; value python:params[param]" /> <input
     90          class="textMain" name="query" onfocus="this.select();" type="text"
     91          tal:attributes="value query" /> <input type="submit" class="buttonMain"
     92          value="Search in Book" />
     93      </form>
     94      <!-- END search-->
     95    </div>
     96  </div>
     97  <!-- DEBUG -->
     98  <!-- <p tal:content="python:repr(docinfo)" /> -->
    10499</body>
    105100<body tal:condition="not:numPages">
Note: See TracChangeset for help on using the changeset viewer.