Changeset 7205 for main/waeup.sirp/trunk/src
- Timestamp:
- 26 Nov 2011, 06:49:16 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7202 r7205 54 54 IPasswordValidator) 55 55 from waeup.sirp.permissions import get_users_with_local_roles, get_all_roles 56 from waeup.sirp.students.catalog import search as searchstudents 56 57 from waeup.sirp.university.catalog import search 57 58 from waeup.sirp.university.vocabularies import course_levels … … 1369 1370 yield(dict(url=url, name=key, container=val)) 1370 1371 1372 class ShowStudentsPage(WAeUPPage): 1373 """Page that lists all students in the department. 1374 """ 1375 grok.context(IDepartment) 1376 grok.require('waeup.showStudents') 1377 grok.name('showstudents') 1378 pnav = 1 1379 label = 'Students' 1380 1381 @property 1382 def title(self): 1383 return self.context.longtitle() 1384 1385 @property 1386 def getStudents(self): 1387 hitlist = searchstudents(query=self.context.code, 1388 searchtype='depcode', view=self) 1389 return hitlist 1390 1391 def update(self, *args, **kw): 1392 datatable.need() 1393 return 1394 1371 1395 class DepartmentManageFormPage(WAeUPEditFormPage): 1372 1396 """Manage the basic properties of a `Department` instance. -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r7202 r7205 416 416 text = 'Manage department' 417 417 418 class ShowDepartmentStudentsActionButton(ManageActionButton): 419 """ 'Show students' button for departments. 420 """ 421 grok.context(IDepartment) 422 grok.view(DepartmentPage) 423 grok.require('waeup.showStudents') 424 icon = 'actionicon_student.png' 425 text = 'Show students' 426 target = 'showstudents' 427 418 428 class ManageCourseActionButton(ManageActionButton): 419 429 """ 'Edit settings' button for courses. -
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r7193 r7205 54 54 grok.name('waeup.manageUsers') 55 55 56 class ShowStudents(grok.Permission): 57 grok.name('waeup.showStudents') 58 56 59 class EditUser(grok.Permission): 57 60 grok.name('waeup.editUser') … … 70 73 grok.name('waeup.local.DepartmentManager') 71 74 grok.title(u'Department Manager') 72 grok.permissions('waeup.manageUniversity' )75 grok.permissions('waeup.manageUniversity','waeup.showStudents') 73 76 74 77 class ClearanceOfficer(grok.Role): … … 78 81 grok.name('waeup.local.ClearanceOfficer') 79 82 grok.title(u'Clearance Officer') 83 grok.permissions('waeup.showStudents') 80 84 81 85 class CourseAdviser(grok.Role): … … 85 89 grok.name('waeup.local.CourseAdviser') 86 90 grok.title(u'Course Adviser') 91 grok.permissions('waeup.showStudents') 87 92 88 93 class Owner(grok.Role): … … 112 117 'waeup.viewStudent', 'waeup.manageStudent', 'clearStudent', 113 118 'waeup.uploadStudentFile', 'waeup.viewStudents', 114 'waeup.viewHostels', 'waeup.manageHostels') 119 'waeup.viewHostels', 'waeup.manageHostels', 120 'waeup.showStudents') 115 121 116 122 def get_all_roles(): -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7191 r7205 70 70 if changed_fields: 71 71 changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) 72 # Inform catalog if certificate has changed 73 # (applyData does this only for the context) 74 if 'certificate' in changed_fields: 75 notify(grok.ObjectModifiedEvent(view.context.getStudent())) 72 76 fields_string = ' + '.join(changed_fields) 73 #view.context._p_changed = True74 77 view.flash('Form has been saved.') 75 78 if fields_string: … … 599 602 @property 600 603 def department(self): 601 if self.context.certificate :604 if self.context.certificate is not None: 602 605 return self.context.certificate.__parent__.__parent__ 603 606 return … … 605 608 @property 606 609 def faculty(self): 607 if self.context.certificate :610 if self.context.certificate is not None: 608 611 return self.context.certificate.__parent__.__parent__.__parent__ 609 612 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/containermanagepage.pt
r7068 r7205 10 10 <option value="student_id">with id</option> 11 11 <option value="fullname">with name</option> 12 <option value="reg_number">with registration number</option> 13 <option value="matric_number">with matriculation number</option> 12 14 <option value="current_session">in session</option> 15 <option value="depcode">in department</option> 13 16 </select> 14 17 -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/containerpage.pt
r7068 r7205 13 13 <option value="matric_number">with matriculation number</option> 14 14 <option value="current_session">in session</option> 15 <option value="depcode">in department</option> 15 16 </select> 16 17 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7203 r7205 149 149 self.certificate.end_level = 500 150 150 self.app['faculties']['fac1'] = Faculty() 151 self.app['faculties']['fac1']['dep1'] = Department( )151 self.app['faculties']['fac1']['dep1'] = Department(code='dep1') 152 152 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( 153 153 self.certificate) … … 196 196 self.student['studycourse'].current_verdict = 'A' 197 197 self.student['studycourse'].current_level = 100 198 # Update the catalog 199 notify(grok.ObjectModifiedEvent(self.student)) 198 200 199 201 # Put the prepopulated site into test ZODB and prepare test … … 263 265 self.browser.getControl(name="searchtype").value = ['student_id'] 264 266 self.browser.getControl(name="searchterm").value = self.student_id 267 self.browser.getControl("Search").click() 268 self.assertTrue('Anna Tester' in self.browser.contents) 269 270 # We can find a student in a certain department 271 self.browser.open(self.container_path) 272 self.browser.getControl(name="searchtype").value = ['depcode'] 273 self.browser.getControl(name="searchterm").value = 'dep1' 265 274 self.browser.getControl("Search").click() 266 275 self.assertTrue('Anna Tester' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.