changeset 498:3146b4e7b6a5 elementtree

more clean up. works with new jquery digilib.
author casties
date Fri, 10 Feb 2012 19:05:45 +0100
parents 79d414cead6d
children 3f9703746fef
files documentViewer.py version.txt zpt/page_main_gis.zpt zpt/page_main_images.zpt zpt/page_main_pureXml.zpt zpt/page_main_text.zpt zpt/page_main_text_dict.zpt zpt/page_main_xml.zpt zpt/viewer_images.zpt zpt/viewer_main.zpt
diffstat 10 files changed, 36 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Mon Sep 05 11:10:36 2011 +0200
+++ b/documentViewer.py	Fri Feb 10 19:05:45 2012 +0100
@@ -149,21 +149,21 @@
         # create template folder so we can always use template.something
         
         templateFolder = Folder('template')
-        #self['template'] = templateFolder # Zope-2.12 style
-        self._setObject('template',templateFolder) # old style
+        self['template'] = templateFolder # Zope-2.12 style
+        #self._setObject('template',templateFolder) # old style
         try:
             import MpdlXmlTextServer
             textServer = MpdlXmlTextServer.MpdlXmlTextServer(id='fulltextclient',serverName=textServerName)
-            #templateFolder['fulltextclient'] = xmlRpcClient
-            templateFolder._setObject('fulltextclient',textServer)
+            templateFolder['fulltextclient'] = textServer
+            #templateFolder._setObject('fulltextclient',textServer)
         except Exception, e:
             logging.error("Unable to create MpdlXmlTextServer for fulltextclient: "+str(e))
             
         try:
             from Products.zogiLib.zogiLib import zogiLib
             zogilib = zogiLib(id="zogilib", title="zogilib for docuviewer", dlServerURL=imageScalerUrl, layout="book")
-            #templateFolder['zogilib'] = zogilib
-            templateFolder._setObject('zogilib',zogilib)
+            templateFolder['zogilib'] = zogilib
+            #templateFolder._setObject('zogilib',zogilib)
         except Exception, e:
             logging.error("Unable to create zogiLib for zogilib: "+str(e))
             
@@ -179,55 +179,55 @@
         
     # proxy text server methods to fulltextclient
     def getTextPage(self, **args):
-        """get page"""
+        """returns full text content of page"""
         return self.template.fulltextclient.getTextPage(**args)
 
-    def getOrigPages(self, **args):
-        """get page"""
-        return self.template.fulltextclient.getOrigPages(**args)
-    
-    def getOrigPagesNorm(self, **args):
-        """get page"""
-        return self.template.fulltextclient.getOrigPagesNorm(**args)
-
+    #WTF?
     def getQuery(self, **args):
         """get query in search"""
         return self.template.fulltextclient.getQuery(**args)
      
+    #WTF?
     def getSearch(self, **args):
         """get search"""
         return self.template.fulltextclient.getSearch(**args)
     
+    #WTF?
     def getGisPlaces(self, **args):
         """get gis places"""
         return self.template.fulltextclient.getGisPlaces(**args)
  
+    #WTF?
     def getAllGisPlaces(self, **args):
         """get all gis places """
         return self.template.fulltextclient.getAllGisPlaces(**args)
        
+    #WTF?
     def getWordInfo(self, **args):
         """get translate"""
         return self.template.fulltextclient.getWordInfo(**args)
 
+    #WTF?
     def getLemma(self, **args):
         """get lemma"""
         return self.template.fulltextclient.getLemma(**args)
 
+    #WTF?
     def getLemmaQuery(self, **args):
         """get query"""
         return self.template.fulltextclient.getLemmaQuery(**args)
 
+    #WTF?
     def getLex(self, **args):
         """get lex"""
         return self.template.fulltextclient.getLex(**args)
 
     def getToc(self, **args):
-        """get toc"""
+        """returns the full table of contents (in internal format)"""
         return self.template.fulltextclient.getToc(**args)
 
     def getTocPage(self, **args):
-        """get tocpage"""
+        """returns one page of the table of contents"""
         return self.template.fulltextclient.getTocPage(**args)
 
     
--- a/version.txt	Mon Sep 05 11:10:36 2011 +0200
+++ b/version.txt	Fri Feb 10 19:05:45 2012 +0100
@@ -1,1 +1,1 @@
-DocumentViewer 0.7.0
\ No newline at end of file
+DocumentViewer 2.0a
\ No newline at end of file
--- a/zpt/page_main_gis.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn',''); characterNormalization python:pageinfo.get('characterNormalization',''); optionToggle python:pageinfo.get('optionToggle','');">
-  <div tal:content="structure python:here.getTextPage(mode='gis',pn=pageinfo['current'],docinfo=docinfo,  pageinfo=pageinfo, characterNormalization=characterNormalization, optionToggle=optionToggle)"></div>
-</tal:block>
\ No newline at end of file
--- a/zpt/page_main_images.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:block tal:define="docinfo options/docinfo; pageinfo options/pageinfo; mk python:options.get('mk','')">
- <iframe height="100%" width="100%" tal:attributes="src string:${here/template/zogilib/absolute_url}?fn=${docinfo/imagePath}&pn=${pageinfo/current}&$mk"/>
-</tal:block>
--- a/zpt/page_main_pureXml.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None)   ">
-  <div tal:content="structure python:here.getTextPage(mode='pureXml',pn=pageinfo['current'],docinfo=docinfo,   pageinfo=pageinfo)"></div>
-</tal:block>
\ No newline at end of file
--- a/zpt/page_main_text.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn','');characterNormalization python:pageinfo.get('characterNormalization','');optionToggle python:pageinfo.get('optionToggle','');">
-  <div tal:content="structure python:here.getTextPage(mode='text',pn=pageinfo['current'],docinfo=docinfo,  pageinfo=pageinfo, highlightQuery=highlightQuery,sn=sn, characterNormalization=characterNormalization,optionToggle=optionToggle)"></div>
-</tal:block>
\ No newline at end of file
--- a/zpt/page_main_text_dict.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn','');characterNormalization python:pageinfo.get('characterNormalization','');optionToggle python:pageinfo.get('optionToggle','');">
-  <div tal:content="structure python:here.getTextPage(mode='text_dict',pn=pageinfo['current'],docinfo=docinfo,  pageinfo=pageinfo, characterNormalization=characterNormalization,optionToggle=optionToggle)"></div>
-</tal:block>
\ No newline at end of file
--- a/zpt/page_main_xml.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn','');optionToggle python:pageinfo.get('optionToggle','');  ">
-  <div tal:content="structure python:here.getTextPage(mode='xml',pn=pageinfo['current'],docinfo=docinfo, pageinfo=pageinfo,optionToggle=optionToggle)"></div>
-</tal:block>
\ No newline at end of file
--- a/zpt/viewer_images.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ b/zpt/viewer_images.zpt	Fri Feb 10 19:05:45 2012 +0100
@@ -12,8 +12,8 @@
   <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.cookie.js"></script>
   <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.js"></script>
   <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.geometry.js"></script>
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.birdseye.js"></script>
-  <!-- <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.regions.js"></script> -->
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.arrows.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.marks.js"></script>
   <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/jquery.digilib.css" />
 
 <script type="text/javascript"
@@ -24,12 +24,11 @@
             'fn' : '${docinfo/imagePath}',
             'pn' : '${pageinfo/pn}',
             'suppressParamNames' : ['fn'],
-            'showRegionNumbers' : true,
-            'visibleButtonSets' : 0
+            'scalerInsets' : {'x' : 140, 'y' : 100}
         };"></script>
 
 <script type="text/javascript">
-    //<!--
+// <!--
     $(document).ready(function() {
         // autosubmit forms
         $('form.autosubmit').find('.autosubmit').change(function() {
@@ -37,11 +36,11 @@
         });
         $('form.autosubmit input[type="submit"]').hide();
         // get digilib div
-        $digilib = $('div.scaler');
+        $digilib = $('div#scaler');
         // configure digilib
         $digilib.digilib(dlOpts);
     });
-//-->
+// -->
 </script>
 </head>
 <body tal:condition="numPages">
@@ -87,16 +86,23 @@
           <li><a tal:condition="docpath" tal:attributes="href python:here.getLink('viewMode','text')">Text</a></li>
         </ul>
         <div class="content">
-          <div class="dl-buttons">
-            <span><a href="javascript:$digilib.digilib('zoomArea')">zoom</a></span>
-          </div>
-          <div class="scaler">
+          <div id="scaler">
             <img tal:attributes="src string:${docinfo/imageURL}&pn=${pageinfo/pn}&dw=500&dh=500" />
           </div>
         </div> <!-- content -->
       </div> <!-- col-main -->
       <div class="col-right">
-        BUTTONS
+          <div class="digilib-buttons">
+            <div><a href="javascript:$digilib.digilib('zoomBy', 1.4)">zoom in</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomBy', 0.7)">zoom out</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomArea')">zoom area</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomFull')">full page</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomFull', 'width')">page width</a></div>
+            <div><a href="javascript:$digilib.digilib('setMark')">set mark</a></div>
+            <div><a href="javascript:$digilib.digilib('removeMark')">remove mark</a></div>
+            <div><a href="javascript:$digilib.digilib('reference')">get reference</a></div>
+            <div><a tal:attributes="href string:$dlBaseUrl/jquery/digilib.html?fn=${docinfo/imagePath}&pn=${pageinfo/pn}" target="_blank">digilib</a></div>
+          </div>
       </div>
     </div> <!-- page-body -->
     <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
--- a/zpt/viewer_main.zpt	Mon Sep 05 11:10:36 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!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">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" href="template/docuviewer_css" type="text/css">
-</head>
-<body tal:condition="docinfo/numPages">
-<div tal:replace="structure python:here.template.head_main(docinfo=docinfo,viewMode=viewMode,pageinfo=pageinfo)"/>
-<tal:block tal:condition="python:here.isAccessible(docinfo)">
-<table border="0" width="100%" height="100%">
-  <tr>
-    <td width="300px" valign="top">
-      <tal:block tal:replace="structure python:getattr(here.template, 'toc_%s'%tocMode)(docinfo=docinfo,pageinfo=pageinfo)"/> 
-    </td>
-    <td width="100%" valign="top">
-      <tal:block tal:content="structure python:getattr(here.template, 'page_main_%s'%viewMode)(docinfo=docinfo,pageinfo=pageinfo,mk=options['mk'])"/>
-    </td>
-  </tr>
-</table>
-</tal:block>
-<tal:block tal:condition="not:python:here.isAccessible(docinfo)">
-<div class="errortext">Sorry, access to this document is restricted.</div>
-</tal:block>
-</body>
-<body tal:condition="not:docinfo/numPages">
-<div class="errortext">Sorry, document doesn't exist.</div>
-</body>
-</html>