Index: zpt/addDocumentViewer.zpt
===================================================================
--- zpt/addDocumentViewer.zpt	(revision 87)
+++ zpt/addDocumentViewer.zpt	(revision 87)
@@ -0,0 +1,12 @@
+<h1 tal:replace="structure here/manage_page_header">Header</h1>
+	<h2>Add an Document Viewer</h2>
+		<form action="manage_AddDocumentViewer">
+		<p class="form-label">Id<input name="id"></p>
+		<p class="form-optional">Title<input size="80" name="title"></p>
+		<p class="form-label">Image scaler URL<input size="80" name="imageScalerUrl" value="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?"></p>
+		<p class="form-optional">Text server name<input size="80" name="textServerName" value="mpdl-proto.mpiwg-berlin.mpg.de"></p>
+		
+		<p><input type="submit" value="add"></p>
+		</form>
+			
+<h1 tal:replace="structure here/manage_page_footer">Footer</h1>
Index: zpt/addDocumentViewerTemplate.zpt
===================================================================
--- zpt/addDocumentViewerTemplate.zpt	(revision 23)
+++ zpt/addDocumentViewerTemplate.zpt	(revision 23)
@@ -0,0 +1,8 @@
+<h1 tal:replace="structure here/manage_page_header">Header</h1>
+	<h2>Document Viewer Template</h2>
+    <p>Add DocumentViewer template <code>viewer_main</code>.</p>
+    <form action="manage_addDocumentViewerTemplate">
+    <p><input type="submit" value="add"></p>
+    </form>
+    
+<h1 tal:replace="structure here/manage_page_footer">Footer</h1>
Index: zpt/changeDocumentViewer.zpt
===================================================================
--- zpt/changeDocumentViewer.zpt	(revision 477)
+++ zpt/changeDocumentViewer.zpt	(revision 477)
@@ -0,0 +1,27 @@
+<div tal:replace="structure here/manage_page_header">Header</div>
+<!-- ZOPE management tabs -->
+<h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
+    tal:replace="structure here/manage_tabs">Tabs</h2>
+<!-- end of ZOPE management tabs -->
+		<form action="changeDocumentViewer">
+		
+		<p class="form-optional">Title</p>
+        <p class="form-element"><input size="80" tal:attributes="value here/title" name="title"></p>
+        <p class="form-text">The image scaler URL and text server URL have to be configured in the <tt>zogilib</tt> and <tt>fulltextclient</tt>
+        objects in the <tt>template</tt> folder.</p>
+        <p class="form-optional">Thumbnail rows</p>
+        <p class="form-element"><input size="3" tal:attributes="value here/thumbrows | default" name="thumbrows"></p>
+        <p class="form-optional">Thumbnail columns</p>
+        <p class="form-element"><input size="3" tal:attributes="value here/thumbcols | default" name="thumbcols"></p>
+        <p class="form-optional">Authorized groups</p>
+        <p class="form-element"><input size="80" tal:attributes="value python:','.join(getattr(here,'authgroups', []))" name="authgroups"></p>
+        <p class="form-text">Access groups (separated by ',') that are considered local, i.e. when a ressource restricts access
+        to one of these groups, local access to the ressource is granted.</p>
+        <p class="form-optional">Digilib base URL</p>
+        <p class="form-element"><input size="80" tal:attributes="value here/digilibBaseUrl | nothing" name="digilibBaseUrl"></p>
+        <p class="form-text">Leave empty for autoconfiguration.</p>
+		
+		<p><input type="submit" value="change"></p>
+		</form>
+			
+<div tal:replace="structure here/manage_page_footer">Footer</div>
Index: zpt/head_main.zpt
===================================================================
--- zpt/head_main.zpt	(revision 489)
+++ zpt/head_main.zpt	(revision 489)
@@ -0,0 +1,20 @@
+<!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="main"
+    tal:define="docpath docinfo/textURLPath | nothing;
+               query here/REQUEST/query | nothing;
+               queryType here/REQUEST/queryType | nothing;
+               bib docinfo/bib | nothing; bibType docinfo/bibType | nothing;
+               formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);">
+    <div tal:condition="not:formattedLabel"
+      tal:content="string:(no bibliographical information for ${bibType})" />
+    <div tal:condition="formattedLabel" tal:content="structure formattedLabel" />
+  </metal:block>
+</body>
+</html>
Index: zpt/info_xml.zpt
===================================================================
--- zpt/info_xml.zpt	(revision 58)
+++ zpt/info_xml.zpt	(revision 58)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<document-parameters xmlns:tal="http://xml.zope.org/namespaces/tal" tal:define="docinfo options/docinfo">
+  <parameter tal:repeat="info docinfo" tal:attributes="name info; value python:docinfo[info]"/>
+</document-parameters>
Index: zpt/page_main_pureXml.zpt
===================================================================
--- zpt/page_main_pureXml.zpt	(revision 495)
+++ 	(revision )
@@ -1,4 +1,0 @@
-
-<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None)   ">
-  <div tal:content="structure python:here.getTextPage(mode='pureXml',pn=pageinfo['current'],docinfo=docinfo,   pageinfo=pageinfo)"></div>
-</tal:block>
Index: zpt/page_main_text.zpt
===================================================================
--- zpt/page_main_text.zpt	(revision 495)
+++ 	(revision )
@@ -1,16 +1,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">
-  <!--  block used for definitions and scripts in head -->
-  <metal:block metal:define-macro="head">
-  </metal:block>
-</head>
-<body>
-  <!-- block used for main content area -->
-  <metal:block metal:define-macro="main" tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn','')">
-    <div tal:content="structure python:here.getTextPage(mode='text',pn=pageinfo['current'],docinfo=docinfo, highlightQuery=highlightQuery, sn=sn, pageinfo=pageinfo)"></div>
-  </metal:block>
-</body>
-</html>
Index: zpt/page_main_text_dict.zpt
===================================================================
--- zpt/page_main_text_dict.zpt	(revision 495)
+++ 	(revision )
@@ -1,16 +1,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">
-  <!--  block used for definitions and scripts in head -->
-  <metal:block metal:define-macro="head">
-  </metal:block>
-</head>
-<body>
-  <!-- block used for main content area -->
-  <metal:block metal:define-macro="main" tal:define="pageinfo options/pageinfo; docinfo options/docinfo; highlightQuery pageinfo/highlightQuery|nothing; sn pageinfo/sn|nothing">
-    <div tal:content="structure python:here.getTextPage(mode='text_dict',pn=pageinfo['current'],docinfo=docinfo,highlightQuery=highlightQuery,sn=sn,pageinfo=pageinfo)"/>
-  </metal:block>
-</body>
-</html>
Index: zpt/thumbs_main_rss.zpt
===================================================================
--- zpt/thumbs_main_rss.zpt	(revision 72)
+++ zpt/thumbs_main_rss.zpt	(revision 72)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" 
+     xmlns:media="http://search.yahoo.com/mrss"
+     xmlns:tal="http://xml.zope.org/namespaces/tal">
+
+<channel tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode options/viewMode; start pageinfo/start; end pageinfo/end; rows pageinfo/rows; cols pageinfo/cols;  current pageinfo/current; grpsize pageinfo/groupsize; pages docinfo/numPages">
+ 
+    <item tal:repeat="idx python:range(1,pages)">
+      <title tal:content="string:$idx">title</title>
+      <link tal:content="structure python:here.getLinkAmp(param='pn',val=idx)">link</link>
+    
+      <media:thumbnail tal:attributes="url string:${docinfo/imageURL}&amp;pn=$idx&amp;dw=100&amp;dh=100"/>
+      <media:content tal:attributes="url string:${docinfo/imageURL}&amp;pn=$idx&amp;dw=800&amp;dh=800"/>
+
+  </item>
+
+</channel>
+</rss>
Index: zpt/toc_figures.zpt
===================================================================
--- zpt/toc_figures.zpt	(revision 489)
+++ zpt/toc_figures.zpt	(revision 489)
@@ -0,0 +1,54 @@
+<!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-figures" metal:define-macro="main"
+    tal:define="start pageinfo/start; tocsize docinfo/tocSize_figures; grpsize pageinfo/tocPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
+    <ul class="switcher">
+      <li><a
+        tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a>
+      </li>
+      <li
+        tal:condition="python:docpath and docinfo.get('numTocEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','text')">Content</a>
+      </li>
+      <li class="sel"
+        tal:condition="python:docpath and docinfo.get('numFigureEntries', None)">
+        <a
+        tal:attributes="href python:here.getLink('tocMode','figures')">Figures</a>
+      </li>
+      <li><a
+        tal:attributes="href python:here.getLink('tocMode','none')">None</a>
+      </li>
+    </ul>
+    <div class="ruler">
+      <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]" /> 
+        <a tal:condition="batch/prevStart"
+          tal:attributes="href python:here.getLink('start',batch['prevStart'])">&lt;</a>
+        <span tal:condition="not:batch/prevStart">&lt;</span> 
+        <select class="autosubmit" name="start">
+          <option tal:repeat="grp batch/batches"
+            tal:attributes="selected python:(start==grp['start']); value grp/start"
+            tal:content="string:${grp/start} - ${grp/end}" />
+        </select> 
+        <input type="submit" value="Go" /> 
+        <a tal:condition="batch/nextStart"
+          tal:attributes="href python:here.getLink('start',batch['nextStart'])">&gt;</a>
+        <span tal:condition="not:batch/nextStart">&gt;</span> 
+      </form>
+    </div>
+    <div class="content"
+      tal:content="structure python:here.getTocPage(mode='figures',start=start,pageinfo=pageinfo,docinfo=docinfo)" />
+  </div>
+  <!-- toc -->
+</body>
+</html>
Index: zpt/toc_none.zpt
===================================================================
--- zpt/toc_none.zpt	(revision 491)
+++ zpt/toc_none.zpt	(revision 491)
@@ -0,0 +1,28 @@
+<!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">
+    <ul class="switcher">
+      <li>
+        <a tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a>
+      </li>
+      <li tal:condition="python:docpath and docinfo.get('numTocEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','text')">Content</a>
+      </li>
+      <li tal:condition="python:docpath and docinfo.get('numFigureEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','figures')">Figures</a>
+      </li>
+      <li class="sel">
+        <a tal:attributes="href python:here.getLink('tocMode','none')">None</a>
+      </li>
+    </ul>
+    <div class="content"></div>
+  </div>
+  <!-- toc -->
+</body>
+</html>
Index: zpt/toc_text.zpt
===================================================================
--- zpt/toc_text.zpt	(revision 489)
+++ zpt/toc_text.zpt	(revision 489)
@@ -0,0 +1,54 @@
+<!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-text" metal:define-macro="main"
+    tal:define="start pageinfo/start; tocsize docinfo/tocSize_text; grpsize pageinfo/tocPageSize;
+                batch python:here.getBatch(start=start,size=grpsize,end=tocsize);">
+    <ul class="switcher">
+      <li><a
+        tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a>
+      </li>
+      <li class="sel"
+        tal:condition="python:docpath and docinfo.get('numTocEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','text')">Content</a>
+      </li>
+      <li
+        tal:condition="python:docpath and docinfo.get('numFigureEntries', None)">
+        <a
+        tal:attributes="href python:here.getLink('tocMode','figures')">Figures</a>
+      </li>
+      <li><a
+        tal:attributes="href python:here.getLink('tocMode','none')">None</a>
+      </li>
+    </ul>
+    <div class="ruler">
+      <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]" /> 
+        <a tal:condition="batch/prevStart"
+          tal:attributes="href python:here.getLink('start',batch['prevStart'])">&lt;</a>
+        <span tal:condition="not:batch/prevStart">&lt;</span> 
+        <select class="autosubmit" name="start">
+          <option tal:repeat="grp batch/batches"
+            tal:attributes="selected python:(start==grp['start']); value grp/start"
+            tal:content="string:${grp/start} - ${grp/end}" />
+        </select> 
+        <input type="submit" value="Go" /> 
+        <a tal:condition="batch/nextStart"
+          tal:attributes="href python:here.getLink('start',batch['nextStart'])">&gt;</a>
+        <span tal:condition="not:batch/nextStart">&gt;</span> 
+      </form>
+    </div>
+    <div class="content"
+      tal:content="structure python:here.getTocPage(mode='text',start=start,pageinfo=pageinfo,docinfo=docinfo)" />
+  </div>
+  <!-- toc -->
+</body>
+</html>
Index: zpt/toc_thumbs.zpt
===================================================================
--- zpt/toc_thumbs.zpt	(revision 489)
+++ zpt/toc_thumbs.zpt	(revision 489)
@@ -0,0 +1,70 @@
+<!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-thumbs" metal:define-macro="main"
+    tal:define="start pageinfo/start;
+                grpsize pageinfo/groupsize;
+                numgroups pageinfo/numgroups;
+                pageBatch pageinfo/pageBatch; pageZero pageinfo/pageZero;
+                left python:test(flowLtr,pageBatch['prevStart'],pageBatch['nextStart']);
+                right python:test(flowLtr,pageBatch['nextStart'],pageBatch['prevStart']);">
+    <ul class="toctype">
+      <li class="sel">
+        <a tal:attributes="href python:here.getLink('tocMode','thumbs')">Thumbnails</a>
+      </li>
+      <li tal:condition="python:docinfo.get('numTocEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','text')">Content</a>
+      </li>
+      <li tal:condition="python:docinfo.get('numFigureEntries', None)">
+        <a tal:attributes="href python:here.getLink('tocMode','figures')">Figures</a>
+      </li>
+      <li>
+        <a tal:attributes="href python:here.getLink('tocMode','none')">None</a>
+      </li>
+    </ul>
+
+    <div class="content">
+      <div class="ruler">
+        <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]" /> 
+          <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']; value grp/start;"
+                tal:content="string:${grp/start} - ${grp/end}" />
+            </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>
+        </form>
+      </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['imageURL'],here.getScalerUrl(pn=idx,dw=100,dh=100,docinfo=docinfo),'images/pic');
+                                alt idx" /><br/>
+              <span tal:content="idx" />
+            </a>
+          </td>
+        </tr>
+      </table>
+    </div> <!-- content -->
+  </div> <!-- toc -->
+</body>
+</html>
Index: zpt/viewer_images.zpt
===================================================================
--- zpt/viewer_images.zpt	(revision 498)
+++ zpt/viewer_images.zpt	(revision 498)
@@ -0,0 +1,116 @@
+<!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; viewType pageinfo/viewType; 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="string:
+       var dlOpts = {
+            'interactionMode' : 'fullscreen',
+            'digilibBaseUrl' : '$dlBaseUrl',
+            'fn' : '${docinfo/imagePath}',
+            'pn' : '${pageinfo/pn}',
+            'suppressParamNames' : ['fn'],
+            'scalerInsets' : {'x' : 140, 'y' : 100}
+        };"></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();
+        // 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:pageinfo.get('pageFlow','ltr')!='rtl';
+              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);">
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/head_main/macros/main" />
+    </div>
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!--table of contents-->
+      <div class="col-left">
+        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+      </div>
+      <!-- col-main: text page -->
+      <div class="col-main">
+        <div class="ruler">
+          <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]" /> 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" />
+            <tal:block 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>)      
+            </tal:block>
+            <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>
+          </form>
+        </div><!-- ruler -->
+        <ul class="switcher">
+          <li class="sel">Image</li>
+          <li><a tal:condition="docpath" tal:attributes="href python:here.getLink('viewMode','text')">Text</a></li>
+        </ul>
+        <div class="content">
+          <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-right">
+          <div class="digilib-buttons">
+            <div><a href="javascript:$digilib.digilib('zoomBy', 1.4)">zoom in</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomBy', 0.7)">zoom out</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomArea')">zoom area</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomFull')">full page</a></div>
+            <div><a href="javascript:$digilib.digilib('zoomFull', 'width')">page width</a></div>
+            <div><a href="javascript:$digilib.digilib('setMark')">set mark</a></div>
+            <div><a href="javascript:$digilib.digilib('removeMark')">remove mark</a></div>
+            <div><a href="javascript:$digilib.digilib('reference')">get reference</a></div>
+            <div><a tal:attributes="href string:$dlBaseUrl/jquery/digilib.html?fn=${docinfo/imagePath}&pn=${pageinfo/pn}" target="_blank">digilib</a></div>
+          </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>
+</body>
+<body tal:condition="not:numPages">
+  <div class="errortext">Sorry, document doesn't exist.</div>
+</body>
+</html>
Index: zpt/viewer_main.zpt
===================================================================
--- zpt/viewer_main.zpt	(revision 495)
+++ 	(revision )
@@ -1,32 +1,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; global viewMode pageinfo/viewMode; tocMode pageinfo/tocMode;
- body_onload nothing">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" href="template/docuviewer_css" type="text/css">
-  <metal:block metal:use-macro="python:path('here/template/page_main_%s/macros/head'%viewMode)"/>
-</head>
-<body tal:condition="docinfo/numPages" tal:attributes="onload body_onload">
-  <metal:block metal:use-macro="here/template/head_main/macros/main"/>
-  <tal:block tal:condition="python:here.isAccessible(docinfo)">
-  <table border="0" width="100%" height="100%">
-    <tr>
-      <td width="300px" valign="top">
-        <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)"/> 
-      </td>
-      <td width="100%" valign="top">
-        <metal:block metal:use-macro="python:path('here/template/page_main_%s/macros/main'%viewMode)"/>
-      </td>
-    </tr>
-  </table>
-  </tal:block>
-  <tal:block tal:condition="not:python:here.isAccessible(docinfo)">
-    <div class="errortext">Sorry, access to this document is restricted.</div>
-  </tal:block>
-</body>
-<body tal:condition="not:docinfo/numPages">
-<div class="errortext">Sorry, document doesn't exist.</div>
-</body>
-</html>
Index: zpt/viewer_text.zpt
===================================================================
--- zpt/viewer_text.zpt	(revision 490)
+++ zpt/viewer_text.zpt	(revision 490)
@@ -0,0 +1,153 @@
+<!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; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
+                  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">
+      </head>
+      <body tal:condition="numPages">
+        <tal:block tal:define="docpath docinfo/textURLPath;
+                               pn pageinfo/pn; 
+                               flowLtr python:pageinfo.get('pageFlow','ltr')!='rtl';
+                               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);
+                               textPage python:here.getTextPage(mode=viewType, pn=pn, docinfo=docinfo, pageinfo=pageinfo);">
+          <div class="page-head">
+            <metal:block metal:use-macro="here/template/head_main/macros/main" />
+          </div>
+          <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+            <!--table of contents-->
+            <div class="col-left">
+              <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+            </div>
+
+            <!-- text page -->
+            <div class="col-main">
+              <div class="ruler">
+                <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]" />
+                  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" /> 
+                  <tal:block 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>)      
+                  </tal:block>
+                  <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>
+                </form>
+              </div> <!-- ruler -->
+              <ul class="switcher">
+                <li>
+                  <a tal:attributes="href python:here.getLink('viewMode','images')">Image</a>
+                </li>
+                <li class="sel">Text</li>
+              </ul>
+              <div class="content">
+                <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-right">
+              <!--"BEGIN TEXT DISPLAY"  -->
+              <div class="options">
+                <h4>Text display</h4>
+                <form tal:attributes="action viewerUrl" class="autosubmit">
+                  <input type="hidden" tal:define="params python:here.getParams(params={'viewType':None})" tal:repeat="param params" tal:attributes="name param; value python:params[param]"/>
+                  <input class="autosubmit" type="radio" name="viewType" value="" tal:attributes="checked python:viewType!='xml'"/> Text<br/>
+                  <span class="optionsText" tal:condition="python:viewType!='xml'">
+                    &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType" value="dict" tal:attributes="checked python:viewType=='dict'"/> Dictionary<br/>
+                  </span>
+                  <span class="optionsText" tal:condition="python:viewType!='xml' and docinfo.get('numPlaces',0)">
+                    &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType" value="gis" tal:attributes="checked python:viewType=='gis'"/> Places<br/>
+                  </span> <input type="radio" class="autosubmit" name="viewType" tal:attributes="value string:xml; checked python:viewType=='xml'"/> XML<br/>
+                  <input type="submit" value="Go!"/>
+                </form>
+              </div>
+              <!--"END TEXT DISPLAY"-->
+              
+              <!--"BEGIN TEXT SIZE"-->
+              <div class="options">
+                <h4>Text size</h4>
+                <div class="fsizer">
+                  &nbsp;
+                  <a href="javascript:fontSize(12);" class="fs_sml">S</a>
+                  <a href="javascript:fontSize(14);" class="fs_med">M</a>
+                  <a href="javascript:fontSize(16);" class="fs_lrg">L</a>
+                </div>
+              </div>
+              <!--"END TEXT SIZE"-->    
+              
+              <!--"BEGIN DICTIONARY OVERVIEW"-->
+              <div class="options" tal:condition="python:viewType=='dict'">
+                <h4>Dictionary view</h4>
+                <form name="f3" action="">
+                  <input type="radio" name="r3"/>Tab<br/>
+                  <input type="radio" name="r3"/>Window<br/>
+                </form>
+              </div>
+              <!--"END DICTIONARY OVERVIEW"-->
+              
+              <!--"BEGIN TEXT NORMALIZATION"-->
+              <div class="options" tal:condition="python:viewType!='xml'">
+                <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('characterNormalization',None)" tal:repeat="param params" tal:attributes="name param; value python:params[param]"/>
+                  <input type="radio" class="autosubmit" name="characterNormalization" value="orig" tal:attributes="checked python:norm=='orig'"/> Original<br/>
+                  <input type="radio" class="autosubmit" name="characterNormalization" value="reg" tal:attributes="checked python:norm=='reg'"/> Regularized<br/>
+                  <input type="radio" class="autosubmit" name="characterNormalization" value="regPlusNorm" tal:attributes="checked python:norm=='regPlusNorm'"/> Normalized<br/>
+                  <input type="submit" value="Go!"/>
+                </form>
+              </div>
+              <!--"END TEXT NORMALIZATION"-->
+              
+              <!--"BEGIN PLACES"-->
+              <div class="options" tal:condition="python:viewType=='gis'">  
+                <tal:block tal:define="gisPlaces python:here.getGisPlaces(docinfo=docinfo, pageinfo=pageinfo); gisAllPlaces python:here.getAllGisPlaces(docinfo=docinfo, pageinfo=pageinfo);">
+                  <span><b>Places</b></span><br/>(Link to extern:)<br/>
+                  <span>Page</span>
+                  <span style="float:right">
+                    <a tal:attributes="href python:'http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/db/mpdl/%s?id=%s&format=%s'%(name,gisPlaces,'gis')" target="_blank">
+                      <img src="images/arrow.png" alt=""/>
+                    </a>
+                  </span><br/>
+                  <span>Book</span>
+                  <span style="float:right">
+                    <a tal:attributes="href python:'http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/db/mpdl/%s?format=%s'%(name,'gis')" target="_blank">
+                      <img src="images/arrow.png" alt=""/>
+                    </a>
+                  </span><br/>
+                </tal:block>
+              </div>
+              <!--"END PLACES"-->   
+            </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>
+      </body>
+      <body tal:condition="not:numPages">
+        <div class="errortext">Sorry, document doesn't exist.</div>
+      </body>
+    </html>
