Diff for /MPIWGWeb/MPIWGProjects.py between versions 1.47.2.101 and 1.47.2.108

version 1.47.2.101, 2008/09/04 17:51:51 version 1.47.2.108, 2008/10/23 10:02:09
Line 20  from OFS.SimpleItem import SimpleItem Line 20  from OFS.SimpleItem import SimpleItem
 from OFS.Folder import Folder  from OFS.Folder import Folder
 from OFS.Image import Image  from OFS.Image import Image
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
   from AccessControl import getSecurityManager
 from bibliography import *  from bibliography import *
 import time  import time
   from OFS.Cache import Cacheable
 #import xml.dom.minidom  #import xml.dom.minidom
 import sys  import sys
 #from Ft.Xml.XPath import Evaluate  #from Ft.Xml.XPath import Evaluate
Line 111  class MPIWGProject_image(Image): Line 113  class MPIWGProject_image(Image):
         if RESPONSE:          if RESPONSE:
             RESPONSE.redirect("../manageImages")              RESPONSE.redirect("../manageImages")
   
 class MPIWGProject(CatalogAware,Folder):  class MPIWGProject(CatalogAware,Folder,Cacheable):
     """Class for Projects"""      """Class for Projects"""
   
   
Line 379  class MPIWGProject(CatalogAware,Folder): Line 381  class MPIWGProject(CatalogAware,Folder):
     
     def hasChildren(self,date=None,onlyActive=1,onlyArchived=1):      def hasChildren(self,date=None,onlyActive=1,onlyArchived=1):
         """check if project has children"""          """check if project has children"""
           
         ct=self.getContexts(childs=self.getContent('xdata_05'),          ct=self.getContexts(childs=self.getContent('xdata_05'),
                                  depth=1,date=date,onlyActive=onlyActive)                                   depth=1,date=date,onlyActive=onlyActive)
                   
Line 576  class MPIWGProject(CatalogAware,Folder): Line 579  class MPIWGProject(CatalogAware,Folder):
     def isArchivedProject(self):      def isArchivedProject(self):
         """check if the project is archived"""          """check if the project is archived"""
                   
         completed=getattr(self,'completedAt',0)          completed=self.getCompletedAt()
                 
        #completed leer          #completed leer 
         if completed=="" :          if completed=="" :
Line 613  class MPIWGProject(CatalogAware,Folder): Line 616  class MPIWGProject(CatalogAware,Folder):
             return True;              return True;
         else:          else:
             return False;              return False;
   
     def getCompletedAt(self):      def getCompletedAt(self):
         """gibt das transformierte Datum zurueck, an dem das Projekt beendet wurde."""          """gibt das transformierte Datum zurueck, an dem das Projekt beendet wurde."""
         date=getattr(self,'completedAt','')          date=getattr(self,'completedAt','')
         
         if date:          if date:
             return self.reTransformDate(date);              return self.reTransformDate(date);
         else:          else:
               return ""
             # test ob parent abgeschlossen ist              # test ob parent abgeschlossen ist
                           try:          #TODO: ersetzte try except durch vernuenftige abfrage  
             ct=self.getContexts(parents=self.getContent('xdata_05'),depth=1)              ct=self.getContexts(parents=self.getContent('xdata_05'),depth=1)
             if (len(ct)>0): #is there are parent              if (len(ct)>0): #is there are parent
                   
                 return ct[0][0].getCompletedAt()                  return ct[0][0].getCompletedAt()
             return '';              return '';
               except:
                   return '';
                   
     def getStartedAt(self):      def getStartedAt(self):
         """gibt das transformierte Datum zurŸck, an dem Projekt begonnen wurde."""          """gibt das transformierte Datum zurŸck, an dem Projekt begonnen wurde."""
Line 749  class MPIWGProject(CatalogAware,Folder): Line 756  class MPIWGProject(CatalogAware,Folder):
                     
     def index_html(self,request=True,context=None):      def index_html(self,request=True,context=None):
         """show homepage"""          """show homepage"""
       
           bound_names={}
            
           if not context:
               context=self
           if request:
               if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected',None)==None:
                   self.REQUEST.SESSION['MPI_redirected']=1
                   self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date'])+"?date="+self.REQUEST['date'])
               else:
                   self.REQUEST.SESSION['MPI_redirected']=None
           
           #ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"])
         
      
           request2=getattr(self,'REQUEST',None)
           
           if request2 is not None:
               response = request2.response
               if not response.headers.has_key('content-type'):
                   response.setHeader('content-type', 'text/html')
   
           security = getSecurityManager()
           bound_names['user'] = security.getUser()
   
         
           # Retrieve the value from the cache.
           keyset = None
           if self.ZCacheable_isCachingEnabled():
               
               # Prepare a cache key.
               keyset = {'here': self, 'params':request2['QUERY_STRING']}
                         
               result = self.ZCacheable_get(keywords=keyset)
              
               if result is not None:
                   # Got a cached value.
                   return result
           
           pt = getTemplate(self, "project_main")
            # Execute the template in a new security context.
           security.addContext(self)
   
           try:
               result = pt.pt_render(extra_context=bound_names)
               if keyset is not None:
                   # Store the result in the cache.
                   self.ZCacheable_set(result, keywords=keyset)
                  
               return result
           finally:
               security.removeContext(self)
          
   
         
       def index_html_old(self,request=True,context=None):
           """show homepage"""
         if not context:          if not context:
             context=self              context=self
         if request:          if request:
Line 759  class MPIWGProject(CatalogAware,Folder): Line 823  class MPIWGProject(CatalogAware,Folder):
                 self.REQUEST.SESSION['MPI_redirected']=None                  self.REQUEST.SESSION['MPI_redirected']=None
                   
         #ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"])          #ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"])
         
         ext=getattr(self,"project_main",None)          ext=getattr(self,"project_main",None)
         if ext:          if ext:
             return getattr(self,ext.getId())()              return getattr(self,ext.getId())()
Line 788  class MPIWGProject(CatalogAware,Folder): Line 853  class MPIWGProject(CatalogAware,Folder):
     def getContent(self,field,filter=None):      def getContent(self,field,filter=None):
         """Inhalt des Feldes"""          """Inhalt des Feldes"""
                   
       if field=="short_title":
           text = self.getContent("xdata_07")
           if text=="":
               text = self.getContent("WEB_title")
           return text
   
         text=u''          text=u''
   
         for x in getattr(self,field):          for x in getattr(self,field):
Line 807  class MPIWGProject(CatalogAware,Folder): Line 878  class MPIWGProject(CatalogAware,Folder):
         except:          except:
             pass              pass
                   
         if text=='':          if text=='': ## wozu die folgenden Zeilen??
             text2=text              text2=text
         else:          else:
             text2=re.sub(r';([^\s])','; \g<1>',text)              text2=re.sub(r';([^\s])','; \g<1>',text)
                 
           if field=="WEB_project_description":##Jedenfalls darf letzteres nicht gemacht werden, falls normaler text
               text2=text
               
         #teste ob ergebnis leer und header dann nehme title          #teste ob ergebnis leer und header dann nehme title
                   
         if (text2=='') and (field=='WEB_project_header'):          if (text2=='') and (field=='WEB_project_header'):
Line 900  class MPIWGProject(CatalogAware,Folder): Line 974  class MPIWGProject(CatalogAware,Folder):
             return self.preview(newcontent)              return self.preview(newcontent)
   
         self.copyObjectToArchive()          self.copyObjectToArchive()
           self.ZCacheable_invalidate()
         self.WEB_project_description=newcontent[0:]          self.WEB_project_description=newcontent[0:]
   
         self.REQUEST.RESPONSE.redirect("./index.html")          self.REQUEST.RESPONSE.redirect("./index.html")
Line 952  class MPIWGProject(CatalogAware,Folder): Line 1027  class MPIWGProject(CatalogAware,Folder):
             baseUrl = "/en/research/projects/"              baseUrl = "/en/research/projects/"
                           
         # add in the internal project hierarchy          # add in the internal project hierarchy
           
         ct=self.getContexts(parents=self.getContent('xdata_05'))          ct=self.getContexts(parents=self.getContent('xdata_05'))
         # start with grandparents          # start with grandparents
         ct.reverse()          ct.reverse()
Line 966  class MPIWGProject(CatalogAware,Folder): Line 1042  class MPIWGProject(CatalogAware,Folder):
   
     def getRootProject(self):      def getRootProject(self):
         """returns the root (=top level) project of the current project"""          """returns the root (=top level) project of the current project"""
           
         ct=self.getContexts(parents=self.getContent('xdata_05'))          ct=self.getContexts(parents=self.getContent('xdata_05'))
         if len(ct) > 0:          if len(ct) > 0:
             return ct[-1][0]              return ct[-1][0]
Line 1109  class MPIWGProject(CatalogAware,Folder): Line 1186  class MPIWGProject(CatalogAware,Folder):
             lastname=self.myCapitalize(lastname).encode('utf-8')              lastname=self.myCapitalize(lastname).encode('utf-8')
             logging.info("Search: %s %s %s"%(name,repr(firstname),repr(lastname)))              logging.info("Search: %s %s %s"%(name,repr(firstname),repr(lastname)))
             try:              try:
                 cataloggedNames=self.MembersCatalog({'firstName':firstname,'lastName':lastname})                  cataloggedNames=self.MembersCatalog(firstName=firstname,lastName=lastname)
             except:              except:
                 cataloggedNames=[]                  cataloggedNames=[]
                 logging.error("ERROR: identifyNames %s %s"%sys.exc_info()[0:2])                  logging.error("ERROR: identifyNames %s %s"%sys.exc_info()[0:2])
Line 1132  class MPIWGProject(CatalogAware,Folder): Line 1209  class MPIWGProject(CatalogAware,Folder):
         """edit the project and archive the old version"""          """edit the project and archive the old version"""
                   
         self.copyObjectToArchive() # archive the object          self.copyObjectToArchive() # archive the object
           self.ZCacheable_invalidate()
   
         for x in definedFields:          for x in definedFields:
             if self.REQUEST.has_key(x):              if self.REQUEST.has_key(x):

Removed from v.1.47.2.101  
changed lines
  Added in v.1.47.2.108


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