changeset 499:3f9703746fef elementtree

more cleanup. new template for viewMode=index (not pretty so far).
author casties
date Mon, 13 Feb 2012 19:28:33 +0100
parents 3146b4e7b6a5
children 62cc3d7f7570
files documentViewer.py zpt/viewer_index.zpt
diffstat 2 files changed, 119 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Fri Feb 10 19:05:45 2012 +0100
+++ b/documentViewer.py	Mon Feb 13 19:28:33 2012 +0100
@@ -116,18 +116,11 @@
     # templates and forms
     viewer_text = PageTemplateFile('zpt/viewer_text', globals())
     viewer_images = PageTemplateFile('zpt/viewer_images', globals())
-    viewer_main = PageTemplateFile('zpt/viewer_main', globals())
+    viewer_index = PageTemplateFile('zpt/viewer_index', globals())
     toc_thumbs = PageTemplateFile('zpt/toc_thumbs', globals())
     toc_text = PageTemplateFile('zpt/toc_text', globals())
     toc_figures = PageTemplateFile('zpt/toc_figures', globals())
     toc_none = PageTemplateFile('zpt/toc_none', globals())
-    page_main_images = PageTemplateFile('zpt/page_main_images', globals())
-    page_main_double = PageTemplateFile('zpt/page_main_double', globals())
-    page_main_text = PageTemplateFile('zpt/page_main_text', globals())
-    page_main_text_dict = PageTemplateFile('zpt/page_main_text_dict', globals())
-    page_main_gis =PageTemplateFile ('zpt/page_main_gis', globals())
-    page_main_xml = PageTemplateFile('zpt/page_main_xml', globals())
-    page_main_pureXml = PageTemplateFile('zpt/page_main_pureXml', globals())
     head_main = PageTemplateFile('zpt/head_main', globals())
     info_xml = PageTemplateFile('zpt/info_xml', globals())
     docuviewer_css = ImageFile('css/docuviewer.css',globals())
@@ -135,9 +128,6 @@
     docuviewer_css.index_html = refreshingImageFileIndexHtml
     
     
-    thumbs_main_rss = PageTemplateFile('zpt/thumbs_main_rss', globals())
-
-    
     def __init__(self,id,imageScalerUrl=None,textServerName=None,title="",digilibBaseUrl=None,thumbcols=2,thumbrows=5,authgroups="mpiwg"):
         """init document viewer"""
         self.id=id
@@ -182,6 +172,14 @@
         """returns full text content of page"""
         return self.template.fulltextclient.getTextPage(**args)
 
+    def getToc(self, **args):
+        """returns the full table of contents (in internal format)"""
+        return self.template.fulltextclient.getToc(**args)
+
+    def getTocPage(self, **args):
+        """returns one page of the table of contents"""
+        return self.template.fulltextclient.getTocPage(**args)
+
     #WTF?
     def getQuery(self, **args):
         """get query in search"""
@@ -222,15 +220,8 @@
         """get lex"""
         return self.template.fulltextclient.getLex(**args)
 
-    def getToc(self, **args):
-        """returns the full table of contents (in internal format)"""
-        return self.template.fulltextclient.getToc(**args)
-
-    def getTocPage(self, **args):
-        """returns one page of the table of contents"""
-        return self.template.fulltextclient.getTocPage(**args)
-
-    
+    #WTF?
+    thumbs_main_rss = PageTemplateFile('zpt/thumbs_main_rss', globals())
     security.declareProtected('View','thumbs_rss')
     def thumbs_rss(self,mode,url,viewMode="auto",start=None,pn=1):
         '''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer_index.zpt	Mon Feb 13 19:28:33 2012 +0100
@@ -0,0 +1,108 @@
+<!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; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
+                  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" />
+</head>
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="docpath docinfo/textURLPath; 
+                query nothing;">
+    <table width="98%">
+      <tr>
+        <td valign="top">
+              <a href="http://echo.mpiwg-berlin.mpg.de/content">
+                <img border="0" src="images/logo.png" align="top" alt=""/>
+              </a>
+            </td>
+        <td valign="top" align="right">
+          <!--<b><span>home</span>&nbsp;&nbsp;&nbsp;<span>contact</span>&nbsp;&nbsp;&nbsp;<span>help</span></b>-->
+        </td>
+        <td valign="top" align="right">
+          <!--BEGIN search -->
+          <form tal:condition="docpath" tal:attributes="action python:here.getLink()">
+                <input type="hidden" tal:define="params python:here.getParams('viewMode', None)" tal:repeat="param params" tal:attributes="name param; value python:params[param]"/>
+        <input class="textMain" name="query" onfocus="this.select();"  type="text" tal:attributes="value query"/>
+        <input type="submit" class="buttonMain" value="Search in Book"/>           
+          </form>
+          <!-- END search-->
+        </td>
+      </tr>
+    </table>
+    <table border="0">
+      <tr>
+        <td valign="top">
+          <a tal:define="tp docinfo/titlePage | nothing" tal:attributes="href python:context.getLink('viewMode','auto')">
+        <img tal:condition="tp" border="0" tal:attributes="src string:${docinfo/imageURL}&pn=$tp&dw=300&dh=500"/>
+        <img tal:condition="not:tp" border="0" src="images/oldbook.png"/>
+          </a>
+        </td>
+        <td valign="top">
+              <table border=0 id="bibinfo" tal:define="formattedData python:here.metadata.getFormattedMetaDataExtended(bibdata=docinfo.get('bib', None))">
+            <!-- wenn es bibinfo in docinfo gibt -->
+
+            <tal:x condition="python:formattedData">
+              <div tal:replace="structure python:formattedData"/>
+              <!-- <div><a href="javascript:showExtendedMetadata(1)">extended</a></div> -->
+                  <div tal:condition="exists:docinfo/attribution" tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=docinfo['attribution'])"/>
+                  <div tal:condition="exists:docinfo/copyright" tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=docinfo['copyright'])"/>
+            </tal:x>
+
+            <!-- kein template fuer die daten -->
+            <tal:x condition="python:formattedData==None">
+              <tal:x condition="exists:docinfo/bib">
+                <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                  <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'"/>
+                  <td class="content" tal:content="bibinfo/bib"/>
+                </tr>
+              </tal:x>
+              
+              <!-- wenn es keine bibinfo gibt (archimedes-texte) -->
+              <tal:y condition="not:exists:docinfo/bib">
+                <tr>
+                  <td class="type">Author:</td>
+                  <td class="content" tal:content="python:docinfo['creator']"/>
+                </tr>
+                <tr>
+                  <td class="type">Title:</td>
+                  <td class="content" tal:content="python:docinfo['title']"/>
+                </tr>
+                <tr>
+                  <td class="type">Year:</td>
+                  <td class="content" tal:content="python:docinfo['date']"/>
+                </tr>
+              </tal:y>
+            </tal:x> <!-- ende kein template fuer die daten -->
+              </table>
+
+          <br/><br/><br/><br/><br/><br/>
+          <table border="0" width="100%">
+        <tr>
+          <td>
+            <a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">Access Book</a>
+          </td>
+        </tr>
+        
+        <tr tal:condition="docpath">
+          <td class="openbutton1">Download: 
+            <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> 
+            /
+            <a tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">xml</a>
+          </td>
+        </tr>
+          </table>
+        </td>
+      </tr>
+    </table>
+
+</tal:block>
+</body>
+<body tal:condition="not:numPages">
+  <div class="errortext">Sorry, document doesn't exist.</div>
+</body>
+</html>
\ No newline at end of file