Diff for /ECHO_content/ECHO_helpers.py between versions 1.103.2.3 and 1.103.2.5

version 1.103.2.3, 2012/01/17 18:39:07 version 1.103.2.5, 2012/08/27 09:45:33
Line 11  from OFS.SimpleItem import SimpleItem Line 11  from OFS.SimpleItem import SimpleItem
 from Globals import package_home  from Globals import package_home
 import Globals  import Globals
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
   from Acquisition import aq_parent,aq_chain,aq_base
 import os.path  import os.path
 from OFS.Folder import Folder  from OFS.Folder import Folder
 import ECHO_collection  import ECHO_collection
Line 263  class ECHO_basis: Line 264  class ECHO_basis:
                 locale=self.ZopeFind(self,obj_ids=["locale_"+lang])                  locale=self.ZopeFind(self,obj_ids=["locale_"+lang])
   
         if locale:          if locale:
                 return self.decode(locale[0][1].title)                  return unicodify(locale[0][1].title)
         else:                  
             try:          return unicodify(self.title)
                 return self.decode(self.title)  
             except:      
                 return self.title  
                   
     def getLabel(self):      def getLabel(self):
         """title"""          """title"""
Line 295  class ECHO_basis: Line 293  class ECHO_basis:
                         ret=self.getId()                          ret=self.getId()
                 return ret                  return ret
                   
         return self.decode(self.label)          return unicodify(self.label)
               
     def changeECHOEntriesForm(self):      def changeECHOEntriesForm(self):
         """change Entries for the ECHO Navigation environment"""          """change Entries for the ECHO Navigation environment"""
Line 372  class ECHO_basis: Line 370  class ECHO_basis:
                 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]
             return text              return unicodify(text)
         return None          return None
   
     def ECHO_graphicEntry(self):      def ECHO_graphicEntry(self):
Line 480  class ECHO_basis: Line 478  class ECHO_basis:
             text = "link"              text = "link"
                           
         tiptext = ob.getTip()          tiptext = ob.getTip()
   
         tag = ""          tag = ""
         if bt['isN4']:          if bt['isN4']:
             # N4 needs layer for highlighting              # N4 needs layer for highlighting
Line 490  class ECHO_basis: Line 489  class ECHO_basis:
             tag = '<a id="a.%s" class="maplink" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" %s %s'%(id,id,id,href,targetattr)              tag = '<a id="a.%s" class="maplink" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" %s %s'%(id,id,id,href,targetattr)
             if tiptext:              if tiptext:
                 tag += ' title="%s"'%tiptext                  tag += ' title="%s"'%tiptext
             tag += ">" + text + "</a>"  
               logging.debug("createMapLink: text=%s"%repr(text))
               tag += ">%s</a>"%text
   
         return tag          return tag
   
     def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil", circlesrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/kreis", target="_blank",backLink=None,alternativArrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil_blau"):      def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil", circlesrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/kreis", target="_blank",backLink=None,alternativArrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil_blau"):
Line 510  class ECHO_basis: Line 512  class ECHO_basis:
         else:          else:
             targetattr = 'target="%s"'%target              targetattr = 'target="%s"'%target
         tiptext = ob.getTip()          tiptext = ob.getTip()
         tag = ""  
   
           tag = ""
         if bt['isN4']:          if bt['isN4']:
             #              #
             # N4 needs layer and img elements              # N4 needs layer and img elements
Line 694  def checkOnlyOneInGroup(object): Line 696  def checkOnlyOneInGroup(object):
         else:           return object          else:           return object
   
   
   
   def getCrumb(self):
       """returns breadcrumb for this object"""
       # ignore this object if title is empty
       if not self.title:
           return None
       
       crumb = {'obj': self,
                'url': self.absolute_url(),
                'label': self.getLabel()}
       return crumb        
   
   # roots of the ECHO hierarchy
   rootMetaTypes = ['ECHO_root', 'ECHO_main', 'ECHO_nav']
   
   def getHierCrumbs(self):
       """returns a list of hierarchical breadcrumbs from self to the ECHO_root"""
       crumbs = []
       # walk the acquisition chain
       for obj in aq_chain(self):
           #logging.debug("getHiercrumbs: obj=%s"%(obj))
           # test if the object really has a getCrumb method
           if hasattr(aq_base(obj), 'getCrumb'):
               crumb = obj.getCrumb()
               #logging.debug("getHiercrumbs: got %s from %s"%(crumb,obj))
               if crumb is not None:
                   crumbs.insert(0, crumb)
                   
               if obj.meta_type in rootMetaTypes:
                   # stop when we reach the ECHO root
                   return crumbs
           
       return crumbs        
   
   
 def getSubCols(self, sortfield=None,   def getSubCols(self, sortfield=None, 
                subColTypes=displayTypes,                  subColTypes=displayTypes, 
                sortFieldMD=None,                 sortFieldMD=None,
Line 1237  class MapArea(SimpleItem): Line 1274  class MapArea(SimpleItem):
         if self.tip is None:          if self.tip is None:
             if hasattr(self, 'aq_parent'):              if hasattr(self, 'aq_parent'):
                 parent = self.aq_parent                  parent = self.aq_parent
                   # text-popup type
                 if parent.contentType == 'text-popup':                  if parent.contentType == 'text-popup':
                     return parent.description                      return unicodify(parent.description)
         return self.tip  
                   # use map-text
                   text = parent.getMapText()
                   if text is not None:
                       return text()
   
           return unicodify(self.tip)
   
     def setTip(self, text):      def setTip(self, text):
         """sets the text"""          """sets the text"""
         self.tiptext = text          self.tiptext = text
   
     def getText(self):      def getText(self):
         """returns the text fpr the area"""          """returns the text for the area"""
         if hasattr(self, 'aq_parent'):          if hasattr(self, 'aq_parent'):
             parent = self.aq_parent              parent = self.aq_parent
             text = parent.getMapText()              text = parent.getMapText()
Line 1259  class MapArea(SimpleItem): Line 1303  class MapArea(SimpleItem):
         """returns the link label"""          """returns the link label"""
         if self.label is None:          if self.label is None:
             if hasattr(self, 'aq_parent'):              if hasattr(self, 'aq_parent'):
                 return self.aq_parent.label or self.aq_parent.id                  return unicodify(self.aq_parent.label or self.aq_parent.id)
         return self.label          return unicodify(self.label)
   
     def getTargetUrl(self):      def getTargetUrl(self):
         """returns the URL of the linked object"""          """returns the URL of the linked object"""

Removed from v.1.103.2.3  
changed lines
  Added in v.1.103.2.5


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