--- ECHO_content/ECHO_collection.py 2010/10/11 13:15:00 1.309 +++ ECHO_content/ECHO_collection.py 2011/11/03 11:05:25 1.311 @@ -57,6 +57,7 @@ import Ft.Xml.XPath import cStringIO import sys +import logging try: from psycopg import libpq @@ -701,6 +702,39 @@ class ECHO_collection(CatalogAware, Fold path="/mpiwg/online/permanent/shipbuilding" + def getSection(self, crumbs=None): + """returns the current section name""" + # use breadcrumbs if available + if crumbs is not None and len(crumbs) > 0: + return crumbs[0][2].getId() + + p = self + + sec = None + # descend parents to the root (and remember the last id) + while p is not None and p.meta_type != 'ECHO_root' and p.meta_type!='ECHO_main' and p.meta_type!='ECHO_nav': + sec = p.getId() + p = p.aq_parent + + return sec + + def getSubSection(self, crumbs=None): + """returns the current subsection name""" + # use breadcrumbs if available + if crumbs is not None and len(crumbs) > 1: + return crumbs[1][2].getId() + + p = self + sec = None + subsec = None + # descend parents to the root (and remember the last id) + while p is not None and p.meta_type != 'ECHO_root' and p.meta_type!='ECHO_main' and p.meta_type!='ECHO_nav': + subsec = sec + sec = p.getId() + p = p.aq_parent + + return subsec + def exportImportObjects_html(self,RESPONSE): """ImportObject""" @@ -1472,8 +1506,15 @@ class ECHO_collection(CatalogAware, Fold def showOverview(self): """overview""" + # ECHO_overview.html template for this instance if 'ECHO_overview.html' in self.__dict__.keys(): return getattr(self,'ECHO_overview.html')() + + # ECHO_overview_main template in path + if hasattr(self, 'ECHO_overview_main'): + return getattr(self, 'ECHO_overview_main')() + + # template from product pt=zptFile(self, 'zpt/ECHO_content_overview.zpt') return pt() @@ -1896,6 +1937,8 @@ class ECHO_root(Folder,Persistent,Implic ) + + def getECHORootURL(self): return self.absolute_url()