Changeset 9281
- Timestamp:
- 3 Oct 2012, 07:08:02 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r9251 r9281 19 19 from zope.i18n import translate 20 20 from zope.schema.interfaces import ConstraintNotSatisfied 21 from hurry.workflow.interfaces import IWorkflowInfo 21 22 from waeup.kofa.interfaces import REQUESTED 22 23 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 23 24 from waeup.kofa.browser.layout import KofaEditFormPage 24 25 from waeup.kofa.browser.viewlets import ManageActionButton 25 from waeup.kofa.browser.layout import action 26 from waeup.kofa.browser.layout import action, jsaction 26 27 from waeup.kofa.students.browser import ( 27 28 StudentClearPage, StudentRejectClearancePage, 28 StudyCourseDisplayFormPage, msave, emit_lock_message) 29 StudyCourseDisplayFormPage, 30 StudyLevelEditFormPage, 31 msave, emit_lock_message) 29 32 from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS 30 33 from kofacustom.nigeria.students.browser import ( … … 32 35 NigeriaStudentBaseManageFormPage, 33 36 NigeriaOnlinePaymentAddFormPage, 34 NigeriaExportPDFPaymentSlipPage) 37 NigeriaExportPDFPaymentSlipPage, 38 ) 35 39 #from waeup.uniben.students.interfaces import ICustomStudent 36 40 … … 117 121 118 122 class StudyCourseCOEditFormPage(KofaEditFormPage): 119 """ Page to edit the student study course data by clearance officers 123 """ Page to edit the student study course data by clearance officers. 120 124 121 125 This form page is available only in Uniben. … … 147 151 #notify(grok.ObjectModifiedEvent(self.context.__parent__)) 148 152 return 153 154 class CustomStudyLevelEditFormPage(StudyLevelEditFormPage): 155 """ Page to edit the student study level data by students. 156 157 """ 158 159 def _registerCourses(self, **data): 160 """ This customized version does allow 'special postgraduate' 161 students to register their courses. 162 """ 163 if self.context.student.is_postgrad and \ 164 not self.context.student.is_special_postgrad: 165 self.flash(_( 166 "You are a postgraduate student, " 167 "your course list can't bee registered.")) 168 self.redirect(self.url(self.context)) 169 return 170 if self.total_credits > self.max_credits: 171 self.flash(_('Maximum credits of ${a} exceeded.', 172 mapping = {'a':self.max_credits})) 173 return 174 IWorkflowInfo(self.context.student).fireTransition( 175 'register_courses') 176 self.flash(_('Course list has been registered.')) 177 self.redirect(self.url(self.context)) 178 return -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r9251 r9281 487 487 self.assertMatches('...has been saved...', self.browser.contents) 488 488 self.assertEqual(self.student.current_level, 200) 489 490 def test_postgraduate_student_access(self): 491 self.certificate.study_mode = 'special_pg_pt' 492 self.certificate.start_level = 700 493 self.certificate.end_level = 800 494 self.student['studycourse'].current_level = 700 495 IWorkflowState(self.student).setState('school fee paid') 496 self.browser.open(self.login_path) 497 self.browser.getControl(name="form.login").value = self.student_id 498 self.browser.getControl(name="form.password").value = 'spwd' 499 self.browser.getControl("Login").click() 500 self.assertTrue( 501 'You logged in.' in self.browser.contents) 502 # Now students can add the current study level 503 self.browser.getLink("Study Course").click() 504 self.browser.getLink("Add course list").click() 505 self.assertMatches('...Add current level 700...', 506 self.browser.contents) 507 self.browser.getControl("Create course list now").click() 508 # A level with one course ticket was created 509 self.assertEqual(self.student['studycourse']['700'].number_of_tickets, 0) 510 self.browser.getLink("700").click() 511 self.browser.getLink("Edit course list").click() 512 self.browser.getControl("Add course ticket").click() 513 self.browser.getControl(name="form.course").value = ['COURSE1'] 514 self.browser.getControl("Add course ticket").click() 515 self.assertMatches('...Successfully added COURSE1...', 516 self.browser.contents) 517 # Special postgraduate students can register course lists 518 self.browser.getControl("Register course list").click() 519 self.assertMatches('...Course list has been registered...', 520 self.browser.contents) 521 self.assertEqual(self.student.state, 'courses registered') 522 return
Note: See TracChangeset for help on using the changeset viewer.