# HG changeset patch # User casties # Date 1348824325 -7200 # Node ID 6ab436383fcaa2c358dbc97fdb5246e6369823eb # Parent abcb67f5cab40c4a1e4ef89c4ca648acd12509a7 first step to layers for index view. diff -r abcb67f5cab4 -r 6ab436383fca documentViewer.py --- 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()) diff -r abcb67f5cab4 -r 6ab436383fca zpt/viewer_index.zpt --- 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 @@ @@ -10,6 +12,12 @@ <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