changeset 78:70ab234a18dc

bugs in filepath mode fixes
author dwinter
date Fri, 06 Mar 2009 16:36:38 +0100
parents d41833613619
children df6952ac93e9
files documentViewer.py
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Fri Mar 06 16:36:38 2009 +0100
+++ b/documentViewer.py	Fri Mar 06 16:36:38 2009 +0100
@@ -189,6 +189,9 @@
                     del params[param]
             else:
                 params[param] = str(val)
+        if params["mode"] == "filepath": #wenn beim erst Aufruf filepath gesetzt wurde aendere das nun zu imagepath
+                params["mode"] = "imagepath"
+                params["url"] = getParentDir(params["url"])
                 
         # quote values and assemble into query string
         ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()])
@@ -257,7 +260,9 @@
             docinfo = {}
         
         for x in range(cut):
+               
                 path=getParentDir(path)
+       
         infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
     
         logger("documentViewer (getparamfromdigilib)", logging.INFO, "dirInfo from %s"%(infoUrl))
@@ -354,7 +359,7 @@
             docinfo = {}
             
         if dom is None:
-            for x in range(cut+1):
+            for x in range(cut):
                 path=getParentDir(path)
             dom = self.getIndexMeta(path)
        
@@ -374,9 +379,9 @@
         
         if docinfo is None:
             docinfo = {}
-            
+        
         if dom is None:
-            for x in range(cut+1):
+            for x in range(cut):
                 path=getParentDir(path)
             dom = self.getIndexMeta(path)
             
@@ -475,6 +480,7 @@
            imageDir=imageDir.replace("/mpiwg/online",'')
            docinfo=self.getDirinfoFromDigilib(imageDir,docinfo=docinfo)
            docinfo['imagePath'] = imageDir
+           
            docinfo['imageURL'] = self.digilibBaseUrl+"/servlet/Scaler?fn="+imageDir
            
        viewerUrls=dom.xpath("//texttool/digiliburlprefix")
@@ -532,6 +538,10 @@
         path=path.replace("/mpiwg/online","")
         docinfo['imagePath'] = path
         docinfo=self.getDirinfoFromDigilib(path,docinfo=docinfo,cut=cut)
+        
+        for x in range(cut):       
+                path=getParentDir(path)
+        logging.error("PATH:"+path)
         imageUrl=self.digilibBaseUrl+"/servlet/Scaler?fn="+path
         docinfo['imageURL'] = imageUrl
         
@@ -588,7 +598,7 @@
             pageinfo['numgroups'] = int(np / grpsize)
             if np % grpsize > 0:
                 pageinfo['numgroups'] += 1
-        logging.debug("getPageInfo: %s"%repr(pageinfo))
+
         return pageinfo
                 
     def text(self,mode,url,pn):