Changeset 6184 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 21 May 2011, 18:51:49 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 7 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) -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainermanagepage.pt
r6111 r6184 1 1 <form action="." tal:attributes="action request/URL" method="POST" 2 2 class="edit-form" enctype="multipart/form-data"> 3 4 <h2 i18n:translate="" 5 tal:condition="view/label" 6 tal:content="view/label">Label</h2> 7 8 <div class="form-status" 9 tal:define="status view/status" 10 tal:condition="status"> 11 12 <div i18n:translate="" tal:content="view/status"> 13 Form status summary 3 <h2 i18n:translate="" tal:condition="view/label" tal:content="view/label">Label</h2> 4 <div class="form-status" tal:define="status view/status" tal:condition="status"> 5 <div i18n:translate="" tal:content="view/status"> Form status summary 14 6 </div> 15 16 7 <ul class="errors" tal:condition="view/errors"> 17 8 <li tal:repeat="error view/error_views"> 18 <span tal:replace="structure error">Error Type</span> 9 <span tal:replace="structure error">Error Type 10 </span> 19 11 </li> 20 12 </ul> 21 13 </div> 22 23 14 <div id="tabs"> 24 15 <ul> 25 <li><a href="#tab-1"><span>Settings</span></a></li> 26 <li><a href="#tab-2"><span>Applicants</span></a></li> 16 <li> 17 <a href="#tab-1"> 18 <span>Settings 19 </span></a> 20 </li> 21 <li> 22 <a href="#tab-2"> 23 <span>Applicants 24 </span></a> 25 </li> 26 <li> 27 <a href="#tab-3"> 28 <span>Local Roles 29 </span></a> 30 </li> 27 31 </ul> 28 32 <div id="tab-1"> 33 <table class="zebra"> 34 <tbody> 35 <tal:block repeat="widget view/widgets"> 36 <tr> 37 <td class="label" tal:define="hint widget/hint"> 38 <label tal:condition="python:hint" tal:attributes="for widget/name"> 39 <span class="required" tal:condition="widget/required" >* 40 </span> 41 <span i18n:translate="" tal:content="widget/label">label 42 </span>: 43 </label> 44 <label tal:condition="python:not hint" tal:attributes="for widget/name"> 45 <span class="required" tal:condition="widget/required" >* 46 </span> 47 <span i18n:translate="" tal:content="widget/label">label 48 </span>: 49 </label> </td> 50 <td class="field"> 51 <div class="widget" tal:content="structure widget"> 52 <input type="text" /> 53 </div> 54 <div class="error" tal:condition="widget/error"> 55 <span tal:replace="structure widget/error">error 56 </span> 57 </div> </td> 58 </tr> 59 </tal:block> 60 </tbody> 61 </table> 62 <div id="actionsView"> 63 <span class="actionButtons" tal:condition="view/availableActions"> 64 <span tal:repeat="action view/actions" tal:omit-tag=""> 65 <input tal:condition="python:action.label in view.taboneactions" 66 tal:replace="structure action/render"/> 67 </span> 68 </span> 69 </div> 70 </div> 71 <div id="tab-2"> <h3>Applicants</h3> 72 <table id="datatable" class="display"> 73 <thead> 74 <tr> 75 <th> 76 </th> 77 <th>ID 78 </th> 79 <th>status 80 </th> 81 </tr> 82 </thead> 83 <tbody> 84 <tr tal:repeat="appl context/values"> <td> 85 <input type="checkbox" name="val_id" tal:attributes="value appl/__name__" /> </td> <td> 86 <a tal:attributes="href python: view.url(appl)" 87 tal:content="appl/__name__"> ID </a> </td> <td> 88 <span tal:condition="not: appl/locked">in progress 89 </span> 90 <span tal:condition="appl/locked">submitted 91 </span> </td> 92 </tr> 93 </tbody> 94 </table> 95 <div id="actionsView"> 96 <span class="actionButtons" tal:condition="view/availableActions"> 97 <span tal:repeat="action view/actions" tal:omit-tag=""> 98 <input tal:condition="python:action.label in view.tabtwoactions" 99 tal:replace="structure action/render"/> 100 </span> 101 </span> 102 </div> 103 </div> 104 <div id="tab-3"> <br /> 105 <table class="display dataTableManage"> 106 <thead> 107 <tr> 108 <th> 109 </th> 110 <th>User Id 111 </th> 112 <th>Name 113 </th> 114 <th>Local Role 115 </th> 116 </tr> 117 </thead> 118 <tbody> 119 <tr tal:repeat="entry view/getUsersWithLocalRoles" class="gradeB"> 120 <td> 121 <input type="checkbox" name="role_id" tal:attributes="value python: entry['user_name']+'|'+entry['local_role']" /> 122 </td> 123 <td tal:content="entry/user_name"> USERNAME 124 </td> 125 <td tal:content="entry/user_title"> USERTITLE 126 </td> 127 <td tal:content="entry/local_role_title"> LOCAL ROLE 128 </td> 129 </tr> 130 </tbody> 131 </table> <br /><br /> 132 <div class="actionButtons" tal:condition="view/availableActions"> 133 <span tal:repeat="action view/actions" tal:omit-tag=""> 134 <input tal:condition="python:action.label in view.tabthreeactions1" tal:replace="structure action/render"/> 135 </span> 136 </div> <br /><br /> 29 137 <table class="zebra"> 30 <tbody> 31 <tal:block repeat="widget view/widgets"> 32 <tr> 33 <td class="label" tal:define="hint widget/hint"> 34 <label tal:condition="python:hint" 35 tal:attributes="for widget/name"> 36 <span class="required" tal:condition="widget/required" 37 >*</span><span i18n:translate="" 38 tal:content="widget/label">label</span>: 39 </label> 40 <label tal:condition="python:not hint" 41 tal:attributes="for widget/name"> 42 <span class="required" tal:condition="widget/required" 43 >*</span><span i18n:translate="" 44 tal:content="widget/label">label</span>: 45 </label> 46 </td> 47 <td class="field"> 48 <div class="widget" tal:content="structure widget"> 49 <input type="text" /> 50 </div> 51 <div class="error" tal:condition="widget/error"> 52 <span tal:replace="structure widget/error">error</span> 53 </div> 54 </td> 55 </tr> 56 </tal:block> 57 </tbody> 138 <tr> 139 <td> 140 <select id="user" name="user"> 141 <option tal:repeat="user view/getUsers" tal:attributes="value user/name"> 142 <span tal:replace="user/val/description">USERTITLE 143 </span> 144 </option> 145 </select> 146 </td> 147 <td> 148 <select id="local_role" name="local_role"> 149 <option tal:repeat="localrole view/getLocalRoles" tal:attributes="value localrole/name"> 150 <span tal:replace="localrole/title">LOCALROLETITLE 151 </span> 152 </option> 153 </select> 154 </td> 155 <td> 156 <div class="actionButtons" tal:condition="view/availableActions"> 157 <span tal:repeat="action view/actions" tal:omit-tag=""> 158 <input tal:condition="python:action.label in view.tabthreeactions2" tal:replace="structure action/render"/> 159 </span> 160 </div> 161 </td> 162 </tr> 58 163 </table> 59 <div id="actionsView">60 <span class="actionButtons" tal:condition="view/availableActions">61 <span tal:repeat="action view/actions"62 tal:omit-tag="">63 <input tal:condition="python:action.label in view.taboneactions"64 tal:replace="structure action/render"/>65 </span>66 </span>67 </div>68 </div>69 <div id="tab-2">70 <h3>Applicants</h3>71 <table id="datatable" class="display">72 <thead>73 <tr>74 <th> </th><th>ID</th><th>status</th>75 </tr>76 </thead>77 <tbody>78 <tr tal:repeat="appl context/values">79 <td>80 <input type="checkbox"81 name="val_id"82 tal:attributes="value appl/__name__" />83 </td>84 <td>85 <a tal:attributes="href python: view.url(appl)"86 tal:content="appl/__name__">87 ID88 </a>89 </td>90 <td>91 <span tal:condition="not: appl/locked">in progress</span>92 <span tal:condition="appl/locked">submitted</span>93 </td>94 </tr>95 </tbody>96 </table>97 <div id="actionsView">98 <span class="actionButtons" tal:condition="view/availableActions">99 <span tal:repeat="action view/actions"100 tal:omit-tag="">101 <input tal:condition="python:action.label in view.tabtwoactions"102 tal:replace="structure action/render"/>103 </span>104 </span>105 </div>106 164 </div> 107 165 </div> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrootmanagepage.pt
r6108 r6184 1 <h2 i18n:translate="" 2 tal:condition="view/label" 3 tal:content="view/label">Label</h2> 4 5 <div class="form-status" 6 tal:define="status view/status" 7 tal:condition="status"> 8 9 <div i18n:translate="" tal:content="view/status">10 Form status summary1 <h2 i18n:translate="" tal:condition="view/label" tal:content="view/label">Label</h2> 2 <div class="form-status" tal:define="status view/status" tal:condition="status"> 3 <div i18n:translate="" tal:content="view/status"> Form status summary 4 </div> 5 <ul class="errors" tal:condition="view/errors"> 6 <li tal:repeat="error view/error_views"> 7 <span tal:replace="structure error">Error Type 8 </span> 9 </li> 10 </ul> 11 11 </div> 12 13 <ul class="errors" tal:condition="view/errors">14 <li tal:repeat="error view/error_views">15 <span tal:replace="structure error">Error Type</span>16 </li>17 </ul>18 </div>19 20 21 12 <form action="." tal:attributes="action request/URL" method="POST" 22 class="edit-form" enctype="multipart/form-data"> 23 24 <div id="tabs"> 25 <ul> 26 <li><a href="#tab-1"><span tal:content="view/subunits">Contents</span></a></li> 27 </ul> 28 29 <div id="tab-1"> 30 <h3 tal:content="view/subunits">Applicants Containers</h3> 31 <table class="display dataTableManage"> 32 <thead> 33 <tr> 34 <th> </th><th>Year</th><th>Code</th><th>Title</th> 35 </tr> 36 </thead> 37 <tbody> 38 <tr tal:repeat="entry context/values" 39 class="gradeB"> 40 <td> 41 <input type="checkbox" 42 name="val_id" 43 tal:attributes="value entry/__name__" /> 44 </td> 45 <td tal:content="entry/year">Year 46 </td> 47 <td> 48 <a href="" 49 tal:attributes="href python:view.url(entry)" 50 tal:content="entry/__name__">Code</a> 51 </td> 52 <td tal:content="entry/title">Title 53 </td> 54 </tr> 55 </tbody> 56 </table> 57 58 <div id="actionsView"> 13 class="edit-form" enctype="multipart/form-data"> 14 <div id="tabs"> 15 <ul> 16 <li> 17 <a href="#tab-1"> 18 <span tal:content="view/subunits">Contents 19 </span></a> 20 </li> 21 <li> 22 <a href="#tab-2"> 23 <span>Local Roles 24 </span></a> 25 </li> 26 </ul> 27 <div id="tab-1"> 28 <h3 tal:content="view/subunits">Applicants Containers</h3> 29 <table class="display dataTableManage"> 30 <thead> 31 <tr> 32 <th> 33 </th> 34 <th>Year 35 </th> 36 <th>Code 37 </th> 38 <th>Title 39 </th> 40 </tr> 41 </thead> 42 <tbody> 43 <tr tal:repeat="entry context/values" class="gradeB"> <td> 44 <input type="checkbox" name="val_id" 45 tal:attributes="value entry/__name__" /> </td> 46 <td tal:content="entry/year">Year </td> <td> 47 <a href="" tal:attributes="href python:view.url(entry)" 48 tal:content="entry/__name__">Code</a> </td> 49 <td tal:content="entry/title">Title </td> 50 </tr> 51 </tbody> 52 </table> 53 <div id="actionsView"> 59 54 <span class="actionButtons" tal:condition="view/availableActions"> 60 <span tal:repeat="action view/actions" 61 tal:omit-tag=""> 62 <input tal:condition="python:action.label in view.taboneactions" 63 tal:replace="structure action/render"/> 55 <span tal:repeat="action view/actions" tal:omit-tag=""> 56 <input tal:condition="python:action.label in view.taboneactions" 57 tal:replace="structure action/render"/> 58 </span> 59 </span> 60 </div> 61 </div> 62 <div id="tab-2"> <br /> 63 <table class="display dataTableManage"> 64 <thead> 65 <tr> 66 <th> 67 </th> 68 <th>User Id 69 </th> 70 <th>Name 71 </th> 72 <th>Local Role 73 </th> 74 </tr> 75 </thead> 76 <tbody> 77 <tr tal:repeat="entry view/getUsersWithLocalRoles" class="gradeB"> 78 <td> 79 <input type="checkbox" name="role_id" tal:attributes="value python: entry['user_name']+'|'+entry['local_role']" /> 80 </td> 81 <td tal:content="entry/user_name"> USERNAME 82 </td> 83 <td tal:content="entry/user_title"> USERTITLE 84 </td> 85 <td tal:content="entry/local_role_title"> LOCAL ROLE 86 </td> 87 </tr> 88 </tbody> 89 </table> <br /><br /> 90 <div class="actionButtons" tal:condition="view/availableActions"> 91 <span tal:repeat="action view/actions" tal:omit-tag=""> 92 <input tal:condition="python:action.label in view.tabtwoactions1" tal:replace="structure action/render"/> 64 93 </span> 65 </span> 66 </div> 67 68 </div> 69 </div> 70 </form> 94 </div> <br /><br /> 95 <table class="zebra"> 96 <tr> 97 <td> 98 <select id="user" name="user"> 99 <option tal:repeat="user view/getUsers" tal:attributes="value user/name"> 100 <span tal:replace="user/val/description">USERTITLE 101 </span> 102 </option> 103 </select> 104 </td> 105 <td> 106 <select id="local_role" name="local_role"> 107 <option tal:repeat="localrole view/getLocalRoles" tal:attributes="value localrole/name"> 108 <span tal:replace="localrole/title">LOCALROLETITLE 109 </span> 110 </option> 111 </select> 112 </td> 113 <td> 114 <div class="actionButtons" tal:condition="view/availableActions"> 115 <span tal:repeat="action view/actions" tal:omit-tag=""> 116 <input tal:condition="python:action.label in view.tabtwoactions2" tal:replace="structure action/render"/> 117 </span> 118 </div> 119 </td> 120 </tr> 121 </table> 122 </div> 123 </div> 124 </form> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/container.py
r6077 r6184 50 50 container_description = u'handles basic applicants' 51 51 52 @property 53 def local_roles(cls): 54 return ['waeup.local.ApplicationsOfficer'] 55 52 56 def archive(self, app_ids=None): 53 57 """Create on-dist archive of applicants stored in this term. -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r6158 r6184 365 365 default = DEFAULT_PASSPORT_IMAGE_MALE, 366 366 required = True, 367 #max_size = 20480, 367 368 ) 368 369 aos = schema.TextLine( … … 622 623 default = DEFAULT_PASSPORT_IMAGE_MALE, 623 624 required = True , 625 #max_size = 20480, 624 626 ) 625 627 # -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/permissions.py
r6159 r6184 43 43 grok.title(u'Application Owner') 44 44 grok.permissions('waeup.viewApplication', 'waeup.editApplication') 45 46 class ApplicationsOfficer(grok.Role): 47 grok.name('waeup.local.ApplicationsOfficer') 48 grok.title(u'Applications Officer') 49 grok.permissions('waeup.viewFullApplication', 'waeup.editFullApplication') -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
r6121 r6184 36 36 """ 37 37 grok.implements(IApplicantsRoot) 38 39 @property 40 def local_roles(cls): 41 return ['waeup.local.ApplicationsOfficer'] 38 42 39 43 class ApplicantsPlugin(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.