Diff for /ECHO_content/ECHO_collection.py between versions 1.305 and 1.310

version 1.305, 2009/04/17 13:58:40 version 1.310, 2010/10/13 13:10:19
Line 57  import Ft.Xml.XPath Line 57  import Ft.Xml.XPath
 import cStringIO  import cStringIO
   
 import sys  import sys
   import logging
   
 try:  try:
         from psycopg import libpq          from psycopg import libpq
Line 380  class ECHO_fullText(ZopePageTemplate,ECH Line 381  class ECHO_fullText(ZopePageTemplate,ECH
                 try:                  try:
                    dom=xml.dom.minidom.parseString(self())                     dom=xml.dom.minidom.parseString(self())
                 except:                  except:
                    dom=xml.dom.minidom.parseString(self().encode('latin-1'))                     dom=xml.dom.minidom.parseString(self.utf8ify(self()))
                 pages=dom.getElementsByTagName('page')                  pages=dom.getElementsByTagName('page')
                                   
                 return pages[int(nr)-1].toxml()                  return pages[int(nr)-1].toxml()
Line 701  class ECHO_collection(CatalogAware, Fold Line 702  class ECHO_collection(CatalogAware, Fold
   
     path="/mpiwg/online/permanent/shipbuilding"      path="/mpiwg/online/permanent/shipbuilding"
   
       def getSection(self, crumbs=None):
           """returns the current section name"""
           # use breadcrumbs if available
           if crumbs is not None and len(crumbs) > 0:
               return crumbs[0][2].getId()
       
           p = self
         
           sec = None
           # descend parents to the root (and remember the last id)
           while p is not None and p.meta_type != 'ECHO_root' and p.meta_type!='ECHO_main' and p.meta_type!='ECHO_nav':
               sec = p.getId()
               p = p.aq_parent
        
           return sec
       
       def getSubSection(self, crumbs=None):
           """returns the current subsection name"""
           # use breadcrumbs if available
           if crumbs is not None and len(crumbs) > 1:
               return crumbs[1][2].getId()
       
           p = self
           sec = None
           subsec = None
           # descend parents to the root (and remember the last id)
           while p is not None and p.meta_type != 'ECHO_root' and p.meta_type!='ECHO_main' and p.meta_type!='ECHO_nav':
               subsec = sec
               sec = p.getId()
               p = p.aq_parent
             
           return subsec
   
           
     def exportImportObjects_html(self,RESPONSE):      def exportImportObjects_html(self,RESPONSE):
         """ImportObject"""          """ImportObject"""
Line 856  class ECHO_collection(CatalogAware, Fold Line 890  class ECHO_collection(CatalogAware, Fold
             if not urn:              if not urn:
                     urn=self.absolute_url()                      urn=self.absolute_url()
                                           
             li="""<RDF:li RDF:resource="%s" />\n"""              li="""<rdf:li rdf:resource="%s" />\n"""
   
                           
             for content in contents:              for content in contents:
         try:          try:
                     ret+=content[1].getRDF()+"\n"                      ret+=content[1].getRDF()+"\n"
                 except:                  except:
             logging.error("getRDF: "+repr(content[1].getRDF()))              logging.error("getrdf: "+repr(content[1].getRDF()))
               try:
             ret+=self.unicodify(content[1].getRDF())+"\n"              ret+=self.unicodify(content[1].getRDF())+"\n"
             ret+="""<RDF:Seq RDF:about="%s">\n"""%urn              except:
               logging.error("--still cannot do it")
                   ret+=repr(content[1].getRDF())+"\n"
               ret+="""<rdf:Seq rdf:about="%s">\n"""%urn
             for content in contents:              for content in contents:
                     nurn=content[1].absolute_url()                      nurn=content[1].absolute_url()
                     ret+=li%nurn                      ret+=li%nurn
             return ret+"</RDF:Seq>"              return ret+"</rdf:Seq>"
                           
   
           
Line 999  class ECHO_collection(CatalogAware, Fold Line 1037  class ECHO_collection(CatalogAware, Fold
                             pass                              pass
             return ret              return ret
                 
     def importCollection(self,path=None,RESPONSE=None):      def importCollection(self,path=None,viewerUrl=None,metaDataUrl=None,replacePathPermanent=None,replacePathExperimental=None,RESPONSE=None):
         """liest verzeichnisse aus dem pfad und legt sie dann als objekte in den ordner"""          """liest verzeichnisse aus dem pfad und legt sie dann als objekte in den ordner"""
                   
         if path is None:          if path is None:
Line 1012  class ECHO_collection(CatalogAware, Fold Line 1050  class ECHO_collection(CatalogAware, Fold
                           
             if fileName:              if fileName:
                                   
                 tempPath=re.sub("/mpiwg/online","",path)                  if (replacePathExperimental and replacePathExperimental!=''):
                 link="http://echo.mpiwg-berlin.mpg.de/zogilib_book?fn="+tempPath+"/"+fileName+"/pageimg"                      path=re.sub(replacePathExperimental,"/mpiwg/online/experimental",path)
                      
                   if (replacePathPermanent and replacePathPermanent!=''):
                       path=re.sub(replacePathPermanent,"/mpiwg/online/permanent",path)
                                   
                 metalink=self.path+"/"+fileName+"/index.meta"                  link=viewerUrl%(path+"/"+fileName+"/pageimg")
                   
                   metalink=metaDataUrl+"/"+path+"/"+fileName+"/index.meta"
                 try:                  try:
   
                         #link="http://nausikaa2.mpiwg-berlin.mpg.de/cgi-bin/toc/toc.x.cgi?dir="+fileName+"&step=thumb"                          #link="http://nausikaa2.mpiwg-berlin.mpg.de/cgi-bin/toc/toc.x.cgi?dir="+fileName+"&step=thumb"
                                                   
                         newObj=ECHO_resource(fileName,link,metalink,fileName,fileName,fileName,'generated','book','','','','','','')                          newObj=ECHO_resource(fileName,link,metalink,fileName,fileName,fileName,'','book','','','','','','')
                         self._setObject(fileName,newObj)                          self._setObject(fileName,newObj)
                                   
                         genObj=getattr(self,fileName)                          genObj=getattr(self,fileName)
Line 1617  class ECHO_group(ECHO_collection): Line 1660  class ECHO_group(ECHO_collection):
                           
             if not urn:              if not urn:
                     urn=self.absolute_url()                      urn=self.absolute_url()
             li="""<RDF:li RDF:resource="%s" />\n"""              li="""<rdf:li rdf:resource="%s" />\n"""
                           
                           
             for content in contents:              for content in contents:
                     ret+=content[1].getRDF()+"\n"                      ret+=self.unicodify(content[1].getRDF())+"\n"
                                           
             ret+="""<RDF:Seq RDF:about="%s">\n"""%urn              ret+="""<rdf:Seq rdf:about="%s">\n"""%urn
             for content in contents:              for content in contents:
                     nurn=content[1].absolute_url()                      nurn=content[1].absolute_url()
                     ret+=li%nurn                      ret+=li%nurn
             return ret+"</RDF:Seq>"              return ret+"</rdf:Seq>"
                           
         def index_html(self):          def index_html(self):
                 """standard page"""                  """standard page"""
Line 1811  class ECHO_userFolder(UserFolder): Line 1854  class ECHO_userFolder(UserFolder):
                         return 1                          return 1
             return 0              return 0
   
 Globals.default__class_init__(ECHO_userFolder)  # ROC: problem with 2.12
   #Globals.default__class_init__(ECHO_userFolder)
   
   
   
Line 1886  class ECHO_root(Folder,Persistent,Implic Line 1930  class ECHO_root(Folder,Persistent,Implic
 )  )
   
   
   
   
     def getECHORootURL(self):      def getECHORootURL(self):
         return self.absolute_url()          return self.absolute_url()
           

Removed from v.1.305  
changed lines
  Added in v.1.310


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