changeset 594:da7daa783df4

rearranged viewer templates into folder.
author casties
date Fri, 16 Nov 2012 17:16:50 +0100
parents eb46138db658
children ee91a19633a0
files documentViewer.py zpt/common_template.zpt zpt/layer_image_annotator.zpt zpt/layer_image_search.zpt zpt/layer_index_extended.zpt zpt/layer_text_annotator.zpt zpt/layer_text_dict.zpt zpt/layer_text_gis.zpt zpt/layer_text_pundit.zpt zpt/layer_text_search.zpt zpt/toc_concordance.zpt zpt/toc_figures.zpt zpt/toc_handwritten.zpt zpt/toc_none.zpt zpt/toc_text.zpt zpt/toc_thumbs.zpt zpt/viewer/common_template.zpt zpt/viewer/layer_image_annotator.zpt zpt/viewer/layer_image_search.zpt zpt/viewer/layer_index_extended.zpt zpt/viewer/layer_text_annotator.zpt zpt/viewer/layer_text_dict.zpt zpt/viewer/layer_text_gis.zpt zpt/viewer/layer_text_pundit.zpt zpt/viewer/layer_text_search.zpt zpt/viewer/toc_concordance.zpt zpt/viewer/toc_figures.zpt zpt/viewer/toc_handwritten.zpt zpt/viewer/toc_none.zpt zpt/viewer/toc_text.zpt zpt/viewer/toc_thumbs.zpt zpt/viewer/viewer_image.zpt zpt/viewer/viewer_index.zpt zpt/viewer/viewer_indexonly.zpt zpt/viewer/viewer_text.zpt zpt/viewer/viewer_thumbs.zpt zpt/viewer/viewer_xml.zpt zpt/viewer_image.zpt zpt/viewer_index.zpt zpt/viewer_indexonly.zpt zpt/viewer_text.zpt zpt/viewer_thumbs.zpt zpt/viewer_xml.zpt
diffstat 43 files changed, 1740 insertions(+), 1740 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Fri Nov 16 16:40:29 2012 +0100
+++ b/documentViewer.py	Fri Nov 16 17:16:50 2012 +0100
@@ -95,35 +95,35 @@
     # templates and forms
     #
     # viewMode templates
-    viewer_text = PageTemplateFile('zpt/viewer_text', globals())
-    viewer_xml = PageTemplateFile('zpt/viewer_xml', globals())
-    viewer_image = PageTemplateFile('zpt/viewer_image', globals())
-    viewer_index = PageTemplateFile('zpt/viewer_index', globals())
-    viewer_thumbs = PageTemplateFile('zpt/viewer_thumbs', globals())
-    viewer_indexonly = PageTemplateFile('zpt/viewer_indexonly', globals())
+    viewer_text = PageTemplateFile('zpt/viewer/viewer_text', globals())
+    viewer_xml = PageTemplateFile('zpt/viewer/viewer_xml', globals())
+    viewer_image = PageTemplateFile('zpt/viewer/viewer_image', globals())
+    viewer_index = PageTemplateFile('zpt/viewer/viewer_index', globals())
+    viewer_thumbs = PageTemplateFile('zpt/viewer/viewer_thumbs', globals())
+    viewer_indexonly = PageTemplateFile('zpt/viewer/viewer_indexonly', globals())
     # available layer types (annotator not default)
     builtinLayers = {'text': ['dict','search','gis'],
                      'xml': None, 'image': None, 'index': ['extended']}
     availableLayers = builtinLayers;
     # layer templates
-    layer_text_dict = PageTemplateFile('zpt/layer_text_dict', globals())
-    layer_text_search = PageTemplateFile('zpt/layer_text_search', globals())
-    layer_text_annotator = PageTemplateFile('zpt/layer_text_annotator', globals())
-    layer_text_gis = PageTemplateFile('zpt/layer_text_gis', globals())
-    layer_text_pundit = PageTemplateFile('zpt/layer_text_pundit', globals())
-    layer_image_annotator = PageTemplateFile('zpt/layer_image_annotator', globals())
-    layer_image_search = PageTemplateFile('zpt/layer_image_search', globals())
-    layer_index_extended = PageTemplateFile('zpt/layer_index_extended', globals())
+    layer_text_dict = PageTemplateFile('zpt/viewer/layer_text_dict', globals())
+    layer_text_search = PageTemplateFile('zpt/viewer/layer_text_search', globals())
+    layer_text_annotator = PageTemplateFile('zpt/viewer/layer_text_annotator', globals())
+    layer_text_gis = PageTemplateFile('zpt/viewer/layer_text_gis', globals())
+    layer_text_pundit = PageTemplateFile('zpt/viewer/layer_text_pundit', globals())
+    layer_image_annotator = PageTemplateFile('zpt/viewer/layer_image_annotator', globals())
+    layer_image_search = PageTemplateFile('zpt/viewer/layer_image_search', globals())
+    layer_index_extended = PageTemplateFile('zpt/viewer/layer_index_extended', globals())
     # toc templates
-    toc_thumbs = PageTemplateFile('zpt/toc_thumbs', globals())
-    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())
+    toc_thumbs = PageTemplateFile('zpt/viewer/toc_thumbs', globals())
+    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_handwritten = PageTemplateFile('zpt/viewer/toc_handwritten', globals())
+    toc_none = PageTemplateFile('zpt/viewer/toc_none', globals())
     # other templates
-    common_template = PageTemplateFile('zpt/common_template', globals())
-    info_xml = PageTemplateFile('zpt/info_xml', globals())
+    common_template = PageTemplateFile('zpt/viewer/common_template', globals())
+    info_xml = PageTemplateFile('zpt/viewer/info_xml', globals())
     docuviewer_css = ImageFile('css/docuviewer.css',globals())
     # make docuviewer_css refreshable for development
     docuviewer_css.index_html = refreshingImageFileIndexHtml
--- a/zpt/common_template.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +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">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-</head>
-<body>
-  <!-- block used for page header content area -->
-  <metal:block metal:define-macro="head"
-    tal:define="viewMode pageinfo/viewMode;
-                docpath docinfo/textURLPath | nothing;
-                bib docinfo/bib | nothing; bibType docinfo/bibType | nothing;
-                formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);">
-    <div class="logo" tal:condition="exists:here/template/site_template.pt/macros/logo">
-      <metal:block metal:use-macro="here/template/site_template.pt/macros/logo"/>
-    </div>
-    <div class="title-block">
-      <div class="title" tal:condition="not:formattedLabel">
-        <tal:block tal:condition="python:docinfo['creator'] or docinfo['title']">
-          <i tal:content="docinfo/creator" />,
-        <span tal:content="docinfo/title" />, <span tal:content="docinfo/date" />
-        </tal:block>
-        <span tal:condition="not:python:docinfo['creator'] or docinfo['title']"
-          tal:content="string:[no bibliographical information for this document (type ${bibType})]" />
-      </div>
-      <div class="title" tal:condition="formattedLabel" tal:content="structure formattedLabel" />
-      <ul class="view-switcher" metal:define-slot="view-switcher">
-        <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'text')"><a
-          tal:omit-tag="python:viewMode=='text'" tal:attributes="href python:here.getLink('viewMode','text')">Text</a></li>
-        <li tal:condition="python:docinfo.get('imagePath',None)" tal:attributes="class python:here.getStyle(viewMode, 'image')"><a
-          tal:omit-tag="python:viewMode=='image'" tal:attributes="href python:here.getLink('viewMode','image')">Image</a></li>
-        <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'xml')"><a
-          tal:omit-tag="python:viewMode=='xml'" tal:attributes="href python:here.getLink('viewMode','xml')">XML</a></li>
-        <li tal:condition="python:docinfo.get('imagePath',None)" tal:attributes="class python:here.getStyle(viewMode, 'thumbs')"><a
-          tal:omit-tag="python:viewMode=='thumbs'" tal:attributes="href python:here.getLink('viewMode','thumbs')">Thumbnail
-            overview</a></li>
-        <li tal:attributes="class python:here.getStyle(viewMode, 'index')"><a tal:omit-tag="python:viewMode=='index'"
-          tal:attributes="href python:here.getLink('viewMode','index')">Document information</a></li>
-      </ul>
-    </div>
-  </metal:block>
-  <!-- /head -->
-
-
-  <!-- page ruler with previous/next page buttons -->
-  <metal:block metal:define-macro="page_ruler"
-    tal:define="
-              prev python:test(pn>1,pn-1,None); next python:test(pn<numPages,pn+1,None);
-              first python:test(pn>1,1,None); last python:test(pn<numPages,numPages,None);
-              left python:test(flowLtr,prev,next); right python:test(flowLtr,next,prev);
-              leftest python:test(flowLtr,first,last); rightest python:test(flowLtr,last,first);">
-    <form class="autosubmit" tal:attributes="action viewerUrl">
-      <input type="hidden" tal:define="params python:here.getParams('pn', None)" tal:repeat="param params"
-        tal:attributes="name param; value python:params[param]" /> <span class="ruler-main">page <a tal:condition="leftest"
-        tal:attributes="href python:here.getLink('pn',leftest)">|&lt;</a> <span tal:condition="not:leftest">|&lt;</span> <a
-        tal:condition="left" tal:attributes="href python:here.getLink('pn',left)">&lt;</a> <span tal:condition="not:left">&lt;</span>
-        <input class="autosubmit" size="3" type="text" name="pn" tal:attributes="value pn" /> <span class="originalPage"
-        title="Original page number" tal:define="originalPage pageinfo/pageNumberOrig | nothing"
-        tal:condition="python:originalPage!=None"> (<span tal:replace="originalPage" /><span
-          tal:define="originalPageNorm pageinfo/pageNumberOrigNorm | nothing" tal:condition="python:originalPageNorm!=None">
-            [<span tal:replace="originalPageNorm" />]
-        </span>)
-      </span> <input type="submit" value="Go" /> of <span tal:replace="numPages" /> <a tal:condition="right"
-        tal:attributes="href python:here.getLink('pn',right)">&gt;</a> <span tal:condition="not:right">&gt;</span> <a
-        tal:condition="rightest" tal:attributes="href python:here.getLink('pn',rightest)">&gt;|</a> <span
-        tal:condition="not:rightest">&gt;|</span>
-      </span>
-      <!-- ruler-main -->
-    </form>
-  </metal:block>
-  <!-- /ruler -->
-
-  <!-- toc ruler (using getBatch) with previous/next toc page buttons -->
-  <metal:block metal:define-macro="toc_ruler">
-    <form class="autosubmit" tal:attributes="action viewerUrl" tal:define="startParam startParam | string:start">
-      <input type="hidden" tal:define="params python:here.getParams(startParam, None)" tal:repeat="param params"
-        tal:attributes="name param; value python:params[param]" /> <a tal:condition="batch/prevStart"
-        tal:attributes="href python:here.getLink(startParam,batch['prevStart'])">&lt;</a> <span tal:condition="not:batch/prevStart">&lt;</span>
-      <select class="autosubmit" tal:attributes="name startParam">
-        <option tal:repeat="grp batch/batches" tal:attributes="selected python:(start>=grp['start'] and start<=grp['end']); value grp/start"
-          tal:content="string:${grp/start} - ${grp/end}" />
-        <option tal:condition="python:start>batch['last']" selected="selected" value="1">[out of range]</option>
-      </select> <input type="submit" value="Go" /> <a tal:condition="batch/nextStart"
-        tal:attributes="href python:here.getLink(startParam,batch['nextStart'])">&gt;</a> <span tal:condition="not:batch/nextStart">&gt;</span>
-    </form>
-  </metal:block>
-
-  <!-- toc ruler for thumbs (using getPageBatch) with previous/next toc page buttons -->
-  <metal:block metal:define-macro="toc_ruler_thumbs">
-    <form class="autosubmit" tal:attributes="action viewerUrl">
-      <input type="hidden" tal:define="params python:here.getParams('start',None)" tal:repeat="param params"
-        tal:attributes="name param; value python:params[param]" /><span class="ruler-main"><a tal:condition="left"
-        tal:attributes="href python:here.getLink('start',left)">&lt;</a> <span tal:condition="not:left">&lt;</span> <select
-        class="autosubmit" name="start" tal:define="ofs python:test(pageinfo['pageZero'],0,1)">
-          <tal:block>
-            <option tal:repeat="grp pageBatch/batches" tal:attributes="selected python:(start>=grp['start'] and start<=grp['end']); value grp/start;"
-              tal:content="string:${grp/start} - ${grp/end}" />
-            <option tal:condition="python:start>pageBatch['last']" selected="selected" value="1">[out of range]</option>
-          </tal:block>
-      </select> <input type="submit" value="Go" /> <a tal:condition="right" tal:attributes="href python:here.getLink('start',right)">&gt;</a>
-        <span tal:condition="not:right">&gt;</span></span>
-    </form>
-  </metal:block>
-
-  <!-- toc type switcher -->
-  <metal:block metal:define-macro="toc_switcher">
-    <div class="toc-switcher-col">
-      <div class="toc-switcher">
-        <ul>
-          <li tal:attributes="class python:here.getStyle(tocMode, 'none')"><span><a
-              tal:omit-tag="python:tocMode=='none'" tal:attributes="href python:here.getLink('tocMode','none')">None</a></span></li>
-          <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>
-          <li tal:attributes="class python:here.getStyle(tocMode, 'text')"
-            tal:condition="python:docpath and docinfo.get('numTocEntries', None)"><span><a
-              tal:omit-tag="python:tocMode=='text'" tal:attributes="href python:here.getLink('tocMode','text')">Content</a></span></li>
-          <li tal:attributes="class python:here.getStyle(tocMode, 'thumbs')"><span><a
-              tal:omit-tag="python:tocMode=='thumbs'" tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a></span></li>
-        </ul>
-      </div>
-    </div>
-  </metal:block>
-
-</body>
-</html>
--- a/zpt/layer_image_annotator.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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">
-<head>
-<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
-  <!--  annotator for digilib -->
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/showdown.js"></script>
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/annotator-dl.js"></script>
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.annotator.js"></script>
-  <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/annotator.min.css"/>
-
-  <script type="text/javascript" 
-    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
-    global annTokenUrl string:$viewerUrl/template/token/getLoginToken;
-    annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
-    resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
-    global annUser python:here.getAuthenticatedUser(anon='anonymous');
-    global annGroup python:request.get('annotator_group', None);
-    permUser python:test(annGroup, 'group:%s'%annGroup, annUser);"
-    tal:content="structure string:
-    dlOpts.digilibFrontendPath='/jquery/digilib-ann.html';
-    dlOpts.annotationServerUrl='$annServerUrl/annotator';
-    dlOpts.annotationTokenUrl='$annTokenUrl';
-    dlOpts.annotationUser='$annUser';
-    dlOpts.annotatorPlugins=['Auth','Permissions','Store','Markdown','DigilibIntegrator'];
-    dlOpts.annotatorPluginSettings={'Store':{'annotationData':{'uri':'$annUrl','resource':'$resUrl'},'loadFromSearch':{'uri':'$annUrl'}},
-        'Permissions':{'read':[],'update':['$permUser'],'delete':['$permUser'],'admin':['$permUser']}};
-    "></script>
-</metal:block>
-
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <li metal:define-macro="layer_select_li">
-        <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator"
-          tal:attributes="checked python:'annotator' in viewLayers" /> Annotator
-      </li>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers">
-    <!-- BEGIN ANNOTATIONS -->
-    <div class="options">
-      <h4>Annotator</h4>
-      <ul>
-        <li><a href="javascript:$digilib.digilib('setAnnotationMark')"> <img tal:condition="exists:here/template/annotation-mark.png"
-            tal:attributes="src here/template/annotation-mark.png/absolute_url" /> annotate point
-        </a></li>
-        <li><a href="javascript:$digilib.digilib('setAnnotationRegion')"> <img tal:condition="exists:here/template/annotation-region.png"
-            tal:attributes="src here/template/annotation-region.png/absolute_url" /> annotate region
-        </a></li>
-      </ul>
-      <p>
-        User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>.
-      </p>
-      <!-- TODO: login button -->
-      <form class="autosubmit" tal:attributes="action viewerUrl">
-        <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params"
-          tal:attributes="name param; value python:params[param]" />
-        <p>
-          In group
-          <select class="autosubmit" name="annotator_group">
-            <option value="" tal:attributes="selected not:annGroup;"> </option>
-            <option
-              tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)"
-              tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" />
-          </select> <br /> 
-          <input type="submit" value="Go!" />
-        </p>
-      </form>
-      <p tal:define="std modules/Products.PythonScripts.standard">
-        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
-      </p>
-    </div>
-    <!-- END ANNOTATIONS -->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/layer_image_search.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +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">
-<head>
-<metal:block metal:define-macro="html_head" tal:define="global query pageinfo/query | nothing;" 
-  tal:condition="python:('search' in viewLayers) and query">
-  <!--  search for digilib -->
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/showdown.js"></script>
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/annotator-dl.js"></script>
-  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.annotator.js"></script>
-  <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/annotator.min.css"/>
-
-  <script type="text/javascript" 
-    tal:define="global annServerUrl string:http://md.mpiwg-berlin.mpg.de/searchLines;
-    annUri docinfo/documentPath;
-    annPf pageinfo/pf | nothing;"
-    tal:content="structure string:
-    dlOpts.digilibFrontendPath='/jquery/digilib-ann.html';
-    dlOpts.annotationServerUrl='$annServerUrl/annotator';
-    dlOpts.annotationsReadOnly=true;
-    dlOpts.annotatorPlugins=['Store','Markdown','DigilibIntegrator'];
-    dlOpts.annotatorPluginSettings={'Store':{'loadFromSearch':{'uri':'$annUri','pf':'$annPf','query':'$query'}}};
-    "></script>
-</metal:block>
-
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <li metal:define-macro="layer_select_li" tal:condition="query">
-        <input type="checkbox" class="autosubmit" name="viewLayer" value="search"
-          tal:attributes="checked python:'search' in viewLayers" /> Search results
-      </li>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:('search' in viewLayers) and query">
-    <!-- BEGIN OCRSEARCH -->
-    <div class="options">
-      <h4>OCR Search</h4>
-      <p>
-        Query: "<span tal:replace="query"/>".
-      </p>
-    </div>
-    <!-- END OCRSEARCH -->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/layer_index_extended.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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">
-<head>
-<!-- redefine formatted data -->
-<metal:block metal:define-macro="html_head">
-  <tal:block tal:condition="python:'extended' in viewLayers">
-    <tal:block tal:define="global formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None),bibxdata=docinfo.get('bibx', None));"/>
-  </tal:block>
-</metal:block>
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <metal:block metal:define-macro="layer_select_li">
-        <li>
-          <input type="checkbox" class="autosubmit" name="viewLayer" value="extended"
-            tal:attributes="checked python:'extended' in viewLayers" /> All entries
-        </li>
-      </metal:block>
-    </ul>
-  </div>
-</body>
-
-</html>
--- a/zpt/layer_text_annotator.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +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">
-<head>
-<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
-  <!--  annotator -->
-  <link rel="stylesheet" type="text/css"
-    tal:attributes="href string:$rootUrl/template/annotator_files/css/annotator.css" />
-
-  <script
-    tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/json2.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/extensions.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/console.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/class.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/range.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/annotator.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/widget.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/editor.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/viewer.js"></script>
-  <script
-    tal:attributes="src string:$rootUrl/template/annotator_files/lib/notification.js"></script>
-  <script
-    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/store.js"></script>
-  <script
-    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/permissions.js"></script>
-  <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/annotateitpermissions.js"></script> -->
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/auth.js"></script>
-  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/tags.js"></script>
-  <script
-    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/unsupported.js"></script>
-  <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> -->
-
-  <script type="text/javascript" 
-    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
-    annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
-    resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
-    global annUser python:here.getAuthenticatedUser(anon='anonymous');
-    global annGroup python:request.get('annotator_group', None);
-    permUser python:test(annGroup, 'group:%s'%annGroup, annUser);"
-    tal:content="structure string:
-    var annotatorServerUrl='$annServerUrl';
-    var annotatorPageUrl='$annUrl'; 
-    var annotatorResourceUrl='$resUrl'; 
-    var annotatorUser='$annUser'; 
-    var permissionUser='$permUser';"></script>
-
-  <script type="text/javascript">
-            // <!--
-            $(document).ready(function() {
-                // annotator
-                var elem = $('div.pageContent').get(0);
-                var uri = annotatorPageUrl;
-                var devAnnotator = new Annotator(elem).addPlugin('Auth', {
-                    tokenUrl : 'template/token?user='+annotatorUser
-                }).addPlugin('Permissions', {
-                    permissions: {
-                        'read':   [],
-                        'update': [permissionUser],
-                        'delete': [permissionUser],
-                        'admin':  [permissionUser]
-                    },
-                    user : permissionUser,
-                    userString : function(user) {
-                        if (user && user.name) {
-                            return user.name;
-                        }
-                        return user;
-                    },
-                    userId : function(user) {
-                        if (user && user.id) {
-                            return user.id;
-                        }
-                        return user;
-                    }
-                }).addPlugin('Store', {
-                    prefix: annotatorServerUrl+'/annotator',
-                    annotationData : {
-                        'uri' : uri,
-                        'resource' : annotatorResourceUrl
-                    },
-                    loadFromSearch : {
-                        'limit' : 20,
-                        'uri' : uri
-                    }
-                }).addPlugin('Tags'
-                );
-            });
-        // -->
-        </script>
-
-</metal:block>
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <li metal:define-macro="layer_select_li">
-        <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator"
-          tal:attributes="checked python:'annotator' in viewLayers" /> Annotator
-      </li>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers">
-    <!-- BEGIN ANNOTATIONS -->
-    <div class="options">
-      <h4>Annotator</h4>
-      <p>
-        User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>.
-      </p>
-      <!-- TODO: login button -->
-      <form class="autosubmit" tal:attributes="action viewerUrl">
-        <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params"
-          tal:attributes="name param; value python:params[param]" />
-        <p>
-          In group
-          <select class="autosubmit" name="annotator_group">
-            <option value="" tal:attributes="selected not:annGroup;"> </option>
-            <option
-              tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)"
-              tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" />
-          </select> <br /> 
-          <input type="submit" value="Go!" />
-        </p>
-      </form>
-      <p tal:define="std modules/Products.PythonScripts.standard">
-        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
-      </p>
-    </div>
-    <!-- END ANNOTATIONS -->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/layer_text_dict.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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">
-<head>
-<!-- not used here
-<metal:block metal:define-macro="html_head">
-</metal:block>
--->
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <metal:block metal:define-macro="layer_select_li">
-        <li>
-          <input type="checkbox" class="autosubmit" name="viewLayer" value="dict"
-            tal:attributes="checked python:'dict' in viewLayers" /> Dictionary
-        </li>
-      </metal:block>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:'dict' in viewLayers">
-    <!--"BEGIN DICTIONARY OVERVIEW"-->
-    <!-- <div class="options">
-      <h4>Dictionary view</h4>
-      <form name="f3" action="">
-      <div>Open dictionary definition</div>
-        <ul>
-          <li>
-            <input type="radio" name="r3" /> in new Tab
-          </li>
-          <li>
-            <input type="radio" name="r3" /> in new Window
-          </li>
-        </ul>
-      </form>
-    </div> -->
-    <!--"END DICTIONARY OVERVIEW"-->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/layer_text_gis.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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">
-<head>
-<!-- not used here
-<metal:block metal:define-macro="html_head">
-</metal:block>
--->
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <metal:block metal:define-macro="layer_select_li">
-        <li tal:condition="python:docinfo.get('numPlaces',0)">
-          <input type="checkbox" class="autosubmit" name="viewLayer" value="gis"
-            tal:attributes="checked python:'gis' in viewLayers" /> Places<br />
-        </li>
-      </metal:block>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:'gis' in viewLayers">
-    <!--"BEGIN PLACES"-->
-    <div class="options">
-      <tal:block
-        tal:define="
-            name docinfo/documentName;
-            places python:here.getPlacesOnPage(docinfo=docinfo, pn=pn);
-            pidlist python:','.join([p['id'] for p in places]);">
-        <h4>Places</h4>
-        Show all places
-        <ul class="list">
-          <li>
-            <a
-              tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?id=%s&format=gis'%(name,pidlist)"
-              target="_blank">on this page</a>
-          </li>
-          <li>
-            <a
-              tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?format=gis'%(name)"
-              target="_blank">in whole document</a>
-          </li>
-        </ul>
-      </tal:block>
-    </div>
-    <!--"END PLACES"-->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/layer_text_pundit.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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">
-<head>
-<!-- not used here
-<metal:block metal:define-macro="html_head">
-</metal:block>
--->
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <metal:block metal:define-macro="layer_select_li">
-        <li>
-          <input type="checkbox" class="autosubmit" name="viewLayer" value="pundit"
-            tal:attributes="checked python:'pundit' in viewLayers" /> Pundit
-        </li>
-      </metal:block>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="options_box" tal:condition="python:'pundit' in viewLayers">
-    <!-- <div class="options">
-      <h4>Dictionary view</h4>
-      <form name="f3" action="">
-      <div>Open dictionary definition</div>
-        <ul>
-          <li>
-            <input type="radio" name="r3" /> in new Tab
-          </li>
-          <li>
-            <input type="radio" name="r3" /> in new Window
-          </li>
-        </ul>
-      </form>
-    </div> -->
-  </metal:block> 
-
-</body>
-
-</html>
--- a/zpt/layer_text_search.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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">
-<head>
-<metal:block metal:define-macro="html_head"
-  tal:define="
-    global query python:request.get('query', None); 
-    global queryType python:request.get('queryType','fulltextMorph');
-">
-</metal:block>
-</head>
-<body>
-  <!-- right-side options -->
-  <div class="col buttons">
-    <!-- LAYER DISPLAY OPTION  -->
-    <ul>
-      <metal:block metal:define-macro="layer_select_li">
-        <li tal:condition="python:query"><input type="checkbox" class="autosubmit" name="viewLayer" value="search"
-          tal:attributes="checked python:'search' in viewLayers" /> Search results</li>
-      </metal:block>
-    </ul>
-  </div>
-
-  <metal:block metal:define-macro="extra_column" tal:condition="python:'search' in viewLayers">
-    <!-- right-side search results -->
-    <div class="col results" tal:condition="query">
-      <div class="result">
-        <h4>Search results</h4>
-        <div
-          tal:define="start pageinfo/resultStart; resultsize python:docinfo.get('resultSize',0); grpsize pageinfo/resultPageSize;
-                batch python:here.getBatch(start=start,size=grpsize,end=resultsize);">
-          <div class="ruler" tal:define="startParam string:resultStart">
-            <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
-          </div>
-          <div class="query">
-            Searching "<span tal:content="query" />" (<span tal:content="queryType" />)
-          </div>
-          <div class="content"
-            tal:content="structure python:here.getResultsPage(mode=queryType,query=query,start=start,size=grpsize,pageinfo=pageinfo,docinfo=docinfo)" />
-        </div>
-      </div>
-    </div>
-  </metal:block>
-
-  <metal:block metal:define-macro="options_box">
-    <!-- search options -->
-    <div class="options">
-      <h4>Search</h4>
-      <form tal:attributes="action viewerUrl">
-        <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewLayer':None})"
-          tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
-        <!-- make sure we have one viewLayer=search -->
-        <tal:block tal:repeat="vl viewLayers">
-          <input type="hidden" name="viewLayer" tal:attributes="value vl" tal:condition="python:vl != 'search'" />
-        </tal:block>
-        <input type="hidden" name="viewLayer" value="search" />
-        <!-- query text -->
-        <input type="text" name="query" tal:attributes="value query" /> <br /> <input type="submit" value="Search" /> <a
-          tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a>
-        <ul>
-          <li><input type="radio" name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" />
-            Exact</li>
-          <li><input type="radio" name="queryType" value="fulltextMorph"
-            tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms</li>
-          <li><input type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" />
-            Fulltext index</li>
-          <li><input type="radio" name="queryType" value="ftIndexMorph"
-            tal:attributes="checked python:queryType=='ftIndexMorph'" /> Morphological index</li>
-        </ul>
-      </form>
-    </div>
-    <!-- end search options-->
-  </metal:block>
-
-</body>
-
-</html>
--- a/zpt/toc_concordance.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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">
-<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 concordance"
-      tal:define="start pageinfo/start; tocsize docinfo/numPages; grpsize pageinfo/tocPageSize;
-                pageNumbers docinfo/pageNumbers | nothing;
-                batch python:here.getBatch(start=start,size=grpsize,end=tocsize,data=pageNumbers);">
-      <h4>Page concordance</h4>              
-      <div class="ruler top">
-        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
-      </div>
-      <div class="content">
-        <table class="concordance" tal:condition="pageNumbers">
-          <tr>
-            <th>Scan</th>
-            <th>Original</th>
-          </tr>
-          <tr tal:repeat="toc batch/this">
-            <tal:block tal:define="pn toc/pn | nothing">
-              <td><a tal:condition="pn" tal:attributes="href python:here.getLink('pn', toc['pn'])" tal:content="toc/pn"
-                title="Scan number">ScanNo</a></td>
-              <td><span class="originalPage" title="Original page number" tal:define="originalPage toc/no | nothing"
-                tal:condition="python:originalPage!=None"><span tal:replace="originalPage" /><span
-                  tal:define="originalPageNorm toc/non | nothing" tal:condition="python:originalPageNorm!=None"> [<span
-                    tal:replace="originalPageNorm" />]
-                </span></span></td>
-            </tal:block>
-          </tr>
-        </table>
-      </div>
-      <div class="ruler bottom">
-        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
-      </div>
-    </div>
-  </div>
-  <!-- /toc -->
-</body>
-</html>
--- a/zpt/toc_figures.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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">
-<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/numFigureEntries; grpsize pageinfo/tocPageSize;
-                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
-      <h4>Table of figures</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='figures',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>
--- a/zpt/toc_handwritten.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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">
-<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>
--- a/zpt/toc_none.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +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">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-</head>
-<body>
-  <!-- block used for main content area -->
-  <div class="toc-none" metal:define-macro="main">
-    <div metal:use-macro="here/template/common_template/macros/toc_switcher"/>
-    <!--  <div class="tocbody none"></div> -->
-  </div>
-  <!-- toc -->
-</body>
-</html>
--- a/zpt/toc_text.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-</head>
-<body>
-  <div class="toc-container" metal:define-macro="main"
-    tal:define="start pageinfo/start; tocsize docinfo/numTocEntries; grpsize pageinfo/tocPageSize;
-                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
-    <div metal:use-macro="here/template/common_template/macros/toc_switcher" />
-    <!-- block used for main content area -->
-    <div class="tocbody text">
-      <h4>Table of contents</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='text',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>
--- a/zpt/toc_thumbs.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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">
-<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 thumbs"
-      tal:define="start pageinfo/start;
-                grpsize pageinfo/groupsize;
-                numgroups pageinfo/numgroups;
-                pageBatch pageinfo/pageBatch; pageZero pageinfo/pageZero;
-                pageNumbers docinfo/pageNumbers | nothing;
-                left python:test(flowLtr,pageBatch['prevStart'],pageBatch['nextStart']);
-                right python:test(flowLtr,pageBatch['nextStart'],pageBatch['prevStart']);">
-
-      <div class="content">
-        <h4>List of thumbnails</h4>
-        <div class="ruler top">
-          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
-        </div>
-        <table class="thumbs">
-          <tr tal:repeat="row pageBatch/pages">
-            <td tal:repeat="thumb row" tal:attributes="class python:here.getStyle(thumb['idx'],pn,'thumb')"><a
-              tal:define="idx thumb/idx" tal:condition="idx" tal:attributes="href python:here.getLink('pn',idx)"> <img
-                tal:attributes="src python:test(docinfo.get('imageURL',None),here.getScalerUrl(pn=idx,dw=100,dh=100,docinfo=docinfo),'template/text.png');
-                                alt idx;" /><br />
-                <span tal:attributes="title string:Scan number $idx" tal:content="idx" /> <span
-                tal:condition="python:pageNumbers and pageNumbers.get(idx, False) and pageNumbers[idx]['no']"
-                tal:attributes="title python:'Original page number %s'%(pageNumbers[idx]['no'])" tal:content="python:' (%s)'%(pageNumbers[idx]['no'])" />
-            </a></td>
-          </tr>
-        </table>
-        <div class="ruler bottom">
-          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
-        </div>
-      </div>
-      <!-- content -->
-    </div>
-    <!-- toc -->
-  </div>
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/common_template.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,132 @@
+<!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>
+  <!-- block used for page header content area -->
+  <metal:block metal:define-macro="head"
+    tal:define="viewMode pageinfo/viewMode;
+                docpath docinfo/textURLPath | nothing;
+                bib docinfo/bib | nothing; bibType docinfo/bibType | nothing;
+                formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);">
+    <div class="logo" tal:condition="exists:here/template/site_template.pt/macros/logo">
+      <metal:block metal:use-macro="here/template/site_template.pt/macros/logo"/>
+    </div>
+    <div class="title-block">
+      <div class="title" tal:condition="not:formattedLabel">
+        <tal:block tal:condition="python:docinfo['creator'] or docinfo['title']">
+          <i tal:content="docinfo/creator" />,
+        <span tal:content="docinfo/title" />, <span tal:content="docinfo/date" />
+        </tal:block>
+        <span tal:condition="not:python:docinfo['creator'] or docinfo['title']"
+          tal:content="string:[no bibliographical information for this document (type ${bibType})]" />
+      </div>
+      <div class="title" tal:condition="formattedLabel" tal:content="structure formattedLabel" />
+      <ul class="view-switcher" metal:define-slot="view-switcher">
+        <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'text')"><a
+          tal:omit-tag="python:viewMode=='text'" tal:attributes="href python:here.getLink('viewMode','text')">Text</a></li>
+        <li tal:condition="python:docinfo.get('imagePath',None)" tal:attributes="class python:here.getStyle(viewMode, 'image')"><a
+          tal:omit-tag="python:viewMode=='image'" tal:attributes="href python:here.getLink('viewMode','image')">Image</a></li>
+        <li tal:condition="docpath" tal:attributes="class python:here.getStyle(viewMode, 'xml')"><a
+          tal:omit-tag="python:viewMode=='xml'" tal:attributes="href python:here.getLink('viewMode','xml')">XML</a></li>
+        <li tal:condition="python:docinfo.get('imagePath',None)" tal:attributes="class python:here.getStyle(viewMode, 'thumbs')"><a
+          tal:omit-tag="python:viewMode=='thumbs'" tal:attributes="href python:here.getLink('viewMode','thumbs')">Thumbnail
+            overview</a></li>
+        <li tal:attributes="class python:here.getStyle(viewMode, 'index')"><a tal:omit-tag="python:viewMode=='index'"
+          tal:attributes="href python:here.getLink('viewMode','index')">Document information</a></li>
+      </ul>
+    </div>
+  </metal:block>
+  <!-- /head -->
+
+
+  <!-- page ruler with previous/next page buttons -->
+  <metal:block metal:define-macro="page_ruler"
+    tal:define="
+              prev python:test(pn>1,pn-1,None); next python:test(pn<numPages,pn+1,None);
+              first python:test(pn>1,1,None); last python:test(pn<numPages,numPages,None);
+              left python:test(flowLtr,prev,next); right python:test(flowLtr,next,prev);
+              leftest python:test(flowLtr,first,last); rightest python:test(flowLtr,last,first);">
+    <form class="autosubmit" tal:attributes="action viewerUrl">
+      <input type="hidden" tal:define="params python:here.getParams('pn', None)" tal:repeat="param params"
+        tal:attributes="name param; value python:params[param]" /> <span class="ruler-main">page <a tal:condition="leftest"
+        tal:attributes="href python:here.getLink('pn',leftest)">|&lt;</a> <span tal:condition="not:leftest">|&lt;</span> <a
+        tal:condition="left" tal:attributes="href python:here.getLink('pn',left)">&lt;</a> <span tal:condition="not:left">&lt;</span>
+        <input class="autosubmit" size="3" type="text" name="pn" tal:attributes="value pn" /> <span class="originalPage"
+        title="Original page number" tal:define="originalPage pageinfo/pageNumberOrig | nothing"
+        tal:condition="python:originalPage!=None"> (<span tal:replace="originalPage" /><span
+          tal:define="originalPageNorm pageinfo/pageNumberOrigNorm | nothing" tal:condition="python:originalPageNorm!=None">
+            [<span tal:replace="originalPageNorm" />]
+        </span>)
+      </span> <input type="submit" value="Go" /> of <span tal:replace="numPages" /> <a tal:condition="right"
+        tal:attributes="href python:here.getLink('pn',right)">&gt;</a> <span tal:condition="not:right">&gt;</span> <a
+        tal:condition="rightest" tal:attributes="href python:here.getLink('pn',rightest)">&gt;|</a> <span
+        tal:condition="not:rightest">&gt;|</span>
+      </span>
+      <!-- ruler-main -->
+    </form>
+  </metal:block>
+  <!-- /ruler -->
+
+  <!-- toc ruler (using getBatch) with previous/next toc page buttons -->
+  <metal:block metal:define-macro="toc_ruler">
+    <form class="autosubmit" tal:attributes="action viewerUrl" tal:define="startParam startParam | string:start">
+      <input type="hidden" tal:define="params python:here.getParams(startParam, None)" tal:repeat="param params"
+        tal:attributes="name param; value python:params[param]" /> <a tal:condition="batch/prevStart"
+        tal:attributes="href python:here.getLink(startParam,batch['prevStart'])">&lt;</a> <span tal:condition="not:batch/prevStart">&lt;</span>
+      <select class="autosubmit" tal:attributes="name startParam">
+        <option tal:repeat="grp batch/batches" tal:attributes="selected python:(start>=grp['start'] and start<=grp['end']); value grp/start"
+          tal:content="string:${grp/start} - ${grp/end}" />
+        <option tal:condition="python:start>batch['last']" selected="selected" value="1">[out of range]</option>
+      </select> <input type="submit" value="Go" /> <a tal:condition="batch/nextStart"
+        tal:attributes="href python:here.getLink(startParam,batch['nextStart'])">&gt;</a> <span tal:condition="not:batch/nextStart">&gt;</span>
+    </form>
+  </metal:block>
+
+  <!-- toc ruler for thumbs (using getPageBatch) with previous/next toc page buttons -->
+  <metal:block metal:define-macro="toc_ruler_thumbs">
+    <form class="autosubmit" tal:attributes="action viewerUrl">
+      <input type="hidden" tal:define="params python:here.getParams('start',None)" tal:repeat="param params"
+        tal:attributes="name param; value python:params[param]" /><span class="ruler-main"><a tal:condition="left"
+        tal:attributes="href python:here.getLink('start',left)">&lt;</a> <span tal:condition="not:left">&lt;</span> <select
+        class="autosubmit" name="start" tal:define="ofs python:test(pageinfo['pageZero'],0,1)">
+          <tal:block>
+            <option tal:repeat="grp pageBatch/batches" tal:attributes="selected python:(start>=grp['start'] and start<=grp['end']); value grp/start;"
+              tal:content="string:${grp/start} - ${grp/end}" />
+            <option tal:condition="python:start>pageBatch['last']" selected="selected" value="1">[out of range]</option>
+          </tal:block>
+      </select> <input type="submit" value="Go" /> <a tal:condition="right" tal:attributes="href python:here.getLink('start',right)">&gt;</a>
+        <span tal:condition="not:right">&gt;</span></span>
+    </form>
+  </metal:block>
+
+  <!-- toc type switcher -->
+  <metal:block metal:define-macro="toc_switcher">
+    <div class="toc-switcher-col">
+      <div class="toc-switcher">
+        <ul>
+          <li tal:attributes="class python:here.getStyle(tocMode, 'none')"><span><a
+              tal:omit-tag="python:tocMode=='none'" tal:attributes="href python:here.getLink('tocMode','none')">None</a></span></li>
+          <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>
+          <li tal:attributes="class python:here.getStyle(tocMode, 'text')"
+            tal:condition="python:docpath and docinfo.get('numTocEntries', None)"><span><a
+              tal:omit-tag="python:tocMode=='text'" tal:attributes="href python:here.getLink('tocMode','text')">Content</a></span></li>
+          <li tal:attributes="class python:here.getStyle(tocMode, 'thumbs')"><span><a
+              tal:omit-tag="python:tocMode=='thumbs'" tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a></span></li>
+        </ul>
+      </div>
+    </div>
+  </metal:block>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_image_annotator.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,83 @@
+<!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>
+<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
+  <!--  annotator for digilib -->
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/showdown.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/annotator-dl.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.annotator.js"></script>
+  <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/annotator.min.css"/>
+
+  <script type="text/javascript" 
+    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
+    global annTokenUrl string:$viewerUrl/template/token/getLoginToken;
+    annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
+    resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
+    global annUser python:here.getAuthenticatedUser(anon='anonymous');
+    global annGroup python:request.get('annotator_group', None);
+    permUser python:test(annGroup, 'group:%s'%annGroup, annUser);"
+    tal:content="structure string:
+    dlOpts.digilibFrontendPath='/jquery/digilib-ann.html';
+    dlOpts.annotationServerUrl='$annServerUrl/annotator';
+    dlOpts.annotationTokenUrl='$annTokenUrl';
+    dlOpts.annotationUser='$annUser';
+    dlOpts.annotatorPlugins=['Auth','Permissions','Store','Markdown','DigilibIntegrator'];
+    dlOpts.annotatorPluginSettings={'Store':{'annotationData':{'uri':'$annUrl','resource':'$resUrl'},'loadFromSearch':{'uri':'$annUrl'}},
+        'Permissions':{'read':[],'update':['$permUser'],'delete':['$permUser'],'admin':['$permUser']}};
+    "></script>
+</metal:block>
+
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <li metal:define-macro="layer_select_li">
+        <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator"
+          tal:attributes="checked python:'annotator' in viewLayers" /> Annotator
+      </li>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers">
+    <!-- BEGIN ANNOTATIONS -->
+    <div class="options">
+      <h4>Annotator</h4>
+      <ul>
+        <li><a href="javascript:$digilib.digilib('setAnnotationMark')"> <img tal:condition="exists:here/template/annotation-mark.png"
+            tal:attributes="src here/template/annotation-mark.png/absolute_url" /> annotate point
+        </a></li>
+        <li><a href="javascript:$digilib.digilib('setAnnotationRegion')"> <img tal:condition="exists:here/template/annotation-region.png"
+            tal:attributes="src here/template/annotation-region.png/absolute_url" /> annotate region
+        </a></li>
+      </ul>
+      <p>
+        User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>.
+      </p>
+      <!-- TODO: login button -->
+      <form class="autosubmit" tal:attributes="action viewerUrl">
+        <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params"
+          tal:attributes="name param; value python:params[param]" />
+        <p>
+          In group
+          <select class="autosubmit" name="annotator_group">
+            <option value="" tal:attributes="selected not:annGroup;"> </option>
+            <option
+              tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)"
+              tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" />
+          </select> <br /> 
+          <input type="submit" value="Go!" />
+        </p>
+      </form>
+      <p tal:define="std modules/Products.PythonScripts.standard">
+        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
+      </p>
+    </div>
+    <!-- END ANNOTATIONS -->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_image_search.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,52 @@
+<!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>
+<metal:block metal:define-macro="html_head" tal:define="global query pageinfo/query | nothing;" 
+  tal:condition="python:('search' in viewLayers) and query">
+  <!--  search for digilib -->
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/showdown.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/annotator-dl.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.annotator.js"></script>
+  <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/annotator.min.css"/>
+
+  <script type="text/javascript" 
+    tal:define="global annServerUrl string:http://md.mpiwg-berlin.mpg.de/searchLines;
+    annUri docinfo/documentPath;
+    annPf pageinfo/pf | nothing;"
+    tal:content="structure string:
+    dlOpts.digilibFrontendPath='/jquery/digilib-ann.html';
+    dlOpts.annotationServerUrl='$annServerUrl/annotator';
+    dlOpts.annotationsReadOnly=true;
+    dlOpts.annotatorPlugins=['Store','Markdown','DigilibIntegrator'];
+    dlOpts.annotatorPluginSettings={'Store':{'loadFromSearch':{'uri':'$annUri','pf':'$annPf','query':'$query'}}};
+    "></script>
+</metal:block>
+
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <li metal:define-macro="layer_select_li" tal:condition="query">
+        <input type="checkbox" class="autosubmit" name="viewLayer" value="search"
+          tal:attributes="checked python:'search' in viewLayers" /> Search results
+      </li>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:('search' in viewLayers) and query">
+    <!-- BEGIN OCRSEARCH -->
+    <div class="options">
+      <h4>OCR Search</h4>
+      <p>
+        Query: "<span tal:replace="query"/>".
+      </p>
+    </div>
+    <!-- END OCRSEARCH -->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_index_extended.zpt	Fri Nov 16 17:16:50 2012 +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>
+<!-- redefine formatted data -->
+<metal:block metal:define-macro="html_head">
+  <tal:block tal:condition="python:'extended' in viewLayers">
+    <tal:block tal:define="global formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None),bibxdata=docinfo.get('bibx', None));"/>
+  </tal:block>
+</metal:block>
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <metal:block metal:define-macro="layer_select_li">
+        <li>
+          <input type="checkbox" class="autosubmit" name="viewLayer" value="extended"
+            tal:attributes="checked python:'extended' in viewLayers" /> All entries
+        </li>
+      </metal:block>
+    </ul>
+  </div>
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_text_annotator.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,136 @@
+<!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>
+<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
+  <!--  annotator -->
+  <link rel="stylesheet" type="text/css"
+    tal:attributes="href string:$rootUrl/template/annotator_files/css/annotator.css" />
+
+  <script
+    tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/json2.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/extensions.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/console.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/class.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/range.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/annotator.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/widget.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/editor.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/viewer.js"></script>
+  <script
+    tal:attributes="src string:$rootUrl/template/annotator_files/lib/notification.js"></script>
+  <script
+    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/store.js"></script>
+  <script
+    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/permissions.js"></script>
+  <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/annotateitpermissions.js"></script> -->
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/auth.js"></script>
+  <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/tags.js"></script>
+  <script
+    tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/unsupported.js"></script>
+  <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> -->
+
+  <script type="text/javascript" 
+    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
+    annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
+    resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
+    global annUser python:here.getAuthenticatedUser(anon='anonymous');
+    global annGroup python:request.get('annotator_group', None);
+    permUser python:test(annGroup, 'group:%s'%annGroup, annUser);"
+    tal:content="structure string:
+    var annotatorServerUrl='$annServerUrl';
+    var annotatorPageUrl='$annUrl'; 
+    var annotatorResourceUrl='$resUrl'; 
+    var annotatorUser='$annUser'; 
+    var permissionUser='$permUser';"></script>
+
+  <script type="text/javascript">
+            // <!--
+            $(document).ready(function() {
+                // annotator
+                var elem = $('div.pageContent').get(0);
+                var uri = annotatorPageUrl;
+                var devAnnotator = new Annotator(elem).addPlugin('Auth', {
+                    tokenUrl : 'template/token?user='+annotatorUser
+                }).addPlugin('Permissions', {
+                    permissions: {
+                        'read':   [],
+                        'update': [permissionUser],
+                        'delete': [permissionUser],
+                        'admin':  [permissionUser]
+                    },
+                    user : permissionUser,
+                    userString : function(user) {
+                        if (user && user.name) {
+                            return user.name;
+                        }
+                        return user;
+                    },
+                    userId : function(user) {
+                        if (user && user.id) {
+                            return user.id;
+                        }
+                        return user;
+                    }
+                }).addPlugin('Store', {
+                    prefix: annotatorServerUrl+'/annotator',
+                    annotationData : {
+                        'uri' : uri,
+                        'resource' : annotatorResourceUrl
+                    },
+                    loadFromSearch : {
+                        'limit' : 20,
+                        'uri' : uri
+                    }
+                }).addPlugin('Tags'
+                );
+            });
+        // -->
+        </script>
+
+</metal:block>
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <li metal:define-macro="layer_select_li">
+        <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator"
+          tal:attributes="checked python:'annotator' in viewLayers" /> Annotator
+      </li>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers">
+    <!-- BEGIN ANNOTATIONS -->
+    <div class="options">
+      <h4>Annotator</h4>
+      <p>
+        User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>.
+      </p>
+      <!-- TODO: login button -->
+      <form class="autosubmit" tal:attributes="action viewerUrl">
+        <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params"
+          tal:attributes="name param; value python:params[param]" />
+        <p>
+          In group
+          <select class="autosubmit" name="annotator_group">
+            <option value="" tal:attributes="selected not:annGroup;"> </option>
+            <option
+              tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)"
+              tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" />
+          </select> <br /> 
+          <input type="submit" value="Go!" />
+        </p>
+      </form>
+      <p tal:define="std modules/Products.PythonScripts.standard">
+        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
+      </p>
+    </div>
+    <!-- END ANNOTATIONS -->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_text_dict.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,45 @@
+<!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>
+<!-- not used here
+<metal:block metal:define-macro="html_head">
+</metal:block>
+-->
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <metal:block metal:define-macro="layer_select_li">
+        <li>
+          <input type="checkbox" class="autosubmit" name="viewLayer" value="dict"
+            tal:attributes="checked python:'dict' in viewLayers" /> Dictionary
+        </li>
+      </metal:block>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'dict' in viewLayers">
+    <!--"BEGIN DICTIONARY OVERVIEW"-->
+    <!-- <div class="options">
+      <h4>Dictionary view</h4>
+      <form name="f3" action="">
+      <div>Open dictionary definition</div>
+        <ul>
+          <li>
+            <input type="radio" name="r3" /> in new Tab
+          </li>
+          <li>
+            <input type="radio" name="r3" /> in new Window
+          </li>
+        </ul>
+      </form>
+    </div> -->
+    <!--"END DICTIONARY OVERVIEW"-->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_text_gis.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,53 @@
+<!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>
+<!-- not used here
+<metal:block metal:define-macro="html_head">
+</metal:block>
+-->
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <metal:block metal:define-macro="layer_select_li">
+        <li tal:condition="python:docinfo.get('numPlaces',0)">
+          <input type="checkbox" class="autosubmit" name="viewLayer" value="gis"
+            tal:attributes="checked python:'gis' in viewLayers" /> Places<br />
+        </li>
+      </metal:block>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'gis' in viewLayers">
+    <!--"BEGIN PLACES"-->
+    <div class="options">
+      <tal:block
+        tal:define="
+            name docinfo/documentName;
+            places python:here.getPlacesOnPage(docinfo=docinfo, pn=pn);
+            pidlist python:','.join([p['id'] for p in places]);">
+        <h4>Places</h4>
+        Show all places
+        <ul class="list">
+          <li>
+            <a
+              tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?id=%s&format=gis'%(name,pidlist)"
+              target="_blank">on this page</a>
+          </li>
+          <li>
+            <a
+              tal:attributes="href python:'http://mappit.mpiwg-berlin.mpg.de/db/RESTdb/db/mpdl/%s?format=gis'%(name)"
+              target="_blank">in whole document</a>
+          </li>
+        </ul>
+      </tal:block>
+    </div>
+    <!--"END PLACES"-->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_text_pundit.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,43 @@
+<!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>
+<!-- not used here
+<metal:block metal:define-macro="html_head">
+</metal:block>
+-->
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <metal:block metal:define-macro="layer_select_li">
+        <li>
+          <input type="checkbox" class="autosubmit" name="viewLayer" value="pundit"
+            tal:attributes="checked python:'pundit' in viewLayers" /> Pundit
+        </li>
+      </metal:block>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'pundit' in viewLayers">
+    <!-- <div class="options">
+      <h4>Dictionary view</h4>
+      <form name="f3" action="">
+      <div>Open dictionary definition</div>
+        <ul>
+          <li>
+            <input type="radio" name="r3" /> in new Tab
+          </li>
+          <li>
+            <input type="radio" name="r3" /> in new Window
+          </li>
+        </ul>
+      </form>
+    </div> -->
+  </metal:block> 
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/layer_text_search.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,77 @@
+<!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>
+<metal:block metal:define-macro="html_head"
+  tal:define="
+    global query python:request.get('query', None); 
+    global queryType python:request.get('queryType','fulltextMorph');
+">
+</metal:block>
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <metal:block metal:define-macro="layer_select_li">
+        <li tal:condition="python:query"><input type="checkbox" class="autosubmit" name="viewLayer" value="search"
+          tal:attributes="checked python:'search' in viewLayers" /> Search results</li>
+      </metal:block>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="extra_column" tal:condition="python:'search' in viewLayers">
+    <!-- right-side search results -->
+    <div class="col results" tal:condition="query">
+      <div class="result">
+        <h4>Search results</h4>
+        <div
+          tal:define="start pageinfo/resultStart; resultsize python:docinfo.get('resultSize',0); grpsize pageinfo/resultPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=resultsize);">
+          <div class="ruler" tal:define="startParam string:resultStart">
+            <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
+          </div>
+          <div class="query">
+            Searching "<span tal:content="query" />" (<span tal:content="queryType" />)
+          </div>
+          <div class="content"
+            tal:content="structure python:here.getResultsPage(mode=queryType,query=query,start=start,size=grpsize,pageinfo=pageinfo,docinfo=docinfo)" />
+        </div>
+      </div>
+    </div>
+  </metal:block>
+
+  <metal:block metal:define-macro="options_box">
+    <!-- search options -->
+    <div class="options">
+      <h4>Search</h4>
+      <form tal:attributes="action viewerUrl">
+        <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewLayer':None})"
+          tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+        <!-- make sure we have one viewLayer=search -->
+        <tal:block tal:repeat="vl viewLayers">
+          <input type="hidden" name="viewLayer" tal:attributes="value vl" tal:condition="python:vl != 'search'" />
+        </tal:block>
+        <input type="hidden" name="viewLayer" value="search" />
+        <!-- query text -->
+        <input type="text" name="query" tal:attributes="value query" /> <br /> <input type="submit" value="Search" /> <a
+          tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a>
+        <ul>
+          <li><input type="radio" name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" />
+            Exact</li>
+          <li><input type="radio" name="queryType" value="fulltextMorph"
+            tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms</li>
+          <li><input type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" />
+            Fulltext index</li>
+          <li><input type="radio" name="queryType" value="ftIndexMorph"
+            tal:attributes="checked python:queryType=='ftIndexMorph'" /> Morphological index</li>
+        </ul>
+      </form>
+    </div>
+    <!-- end search options-->
+  </metal:block>
+
+</body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_concordance.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,45 @@
+<!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 concordance"
+      tal:define="start pageinfo/start; tocsize docinfo/numPages; grpsize pageinfo/tocPageSize;
+                pageNumbers docinfo/pageNumbers | nothing;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize,data=pageNumbers);">
+      <h4>Page concordance</h4>              
+      <div class="ruler top">
+        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
+      </div>
+      <div class="content">
+        <table class="concordance" tal:condition="pageNumbers">
+          <tr>
+            <th>Scan</th>
+            <th>Original</th>
+          </tr>
+          <tr tal:repeat="toc batch/this">
+            <tal:block tal:define="pn toc/pn | nothing">
+              <td><a tal:condition="pn" tal:attributes="href python:here.getLink('pn', toc['pn'])" tal:content="toc/pn"
+                title="Scan number">ScanNo</a></td>
+              <td><span class="originalPage" title="Original page number" tal:define="originalPage toc/no | nothing"
+                tal:condition="python:originalPage!=None"><span tal:replace="originalPage" /><span
+                  tal:define="originalPageNorm toc/non | nothing" tal:condition="python:originalPageNorm!=None"> [<span
+                    tal:replace="originalPageNorm" />]
+                </span></span></td>
+            </tal:block>
+          </tr>
+        </table>
+      </div>
+      <div class="ruler bottom">
+        <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler" />
+      </div>
+    </div>
+  </div>
+  <!-- /toc -->
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_figures.zpt	Fri Nov 16 17:16:50 2012 +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/numFigureEntries; grpsize pageinfo/tocPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
+      <h4>Table of figures</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='figures',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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_handwritten.zpt	Fri Nov 16 17:16:50 2012 +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 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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_none.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,15 @@
+<!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>
+  <!-- block used for main content area -->
+  <div class="toc-none" metal:define-macro="main">
+    <div metal:use-macro="here/template/common_template/macros/toc_switcher"/>
+    <!--  <div class="tocbody none"></div> -->
+  </div>
+  <!-- toc -->
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_text.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,26 @@
+<!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"
+    tal:define="start pageinfo/start; tocsize docinfo/numTocEntries; grpsize pageinfo/tocPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
+    <div metal:use-macro="here/template/common_template/macros/toc_switcher" />
+    <!-- block used for main content area -->
+    <div class="tocbody text">
+      <h4>Table of contents</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='text',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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/toc_thumbs.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,46 @@
+<!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 thumbs"
+      tal:define="start pageinfo/start;
+                grpsize pageinfo/groupsize;
+                numgroups pageinfo/numgroups;
+                pageBatch pageinfo/pageBatch; pageZero pageinfo/pageZero;
+                pageNumbers docinfo/pageNumbers | nothing;
+                left python:test(flowLtr,pageBatch['prevStart'],pageBatch['nextStart']);
+                right python:test(flowLtr,pageBatch['nextStart'],pageBatch['prevStart']);">
+
+      <div class="content">
+        <h4>List of thumbnails</h4>
+        <div class="ruler top">
+          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
+        </div>
+        <table class="thumbs">
+          <tr tal:repeat="row pageBatch/pages">
+            <td tal:repeat="thumb row" tal:attributes="class python:here.getStyle(thumb['idx'],pn,'thumb')"><a
+              tal:define="idx thumb/idx" tal:condition="idx" tal:attributes="href python:here.getLink('pn',idx)"> <img
+                tal:attributes="src python:test(docinfo.get('imageURL',None),here.getScalerUrl(pn=idx,dw=100,dh=100,docinfo=docinfo),'template/text.png');
+                                alt idx;" /><br />
+                <span tal:attributes="title string:Scan number $idx" tal:content="idx" /> <span
+                tal:condition="python:pageNumbers and pageNumbers.get(idx, False) and pageNumbers[idx]['no']"
+                tal:attributes="title python:'Original page number %s'%(pageNumbers[idx]['no'])" tal:content="python:' (%s)'%(pageNumbers[idx]['no'])" />
+            </a></td>
+          </tr>
+        </table>
+        <div class="ruler bottom">
+          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
+        </div>
+      </div>
+      <!-- content -->
+    </div>
+    <!-- toc -->
+  </div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_image.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,165 @@
+<!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;
+              viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
+              availableLayers python:here.getAvailableLayers().get('image', None);
+              tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
+              numPages docinfo/numPages | nothing; dlBaseUrl docinfo/digilibBaseUrl | nothing;">
+<head>
+<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" />
+<script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.js"></script>
+<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.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"
+  tal:content="python:'''\n
+       var dlOpts = {\n
+            'interactionMode' : 'fullscreen',\n
+            'digilibBaseUrl' : '%s',\n
+            'fn' : '%s',\n
+            'pn' : '%s',\n
+            'suppressParamNames' : ['fn'],\n
+            'scalerInsets' : {'x':300, 'y':100}\n
+        };\n'''%(dlBaseUrl,docinfo.get('imagePath',''),pageinfo.get('pn','1'))"></script>
+
+<!--  layer headers (rendered always) -->
+<tal:block tal:repeat="layer availableLayers">
+  <tal:block tal:define="mpath string:here/template/layer_image_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
+    <metal:block metal:use-macro="python:path(mpath)" />
+  </tal:block>
+</tal:block>
+
+<script type="text/javascript">
+	// <!--
+	$(document).ready(function() {
+		// autosubmit forms
+		$('form.autosubmit').find('.autosubmit').change(function() {
+			this.form.submit();
+		});
+		$('form.autosubmit input[type="submit"]').hide();
+		// get digilib div
+		$digilib = $('div#scaler');
+		// configure digilib
+		$digilib.digilib(dlOpts);
+	});
+// -->
+</script>
+</head>
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="docpath docinfo/textURLPath | nothing;
+              pn pageinfo/pn; 
+              flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';">
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/common_template/macros/head" />
+    </div>
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!-- table of contents -->
+      <div class="col toc">
+        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+      </div>
+      <!-- col-main: document page -->
+      <div class="col main">
+        <div class="ruler top">
+          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
+        </div>
+        <div class="content image">
+          <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 buttons">
+        <!-- layer switcher -->
+        <div class="options" tal:condition="availableLayers">
+          <h4>Image layer</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit">
+            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
+              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+            <ul>
+              <!-- layer select buttons (rendered always) -->
+              <tal:block tal:repeat="layer availableLayers">
+                <tal:block tal:define="mpath string:here/template/layer_image_${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>
+
+        <!-- digilib options -->
+        <div class="options digilib">
+          <ul>
+            <li><a href="javascript:$digilib.digilib('zoomBy', 1.4)"> <img tal:condition="exists:here/template/zoom-in.png"
+                tal:attributes="src here/template/zoom-in.png/absolute_url" /> zoom in
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('zoomBy', 0.7)"> <img
+                tal:condition="exists:here/template/zoom-out.png" tal:attributes="src here/template/zoom-out.png/absolute_url" />
+                zoom out
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('zoomArea')"> <img tal:condition="exists:here/template/zoom-area.png"
+                tal:attributes="src here/template/zoom-area.png/absolute_url" /> zoom area
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('zoomFull')"> <img tal:condition="exists:here/template/zoom-full.png"
+                tal:attributes="src here/template/zoom-full.png/absolute_url" /> full page
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('zoomFull', 'width')"> <img
+                tal:condition="exists:here/template/pagewidth.png" tal:attributes="src here/template/pagewidth.png/absolute_url" /> page
+                width
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('setMark')"> <img tal:condition="exists:here/template/mark.png"
+                tal:attributes="src here/template/mark.png/absolute_url" /> set mark
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('removeMark')"> <img tal:condition="exists:here/template/delmark.png"
+                tal:attributes="src here/template/delmark.png/absolute_url" /> remove mark
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('reference')"> <img tal:condition="exists:here/template/reference.png"
+                tal:attributes="src here/template/reference.png/absolute_url" /> get reference
+            </a></li>
+            <li><a href="javascript:$digilib.digilib('digilibUrl', 'open_new')"> <img
+                tal:condition="exists:here/template/digilib.png" tal:attributes="src here/template/digilib.png/absolute_url" />
+                digilib
+            </a></li>
+          </ul>
+        </div>
+
+        <!--  layer option boxes (rendered if active) -->
+        <tal:block tal:repeat="layer availableLayers">
+          <tal:block tal:define="mpath string:here/template/layer_image_${layer}/macros/options_box"
+            tal:condition="python:exists(mpath)">
+            <metal:block metal:use-macro="python:path(mpath)" />
+          </tal:block>
+        </tal:block>
+      </div>
+    </div><!-- /page-body -->
+    
+    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
+      <div class="errortext">Sorry, access to this document is restricted.</div>
+    </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"/>
+    </tal:block>
+    
+  </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"/>
+  </tal:block>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_index.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,220 @@
+<!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; 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;
+                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
+<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
+<script type="text/javascript" tal:attributes="src string:$viewerUrl/template/jquery_js"></script>
+<script type="text/javascript">
+	$(document).ready(function() {
+		// autosubmit forms
+		$('form.autosubmit').find('.autosubmit').change(function() {
+			this.form.submit();
+		});
+		$('form.autosubmit input[type="submit"]').hide();
+	});
+// -->
+</script>
+<!--  layer headers (all available) -->
+<tal:block tal:repeat="layer availableLayers">
+  <tal:block tal:define="mpath string:here/template/layer_index_${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 -->
+  <div class="page-head">
+    <metal:block metal:use-macro="here/template/common_template/macros/head" />
+  </div>
+
+  <!-- main -->
+  <div class="page-body">
+
+    <div class="col index-image">
+      <!-- image -->
+      <a tal:define="tp docinfo/titlePage | string:1"
+        tal:attributes="href python:context.getLink(params={'viewMode':'auto','pn':tp})"><img tal:condition="tp" border="0"
+        tal:attributes="src python:'%s&pn=%s&dw=300&dh=500'%(docinfo.get('imageURL',None),tp)" /><img
+        tal:condition="python:not docinfo.get('titlePage',None) and exists('here/template/book.png')" border="0"
+        src="template/book.png" /></a>
+    </div>
+
+    <div class="col main">
+      <!-- main content column -->
+      <div class="index-info">
+        <h2>Bibliographic information</h2>
+        <table border="0">
+          <tal:x condition="python:formattedData">
+            <!-- wenn es bibinfo in docinfo gibt -->
+            <tr tal:replace="structure python:formattedData" />
+          </tal:x>
+
+          <tal:x condition="not:formattedData">
+            <!-- kein template fuer die daten -->
+            <tal:x condition="exists:docinfo/bib">
+              <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
+                <td class="content" tal:content="bibinfo/bib" />
+              </tr>
+            </tal:x>
+
+            <tal:y condition="not:exists:docinfo/bib">
+              <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
+              <tr>
+                <td class="type">Author:</td>
+                <td class="content" tal:content="docinfo/creator" />
+              </tr>
+              <tr>
+                <td class="type">Title:</td>
+                <td class="content" tal:content="docinfo/title" />
+              </tr>
+              <tr>
+                <td class="type">Date:</td>
+                <td class="content" tal:content="docinfo/date" />
+              </tr>
+            </tal:y>
+          </tal:x>
+          <!-- ende kein template fuer die daten -->
+        </table>
+
+        <tal:block tal:define="dri docinfo/DRI | nothing" tal:condition="dri">
+          <h2>Permanent URL</h2>
+          <table>
+            <tr>
+              <td class="type">Document ID:</td>
+              <td class="content" tal:content="dri" />
+            </tr>
+            <tr>
+              <td class="type">Permanent URL:</td>
+              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
+                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
+            </tr>
+          </table>
+        </tal:block>
+
+        <tal:block tal:define="ctxs docinfo/presentationContext | nothing" tal:condition="ctxs">
+          <h2>Presentation context</h2>
+          <ul>
+            <li tal:repeat="ctx ctxs"><a tal:define="link ctx/link | nothing; name ctx/name | link;" tal:content="name"
+              tal:attributes="href link" target="_blank" tal:omit-tag="not:link" /></li>
+          </ul>
+        </tal:block>
+
+        <tal:block tal:define="attribution docinfo/attribution | nothing; copyright docinfo/copyright | nothing">
+          <h2>Copyright information</h2>
+          <table border="0" tal:condition="attribution | copyright">
+            <!-- attribution -->
+            <tr tal:condition="attribution"
+              tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=attribution)" />
+            <!-- copyright -->
+            <tr tal:condition="copyright"
+              tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=copyright)" />
+          </table>
+          <table border="0" tal:condition="not:attribution | copyright">
+            <tr>
+              <td class="type">Copyright:</td>
+              <td class="content"><a target="_blank" href="http://www.mpiwg-berlin.mpg.de">Max Planck Institute for the
+                  History of Science</a> (unless stated otherwise)</td>
+            </tr>
+            <tr tal:define="accType python:docinfo.get('accessType', None)">
+              <td class="type">License:</td>
+              <td tal:condition="python:accType == 'free'" class="content"><a target="_blank"
+                href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless stated otherwise)</td>
+              <td tal:condition="python:accType != 'free'" class="content">Internal use only<span tal:condition="accType"
+                tal:content="string: ($accType)" />, please contact <a href="mailto:library@mpiwg-berlin.mpg.de">library@mpiwg-berlin.mpg.de</a>
+                (unless stated otherwise)
+              </td>
+            </tr>
+          </table>
+        </tal:block>
+      </div>
+    </div>
+    <!-- /main content column -->
+
+    <div class="col buttons">
+      <!-- option block column -->
+      <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>
+        </ul>
+      </div>
+
+      <div class="options" tal:condition="docpath">
+        <h4>Download</h4>
+        Download full document
+        <ul class="list">
+          <li><a target="_blank" rel="nofollow" class="download"
+            tal:attributes="href python:here.getTextDownloadUrl(type='html',docinfo=docinfo)" target="_blank">as HTML</a></li>
+          <li><a target="_blank" rel="nofollow" class="download"
+            tal:attributes="href python:here.getTextDownloadUrl(type='xml',docinfo=docinfo)" target="_blank">as XML</a></li>
+        </ul>
+        (copyright and license see below)
+      </div>
+
+      <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'})"
+            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
+            tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a>
+          <ul>
+            <li><input type="radio" name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" />
+              Exact</li>
+            <li><input type="radio" name="queryType" value="fulltextMorph"
+              tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms</li>
+            <li><input type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" />
+              Fulltext index</li>
+            <li><input type="radio" name="queryType" value="ftIndexMorph"
+              tal:attributes="checked python:queryType=='ftIndexMorph'" /> Morphological index</li>
+          </ul>
+        </form>
+      </div>
+
+      <div class="options" tal:condition="availableLayers">
+        <h4>Metadata</h4>
+        <form tal:attributes="action viewerUrl" class="autosubmit">
+          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':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_index_${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>
+    <!-- /option block column -->
+  </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" />
+  </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" />
+  </tal:block>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_indexonly.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,132 @@
+<!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; viewerUrl docinfo/viewerUrl;
+                  docpath docinfo/textURLPath | nothing;
+                  query nothing;
+                  numPages docinfo/numPages | nothing;
+                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
+<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
+</head>
+<body tal:condition="numPages">
+  <!-- header -->
+  <div class="page-head">
+    <metal:block metal:use-macro="here/template/common_template/macros/head">
+      <div metal:fill-slot="view-switcher"></div>
+    </metal:block>
+  </div>
+
+  <!-- main -->
+  <div class="page-body">
+
+    <div class="col index-image">
+      <!-- image -->
+      <a tal:define="tp docinfo/titlePage | string:1"
+        tal:attributes="href python:context.getLink(params={'viewMode':'auto','pn':tp})"><img tal:condition="tp" border="0"
+        tal:attributes="src python:'%s&pn=%s&dw=300&dh=500'%(docinfo.get('imageURL',None),tp)" /><img
+        tal:condition="python:not docinfo.get('titlePage',None) and exists('here/template/book.png')" border="0"
+        src="template/book.png" /></a>
+    </div>
+
+    <div class="col main">
+      <!-- main content column -->
+      <div class="index-info">
+        <h2>Bibliographic information</h2>
+        <table border="0">
+          <tal:x condition="python:formattedData">
+            <!-- wenn es bibinfo in docinfo gibt -->
+            <tr tal:replace="structure python:formattedData" />
+          </tal:x>
+
+          <tal:x condition="not:formattedData">
+            <!-- kein template fuer die daten -->
+            <tal:x condition="exists:docinfo/bib">
+              <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
+                <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
+                <td class="content" tal:content="bibinfo/bib" />
+              </tr>
+            </tal:x>
+
+            <tal:y condition="not:exists:docinfo/bib">
+              <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
+              <tr>
+                <td class="type">Author:</td>
+                <td class="content" tal:content="docinfo/creator" />
+              </tr>
+              <tr>
+                <td class="type">Title:</td>
+                <td class="content" tal:content="docinfo/title" />
+              </tr>
+              <tr>
+                <td class="type">Date:</td>
+                <td class="content" tal:content="docinfo/date" />
+              </tr>
+            </tal:y>
+          </tal:x>
+          <!-- ende kein template fuer die daten -->
+        </table>
+
+        <tal:block tal:define="dri docinfo/DRI | nothing" tal:condition="dri">
+          <h2>Permanent URL</h2>
+          <table>
+            <tr>
+              <td class="type">Document ID:</td>
+              <td class="content" tal:content="dri" />
+            </tr>
+            <tr>
+              <td class="type">Permanent URL:</td>
+              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
+                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
+            </tr>
+          </table>
+        </tal:block>
+
+        <tal:block tal:define="ctxs docinfo/presentationContext | nothing" tal:condition="ctxs">
+          <h2>Presentation context</h2>
+          <ul>
+            <li tal:repeat="ctx ctxs"><a tal:define="link ctx/link | nothing; name ctx/name | link;" tal:content="name"
+              tal:attributes="href link" target="_blank" tal:omit-tag="not:link" /></li>
+          </ul>
+        </tal:block>
+
+        <tal:block tal:define="attribution docinfo/attribution | nothing; copyright docinfo/copyright | nothing">
+          <h2>Copyright information</h2>
+          <table border="0" tal:condition="attribution | copyright">
+            <!-- attribution -->
+            <tr tal:condition="attribution"
+              tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=attribution)" />
+            <!-- copyright -->
+            <tr tal:condition="copyright"
+              tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=copyright)" />
+          </table>
+          <table border="0" tal:condition="not:attribution | copyright">
+            <tr>
+              <td class="type">Copyright:</td>
+              <td class="content"><a target="_blank" href="http://www.mpiwg-berlin.mpg.de">Max Planck Institute for the
+                  History of Science</a> (unless stated otherwise)</td>
+            </tr>
+            <tr tal:define="accType python:docinfo.get('accessType', None)">
+              <td class="type">License:</td>
+              <td tal:condition="python:accType == 'free'" class="content"><a target="_blank"
+                href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless stated otherwise)</td>
+              <td tal:condition="python:accType != 'free'" class="content">Internal use only<span tal:condition="accType"
+                tal:content="string: ($accType)" />, please contact <a href="mailto:library@mpiwg-berlin.mpg.de">library@mpiwg-berlin.mpg.de</a>
+                (unless stated otherwise)
+              </td>
+            </tr>
+          </table>
+        </tal:block>
+      </div>
+    </div>
+    <!-- /main content column -->
+  </div>
+
+</body>
+<body tal:condition="not:numPages">
+  <div class="errortext">Sorry, document doesn't exist.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_text.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,158 @@
+<!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; viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
+              availableLayers python:here.getAvailableLayers().get('text', None);
+              viewerUrl docinfo/viewerUrl;
+              rootUrl here/getDocumentViewerURL;
+              numPages docinfo/numPages | nothing;">
+<head>
+<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" />
+<!--[if IE]><link rel="stylesheet" href="template/docuviewer_ie_css" type="text/css" /><![endif]-->
+<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
+<script type="text/javascript">
+// <!--
+	$(document).ready(function() {
+		// autosubmit forms
+		$('form.autosubmit').find('.autosubmit').change(function() {
+			this.form.submit();
+		});
+		$('form.autosubmit input[type="submit"]').hide();
+	});
+// -->
+</script>
+<!--  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 -->
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="docpath docinfo/textURLPath | nothing;
+                pn pageinfo/pn; 
+                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
+                textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo);">
+    <!-- header -->
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/common_template/macros/head" />
+    </div>
+
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!--table of contents-->
+      <div class="col toc">
+        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+      </div>
+
+      <!-- text page -->
+      <div class="col main">
+        <div class="ruler top">
+          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
+        </div>
+        <div class="content text">
+          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
+            tal:content="structure pageinfo/pageHeaderTitle" />
+          <tal:block tal:condition="textPage" tal:replace="structure textPage"/>
+          <div class="emptyPage" tal:condition="not:textPage">[Error: no text]</div>
+        </div>
+      </div>
+      <!-- end of col-main -->
+
+      <!--  layer columns (rendered always) -->
+      <tal:block tal:repeat="layer availableLayers">
+        <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/extra_column"
+          tal:condition="python:exists(mpath)">
+          <metal:block metal:use-macro="python:path(mpath)" />
+        </tal:block>
+      </tal:block>
+
+      <!-- right-side options -->
+      <div class="col buttons">
+        <!--BEGIN TEXT LAYERS -->
+        <div class="options" tal:condition="availableLayers">
+          <h4>Text layer</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit">
+            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':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>
+        <!--END TEXT LAYERS-->
+
+        <!--"BEGIN TEXT SIZE"-->
+        <!--  <div class="options">
+          <h4>Text size</h4>
+          <ul class="fsizer">
+            <li><a href="javascript:fontSize(12);" class="fs_sml">S</a></li>
+            <li><a href="javascript:fontSize(14);" class="fs_med">M</a></li>
+            <li><a href="javascript:fontSize(16);" class="fs_lrg">L</a></li>
+          </ul>
+        </div> -->
+        <!--"END TEXT SIZE"-->
+
+        <!--"BEGIN TEXT NORMALIZATION"-->
+        <div class="options">
+          <h4>Text normalization</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit"
+            tal:define="norm python:pageinfo.get('characterNormalization','regPlusNorm');">
+            <input type="hidden"
+              tal:define="params python:here.getParams(params={'characterNormalization':None, 'viewLayer':viewLayer})"
+              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+            <ul>
+              <li><input type="radio" class="autosubmit" name="characterNormalization" value="orig"
+                tal:attributes="checked python:norm=='orig'" /> Original</li>
+              <li><input type="radio" class="autosubmit" name="characterNormalization" value="reg"
+                tal:attributes="checked python:norm=='reg'" /> Regularized</li>
+              <li><input type="radio" class="autosubmit" name="characterNormalization" value="regPlusNorm"
+                tal:attributes="checked python:norm=='regPlusNorm'" /> Normalized</li>
+            </ul>
+            <input type="submit" value="Go!" />
+          </form>
+        </div>
+        <!--"END TEXT NORMALIZATION"-->
+
+        <!--  layer option boxes (rendered if active) -->
+        <tal:block tal:repeat="layer availableLayers">
+          <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/options_box"
+            tal:condition="python:exists(mpath)">
+            <metal:block metal:use-macro="python:path(mpath)" />
+          </tal:block>
+        </tal:block>
+      </div>
+      <!-- /col-right -->
+
+    </div>
+    <!-- /page-body -->
+
+    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
+      <div class="errortext">Sorry, access to this document is restricted.</div>
+    </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"/>
+    </tal:block>
+  </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"/>
+    </tal:block>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_thumbs.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,111 @@
+<!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;
+              viewerUrl docinfo/viewerUrl;
+              rootUrl here/getDocumentViewerURL;
+              numPages docinfo/numPages | nothing;">
+<head>
+<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" />
+<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
+<script type="text/javascript">
+	// <!--
+	$(document).ready(function() {
+		// autosubmit forms
+		$('form.autosubmit').find('.autosubmit').change(function() {
+			this.form.submit();
+		});
+		$('form.autosubmit input[type="submit"]').hide();
+	});
+// -->
+</script>
+</head>
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="pn pageinfo/pn;
+                start pageinfo/start;
+                thumbRows python:int(request.get('thumbRows', 10));
+                thumbCols python:int(request.get('thumbCols', 12));
+                thumbSize python:int(request.get('thumbSize', 100));
+                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
+                pageBatch python:here.getPageBatch(start=start, rows=thumbRows, cols=thumbCols, pageFlowLtr=flowLtr, maxIdx=numPages);
+                pageNumbers docinfo/pageNumbers | nothing;
+                left python:test(flowLtr,pageBatch['prevStart'],pageBatch['nextStart']);
+                right python:test(flowLtr,pageBatch['nextStart'],pageBatch['prevStart']);">
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/common_template/macros/head" />
+    </div>
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!-- col-main: text page -->
+      <div class="col main">
+        <div class="ruler">
+          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
+        </div>
+        <div class="content-thumbs">
+          <table class="thumbs">
+            <tr tal:repeat="row pageBatch/pages">
+              <td tal:repeat="thumb row" tal:attributes="class python:here.getStyle(thumb['idx'],pn,'thumb')"><a
+                tal:define="idx thumb/idx" tal:condition="idx"
+                tal:attributes="href python:here.getLink(params={'pn':idx, 'viewMode':'images'})"> <img
+                  tal:attributes="src python:test(docinfo['imageURL'],here.getScalerUrl(pn=idx,dw=thumbSize,dh=thumbSize,docinfo=docinfo),'images/pic');
+                                alt idx" /><br />
+                  <span title="Scan number" tal:content="idx" /> <span
+                  tal:condition="python:pageNumbers and pageNumbers.get(idx, False) and pageNumbers[idx]['no']"
+                  title="Original page number" tal:content="python:' (%s)'%(pageNumbers[idx]['no'])" />
+              </a></td>
+            </tr>
+          </table>
+        </div>
+        <div class="ruler bottom">
+          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
+        </div>
+      </div>
+      <!-- /col-main -->
+
+      <!-- right-side options -->
+      <div class="col buttons">
+        <!--"BEGIN TEXT DISPLAY"  -->
+        <div class="options">
+          <h4>Thumbnail display</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit">
+            <input type="hidden"
+              tal:define="params python:here.getParams(params={'thumbRows':None,'thumbCols':None,'thumbSize':None})"
+              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+            <ul>
+              <li>Rows <select class="autosubmit" name="thumbRows" tal:define="rows python:[2,3,5,10,12,15,20,50,100]">
+                  <option tal:repeat="row rows" tal:attributes="selected python:thumbRows==row; value row" tal:content="row" />
+              </select>
+              </li>
+              <li>Columns <select class="autosubmit" name="thumbCols" tal:define="cols python:[2,3,5,10,12,15,20,50,100]">
+                  <option tal:repeat="col cols" tal:attributes="selected python:thumbCols==col; value col" tal:content="col" />
+              </select>
+              </li>
+              <li>Thumbnail size <select class="autosubmit" name="thumbSize" tal:define="sizes python:[100,150,200,300,500]">
+                  <option tal:repeat="size sizes" tal:attributes="selected python:thumbSize==size; value size" tal:content="size" />
+              </select>
+              </li>
+            </ul>
+          </form>
+        </div>
+      </div>
+    </div>
+    <!-- page-body -->
+    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
+      <div class="errortext">Sorry, access to this document is restricted.</div>
+    </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"/>
+    </tal:block>
+  </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"/>
+  </tal:block>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/viewer/viewer_xml.zpt	Fri Nov 16 17:16:50 2012 +0100
@@ -0,0 +1,98 @@
+<!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; viewerUrl docinfo/viewerUrl;
+              rootUrl here/getDocumentViewerURL;
+              numPages docinfo/numPages | nothing;">
+<head>
+<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" />
+  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
+  <script type="text/javascript">
+            // <!--
+            $(document).ready(function() {
+                // autosubmit forms
+                $('form.autosubmit').find('.autosubmit').change(function() {
+                    this.form.submit();
+                });
+                $('form.autosubmit input[type="submit"]').hide();
+            });
+        // -->
+        </script>
+</head>
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="docpath docinfo/textURLPath;
+                               pn pageinfo/pn; 
+                               flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
+                               textPage python:here.getTextPage(mode='xml', pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
+    <!-- header -->
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/common_template/macros/head" />
+    </div>
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!--table of contents-->
+      <div class="col toc">
+        <metal:block
+          metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+      </div>
+
+      <!-- text page -->
+      <div class="col main">
+        <div class="ruler top">
+          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
+        </div>
+        <div class="content xml">
+          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
+            tal:content="structure pageinfo/pageHeaderTitle" />
+          <tal:block tal:replace="structure textPage" />
+        </div>
+      </div>
+      <!-- col-main -->
+
+      <!-- right-side options -->
+      <div class="col buttons">
+        <!--"BEGIN TEXT SIZE"-->
+        <!-- <div class="options">
+          <h4>Text size</h4>
+          <ul class="fsizer">
+            <li>
+              <a href="javascript:fontSize(12);" class="fs_sml">S</a>
+            </li>
+            <li>
+              <a href="javascript:fontSize(14);" class="fs_med">M</a>
+            </li>
+            <li>
+              <a href="javascript:fontSize(16);" class="fs_lrg">L</a>
+            </li>
+          </ul>
+        </div> -->
+        <!--"END TEXT SIZE"-->
+
+      </div>
+      <!-- /col-right -->
+
+    </div>
+    <!-- /page-body -->
+
+    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
+      <div class="errortext">Sorry, access to this document is restricted.</div>
+    </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"/>
+    </tal:block>
+  </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"/>
+  </tal:block>
+</body>
+</html>
--- a/zpt/viewer_image.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +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;
-              viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
-              availableLayers python:here.getAvailableLayers().get('image', None);
-              tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
-              numPages docinfo/numPages | nothing; dlBaseUrl docinfo/digilibBaseUrl | nothing;">
-<head>
-<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" />
-<script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.js"></script>
-<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.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"
-  tal:content="python:'''\n
-       var dlOpts = {\n
-            'interactionMode' : 'fullscreen',\n
-            'digilibBaseUrl' : '%s',\n
-            'fn' : '%s',\n
-            'pn' : '%s',\n
-            'suppressParamNames' : ['fn'],\n
-            'scalerInsets' : {'x':300, 'y':100}\n
-        };\n'''%(dlBaseUrl,docinfo.get('imagePath',''),pageinfo.get('pn','1'))"></script>
-
-<!--  layer headers (rendered always) -->
-<tal:block tal:repeat="layer availableLayers">
-  <tal:block tal:define="mpath string:here/template/layer_image_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
-    <metal:block metal:use-macro="python:path(mpath)" />
-  </tal:block>
-</tal:block>
-
-<script type="text/javascript">
-	// <!--
-	$(document).ready(function() {
-		// autosubmit forms
-		$('form.autosubmit').find('.autosubmit').change(function() {
-			this.form.submit();
-		});
-		$('form.autosubmit input[type="submit"]').hide();
-		// get digilib div
-		$digilib = $('div#scaler');
-		// configure digilib
-		$digilib.digilib(dlOpts);
-	});
-// -->
-</script>
-</head>
-<body tal:condition="numPages">
-  <tal:block
-    tal:define="docpath docinfo/textURLPath | nothing;
-              pn pageinfo/pn; 
-              flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';">
-    <div class="page-head">
-      <metal:block metal:use-macro="here/template/common_template/macros/head" />
-    </div>
-    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
-      <!-- table of contents -->
-      <div class="col toc">
-        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
-      </div>
-      <!-- col-main: document page -->
-      <div class="col main">
-        <div class="ruler top">
-          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
-        </div>
-        <div class="content image">
-          <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 buttons">
-        <!-- layer switcher -->
-        <div class="options" tal:condition="availableLayers">
-          <h4>Image layer</h4>
-          <form tal:attributes="action viewerUrl" class="autosubmit">
-            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
-              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
-            <ul>
-              <!-- layer select buttons (rendered always) -->
-              <tal:block tal:repeat="layer availableLayers">
-                <tal:block tal:define="mpath string:here/template/layer_image_${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>
-
-        <!-- digilib options -->
-        <div class="options digilib">
-          <ul>
-            <li><a href="javascript:$digilib.digilib('zoomBy', 1.4)"> <img tal:condition="exists:here/template/zoom-in.png"
-                tal:attributes="src here/template/zoom-in.png/absolute_url" /> zoom in
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('zoomBy', 0.7)"> <img
-                tal:condition="exists:here/template/zoom-out.png" tal:attributes="src here/template/zoom-out.png/absolute_url" />
-                zoom out
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('zoomArea')"> <img tal:condition="exists:here/template/zoom-area.png"
-                tal:attributes="src here/template/zoom-area.png/absolute_url" /> zoom area
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('zoomFull')"> <img tal:condition="exists:here/template/zoom-full.png"
-                tal:attributes="src here/template/zoom-full.png/absolute_url" /> full page
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('zoomFull', 'width')"> <img
-                tal:condition="exists:here/template/pagewidth.png" tal:attributes="src here/template/pagewidth.png/absolute_url" /> page
-                width
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('setMark')"> <img tal:condition="exists:here/template/mark.png"
-                tal:attributes="src here/template/mark.png/absolute_url" /> set mark
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('removeMark')"> <img tal:condition="exists:here/template/delmark.png"
-                tal:attributes="src here/template/delmark.png/absolute_url" /> remove mark
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('reference')"> <img tal:condition="exists:here/template/reference.png"
-                tal:attributes="src here/template/reference.png/absolute_url" /> get reference
-            </a></li>
-            <li><a href="javascript:$digilib.digilib('digilibUrl', 'open_new')"> <img
-                tal:condition="exists:here/template/digilib.png" tal:attributes="src here/template/digilib.png/absolute_url" />
-                digilib
-            </a></li>
-          </ul>
-        </div>
-
-        <!--  layer option boxes (rendered if active) -->
-        <tal:block tal:repeat="layer availableLayers">
-          <tal:block tal:define="mpath string:here/template/layer_image_${layer}/macros/options_box"
-            tal:condition="python:exists(mpath)">
-            <metal:block metal:use-macro="python:path(mpath)" />
-          </tal:block>
-        </tal:block>
-      </div>
-    </div><!-- /page-body -->
-    
-    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
-      <div class="errortext">Sorry, access to this document is restricted.</div>
-    </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"/>
-    </tal:block>
-    
-  </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"/>
-  </tal:block>
-</body>
-</html>
--- a/zpt/viewer_index.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +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; 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;
-                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
-<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
-<script type="text/javascript" tal:attributes="src string:$viewerUrl/template/jquery_js"></script>
-<script type="text/javascript">
-	$(document).ready(function() {
-		// autosubmit forms
-		$('form.autosubmit').find('.autosubmit').change(function() {
-			this.form.submit();
-		});
-		$('form.autosubmit input[type="submit"]').hide();
-	});
-// -->
-</script>
-<!--  layer headers (all available) -->
-<tal:block tal:repeat="layer availableLayers">
-  <tal:block tal:define="mpath string:here/template/layer_index_${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 -->
-  <div class="page-head">
-    <metal:block metal:use-macro="here/template/common_template/macros/head" />
-  </div>
-
-  <!-- main -->
-  <div class="page-body">
-
-    <div class="col index-image">
-      <!-- image -->
-      <a tal:define="tp docinfo/titlePage | string:1"
-        tal:attributes="href python:context.getLink(params={'viewMode':'auto','pn':tp})"><img tal:condition="tp" border="0"
-        tal:attributes="src python:'%s&pn=%s&dw=300&dh=500'%(docinfo.get('imageURL',None),tp)" /><img
-        tal:condition="python:not docinfo.get('titlePage',None) and exists('here/template/book.png')" border="0"
-        src="template/book.png" /></a>
-    </div>
-
-    <div class="col main">
-      <!-- main content column -->
-      <div class="index-info">
-        <h2>Bibliographic information</h2>
-        <table border="0">
-          <tal:x condition="python:formattedData">
-            <!-- wenn es bibinfo in docinfo gibt -->
-            <tr tal:replace="structure python:formattedData" />
-          </tal:x>
-
-          <tal:x condition="not:formattedData">
-            <!-- kein template fuer die daten -->
-            <tal:x condition="exists:docinfo/bib">
-              <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
-                <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
-                <td class="content" tal:content="bibinfo/bib" />
-              </tr>
-            </tal:x>
-
-            <tal:y condition="not:exists:docinfo/bib">
-              <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
-              <tr>
-                <td class="type">Author:</td>
-                <td class="content" tal:content="docinfo/creator" />
-              </tr>
-              <tr>
-                <td class="type">Title:</td>
-                <td class="content" tal:content="docinfo/title" />
-              </tr>
-              <tr>
-                <td class="type">Date:</td>
-                <td class="content" tal:content="docinfo/date" />
-              </tr>
-            </tal:y>
-          </tal:x>
-          <!-- ende kein template fuer die daten -->
-        </table>
-
-        <tal:block tal:define="dri docinfo/DRI | nothing" tal:condition="dri">
-          <h2>Permanent URL</h2>
-          <table>
-            <tr>
-              <td class="type">Document ID:</td>
-              <td class="content" tal:content="dri" />
-            </tr>
-            <tr>
-              <td class="type">Permanent URL:</td>
-              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
-                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
-            </tr>
-          </table>
-        </tal:block>
-
-        <tal:block tal:define="ctxs docinfo/presentationContext | nothing" tal:condition="ctxs">
-          <h2>Presentation context</h2>
-          <ul>
-            <li tal:repeat="ctx ctxs"><a tal:define="link ctx/link | nothing; name ctx/name | link;" tal:content="name"
-              tal:attributes="href link" target="_blank" tal:omit-tag="not:link" /></li>
-          </ul>
-        </tal:block>
-
-        <tal:block tal:define="attribution docinfo/attribution | nothing; copyright docinfo/copyright | nothing">
-          <h2>Copyright information</h2>
-          <table border="0" tal:condition="attribution | copyright">
-            <!-- attribution -->
-            <tr tal:condition="attribution"
-              tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=attribution)" />
-            <!-- copyright -->
-            <tr tal:condition="copyright"
-              tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=copyright)" />
-          </table>
-          <table border="0" tal:condition="not:attribution | copyright">
-            <tr>
-              <td class="type">Copyright:</td>
-              <td class="content"><a target="_blank" href="http://www.mpiwg-berlin.mpg.de">Max Planck Institute for the
-                  History of Science</a> (unless stated otherwise)</td>
-            </tr>
-            <tr tal:define="accType python:docinfo.get('accessType', None)">
-              <td class="type">License:</td>
-              <td tal:condition="python:accType == 'free'" class="content"><a target="_blank"
-                href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless stated otherwise)</td>
-              <td tal:condition="python:accType != 'free'" class="content">Internal use only<span tal:condition="accType"
-                tal:content="string: ($accType)" />, please contact <a href="mailto:library@mpiwg-berlin.mpg.de">library@mpiwg-berlin.mpg.de</a>
-                (unless stated otherwise)
-              </td>
-            </tr>
-          </table>
-        </tal:block>
-      </div>
-    </div>
-    <!-- /main content column -->
-
-    <div class="col buttons">
-      <!-- option block column -->
-      <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>
-        </ul>
-      </div>
-
-      <div class="options" tal:condition="docpath">
-        <h4>Download</h4>
-        Download full document
-        <ul class="list">
-          <li><a target="_blank" rel="nofollow" class="download"
-            tal:attributes="href python:here.getTextDownloadUrl(type='html',docinfo=docinfo)" target="_blank">as HTML</a></li>
-          <li><a target="_blank" rel="nofollow" class="download"
-            tal:attributes="href python:here.getTextDownloadUrl(type='xml',docinfo=docinfo)" target="_blank">as XML</a></li>
-        </ul>
-        (copyright and license see below)
-      </div>
-
-      <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'})"
-            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
-            tal:condition="query" tal:attributes="href python:here.getLink('query',None)">Clear</a>
-          <ul>
-            <li><input type="radio" name="queryType" value="fulltext" tal:attributes="checked python:queryType=='fulltext'" />
-              Exact</li>
-            <li><input type="radio" name="queryType" value="fulltextMorph"
-              tal:attributes="checked python:queryType=='fulltextMorph'" /> All forms</li>
-            <li><input type="radio" name="queryType" value="ftIndex" tal:attributes="checked python:queryType=='ftIndex'" />
-              Fulltext index</li>
-            <li><input type="radio" name="queryType" value="ftIndexMorph"
-              tal:attributes="checked python:queryType=='ftIndexMorph'" /> Morphological index</li>
-          </ul>
-        </form>
-      </div>
-
-      <div class="options" tal:condition="availableLayers">
-        <h4>Metadata</h4>
-        <form tal:attributes="action viewerUrl" class="autosubmit">
-          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':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_index_${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>
-    <!-- /option block column -->
-  </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" />
-  </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" />
-  </tal:block>
-</body>
-</html>
\ No newline at end of file
--- a/zpt/viewer_indexonly.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +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; viewerUrl docinfo/viewerUrl;
-                  docpath docinfo/textURLPath | nothing;
-                  query nothing;
-                  numPages docinfo/numPages | nothing;
-                  global formattedData python:here.metadata.getBibFormattedMetaData(bibdata=docinfo.get('bib', None));">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
-<link rel="stylesheet" tal:attributes="href string:$viewerUrl/template/docuviewer_css" type="text/css" />
-</head>
-<body tal:condition="numPages">
-  <!-- header -->
-  <div class="page-head">
-    <metal:block metal:use-macro="here/template/common_template/macros/head">
-      <div metal:fill-slot="view-switcher"></div>
-    </metal:block>
-  </div>
-
-  <!-- main -->
-  <div class="page-body">
-
-    <div class="col index-image">
-      <!-- image -->
-      <a tal:define="tp docinfo/titlePage | string:1"
-        tal:attributes="href python:context.getLink(params={'viewMode':'auto','pn':tp})"><img tal:condition="tp" border="0"
-        tal:attributes="src python:'%s&pn=%s&dw=300&dh=500'%(docinfo.get('imageURL',None),tp)" /><img
-        tal:condition="python:not docinfo.get('titlePage',None) and exists('here/template/book.png')" border="0"
-        src="template/book.png" /></a>
-    </div>
-
-    <div class="col main">
-      <!-- main content column -->
-      <div class="index-info">
-        <h2>Bibliographic information</h2>
-        <table border="0">
-          <tal:x condition="python:formattedData">
-            <!-- wenn es bibinfo in docinfo gibt -->
-            <tr tal:replace="structure python:formattedData" />
-          </tal:x>
-
-          <tal:x condition="not:formattedData">
-            <!-- kein template fuer die daten -->
-            <tal:x condition="exists:docinfo/bib">
-              <tr tal:define="bibinfo docinfo/bib" tal:repeat="bib bibinfo">
-                <td class="type" tal:content="python:bib.capitalize().replace('_',' ') + ':'" />
-                <td class="content" tal:content="bibinfo/bib" />
-              </tr>
-            </tal:x>
-
-            <tal:y condition="not:exists:docinfo/bib">
-              <!-- wenn es kein bibinfo gibt (archimedes-texte) -->
-              <tr>
-                <td class="type">Author:</td>
-                <td class="content" tal:content="docinfo/creator" />
-              </tr>
-              <tr>
-                <td class="type">Title:</td>
-                <td class="content" tal:content="docinfo/title" />
-              </tr>
-              <tr>
-                <td class="type">Date:</td>
-                <td class="content" tal:content="docinfo/date" />
-              </tr>
-            </tal:y>
-          </tal:x>
-          <!-- ende kein template fuer die daten -->
-        </table>
-
-        <tal:block tal:define="dri docinfo/DRI | nothing" tal:condition="dri">
-          <h2>Permanent URL</h2>
-          <table>
-            <tr>
-              <td class="type">Document ID:</td>
-              <td class="content" tal:content="dri" />
-            </tr>
-            <tr>
-              <td class="type">Permanent URL:</td>
-              <td class="content"><a target="_blank" tal:attributes="href string:http://echo.mpiwg-berlin.mpg.de/$dri"
-                tal:content="string:http://echo.mpiwg-berlin.mpg.de/$dri" /></td>
-            </tr>
-          </table>
-        </tal:block>
-
-        <tal:block tal:define="ctxs docinfo/presentationContext | nothing" tal:condition="ctxs">
-          <h2>Presentation context</h2>
-          <ul>
-            <li tal:repeat="ctx ctxs"><a tal:define="link ctx/link | nothing; name ctx/name | link;" tal:content="name"
-              tal:attributes="href link" target="_blank" tal:omit-tag="not:link" /></li>
-          </ul>
-        </tal:block>
-
-        <tal:block tal:define="attribution docinfo/attribution | nothing; copyright docinfo/copyright | nothing">
-          <h2>Copyright information</h2>
-          <table border="0" tal:condition="attribution | copyright">
-            <!-- attribution -->
-            <tr tal:condition="attribution"
-              tal:replace="structure python:here.metadataService.getAttributionFormatted('metadata_template', data=attribution)" />
-            <!-- copyright -->
-            <tr tal:condition="copyright"
-              tal:replace="structure python:here.metadataService.getCopyrightFormatted('metadata_template', data=copyright)" />
-          </table>
-          <table border="0" tal:condition="not:attribution | copyright">
-            <tr>
-              <td class="type">Copyright:</td>
-              <td class="content"><a target="_blank" href="http://www.mpiwg-berlin.mpg.de">Max Planck Institute for the
-                  History of Science</a> (unless stated otherwise)</td>
-            </tr>
-            <tr tal:define="accType python:docinfo.get('accessType', None)">
-              <td class="type">License:</td>
-              <td tal:condition="python:accType == 'free'" class="content"><a target="_blank"
-                href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless stated otherwise)</td>
-              <td tal:condition="python:accType != 'free'" class="content">Internal use only<span tal:condition="accType"
-                tal:content="string: ($accType)" />, please contact <a href="mailto:library@mpiwg-berlin.mpg.de">library@mpiwg-berlin.mpg.de</a>
-                (unless stated otherwise)
-              </td>
-            </tr>
-          </table>
-        </tal:block>
-      </div>
-    </div>
-    <!-- /main content column -->
-  </div>
-
-</body>
-<body tal:condition="not:numPages">
-  <div class="errortext">Sorry, document doesn't exist.</div>
-</body>
-</html>
\ No newline at end of file
--- a/zpt/viewer_text.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +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; viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
-              availableLayers python:here.getAvailableLayers().get('text', None);
-              viewerUrl docinfo/viewerUrl;
-              rootUrl here/getDocumentViewerURL;
-              numPages docinfo/numPages | nothing;">
-<head>
-<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" />
-<!--[if IE]><link rel="stylesheet" href="template/docuviewer_ie_css" type="text/css" /><![endif]-->
-<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
-<script type="text/javascript">
-// <!--
-	$(document).ready(function() {
-		// autosubmit forms
-		$('form.autosubmit').find('.autosubmit').change(function() {
-			this.form.submit();
-		});
-		$('form.autosubmit input[type="submit"]').hide();
-	});
-// -->
-</script>
-<!--  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 -->
-<body tal:condition="numPages">
-  <tal:block
-    tal:define="docpath docinfo/textURLPath | nothing;
-                pn pageinfo/pn; 
-                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
-                textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo);">
-    <!-- header -->
-    <div class="page-head">
-      <metal:block metal:use-macro="here/template/common_template/macros/head" />
-    </div>
-
-    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
-      <!--table of contents-->
-      <div class="col toc">
-        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
-      </div>
-
-      <!-- text page -->
-      <div class="col main">
-        <div class="ruler top">
-          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
-        </div>
-        <div class="content text">
-          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
-            tal:content="structure pageinfo/pageHeaderTitle" />
-          <tal:block tal:condition="textPage" tal:replace="structure textPage"/>
-          <div class="emptyPage" tal:condition="not:textPage">[Error: no text]</div>
-        </div>
-      </div>
-      <!-- end of col-main -->
-
-      <!--  layer columns (rendered always) -->
-      <tal:block tal:repeat="layer availableLayers">
-        <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/extra_column"
-          tal:condition="python:exists(mpath)">
-          <metal:block metal:use-macro="python:path(mpath)" />
-        </tal:block>
-      </tal:block>
-
-      <!-- right-side options -->
-      <div class="col buttons">
-        <!--BEGIN TEXT LAYERS -->
-        <div class="options" tal:condition="availableLayers">
-          <h4>Text layer</h4>
-          <form tal:attributes="action viewerUrl" class="autosubmit">
-            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':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>
-        <!--END TEXT LAYERS-->
-
-        <!--"BEGIN TEXT SIZE"-->
-        <!--  <div class="options">
-          <h4>Text size</h4>
-          <ul class="fsizer">
-            <li><a href="javascript:fontSize(12);" class="fs_sml">S</a></li>
-            <li><a href="javascript:fontSize(14);" class="fs_med">M</a></li>
-            <li><a href="javascript:fontSize(16);" class="fs_lrg">L</a></li>
-          </ul>
-        </div> -->
-        <!--"END TEXT SIZE"-->
-
-        <!--"BEGIN TEXT NORMALIZATION"-->
-        <div class="options">
-          <h4>Text normalization</h4>
-          <form tal:attributes="action viewerUrl" class="autosubmit"
-            tal:define="norm python:pageinfo.get('characterNormalization','regPlusNorm');">
-            <input type="hidden"
-              tal:define="params python:here.getParams(params={'characterNormalization':None, 'viewLayer':viewLayer})"
-              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
-            <ul>
-              <li><input type="radio" class="autosubmit" name="characterNormalization" value="orig"
-                tal:attributes="checked python:norm=='orig'" /> Original</li>
-              <li><input type="radio" class="autosubmit" name="characterNormalization" value="reg"
-                tal:attributes="checked python:norm=='reg'" /> Regularized</li>
-              <li><input type="radio" class="autosubmit" name="characterNormalization" value="regPlusNorm"
-                tal:attributes="checked python:norm=='regPlusNorm'" /> Normalized</li>
-            </ul>
-            <input type="submit" value="Go!" />
-          </form>
-        </div>
-        <!--"END TEXT NORMALIZATION"-->
-
-        <!--  layer option boxes (rendered if active) -->
-        <tal:block tal:repeat="layer availableLayers">
-          <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/options_box"
-            tal:condition="python:exists(mpath)">
-            <metal:block metal:use-macro="python:path(mpath)" />
-          </tal:block>
-        </tal:block>
-      </div>
-      <!-- /col-right -->
-
-    </div>
-    <!-- /page-body -->
-
-    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
-      <div class="errortext">Sorry, access to this document is restricted.</div>
-    </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"/>
-    </tal:block>
-  </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"/>
-    </tal:block>
-</body>
-</html>
--- a/zpt/viewer_thumbs.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +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;
-              viewerUrl docinfo/viewerUrl;
-              rootUrl here/getDocumentViewerURL;
-              numPages docinfo/numPages | nothing;">
-<head>
-<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" />
-<script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
-<script type="text/javascript">
-	// <!--
-	$(document).ready(function() {
-		// autosubmit forms
-		$('form.autosubmit').find('.autosubmit').change(function() {
-			this.form.submit();
-		});
-		$('form.autosubmit input[type="submit"]').hide();
-	});
-// -->
-</script>
-</head>
-<body tal:condition="numPages">
-  <tal:block
-    tal:define="pn pageinfo/pn;
-                start pageinfo/start;
-                thumbRows python:int(request.get('thumbRows', 10));
-                thumbCols python:int(request.get('thumbCols', 12));
-                thumbSize python:int(request.get('thumbSize', 100));
-                flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
-                pageBatch python:here.getPageBatch(start=start, rows=thumbRows, cols=thumbCols, pageFlowLtr=flowLtr, maxIdx=numPages);
-                pageNumbers docinfo/pageNumbers | nothing;
-                left python:test(flowLtr,pageBatch['prevStart'],pageBatch['nextStart']);
-                right python:test(flowLtr,pageBatch['nextStart'],pageBatch['prevStart']);">
-    <div class="page-head">
-      <metal:block metal:use-macro="here/template/common_template/macros/head" />
-    </div>
-    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
-      <!-- col-main: text page -->
-      <div class="col main">
-        <div class="ruler">
-          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
-        </div>
-        <div class="content-thumbs">
-          <table class="thumbs">
-            <tr tal:repeat="row pageBatch/pages">
-              <td tal:repeat="thumb row" tal:attributes="class python:here.getStyle(thumb['idx'],pn,'thumb')"><a
-                tal:define="idx thumb/idx" tal:condition="idx"
-                tal:attributes="href python:here.getLink(params={'pn':idx, 'viewMode':'images'})"> <img
-                  tal:attributes="src python:test(docinfo['imageURL'],here.getScalerUrl(pn=idx,dw=thumbSize,dh=thumbSize,docinfo=docinfo),'images/pic');
-                                alt idx" /><br />
-                  <span title="Scan number" tal:content="idx" /> <span
-                  tal:condition="python:pageNumbers and pageNumbers.get(idx, False) and pageNumbers[idx]['no']"
-                  title="Original page number" tal:content="python:' (%s)'%(pageNumbers[idx]['no'])" />
-              </a></td>
-            </tr>
-          </table>
-        </div>
-        <div class="ruler bottom">
-          <metal:block metal:use-macro="here/template/common_template/macros/toc_ruler_thumbs" />
-        </div>
-      </div>
-      <!-- /col-main -->
-
-      <!-- right-side options -->
-      <div class="col buttons">
-        <!--"BEGIN TEXT DISPLAY"  -->
-        <div class="options">
-          <h4>Thumbnail display</h4>
-          <form tal:attributes="action viewerUrl" class="autosubmit">
-            <input type="hidden"
-              tal:define="params python:here.getParams(params={'thumbRows':None,'thumbCols':None,'thumbSize':None})"
-              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
-            <ul>
-              <li>Rows <select class="autosubmit" name="thumbRows" tal:define="rows python:[2,3,5,10,12,15,20,50,100]">
-                  <option tal:repeat="row rows" tal:attributes="selected python:thumbRows==row; value row" tal:content="row" />
-              </select>
-              </li>
-              <li>Columns <select class="autosubmit" name="thumbCols" tal:define="cols python:[2,3,5,10,12,15,20,50,100]">
-                  <option tal:repeat="col cols" tal:attributes="selected python:thumbCols==col; value col" tal:content="col" />
-              </select>
-              </li>
-              <li>Thumbnail size <select class="autosubmit" name="thumbSize" tal:define="sizes python:[100,150,200,300,500]">
-                  <option tal:repeat="size sizes" tal:attributes="selected python:thumbSize==size; value size" tal:content="size" />
-              </select>
-              </li>
-            </ul>
-          </form>
-        </div>
-      </div>
-    </div>
-    <!-- page-body -->
-    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
-      <div class="errortext">Sorry, access to this document is restricted.</div>
-    </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"/>
-    </tal:block>
-  </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"/>
-  </tal:block>
-</body>
-</html>
\ No newline at end of file
--- a/zpt/viewer_xml.zpt	Fri Nov 16 16:40:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +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; viewerUrl docinfo/viewerUrl;
-              rootUrl here/getDocumentViewerURL;
-              numPages docinfo/numPages | nothing;">
-<head>
-<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" />
-  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
-  <script type="text/javascript">
-            // <!--
-            $(document).ready(function() {
-                // autosubmit forms
-                $('form.autosubmit').find('.autosubmit').change(function() {
-                    this.form.submit();
-                });
-                $('form.autosubmit input[type="submit"]').hide();
-            });
-        // -->
-        </script>
-</head>
-<body tal:condition="numPages">
-  <tal:block
-    tal:define="docpath docinfo/textURLPath;
-                               pn pageinfo/pn; 
-                               flowLtr python:docinfo.get('pageFlow','ltr')!='rtl';
-                               textPage python:here.getTextPage(mode='xml', pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
-    <!-- header -->
-    <div class="page-head">
-      <metal:block metal:use-macro="here/template/common_template/macros/head" />
-    </div>
-    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
-      <!--table of contents-->
-      <div class="col toc">
-        <metal:block
-          metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
-      </div>
-
-      <!-- text page -->
-      <div class="col main">
-        <div class="ruler top">
-          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
-        </div>
-        <div class="content xml">
-          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
-            tal:content="structure pageinfo/pageHeaderTitle" />
-          <tal:block tal:replace="structure textPage" />
-        </div>
-      </div>
-      <!-- col-main -->
-
-      <!-- right-side options -->
-      <div class="col buttons">
-        <!--"BEGIN TEXT SIZE"-->
-        <!-- <div class="options">
-          <h4>Text size</h4>
-          <ul class="fsizer">
-            <li>
-              <a href="javascript:fontSize(12);" class="fs_sml">S</a>
-            </li>
-            <li>
-              <a href="javascript:fontSize(14);" class="fs_med">M</a>
-            </li>
-            <li>
-              <a href="javascript:fontSize(16);" class="fs_lrg">L</a>
-            </li>
-          </ul>
-        </div> -->
-        <!--"END TEXT SIZE"-->
-
-      </div>
-      <!-- /col-right -->
-
-    </div>
-    <!-- /page-body -->
-
-    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
-      <div class="errortext">Sorry, access to this document is restricted.</div>
-    </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"/>
-    </tal:block>
-  </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"/>
-  </tal:block>
-</body>
-</html>