Diff for /ECHO_content/ECHO_collection.py between versions 1.63 and 1.72

version 1.63, 2004/05/07 14:34:07 version 1.72, 2004/05/07 18:04:29
Line 76  def getText(nodelist): Line 76  def getText(nodelist):
     return rc      return rc
   
   
   def sendFile(self, filename, type):
       """sends an object or a local file (in the product) as response"""
       paths = filename.split('/')
       object = self
       # look for an object called filename
       for path in paths:
           if hasattr(object, path):
           object = getattr(object, path)
       else:
           object = None
           break
       if object:
       # if the object exists then send it
       object()
       else:
       # send a local file with the given content-type
       fn = os.path.join(package_home(globals()), filename)
       self.REQUEST.RESPONSE.setHeader("Content-Type", type)
       self.REQUEST.RESPONSE.write(file(fn).read())
       return
   
   
 def readMetadata(url):  def readMetadata(url):
     """Methoden zum Auslesen der Metadateninformation zu einer Resource      """Methoden zum Auslesen der Metadateninformation zu einer Resource
     Vorerst noch Typ bib"""      Vorerst noch Typ bib"""
Line 576  class ECHO_collection(Folder, Persistent Line 598  class ECHO_collection(Folder, Persistent
     """ECHO Collection"""      """ECHO Collection"""
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
     meta_type='ECHO_collection'      meta_type='ECHO_collection'
       viewClassificationList=viewClassificationListMaster
     displayTypes=displayTypes      displayTypes=displayTypes
                           
       def getViewClassification(self):
           if hasattr(self,'viewClassification'):
               return self.viewClassification
           else:
               return ""
   
     def getTitle(self):      def getTitle(self):
     """title"""      """title"""
     return self.title.encode('utf-8')       return self.title.encode('utf-8') 
Line 657  class ECHO_collection(Folder, Persistent Line 685  class ECHO_collection(Folder, Persistent
         """CreateJava"""          """CreateJava"""
         ret=javaScriptMain          ret=javaScriptMain
   
         dynamical=""          dynamical="\n"
         for ob in self.getGraphicCoords():          for ob in self.getGraphicCoords():
         if ob[4][4] == "":            if ob[4][4] == "":  
             dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0])              dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0])
Line 667  class ECHO_collection(Folder, Persistent Line 695  class ECHO_collection(Folder, Persistent
         ret+=javaHandler%dynamical          ret+=javaHandler%dynamical
         return ret          return ret
           
       def createJSAreas(self):
           """CreateJava"""
           dynamical="\n"
           for ob in self.getGraphicCoords():
           if ob[5] == "area": 
               dynamical+="""addArea('%s', 'overview', %s, 'area');\n"""%(ob[1],ob[0])
           else:
               dynamical+="""addArea('%s', 'overview', %s, 'arrow');\n"""%(ob[1],ob[0])
           return dynamical
       
     security.declarePublic('getCreditObject')      security.declarePublic('getCreditObject')
     def getCreditObject(self,name):      def getCreditObject(self,name):
         """credit id to credititem"""          """credit id to credititem"""
Line 811  class ECHO_collection(Folder, Persistent Line 849  class ECHO_collection(Folder, Persistent
         else:          else:
             return "#dddddd"              return "#dddddd"
                   
     def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour=""):      def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",viewClassification=None):
         """Änderung der Properties"""          """Aenderung der Properties"""
   
         self.secondaryLink=secondaryLink          self.secondaryLink=secondaryLink
         self.secondaryLinkTitle=secondaryLinkTitle          self.secondaryLinkTitle=secondaryLinkTitle
         self.imageTag=imageTag          self.imageTag=imageTag
     self.bgcolour=bgcolour      self.bgcolour=bgcolour
           self.viewClassification=viewClassification
           
         if coords:          if coords:
             coordsnew=[ string.split(x,",") for x in coords]              coordsnew=[ string.split(x,",") for x in coords]
Line 876  class ECHO_collection(Folder, Persistent Line 915  class ECHO_collection(Folder, Persistent
         else:          else:
             return []              return []
   
       def area_img(self):
           """area image"""
           sendFile(self, 'images/red.gif', 'image/gif')
           return 
   
       def hl_lib_js(self):
           """javascript"""
           sendFile(self, 'js/hl_lib.js', 'text/plain')
           return 
   
       def js_lib_js(self):
           """javascript"""
           sendFile(self, 'js/js_lib.js', 'text/plain')
           return 
   
                   
     def getGraphicCoords(self):      def getGraphicCoords(self):
         """Give list of coordinates"""          """Give list of coordinates"""
         subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource']          subColTypes=['ECHO_collection','ECHO_resource']
         ids=[]          ids=[]
         for entry in self.__dict__.keys():          for entrySearch in self.ZopeFind(self,obj_metatypes=subColTypes):
             object=getattr(self,entry)              object=entrySearch[1]
             try:              if hasattr(object,'coords'):
                 if object.meta_type in subColTypes:  
                     for coordtemp in object.coords:                      for coordtemp in object.coords:
                         if len(coordtemp)>3:                          if len(coordtemp)>3:
                             coord=coordtemp[0:4]                              coord=coordtemp[0:4]
                           label=""
               vc=""
                             if hasattr(object,'label') and not object.label=="":                              if hasattr(object,'label') and not object.label=="":
                                 ids.append([string.join(coord,", "),object.getId(),object.label,object,coordtemp])                              label=object.label
                             elif hasattr(object,'title'):                          elif hasattr(object,'title') and not object.title=="":
                                 if not object.title=="":                              label=object.title
                                     ids.append([string.join(coord,", "),object.getId(),object.title,object,coordtemp])                          else:
                               label=object.getId()
               if object.viewClassification != "":
                   vc=object.viewClassification
                                 else:                                  else:
                                     ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp])                  if len(coordtemp) > 4 and coordtemp[4] != "":
                   vc="view point"
                             else:                              else:
                                 ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp])                  vc="area"
                                               ids.append([string.join(coord,", "),object.getId(),label,object,coordtemp,vc])
             except:  
                 """nothing"""  
   
         return ids          return ids
           
   
Line 1100  class ECHO_root(Folder,Persistent,Implic Line 1155  class ECHO_root(Folder,Persistent,Implic
     def checkIfArrow(obj):      def checkIfArrow(obj):
         if hasattr(obj,'coords'):          if hasattr(obj,'coords'):
             for coordtemp in obj.coords:              for coordtemp in obj.coords:
                 if len(coordtemp)>3:                  print obj.title,len(coordtemp)
                   if (len(coordtemp)>4) and not (coordtemp[4]==''):
                     return 4                      return 4
             return None              return None
         return None          return None
Line 1113  class ECHO_root(Folder,Persistent,Implic Line 1169  class ECHO_root(Folder,Persistent,Implic
         for entry in entries:          for entry in entries:
                   
         if checkIfArrow(entry[1]):           if checkIfArrow(entry[1]): 
               print "VP"
             setattr(entry[1],'viewClassification','view point')              setattr(entry[1],'viewClassification','view point')
         else:          else:
               print "area"
             setattr(entry[1],'viewClassification','area')              setattr(entry[1],'viewClassification','area')
   
                 #entry[1].contentType == entry[1].content_type                  #entry[1].contentType == entry[1].content_type

Removed from v.1.63  
changed lines
  Added in v.1.72


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