Mercurial > hg > documentViewer
changeset 558:6ab436383fca
first step to layers for index view.
author | casties |
---|---|
date | Fri, 28 Sep 2012 11:25:25 +0200 |
parents | abcb67f5cab4 |
children | eabfbad6aeb4 |
files | documentViewer.py zpt/viewer_index.zpt |
diffstat | 2 files changed, 35 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/documentViewer.py Wed Sep 26 23:20:06 2012 +0200 +++ b/documentViewer.py Fri Sep 28 11:25:25 2012 +0200 @@ -128,7 +128,7 @@ viewer_thumbs = PageTemplateFile('zpt/viewer_thumbs', globals()) # available layer types (annotator not default) builtinLayers = {'text': ['dict','search','gis'], - 'xml': None, 'images': None, 'index': None} + 'xml': None, 'images': None, 'index': ['extended']} availableLayers = builtinLayers; # layer templates layer_text_dict = PageTemplateFile('zpt/layer_text_dict', globals())
--- a/zpt/viewer_index.zpt Wed Sep 26 23:20:06 2012 +0200 +++ b/zpt/viewer_index.zpt Fri Sep 28 11:25:25 2012 +0200 @@ -3,6 +3,8 @@ <html xmlns="http://www.w3.org/1999/xhtml" tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode; tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl; + viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers; + availableLayers python:here.getAvailableLayers().get('index', None); docpath docinfo/textURLPath | nothing; query nothing; numPages docinfo/numPages | nothing;"> @@ -10,6 +12,12 @@ <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" /> +<!-- layer headers (rendered always) --> +<tal:block tal:repeat="layer availableLayers"> + <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/html_head" tal:condition="python:exists(mpath)"> + <metal:block metal:use-macro="python:path(mpath)" /> + </tal:block> +</tal:block> </head> <body tal:condition="numPages"> <!-- header --> @@ -108,9 +116,27 @@ </div> <div class="col buttons"> <div class="options"> + <h4>Metadata</h4> + <form tal:attributes="action viewerUrl" class="autosubmit"> + <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})" + tal:repeat="param params" tal:attributes="name param; value python:params[param]" /> + <ul> + <!-- text layer select buttons (rendered always) --> + <tal:block tal:repeat="layer availableLayers"> + <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/layer_select_li" + tal:condition="python:exists(mpath)"> + <li metal:use-macro="python:path(mpath)" /> + </tal:block> + </tal:block> + </ul> + <input type="submit" value="Go!" /> + </form> + </div> + + <div class="options"> <h4>Browse</h4> <ul class="list"> - <li><a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">View full document</a></li> + <li><a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">View full document</a></li> </ul> </div> @@ -122,7 +148,8 @@ tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath.replace('.xml','.html'))" target="_blank">as HTML</a></li> <li><a target="_blank" - tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">as XML</a></li> + tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">as + XML</a></li> </ul> (copyright and license see below) </div> @@ -130,7 +157,8 @@ <div class="options" tal:condition="docpath"> <h4>Search</h4> <form tal:define="queryType string:fulltextMorph" tal:condition="docpath" tal:attributes="action viewerUrl"> - <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':'search'})" + <input type="hidden" + tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':'search'})" tal:repeat="param params" tal:attributes="name param; value python:params[param]" /> <!-- query text --> <input type="text" name="query" tal:attributes="value query" /> <br /> <input type="submit" value="Search" /> <a @@ -152,15 +180,15 @@ </div> <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer"> <!-- footer --> - <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/> + <metal:block metal:use-macro="here/template/site_template.pt/macros/footer" /> </tal:block> - + </body> <body tal:condition="not:numPages"> <div class="errortext">Sorry, document doesn't exist.</div> <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer"> <!-- footer --> - <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/> + <metal:block metal:use-macro="here/template/site_template.pt/macros/footer" /> </tal:block> </body> </html> \ No newline at end of file