changeset 577:9251719154a3

toc with list of handwritten notes.
author casties
date Thu, 18 Oct 2012 17:53:09 +0200
parents b2c7e272e075
children 024b75162437
files MpiwgXmlTextServer.py css/docuviewer.css documentViewer.py zpt/common_template.zpt zpt/toc_handwritten.zpt
diffstat 5 files changed, 54 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/MpiwgXmlTextServer.py	Wed Oct 17 16:36:13 2012 +0200
+++ b/MpiwgXmlTextServer.py	Thu Oct 18 17:53:09 2012 +0200
@@ -159,7 +159,6 @@
                                 pages[pn] = page
                             
                         docinfo['pageNumbers'] = pages
-                        logging.debug("got pageNumbers=%s"%repr(pages))
                                     
                     # toc
                     elif lt == 'toc' or lt == 'figures' or lt == 'handwritten':
@@ -295,6 +294,11 @@
                         
                 if punditMode:
                     self._addPunditAttributes(pagediv, pageinfo, docinfo)
+                    
+                # TODO: move empty page text
+                ep = dom.find(".//div[@class='emptyPage']")
+                if ep is not None:
+                    pagediv.append(ep)
                  
                 s = serialize(pagediv)
                 logging.debug("getTextPage done in %s"%(datetime.now()-startTime))    
@@ -544,18 +548,11 @@
         if start is None:
             start = (pn - 1) * size
 
-        #fullresult = ET.fromstring(resultxml)
-        #fullresult = resultxml
-        #logging.debug("resultxml=%s"%repr(resultxml))
-        
         if resultxml is not None:
             # paginate
             first = start-1
             last = first+size
             tocdivs = resultxml[first:last]
-            #del fullresult[:first]
-            #del fullresult[len:]
-            #tocdivs = fullresult
             
             toc = ET.Element('div', attrib={'class':'queryResultPage'})
             for div in tocdivs:
@@ -620,6 +617,7 @@
         last = first + size
         tocs = fulltoc[first:last]
         tp = '<div>'
+        label = {'figures': 'Figure', 'handwritten': 'Handwritten note'}.get(mode, 'Item')
         for toc in tocs:
             pageurl = self.getLink('pn', toc['pn'])
             tp += '<div class="tocline">'
@@ -627,7 +625,7 @@
             if content:
                 tp += '<div class="toc name">[%s] %s</div>'%(toc['level-string'], toc['content'])
             else:
-                tp += '<div class="toc name">[Figure %s]</div>'%(toc['level-string'])
+                tp += '<div class="toc name">[%s %s]</div>'%(label, toc['level-string'])
             
             if toc.get('no', None):
                 tp += '<div class="toc page"><a href="%s">Page: %s (%s)</a></div>'%(pageurl, toc['pn'], toc['no'])
@@ -658,8 +656,7 @@
     return pt()
 
 def manage_addMpiwgXmlTextServer(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
-#def manage_addMpiwgXmlTextServer(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de:30030/mpdl/interface/",timeout=40,RESPONSE=None):    
-    """add zogiimage"""
+    """add MpiwgXmlTextServer"""
     newObj = MpiwgXmlTextServer(id=id,title=title,serverUrl=serverUrl,timeout=timeout)
     self.Destination()._setObject(id, newObj)
     if RESPONSE is not None:
--- a/css/docuviewer.css	Wed Oct 17 16:36:13 2012 +0200
+++ b/css/docuviewer.css	Thu Oct 18 17:53:09 2012 +0200
@@ -98,7 +98,7 @@
     -o-transform: rotate(270deg);
     -o-transform-origin: top left;
 	left: 7px;
-    top: 32em;
+    top: 34em;
     width: 40em;
     padding: 0px;
 }
@@ -268,27 +268,6 @@
     margin-top: 0.5em;
     margin-bottom: 0.25em;
 }
-/* normalization forms *
-div.col.main div.content.text div.text.orig span.w span.reg,
-div.col.main div.content.text div.text.orig span.w span.norm {
-    display: none;
-}
-div.col.main div.content.text div.text.reg span.w span.orig,
-div.col.main div.content.text div.text.reg span.w span.norm {
-    display: none;
-}
-div.col.main div.content.text div.text.norm span.w span.orig,
-div.col.main div.content.text div.text.norm span.w span.reg {
-    display: none;
-}
-/* dictionary forms *
-div.col.main div.content.text div.text.plain span.w a.dictionary {
-    display: none;
-}
-div.col.main div.content.text div.text.dict span.w span.nodictionary {
-    display: none;
-} 
-*/
 /* page break */
 div.col.main div.content.text span.pb span.n,
 div.col.main div.content.text span.pb span.o {
@@ -314,6 +293,20 @@
     /* font-size: 70%;
 	vertical-align: super; */
 }
+/* handwritten */
+div.col.main div.content.text span.handwritten {
+	display: block;
+	/* float: left; */
+    margin-top: 0.5em;
+    margin-bottom: 0.5em;
+    padding: 5px;
+    border: 1px dashed silver;	
+}
+div.col.main div.content.text span.handwritten span.figureNum {
+    display: none;
+    /* font-size: 70%;
+	vertical-align: super; */
+}
 /* figure */
 div.col.main div.content.text span.figure {
     display: block;
--- a/documentViewer.py	Wed Oct 17 16:36:13 2012 +0200
+++ b/documentViewer.py	Thu Oct 18 17:53:09 2012 +0200
@@ -149,6 +149,7 @@
     toc_text = PageTemplateFile('zpt/toc_text', globals())
     toc_figures = PageTemplateFile('zpt/toc_figures', globals())
     toc_concordance = PageTemplateFile('zpt/toc_concordance', globals())
+    toc_handwritten = PageTemplateFile('zpt/toc_handwritten', globals())
     toc_none = PageTemplateFile('zpt/toc_none', globals())
     # other templates
     common_template = PageTemplateFile('zpt/common_template', globals())
--- a/zpt/common_template.zpt	Wed Oct 17 16:36:13 2012 +0200
+++ b/zpt/common_template.zpt	Thu Oct 18 17:53:09 2012 +0200
@@ -112,6 +112,9 @@
           <li tal:attributes="class python:here.getStyle(tocMode, 'concordance')"
             tal:condition="python:docpath and docinfo.get('pageNumbers', None)"><span><a
               tal:omit-tag="python:tocMode=='concordance'" tal:attributes="href python:here.getLink('tocMode','concordance')">Concordance</a></span></li>
+          <li tal:attributes="class python:here.getStyle(tocMode, 'handwritten')"
+            tal:condition="python:docpath and docinfo.get('numHandwritten', None)"><span><a
+              tal:omit-tag="python:tocMode=='handwritten'" tal:attributes="href python:here.getLink('tocMode','handwritten')">Notes</a></span></li>
           <li tal:attributes="class python:here.getStyle(tocMode, 'figures')"
             tal:condition="python:docpath and docinfo.get('numFigureEntries', None)"><span><a
               tal:omit-tag="python:tocMode=='figures'" tal:attributes="href python:here.getLink('tocMode','figures')">Figures</a></span></li>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/toc_handwritten.zpt	Thu Oct 18 17:53:09 2012 +0200
@@ -0,0 +1,27 @@
+<!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">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+  <div class="toc-container" metal:define-macro="main">
+    <div metal:use-macro="here/template/common_template/macros/toc_switcher" />
+    <!-- block used for main content area -->
+    <div class="tocbody figures"
+      tal:define="start pageinfo/start; tocsize docinfo/numHandwritten; grpsize pageinfo/tocPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
+      <h4>Table of handwritten notes</h4>
+      <div class="ruler top">
+        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
+      </div>
+      <div class="content"
+        tal:content="structure python:here.getTocPage(mode='handwritten',start=start,pageinfo=pageinfo,docinfo=docinfo)" />
+      <div class="ruler bottom">
+        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
+      </div>
+    </div>
+  </div>
+  <!-- /toc -->
+</body>
+</html>