Changeset 6126 for main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
- Timestamp:
- 18 May 2011, 15:57:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6106 r6126 14 14 from hurry.workflow.interfaces import NoTransitionAvailableError 15 15 from zope import schema 16 from waeup.sirp.browser.resources import warning, datepicker, tabs, datatable17 16 try: 18 17 from zope.authentication.interfaces import ( … … 22 21 from zope.app.security.interfaces import ( 23 22 IAuthentication, IUnauthenticatedPrincipal, ILogout) 23 from zope.securitypolicy.interfaces import IPrincipalRoleManager, IPrincipalRoleMap 24 24 from zope.component import ( 25 25 getUtility, createObject,getAllUtilitiesRegisteredFor) … … 27 27 from zope.exceptions import DuplicationError 28 28 from zope.session.interfaces import ISession 29 29 from waeup.sirp.browser.resources import warning, datepicker, tabs, datatable 30 30 from waeup.sirp.browser import ( 31 31 WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, … … 40 40 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor) 41 41 from waeup.sirp.university.catalog import search 42 from waeup.sirp.university.faculty import local_roles as faculty_local_roles 42 43 from waeup.sirp.university.vocabularies import course_levels 43 44 from waeup.sirp.widgets.restwidget import ReSTDisplayWidget … … 950 951 @grok.action('Cancel') 951 952 def cancel(self, **data): 952 self.redirect(self.url(self.context)) 953 self.redirect(self.url(self.context)) 953 954 954 955 #class RemoveFacultyFormPage(RemoveFormPage): … … 986 987 # except: 987 988 # self.flash('Could not delete %s.' % code) 988 989 989 990 class FacultyManageFormPage(WAeUPEditFormPage): 990 991 """Manage the basic properties of a `Faculty` instance. … … 997 998 taboneactions = ['Save','Cancel'] 998 999 tabtwoactions = ['Add department', 'Remove selected','Cancel'] 1000 tabthreeactions = ['Add local role'] 999 1001 subunits = 'Departments' 1000 1002 … … 1007 1009 @property 1008 1010 def title(self): 1009 return self.context.longtitle() 1011 return self.context.longtitle() 1012 1013 def getLocalRoles(self): 1014 #import pdb; pdb.set_trace() 1015 return faculty_local_roles 1016 1017 def getUsers(self): 1018 """Get a list of all users. 1019 """ 1020 for key, val in grok.getSite()['users'].items(): 1021 url = self.url(val) 1022 #import pdb; pdb.set_trace() 1023 yield(dict(url=url, name=key, val=val)) 1010 1024 1011 1025 def update(self): … … 1048 1062 self.redirect(self.url(self.context)) 1049 1063 return 1050 1064 1065 @grok.action('Add local role', validator=NullValidator) 1066 def addLocalRole(self, **data): 1067 form = self.request.form 1068 localrole = form['local_role'] 1069 user = form['user'] 1070 role_manager = IPrincipalRoleManager(self.context) 1071 role_map = IPrincipalRoleMap(self.context) 1072 #import pdb; pdb.set_trace() 1073 role_manager.assignRoleToPrincipal(localrole, user) 1074 self.redirect(self.url(self.context, u'@@manage')+'#tab-3') 1075 return 1051 1076 1052 1077 class DepartmentAddFormPage(WAeUPAddFormPage):
Note: See TracChangeset for help on using the changeset viewer.