Diff for /documentViewer/documentViewer.py between versions 1.71 and 1.76

version 1.71, 2010/06/17 17:38:59 version 1.76, 2010/06/21 11:47:47
Line 7  from AccessControl import getSecurityMan Line 7  from AccessControl import getSecurityMan
 from Globals import package_home  from Globals import package_home
   
 from Ft.Xml import EMPTY_NAMESPACE, Parse  from Ft.Xml import EMPTY_NAMESPACE, Parse
 from Ft.Xml.Domlette import PrettyPrint, Print  import Ft.Xml.Domlette
 import os.path  import os.path
 import sys  import sys
 import urllib  import urllib
Line 43  def getTextFromNode(nodename): Line 43  def getTextFromNode(nodename):
 def serializeNode(node, encoding='utf-8'):  def serializeNode(node, encoding='utf-8'):
     """returns a string containing node as XML"""      """returns a string containing node as XML"""
     buf = cStringIO.StringIO()      buf = cStringIO.StringIO()
     Print(node, stream=buf, encoding=encoding)      Ft.Xml.Domlette.Print(node, stream=buf, encoding=encoding)
     s = buf.getvalue()      s = buf.getvalue()
     buf.close()      buf.close()
     return s      return s
Line 172  class documentViewer(Folder): Line 172  class documentViewer(Folder):
         """get search"""          """get search"""
         return self.template.fulltextclient.getSearch(**args)          return self.template.fulltextclient.getSearch(**args)
   
     def getNumPages(self, **args):      def getNumPages(self, docinfo):
         """get numpages"""          """get numpages"""
         return self.template.fulltextclient.getNumPages(**args)          return self.template.fulltextclient.getNumPages(docinfo)
   
     def getTranslate(self, **args):      def getTranslate(self, **args):
         """get translate"""          """get translate"""
Line 266  class documentViewer(Folder): Line 266  class documentViewer(Folder):
         ret=""          ret=""
         if mk is None:          if mk is None:
             return ""              return ""
         if type(mk) is not ListType:          if not isinstance(mk, list):
             mk=[mk]              mk=[mk]
         for m in mk:          for m in mk:
             ret+="mk=%s"%m              ret+="mk=%s"%m
Line 305  class documentViewer(Folder): Line 305  class documentViewer(Folder):
                 params["url"] = getParentDir(params["url"])                  params["url"] = getParentDir(params["url"])
                                   
         # quote values and assemble into query string          # quote values and assemble into query string
         ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()])          #ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()])
           ps = urllib.urlencode(params)
         url=self.REQUEST['URL1']+"?"+ps          url=self.REQUEST['URL1']+"?"+ps
         return url          return url
   
Line 346  class documentViewer(Folder): Line 347  class documentViewer(Folder):
         elif access is None or access in self.authgroups:          elif access is None or access in self.authgroups:
             # only local access -- only logged in users              # only local access -- only logged in users
             user = getSecurityManager().getUser()              user = getSecurityManager().getUser()
               logging.debug("documentViewer (accessOK) user=%s ip=%s"%(user,self.REQUEST.getClientAddr()))
             if user is not None:              if user is not None:
                 #print "user: ", user                  #print "user: ", user
                 return (user.getUserName() != "Anonymous User")                  return (user.getUserName() != "Anonymous User")
             else:              else:
                 return False                  return False
                   
         logging.debug("documentViewer (accessOK) unknown access type %s"%access)          logging.error("documentViewer (accessOK) unknown access type %s"%access)
         return False          return False
           
                                   
Line 587  class documentViewer(Folder): Line 589  class documentViewer(Folder):
             docinfo['textURLPath'] = textUrl              docinfo['textURLPath'] = textUrl
             if not docinfo['imagePath']:              if not docinfo['imagePath']:
                 # text-only, no page images                  # text-only, no page images
                 docinfo = self.getNumPages(docinfo) #im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht                      docinfo = self.getNumPages(docinfo)
                     
         presentationUrls = dom.xpath("//texttool/presentation")          presentationUrls = dom.xpath("//texttool/presentation")
         docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag          docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag

Removed from v.1.71  
changed lines
  Added in v.1.76


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