- Timestamp:
- 23 Apr 2014, 10:29:32 (11 years ago)
- Location:
- main/waeup.aaue/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/CHANGES.txt
r11591 r11597 4 4 1.2dev (unreleased) 5 5 =================== 6 7 * constructMatricNumber customized. AAUE matric number construction scheme 8 applied. View and viewlet added which enable students to generate 9 a matric number. 6 10 7 11 * STUDY_MODES_DICT customized. -
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r11555 r11597 19 19 from zope.i18n import translate 20 20 from zope.component import getUtility 21 from waeup.kofa.browser.layout import UtilityView 21 22 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 22 23 from waeup.kofa.interfaces import IKofaUtils 23 from waeup.kofa.students.interfaces import IStudentsUtils 24 from waeup.kofa.students.interfaces import IStudentsUtils, IStudent 24 25 from waeup.kofa.students.browser import ( 25 26 StudentBasePDFFormPage, … … 188 189 'waeup.kofa', target_language=portal_language) \ 189 190 + ' %s' % self.context.display_fullname 191 192 class StudentGetMatricNumberPage(UtilityView, grok.View): 193 """ Construct and set the matriculation number. 194 """ 195 grok.context(IStudent) 196 grok.name('get_matric_number') 197 grok.require('waeup.viewStudent') 198 199 def update(self): 200 students_utils = getUtility(IStudentsUtils) 201 msg, mnumber = students_utils.setMatricNumber(self.context) 202 if msg: 203 self.flash(msg, type="danger") 204 else: 205 self.flash(_('Matriculation number %s assigned.' % mnumber)) 206 self.redirect(self.url(self.context)) 207 return 208 209 def render(self): 210 return -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r11596 r11597 18 18 import shutil 19 19 import tempfile 20 import grok 21 from mechanize import LinkNotFoundError 20 22 from hurry.workflow.interfaces import IWorkflowState 21 23 from zope.component.hooks import setSite, clearSite … … 332 334 return 333 335 334 336 def test_set_matric_number(self): 337 # Login as student 338 self.browser.open(self.login_path) 339 #IWorkflowState(self.student).setState('school fee paid') 340 self.browser.open(self.login_path) 341 self.browser.getControl(name="form.login").value = self.student_id 342 self.browser.getControl(name="form.password").value = 'spwd' 343 self.browser.getControl("Login").click() 344 self.assertRaises( 345 LinkNotFoundError, 346 self.browser.getLink, 'Get Matriculation Number') 347 self.student.matric_number = None 348 site = grok.getSite() 349 site['configuration'].next_matric_integer = 1 350 self.student['studycourse'].certificate.study_mode = 'ug_pt' 351 self.browser.open(self.student_path) 352 self.browser.getLink("Get Matriculation Number").click() 353 self.assertTrue('Matriculation number PTP/fac1/dep1/04/00001 assigned.' 354 in self.browser.contents) 355 self.assertEqual(self.student.matric_number, 'PTP/fac1/dep1/04/00001') 356 self.assertRaises( 357 LinkNotFoundError, 358 self.browser.getLink, 'Get Matriculation Number') 359 return 360 -
main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py
r9870 r11597 17 17 ## 18 18 19 import grok 20 from zope.component import getUtility 21 from waeup.kofa.students.interfaces import IStudent, IStudentsUtils 19 22 from waeup.kofa.students.viewlets import ( 20 AddPreviousPaymentActionButton, AddBalancePaymentActionButton) 23 AddPreviousPaymentActionButton, AddBalancePaymentActionButton, 24 ManageActionButton, StudentBaseDisplayFormPage) 25 26 from waeup.aaue.interfaces import MessageFactory as _ 21 27 22 28 class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton): … … 31 37 def target_url(self): 32 38 return '' 39 40 class GetMatricNumberActionButton(ManageActionButton): 41 grok.order(10) 42 grok.context(IStudent) 43 grok.view(StudentBaseDisplayFormPage) 44 grok.require('waeup.viewStudent') 45 icon = 'actionicon_count.png' 46 text = _('Get Matriculation Number') 47 48 @property 49 def target_url(self): 50 students_utils = getUtility(IStudentsUtils) 51 if self.context.matric_number: 52 return '' 53 matric_number = students_utils.constructMatricNumber(self.context) 54 if not matric_number: 55 return '' 56 return self.view.url(self.view.context, 'get_matric_number')
Note: See TracChangeset for help on using the changeset viewer.