Mercurial > hg > documentViewer
changeset 609:7962e6891d99
works with new notes and notesHandwritten.
author | casties |
---|---|
date | Tue, 15 Jan 2013 18:15:32 +0100 |
parents | 0c6056271654 |
children | 0488cd12355b |
files | MpiwgXmlTextServer.py css/docuviewer.css documentViewer.py version.txt zpt/viewer/common_template.zpt zpt/viewer/toc_notes.zpt |
diffstat | 6 files changed, 50 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/MpiwgXmlTextServer.py Tue Dec 18 19:26:22 2012 +0100 +++ b/MpiwgXmlTextServer.py Tue Jan 15 18:15:32 2013 +0100 @@ -95,9 +95,12 @@ logging.debug("getTextInfo mode=%s"%mode) field = '' - if mode in ['pages', 'toc', 'figures', 'handwritten']: + if mode in ['pages', 'toc', 'figures', 'notes', 'handwritten']: # translate mode to field param - field = '&field=%s'%mode + if mode == 'handwritten': + field = '&field=notesHandwritten' + else: + field = '&field=%s'%mode else: mode = None @@ -131,7 +134,9 @@ if sys is not None: docinfo['numTextPages'] = getInt(getText(sys.find('countPages'))) docinfo['numFigureEntries'] = getInt(getText(sys.find('countFigures'))) - docinfo['numHandwritten'] = getInt(getText(sys.find('countHandwritten'))) + docinfo['numHandwritten'] = getInt(getText(sys.find('countNotesHandwritten'))) + docinfo['numNotes'] = getInt(getText(sys.find('countNotes'))) + docinfo['numPlaces'] = getInt(getText(sys.find('countPlaces'))) docinfo['numTocEntries'] = getInt(getText(sys.find('countTocEntries'))) else: @@ -161,7 +166,7 @@ docinfo['pageNumbers'] = pages # toc - elif lt == 'toc' or lt == 'figures' or lt == 'handwritten': + elif lt in ['toc', 'figures', 'notes', 'notesHandwritten']: # contains tags with table of contents/figures # <item n="2.1." lv="2">CAP.I. <ref o="119">132</ref></item> tocs = [] @@ -660,15 +665,18 @@ last = first + size tocs = fulltoc[first:last] tp = '<div>' - label = {'figures': 'Figure', 'handwritten': 'Handwritten note'}.get(mode, 'Item') + label = {'figures': 'Figure', 'notes': 'Note', 'handwritten': 'Handwritten note'}.get(mode, 'Item') for toc in tocs: pageurl = self.getLink('pn', toc['pn']) tp += '<div class="tocline">' content = toc['content'] + lvs = toc['level-string'] if content: - tp += '<div class="toc name">[%s] %s</div>'%(toc['level-string'], toc['content']) + tp += '<div class="toc name">[%s] %s</div>'%(lvs, toc['content']) + elif lvs: + tp += '<div class="toc name">[%s %s]</div>'%(label, lvs) else: - tp += '<div class="toc name">[%s %s]</div>'%(label, toc['level-string']) + tp += '<div class="toc name">[%s]</div>'%(label) if toc.get('no', None): tp += '<div class="toc page"><a href="%s">Page: %s (%s)</a></div>'%(pageurl, toc['pn'], toc['no'])
--- a/css/docuviewer.css Tue Dec 18 19:26:22 2012 +0100 +++ b/css/docuviewer.css Tue Jan 15 18:15:32 2013 +0100 @@ -101,8 +101,8 @@ -o-transform: rotate(270deg); -o-transform-origin: top left; left: 7px; - top: 34em; - width: 40em; + top: 42em; + width: 45em; padding: 0px; }
--- a/documentViewer.py Tue Dec 18 19:26:22 2012 +0100 +++ b/documentViewer.py Tue Jan 15 18:15:32 2013 +0100 @@ -119,6 +119,7 @@ toc_text = PageTemplateFile('zpt/viewer/toc_text', globals()) toc_figures = PageTemplateFile('zpt/viewer/toc_figures', globals()) toc_concordance = PageTemplateFile('zpt/viewer/toc_concordance', globals()) + toc_notes = PageTemplateFile('zpt/viewer/toc_notes', globals()) toc_handwritten = PageTemplateFile('zpt/viewer/toc_handwritten', globals()) toc_none = PageTemplateFile('zpt/viewer/toc_none', globals()) # other templates
--- a/version.txt Tue Dec 18 19:26:22 2012 +0100 +++ b/version.txt Tue Jan 15 18:15:32 2013 +0100 @@ -1,1 +1,1 @@ -DocumentViewer 2.2.10 \ No newline at end of file +DocumentViewer 2.2.11 \ No newline at end of file
--- a/zpt/viewer/common_template.zpt Tue Dec 18 19:26:22 2012 +0100 +++ b/zpt/viewer/common_template.zpt Tue Jan 15 18:15:32 2013 +0100 @@ -115,9 +115,12 @@ <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, 'notes')" + tal:condition="python:docpath and docinfo.get('numNotes', None)"><span><a + tal:omit-tag="python:tocMode=='notes'" tal:attributes="href python:here.getLink('tocMode','notes')">Notes</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> + tal:omit-tag="python:tocMode=='handwritten'" tal:attributes="href python:here.getLink('tocMode','handwritten')">Handwritten</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/viewer/toc_notes.zpt Tue Jan 15 18:15:32 2013 +0100 @@ -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 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='notes',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>