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

version 1.11, 2004/01/27 13:33:27 version 1.72, 2004/05/07 18:04:29
Line 1 Line 1
   """New version of the product started February, 8th. Without scientific classification, use content-type for further classification."""
 """Echo collection provides the classes for the ECHO content web-site.  """Echo collection provides the classes for the ECHO content web-site.
   
 class ECHO_collection is the basis class for an ECHO collection.  class ECHO_collection is the basis class for an ECHO collection.
Line 10  class ECHO_externalLink contains informa Line 10  class ECHO_externalLink contains informa
   
 """  """
 import string  import string
   import re
   import os
 import OFS.Image  import OFS.Image
 from types import *  from types import *
 from OFS.Image import Image  from OFS.Image import Image
Line 21  from Globals import InitializeClass Line 23  from Globals import InitializeClass
 from Globals import DTMLFile  from Globals import DTMLFile
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from Products.PageTemplates.PageTemplate import PageTemplate  from Products.PageTemplates.PageTemplate import PageTemplate
 from Globals import Persistent  from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
   from Globals import Persistent, package_home
 from Acquisition import Implicit  from Acquisition import Implicit
   from ECHO_helpers import displayTypes
   try:
       from psycopg import libpq
   except:
       try:
           from pyPgSQL import libpq
       except:
           print "ECHO_collection: Warning - No libpq imported!"
   
   import xml.dom.minidom
   
 import urllib  import urllib
 import xml.dom.minidom  import xml.dom.minidom
   from ECHO_graphicalOverview import javaHandler,javaScriptMain
   import ECHO_helpers
   
 #List of different types for the graphical linking viewer  #List of different types for the graphical linking viewer
 viewClassificationListMaster=['view point','area']  viewClassificationListMaster=['view point','area']
   
   def content_html(self,type):
           """template fuer content"""
           #templates = self.ZopeFind(self.aq_parent,obj_ids=[type+"_template"])
           #
           #if templates:
           #    return templates[0][1]()
   
           try:
               obj=getattr(self,type+"_template")
               return obj()
           except:
               pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_%s_template_standard.zpt'%type).__of__(self)
               pt.content_type="text/html"
               return pt()
   
 def toList(field):  def toList(field):
     """Einzelfeld in Liste umwandeln"""      """Einzelfeld in Liste umwandeln"""
Line 49  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 93  def readMetadata(url): Line 142  def readMetadata(url):
     return metadict,""      return metadict,""
           
   
 def setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,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"""
   
Line 102  def setECHO_CollectionInformation(self,c Line 151  def setECHO_CollectionInformation(self,c
         self.label = label          self.label = label
         self.title=title          self.title=title
         self.description=description          self.description=description
         self.content_type=content_type          self.contentType=contentType
         self.responsible=responsible          self.responsible=responsible
         self.credits=toList(credits)          self.credits=toList(credits)
         self.weight=weight          self.weight=weight
   
         self.scientific_Information.source_type=source_type  
         self.scientific_Information.period=period  
         self.scientific_Information.scientific_Classification.context=context  
         self.scientific_Information.scientific_Classification.science=science  
         self.scientific_Information.scientific_Classification.practice=practice  
           
         coords=[]          coords=[]
         #coordinates of for rectangles          #coordinates of for rectangles
   
         #print "cs", coordstrs          #print "cs", coordstrs
         if coordstrs:          if coordstrs:
             for coordstr in coordstrs:              for coordstr in coordstrs:
                 print "cs", coordstr                  #print "cs", coordstr
                 try:                  try:
                     temco=coordstr.split(",")                      temco=coordstr.split(",")
                 except:                  except:
Line 132  def setECHO_CollectionInformation(self,c Line 175  def setECHO_CollectionInformation(self,c
                           
   
 class scientificClassification(SimpleItem,Persistent,Implicit):  class scientificClassification(SimpleItem,Persistent,Implicit):
     """subclass"""      """outdated will be deleeted in the next versions: subclass"""
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
           
     def __init__(self,context,science,practice):      def __init__(self,context,science,practice):
Line 155  class scientificClassification(SimpleIte Line 198  class scientificClassification(SimpleIte
           
                                   
 class scientificInformation(Folder,Persistent,Implicit):  class scientificInformation(Folder,Persistent,Implicit):
     """subclass scientificInformation"""      """outdated will be deleted in the next versions: subclass scientificInformation"""
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
           
           
Line 176  class scientificInformation(Folder,Persi Line 219  class scientificInformation(Folder,Persi
     def get_period(self):      def get_period(self):
         return self.period          return self.period
   
   class ECHO_layoutTemplate(ZopePageTemplate):
       """Create a layout Template for different purposes"""
   
       meta_type="ECHO_layoutTemplate"
   
       def __init__(self, id, text=None, content_type=None,EchoType=None):
           self.id = str(id)
   
   
   
           self.ZBindings_edit(self._default_bindings)
           if text is None:
               self._default_content_fn = os.path.join(package_home(globals()),
                                                  'zpt/ECHO_%s_template_standard.zpt'%EchoType)
               text = open(self._default_content_fn).read()
           self.pt_edit(text, content_type)
   
       
           """change form"""
   
   
   def manage_addECHO_layoutTemplateForm(self):
       """Form for adding"""
       pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_layoutTemplate.zpt').__of__(self)
       return pt()
   
   from urllib import quote
   
   
   def manage_addECHO_layoutTemplate(self, EchoType,title=None,REQUEST=None):
       "Add a Page Template with optional file content."
       if type(EchoType)==StringType:
           EchoTypes=[EchoType]
       else:
           EchoTypes=EchoType
           
       for singleType in EchoTypes:
   
           id = str(singleType)+"_template"
           if REQUEST is None:
               self._setObject(id, ECHO_layoutTemplate(id, text,EchoType=singleType))
               ob = getattr(self, id)
               
               if title:
                   ob.pt_setTitle(title)
               return ob
           else:
               file = REQUEST.form.get('file')
               headers = getattr(file, 'headers', None)
               if headers is None or not file.filename:
                   zpt = ECHO_layoutTemplate(id,EchoType=singleType)
               else:
                   zpt = ECHO_layoutTemplate(id, file, headers.get('content_type'))
   
               self._setObject(id, zpt)
               ob = getattr(self, id)
               if title:
                   ob.pt_setTitle(title)
   
               try:
                   u = self.DestinationURL()
               except AttributeError:
                   u = REQUEST['URL1']
   
               
       REQUEST.RESPONSE.redirect(u+'/manage_main')
       return ''
   
 class ECHO_resource(Folder):  class ECHO_resource(Folder):
     """ECHO Ressource"""      """ECHO Ressource"""
Line 183  class ECHO_resource(Folder): Line 293  class ECHO_resource(Folder):
   
     viewClassificationList=viewClassificationListMaster      viewClassificationList=viewClassificationListMaster
   
       getSubCols = ECHO_helpers.getSubCols
       def getTitle(self):
       """title"""
       return self.title.encode('utf-8') 
   
       def getLabel(self):
       """title"""
       return self.label.encode('utf-8') 
   
       def content_html(self):
           """template fuer content"""
           return content_html(self,'resource')
       
     def getViewClassification(self):      def getViewClassification(self):
         if hasattr(self,'viewClassification'):          if hasattr(self,'viewClassification'):
             return self.viewClassification              return self.viewClassification
Line 196  class ECHO_resource(Folder): Line 319  class ECHO_resource(Folder):
         else:          else:
             return []              return []
           
     def __init__(self,id,link,metalink,title,label,description,content_type,responsible,credits,weight,coords):      def __init__(self,id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords):
   
         self.id = id          self.id = id
         """Festlegen der ID"""          """Festlegen der ID"""
Line 208  class ECHO_resource(Folder): Line 331  class ECHO_resource(Folder):
         self.weight=weight          self.weight=weight
         self.credits=toList(credits)          self.credits=toList(credits)
         self.description=description          self.description=description
         self.content_type=content_type          self.contentType=contentType
         self.responsible=responsible          self.responsible=responsible
                   
         if coords:          if coords:
Line 225  class ECHO_resource(Folder): Line 348  class ECHO_resource(Folder):
         except:          except:
             return []              return []
   
       def getContentType(self):
           try:
               return self.contentType
           except:
               return ""
   
     def ECHO_resource_config(self):      def ECHO_resource_config(self):
         """Main configuration"""          """Main configuration"""
Line 234  class ECHO_resource(Folder): Line 362  class ECHO_resource(Folder):
         if not hasattr(self,'coords'):          if not hasattr(self,'coords'):
             self.coords=[]              self.coords=[]
   
         pt=PageTemplateFile('Products/ECHO_content/ChangeECHO_resource.zpt').__of__(self)          print "vorher",self.coords
           pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_resource.zpt').__of__(self)
         return pt()          return pt()
           
   
     def changeECHO_resource(self,metalink,link,context,science,practice,source_type,period,title,label,description,content_type,responsible,credits,weight,viewClassification="",coords="",RESPONSE=None):      def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None):
   
   
         """Änderung der Properties"""          """Änderung der Properties"""
                   
       try:        
               coordsnew=[ string.split(x,",") for x in coords]
           except:
           coordsnew=[]    
   
         setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,credits,weight,coords,viewClassification)          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 260  class ECHO_resource(Folder): Line 391  class ECHO_resource(Folder):
         {'label':'Graphics','action':'ECHO_graphicEntry'},          {'label':'Graphics','action':'ECHO_graphicEntry'},
         )          )
   
       def getOverview(self):
           """overview graphics"""
           
           return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1]
   
     def ECHO_graphicEntry(self):      def ECHO_graphicEntry(self):
         """DO nothing"""          """DO nothing"""
         if 'overview' in self.aq_parent.__dict__.keys():          overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])
             pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self)          if overview: 
               pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self)
             return pt()              return pt()
         else:          else:
             return "NO OVERVIEW GRAPHICS"              return "NO OVERVIEW GRAPHICS"
Line 276  class ECHO_resource(Folder): Line 413  class ECHO_resource(Folder):
         coords.append(temco)          coords.append(temco)
                   
         self.coords=coords[0:]          self.coords=coords[0:]
         #pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self)  
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('ECHO_graphicEntry')              RESPONSE.redirect('ECHO_graphicEntry')
   
Line 284  class ECHO_resource(Folder): Line 421  class ECHO_resource(Folder):
         """Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource"""          """Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource"""
         (metadict, error)=readMetadata(self.metalink)          (metadict, error)=readMetadata(self.metalink)
   
         #print "BLA"          
   
         if not error=="": #Fehler beim Auslesen des Metafiles          if not error=="": #Fehler beim Auslesen des Metafiles
             return "ERROR:",error              return "ERROR:",error
Line 294  class ECHO_resource(Folder): Line 431  class ECHO_resource(Folder):
                   
   
         self.metadata=metadict.keys()          self.metadata=metadict.keys()
         #return "BLUccssB"  
         self.label=self.generate_label()          self.label=self.generate_label()
                   
         if template=="yes":          if template=="yes":
             pt=PageTemplateFile('Products/ECHO_content/ECHO_resourceMD.zpt').__of__(self)              pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_resourceMD.zpt').__of__(self)
             return pt()              return pt()
           
     def ECHO_getMD(self,item):      def ECHO_getMD(self,item):
Line 313  class ECHO_resource(Folder): Line 450  class ECHO_resource(Folder):
     def generate_label(self):      def generate_label(self):
         """Erzeugt_standard_Label aus Template"""          """Erzeugt_standard_Label aus Template"""
         pt=getattr(self,"label_template_"+self.bib_type)          pt=getattr(self,"label_template_"+self.bib_type)
         #return pt  
         #pt.content_type="text/html; charset=utf-8"  
         return pt()  
   
 def manage_AddECHO_resourceForm(self):  
         """Nothing yet"""  
         pt=PageTemplateFile('Products/ECHO_content/AddECHO_resourceForm.zpt').__of__(self)  
         return pt()          return pt()
   
   def manage_addECHO_resourceForm(self):
           """Form for adding a ressource"""
           pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_resourceForm.zpt').__of__(self)
           return pt()
   
   
 def manage_AddECHO_resource(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,link,metalink,credits,weight,coords=None,RESPONSE=None):  
   
   
     """nothing yet"""  
     scientificClassificationObj=scientificClassification(context,science,practice)  
       
     scientificInformationObj=scientificInformation(source_type,period)  
           
   def manage_addECHO_resource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None):
       """addaresource"""
   
     newObj=ECHO_resource(id,link,metalink,title,label,description,content_type,responsible,credits,weight,coords)      newObj=ECHO_resource(id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords)
   
     self._setObject(id,newObj)      self._setObject(id,newObj)
     getattr(self,id)._setObject('scientific_Information',scientificInformationObj)  
     getattr(self,id).scientific_Information._setObject('scientific_Classification',scientificClassificationObj)  
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
     
Line 347  class ECHO_externalLink(Folder): Line 476  class ECHO_externalLink(Folder):
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
     meta_type='ECHO_externalLink'      meta_type='ECHO_externalLink'
   
       def getTitle(self):
       """title"""
       return self.title.encode('utf-8') 
   
       def getLabel(self):
       """title"""
       return self.label.encode('utf-8') 
   
       def content_html(self):
           """template fuer content"""
           return content_html(self,'externalLink')
   
     def __init__(self,id,link,title,label,description,content_type,responsible,credits,weight,coords):      def __init__(self,id,link,title,label,description,contentType,responsible,credits,weight,coords):
   
         self.id = id          self.id = id
         """Festlegen der ID"""          """Festlegen der ID"""
Line 359  class ECHO_externalLink(Folder): Line 499  class ECHO_externalLink(Folder):
         self.title=title          self.title=title
         self.weight=weight          self.weight=weight
         self.description=description          self.description=description
         self.content_type=content_type          self.contentType=contentType
         self.responsible=responsible          self.responsible=responsible
         coordsnew=[ string.split(x,",") for x in coords]          coordsnew=[ string.split(x,",") for x in coords]
         self.coords=coordsnew          self.coords=coordsnew
Line 372  class ECHO_externalLink(Folder): Line 512  class ECHO_externalLink(Folder):
         if not hasattr(self,'coords'):          if not hasattr(self,'coords'):
                           
             self.coords=['']              self.coords=['']
             print "G",self.coords              #print "G",self.coords
   
         pt=PageTemplateFile('Products/ECHO_content/ChangeECHO_externalLink.zpt').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_externalLink.zpt').__of__(self)
         return pt()          return pt()
           
   
     def changeECHO_externalLink(self,link,context,science,practice,source_type,period,title,label,description,content_type,responsible,credits,weight,coords,RESPONSE=None):      def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None):
   
         """Änderung der Properties"""          """Änderung der Properties"""
       try:
           coordsnew=[ string.split(x,",") for x in coords]
       except:
           coordsnew=[]
                   
           setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coords)
   
         setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,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 395  class ECHO_externalLink(Folder): Line 538  class ECHO_externalLink(Folder):
         {'label':'Main Config','action':'ECHO_externalLink_config'},          {'label':'Main Config','action':'ECHO_externalLink_config'},
         )          )
           
       def getCredits(self):
           """Ausgabe der credits"""
           if self.credits:
               return self.credits
           else:
               return []
           
     def index_html(self):      def index_html(self):
         """standard page"""          """standard page"""
                   
         return self.REQUEST.RESPONSE.redirect(self.link)          return self.REQUEST.RESPONSE.redirect(self.link)
   
 def manage_AddECHO_externalLinkForm(self):  def manage_addECHO_externalLinkForm(self):
         """Nothing yet"""          """Form for external Links"""
         pt=PageTemplateFile('Products/ECHO_content/AddECHO_externalLinkForm.zpt').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_externalLinkForm.zpt').__of__(self)
         return pt()          return pt()
   
   
 def manage_AddECHO_externalLink(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,link,credits,weight,coords,RESPONSE=None):  def manage_addECHO_externalLink(self,id,title,label,description,contentType,responsible,link,weight,coords=None,credits=None,RESPONSE=None):
       """Add an external Link"""
   
       newObj=ECHO_externalLink(id,link,title,label,description,contentType,responsible,credits,weight,coords)
   
       self._setObject(id,newObj)
   
       if RESPONSE is not None:
           RESPONSE.redirect('manage_main')
    
   
   class ECHO_link(ECHO_externalLink):
       """external_link"""
   
       meta_type="ECHO_link"
   
     """nothing yet"""  
     scientificClassificationObj=scientificClassification(context,science,practice)  
           
     scientificInformationObj=scientificInformation(source_type,period)      def content_html(self):
           """template fuer content"""
           return content_html(self,'link')
           
   def manage_addECHO_linkForm(self):
           """Form for external Links"""
           pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_linkForm.zpt').__of__(self)
           return pt()
   
   
   def manage_addECHO_link(self,id,title,label,description,contentType,responsible,link,weight,coords=None,credits=None,RESPONSE=None):
       """Add an external Link"""
   
     newObj=ECHO_externalLink(id,link,title,label,description,content_type,responsible,credits,weight,coords)      newObj=ECHO_link(id,link,title,label,description,contentType,responsible,credits,weight,coords)
   
     self._setObject(id,newObj)      self._setObject(id,newObj)
     getattr(self,id)._setObject('scientific_Information',scientificInformationObj)  
     getattr(self,id).scientific_Information._setObject('scientific_Classification',scientificClassificationObj)  
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
     
Line 427  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
   
       def getViewClassification(self):
           if hasattr(self,'viewClassification'):
               return self.viewClassification
           else:
               return ""
   
       def getTitle(self):
       """title"""
       return self.title.encode('utf-8') 
   
       def getLabel(self):
       """title"""
       return self.label.encode('utf-8') 
   
       def createRessourcesFromXMLForm(self):
           """form"""
           pt=PageTemplateFile('Products/ECHO_content/zpt/createRessourcesFromXMLForm.zpt').__of__(self)
           return pt()
       def createRessourcesFromXML(self,fileupload):
           """read an XML file for generating resources"""
           dom=xml.dom.minidom.parse(fileupload)
           ret="<h2>Added</h2>"
           for resource in dom.getElementsByTagName('resource'):
               link=getText(resource.getElementsByTagName('link')[0].childNodes)
               label=getText(resource.getElementsByTagName('label')[0].childNodes)
               #splitted=link.split("?")[0].split("/")
               #id=splitted[len(splitted)-1].encode('ascii')
               id=re.sub(" ","_",label).encode('ascii')
               
               ret+="<p>"+label+"</p>"
               manage_addECHO_resource(self,id,label.encode('ascii'),label.encode('ascii'),"","","",link.encode('ascii'),"","")
           return ret
       def getImageTag(self):
           """GetTag"""
           try:
               return self.imageTag
           except:
               return ""
   
       def addResource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None):
           """SSS"""
           try:
               manage_addECHO_resource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None)
               return "done"
           except:
               return None
   
       def getSecondaryLink(self):
           """secondary link"""
           try:
               return self.secondaryLink
           except:
               return ""
   
       def getSecondaryLinkTitle(self):
           """secondary link"""
           try:
               return self.secondaryLinkTitle
           except:
               return ""
   
       def getCollectionTreeXML(self):
           """Tree as XML"""
   
           def getCollection(object,depth=0):
               depth+=1
               collections=""
               for entry in object.__dict__.keys():
                   element=getattr(object,entry)
                   try:
                       if element.meta_type in ["ECHO_collection","ECHO_group"]:
                           collections+="<element name=\""+quote(element.title)+"\" url=\""+element.absolute_url()+"\">"
                           collections+=getCollection(element,depth)+"</element>\n"
                   except:
                       """nothing"""
               return collections
           
       ret="""<?xml version="1.0" encoding="utf-8" ?>"""
           return ret+"<collection>"+getCollection(self)+"</collection>"
       
       def createJavaScript(self):
           """CreateJava"""
           ret=javaScriptMain
   
           dynamical="\n"
           for ob in self.getGraphicCoords():
           if ob[4][4] == "":  
               dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0])
           else:
           dynamical+="""Coords.push(new Coord('%s', Img, %s));//%s\n"""%(ob[1],ob[0],ob[4][4])
           dynamical+="ShowArrow(new getObj('i.%s'),Img,%s);\n"%(ob[1],ob[0])
       ret+=javaHandler%dynamical
           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"""
           try:
         return getattr(self.partners,name)          return getattr(self.partners,name)
           except:
               return ""
           
     security.declarePublic('ECHO_generateNavBar')      security.declarePublic('ECHO_generateNavBar')
     def ECHO_generateNavBar(self):      def ECHO_generateNavBar(self):
Line 455  class ECHO_collection(Folder, Persistent Line 733  class ECHO_collection(Folder, Persistent
         return ret          return ret
           
     security.declarePublic('ECHO_rerenderLinksMD')      security.declarePublic('ECHO_rerenderLinksMD')
     def ECHO_rerenderLinksMD(self):      def ECHO_rerenderLinksMD(self,obj=None):
         """Rerender all Links"""          """Rerender all Links"""
         #print "HI"          if not obj:
         #return "OK"              obj = self
         for entry in self.__dict__.keys():  
             object=getattr(self,entry)  
                           
           entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection'])
                           
             try:          for entry in entries:
           if entry[1].meta_type == 'ECHO_resource':
               entry[1].ECHO_getResourceMD(template="no")
               print "rerender",entry[1].getId()
           else:
              self.ECHO_rerenderLinksMD(entry[1])
                                   
                 if object.meta_type == 'ECHO_resource':  
                                           
                     object.ECHO_getResourceMD(template="no")  
                       
             except:  
                 """nothing"""  
                                   
         return "Rerenderd all links to resources in: "+self.title          return "Rerenderd all links to resources in: "+self.title
           
       security.declarePublic('ECHO_newViewerLink')
   
     security.declarePublic('printall')  
     def printall(self):  
             return self.scientific_information.__dict__.keys()  
   
   
     def getCoords(self):      def getCoords(self):
Line 491  class ECHO_collection(Folder, Persistent Line 764  class ECHO_collection(Folder, Persistent
   
             return []              return []
                   
     def __init__(self,id,title,label,description,content_type,responsible,credits,weight,sortfield,coords):      def __init__(self,id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle,secondaryLink,imageTag="",bgcolour=""):
         #print "CO",coords          #print "CO",coords
   
         self.id = id          self.id = id
Line 500  class ECHO_collection(Folder, Persistent Line 773  class ECHO_collection(Folder, Persistent
         self.label = label          self.label = label
         self.title=title          self.title=title
         self.description=description          self.description=description
         self.content_type=content_type          self.contentType=contentType
         self.responsible=responsible          self.responsible=responsible
           self.imageTag=imageTag
         self.weight=weight          self.weight=weight
         self.sortfield=sortfield          self.sortfield=sortfield
         coordsnew=[ string.split(x,",") for x in coords]          coordsnew=[ string.split(x,",") for x in coords]
         self.coords=coordsnew          self.coords=coordsnew
           self.secondaryLinkTitle=secondaryLinkTitle
           self.secondaryLink=secondaryLink
       self.bgcolour=bgcolour
   
   
     manage_options = Folder.manage_options+(      manage_options = Folder.manage_options+(
         {'label':'Main Config','action':'ECHO_Collection_config'},          {'label':'Main Config','action':'ECHO_collection_config'},
         {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'},          {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'},
         {'label':'Graphics','action':'ECHO_graphicEntry'},          {'label':'Graphics','action':'ECHO_graphicEntry'},
       {'label':'create resources from XML','action':'createRessourcesFromXMLForm'},
   
         )          )
   
       def getOverview(self):
           """overview graphics"""
           
           return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1]
       
       
     def ECHO_graphicEntry(self):      def ECHO_graphicEntry(self):
         """DO nothing"""          """DO nothing"""
         if 'overview' in self.aq_parent.__dict__.keys():          overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])
             pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self)          
       
           if overview:
               pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self)
             return pt()              return pt()
         else:          else:
             return "NO OVERVIEW GRAPHICS"              return "NO OVERVIEW GRAPHICS"
Line 531  class ECHO_collection(Folder, Persistent Line 817  class ECHO_collection(Folder, Persistent
         temco.append(angle)          temco.append(angle)
         coords.append(temco)          coords.append(temco)
         self.coords=coords[0:]          self.coords=coords[0:]
         #pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self)  
         if RESPONSE is not None:          if RESPONSE is not None:
             RESPONSE.redirect('ECHO_graphicEntry')              RESPONSE.redirect('ECHO_graphicEntry')
   
           
     security.declarePublic('ECHO_Collection_config')      security.declarePublic('ECHO_collection_config')
     def ECHO_Collection_config(self):      def ECHO_collection_config(self):
         """Main configuration"""          """Main configuration"""
   
         if not hasattr(self,'weight'):          if not hasattr(self,'weight'):
Line 545  class ECHO_collection(Folder, Persistent Line 831  class ECHO_collection(Folder, Persistent
   
         if not hasattr(self,'sortfield'):          if not hasattr(self,'sortfield'):
             self.sortfield="weight"              self.sortfield="weight"
         #print "HI"    
         if not hasattr(self,'coords'):          if not hasattr(self,'coords'):
             self.coords=[]              self.coords=[]
   
         pt=PageTemplateFile('Products/ECHO_content/ChangeECHO_Collection.zpt').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_collection.zpt').__of__(self)
         return pt()          return pt()
   
   
     security.declarePublic('changeECHO_Collection')      security.declarePublic('changeECHO_collection')
   
   
     def changeECHO_Collection(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,credits,weight,sortfield="weight",coords="",RESPONSE=None):      def getBgcolour(self):
           """colour"""
           if hasattr(self,'bgcolour') and not (self.bgcolour==""):
               return self.bgcolour
           else:
               return "#dddddd"
   
       def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",viewClassification=None):
           """Aenderung der Properties"""
   
         """Änderung der Properties"""          self.secondaryLink=secondaryLink
         #print "HI",coords          self.secondaryLinkTitle=secondaryLinkTitle
           self.imageTag=imageTag
       self.bgcolour=bgcolour
           self.viewClassification=viewClassification
       
           if coords:
         coordsnew=[ string.split(x,",") for x in coords]          coordsnew=[ string.split(x,",") for x in coords]
         #print "HO",coordsnew              self.coords=coordsnew[0:]
         setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,credits,weight,coordsnew)          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 572  class ECHO_collection(Folder, Persistent Line 878  class ECHO_collection(Folder, Persistent
                           
     security.declarePublic('index_html')      security.declarePublic('index_html')
   
     showOverview=DTMLFile('ECHO_content_overview',globals())  
       def showOverview(self):
           """overview"""
           if 'ECHO_overview.html' in self.__dict__.keys():
               return getattr(self,'ECHO_overview.html')()
           pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_content_overview.zpt').__of__(self)
           return pt()
           
           
     def index_html(self):      def index_html(self):
         """standard page"""          """standard page"""
         #print self.objectIDs()  
                   
         if 'index.html' in self.__dict__.keys():          if 'index.html' in self.__dict__.keys():
             return getattr(self,'index.html')()              return getattr(self,'index.html')()
           
         elif 'overview' in self.__dict__.keys():          elif 'overview' in self.__dict__.keys():
             #print "HI"  
             return self.showOverview()              return self.showOverview()
           elif hasattr(self,'collection_index_template'):
               return self.collection_index_template()    
           elif hasattr(self,'main_index_template'):
               return self.main_index_template()    
                           
                   pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_main_index_template_standard.zpt').__of__(self)
         pt=PageTemplateFile('Products/ECHO_content/ECHO_content_standard.zpt').__of__(self)  
         pt.content_type="text/html"          pt.content_type="text/html"
         return pt()          return pt()
   
       def content_html(self):
           """template fuer content"""
           return content_html(self,'collection')
       
     def getCredits(self):      def getCredits(self):
         """Ausgabe der credits"""          """Ausgabe der credits"""
         if self.credits:          if self.credits:
Line 597  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]
             #print "OB:",object              if hasattr(object,'coords'):
               
             try:  
                 #print "MT:",object.meta_type  
                 if object.meta_type in subColTypes:  
                     #print "MT:",object.meta_type,object.getId()  
                     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]
                             if hasattr(object,'title'):                          label=""
                                 if not object.title=="":              vc=""
                                     ids.append([string.join(coord,", "),object.getId(),object.title])                          if hasattr(object,'label') and not object.label=="":
                               label=object.label
                           elif hasattr(object,'title') and not object.title=="":
                               label=object.title
                                 else:                                  else:
                                     ids.append([string.join(coord,", "),object.getId(),object.getId()])                              label=object.getId()
               if object.viewClassification != "":
                   vc=object.viewClassification
                             else:                              else:
                                 ids.append([string.join(coord,", "),object.getId(),object.getId()])                  if len(coordtemp) > 4 and coordtemp[4] != "":
                                       vc="view point"
             except:                  else:
                 """nothing"""                  vc="area"
         #print "IDS",ids                          ids.append([string.join(coord,", "),object.getId(),label,object,coordtemp,vc])
         return ids          return ids
           
     def getSubCols(self,sortfield="weight"):  
   
         subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource']  
         ids=[]  
         for entry in self.__dict__.keys():  
             object=getattr(self,entry)  
             #print "OB:",object  
                           
             try:  
                 #print "MT:",object.meta_type  
                 if object.meta_type in subColTypes:  
                     ids.append(object)  
                                           
             except:      getSubCols = ECHO_helpers.getSubCols
                 """nothing"""  
         try:  
             sortfield=self.sortfield  
         except:  
             """nothing"""  
                           
         tmplist=[]  
         for x in ids:  
             if hasattr(x,sortfield):  
                 try:  
                     x=int(x)  
                 except:  
                     """nothing"""  
                 tmp=getattr(x,sortfield)  
             else:  
                 tmp=10000000  
             tmplist.append((tmp,x))  
         tmplist.sort()  
         return [x for (key,x) in tmplist]  
             
                   
                   
   def manage_addECHO_collectionForm(self):
           """Add collection form"""
           pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_collectionForm.zpt').__of__(self)
           return pt()
                                   
           
   def manage_addECHO_collection(self,id,title,label,description,contentType,responsible,weight,sortfield,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour=""):
       """add a echo collection"""
           
 def manage_AddECHO_collectionForm(self):  
         """Nothing yet"""      newObj=ECHO_collection(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="")
         pt=PageTemplateFile('Products/ECHO_content/AddECHO_collectionForm.zpt').__of__(self)  
       self._setObject(id,newObj)
   
       if RESPONSE is not None:
           RESPONSE.redirect('manage_main')
   
   class ECHO_group(ECHO_collection):
       """ECHO Gruppe"""
       meta_type="ECHO_group"
   
       manage_options = Folder.manage_options+(
           {'label':'Main Config','action':'ECHO_group_config'},
           {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'},
           {'label':'Graphics','action':'ECHO_graphicEntry'},
           )
   
       def index_html(self):
           """standard page"""
           displayedObjects=self.ZopeFind(self,obj_metatypes=displayTypes)
           #if (len(displayedObjects)==1) and (displayedObjects[0][1].meta_type=="ECHO_collection"): # nur ein Object dann redirect auf dieses Object
           #   return self.REQUEST.RESPONSE.redirect(displayedObjects[0][1].absolute_url())
           
           if 'index.html' in self.__dict__.keys():
               return getattr(self,'index.html')()
           
           elif 'overview' in self.__dict__.keys():
               return self.showOverview()
           elif hasattr(self,'group_index_template'):
               return self.group_index_template()
           elif hasattr(self,'collection_index_template'):
               return self.collection_index_template()    
           elif hasattr(self,'main_index_template'):
               return self.main_index_template()    
   
           pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_main_index_template_standard.zpt').__of__(self)
           pt.content_type="text/html"
         return pt()          return pt()
   
       def ECHO_group_config(self):
           """Main configuration"""
           
           if not hasattr(self,'weight'):
               self.weight=""
               
           if not hasattr(self,'sortfield'):
               self.sortfield="weight"
                   
           if not hasattr(self,'coords'):
               self.coords=[]
   
           pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_group.zpt').__of__(self)
           return pt()
   
       def changeECHO_group(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",logo=""):
           """Änderung der Properties"""
   
           self.secondaryLink=secondaryLink
           self.secondaryLinkTitle=secondaryLinkTitle
           self.imageTag=imageTag
           self.bgcolour=bgcolour
                   self.logo=logo
                   
           if coords:
               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)
   
   
   
           self.sortfield=sortfield
   
           if RESPONSE is not None:
               RESPONSE.redirect('manage_main')
   
       def getLogo(self):    
           """logo ausgeben"""
                   try:
                       return self.logo
                   except:
                       return "ECHO_groups"
   
       def content_html(self):
           """template fuer content"""
           return content_html(self,'group')
       
   
 def manage_AddECHO_collection(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,weight,sortfield,coords,credits=None,RESPONSE=None):  
   
     """nothing yet"""  def manage_addECHO_groupForm(self):
     scientificClassificationObj=scientificClassification(context,science,practice)          """Add group form"""
           pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_groupForm.zpt').__of__(self)
           return pt()
   
           
     scientificInformationObj=scientificInformation(source_type,period)  def manage_addECHO_group(self,id,title,label,description,contentType,responsible,weight,sortfield,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour="",logo=""):
       """add a echo group"""
           
   
     newObj=ECHO_collection(id,title,label,description,content_type,responsible,credits,weight,sortfield,coords)      newObj=ECHO_group(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="")
   
       setattr(newObj,'logo',logo)
     self._setObject(id,newObj)      self._setObject(id,newObj)
     getattr(self,id)._setObject('scientific_Information',scientificInformationObj)      
     getattr(self,id).scientific_Information._setObject('scientific_Classification',scientificClassificationObj)  
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
   
   
       
 class ECHO_root(Folder,Persistent,Implicit):  class ECHO_root(Folder,Persistent,Implicit):
     """ECHO Root Folder"""      """ECHO Root Folder"""
     meta_type="ECHO_root"      meta_type="ECHO_root"
   
       
       def getImageTag(self):
           """needed by main_template"""
           return ""
       secondaryLink="" #needed by main_template
       secondaryLinkTitle="" #needed by main_template
       
       def getBgcolour(self):
       """hack"""
       return "#dddddd"
   
       def contentTypeSelector_HTML(self,selected=None):
           """give type selector"""
           if not selected:
               retStr="<option selected>\n"
           else:
               retStr="<option>\n"
               
           try: # erste version contentTypes exists
               for contentType in self.ZopeFind(self.contentTypes,obj_metatypes=["ECHO_contentType"]):
                   if selected and (contentType[0]==selected):
                       retStr+="""<option selected value="%s">%s\n"""%(contentType[0],contentType[0])
                   else:                
                       retStr+="""<option value="%s">%s\n"""%(contentType[0],contentType[0])
           except:
           try:
               for contentType in self.ZopeFind(self.standardMD,obj_metatypes=["OSAS_MetadataMapping"]):
                   if selected and (contentType[0]==selected):
                       retStr+="""<option selected value="%s">%s\n"""%(contentType[0],contentType[0])
                   else:                
                       retStr+="""<option value="%s">%s\n"""%(contentType[0],contentType[0])
           except:
               """nothing"""
                   
           return retStr
               
       def patchContentType(self,obj=None):
           """austauschen content_type with contentType (patch bei umstieg von alter Version)"""
       
   
           if not obj:
               obj = self
               
           entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection','ECHO_externalLink','ECHO_pageTemplate'])
   
           for entry in entries:
                   setattr(entry[1],'contentType',entry[1].content_type)
                   #entry[1].contentType == entry[1].content_type
   
                   if entry[1].meta_type == 'ECHO_collection':
                       entry[1].patchContentType(entry[1])    
   
                   
           return "changed all contenttypes in: "+self.title
   
   
       def patchViewClassification(self,obj=None):
           """setze viewClassification heuristisch"""
   
       def checkIfArrow(obj):
           if hasattr(obj,'coords'):
               for coordtemp in obj.coords:
                   print obj.title,len(coordtemp)
                   if (len(coordtemp)>4) and not (coordtemp[4]==''):
                       return 4
               return None
           return None
       
           if not obj:
               obj = self
               
           entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection','ECHO_group'])
   
           for entry in entries:
           
           if checkIfArrow(entry[1]):
               print "VP"
               setattr(entry[1],'viewClassification','view point')
           else:
               print "area"
               setattr(entry[1],'viewClassification','area')
   
                   #entry[1].contentType == entry[1].content_type
   
                   if entry[1].meta_type in ['ECHO_collection','ECHO_group']:
                       entry[1].patchViewClassification(entry[1])    
   
                   
           return "changed all contenttypes in: "+self.title
   
       def ECHO_newViewerLink(self,obj=None):
           """change links (:86 faellt weg)"""
   
           if not obj:
               obj = self
               
           entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection'])
   
           for entry in entries:
                   
                   if entry[1].meta_type == 'ECHO_resource':
                       
                       entry[1].link=re.sub('\:86','',entry[1].link)
   
                   else:
                       
                       entry[1].ECHO_newViewerLink(entry[1])
                   
           return "Rerenderd all links to resources in: "+self.title
   
     def __init__(self,id,title):      def __init__(self,id,title):
         """init"""          """init"""
         self.id = id          self.id = id
         self.title=title          self.title=title
                   
       def deleteSpace(self,str):
           """delete space at the end of a line"""
           if str[len(str)-1]==" ":
               return str[0:len(str)-1]
           else:
               return str
           
       
   
       # zusaetliche methoden fuer das vlp muessen in ein eigenes produkt
   
       def formatAscii(self,str,url=None):
           """ersetze ascii umbrueche durch <br>"""
           #url=None
           if url:
               
               retStr=""
               words=str.split("\n")
               
               for word in words:
                   strUrl=url%word
                   print "str",strUrl
                   retStr+="""<a href="%s">%s</a><br/>"""%(strUrl,word)
               str=retStr
           if str:
               return re.sub(r"[\n]","<br/>",str)
           else:
               return ""
           
       def link2html(self,str):
           """link2html fuer VLP muss hier noch raus"""
           if str:
               print str
               str=re.sub("\&","&amp;",str)
               dom=xml.dom.minidom.parseString("<?xml version='1.0' ?><txt>"+str+"</txt>")
               links=dom.getElementsByTagName("link")
               
               print "link",links
               for link in links:
                   link.tagName="a"
                   ref=link.getAttribute("ref")
                   if self.checkRef(ref):
                       link.setAttribute("href",self.aq_parent.absolute_url()+"/vlp_coll?id="+ref)
   
               return dom.toxml('utf-8')
           return ""
   
   
       def checkRef(self,ref):
           dbs={'vl_literature':'AND CD LIKE \'%lise%\'','vl_technology':'','vl_people':''}
           res=None
           for db in dbs.keys():
               #print ref,"select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db])
   
               res=res or self.search(var=str("select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db])))
           return res
                                       
       #Ende Methode fuer vlp
   
       def PgQuoteString(self,string):
           """Quote string"""
           #print "PG",string
           return libpq.PgQuoteString(string)
           
     def getPartners(self):      def getPartners(self):
         """Get list of Partners. Presently only from a subfolder partners"""          """Get list of Partners. Presently only from a subfolder partners"""
         partnerTypes=['ECHO_partner']  
         ids=[]  
         for entry in self.partners.__dict__.keys():  
             object=getattr(self.partners,entry)  
                           
             try:          return [ item[1] for item in self.partners.ZopeFind(self.partners,obj_metatypes=['ECHO_partner'])]
                                   
                 if object.meta_type in partnerTypes:  
                     ids.append(object)  
                                           
             except:  
                 """nothing"""  
                                   
         return ids  
       
       def getPartnersXML(self):
           """partner liste als xml""" 
           partners=self.getPartners()
           ret="""<?xml version="1.0" encoding="utf-8" ?>
       <partners>"""
           
       for partner in partners:
               ret+="""<partner id="%s" title="%s"/>\n"""%(partner.getId(),unicode(partner.title,'utf-8','replace'))
   
           return ret+"\n</partners>"
   
     def getCollectionTree(self):      def getCollectionTree(self):
         """get the collection tree (list of triples (parent,child, depth)"""          """get the collection tree (list of triples (parent,child, depth)"""
Line 740  class ECHO_root(Folder,Persistent,Implic Line 1320  class ECHO_root(Folder,Persistent,Implic
   
                   
                   
 def manage_AddECHO_root(self,id,title,RESPONSE=None):  def manage_addECHO_root(self,id,title,RESPONSE=None):
     """Add an ECHO_root"""      """Add an ECHO_root"""
     self._setObject(id,ECHO_root(id,title))      self._setObject(id,ECHO_root(id,title))
           
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
   
 def manage_AddECHO_rootForm(self):  def manage_addECHO_rootForm(self):
         """Nothing yet"""          """Nothing yet"""
         pt=PageTemplateFile('Products/ECHO_content/AddECHO_root.zpt').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_root.zpt').__of__(self)
         return pt()          return pt()
     
 class ECHO_partner(Image,Persistent):  class ECHO_partner(Image,Persistent):
Line 783  class ECHO_partner(Image,Persistent): Line 1363  class ECHO_partner(Image,Persistent):
         """Main configuration"""          """Main configuration"""
         if not hasattr(self,'url'):          if not hasattr(self,'url'):
             self.url=""              self.url=""
         pt=PageTemplateFile('Products/ECHO_content/ChangeECHO_partner.zpt').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_partner.zpt').__of__(self)
         return pt()          return pt()
   
                   
 manage_AddECHO_partnerForm=DTMLFile('ECHO_partnerAdd',globals(),  manage_addECHO_partnerForm=DTMLFile('dtml/ECHO_partnerAdd',globals(),
                              Kind='ECHO_partner',kind='ECHO_partner')                               Kind='ECHO_partner',kind='ECHO_partner')
   
   
   
 def manage_AddECHO_partner(self, id, file,url, title='', precondition='', content_type='',  def manage_addECHO_partner(self, id, file,url, title='', precondition='', content_type='',
                     REQUEST=None):                      REQUEST=None):
     """      """
     Add a new ECHO_partner object.      Add a new ECHO_partner object.

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


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