- Timestamp:
- 18 May 2011, 15:57:39 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 2 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): -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultymanagepage.pt
r6025 r6126 26 26 <li><a href="#tab-1"><span>Settings</span></a></li> 27 27 <li><a href="#tab-2"><span tal:content="view/subunits">Contents</span></a></li> 28 <li><a href="#tab-3"><span>Local Roles</span></a></li> 28 29 </ul> 29 30 … … 111 112 </span> 112 113 </div> 113 114 114 </div> 115 116 <div id="tab-3"> 117 <h3>Manage local roles</h3> 118 <table class="zebra"> 119 <tr> 120 <td> 121 <label for="users">User:</label> 122 </td> 123 <td> 124 <select id="user" name="user" tal:repeat="user view/getUsers"> 125 <option tal:attributes="value user/name"> 126 <span tal:replace="user/val/description">USERTITLE</span> 127 </option> 128 </select> 129 </td> 130 </tr> 131 <tr> 132 <td> 133 <label for="local_roles">Local Role:</label> 134 </td> 135 <td> 136 <select id="local_role" name="local_role" tal:repeat="localrole view/getLocalRoles"> 137 <option tal:attributes="value localrole/name"> 138 <span tal:replace="localrole/title">LOCALROLETITLE</span> 139 </option> 140 </select> 141 </td> 142 </tr> 143 </table> 144 145 <div id="actionsView"> 146 <span class="actionButtons" tal:condition="view/availableActions"> 147 <span tal:repeat="action view/actions" 148 tal:omit-tag=""> 149 <input tal:condition="python:action.label in view.tabthreeactions" 150 tal:replace="structure action/render"/> 151 </span> 152 </span> 153 </div> 154 </div> 155 115 156 </div> 116 157 </form>
Note: See TracChangeset for help on using the changeset viewer.