Index: MpiwgXmlTextServer.py
===================================================================
--- MpiwgXmlTextServer.py	(revision 583)
+++ MpiwgXmlTextServer.py	(revision 587)
@@ -198,8 +198,4 @@
             return None
         
-        # just checking
-        if pageinfo['current'] != pn:
-            logging.warning("getTextPage: current!=pn!")
-            
         # stuff for constructing full urls
         selfurl = docinfo['viewerUrl']
Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 585)
+++ documentViewer.py	(revision 587)
@@ -47,4 +47,20 @@
     # split by /, shorten, and reassemble
     return '/'.join(path.split('/')[0:-cnt])
+
+def getPnForPf(docinfo, pf):
+    """returns image number for image file name or 0"""
+    if 'imgFileNames' in docinfo:
+        pn = docinfo['imgFileNames'].get(pf, None)
+        if pn is None:
+            # try to cut extension
+            xi = pf.rfind('.')
+            if xi > 0:
+                pf = pf[:xi]
+                # try again, else return 0
+                pn = docinfo['imgFileNames'].get(pf, 0)
+                
+        return pn
+    
+    return 0
 
 
@@ -205,5 +221,5 @@
         docinfo = self.getDocinfo(mode=mode,url=url)
         #pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo)
-        pageinfo = self.getPageinfo(start=start,current=pn, docinfo=docinfo)
+        pageinfo = self.getPageinfo(start=start,pn=pn, docinfo=docinfo)
         ''' ZDES '''
         pt = getattr(self.template, 'thumbs_main_rss')
@@ -219,5 +235,5 @@
   
     security.declareProtected('View','index_html')
-    def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode=None,start=1,pn=1):
+    def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode=None,start=None,pn=None,pf=None):
         """
         show page
@@ -229,5 +245,5 @@
         """
         
-        logging.debug("documentViewer(index_html) mode=%s url=%s viewMode=%s viewLayer=%s start=%s pn=%s"%(mode,url,viewMode,viewLayer,start,pn))
+        logging.debug("documentViewer(index_html) mode=%s url=%s viewMode=%s viewLayer=%s start=%s pn=%s pf=%s"%(mode,url,viewMode,viewLayer,start,pn,pf))
         
         if not hasattr(self, 'template'):
@@ -272,5 +288,5 @@
                 
         # pageinfo: information about page (not cached)
-        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, userinfo=userinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
+        pageinfo = self.getPageinfo(start=start, pn=pn, pf=pf, docinfo=docinfo, userinfo=userinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
                     
         # get template /template/viewer_$viewMode
@@ -452,5 +468,4 @@
         return False
 
-
     def getUserinfo(self):
         """returns userinfo object"""
@@ -734,5 +749,5 @@
 
     def getDocinfoFromDigilib(self, docinfo, path):
-        infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
+        infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?fn="+path
         # fetch data
         txt = getHttpData(infoUrl)
@@ -742,5 +757,7 @@
 
         dom = ET.fromstring(txt)
-        size = getText(dom.find("size"))
+        dir = dom
+        # save size
+        size = dir.findtext('size')
         logging.debug("getDocinfoFromDigilib: size=%s"%size)
         if size:
@@ -748,6 +765,14 @@
         else:
             docinfo['numPages'] = 0
-            
-        # TODO: produce and keep list of image names and numbers
+            return docinfo
+            
+        # save list of image names and numbers
+        imgNames = {}
+        for f in dir:
+            fn = f.findtext('name')
+            pn = f.findtext('index')
+            imgNames[fn] = getInt(pn)
+            
+        docinfo['imgFileNames'] = imgNames
         return docinfo
             
@@ -767,5 +792,4 @@
         else:
             # online path
-            
             server=self.digilibBaseUrl+"/servlet/Texter?fn="
             metaUrl=server+url
@@ -783,7 +807,7 @@
     
 
-    def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, userinfo=None, viewMode=None, viewLayer=None, tocMode=None):
+    def getPageinfo(self, pn=None, pf=None, start=None, rows=None, cols=None, docinfo=None, userinfo=None, viewMode=None, viewLayer=None, tocMode=None):
         """returns pageinfo with the given parameters"""
-        logging.debug("getPageInfo(current=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewLayer=%s, tocMode=%s)"%(current,start,rows,cols,viewMode,viewLayer,tocMode))
+        logging.debug("getPageInfo(pn=%s, pf=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewLayer=%s, tocMode=%s)"%(pn,pf,start,rows,cols,viewMode,viewLayer,tocMode))
         pageinfo = {}
         pageinfo['viewMode'] = viewMode
@@ -808,7 +832,13 @@
 
         # TODO: unify current and pn!
-        current = getInt(current)
-        pageinfo['current'] = current
-        pageinfo['pn'] = current
+        #pageinfo['current'] = current
+        # pf takes precedence over pn
+        if pf:
+            pageinfo['pf'] = pf
+            pn = getPnForPf(docinfo, pf)
+        else:
+            pn = getInt(pn, 1)
+            
+        pageinfo['pn'] = pn
         rows = int(rows or self.thumbrows)
         pageinfo['rows'] = rows
@@ -817,6 +847,6 @@
         grpsize = cols * rows
         pageinfo['groupsize'] = grpsize
-        # is start is empty use one around current
-        start = getInt(start, default=(math.ceil(float(current)/float(grpsize))*grpsize-(grpsize-1)))
+        # is start is empty use one around pn
+        start = getInt(start, default=(math.ceil(float(pn)/float(grpsize))*grpsize-(grpsize-1)))
         # int(current / grpsize) * grpsize +1))
         pageinfo['start'] = start
@@ -845,5 +875,5 @@
         if docinfo.get('pageNumbers'):
             # get original page numbers
-            pageNumber = docinfo['pageNumbers'].get(current, None)
+            pageNumber = docinfo['pageNumbers'].get(pn, None)
             if pageNumber is not None:
                 pageinfo['pageNumberOrig'] = pageNumber['no']
Index: version.txt
===================================================================
--- version.txt	(revision 580)
+++ version.txt	(revision 587)
@@ -1,1 +1,1 @@
-DocumentViewer 2.2.7
+DocumentViewer 2.2.8
Index: zpt/layer_images_annotator.zpt
===================================================================
--- zpt/layer_images_annotator.zpt	(revision 586)
+++ zpt/layer_images_annotator.zpt	(revision 587)
@@ -73,5 +73,5 @@
       </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>
+        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
       </p>
     </div>
Index: zpt/layer_text_annotator.zpt
===================================================================
--- zpt/layer_text_annotator.zpt	(revision 557)
+++ zpt/layer_text_annotator.zpt	(revision 587)
@@ -126,6 +126,5 @@
       </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>
-        <!--  <a class="button" tal:attributes="href python:'%s/login/logout?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">log out</a> -->
+        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a>
       </p>
     </div>
