- Timestamp:
- 12/23/09 06:06:58 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
enpraxis.educommons/trunk/enpraxis/educommons/portlet/simplenavportlet.py
r506 r632 58 58 'getExcludeFromNav':False, 59 59 'sort_on':'getObjPositionInCourse'} 60 61 60 brains = self.context.portal_catalog.searchResults(path) 62 61 62 elif self.isDivisionObject(): 63 parent = self.getDivisionParent() 64 path = {'path':{'query':'/'.join(parent.getPhysicalPath())+'/'}, 65 'getExcludeFromNav':False, 66 'portal_type':'Division', 67 'sort_on':'sortable_title'} 68 brains = self.context.portal_catalog.searchResults(path) 69 63 70 else: 64 brains = self.context.portal_catalog.searchResults(Type='Division', 65 sort_on='sortable_title') 71 brains = self.context.portal_catalog.searchResults(Type='School', 72 sort_on='sortable_title') 73 if len(brains) == 0: 74 brains = self.context.portal_catalog.searchResults(Type='Division', 75 sort_on='sortable_title') 76 77 66 78 return [obj for obj in brains if not getattr(obj.aq_explicit, 'exclude_from_nav', True)] 67 79 … … 70 82 return 'Course' == self.ecparent.Type() 71 83 84 def isDivisionObject(self): 85 """ Check if this object is in a Division. """ 86 return 'Division' == self.ecparent.Type() 87 88 def getDivisionParent(self): 89 """ Check if parent is Division of Portal. """ 90 if self.aq_parent.aq_inner.aq_parent.portal_type == 'School': 91 return self.aq_parent.aq_inner.aq_parent 92 else: 93 return self.context.portal_url.getPortalObject() 94 72 95 def isSelected(self, item): 73 """ Check if the naviga ion item is the one being displayed. """96 """ Check if the navigation item is the one being displayed. """ 74 97 if '/'.join(item.getPath().split('/')[1:]) == self.context.virtual_url_path(): 75 98 return 'portletItem portletItemSelected' … … 82 105 if self.isCourseObject(): 83 106 return ts.translate(ecprops.course_descriptor) 107 elif self.isDivisionObject(): 108 return ecprops.division_descriptor 84 109 else: 85 return ecprops.division_descriptor 110 brains = self.context.portal_catalog.searchResults(Type='School', 111 sort_on='sortable_title') 112 if len(brains) == 0: 113 return ecprops.division_descriptor 114 return ecprops.school_descriptor 86 115 87 116 def get_view_url(self, item):
