- Timestamp:
- 21 Jul 2009, 14:51:19 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/app.py
r4165 r4409 12 12 from waeup.datacenter import DataCenter 13 13 from waeup.users import UserContainer 14 from waeup.widgets.interfaces import ITableProvider 15 from waeup.widgets.table import Table, Col, YUITable 14 16 15 17 class University(grok.Application, grok.Container): … … 93 95 # be rendered in this viewlet. 94 96 97 class FacultyTableProvider(grok.Adapter): 98 grok.context(IUniversity) 99 grok.provides(ITableProvider) 100 101 def __init__(self, context): 102 self.context = context 103 data = self.context.faculties 104 cols = ( 105 Col( 106 header='Code', sortable=True, 107 data = tuple(['<a href="faculties/%s">%s</a>' % ( 108 data[x].code, data[x].code) for x in data])), 109 Col( 110 header='Prefix', sortable=True, 111 data = tuple([data[x].title_prefix for x in data])), 112 Col( 113 header='Title', sortable=True, 114 data = tuple([data[x].title for x in data])), 115 ) 116 self.table = YUITable('Faculties', cols=cols) 117 118 def getTable(self): 119 return self.table 120 95 121 class Content(grok.Viewlet): 96 122 grok.viewletmanager(MainArea) 97 123 grok.context(IUniversity) 98 124 grok.view(Index) 125 126 def update(self): 127 self.table = ITableProvider(self.context).getTable() 128 self.table.need() 99 129 100 130 class ManageLink(grok.Viewlet): … … 141 171 def render(self): 142 172 return u'<div class="portlet"><a href="datacenter">Data Center</a></div>' 143
Note: See TracChangeset for help on using the changeset viewer.