- Timestamp:
- 21 May 2011, 18:51:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6153 r6184 43 43 ThumbnailWidget, EncodingImageFileWidget, 44 44 ) 45 from waeup.sirp.interfaces import IWAeUPObject 45 from waeup.sirp.interfaces import IWAeUPObject, ILocalRolesAssignable 46 46 from waeup.sirp.widgets.datewidget import ( 47 47 FriendlyDateWidget, FriendlyDateDisplayWidget) … … 58 58 IApplicantsContainerAdd, application_types_vocab 59 59 ) 60 from waeup.sirp.browser.pages import add_local_role, del_local_roles 61 from waeup.sirp.permissions import get_users_with_local_roles, getRoles 60 62 61 63 results_widget = CustomWidgetFactory( … … 99 101 grok.require('waeup.manageUniversity') 100 102 taboneactions = ['Add applicants container', 'Remove selected','Cancel'] 103 tabtwoactions1 = ['Remove selected local roles'] 104 tabtwoactions2 = ['Add local role'] 101 105 subunits = 'Applicants Containers' 102 106 … … 105 109 datatable.need() 106 110 return super(ApplicantsRootManageFormPage, self).update() 111 112 def getLocalRoles(self): 113 roles = ILocalRolesAssignable(self.context) 114 return roles() 115 116 def getUsers(self): 117 """Get a list of all users. 118 """ 119 for key, val in grok.getSite()['users'].items(): 120 url = self.url(val) 121 yield(dict(url=url, name=key, val=val)) 122 123 def getUsersWithLocalRoles(self): 124 return get_users_with_local_roles(self.context) 107 125 108 126 # ToDo: Show warning message before deletion … … 136 154 return 137 155 156 @grok.action('Add local role', validator=NullValidator) 157 def addLocalRole(self, **data): 158 return add_local_role(self,2, **data) 159 160 @grok.action('Remove selected local roles') 161 def delLocalRoles(self, **data): 162 return del_local_roles(self,2,**data) 163 138 164 class ApplicantsContainerAddFormPage(WAeUPAddFormPage): 139 165 grok.context(IApplicantsRoot) … … 255 281 taboneactions = ['Save','Cancel'] 256 282 tabtwoactions = ['Add applicant', 'Remove selected','Cancel'] 283 tabthreeactions1 = ['Remove selected local roles'] 284 tabthreeactions2 = ['Add local role'] 257 285 # Use friendlier date widget... 258 286 form_fields['startdate'].custom_widget = FriendlyDateWidget('le') … … 276 304 return super(ApplicantsContainerManageFormPage, self).update() 277 305 306 def getLocalRoles(self): 307 roles = ILocalRolesAssignable(self.context) 308 return roles() 309 310 def getUsers(self): 311 """Get a list of all users. 312 """ 313 for key, val in grok.getSite()['users'].items(): 314 url = self.url(val) 315 yield(dict(url=url, name=key, val=val)) 316 317 def getUsersWithLocalRoles(self): 318 return get_users_with_local_roles(self.context) 319 278 320 @grok.action('Save') 279 321 def apply(self, **data): … … 295 337 self.redirect(self.url(self.context)) 296 338 return 339 340 @grok.action('Add local role', validator=NullValidator) 341 def addLocalRole(self, **data): 342 return add_local_role(self,3, **data) 343 344 @grok.action('Remove selected local roles') 345 def delLocalRoles(self, **data): 346 return del_local_roles(self,3,**data) 297 347 298 348 … … 339 389 # Assign current principal the owner role on created applicant 340 390 # record 341 role_manager = IPrincipalRoleManager(self.context )391 role_manager = IPrincipalRoleManager(self.context[pin]) 342 392 role_manager.assignRoleToPrincipal( 343 393 'waeup.local.ApplicationOwner', self.request.principal.id)
Note: See TracChangeset for help on using the changeset viewer.