diff -r 66ff0b2f7d03 -r 99f5852f8604 web/views/euser.py --- a/web/views/euser.py Mon Feb 16 16:24:24 2009 +0100 +++ b/web/views/euser.py Mon Feb 16 18:26:13 2009 +0100 @@ -10,12 +10,30 @@ from logilab.mtconverter import html_escape from cubicweb.schema import display_name +from cubicweb.common.selectors import one_line_rset, implements, match_user_groups from cubicweb.web import INTERNAL_FIELD_VALUE from cubicweb.web.form import EntityForm +from cubicweb.web.action import Action from cubicweb.web.views.baseviews import PrimaryView, EntityView + +class UserPreferencesEntityAction(Action): + id = 'prefs' + __selectors__ = (one_line_rset, + implements('EUser'), + match_user_groups('owners', 'managers')) + + title = _('preferences') + category = 'mainactions' + + def url(self): + login = self.rset.get_entity(self.row or 0, self.col or 0).login + return self.build_url('euser/%s'%login, vid='epropertiesform') + + class EUserPrimaryView(PrimaryView): - accepts = ('EUser',) + __selectors__ = (implements('EUser'),) + skip_attrs = ('firstname', 'surname') def iter_relations(self, entity): @@ -34,7 +52,8 @@ ] class FoafView(EntityView): id = 'foaf' - accepts = ('EUser',) + __selectors__ = (implements('EUser'),) + title = _('foaf') templatable = False content_type = 'text/xml' @@ -54,7 +73,6 @@ ''' % (entity.absolute_url(), entity.absolute_url())) - self.w(u'\n' % entity.eid) self.w(u'%s\n' % html_escape(entity.dc_long_title())) if entity.surname: @@ -68,11 +86,13 @@ self.w(u'%s\n' % html_escape(emailaddr)) self.w(u'\n') + class FoafUsableView(FoafView): id = 'foaf_usable' def call(self): self.cell_call(0, 0) + class EditGroups(EntityForm): """displays a simple euser / egroups editable table"""