Changeset 10540
- Timestamp:
- 27 Aug 2013, 20:08:27 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/browser
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/browser.txt
r10438 r10540 726 726 True 727 727 728 We can grant local roles: 729 730 >>> browser.open('http://localhost/myuniversity/faculties/TF/TD/courses/COURSE1/manage') 731 >>> browser.getControl(name="user").value = ['bob'] 732 >>> browser.getControl( 733 ... name="local_role").value = ['waeup.local.Lecturer'] 734 >>> browser.getControl("Add local role").click() 735 >>> print browser.contents 736 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 737 ...<td>bob</td> 738 ... 739 740 On the portal user page the new local role is displayed: 741 742 >>> browser.getLink("Portal Users").click() 743 >>> print browser.contents 744 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 745 ...<td>Lecturer:... 746 ... 747 748 The local role can be removed again: 749 750 >>> browser.open('http://localhost/myuniversity/faculties/TF/TD/courses/COURSE1/manage') 751 >>> ctrl = browser.getControl(name='role_id') 752 >>> browser.getControl("Remove selected local roles").click() 753 >>> print browser.contents 754 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 755 ...No local role selected... 756 ... 757 758 >>> browser.open('http://localhost/myuniversity/faculties/TF/TD/courses/COURSE1/manage') 759 >>> ctrl = browser.getControl(name='role_id') 760 >>> ctrl.getControl(value='bob|waeup.local.Lecturer').selected = True 761 >>> browser.getControl("Remove selected local roles").click() 762 >>> print browser.contents 763 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 764 ...Local role successfully removed... 765 ... 766 728 767 Deleting courses 729 768 ---------------- -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r10244 r10540 2111 2111 grok.name('manage') 2112 2112 grok.require('waeup.manageAcademics') 2113 grok.template('coursemanagepage') 2113 2114 label = _(u'Edit course') 2114 2115 pnav = 1 2116 taboneactions = [_('Save'),_('Cancel')] 2117 tabtwoactions1 = [_('Remove selected local roles')] 2118 tabtwoactions2 = [_('Add local role')] 2115 2119 2116 2120 form_fields = grok.AutoFields(ICourse) 2121 2122 def update(self): 2123 tabs.need() 2124 self.tab1 = self.tab2 = '' 2125 qs = self.request.get('QUERY_STRING', '') 2126 if not qs: 2127 qs = 'tab1' 2128 setattr(self, qs, 'active') 2129 warning.need() 2130 datatable.need() 2131 return super(CourseManageFormPage, self).update() 2117 2132 2118 2133 @action(_('Save'), style='primary') … … 2124 2139 self.redirect(self.url(self.context)) 2125 2140 return 2141 2142 def getLocalRoles(self): 2143 roles = ILocalRolesAssignable(self.context) 2144 return roles() 2145 2146 def getUsers(self): 2147 return get_all_users() 2148 2149 def getUsersWithLocalRoles(self): 2150 return get_users_with_local_roles(self.context) 2151 2152 @action(_('Add local role'), validator=NullValidator) 2153 def addLocalRole(self, **data): 2154 return add_local_role(self, 2, **data) 2155 2156 @action(_('Remove selected local roles')) 2157 def delLocalRoles(self, **data): 2158 return del_local_roles(self,2,**data) 2126 2159 2127 2160 #
Note: See TracChangeset for help on using the changeset viewer.