Diff for /ECHO_content/ECHO_collection.py between versions 1.197 and 1.198

version 1.197, 2004/12/02 17:04:15 version 1.198, 2004/12/02 17:17:29
Line 75  regexpPage = re.compile(patternPage, re. Line 75  regexpPage = re.compile(patternPage, re.
   
                   
   
 def setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordstrs,viewClassification=""):  def setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordstrs="",viewClassification=""):
   
         """Allegemeine Informationen zu einer ECHO Collection"""          """Allegemeine Informationen zu einer ECHO Collection"""
   
         self.viewClassification=viewClassification  
   
         self.label = label          self.label = label
         self.title=title          self.title=title
         self.description=description          self.description=description
Line 89  def setECHO_collectionInformation(self,t Line 87  def setECHO_collectionInformation(self,t
         self.credits=toList(credits)          self.credits=toList(credits)
         self.weight=weight          self.weight=weight
   
         coords=[]  
         #coordinates of for rectangles  
   
           
         if coordstrs:  
             for coordstr in coordstrs:  
           
                 try:  
                     temco=coordstr.split(",")  
                 except:  
                     temco=[]  
           
                 coords.append(temco)  
   
   
         self.coords=coords[0:]  
                           
 class ECHO_copyright(Folder,ECHO_basis):  class ECHO_copyright(Folder,ECHO_basis):
     """Copyright informationen"""      """Copyright informationen"""
Line 1027  class ECHO_resource(Folder,Persistent,EC Line 1009  class ECHO_resource(Folder,Persistent,EC
     def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None):      def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None):
         """Aenderung der Properties"""          """Aenderung der Properties"""
                   
     try:                  setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight)
             coordsnew=[ string.split(x,",") for x in coords]  
         except:  
         coordsnew=[]      
           
         setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew)  
     self.viewClassification=viewClassification  
         self.coords=coordsnew[0:]  
         self.link=link          self.link=link
         self.metalink=metalink          self.metalink=metalink
                   
Line 1411  class ECHO_externalLink(Folder,ECHO_basi Line 1386  class ECHO_externalLink(Folder,ECHO_basi
           
   
     def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None):      def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None):
   
         """Aenderung der Properties"""          """Aenderung der Properties"""
     try:          setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight)
         coordsnew=[ string.split(x,",") for x in coords]  
     except:  
         coordsnew=[]  
   
         setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coords)  
   
         self.coords=coordsnew[0:]  
         self.link=link          self.link=link
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('manage_main')              RESPONSE.redirect('manage_main')
Line 2092  class ECHO_collection(Folder, Persistent Line 2060  class ECHO_collection(Folder, Persistent
         if not hasattr(self,'sortfield'):          if not hasattr(self,'sortfield'):
             self.sortfield="weight"              self.sortfield="weight"
       
         if not hasattr(self,'coords'):  
             self.coords=[]  
   
         pt=zptFile(self, 'zpt/ChangeECHO_collection.zpt')          pt=zptFile(self, 'zpt/ChangeECHO_collection.zpt')
         return pt()          return pt()
   
Line 2115  class ECHO_collection(Folder, Persistent Line 2080  class ECHO_collection(Folder, Persistent
         self.secondaryLinkTitle=secondaryLinkTitle          self.secondaryLinkTitle=secondaryLinkTitle
         self.imageTag=imageTag          self.imageTag=imageTag
     self.bgcolour=bgcolour      self.bgcolour=bgcolour
         self.viewClassification=viewClassification  
         self.location=location          self.location=location
     self.isAlwaysClickable=isAlwaysClickable      self.isAlwaysClickable=isAlwaysClickable
           
         if coords:          setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight)
             coordsnew=[ string.split(x,",") for x in coords]  
             self.coords=coordsnew[0:]  
         else:  
             coordsnew=None  
             self.coords=None  
               
         setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew)  
     try:  
         self.coords=coordsnew[0:] # HACK fehler in setECHO_collection  
         except:  
         """none"""  
                   
         self.sortfield=sortfield          self.sortfield=sortfield
   
Line 2241  class ECHO_collection(Folder, Persistent Line 2194  class ECHO_collection(Folder, Persistent
         parent._delObject(id)          parent._delObject(id)
     return "Done"      return "Done"
   
     def repairCoords(self):  
     """updates map coordinates to new class objects"""  
     msg = ""  
     for cols in self.ZopeFind(self, obj_metatypes=['ECHO_collection','ECHO_resource'], search_sub=1):  
         col = cols[1]  
         if not hasattr(col, 'coords'):  
         continue  
         print "fixing: ", col.id  
         msg += "fixing: "+col.id+"\n"  
         coords = col.coords  
         if len(coords) > 0:  
         # delete old MapAreas  
         for areas in self.ZopeFind(col, obj_metatypes=['MapArea']):  
             #area = areas[1]  
             id = areas[0]  
             print "  deleting: ", id  
             msg += "  deleting: "+id+"\n"  
             col._delObject(id)  
         # add new MapAreas  
         areacnt = 0  
         for coord in coords:  
             if len(coord) < 4:  
             continue  
             type = col.viewClassification  
             if type == 'view point':  
             type = 'arrow'  
             if type is None:  
             if len(coord) > 4:  
                 type = 'arrow'  
             else:  
                 type = 'area'  
             newid = "a%02d"%areacnt  
             areacnt += 1  
             area = MapArea(newid, coord, type=type)  
             print  "  adding: ", newid  
             msg += "  adding: "+newid+"\n"  
             col.addMapArea(area)  
     msg += "\nDone!"  
     return msg  
   
     getSubCols = ECHO_helpers.getSubCols      getSubCols = ECHO_helpers.getSubCols
   
Line 2383  class ECHO_group(ECHO_collection): Line 2297  class ECHO_group(ECHO_collection):
         self.bgcolour=bgcolour          self.bgcolour=bgcolour
                 self.logo=logo                  self.logo=logo
                                   
         if coords:          setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight)
             coordsnew=[ string.split(x,",") for x in coords]  
             self.coords=coordsnew[0:]  
         else:  
             coordsnew=None  
             self.coords=None  
   
         setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew)  
   
   
   
Line 2983  class ECHO_root(Folder,Persistent,Implic Line 2890  class ECHO_root(Folder,Persistent,Implic
         return "changed all contenttypes in: "+self.title          return "changed all contenttypes in: "+self.title
   
   
       def repairAllCoords(self):
       """updates map coordinates on the same and sublevels"""
       return repairCoords(self)
   
   
     def patchViewClassification(self,obj=None):      def patchViewClassification(self,obj=None):
         """setze viewClassification heuristisch"""          """setze viewClassification heuristisch"""
   
Line 3017  class ECHO_root(Folder,Persistent,Implic Line 2929  class ECHO_root(Folder,Persistent,Implic
   
     def deleteCache(self,obj=None,RESPONSE=None):      def deleteCache(self,obj=None,RESPONSE=None):
         """setze alle collections auf cache = CacheManager"""          """setze alle collections auf cache = CacheManager"""
   
       
         if not obj:          if not obj:
             obj = self              obj = self
               
         entries=obj.ZopeFind(obj,search_sub=1)          entries=obj.ZopeFind(obj,search_sub=1)
   
         for entry in entries:          for entry in entries:
         if hasattr(entry[1],'_v_hash'):          if hasattr(entry[1],'_v_hash'):
             entry[1]._v_hash=None              entry[1]._v_hash=None
                           
   
   
           
         return "changed all CM in: "+self.title          return "changed all CM in: "+self.title
   
   
       
     security.declarePublic('ECHO_newViewerLink')      security.declarePublic('ECHO_newViewerLink')
     def ECHO_newViewerLink(self,obj=None):      def ECHO_newViewerLink(self,obj=None):
         """change links (:86 faellt weg)"""          """change links (:86 faellt weg)"""
Line 3749  def manage_addECHO_institution(self, id, Line 3653  def manage_addECHO_institution(self, id,
         REQUEST.RESPONSE.redirect('%s/manage_main' % url)          REQUEST.RESPONSE.redirect('%s/manage_main' % url)
     return id      return id
   
   def repairCoords(self):
       """updates map coordinates to new MapArea objects"""
       msg = ""
       for cols in self.ZopeFind(self, obj_metatypes=['ECHO_collection','ECHO_resource'], search_sub=1):
           col = cols[1]
           if not hasattr(col, 'coords'):
           continue
           print "fixing: ", col.id
           msg += "fixing: "+col.id+"\n"
           coords = col.coords
           if len(coords) > 0:
           # delete old MapAreas
           for areas in self.ZopeFind(col, obj_metatypes=['MapArea']):
               #area = areas[1]
               id = areas[0]
               print "  deleting: ", id
               msg += "  deleting: "+id+"\n"
               col._delObject(id)
           # add new MapAreas
           areacnt = 0
           for coord in coords:
               if len(coord) < 4:
               continue
               type = col.viewClassification
               if type == 'view point':
               type = 'arrow'
               if type is None:
               if len(coord) > 4:
                   type = 'arrow'
               else:
                   type = 'area'
               newid = "a%02d"%areacnt
               areacnt += 1
               area = MapArea(newid, coord, type=type)
               print  "  adding: ", newid
               msg += "  adding: "+newid+"\n"
               col.addMapArea(area)
       msg += "\nDone!"
       return msg

Removed from v.1.197  
changed lines
  Added in v.1.198


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