Diff for /documentViewer/documentViewer.py between versions 1.7 and 1.21

version 1.7, 2006/04/10 19:51:50 version 1.21, 2007/01/11 20:27:17
Line 1 Line 1
   
 genericDigilib="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/"  
   
 from OFS.Folder import Folder  from OFS.Folder import Folder
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate  from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
   from AccessControl import getSecurityManager
 from Globals import package_home  from Globals import package_home
   
 from Ft.Xml.Domlette import NonvalidatingReader  from Ft.Xml.Domlette import NonvalidatingReader
 from Ft.Xml.Domlette import PrettyPrint, Print  from Ft.Xml.Domlette import PrettyPrint, Print
 from Ft.Xml import EMPTY_NAMESPACE  from Ft.Xml import EMPTY_NAMESPACE, Parse
   
 import Ft.Xml.XPath  import Ft.Xml.XPath
   
Line 17  import os.path Line 17  import os.path
 import sys  import sys
 import cgi  import cgi
 import urllib  import urllib
   import logging
 import zLOG  import zLOG
   import urlparse 
   
 def getInt(number, default=0):  def getInt(number, default=0):
     """returns always an int (0 in case of problems)"""      """returns always an int (0 in case of problems)"""
Line 26  def getInt(number, default=0): Line 28  def getInt(number, default=0):
     except:      except:
         return default          return default
           
   
 def getTextFromNode(nodename):  def getTextFromNode(nodename):
       """get the cdata content of a node"""
       if nodename is None:
           return ""
     nodelist=nodename.childNodes      nodelist=nodename.childNodes
     rc = ""      rc = ""
     for node in nodelist:      for node in nodelist:
Line 35  def getTextFromNode(nodename): Line 39  def getTextFromNode(nodename):
            rc = rc + node.data             rc = rc + node.data
     return rc      return rc
   
           
   def getParentDir(path):
       """returns pathname shortened by one"""
       return '/'.join(path.split('/')[0:-1])
           
   
 import socket  import socket
   
 def urlopen(url):  def urlopen(url,timeout=2):
         """urlopen mit timeout"""          """urlopen mit timeout"""
         socket.setdefaulttimeout(2)          socket.setdefaulttimeout(timeout)
         ret=urllib.urlopen(url)          ret=urllib.urlopen(url)
         socket.setdefaulttimeout(5)          socket.setdefaulttimeout(5)
         return ret          return ret
Line 50  def urlopen(url): Line 60  def urlopen(url):
 ##  ##
 class documentViewer(Folder):  class documentViewer(Folder):
     """document viewer"""      """document viewer"""
       #textViewerUrl="http://127.0.0.1:8080/HFQP/testXSLT/getPage?"
   
     meta_type="Document viewer"      meta_type="Document viewer"
           
Line 69  class documentViewer(Folder): Line 80  class documentViewer(Folder):
     changeDocumentViewerForm = PageTemplateFile('zpt/changeDocumentViewer', globals())      changeDocumentViewerForm = PageTemplateFile('zpt/changeDocumentViewer', globals())
   
           
     def __init__(self,id,imageViewerUrl,title="",digilibBaseUrl=None,thumbcols=2,thumbrows=10):      def __init__(self,id,imageViewerUrl,textViewerUrl=None,title="",digilibBaseUrl=None,thumbcols=2,thumbrows=10,authgroups="mpiwg"):
         """init document viewer"""          """init document viewer"""
         self.id=id          self.id=id
         self.title=title          self.title=title
         self.imageViewerUrl=imageViewerUrl          self.imageViewerUrl=imageViewerUrl
           self.textViewerUrl=textViewerUrl
           
         if not digilibBaseUrl:          if not digilibBaseUrl:
             self.digilibBaseUrl = self.findDigilibUrl()              self.digilibBaseUrl = self.findDigilibUrl()
         else:          else:
             self.digilibBaseUrl = digilibBaseUrl              self.digilibBaseUrl = digilibBaseUrl
         self.thumbcols = thumbcols          self.thumbcols = thumbcols
         self.thumbrows = thumbrows          self.thumbrows = thumbrows
           # authgroups is list of authorized groups (delimited by ,)
           self.authgroups = [s.strip().lower() for s in authgroups.split(',')]
         # add template folder so we can always use template.something          # add template folder so we can always use template.something
         self.manage_addFolder('template')          self.manage_addFolder('template')
   
   
     security.declareProtected('View','index_html')      security.declareProtected('View','index_html')
     def index_html(self,mode,url,start=None,pn=1):      def index_html(self,mode,url,viewMode="auto",start=None,pn=1):
         '''          '''
         view it          view it
         @param mode: defines which type of document is behind url          @param mode: defines which type of document is behind url (text,images or auto)
         @param url: url which contains display information          @param url: url which contains display information
           @param viewMode: if images display images, if text display text, default is images
           
         '''          '''
                   
         zLOG.LOG("documentViewer (index)", zLOG.INFO, "mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))          zLOG.LOG("documentViewer (index)", zLOG.INFO, "mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))
Line 104  class documentViewer(Folder): Line 121  class documentViewer(Folder):
         docinfo = self.getDocinfo(mode=mode,url=url)          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)
         pt = getattr(self.template, 'viewer_main')          pt = getattr(self.template, 'viewer_main')
         return pt(docinfo=docinfo,pageinfo=pageinfo)          
           if viewMode=="auto": # automodus gewaehlt
               if docinfo.get("textURL",'') and self.textViewerUrl: #texturl gesetzt und textViewer konfiguriert
                   viewMode="text"
               else:
                   viewMode="images"
                   
           return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode)
       
       
     def getLink(self,param=None,val=None):      def getLink(self,param=None,val=None):
         """link to documentviewer with parameter param set to val"""          """link to documentviewer with parameter param set to val"""
         params=cgi.parse_qs(self.REQUEST['QUERY_STRING'])          params=self.REQUEST.form.copy()
         if param is not None:          if param is not None:
             if val is None:              if val is None:
                 if params.has_key(param):                  if params.has_key(param):
                     del params[param]                      del params[param]
             else:              else:
                 params[param] = [str(val)]                  params[param] = str(val)
                                   
         ps = "&".join(["%s=%s"%(k,urllib.quote(v[0])) for (k, v) in params.items()])          # quote values and assemble into query string
         url=self.REQUEST['URL']+"?"+ps          ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()])
         #url=self.REQUEST['URL']+"?"+urllib.urlencode(params, doseq=True)          url=self.REQUEST['URL1']+"?"+ps
         return url          return url
   
           
Line 132  class documentViewer(Folder): Line 156  class documentViewer(Folder):
             return style                  return style    
                   
                   
       def isAccessible(self, docinfo):
           """returns if access to the resource is granted"""
           access = docinfo.get('accessType', None)
           zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "access type %s"%access)
           if access is not None and access == 'free':
               zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "access is free")
               return True
           elif access is None or access in self.authgroups:
               # only local access -- only logged in users
               user = getSecurityManager().getUser()
               if user is not None:
                   #print "user: ", user
                   return (user.getUserName() != "Anonymous User")
               else:
                   return False
           
           zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "unknown access type %s"%access)
           return False
       
                   
     def getDirinfoFromDigilib(self,path,docinfo=None):      def getDirinfoFromDigilib(self,path,docinfo=None):
         """gibt param von dlInfo aus"""          """gibt param von dlInfo aus"""
           num_retries = 3
         if docinfo is None:          if docinfo is None:
             docinfo = {}              docinfo = {}
                           
         imageUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path          infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
           
         zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(imageUrl))          zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(infoUrl))
                   
           for cnt in range(num_retries):
         try:          try:
             dom = NonvalidatingReader.parseUri(imageUrl)                  # dom = NonvalidatingReader.parseUri(imageUrl)
                   txt=urllib.urlopen(infoUrl).read()
                   dom = Parse(txt)
                   break
         except:          except:
             zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.ERROR, "error reading %s"%(imageUrl))                  zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(infoUrl,cnt))
             raise IOError("Unable to get dirinfo from %s"%(imageUrl))          else:
               raise IOError("Unable to get dir-info from %s"%(infoUrl))
                   
         params=dom.xpath("//dir/size")          sizes=dom.xpath("//dir/size")
         zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:size"%params)          zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:size"%sizes)
                   
         if params:          if sizes:
             docinfo['numPages'] = getTextFromNode(params[0])              docinfo['numPages'] = int(getTextFromNode(sizes[0]))
         else:          else:
             docinfo['numPages'] = 0              docinfo['numPages'] = 0
                                                   
         return docinfo          return docinfo
                           
           
       def getIndexMeta(self, url):
           """returns dom of index.meta document at url"""
           num_retries = 3
           dom = None
           metaUrl = None
           if url.startswith("http://"):
               # real URL
               metaUrl = url
           else:
               # online path
               server=self.digilibBaseUrl+"/servlet/Texter?fn="
               metaUrl=server+url.replace("/mpiwg/online","")
               if not metaUrl.endswith("index.meta"):
                   metaUrl += "/index.meta"
           print metaUrl
           for cnt in range(num_retries):
               try:
                   # patch dirk encoding fehler treten dann nicht mehr auf
                   # dom = NonvalidatingReader.parseUri(metaUrl)
                   txt=urllib.urlopen(metaUrl).read()
                   dom = Parse(txt)
                   break
               except:
                   zLOG.LOG("ERROR documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
                   
           if dom is None:
               raise IOError("Unable to read index meta from %s"%(url))
                    
           return dom
       
       def getPresentationInfoXML(self, url):
           """returns dom of info.xml document at url"""
           num_retries = 3
           dom = None
           metaUrl = None
           if url.startswith("http://"):
               # real URL
               metaUrl = url
           else:
               # online path
               server=self.digilibBaseUrl+"/servlet/Texter?fn="
               metaUrl=server+url.replace("/mpiwg/online","")
              
           
           for cnt in range(num_retries):
               try:
                   # patch dirk encoding fehler treten dann nicht mehr auf
                   # dom = NonvalidatingReader.parseUri(metaUrl)
                   txt=urllib.urlopen(metaUrl).read()
                   dom = Parse(txt)
                   break
               except:
                   zLOG.LOG("ERROR documentViewer (getPresentationInfoXML)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
                   
           if dom is None:
               raise IOError("Unable to read infoXMLfrom %s"%(url))
                    
           return dom
                           
           
       def getAuthinfoFromIndexMeta(self,path,docinfo=None,dom=None):
           """gets authorization info from the index.meta file at path or given by dom"""
           zLOG.LOG("documentViewer (getauthinfofromindexmeta)", zLOG.INFO,"path: %s"%(path))
           
           access = None
           
           if docinfo is None:
               docinfo = {}
               
           if dom is None:
               dom = self.getIndexMeta(getParentDir(path))
          
           acctype = dom.xpath("//access-conditions/access/@type")
           if acctype and (len(acctype)>0):
               access=acctype[0].value
               if access in ['group', 'institution']:
                   access = getTextFromNode(dom.xpath("//access-conditions/access/name")[0]).lower()
               
           docinfo['accessType'] = access
           return docinfo
       
           
     def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None):      def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None):
         """gets bibliographical info from the index.meta file at url or given by dom"""          """gets bibliographical info from the index.meta file at path or given by dom"""
         zLOG.LOG("documentViewer (getbibinfofromindexmeta)", zLOG.INFO,"path: %s"%(path))          zLOG.LOG("documentViewer (getbibinfofromindexmeta)", zLOG.INFO,"path: %s"%(path))
                   
         if docinfo is None:          if docinfo is None:
             docinfo = {}              docinfo = {}
                           
         if dom is None:          if dom is None:
             server=self.digilibBaseUrl+"/servlet/Texter?fn="              dom = self.getIndexMeta(getParentDir(path))
             path="/".join(path.split("/")[0:-1])  
             metaUrl=server+path+"/index.meta"  
             try:  
                 dom = NonvalidatingReader.parseUri(metaUrl)  
             except:  
                 return docinfo  
                   
         metaData=self.metadata.main.meta.bib          metaData=self.metadata.main.meta.bib
         bibtype=dom.xpath("//bib/@type")          bibtype=dom.xpath("//bib/@type")
Line 182  class documentViewer(Folder): Line 308  class documentViewer(Folder):
             bibtype="generic"              bibtype="generic"
         bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC)          bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC)
         bibmap=metaData.generateMappingForType(bibtype)          bibmap=metaData.generateMappingForType(bibtype)
         print "bibmap: ", bibmap, " for: ", bibtype          #print "bibmap: ", bibmap, " for: ", bibtype
           # if there is no mapping bibmap is empty (mapping sometimes has empty fields)
         if len(bibmap) > 0 and len(bibmap['author'][0]) > 0:          if len(bibmap) > 0 and len(bibmap['author'][0]) > 0:
             docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0])              docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0])
             docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0])              docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0])
Line 191  class documentViewer(Folder): Line 318  class documentViewer(Folder):
         return docinfo          return docinfo
   
                   
     def getDocinfoFromTextTool(self,url,docinfo=None):      def getDocinfoFromTextTool(self,url,dom=None,docinfo=None):
        """parse texttool tag in index meta"""         """parse texttool tag in index meta"""
        zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.INFO,"url: %s"%(url))         zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.INFO,"url: %s"%(url))
        if docinfo is None:         if docinfo is None:
            docinfo = {}             docinfo = {}
                         
        try:         if dom is None:
            dom = NonvalidatingReader.parseUri(url)             dom = self.getIndexMeta(url)
        except:         
            zLOG.LOG("documentViewer (parseUrlTexttool)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])         archivePath = None
            raise IOError("Unable to get texttool info from %s"%(url))         archiveName = None
   
          archiveNames=dom.xpath("//resource/name")
          if archiveNames and (len(archiveNames)>0):
              archiveName=getTextFromNode(archiveNames[0])
          else:
              zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/name missing in: %s"%(url))
                 
        archivePaths=dom.xpath("//resource/archive-path")         archivePaths=dom.xpath("//resource/archive-path")
        if archivePaths and (len(archivePaths)>0):         if archivePaths and (len(archivePaths)>0):
            archivePath=getTextFromNode(archivePaths[0])             archivePath=getTextFromNode(archivePaths[0])
              # clean up archive path
              if archivePath[0] != '/':
                  archivePath = '/' + archivePath
              if archiveName and (not archivePath.endswith(archiveName)):
                  archivePath += "/" + archiveName
        else:         else:
            archivePath=None             # try to get archive-path from url
              zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/archive-path missing in: %s"%(url))
              if (not url.startswith('http')):
                  archivePath = url.replace('index.meta', '')
                  
          if archivePath is None:
              # we balk without archive-path
              raise IOError("Missing archive-path (for text-tool) in %s"%(url))
          
          imageDirs=dom.xpath("//texttool/image")
          if imageDirs and (len(imageDirs)>0):
              imageDir=getTextFromNode(imageDirs[0])
          else:
              # we balk with no image tag
              raise IOError("No text-tool info in %s"%(url))
                 
        images=dom.xpath("//texttool/image")         if imageDir and archivePath:
        if images and (len(images)>0):             #print "image: ", imageDir, " archivepath: ", archivePath
            image=getTextFromNode(images[0])             imageDir=os.path.join(archivePath,imageDir)
        else:             imageDir=imageDir.replace("/mpiwg/online",'')
            image=None             docinfo=self.getDirinfoFromDigilib(imageDir,docinfo=docinfo)
                         docinfo['imagePath'] = imageDir
        if image and archivePath:             docinfo['imageURL'] = self.digilibBaseUrl+"/servlet/Scaler?fn="+imageDir
            image=os.path.join(archivePath,image)  
            image=image.replace("/mpiwg/online",'')  
            docinfo=self.getDirinfoFromDigilib(image,docinfo=docinfo)  
            docinfo['imagePath'] = image  
            docinfo['imageURL'] = self.digilibBaseUrl+"/servlet/Scaler?fn="+image  
                         
        viewerUrls=dom.xpath("//texttool/digiliburlprefix")         viewerUrls=dom.xpath("//texttool/digiliburlprefix")
        if viewerUrls and (len(viewerUrls)>0):         if viewerUrls and (len(viewerUrls)>0):
Line 230  class documentViewer(Folder): Line 377  class documentViewer(Folder):
        textUrls=dom.xpath("//texttool/text")         textUrls=dom.xpath("//texttool/text")
        if textUrls and (len(textUrls)>0):         if textUrls and (len(textUrls)>0):
            textUrl=getTextFromNode(textUrls[0])             textUrl=getTextFromNode(textUrls[0])
              if urlparse.urlparse(textUrl)[0]=="": #keine url
                  textUrl=os.path.join(archivePath,textUrl) 
   
            docinfo['textURL'] = textUrl             docinfo['textURL'] = textUrl
                                             
      
          presentationUrls=dom.xpath("//texttool/presentation")
          if presentationUrls and (len(presentationUrls)>0):
               # presentation url ergiebt sich ersetzen von index.meta in der url der fŸr die Metadaten
               # durch den relativen Pfad auf die presentation infos
              presentationUrl=url.replace('index.meta',getTextFromNode(presentationUrls[0]))
              
              docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom)
          else:
        docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom)         docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom)
          docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom)
        return docinfo         return docinfo
         
   
       def getBibinfoFromTextToolPresentation(self,url,docinfo=None,dom=None):
           """gets the bibliographical information from the preseantion entry in texttools
           """
           dom=self.getPresentationInfoXML(url)
           docinfo['author']=getTextFromNode(dom.xpath("//author")[0])
           docinfo['title']=getTextFromNode(dom.xpath("//title")[0])
           docinfo['year']=getTextFromNode(dom.xpath("//date")[0])
           return docinfo
       
     def getDocinfoFromImagePath(self,path,docinfo=None):      def getDocinfoFromImagePath(self,path,docinfo=None):
         """path ist the path to the images it assumes that the index.meta file is one level higher."""          """path ist the path to the images it assumes that the index.meta file is one level higher."""
         zLOG.LOG("documentViewer (getdocinfofromimagepath)", zLOG.INFO,"path: %s"%(path))          zLOG.LOG("documentViewer (getdocinfofromimagepath)", zLOG.INFO,"path: %s"%(path))
Line 248  class documentViewer(Folder): Line 417  class documentViewer(Folder):
         docinfo['imageURL'] = imageUrl          docinfo['imageURL'] = imageUrl
                   
         docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo)          docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo)
           docinfo = self.getAuthinfoFromIndexMeta(path,docinfo=docinfo)
         return docinfo          return docinfo
           
           
Line 269  class documentViewer(Folder): Line 439  class documentViewer(Folder):
             docinfo = self.getDocinfoFromImagePath(url, docinfo=docinfo)              docinfo = self.getDocinfoFromImagePath(url, docinfo=docinfo)
         else:          else:
             zLOG.LOG("documentViewer (getdocinfo)", zLOG.ERROR,"unknown mode!")              zLOG.LOG("documentViewer (getdocinfo)", zLOG.ERROR,"unknown mode!")
               raise ValueError("Unknown mode %s"%(mode))
                           
         zLOG.LOG("documentViewer (getdocinfo)", zLOG.INFO,"docinfo: %s"%docinfo)          zLOG.LOG("documentViewer (getdocinfo)", zLOG.INFO,"docinfo: %s"%docinfo)
         self.REQUEST.SESSION['docinfo'] = docinfo          self.REQUEST.SESSION['docinfo'] = docinfo
         return docinfo          return docinfo
Line 302  class documentViewer(Folder): Line 474  class documentViewer(Folder):
         if mode=="texttool": #index.meta with texttool information          if mode=="texttool": #index.meta with texttool information
             (viewerUrl,imagepath,textpath)=parseUrlTextTool(url)              (viewerUrl,imagepath,textpath)=parseUrlTextTool(url)
                   
         print textpath          #print textpath
         try:          try:
             dom = NonvalidatingReader.parseUri(textpath)              dom = NonvalidatingReader.parseUri(textpath)
         except:          except:
Line 354  class documentViewer(Folder): Line 526  class documentViewer(Folder):
     def findDigilibUrl(self):      def findDigilibUrl(self):
         """try to get the digilib URL from zogilib"""          """try to get the digilib URL from zogilib"""
         url = self.imageViewerUrl[:-1] + "/getScalerUrl"          url = self.imageViewerUrl[:-1] + "/getScalerUrl"
           #print urlparse.urlparse(url)[0]
           #print urlparse.urljoin(self.absolute_url(),url)
           logging.info("finddigiliburl: %s"%urlparse.urlparse(url)[0])
           logging.info("finddigiliburl: %s"%urlparse.urljoin(self.absolute_url(),url))
           
         try:          try:
               if urlparse.urlparse(url)[0]=='': #relative path
                   url=urlparse.urljoin(self.absolute_url()+"/",url)
                   
             scaler = urlopen(url).read()              scaler = urlopen(url).read()
             return scaler.replace("/servlet/Scaler?", "")              return scaler.replace("/servlet/Scaler?", "")
         except:          except:
             return None              return None
           
     def changeDocumentViewer(self,imageViewerUrl,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=10,RESPONSE=None):      def changeDocumentViewer(self,imageViewerUrl,textViewerUrl,title="",digilibBaseUrl=None,thumbrows=2,thumbcols=10,authgroups='mpiwg',RESPONSE=None):
         """init document viewer"""          """init document viewer"""
         self.title=title          self.title=title
         self.imageViewerUrl=imageViewerUrl          self.imageViewerUrl=imageViewerUrl
           self.textViewerUrl=textViewerUrl
         self.digilibBaseUrl = digilibBaseUrl          self.digilibBaseUrl = digilibBaseUrl
         self.thumbrows = thumbrows          self.thumbrows = thumbrows
         self.thumbcols = thumbcols          self.thumbcols = thumbcols
                   self.authgroups = [s.strip().lower() for s in authgroups.split(',')]
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('manage_main')              RESPONSE.redirect('manage_main')
           
Line 381  def manage_AddDocumentViewerForm(self): Line 562  def manage_AddDocumentViewerForm(self):
     pt=PageTemplateFile('zpt/addDocumentViewer', globals()).__of__(self)      pt=PageTemplateFile('zpt/addDocumentViewer', globals()).__of__(self)
     return pt()      return pt()
       
 def manage_AddDocumentViewer(self,id,imageViewerUrl="",title="",RESPONSE=None):  def manage_AddDocumentViewer(self,id,imageViewerUrl="",textViewerUrl="",title="",RESPONSE=None):
     """add the viewer"""      """add the viewer"""
     newObj=documentViewer(id,imageViewerUrl,title)      newObj=documentViewer(id,imageViewerUrl,title=title,textViewerUrl=textViewerUrl)
     self._setObject(id,newObj)      self._setObject(id,newObj)
           
     if RESPONSE is not None:      if RESPONSE is not None:

Removed from v.1.7  
changed lines
  Added in v.1.21


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>