Changeset 4494 for waeup/branches


Ignore:
Timestamp:
31 Jul 2009, 09:37:30 (15 years ago)
Author:
uli
Message:
  • Add a column with delete buttons in courses table for departments. Only added/displayed, if the user has permission 'waeup.manageUniversity' on the courses container.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/tables.py

    r4461 r4494  
    77from waeup.widgets.table import YUITable as Table
    88from waeup.widgets.table import Col
     9from zope.security.management import checkPermission
    910
    1011class CodeAndTitleTableProvider(grok.Adapter):
     
    8990                data = tuple([data[x].title for x in data])),
    9091            )
     92        delcol = Col(header='', sortable=False,
     93                     data = [
     94                '<form method="post">'
     95                '<input type="submit" name="delcourse" value="Delete" />'
     96                '<input type="hidden" name="code" value="%s" />'
     97                '</form>' % (data[x].code)
     98                for x in data])
     99
     100        if checkPermission('waeup.manageUniversity', self.context.courses):
     101            cols = list(cols)
     102            cols.append(delcol)
     103            cols = tuple(cols)
    91104        self.coursetable = Table('Courses', cols=cols)
    92105
Note: See TracChangeset for help on using the changeset viewer.