Changeset 6695
- Timestamp:
- 9 Sep 2011, 06:03:28 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 5 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6694 r6695 66 66 IStudentPersonal, IStudentBase, IStudentStudyCourse, 67 67 IStudentPayments, IStudentAccommodation, IStudentNavigation, 68 IStudentBaseEdit, 68 IStudentBaseEdit, IStudentClearanceEdit, 69 69 ) 70 70 from waeup.sirp.students.student import Student … … 117 117 grok.name('index') 118 118 grok.require('waeup.viewStudent') 119 grok.template(' studentscontainerpage')119 grok.template('containerpage') 120 120 label = 'Student Section' 121 121 title = 'Students' … … 156 156 grok.name('manage') 157 157 grok.require('waeup.manageStudents') 158 grok.template(' studentscontainermanagepage')158 grok.template('containermanagepage') 159 159 pnav = 4 160 160 title = 'Manage student section' … … 233 233 grok.name('index') 234 234 grok.require('waeup.viewStudent') 235 grok.template(' studentpage')235 grok.template('basepage') 236 236 form_fields = grok.AutoFields(IStudentBase).omit('password') 237 237 pnav = 4 … … 247 247 grok.view(StudentBaseDisplayFormPage) 248 248 grok.require('waeup.manageStudents') 249 text = ' Edit'249 text = 'Manage' 250 250 target = 'edit_base' 251 251 … … 257 257 grok.require('waeup.manageStudents') 258 258 form_fields = grok.AutoFields(IStudentBase).omit('student_id') 259 grok.template(' studentbasemanagepage')260 label = ' Editbase data'259 grok.template('basemanagepage') 260 label = 'Manage base data' 261 261 title = 'Base Data' 262 262 pnav = 4 … … 303 303 grok.name('view_clearance') 304 304 grok.require('waeup.viewStudent') 305 form_fields = grok.AutoFields(IStudentClearance) 305 form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked') 306 306 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 307 307 title = 'Clearance Data' … … 317 317 grok.view(StudentClearanceDisplayFormPage) 318 318 grok.require('waeup.manageStudents') 319 text = ' Edit'319 text = 'Manage' 320 320 target = 'edit_clearance' 321 321 … … 327 327 grok.require('waeup.manageStudents') 328 328 form_fields = grok.AutoFields(IStudentClearance) 329 label = ' Editclearance data'329 label = 'Manage clearance data' 330 330 title = 'Clearance Data' 331 331 pnav = 4 … … 337 337 return super(StudentClearanceManageFormPage, self).update() 338 338 339 @grok.action('Save') 340 def save(self, **data): 341 changed_fields = self.applyData(self.context, **data) 342 changed_fields = changed_fields.values() 343 fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields) 344 self.context._p_changed = True 345 form = self.request.form 346 self.flash('Form has been saved.') 347 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 348 if fields_string: 349 self.context.loggerInfo(ob_class, 'saved: % s' % fields_string) 350 return 351 339 352 class StudentPersonalDisplayFormPage(WAeUPDisplayFormPage): 340 353 """ Page to display student personal data … … 356 369 grok.view(StudentPersonalDisplayFormPage) 357 370 grok.require('waeup.manageStudents') 358 text = ' Edit'371 text = 'Manage' 359 372 target = 'edit_personal' 360 373 … … 366 379 grok.require('waeup.viewStudent') 367 380 form_fields = grok.AutoFields(IStudentPersonal) 368 label = ' Editpersonal data'381 label = 'Manage personal data' 369 382 title = 'Personal Data' 370 383 pnav = 4 … … 390 403 grok.view(StudyCourseDisplayFormPage) 391 404 grok.require('waeup.manageStudents') 392 text = ' Edit'405 text = 'Manage' 393 406 target = 'edit' 394 407 … … 400 413 grok.require('waeup.manageStudents') 401 414 form_fields = grok.AutoFields(IStudentStudyCourse) 402 label = 'Edit clearance data'403 415 title = 'Study Course' 404 label = ' Editstudy course'416 label = 'Manage study course' 405 417 pnav = 4 406 418 … … 466 478 grok.require('waeup.handleStudent') 467 479 form_fields = grok.AutoFields(IStudentBaseEdit).omit('student_id') 468 grok.template(' studentbaseeditpage')480 grok.template('baseeditpage') 469 481 label = 'Change password' 470 482 title = 'Base Data' … … 491 503 IUserAccount(self.context).setPassword(form['form.password']) 492 504 return 505 506 class StudentClearanceEditActionButton(ManageActionButton): 507 grok.order(1) 508 grok.context(IStudent) 509 grok.view(StudentClearanceDisplayFormPage) 510 grok.require('waeup.handleStudent') 511 text = 'Edit and submit' 512 target = 'cedit' 513 514 class StudentClearanceEditFormPage(StudentClearanceManageFormPage): 515 """ View to edit student clearance data by student 516 """ 517 grok.context(IStudent) 518 grok.name('cedit') 519 grok.require('waeup.handleStudent') 520 form_fields = grok.AutoFields(IStudentClearanceEdit).omit('clearance_locked') 521 #grok.template('clearanceeditpage') 522 label = 'Edit clerance data' 523 title = 'Clearance Data' 524 pnav = 4 525 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') -
main/waeup.sirp/trunk/src/waeup/sirp/students/container.py
r6684 r6695 49 49 raise TypeError( 50 50 'StudentsContainers contain only IStudent instances') 51 student.clearance_locked = True 51 52 self[student.student_id] = student 52 53 studycourse = StudentStudyCourse() -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6694 r6695 91 91 ) 92 92 93 clearance_locked = schema.Bool( 94 title = u'Clearance form locked', 95 default = False, 96 ) 97 93 98 class IStudentPersonal(IWAeUPObject): 94 99 """Representation of student personal data. -
main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
r6694 r6695 24 24 from waeup.sirp.interfaces import IObjectHistory 25 25 from waeup.sirp.students.interfaces import ( 26 IStudent, IStudentNavigation, IStudentBaseEdit, 27 )26 IStudent, IStudentNavigation, IStudentBaseEdit, IStudentClearanceEdit, 27 IStudentPersonalEdit) 28 28 from waeup.sirp.utils.helpers import attrs_to_fields 29 29 from waeup.sirp.students.utils import generate_student_id … … 34 34 """ 35 35 grok.implements(IStudent, IStudentNavigation, 36 IStudentBaseEdit )36 IStudentBaseEdit, IStudentClearanceEdit, IStudentPersonalEdit) 37 37 grok.provides(IStudent) 38 38 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6694 r6695 199 199 self.assertEqual(self.browser.headers['Status'], '200 Ok') 200 200 self.assertEqual(self.browser.url, self.student_path) 201 self.browser.getLink(" Edit").click()201 self.browser.getLink("Manage").click() 202 202 self.assertEqual(self.browser.headers['Status'], '200 Ok') 203 203 self.assertEqual(self.browser.url, self.manage_student_path) … … 213 213 self.assertEqual(self.browser.headers['Status'], '200 Ok') 214 214 self.assertEqual(self.browser.url, self.clearance_student_path) 215 self.browser.getLink(" Edit").click()215 self.browser.getLink("Manage").click() 216 216 self.assertEqual(self.browser.headers['Status'], '200 Ok') 217 217 self.assertEqual(self.browser.url, self.edit_clearance_student_path) … … 221 221 self.assertEqual(self.browser.headers['Status'], '200 Ok') 222 222 self.assertEqual(self.browser.url, self.personal_student_path) 223 self.browser.getLink(" Edit").click()223 self.browser.getLink("Manage").click() 224 224 self.assertEqual(self.browser.headers['Status'], '200 Ok') 225 225 self.assertEqual(self.browser.url, self.edit_personal_student_path) … … 229 229 self.assertEqual(self.browser.headers['Status'], '200 Ok') 230 230 self.assertEqual(self.browser.url, self.studycourse_student_path) 231 self.browser.getLink(" Edit").click()232 self.assertTrue(' Editstudy course' in self.browser.contents)231 self.browser.getLink("Manage").click() 232 self.assertTrue('Manage study course' in self.browser.contents) 233 233 234 234 self.browser.open(self.student_path) … … 274 274 # We can login again with the new password 275 275 self.browser.getLink("Login").click() 276 #self.browser.open(self.login_path)276 self.browser.open(self.login_path) 277 277 self.browser.getControl(name="form.login").value = self.test_student_id 278 278 self.browser.getControl(name="form.password").value = 'new_password' … … 280 280 self.assertEqual(self.browser.url, self.student_path) 281 281 self.assertTrue('You logged in' in self.browser.contents) 282 return 282 283 return
Note: See TracChangeset for help on using the changeset viewer.