Ignore:
Timestamp:
2 Jan 2010, 14:06:54 (15 years ago)
Author:
uli
Message:

Add a user edit form page, which is also the default view for single
accounts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/browser/pages.py

    r4627 r4632  
    44import grok
    55from waeup.browser import WAeUPPage, WAeUPEditFormPage
    6 from waeup.interfaces import IUniversity, IWAeUPObject, IUserContainer
     6from waeup.interfaces import (IUniversity, IWAeUPObject, IUserContainer,
     7                              IUserAccount)
    78from waeup.widgets.interfaces import ITableProvider
    89from zope.app.security.interfaces import (IAuthentication,
     
    114115   
    115116class UserContainerPage(WAeUPPage):
     117    """Overview page for all local users.
     118    """
    116119    grok.require('waeup.manageUsers')
    117120    grok.context(IUserContainer)
     
    125128            self.context.delUser(userid)
    126129            self.flash('User %s successfully deleted.' % userid)
     130
     131class UserEditFormPage(WAeUPEditFormPage):
     132    """Edit a user account.
     133    """
     134    grok.context(IUserAccount)
     135    grok.name('index')
     136   
     137    form_fields = grok.AutoFields(IUserAccount)
     138    grok.require('waeup.manageUsers')
     139
     140    title = "Edit user"
     141
     142    @grok.action('Save')
     143    def save(self, **data):
     144        self.applyData(self.context, **data)
     145        self.flash('User settings have been saved.')
     146        return
     147   
     148    @grok.action('Save and return')
     149    def saveAndReturn(self, **data):
     150        self.applyData(self.context, **data)
     151        self.flash('User settings have been saved.')
     152        self.redirect(self.url(self.context.__parent__))
     153        return
     154
     155    @grok.action('Cancel')
     156    def cancel(self, **data):
     157        self.redirect(self.url(self.context.__parent__))
     158        return
Note: See TracChangeset for help on using the changeset viewer.