- Timestamp:
- 2 Aug 2009, 14:08:18 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/certificate.py
r4503 r4516 10 10 ICertificateCourse, ICourse, IDepartment) 11 11 from waeup.viewlets import FormWrapMixin, Index, Manage, MainArea 12 from waeup.utils.helpers import getName 12 13 13 14 class Certificate(grok.Container): … … 104 105 return implementedBy(CertificateCourse) 105 106 107 class ContentHeader(grok.Viewlet): 108 """A viewlet that renders the faculty, department and course title. 109 """ 110 grok.viewletmanager(MainArea) 111 grok.context(ICertificate) 112 grok.view(Index) 113 grok.order(2) 114 115 def render(self): 116 return '''<h5>%s</h5><h4>%s</h4><h3>%s</h3>''' % ( 117 getName(self.context.__parent__.__parent__.__parent__), 118 getName(self.context.__parent__.__parent__), 119 self.context.title) 120 106 121 class DisplayForm(grok.DisplayForm): 107 122 grok.context(ICertificate) … … 118 133 # to be rendered in this viewlet. 119 134 135 120 136 class ManageForm(grok.EditForm): 121 137 """Manage the basic properties of a `Department` instance. … … 156 172 # be rendered in this viewlet. 157 173 174 class CourseList(grok.Viewlet): 175 grok.viewletmanager(MainArea) 176 grok.context(ICertificate) 177 grok.view(Index) 178 grok.order(2) 179 180 def render(self): 181 result = '<h3>Courses</h4>\n' 182 for key, course in self.context.items(): 183 certcourse = self.context[key] 184 course = certcourse.course 185 result += '<div><a href="%s">%s</a>%s (%s / %s)</div>' % ( 186 self.view.url(course), course.code, course.title, 187 certcourse.level, certcourse.core_or_elective) 188 return result 158 189 159 190 @grok.subscribe(ICourse, grok.IObjectRemovedEvent)
Note: See TracChangeset for help on using the changeset viewer.