Diff for /ECHO_content/ECHO_helpers.py between versions 1.53 and 1.57

version 1.53, 2005/06/09 16:35:51 version 1.57, 2005/07/20 11:30:28
Line 12  from Globals import package_home Line 12  from Globals import package_home
 import Globals  import Globals
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
 import os.path  import os.path
   from OFS.Folder import Folder
   import ECHO_collection
   
 displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','ECHO_movie']  displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','ECHO_movie']
   
Line 36  class ECHO_basis: Line 38  class ECHO_basis:
     """basis eigenschaften fuer echo objekte"""      """basis eigenschaften fuer echo objekte"""
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
     security.declarePublic('getImageTag')      security.declarePublic('getImageTag')
   
       def manage_addECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None):
           return ECHO_collection.manage_addECHO_locale(self,lang,title,label)
           
     def getImageTag(self):      def getImageTag(self):
         """sollte uerberschrieben werden, falls von der Klasse eine imagetag zurueckkommt"""          """sollte uerberschrieben werden, falls von der Klasse eine imagetag zurueckkommt"""
                   
Line 116  class ECHO_basis: Line 122  class ECHO_basis:
                   
     def getTitle(self):      def getTitle(self):
     """title"""      """title"""
       lang=self.getLanguage()
       locale=None
       if lang and not (lang =="de"):
           locale=self.ZopeFind(self,obj_ids=["locale_"+lang])
   
       if locale:
           return self.decode(locale[0][1].title)
       else:
     return self.decode(self.title)      return self.decode(self.title)
   
   
     try:      try:
         return self.title.encode('utf-8','ignore')           return self.title.encode('utf-8','ignore') 
     except:      except:
Line 125  class ECHO_basis: Line 141  class ECHO_basis:
           
     def getLabel(self):      def getLabel(self):
     """title"""      """title"""
       lang=self.getLanguage()
       locale=None
       if lang and not (lang=="de"):
           locale=self.ZopeFind(self,obj_ids=["locale_"+lang])
   
       if locale:
           return self.decode(locale[0][1].label)
       
   
     if not hasattr(self,'label'):      if not hasattr(self,'label'):
         self.label=""          self.label=""
                   
Line 178  class ECHO_basis: Line 203  class ECHO_basis:
   
     def getMapAreas(self):      def getMapAreas(self):
         """returns the list of MapAreas"""          """returns the list of MapAreas"""
       forcetypes = self.REQUEST.get('map_force_types', None)
       if forcetypes:
           typelist = forcetypes.split(',')
       else:
           typelist = None
       areas = []
     # get all contained MapAreas      # get all contained MapAreas
         areas = [res[1] for res in self.ZopeFind(self, obj_metatypes=('MapArea'))]          for res in self.ZopeFind(self, obj_metatypes=('MapArea')):
           area = res[1]
           # check the allowed types
           if typelist is not None and area.getType() not in typelist:
           continue
           areas.append(area)
     return areas      return areas
   
     def addMapArea(self, newarea):      def addMapArea(self, newarea):
Line 197  class ECHO_basis: Line 233  class ECHO_basis:
     def getMapText(self):      def getMapText(self):
         """returns the MapText"""          """returns the MapText"""
     # get (the first) contained MapText      # get (the first) contained MapText
       #lang="en"
       lang=self.getLanguage()
       res=None
       if lang and not (lang=="de"):
           resTmp = self.ZopeFind(self, obj_metatypes=('ECHO_mapText'))
           res = self.ZopeFind(resTmp[0][1])
   
       if not res:
         res = self.ZopeFind(self, obj_metatypes=('ECHO_mapText'))          res = self.ZopeFind(self, obj_metatypes=('ECHO_mapText'))
     if len(res) > 0:      if len(res) > 0:
         text = res[0][1]          text = res[0][1]
Line 235  class ECHO_basis: Line 279  class ECHO_basis:
         area.setAngle(angle)          area.setAngle(angle)
         area.setType(type)          area.setType(type)
         area.setPermanent(permanent)          area.setPermanent(permanent)
     # add new area      # add the "new" area
     if self.REQUEST.has_key('add'):      if self.REQUEST.has_key('add'):
         coordstring = self.REQUEST.get('coords.new', '')          coordstring = self.REQUEST.get('coords.new', '')
         coords = string.split(coordstring, ',')          coords = string.split(coordstring, ',')
         angle = self.REQUEST.get('angle.new', '0')          angle = self.REQUEST.get('angle.new', '0')
         type = self.REQUEST.get('type.new', 'area')          type = self.REQUEST.get('type.new', 'area')
         permanent = self.REQUEST.get('permanent.'+id, '')          permanent = self.REQUEST.get('permanent.new', '')
         if len(coords) == 4:          if len(coords) == 4:
         coords.append(angle)          coords.append(angle)
         area = MapArea(None, coords, type=type, permanent=permanent)          area = MapArea(None, coords, type=type, permanent=permanent)
Line 252  class ECHO_basis: Line 296  class ECHO_basis:
   
     def createJSAreas(self, areas):      def createJSAreas(self, areas):
         """create area calls for JavaScript"""          """create area calls for JavaScript"""
       forceperm = self.REQUEST.get('map_force_permanent', None)
         js="\n"          js="\n"
         for ob in areas:          for ob in areas:
         js+="""addArea('%s', 'overview', %s, '%s', '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType(),ob.isPermanent())          # check for force-permanent
           if forceperm is not None:
           perm = forceperm
           else:
           perm = ob.isPermanent()
           js+="""addArea('%s', 'overview', %s, '%s', '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType(),perm)
         return js          return js
   
     def createMapHead(self):      def createMapHead(self):
Line 292  class ECHO_basis: Line 342  class ECHO_basis:
     tag = ""      tag = ""
     if bt.isN4:      if bt.isN4:
         # N4 needs layer for highlighting          # N4 needs layer for highlighting
         tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)          tag += '<ilayer id="a.%s"><a class="maplink" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)
         tag += ">" + text + "</a></ilayer>"          tag += ">" + text + "</a></ilayer>"
     else:      else:
         # a-element          # a-element
         tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)          tag = '<a id="a.%s" class="maplink" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)
         if tiptext:          if tiptext:
         tag += ' title="%s"'%tiptext          tag += ' title="%s"'%tiptext
         tag += ">" + text + "</a>"          tag += ">" + text + "</a>"
Line 322  class ECHO_basis: Line 372  class ECHO_basis:
         if float(rot) < 0:          if float(rot) < 0:
             marksrc = circlesrc              marksrc = circlesrc
         tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,marksrc,rot)          tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,marksrc,rot)
           elif ob.isTypeText():
           # N4 - Text
           tag += '<div id="t.%s" class="maptext"'%(id)
           tag += 'style="visibility:hidden">'
           tag += ob.getText()
           tag += '</div>'
         else:          else:
         # N4 - Area          # N4 - Area
         tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link)          tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link)
Line 333  class ECHO_basis: Line 389  class ECHO_basis:
         #          #
         # (more or less) DOM capable browser          # (more or less) DOM capable browser
         #          #
         tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s">'%(id,id,id,link,target)          tag = '<a id="b.%s" class="mapmarklink" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s">'%(id,id,id,link,target)
         if ob.isTypeArrow():          if ob.isTypeArrow():
         # DOM - Arrow          # DOM - Arrow
         rot = ob.angle          rot = ob.angle
Line 1043  class MapArea(SimpleItem): Line 1099  class MapArea(SimpleItem):
 Globals.InitializeClass(MapArea)  Globals.InitializeClass(MapArea)
   
   
 class MapText(ZopePageTemplate):  class MapText(Folder,ZopePageTemplate):
     """class to hold text for map areas"""      """class to hold text for map areas"""
   
     meta_type = 'ECHO_mapText'      meta_type = 'ECHO_mapText'
Line 1061  class MapText(ZopePageTemplate): Line 1117  class MapText(ZopePageTemplate):
             text = open(self._default_content_fn).read()              text = open(self._default_content_fn).read()
         self.pt_edit(text, content_type)          self.pt_edit(text, content_type)
   
       def createLocale(self):
           """create locale"""
           return ECHO_collection.manage_addECHO_localeForm(self)
   
       def manage_addECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None):
           """manage add echo locale in map"""
           ECHO_collection.manage_addECHO_locale(self,lang,title,label,text,content_type)
           if RESPONSE is not None:
               RESPONSE.redirect('manage_main')
   
   
       def changeLocale(self):
          """change locale"""
          return self.locale_en.change_ECHO_localeForm()
   
       def change_ECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None):
           """change echo locale"""
   
           obj= self.locale_en.change_ECHO_locale(lang,title,label,text,content_type,RESPONSE)
       
   
   
           if RESPONSE is not None:
               RESPONSE.redirect('manage_main')
   
           
 # Product registration and Add support  # Product registration and Add support
 manage_addMapTextForm = PageTemplateFile(  manage_addMapTextForm = PageTemplateFile(
     'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm')      'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm')

Removed from v.1.53  
changed lines
  Added in v.1.57


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