Changeset 5917 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 6 Apr 2011, 09:41:06 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 3 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r5523 r5917 144 144 >>> print browser.contents 145 145 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 146 ...<h2> RegisteredFaculties</h2>146 ...<h2>Faculties</h2> 147 147 ...<td><a href="http://localhost/myuniversity/faculties/TF">TF</a></td><td>Faculty of TestFac</td> 148 148 ... … … 164 164 165 165 We can change the settings for a faculty by clicking on the 166 provided 'Edit settings' button:167 168 >>> browser.getLink('Edit settings').click()166 provided 'Edit faculty' button: 167 168 >>> browser.getLink('Edit faculty').click() 169 169 170 170 Let's set a new title and save the form: … … 184 184 changed: 185 185 186 >>> browser.getLink('Edit settings').click()186 >>> browser.getLink('Edit faculty').click() 187 187 >>> browser.getControl(name='form.title').value = "Blah" 188 188 >>> browser.getControl('Cancel').click() … … 194 194 >>> print browser.contents 195 195 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 196 ...<h2> RegisteredFaculties</h2>196 ...<h2>Faculties</h2> 197 197 ...<td><a href="http://localhost/myuniversity/faculties/TF">TF</a></td><td>Faculty of My renamed faculty</td> 198 198 ... … … 250 250 >>> print browser.contents 251 251 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 252 ...<h2> Registered Departments:</h2>252 ...<h2>Departments</h2> 253 253 ...<td><a href="http://localhost/myuniversity/faculties/TF/TD">TD</a></td><td>Department of TestDept</td> 254 254 ... … … 259 259 260 260 We can change the settings for a department by clicking on the 261 provided 'Edit settings' button:261 provided 'Edit department' button: 262 262 263 263 >>> browser.open('http://localhost/myuniversity/faculties/TF/TD') 264 >>> browser.getLink('Edit settings').click()264 >>> browser.getLink('Edit department').click() 265 265 266 266 Let's set a new title and save the form: … … 280 280 changed: 281 281 282 >>> browser.getLink('Edit settings').click()282 >>> browser.getLink('Edit department').click() 283 283 >>> browser.getControl(name='form.title').value = "Blah" 284 284 >>> browser.getControl('Cancel').click() … … 290 290 >>> print browser.contents 291 291 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 292 ...<h2> Registered Departments:</h2>292 ...<h2>Departments</h2> 293 293 ...<td><a href="http://localhost/myuniversity/faculties/TF/TD">TD</a></td><td>Department of My renamed dept</td> 294 294 ... … … 384 384 385 385 >>> browser.open(dept_url + '/courses/COURSE1') 386 >>> browser.getLink('Edit settings').click()386 >>> browser.getLink('Edit course').click() 387 387 388 388 When modifying a course, we cannot change the code any more: … … 409 409 changed: 410 410 411 >>> browser.getLink('Edit settings').click()411 >>> browser.getLink('Edit course').click() 412 412 >>> browser.getControl(name='form.title').value = "Blah" 413 413 >>> browser.getControl('Cancel').click() … … 530 530 531 531 We can change the settings for a cert by clicking on the provided 532 'Edit settings' link:532 'Edit certificate' link: 533 533 534 534 >>> browser.open(dept_url + '/certificates/CERT1') 535 >>> browser.getLink('Edit settings').click()535 >>> browser.getLink('Edit certificate').click() 536 536 537 537 When modifying a certificate, we cannot change the code any more: … … 558 558 changed: 559 559 560 >>> browser.getLink('Edit settings').click()560 >>> browser.getLink('Edit certificate').click() 561 561 >>> browser.getControl(name='form.title').value = "Blah" 562 562 >>> browser.getControl('Cancel').click() … … 690 690 691 691 We can change the settings for a certcourse by clicking on the 692 provided 'Edit settings' link:692 provided 'Edit certificate course' link: 693 693 694 694 >>> browser.open(cert_url + '/COURSE1_100') 695 >>> browser.getLink('Edit settings').click()695 >>> browser.getLink('Edit certificate course').click() 696 696 697 697 Let's set a new level (it was 100 before) and save the form. This will … … 711 711 changed: 712 712 713 >>> browser.getLink('Edit settings').click()713 >>> browser.getLink('Edit certificate course').click() 714 714 >>> browser.getControl(name='form.level').value = "666" 715 715 >>> browser.getControl('Cancel').click() -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5524 r5917 125 125 grok.context(IUniversity) 126 126 grok.require('waeup.manageUniversity') 127 title = u'Edit settings'127 title = u'Edit portal settings' 128 128 pnav = 0 129 129 … … 140 140 self.flash('Settings have been saved.') 141 141 return 142 143 142 @grok.action('Cancel', validator=NullValidator) 144 143 def cancel(self, **data): … … 152 151 self.flash('Plugins were updated. See log file for details.') 153 152 self.redirect(self.url(self.context)) 153 return 154 155 class RemoveFormPage(WAeUPPage): 156 grok.require('waeup.manageUniversity') 157 grok.name('remove') 158 grok.template('removesubobjectspage') 159 pnav = 1 160 161 def update(self): 162 form = self.request.form 163 if 'CANCEL' in form.keys(): 164 self.redirect(self.url(self.context)) 165 if not 'REMOVE' in form.keys(): 166 return 167 child_id = form['val_id'] 168 if not isinstance(child_id, list): 169 child_id = [child_id] 170 deleted = [] 171 for id in child_id: 172 try: 173 del self.context[id] 174 deleted.append(id) 175 except: 176 self.flash('Could not delete %s: %s: %s' % ( 177 id, sys.exc_info()[0], sys.exc_info()[1])) 178 if len(deleted): 179 self.flash('Successfully removed: %s' % ', '.join(deleted)) 180 # We have to redirect to let flash messages appear immediately... 181 self.redirect(self.url()) 154 182 return 155 183 … … 221 249 grok.name('add') 222 250 form_fields = grok.AutoFields(IUserAccount) 223 label = ' Add user'251 label = '' 224 252 title = 'Add user' 225 253 … … 318 346 grok.template('contactadminform') 319 347 grok.require('waeup.Public') 320 pnav = 3348 pnav = 2 321 349 322 350 def title(self): … … 839 867 grok.name('add') 840 868 form_fields = grok.AutoFields(IFaculty) 841 label = ' Add a faculty'842 title = 'Add afaculty'869 label = '' 870 title = 'Add faculty' 843 871 pnav = 1 844 872 … … 858 886 return 859 887 self.redirect(self.url(self.context)) 860 861 class ManageFacultyContainerPage(WAeUPPage): 862 """ Manage Page 888 889 @grok.action('Cancel') 890 def cancel(self, **data): 891 self.redirect(self.url(self.context)) 892 893 class RemoveFacultyFormPage(RemoveFormPage): 894 """ Remove Faculty Page 863 895 """ 864 896 grok.context(IFacultyContainer) 865 grok.require('waeup.manageUniversity') 866 grok.template('facultycontainermanagepage') 867 grok.name('manage') 868 title = "Manage Faculties" 869 pnav = 1 870 871 def update(self): 872 form = self.request.form 873 if 'CANCEL' in form.keys(): 874 self.redirect(self.url(self.context)) 875 if not 'DELETE' in form.keys(): 876 return 877 fac_id = form['fac_id'] 878 if not isinstance(fac_id, list): 879 fac_id = [fac_id] 880 deleted = [] 881 for id in fac_id: 882 try: 883 del self.context[id] 884 deleted.append(id) 885 except: 886 self.flash('Could not delete %s: %s: %s' % ( 887 id, sys.exc_info()[0], sys.exc_info()[1])) 888 if len(deleted): 889 self.flash('Successfully deleted: %s' % ', '.join(deleted)) 890 # We have to redirect to let flash messages appear immediately... 891 self.redirect(self.url()) 892 return 897 title = "Remove faculty" 898 pnav = 1 893 899 894 900 # … … 917 923 grok.require('waeup.manageUniversity') 918 924 form_fields = grok.AutoFields(IDepartment) 919 title = 'Add a department' 925 title = 'Add department' 926 label = '' 920 927 pnav = 1 921 928 … … 935 942 return 936 943 self.redirect(self.url(self.context)) 944 945 @grok.action('Cancel') 946 def cancel(self, **data): 947 self.redirect(self.url(self.context)) 937 948 938 949 class ManageFacultyFormPage(WAeUPEditFormPage): … … 961 972 self.redirect(self.url(self.context)) 962 973 return 974 975 976 class RemoveDepartmentFormPage(RemoveFormPage): 977 """ Remove Department Page 978 """ 979 grok.context(IFaculty) 980 title = "Remove department" 981 pnav = 1 982 963 983 964 984 # … … 997 1017 grok.name('manage') 998 1018 grok.require('waeup.manageUniversity') 999 title = u'Edit department settings'1019 title = u'Edit department' 1000 1020 pnav = 1 1001 1021 … … 1112 1132 grok.name('manage') 1113 1133 grok.require('waeup.manageUniversity') 1114 title = u'Edit course settings'1134 title = u'Edit course' 1115 1135 pnav = 1 1116 1136 … … 1296 1316 form_fields = grok.AutoFields(ICertificateCourse) 1297 1317 pnav = 1 1298 title = 'Add acourse'1318 title = 'Add course' 1299 1319 1300 1320 @grok.action('Add course') -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultycontainerpage.pt
r4789 r5917 1 <h2> RegisteredFaculties</h2>1 <h2>Faculties</h2> 2 2 3 3 <div tal:condition="python: not len(context.keys())"> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultypage.pt
r4789 r5917 1 <h2> Registered Departments:</h2>1 <h2>Departments</h2> 2 2 3 3 -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r5914 r5917 62 62 icon = 'actionicon_modify.png' # File must exist in static/ 63 63 target = '@@manage' # link to this viewname. 64 text = 'Edit settings' # Text to display on the button64 text = 'Edit' # Text to display on the button 65 65 66 66 # We set the template file explicitly (instead of using … … 125 125 icon = 'actionicon_modify.png' 126 126 target = '@@manage' 127 text = 'Edit settings'127 text = 'Edit' 128 128 129 129 class AddActionButton(ActionButton): … … 133 133 grok.order(4) 134 134 grok.require('waeup.manageUniversity') 135 icon = 'actionicon_add favorite.png'135 icon = 'actionicon_add.png' 136 136 target = 'add' 137 137 text = 'Add' 138 139 class RemoveActionButton(ActionButton): 140 """A base for 'remove' buttons. 141 """ 142 grok.baseclass() 143 grok.order(4) 144 grok.require('waeup.manageUniversity') 145 icon = 'actionicon_delete.png' 146 target = 'remove' 147 text = 'Remove' 138 148 139 149 class SearchActionButton(ActionButton): … … 282 292 # 283 293 class ManageUniversityActionButton(ManageActionButton): 284 """ 'Edit settings' button for University instances.294 """ 'Edit' button for University instances. 285 295 """ 286 296 grok.context(IUniversity) 287 297 grok.view(UniversityPage) 288 289 class ManageFacultiesActionButton(ManageActionButton): 290 """ 'Edit settings' button for faculty container. 291 """ 292 grok.context(IFacultyContainer) 293 grok.view(FacultyContainerPage) 298 text = 'Edit portal settings' 299 300 #class ManageFacultiesActionButton(ManageActionButton): 301 # """ 'Edit settings' button for faculty container. 302 # """ 303 # grok.context(IFacultyContainer) 304 # grok.view(FacultyContainerPage) 294 305 295 306 class ManageDataCenterActionButton(ManageActionButton): … … 298 309 grok.context(IDataCenter) 299 310 grok.view(DatacenterPage) 311 text = 'Edit settings' 300 312 301 313 class ManageFacultyActionButton(ManageActionButton): … … 304 316 grok.context(IFaculty) 305 317 grok.view(FacultyPage) 318 text = 'Edit faculty' 306 319 307 320 class ManageDepartmentActionButton(ManageActionButton): … … 310 323 grok.context(IDepartment) 311 324 grok.view(DepartmentPage) 325 text = 'Edit department' 312 326 313 327 class ManageCourseActionButton(ManageActionButton): … … 316 330 grok.context(ICourse) 317 331 grok.view(CoursePage) 332 text = 'Edit course' 318 333 319 334 class ManageCertificateActionButton(ManageActionButton): … … 322 337 grok.context(ICertificate) 323 338 grok.view(CertificatePage) 339 text = 'Edit certificate' 324 340 325 341 class ManageCertificateCourseActionButton(ManageActionButton): … … 328 344 grok.context(ICertificateCourse) 329 345 grok.view(CertificateCoursePage) 346 text = 'Edit certificate course' 330 347 331 348 # … … 363 380 text = 'Add course reference' 364 381 target = 'addcertificatecourse' 382 383 # 384 # Remove actions... 385 # 386 387 388 class RemoveFacultyActionButton(RemoveActionButton): 389 grok.context(IFacultyContainer) 390 grok.view(FacultyContainerPage) 391 text = 'Remove faculty' 392 393 class RemoveDepartmentActionButton(RemoveActionButton): 394 grok.context(IFaculty) 395 grok.view(FacultyPage) 396 text = 'Remove department' 397 365 398 366 399 #
Note: See TracChangeset for help on using the changeset viewer.