Diff for /ECHO_content/VLPExtension.py between versions 1.50 and 1.62

version 1.50, 2005/10/13 15:59:42 version 1.62, 2007/07/26 08:29:06
Line 21  import os Line 21  import os
 from stat import *  from stat import *
 from types import *  from types import *
 from Globals import package_home  from Globals import package_home
   import transaction
   
   
 def lemmatize(str):  def lemmatize(str):
Line 145  def manage_addSendMailForm(self, id, toA Line 145  def manage_addSendMailForm(self, id, toA
   
                   
 class VLP_essay(Folder):  class VLP_essay(Folder):
     """classe für VLP essays"""      """classe fr VLP essays"""
   
     meta_type="VLP_essay"      meta_type="VLP_essay"
   
Line 230  class VLP_essay(Folder): Line 230  class VLP_essay(Folder):
                                                   
         pages.sort(sortFind)          pages.sort(sortFind)
         #print str(pages[int(pagenum)][1]())          #print str(pages[int(pagenum)][1]())
           
         if pages[int(pagenum)-1][1].meta_type=='File':          if pages[int(pagenum)-1][1].meta_type=='File':
                                   
                 #return makeXML(str(pages[int(pagenum)-1][1]))                  #return makeXML(str(pages[int(pagenum)-1][1]))
Line 262  class VLP_essay(Folder): Line 263  class VLP_essay(Folder):
             retstr=url+"?p="+str(int(pagenum)+1)              retstr=url+"?p="+str(int(pagenum)+1)
             return retstr              return retstr
                   
       def lastURL(self,pagenum,url):
           # teste ob performance ok, sonst in variable
           pages=len(self.ZopeFind(self,obj_metatypes=['DTML Document','File'])) 
           
           return url+"?p="+str(pages)
               
     def previousURL(self,pagenum,url):      def previousURL(self,pagenum,url):
                   
         if int(pagenum)-1 > 0:          if int(pagenum)-1 > 0:
Line 346  class VLP_subcollection(ECHO_collection) Line 353  class VLP_subcollection(ECHO_collection)
   
         meta_type="VLP_subcollection"          meta_type="VLP_subcollection"
                   
           def getVLPSubcollectionToc(self,type):
               
               #different ordering depending on the type
               if(type == "(Collection)"):
                  sort= "shortreference"
               else:
                  sort = "startpages"
              
              #content of journals also displayed if not online
              
               if (type == "(JournalVolume)"):
                  online =""
               else:
                  online ="AND online = 1"
               sort=self.collectionSort(type)
           
               item = [x for x in self.ZSQLSimpleSearch("""SELECT * FROM vl_literature 
                                    WHERE volumeid ~ '%s\\\\M' """%self.getId()
                                    + """ %s AND not referenceType='%s' """%(online,type)
                                    + """ORDER BY """ + sort)]
           
               tocItem = [x for x in self.ZSQLSimpleSearch("""SELECT * FROM vl_literature 
                                    WHERE reference = '%s' """%self.getId()
                                    + """AND online = 1 AND referenceType='%s' """%type
                                    + """ORDER BY """ + sort)]
               
               
   
               return tocItem+item
               
         def checkForFrontMatter(self,item):          def checkForFrontMatter(self,item):
                 """Teste ob Frontmatter exists"""                  """Teste ob Frontmatter exists"""
                 if not item==self.getId():                  if not item==self.getId():
Line 395  class VLP_collection(ECHO_collection): Line 432  class VLP_collection(ECHO_collection):
   
     def generateSubCollections(self,errorsTXT=""):      def generateSubCollections(self,errorsTXT=""):
             """erzeuge subcollectionen"""              """erzeuge subcollectionen"""
             founds=self.ZSQLSimpleSearch("select * from vl_literature where referencetype in ('(Book)','(Collection)','(Journal)')")              founds=self.ZSQLSimpleSearch("select * from vl_literature where referencetype in ('(Edited Book)','(Book)','(Collection)','(JournalVolume)','(Generic Container)')")
                           
             self.REQUEST.RESPONSE.write("<h2>Create Subcollections</h2>\n")              self.REQUEST.RESPONSE.write("<h2>Create Subcollections</h2>\n")
             for found in founds:              for found in founds:
   
                     try:                      try:
                             foundCol=self.ZopeFind(self,obj_ids=[found.reference])                              foundCol=self.ZopeFind(self,obj_ids=[found.reference])
                             if foundCol:                              if foundCol:
Line 444  class VLP_collection(ECHO_collection): Line 482  class VLP_collection(ECHO_collection):
         files=os.listdir(self.vlp_basis)          files=os.listdir(self.vlp_basis)
   
         errorsTXT+="<h3>New Ressources</h3>"          errorsTXT+="<h3>New Ressources</h3>"
   
         for fileName in files:          for fileName in files:
                           
             if fileName[0:3]=="lit":              if fileName[0:3]=="lit":
Line 472  class VLP_collection(ECHO_collection): Line 511  class VLP_collection(ECHO_collection):
                 except:                  except:
                         error=sys.exc_info()[0:2]                          error=sys.exc_info()[0:2]
                         RESPONSE.write("<p>(ERROR (%s): %s %s)</p>\n"%(fileName,error[0],error[1]))                          RESPONSE.write("<p>(ERROR (%s): %s %s)</p>\n"%(fileName,error[0],error[1]))
                         errorsTXT+="<p>File not created:%s  "+"(ERROR: %s %s)</p>"%error                          errorsTXT+="<p>File not created:%s  (ERROR: %s %s)</p>"%(fileName,error[0],error[1])
                                                                   
         errorsTXT+=self.generateSubCollections()          errorsTXT+=self.generateSubCollections()
         errorsTXT+="/n"          errorsTXT+="\n"
         RESPONSE.write(errorsTXT)          RESPONSE.write(errorsTXT)
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('manage_main')              RESPONSE.redirect('manage_main')
Line 740  class VLP_resource(ECHO_resource,Cacheab Line 779  class VLP_resource(ECHO_resource,Cacheab
         temp=[]          temp=[]
         ret.sort()          ret.sort()
         for x in ret:          for x in ret:
             if (not (x[0]==".")) and (not x[0:4] in excludeNames):              if (not (x[0] in ('.',':'))) and (not x[0:4] in excludeNames):
                   
                 temp.append((calculateName(x),os.path.splitext(x)[0]))                  temp.append((calculateName(x),os.path.splitext(x)[0]))
         return temp          return temp
   
Line 851  class VLP_resource(ECHO_resource,Cacheab Line 889  class VLP_resource(ECHO_resource,Cacheab
     def createIndexFile(self,RESPONSE=None):      def createIndexFile(self,RESPONSE=None):
         """create index file"""          """create index file"""
   
                   logging.debug("createindexfile of %s"%self.id)
         pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','index_template.zpt')).__of__(self)()          pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','index_template.zpt')).__of__(self)()
   
   
           
         if not hasattr(self,'index.xml'):          if not hasattr(self,'index.xml'):
             zt=ZopePageTemplate('index.xml')              zt=ZopePageTemplate('index.xml')
             self._setObject('index.xml',zt)              self._setObject('index.xml',zt)
         else:          else:
             zt=getattr(self,'index.xml')              zt=getattr(self,'index.xml')
                           
                       #logging.debug("createindexfile uses %s"%pt)
         zt.pt_edit(pt, 'text/xml')          zt.pt_edit(pt, 'text/xml')
           transaction.get().commit()
   
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('manage_main')              RESPONSE.redirect('manage_main')

Removed from v.1.50  
changed lines
  Added in v.1.62


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