Changeset 6635 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 26 Aug 2011, 20:54:25 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6633 r6635 46 46 from waeup.sirp.browser.viewlets import ( 47 47 ManageActionButton, PrimaryNavTab, LeftSidebarLink, 48 AddActionButton, ActionButton, 48 AddActionButton, ActionButton, PlainActionButton, 49 49 ) 50 50 from waeup.sirp.image.browser.widget import ( … … 64 64 from waeup.sirp.students.interfaces import ( 65 65 IStudentsContainer, IStudent, IStudentClearance, 66 IStudentPersonal, IStudentBase 66 IStudentPersonal, IStudentBase, IStudentStudyCourse, 67 IStudentPayments, IStudentAccommodation 67 68 ) 68 69 from waeup.sirp.students.student import ( … … 92 93 grok.context(IStudentsContainer) 93 94 title = u'Students' 95 96 class SudyCourseBreadcrumb(Breadcrumb): 97 """A breadcrumb for the student study course. 98 """ 99 grok.context(IStudentStudyCourse) 100 title = u'Study Course' 101 102 class PaymentsBreadcrumb(Breadcrumb): 103 """A breadcrumb for the student payments folder. 104 """ 105 grok.context(IStudentPayments) 106 title = u'Payments' 107 108 class AccommodationBreadcrumb(Breadcrumb): 109 """A breadcrumb for the student accommodation folder. 110 """ 111 grok.context(IStudentAccommodation) 112 title = u'Accommodation' 94 113 95 114 class StudentsContainerPage(WAeUPPage): … … 229 248 grok.name('index') 230 249 grok.require('waeup.viewStudents') 250 grok.template('studentpage') 231 251 form_fields = grok.AutoFields(IStudentBase) 232 252 … … 244 264 grok.view(StudentBaseDisplayFormPage) 245 265 grok.require('waeup.manageStudents') 246 text = 'Edit base data'266 text = 'Edit' 247 267 target = 'edit_base' 248 268 249 class StudentClearanceViewActionButton( ActionButton):269 class StudentClearanceViewActionButton(PlainActionButton): 250 270 grok.order(2) 251 icon = 'actionicon_view.png' 252 grok.context(IStudent) 253 grok.view(StudentBaseDisplayFormPage) 254 grok.require('waeup.viewStudents') 255 text = 'View clearance data' 271 grok.context(IStudent) 272 grok.view(StudentBaseDisplayFormPage) 273 grok.require('waeup.viewStudents') 274 text = 'Clearance Data' 256 275 target = 'view_clearance' 257 276 258 class StudentPersonalViewActionButton( ActionButton):277 class StudentPersonalViewActionButton(PlainActionButton): 259 278 grok.order(3) 260 icon = 'actionicon_view.png' 261 grok.context(IStudent) 262 grok.view(StudentBaseDisplayFormPage) 263 grok.require('waeup.viewStudents') 264 text = 'View personal data' 279 grok.context(IStudent) 280 grok.view(StudentBaseDisplayFormPage) 281 grok.require('waeup.viewStudents') 282 text = 'Personal Data' 265 283 target = 'view_personal' 284 285 class StudyCourseViewActionButton(PlainActionButton): 286 grok.order(4) 287 grok.context(IStudent) 288 grok.view(StudentBaseDisplayFormPage) 289 grok.require('waeup.viewStudents') 290 text = 'Study Course' 291 target = 'studycourse' 292 293 class PaymentsViewActionButton(PlainActionButton): 294 grok.order(5) 295 grok.context(IStudent) 296 grok.view(StudentBaseDisplayFormPage) 297 grok.require('waeup.viewStudents') 298 text = 'Payments' 299 target = 'payments' 300 301 class AccommodationViewActionButton(PlainActionButton): 302 grok.order(6) 303 grok.context(IStudent) 304 grok.view(StudentBaseDisplayFormPage) 305 grok.require('waeup.viewStudents') 306 text = 'Accommodation' 307 target = 'accommodation' 266 308 267 309 class StudentBaseManageFormPage(WAeUPEditFormPage): … … 300 342 grok.view(StudentClearanceDisplayFormPage) 301 343 grok.require('waeup.manageStudents') 302 text = 'Edit clearance data'344 text = 'Edit' 303 345 target = 'edit_clearance' 304 346 … … 337 379 grok.view(StudentPersonalDisplayFormPage) 338 380 grok.require('waeup.manageStudents') 339 text = 'Edit personal data'381 text = 'Edit' 340 382 target = 'edit_personal' 341 383 … … 352 394 def title(self): 353 395 return 'Student: %s' % self.context.name 396 397 class StudyCourseDisplayFormPage(WAeUPDisplayFormPage): 398 """ Page to display the student study course data 399 """ 400 grok.context(IStudentStudyCourse) 401 grok.name('index') 402 grok.require('waeup.viewStudents') 403 form_fields = grok.AutoFields(IStudentStudyCourse) 404 #grok.template('studycoursepage') 405 406 @property 407 def title(self): 408 return 'Student: %s' % self.context.__parent__.name 409 410 @property 411 def label(self): 412 return '%s: Study Course Data' % self.context.__parent__.name 413 414 class PaymentsDisplayFormPage(WAeUPDisplayFormPage): 415 """ Page to display the student payments 416 """ 417 grok.context(IStudentPayments) 418 grok.name('index') 419 grok.require('waeup.viewStudents') 420 form_fields = grok.AutoFields(IStudentPayments) 421 #grok.template('paymentspage') 422 423 @property 424 def title(self): 425 return 'Student: %s' % self.context.__parent__.name 426 427 @property 428 def label(self): 429 return '%s: Payments' % self.context.__parent__.name 430 431 class AccommodationDisplayFormPage(WAeUPDisplayFormPage): 432 """ Page to display the student accommodation data 433 """ 434 grok.context(IStudentAccommodation) 435 grok.name('index') 436 grok.require('waeup.viewStudents') 437 form_fields = grok.AutoFields(IStudentAccommodation) 438 #grok.template('accommodationpage') 439 440 @property 441 def title(self): 442 return 'Student: %s' % self.context.__parent__.name 443 444 @property 445 def label(self): 446 return '%s: Accommodation Data' % self.context.__parent__.name -
main/waeup.sirp/trunk/src/waeup/sirp/students/container.py
r6633 r6635 22 22 from zope.interface import implementedBy 23 23 from waeup.sirp.students.interfaces import ( 24 IStudentsContainer, IStudent )24 IStudentsContainer, IStudent, IStudentPayments, IStudentAccommodation) 25 25 from waeup.sirp.students.studycourse import StudentStudyCourse 26 from waeup.sirp.students.payments import StudentPayments 27 from waeup.sirp.students.accommodation import StudentAccommodation 26 28 27 29 class StudentsContainer(grok.Container): … … 46 48 studycourse = StudentStudyCourse() 47 49 self[student.student_id]['studycourse'] = studycourse 50 payments = StudentPayments() 51 self[student.student_id]['payments'] = payments 52 accommodation = StudentAccommodation() 53 self[student.student_id]['accommodation'] = accommodation 48 54 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6633 r6635 92 92 required = True, 93 93 ) 94 95 class IStudentAccommodation(IWAeUPObject): 96 """A container for student accommodation objects. 97 98 """ 99 100 class IStudentPayments(IWAeUPObject): 101 """A container for student payment objects. 102 103 """ 104 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6632 r6635 72 72 73 73 74 # Add student 74 # Add student with subobjects (done by addStudent) 75 75 student = Student() 76 76 student.name = u'Anna Tester' 77 77 student.student_id = u'Z654321' 78 self.app['students'] [student.student_id] = student78 self.app['students'].addStudent(student) 79 79 80 80 self.container_path = 'http://localhost/app/students' … … 88 88 self.edit_personal_student_path = self.student_path + '/edit_personal' 89 89 90 self.studycourse_student_path = self.student_path + '/studycourse' 91 self.payments_student_path = self.student_path + '/payments' 92 self.accommodation_student_path = self.student_path + '/accommodation' 93 90 94 # Populate university 91 95 certificate = createObject('waeup.Certificate') … … 188 192 # and can perform actions 189 193 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 194 190 195 self.browser.open(self.student_path) 191 196 self.assertEqual(self.browser.headers['Status'], '200 Ok') 192 197 self.assertEqual(self.browser.url, self.student_path) 193 self.browser.getLink("Edit base data").click()198 self.browser.getLink("Edit").click() 194 199 self.assertEqual(self.browser.headers['Status'], '200 Ok') 195 200 self.assertEqual(self.browser.url, self.manage_student_path) 196 self.browser.open(self.student_path) 197 self.browser.getLink("View clearance data").click() 201 202 self.browser.open(self.student_path) 203 self.browser.getLink("Clearance Data").click() 198 204 self.assertEqual(self.browser.headers['Status'], '200 Ok') 199 205 self.assertEqual(self.browser.url, self.clearance_student_path) 200 self.browser.getLink("Edit clearance data").click()206 self.browser.getLink("Edit").click() 201 207 self.assertEqual(self.browser.headers['Status'], '200 Ok') 202 208 self.assertEqual(self.browser.url, self.edit_clearance_student_path) 203 self.browser.open(self.student_path) 204 self.browser.getLink("View personal data").click() 209 210 self.browser.open(self.student_path) 211 self.browser.getLink("Personal Data").click() 205 212 self.assertEqual(self.browser.headers['Status'], '200 Ok') 206 213 self.assertEqual(self.browser.url, self.personal_student_path) 207 self.browser.getLink("Edit personal data").click()214 self.browser.getLink("Edit").click() 208 215 self.assertEqual(self.browser.headers['Status'], '200 Ok') 209 216 self.assertEqual(self.browser.url, self.edit_personal_student_path) 217 218 self.browser.open(self.student_path) 219 self.browser.getLink("Study Course").click() 220 self.assertEqual(self.browser.headers['Status'], '200 Ok') 221 self.assertEqual(self.browser.url, self.studycourse_student_path) 222 223 self.browser.open(self.student_path) 224 self.browser.getLink("Payments").click() 225 self.assertEqual(self.browser.headers['Status'], '200 Ok') 226 self.assertEqual(self.browser.url, self.payments_student_path) 227 228 self.browser.open(self.student_path) 229 self.browser.getLink("Accommodation").click() 230 self.assertEqual(self.browser.headers['Status'], '200 Ok') 231 self.assertEqual(self.browser.url, self.accommodation_student_path) 232 210 233 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py
r6633 r6635 30 30 Student, StudentFactory, 31 31 ) 32 from waeup.sirp.students.studycourse import (33 StudentStudyCourse, 34 ) 32 from waeup.sirp.students.studycourse import StudentStudyCourse 33 from waeup.sirp.students.payments import StudentPayments 34 from waeup.sirp.students.accommodation import StudentAccommodation 35 35 from waeup.sirp.students.interfaces import ( 36 IStudent, IStudentStudyCourse, 36 IStudent, IStudentStudyCourse, IStudentPayments, IStudentAccommodation, 37 37 ) 38 38 from waeup.sirp.testing import FunctionalLayer … … 46 46 self.student = Student() 47 47 self.studycourse = StudentStudyCourse() 48 self.payments = StudentPayments() 49 self.accommodation = StudentAccommodation() 48 50 return 49 51 … … 57 59 verify.verifyClass(IStudentStudyCourse, StudentStudyCourse) 58 60 verify.verifyObject(IStudentStudyCourse, self.studycourse) 61 verify.verifyClass(IStudentPayments, StudentPayments) 62 verify.verifyObject(IStudentPayments, self.payments) 63 verify.verifyClass(IStudentAccommodation, StudentAccommodation) 64 verify.verifyObject(IStudentAccommodation, self.accommodation) 59 65 return 60 66
Note: See TracChangeset for help on using the changeset viewer.