Changeset 7723
- Timestamp:
- 29 Feb 2012, 13:29:35 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/workflow.py
r7719 r7723 26 26 from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent 27 27 from waeup.sirp.accesscodes.interfaces import IAccessCode 28 from waeup.sirp.interfaces import IObjectHistory, ISIRPWorkflowInfo , ISIRPUtils28 from waeup.sirp.interfaces import IObjectHistory, ISIRPWorkflowInfo 29 29 from waeup.sirp.interfaces import MessageFactory as _ 30 30 from waeup.sirp.workflow import SIRPWorkflow, SIRPWorkflowInfo … … 133 133 def handle_accesscode_transition_event(obj, event): 134 134 # append message to history 135 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE136 135 if event.comment is not None: 137 136 msg = event.comment -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7687 r7723 24 24 from datetime import datetime 25 25 from zope.event import notify 26 from zope.i18n import translate 26 27 from zope.catalog.interfaces import ICatalog 27 28 from zope.component import queryUtility, getUtility, createObject … … 77 78 notify(grok.ObjectModifiedEvent(view.context.getStudent())) 78 79 fields_string = ' + '.join(changed_fields) 79 view.flash( 'Form has been saved.')80 view.flash(_('Form has been saved.')) 80 81 if fields_string: 81 82 write_log_message(view, 'saved: %s' % fields_string) … … 85 86 """Flash a lock message. 86 87 """ 87 view.flash( 'The requested form is locked (read-only).')88 view.flash(_('The requested form is locked (read-only).')) 88 89 view.redirect(view.url(view.context)) 89 90 return … … 93 94 """ 94 95 grok.context(IStudentsContainer) 95 title = 'Students'96 title = _('Students') 96 97 97 98 @property … … 114 115 """ 115 116 grok.context(IStudentStudyCourse) 116 title = 'Study Course'117 title = _('Study Course') 117 118 118 119 class PaymentsBreadcrumb(Breadcrumb): … … 120 121 """ 121 122 grok.context(IStudentPaymentsContainer) 122 title = 'Payments'123 title = _('Payments') 123 124 124 125 class OnlinePaymentBreadcrumb(Breadcrumb): … … 135 136 """ 136 137 grok.context(IStudentAccommodation) 137 title = 'Accommodation'138 title = _('Accommodation') 138 139 139 140 class BedTicketBreadcrumb(Breadcrumb): … … 144 145 @property 145 146 def title(self): 146 return 'Bed Ticket %s' % self.context.getSessionString() 147 return _('Bed Ticket ${a}', 148 mapping = {'a':self.context.getSessionString()}) 147 149 148 150 class StudyLevelBreadcrumb(Breadcrumb): … … 153 155 @property 154 156 def title(self): 155 return self.context.level_title 157 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 158 # There is no request attribute, thus we can only translate 159 # to the default (portal) language 160 return translate(self.context.level_title, 'waeup.sirp', 161 target_language=portal_language) 156 162 157 163 class StudentsContainerPage(SIRPPage): … … 162 168 grok.require('waeup.viewStudentsContainer') 163 169 grok.template('containerpage') 164 label = 'Student Section'170 label = _('Student Section') 165 171 pnav = 4 166 172 … … 177 183 else: 178 184 if 'search' in form: 179 self.flash( 'Empty search string.')185 self.flash(_('Empty search string.')) 180 186 return 181 187 if self.searchtype == 'current_session': … … 195 201 grok.template('containermanagepage') 196 202 pnav = 4 197 label = 'Manage student section'203 label = _('Manage student section') 198 204 199 205 def update(self, *args, **kw): … … 211 217 else: 212 218 if 'search' in form: 213 self.flash( 'Empty search string.')219 self.flash(_('Empty search string.')) 214 220 return 215 221 if not 'entries' in form: … … 217 223 searchtype=self.searchtype, view=self) 218 224 if not self.hitlist: 219 self.flash( 'No student found.')225 self.flash(_('No student found.')) 220 226 if 'remove' in form: 221 self.flash( 'No item selected.')227 self.flash(_('No item selected.')) 222 228 return 223 229 entries = form['entries'] … … 232 238 searchtype=self.searchtype, view=self) 233 239 if len(deleted): 234 self.flash('Successfully removed: %s' % ', '.join(deleted)) 240 self.flash(_('Successfully removed: ${a}', 241 mapping = {'a':', '.join(deleted)})) 235 242 return 236 243 … … 243 250 form_fields = grok.AutoFields(IStudent).select( 244 251 'firstname', 'middlename', 'lastname', 'reg_number') 245 label = 'Add student'246 pnav = 4 247 248 @action( 'Create student record', style='primary')252 label = _('Add student') 253 pnav = 4 254 255 @action(_('Create student record'), style='primary') 249 256 def addStudent(self, **data): 250 257 student = createObject(u'waeup.Student') 251 258 self.applyData(student, **data) 252 259 self.context.addStudent(student) 253 self.flash( 'Student record created.')260 self.flash(_('Student record created.')) 254 261 self.redirect(self.url(self.context[student.student_id], 'index')) 255 262 return … … 267 274 @property 268 275 def label(self): 269 return '%s: Base Data' % self.context.display_fullname 276 return _('${a}: Base Data', 277 mapping = {'a':self.context.display_fullname}) 270 278 271 279 @property 272 280 def hasPassword(self): 273 281 if self.context.password: 274 return 'set'275 return 'unset'282 return _('set') 283 return _('unset') 276 284 277 285 class ContactStudentForm(ContactAdminForm): … … 288 296 289 297 def label(self): 290 return u'Send message to %s' % self.context.display_fullname 298 return _(u'Send message to ${a}', 299 mapping = {'a':self.context.display_fullname}) 291 300 292 301 @action('Send message now', style='primary') … … 306 315 data['body'],data['subject']) 307 316 if success: 308 self.flash( 'Your message has been sent.')317 self.flash(_('Your message has been sent.')) 309 318 else: 310 self.flash( 'An smtp server error occurred.')319 self.flash(_('An smtp server error occurred.')) 311 320 return 312 321 … … 319 328 form_fields = grok.AutoFields(IStudentBase).omit('student_id') 320 329 grok.template('basemanagepage') 321 label = 'Manage base data'330 label = _('Manage base data') 322 331 pnav = 4 323 332 … … 345 354 dict(name=x, title=y) for x, y in allowed_transitions] 346 355 347 @action( 'Save', style='primary')356 @action(_('Save'), style='primary') 348 357 def save(self, **data): 349 358 form = self.request.form … … 371 380 self.wf_info.fireTransition(transition_id) 372 381 fields_string = ' + '.join(changed_fields) 373 self.flash( 'Form has been saved.')382 self.flash(_('Form has been saved.')) 374 383 if fields_string: 375 384 write_log_message(self, 'saved: % s' % fields_string) … … 388 397 @property 389 398 def label(self): 390 return '%s: Clearance Data' % self.context.display_fullname 399 return _('${a}: Clearance Data', 400 mapping = {'a':self.context.display_fullname}) 391 401 392 402 class ExportPDFClearanceSlipPage(grok.View): … … 399 409 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 400 410 prefix = 'form' 401 title = 'Clearance Data' 411 412 @property 413 def title(self): 414 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 415 return translate(_('Clearance Data'), 'waeup.sirp', 416 target_language=portal_language) 402 417 403 418 @property 404 419 def label(self): 405 return 'Clearance Slip of %s' % self.context.display_fullname 420 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 421 return translate(_('Clearance Slip of '), 422 'waeup.sirp', target_language=portal_language) \ 423 + ' %s' % self.context.display_fullname 406 424 407 425 def render(self): … … 421 439 grok.template('clearanceeditpage') 422 440 form_fields = grok.AutoFields(IStudentClearance) 423 label = 'Manage clearance data'441 label = _('Manage clearance data') 424 442 pnav = 4 425 443 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') … … 435 453 return super(StudentClearanceManageFormPage, self).update() 436 454 437 @action( 'Save', style='primary')455 @action(_('Save'), style='primary') 438 456 def save(self, **data): 439 457 msave(self, **data) … … 450 468 if self.context.state == REQUESTED: 451 469 IWorkflowInfo(self.context).fireTransition('clear') 452 self.flash( 'Student has been cleared.')470 self.flash(_('Student has been cleared.')) 453 471 else: 454 self.flash( 'Student is in the wrong state.')472 self.flash(_('Student is in wrong state.')) 455 473 self.redirect(self.url(self.context,'view_clearance')) 456 474 return … … 469 487 if self.context.state == CLEARED: 470 488 IWorkflowInfo(self.context).fireTransition('reset4') 471 message = 'Clearance has been annulled'489 message = _('Clearance has been annulled.') 472 490 self.flash(message) 473 491 elif self.context.state == REQUESTED: 474 492 IWorkflowInfo(self.context).fireTransition('reset3') 475 message = 'Clearance request has been rejected'493 message = _('Clearance request has been rejected.') 476 494 self.flash(message) 477 495 else: 478 self.flash( 'Student is in the wrong state.')496 self.flash(_('Student is in wrong state.')) 479 497 self.redirect(self.url(self.context,'view_clearance')) 480 498 return … … 499 517 @property 500 518 def label(self): 501 return '%s: Personal Data' % self.context.display_fullname 519 return _('${a}: Personal Data', 520 mapping = {'a':self.context.display_fullname}) 502 521 503 522 class StudentPersonalManageFormPage(SIRPEditFormPage): … … 508 527 grok.require('waeup.viewStudent') 509 528 form_fields = grok.AutoFields(IStudentPersonal) 510 label = 'Manage personal data'511 pnav = 4 512 513 @action( 'Save', style='primary')529 label = _('Manage personal data') 530 pnav = 4 531 532 @action(_('Save'), style='primary') 514 533 def save(self, **data): 515 534 msave(self, **data) … … 528 547 @property 529 548 def label(self): 530 return '%s: Study Course' % self.context.__parent__.display_fullname 549 return _('${a}: Study Course', 550 mapping = {'a':self.context.__parent__.display_fullname}) 531 551 532 552 @property … … 557 577 grok.template('studycoursemanagepage') 558 578 form_fields = grok.AutoFields(IStudentStudyCourse) 559 label = 'Manage study course'560 pnav = 4 561 taboneactions = [ 'Save','Cancel']562 tabtwoactions = [ 'Remove selected levels','Cancel']563 tabthreeactions = [ 'Add study level']579 label = _('Manage study course') 580 pnav = 4 581 taboneactions = [_('Save'),_('Cancel')] 582 tabtwoactions = [_('Remove selected levels'),_('Cancel')] 583 tabthreeactions = [_('Add study level')] 564 584 565 585 def update(self): … … 575 595 return 576 596 577 @action( 'Save', style='primary')597 @action(_('Save'), style='primary') 578 598 def save(self, **data): 579 599 msave(self, **data) … … 587 607 yield(dict(code=code, title=title)) 588 608 589 @action( 'Add study level')609 @action(_('Add study level')) 590 610 def addStudyLevel(self, **data): 591 611 level_code = self.request.form.get('addlevel', None) … … 595 615 self.context.addStudentStudyLevel( 596 616 self.context.certificate,studylevel) 597 self.flash( 'Study level has been added.')617 self.flash(_('Study level has been added.')) 598 618 except KeyError: 599 self.flash( 'This level exists.')619 self.flash(_('This level exists.')) 600 620 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 601 621 return 602 622 603 @jsaction( 'Remove selected levels')623 @jsaction(_('Remove selected levels')) 604 624 def delStudyLevels(self, **data): 605 625 form = self.request.form … … 607 627 child_id = form['val_id'] 608 628 else: 609 self.flash( 'No study level selected.')629 self.flash(_('No study level selected.')) 610 630 self.redirect(self.url(self.context, '@@manage')+'?tab2') 611 631 return … … 614 634 deleted = [] 615 635 for id in child_id: 616 try: 617 del self.context[id] 618 deleted.append(id) 619 except: 620 self.flash('Could not delete %s: %s: %s' % ( 621 id, sys.exc_info()[0], sys.exc_info()[1])) 636 del self.context[id] 637 deleted.append(id) 622 638 if len(deleted): 623 self.flash('Successfully removed: %s' % ', '.join(deleted)) 639 self.flash(_('Successfully removed: ${a}', 640 mapping = {'a':', '.join(deleted)})) 624 641 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 625 642 return … … 642 659 @property 643 660 def label(self): 644 return '%s: Study Level %s' % ( 645 self.context.getStudent().display_fullname,self.context.level_title) 661 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 662 lang = self.request.cookies.get('sirp.language', portal_language) 663 level_title = translate(self.context.level_title, 'waeup.sirp', 664 target_language=lang) 665 return _('${a}: Study Level ${b}', mapping = { 666 'a':self.context.getStudent().display_fullname, 667 'b':level_title}) 646 668 647 669 @property … … 660 682 form_fields = grok.AutoFields(IStudentStudyLevel) 661 683 prefix = 'form' 662 title = 'Level Data' 663 content_title = 'Course List' 684 685 @property 686 def title(self): 687 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 688 return translate(_('Level Data'), 'waeup.sirp', 689 target_language=portal_language) 690 691 @property 692 def content_title(self): 693 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 694 return translate(_('Course List'), 'waeup.sirp', 695 target_language=portal_language) 664 696 665 697 @property 666 698 def label(self): 667 return 'Course Registration Slip %s' % self.context.level_title 699 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 700 lang = self.request.cookies.get('sirp.language', portal_language) 701 level_title = translate(self.context.level_title, 'waeup.sirp', 702 target_language=lang) 703 return translate(_('Course Registration Slip '), 704 'waeup.sirp', target_language=portal_language) \ 705 + ' %s' % level_title 668 706 669 707 def render(self): 708 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 709 Sem = translate(_('Sem.'), 'waeup.sirp', target_language=portal_language) 710 Code = translate(_('Code'), 'waeup.sirp', target_language=portal_language) 711 Title = translate(_('Title'), 'waeup.sirp', target_language=portal_language) 712 Dept = translate(_('Dept.'), 'waeup.sirp', target_language=portal_language) 713 Faculty = translate(_('Faculty'), 'waeup.sirp', target_language=portal_language) 714 Cred = translate(_('Cred.'), 'waeup.sirp', target_language=portal_language) 715 Mand = translate(_('Mand.'), 'waeup.sirp', target_language=portal_language) 716 Score = translate(_('Score'), 'waeup.sirp', target_language=portal_language) 670 717 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 671 718 self.request) … … 676 723 self, 'course_registration.pdf', 677 724 self.context.getStudent(), studentview, 678 tableheader=[( 'Sem.','semester', 1.5),('Code','code', 2.5),679 ( 'Title','title', 5),680 ( 'Dept.','dcode', 1.5), ('Faculty','fcode', 1.5),681 ( 'Cred.', 'credits', 1.5),682 ( 'Mand.', 'mandatory', 1.5),683 ( 'Score', 'score', 1.5),('Auto', 'automatic', 1.5)725 tableheader=[(Sem,'semester', 1.5),(Code,'code', 2.5), 726 (Title,'title', 5), 727 (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 728 (Cred, 'credits', 1.5), 729 (Mand, 'mandatory', 1.5), 730 (Score, 'score', 1.5),('Auto', 'automatic', 1.5) 684 731 ], 685 732 tabledata=tabledata) … … 694 741 form_fields = grok.AutoFields(IStudentStudyLevel) 695 742 pnav = 4 696 taboneactions = ['Save','Cancel'] 697 tabtwoactions = ['Add course ticket','Remove selected tickets','Cancel'] 743 taboneactions = [_('Save'),_('Cancel')] 744 tabtwoactions = [_('Add course ticket'), 745 _('Remove selected tickets'),_('Cancel')] 698 746 699 747 def update(self): … … 711 759 @property 712 760 def label(self): 713 return 'Manage study level %s' % self.context.level_title 714 715 @action('Save', style='primary') 761 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 762 lang = self.request.cookies.get('sirp.language', portal_language) 763 level_title = translate(self.context.level_title, 'waeup.sirp', 764 target_language=lang) 765 return _('Manage study level ${a}', 766 mapping = {'a':level_title}) 767 768 @action(_('Save'), style='primary') 716 769 def save(self, **data): 717 770 msave(self, **data) 718 771 return 719 772 720 @action( 'Add course ticket')773 @action(_('Add course ticket')) 721 774 def addCourseTicket(self, **data): 722 775 self.redirect(self.url(self.context, '@@add')) 723 776 724 @jsaction( 'Remove selected tickets')777 @jsaction(_('Remove selected tickets')) 725 778 def delCourseTicket(self, **data): 726 779 form = self.request.form … … 728 781 child_id = form['val_id'] 729 782 else: 730 self.flash( 'No ticket selected.')783 self.flash(_('No ticket selected.')) 731 784 self.redirect(self.url(self.context, '@@manage')+'?tab2') 732 785 return … … 735 788 deleted = [] 736 789 for id in child_id: 737 try: 738 del self.context[id] 739 deleted.append(id) 740 except: 741 self.flash('Could not delete %s: %s: %s' % ( 742 id, sys.exc_info()[0], sys.exc_info()[1])) 790 del self.context[id] 791 deleted.append(id) 743 792 if len(deleted): 744 self.flash('Successfully removed: %s' % ', '.join(deleted)) 793 self.flash(_('Successfully removed: ${a}', 794 mapping = {'a':', '.join(deleted)})) 745 795 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 746 796 return … … 755 805 def update(self): 756 806 if str(self.context.__parent__.current_level) != self.context.__name__: 757 self.flash( 'This level does not correspond current level.')807 self.flash(_('This level does not correspond current level.')) 758 808 elif self.context.getStudent().state == REGISTERED: 759 809 IWorkflowInfo(self.context.getStudent()).fireTransition( 760 810 'validate_courses') 761 self.flash( 'Course list has been validated.')811 self.flash(_('Course list has been validated.')) 762 812 else: 763 self.flash( 'Student is in the wrong state.')813 self.flash(_('Student is in the wrong state.')) 764 814 self.redirect(self.url(self.context)) 765 815 return … … 777 827 def update(self): 778 828 if str(self.context.__parent__.current_level) != self.context.__name__: 779 self.flash( 'This level does not correspond current level.')829 self.flash(_('This level does not correspond current level.')) 780 830 self.redirect(self.url(self.context)) 781 831 return 782 832 elif self.context.getStudent().state == VALIDATED: 783 833 IWorkflowInfo(self.context.getStudent()).fireTransition('reset8') 784 message = 'Course list request has been annulled'834 message = _('Course list request has been annulled.') 785 835 self.flash(message) 786 836 elif self.context.getStudent().state == REGISTERED: 787 837 IWorkflowInfo(self.context.getStudent()).fireTransition('reset7') 788 message = 'Course list request has been rejected'838 message = _('Course list request has been rejected:') 789 839 self.flash(message) 790 840 else: 791 self.flash( 'Student is in the wrong state.')841 self.flash(_('Student is in the wrong state.')) 792 842 self.redirect(self.url(self.context)) 793 843 return … … 806 856 grok.name('add') 807 857 grok.require('waeup.manageStudent') 808 label = 'Add course ticket'858 label = _('Add course ticket') 809 859 form_fields = grok.AutoFields(ICourseTicketAdd).omit( 810 860 'grade', 'score', 'automatic', 'carry_over') 811 861 pnav = 4 812 862 813 @action( 'Add course ticket')863 @action(_('Add course ticket')) 814 864 def addCourseTicket(self, **data): 815 865 ticket = CourseTicket() … … 826 876 self.context.addCourseTicket(ticket) 827 877 except KeyError: 828 self.flash('The ticket exists.') 829 return 830 self.flash('Successfully added %s.' % ticket.code) 878 self.flash(_('The ticket exists.')) 879 return 880 self.flash(_('Successfully added ${a}.', 881 mapping = {'a':ticket.code})) 831 882 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 832 883 return 833 884 834 @action( 'Cancel')885 @action(_('Cancel')) 835 886 def cancel(self, **data): 836 887 self.redirect(self.url(self.context)) … … 848 899 @property 849 900 def label(self): 850 return '%s: Course Ticket %s' % ( 851 self.context.getStudent().display_fullname,self.context.code) 901 return _('${a}: Course Ticket ${b}', mapping = { 902 'a':self.context.getStudent().display_fullname, 903 'b':self.context.code}) 852 904 853 905 class CourseTicketManageFormPage(SIRPEditFormPage): … … 863 915 @property 864 916 def label(self): 865 return 'Manage course ticket %s' % self.context.code917 return _('Manage course ticket ${a}', mapping = {'a':self.context.code}) 866 918 867 919 @action('Save', style='primary') … … 890 942 @property 891 943 def label(self): 892 return '%s: Payments' % self.context.__parent__.display_fullname 944 return _('${a}: Payments', 945 mapping = {'a':self.context.__parent__.display_fullname}) 893 946 894 947 def update(self): … … 898 951 return 899 952 900 @jsaction( 'Remove selected tickets')953 @jsaction(_('Remove selected tickets')) 901 954 def delPaymentTicket(self, **data): 902 955 form = self.request.form … … 904 957 child_id = form['val_id'] 905 958 else: 906 self.flash( 'No payment selected.')959 self.flash(_('No payment selected.')) 907 960 self.redirect(self.url(self.context)) 908 961 return … … 913 966 # Students are not allowed to remove used payment tickets 914 967 if not self.unremovable(self.context[id]): 915 try: 916 del self.context[id] 917 deleted.append(id) 918 except: 919 self.flash('Could not delete %s: %s: %s' % ( 920 id, sys.exc_info()[0], sys.exc_info()[1])) 968 del self.context[id] 969 deleted.append(id) 921 970 if len(deleted): 922 self.flash('Successfully removed: %s' % ', '.join(deleted)) 971 self.flash(_('Successfully removed: ${a}', 972 mapping = {'a': ', '.join(deleted)})) 923 973 write_log_message(self,'removed: % s' % ', '.join(deleted)) 924 974 self.redirect(self.url(self.context)) 925 975 return 926 976 927 @action( 'Add online payment ticket')977 @action(_('Add online payment ticket')) 928 978 def addPaymentTicket(self, **data): 929 979 self.redirect(self.url(self.context, '@@addop')) … … 937 987 form_fields = grok.AutoFields(IStudentOnlinePayment).select( 938 988 'p_category') 939 label = 'Add online payment'940 pnav = 4 941 942 @action( 'Create ticket', style='primary')989 label = _('Add online payment') 990 pnav = 4 991 992 @action(_('Create ticket'), style='primary') 943 993 def createTicket(self, **data): 944 994 p_category = data['p_category'] … … 948 998 'configuration'].accommodation_session: 949 999 self.flash( 950 'Your current session does not match '951 'accommodation session.') 1000 _('Your current session does not match ' + \ 1001 'accommodation session.')) 952 1002 self.redirect(self.url(self.context)) 953 1003 return … … 968 1018 ticket.p_session == p_session: 969 1019 self.flash( 970 'This type of payment has already been made.')1020 _('This type of payment has already been made.')) 971 1021 self.redirect(self.url(self.context)) 972 1022 return … … 982 1032 payment.surcharge_3 = pay_details['surcharge_3'] 983 1033 self.context[payment.p_id] = payment 984 self.flash( 'Payment ticket created.')1034 self.flash(_('Payment ticket created.')) 985 1035 self.redirect(self.url(self.context)) 986 1036 return … … 1001 1051 @property 1002 1052 def label(self): 1003 return '%s: Online Payment Ticket %s' % ( 1004 self.context.getStudent().display_fullname,self.context.p_id) 1053 return _('${a}: Online Payment Ticket ${b}', mapping = { 1054 'a':self.context.getStudent().display_fullname, 1055 'b':self.context.p_id}) 1005 1056 1006 1057 class OnlinePaymentCallbackPage(UtilityView, grok.View): … … 1016 1067 def update(self): 1017 1068 if self.context.p_state == 'paid': 1018 self.flash( 'This ticket has already been paid.')1069 self.flash(_('This ticket has already been paid.')) 1019 1070 return 1020 1071 student = self.context.getStudent() … … 1029 1080 pin, error = create_accesscode('CLR',0,student.student_id) 1030 1081 if error: 1031 self.flash('Valid callback received. ' + error) 1082 self.flash(_('Valid callback received. ${a}', 1083 mapping = {'a':error})) 1032 1084 return 1033 1085 self.context.ac = pin … … 1036 1088 pin, error = create_accesscode('SFE',0,student.student_id) 1037 1089 if error: 1038 self.flash('Valid callback received. ' + error) 1090 self.flash(_('Valid callback received. ${a}', 1091 mapping = {'a':error})) 1039 1092 return 1040 1093 self.context.ac = pin … … 1043 1096 pin, error = create_accesscode('HOS',0,student.student_id) 1044 1097 if error: 1045 self.flash('Valid callback received. ' + error) 1098 self.flash(_('Valid callback received. ${a}', 1099 mapping = {'a':error})) 1046 1100 return 1047 1101 self.context.ac = pin 1048 self.flash( 'Valid callback received.')1102 self.flash(_('Valid callback received.')) 1049 1103 return 1050 1104 … … 1092 1146 grok.template('accommodationmanagepage') 1093 1147 pnav = 4 1094 officers_only_actions = [ 'Remove selected']1148 officers_only_actions = [_('Remove selected')] 1095 1149 1096 1150 @property 1097 1151 def label(self): 1098 return '%s: Accommodation' % self.context.__parent__.display_fullname 1152 return _('${a}: Accommodation', 1153 mapping = {'a':self.context.__parent__.display_fullname}) 1099 1154 1100 1155 def update(self): … … 1104 1159 return 1105 1160 1106 @jsaction( 'Remove selected')1161 @jsaction(_('Remove selected')) 1107 1162 def delBedTickets(self, **data): 1108 1163 if getattr(self.request.principal, 'user_type', None) == 'student': 1109 self.flash( 'You are not allowed to remove bed tickets.')1164 self.flash(_('You are not allowed to remove bed tickets.')) 1110 1165 self.redirect(self.url(self.context)) 1111 1166 return … … 1114 1169 child_id = form['val_id'] 1115 1170 else: 1116 self.flash( 'No bed ticket selected.')1171 self.flash(_('No bed ticket selected.')) 1117 1172 self.redirect(self.url(self.context)) 1118 1173 return … … 1124 1179 deleted.append(id) 1125 1180 if len(deleted): 1126 self.flash('Successfully removed: %s' % ', '.join(deleted)) 1181 self.flash(_('Successfully removed: ${a}', 1182 mapping = {'a':', '.join(deleted)})) 1127 1183 write_log_message(self,'removed: % s' % ', '.join(deleted)) 1128 1184 self.redirect(self.url(self.context)) … … 1144 1200 grok.template('enterpin') 1145 1201 ac_prefix = 'HOS' 1146 label = 'Add bed ticket'1147 pnav = 4 1148 buttonname = 'Create bed ticket'1202 label = _('Add bed ticket') 1203 pnav = 4 1204 buttonname = _('Create bed ticket') 1149 1205 notice = '' 1150 1206 … … 1154 1210 acc_details = students_utils.getAccommodationDetails(student) 1155 1211 if not acc_details: 1156 self.flash( "Your data are incomplete.")1212 self.flash(_("Your data are incomplete.")) 1157 1213 self.redirect(self.url(self.context)) 1158 1214 return 1159 1215 if not student.state in acc_details['allowed_states']: 1160 self.flash( "You are in the wrong registration state.")1216 self.flash(_("You are in the wrong registration state.")) 1161 1217 self.redirect(self.url(self.context)) 1162 1218 return … … 1164 1220 'booking_session']: 1165 1221 self.flash( 1166 'Your current session does not match accommodation session.')1222 _('Your current session does not match accommodation session.')) 1167 1223 self.redirect(self.url(self.context)) 1168 1224 return 1169 1225 if str(acc_details['booking_session']) in self.context.keys(): 1170 1226 self.flash( 1171 'You already booked a bed space in current '1172 'accommodation session.')1227 _('You already booked a bed space in current ' \ 1228 + 'accommodation session.')) 1173 1229 self.redirect(self.url(self.context)) 1174 1230 return … … 1180 1236 code = get_access_code(pin) 1181 1237 if not code: 1182 self.flash( 'Activation code is invalid.')1238 self.flash(_('Activation code is invalid.')) 1183 1239 return 1184 1240 # Search and book bed … … 1200 1256 bed.bookBed(student.student_id) 1201 1257 else: 1202 self.flash( 'There is no free bed in your category %s.'1203 % acc_details['bt'])1258 self.flash(_('There is no free bed in your category ${a}.', 1259 mapping = {'a':acc_details['bt']})) 1204 1260 return 1205 1261 # Mark pin as used (this also fires a pin related transition) 1206 1262 if code.state == USED: 1207 self.flash( 'Activation code has already been used.')1263 self.flash(_('Activation code has already been used.')) 1208 1264 return 1209 1265 else: 1210 comment = u"AC invalidated for %s" % ( 1211 self.context.getStudent().student_id,) 1266 comment = _(u'invalidated') 1212 1267 # Here we know that the ac is in state initialized so we do not 1213 1268 # expect an exception, but the owner might be different 1214 1269 if not invalidate_accesscode( 1215 1270 pin,comment,self.context.getStudent().student_id): 1216 self.flash( 'You are not the owner of this access code.')1271 self.flash(_('You are not the owner of this access code.')) 1217 1272 return 1218 1273 # Create bed ticket … … 1225 1280 coordinates = bed.getBedCoordinates()[1:] 1226 1281 block, room_nr, bed_nr = coordinates 1227 bedticket.bed_coordinates = '%s, Block %s, Room %s, Bed %s (%s)' % ( 1228 hall_title, block, room_nr, bed_nr, bed.bed_type) 1282 bc = _('${a}, Block ${b}, Room ${c}, Bed ${d} (${e})', mapping = { 1283 'a':hall_title, 'b':block, 1284 'c':room_nr, 'd':bed_nr, 1285 'e':bed.bed_type}) 1286 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 1287 bedticket.bed_coordinates = translate( 1288 bc, 'waeup.sirp',target_language=portal_language) 1229 1289 key = str(acc_details['booking_session']) 1230 1290 self.context[key] = bedticket 1231 self.flash( 'Bed ticket created and bed booked: %s'1232 % bedticket.bed_coordinates)1291 self.flash(_('Bed ticket created and bed booked: ${a}', 1292 mapping = {'a':bedticket.bed_coordinates})) 1233 1293 self.redirect(self.url(self.context)) 1234 1294 return … … 1247 1307 @property 1248 1308 def label(self): 1249 return 'Bed Ticket for Session %s' % self.context.getSessionString() 1309 return _('Bed Ticket for Session ${a}', 1310 mapping = {'a':self.context.getSessionString()}) 1250 1311 1251 1312 class ExportPDFBedTicketSlipPage(UtilityView, grok.View): … … 1258 1319 form_fields['booking_date'].custom_widget = FriendlyDateDisplayWidget('le') 1259 1320 prefix = 'form' 1260 title = 'Bed Allocation Data' 1321 1322 @property 1323 def title(self): 1324 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 1325 return translate(_('Bed Allocation Data'), 'waeup.sirp', 1326 target_language=portal_language) 1261 1327 1262 1328 @property 1263 1329 def label(self): 1264 return 'Bed Allocation: %s' % self.context.bed_coordinates 1330 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 1331 return translate(_('Bed Allocation: '), 1332 'waeup.sirp', target_language=portal_language) \ 1333 + ' %s' % self.context.bed_coordinates 1265 1334 1266 1335 def render(self): … … 1287 1356 if self.context.bed != None and \ 1288 1357 'reserved' in self.context.bed.bed_type: 1289 self.flash( "Students in reserved beds can't be relocated.")1358 self.flash(_("Students in reserved beds can't be relocated.")) 1290 1359 self.redirect(self.url(self.context)) 1291 1360 return … … 1293 1362 self.context.bed != None and \ 1294 1363 self.context.bed.bed_type == self.context.bed_type: 1295 self.flash( "Student can't be relocated.")1364 self.flash(_("Student can't be relocated.")) 1296 1365 self.redirect(self.url(self.context)) 1297 1366 return … … 1315 1384 new_bed.bookBed(student.student_id) 1316 1385 else: 1317 self.flash( 'There is no free bed in your category %s.'1318 % acc_details['bt'])1386 self.flash(_('There is no free bed in your category ${a}.', 1387 mapping = {'a':acc_details['bt']})) 1319 1388 self.redirect(self.url(self.context)) 1320 1389 return … … 1329 1398 coordinates = new_bed.getBedCoordinates()[1:] 1330 1399 block, room_nr, bed_nr = coordinates 1331 self.context.bed_coordinates = '%s, Block %s, Room %s, Bed %s (%s)' % ( 1332 hall_title, block, room_nr, bed_nr, new_bed.bed_type) 1333 self.flash('Student relocated: %s' % self.context.bed_coordinates) 1400 bc = _('${a}, Block ${b}, Room ${c}, Bed ${d} (${e})', mapping = { 1401 'a':hall_title, 'b':block, 1402 'c':room_nr, 'd':bed_nr, 1403 'e':new_bed.bed_type}) 1404 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 1405 self.context.bed_coordinates = translate( 1406 bc, 'waeup.sirp',target_language=portal_language) 1407 self.flash(_('Student relocated: ${a}', 1408 mapping = {'a':self.context.bed_coordinates})) 1334 1409 self.redirect(self.url(self.context)) 1335 1410 return … … 1349 1424 @property 1350 1425 def label(self): 1351 return '%s: History' % self.context.display_fullname1426 return _('${a}: History', mapping = {'a':self.context.display_fullname}) 1352 1427 1353 1428 # Pages for students only … … 1361 1436 form_fields = grok.AutoFields(IStudentBase).select( 1362 1437 'email', 'phone') 1363 label = 'Edit base data'1364 pnav = 4 1365 1366 @action( 'Save', style='primary')1438 label = _('Edit base data') 1439 pnav = 4 1440 1441 @action(_('Save'), style='primary') 1367 1442 def save(self, **data): 1368 1443 msave(self, **data) … … 1376 1451 grok.require('waeup.handleStudent') 1377 1452 grok.template('change_password') 1378 label = 'Change password'1379 pnav = 4 1380 1381 @action( 'Save', style='primary')1453 label = _('Change password') 1454 pnav = 4 1455 1456 @action(_('Save'), style='primary') 1382 1457 def save(self, **data): 1383 1458 form = self.request.form … … 1390 1465 IUserAccount(self.context).setPassword(password) 1391 1466 write_log_message(self, 'saved: password') 1392 self.flash( 'Password changed.')1467 self.flash(_('Password changed.')) 1393 1468 else: 1394 1469 self.flash( ' '.join(errors)) … … 1402 1477 grok.require('waeup.uploadStudentFile') 1403 1478 grok.template('filesuploadpage') 1404 label = 'Upload portrait'1479 label = _('Upload portrait') 1405 1480 pnav = 4 1406 1481 … … 1417 1492 grok.require('waeup.handleStudent') 1418 1493 grok.template('enterpin') 1419 label = 'Start clearance'1494 label = _('Start clearance') 1420 1495 ac_prefix = 'CLR' 1421 1496 notice = '' 1422 1497 pnav = 4 1423 buttonname = 'Start clearance now'1498 buttonname = _('Start clearance now') 1424 1499 1425 1500 @property … … 1438 1513 def update(self, SUBMIT=None): 1439 1514 if not self.context.state == ADMITTED: 1440 self.flash( "Wrong state.")1515 self.flash(_("Wrong state.")) 1441 1516 self.redirect(self.url(self.context)) 1442 1517 return 1443 1518 if not self.portrait_uploaded: 1444 self.flash( "No portrait uploaded.")1519 self.flash(_("No portrait uploaded.")) 1445 1520 self.redirect(self.url(self.context, 'change_portrait')) 1446 1521 return 1447 1522 if not self.all_required_fields_filled: 1448 self.flash( "Not all required fields filled.")1523 self.flash(_("Not all required fields filled.")) 1449 1524 self.redirect(self.url(self.context, 'edit_base')) 1450 1525 return … … 1457 1532 code = get_access_code(pin) 1458 1533 if not code: 1459 self.flash( 'Activation code is invalid.')1534 self.flash(_('Activation code is invalid.')) 1460 1535 return 1461 1536 # Mark pin as used (this also fires a pin related transition) 1462 1537 # and fire transition start_clearance 1463 1538 if code.state == USED: 1464 self.flash( 'Activation code has already been used.')1539 self.flash(_('Activation code has already been used.')) 1465 1540 return 1466 1541 else: 1467 comment = u"AC invalidated for %s" % self.context.student_id1542 comment = _(u"invalidated") 1468 1543 # Here we know that the ac is in state initialized so we do not 1469 1544 # expect an exception, but the owner might be different 1470 1545 if not invalidate_accesscode(pin,comment,self.context.student_id): 1471 self.flash( 'You are not the owner of this access code.')1546 self.flash(_('You are not the owner of this access code.')) 1472 1547 return 1473 1548 self.context.clr_code = pin 1474 1549 IWorkflowInfo(self.context).fireTransition('start_clearance') 1475 self.flash( 'Clearance process has been started.')1550 self.flash(_('Clearance process has been started.')) 1476 1551 self.redirect(self.url(self.context,'cedit')) 1477 1552 return … … 1485 1560 form_fields = grok.AutoFields( 1486 1561 IStudentClearance).omit('clearance_locked') 1487 label = 'Edit clearance data'1562 label = _('Edit clearance data') 1488 1563 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 1489 1564 … … 1494 1569 return super(StudentClearanceEditFormPage, self).update() 1495 1570 1496 @action( 'Save', style='primary')1571 @action(_('Save'), style='primary') 1497 1572 def save(self, **data): 1498 1573 self.applyData(self.context, **data) 1499 self.flash( 'Clearance form has been saved.')1574 self.flash(_('Clearance form has been saved.')) 1500 1575 return 1501 1576 … … 1505 1580 return False 1506 1581 1507 @action( 'Save and request clearance', style='primary')1582 @action(_('Save and request clearance'), style='primary') 1508 1583 def requestClearance(self, **data): 1509 1584 self.applyData(self.context, **data) … … 1511 1586 self.flash(self.dataNotComplete()) 1512 1587 return 1513 self.flash( 'Clearance form has been saved.')1588 self.flash(_('Clearance form has been saved.')) 1514 1589 self.redirect(self.url(self.context,'request_clearance')) 1515 1590 return … … 1520 1595 grok.require('waeup.handleStudent') 1521 1596 grok.template('enterpin') 1522 label = 'Request clearance'1523 notice = 'Enter the CLR access code used for starting clearance.'1597 label = _('Request clearance') 1598 notice = _('Enter the CLR access code used for starting clearance.') 1524 1599 ac_prefix = 'CLR' 1525 1600 pnav = 4 1526 buttonname = 'Request clearance now'1601 buttonname = _('Request clearance now') 1527 1602 1528 1603 def update(self, SUBMIT=None): … … 1533 1608 pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number) 1534 1609 if self.context.clr_code != pin: 1535 self.flash( "This isn't your CLR access code.")1610 self.flash(_("This isn't your CLR access code.")) 1536 1611 return 1537 1612 state = IWorkflowState(self.context).getState() … … 1539 1614 # might have forgotten to lock the form after changing the state 1540 1615 if state != CLEARANCE: 1541 self.flash( 'This form cannot be submitted. Wrong state!')1616 self.flash(_('This form cannot be submitted. Wrong state!')) 1542 1617 return 1543 1618 IWorkflowInfo(self.context).fireTransition('request_clearance') 1544 self.flash( 'Clearance has been requested.')1619 self.flash(_('Clearance has been requested.')) 1545 1620 self.redirect(self.url(self.context)) 1546 1621 return … … 1551 1626 grok.require('waeup.handleStudent') 1552 1627 grok.template('enterpin') 1553 label = 'Start course registration'1628 label = _('Start course registration') 1554 1629 ac_prefix = 'SFE' 1555 1630 notice = '' 1556 1631 pnav = 4 1557 buttonname = 'Start course registration now'1632 buttonname = _('Start course registration now') 1558 1633 1559 1634 def update(self, SUBMIT=None): 1560 1635 if not self.context.getStudent().state in (CLEARED,RETURNING): 1561 self.flash( "Wrong state.")1636 self.flash(_("Wrong state.")) 1562 1637 self.redirect(self.url(self.context)) 1563 1638 return … … 1570 1645 code = get_access_code(pin) 1571 1646 if not code: 1572 self.flash( 'Activation code is invalid.')1647 self.flash(_('Activation code is invalid.')) 1573 1648 return 1574 1649 # Mark pin as used (this also fires a pin related transition) 1575 1650 # and fire transition start_clearance 1576 1651 if code.state == USED: 1577 self.flash( 'Activation code has already been used.')1652 self.flash(_('Activation code has already been used.')) 1578 1653 return 1579 1654 else: 1580 comment = u"AC invalidated for %s" % ( 1581 self.context.getStudent().student_id,) 1655 comment = _(u"invalidated") 1582 1656 # Here we know that the ac is in state initialized so we do not 1583 1657 # expect an exception, but the owner might be different 1584 1658 if not invalidate_accesscode( 1585 1659 pin,comment,self.context.getStudent().student_id): 1586 self.flash( 'You are not the owner of this access code.')1660 self.flash(_('You are not the owner of this access code.')) 1587 1661 return 1588 1662 if self.context.getStudent().state == CLEARED: … … 1592 1666 IWorkflowInfo(self.context.getStudent()).fireTransition( 1593 1667 'pay_school_fee') 1594 self.flash( 'Course registration has been started.')1668 self.flash(_('Course registration has been started.')) 1595 1669 self.redirect(self.url(self.context)) 1596 1670 return … … 1611 1685 code = self.context.current_level 1612 1686 title = studylevelsource.getTitle(self.context, code) 1613 return 'Add current level %s' % title1687 return _('Add current level ${a}', mapping = {'a':title}) 1614 1688 1615 1689 def update(self): … … 1620 1694 return 1621 1695 1622 @action( 'Create course list now', style='primary')1696 @action(_('Create course list now'), style='primary') 1623 1697 def addStudyLevel(self, **data): 1624 1698 studylevel = StudentStudyLevel() … … 1629 1703 self.context.certificate,studylevel) 1630 1704 except KeyError: 1631 self.flash( 'This level exists.')1705 self.flash(_('This level exists.')) 1632 1706 self.redirect(self.url(self.context)) 1633 1707 return … … 1655 1729 @property 1656 1730 def label(self): 1657 return 'Add and remove course tickets of study level %s' % ( 1658 self.context.level_title,) 1731 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 1732 lang = self.request.cookies.get('sirp.language', portal_language) 1733 level_title = translate(self.context.level_title, 'waeup.sirp', 1734 target_language=lang) 1735 return _('Add and remove course tickets of study level ${a}', 1736 mapping = {'a':level_title}) 1659 1737 1660 1738 @property … … 1665 1743 return total_credits 1666 1744 1667 @action( 'Add course ticket')1745 @action(_('Add course ticket')) 1668 1746 def addCourseTicket(self, **data): 1669 1747 self.redirect(self.url(self.context, 'ctadd')) 1670 1748 1671 @jsaction( 'Remove selected tickets')1749 @jsaction(_('Remove selected tickets')) 1672 1750 def delCourseTicket(self, **data): 1673 1751 form = self.request.form … … 1675 1753 child_id = form['val_id'] 1676 1754 else: 1677 self.flash( 'No ticket selected.')1755 self.flash(_('No ticket selected.')) 1678 1756 self.redirect(self.url(self.context, '@@edit')) 1679 1757 return … … 1684 1762 # Students are not allowed to remove core tickets 1685 1763 if not self.context[id].mandatory: 1686 try: 1687 del self.context[id] 1688 deleted.append(id) 1689 except: 1690 self.flash('Could not delete %s: %s: %s' % ( 1691 id, sys.exc_info()[0], sys.exc_info()[1])) 1764 del self.context[id] 1765 deleted.append(id) 1692 1766 if len(deleted): 1693 self.flash('Successfully removed: %s' % ', '.join(deleted)) 1767 self.flash(_('Successfully removed: ${a}', 1768 mapping = {'a':', '.join(deleted)})) 1694 1769 self.redirect(self.url(self.context, u'@@edit')) 1695 1770 return 1696 1771 1697 @action( 'Register course list', style='primary')1772 @action(_('Register course list'), style='primary') 1698 1773 def RegisterCourses(self, **data): 1699 1774 IWorkflowInfo(self.context.getStudent()).fireTransition( 1700 1775 'register_courses') 1701 self.flash( 'Course list has been registered.')1776 self.flash(_('Course list has been registered.')) 1702 1777 self.redirect(self.url(self.context)) 1703 1778 return … … 1718 1793 return 1719 1794 1720 @action( 'Add course ticket')1795 @action(_('Add course ticket')) 1721 1796 def addCourseTicket(self, **data): 1722 1797 # Safety belt … … 1731 1806 self.context.addCourseTicket(ticket) 1732 1807 except KeyError: 1733 self.flash('The ticket exists.') 1734 return 1735 self.flash('Successfully added %s.' % ticket.code) 1808 self.flash(_('The ticket exists.')) 1809 return 1810 self.flash(_('Successfully added ${a}.', 1811 mapping = {'a':ticket.code})) 1736 1812 self.redirect(self.url(self.context, u'@@edit')) 1737 1813 return … … 1744 1820 grok.require('waeup.Anonymous') 1745 1821 grok.template('changepw') 1746 label = 'Change my password'1822 label = _('Change my password') 1747 1823 form_fields = grok.AutoFields(IStudentChangePassword) 1748 1824 … … 1754 1830 return 1755 1831 1756 @action( 'Get new login credentials', style='primary')1832 @action(_('Get new login credentials'), style='primary') 1757 1833 def request(self, **data): 1758 1834 if not self.captcha_result.is_valid: … … 1768 1844 email=(email,email)) 1769 1845 if len(results) == 0: 1770 self.flash( 'No student record found.')1846 self.flash(_('No student record found.')) 1771 1847 return 1772 1848 student = list(results)[0] … … 1781 1857 IUserAccount(student),pwd,login_url,msg) 1782 1858 if success: 1783 self.flash( 'An email with your user name and password ' +1784 'has been sent to %s.' % email)1859 self.flash(_('An email with your user name and password ' + 1860 'has been sent to ${a}.', mapping = {'a':email})) 1785 1861 else: 1786 self.flash( 'An smtp server error occurred.')1862 self.flash(_('An smtp server error occurred.')) 1787 1863 return 1788 1864 … … 1792 1868 grok.require('waeup.Anonymous') 1793 1869 grok.template('setpassword') 1794 label = 'Set password for first-time login'1870 label = _('Set password for first-time login') 1795 1871 ac_prefix = 'PWD' 1796 1872 pnav = 0 … … 1806 1882 searchtype='reg_number', view=self) 1807 1883 if not hitlist: 1808 self.flash( 'No student found.')1884 self.flash(_('No student found.')) 1809 1885 return 1810 1886 if len(hitlist) != 1: # Cannot happen but anyway 1811 self.flash( 'More than one student found.')1887 self.flash(_('More than one student found.')) 1812 1888 return 1813 1889 student = hitlist[0].context … … 1817 1893 code = get_access_code(pin) 1818 1894 if not code: 1819 self.flash( 'Access code is invalid.')1895 self.flash(_('Access code is invalid.')) 1820 1896 return 1821 1897 if student_pw and pin == student.adm_code: 1822 self.flash('Password has already been set. Your Student Id is %s' 1823 % self.student_id) 1898 self.flash(_( 1899 'Password has already been set. Your Student Id is ${a}', 1900 mapping = {'a':self.student_id})) 1824 1901 return 1825 1902 elif student_pw: 1826 1903 self.flash( 1827 'Password has already been set. You are using the '1828 'wrong Access Code.') 1904 _('Password has already been set. You are using the ' + 1905 'wrong Access Code.')) 1829 1906 return 1830 1907 # Mark pin as used (this also fires a pin related transition) 1831 1908 # and set student password 1832 1909 if code.state == USED: 1833 self.flash( 'Access code has already been used.')1910 self.flash(_('Access code has already been used.')) 1834 1911 return 1835 1912 else: 1836 comment = u"AC invalidated for %s" % self.student_id1913 comment = _(u"invalidated") 1837 1914 # Here we know that the ac is in state initialized so we do not 1838 1915 # expect an exception … … 1840 1917 IUserAccount(student).setPassword(self.ac_number) 1841 1918 student.adm_code = pin 1842 self.flash( 'Password has been set. Your Student Id is %s'1843 % self.student_id)1844 return 1919 self.flash(_('Password has been set. Your Student Id is ${a}', 1920 mapping = {'a':self.student_id})) 1921 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7688 r7723 23 23 from waeup.sirp.interfaces import ( 24 24 ISIRPObject, academic_sessions_vocab, validate_email, ISIRPUtils) 25 from waeup.sirp.interfaces import MessageFactory as _ 25 26 from waeup.sirp.schema import TextLineChoice 26 27 from waeup.sirp.university.vocabularies import CourseSource, StudyModeSource … … 146 147 147 148 student_id = schema.TextLine( 148 title = u'Student Id',149 title = _(u'Student Id'), 149 150 required = False, 150 151 ) 151 152 152 153 firstname = schema.TextLine( 153 title = u'First Name',154 title = _(u'First Name'), 154 155 required = True, 155 156 ) 156 157 157 158 middlename = schema.TextLine( 158 title = u'Middle Name',159 title = _(u'Middle Name'), 159 160 required = False, 160 161 ) 161 162 162 163 lastname = schema.TextLine( 163 title = u'Last Name (Surname)',164 title = _(u'Last Name (Surname)'), 164 165 required = True, 165 166 ) 166 167 167 168 sex = schema.Choice( 168 title = u'Sex',169 title = _(u'Sex'), 169 170 source = GenderSource(), 170 171 default = u'm', … … 173 174 174 175 reg_number = TextLineChoice( 175 title = u'Registration Number',176 title = _(u'Registration Number'), 176 177 required = True, 177 178 readonly = False, … … 180 181 181 182 matric_number = TextLineChoice( 182 title = u'Matriculation Number',183 title = _(u'Matriculation Number'), 183 184 #default = u'', 184 185 required = False, … … 188 189 189 190 adm_code = schema.TextLine( 190 title = u'PWD Activation Code',191 title = _(u'PWD Activation Code'), 191 192 default = u'', 192 193 required = False, … … 195 196 196 197 email = schema.ASCIILine( 197 title = u'Email',198 title = _(u'Email'), 198 199 required = False, 199 200 constraint=validate_email, 200 201 ) 201 202 phone = schema.TextLine( 202 title = u'Phone',203 title = _(u'Phone'), 203 204 description = u'', 204 205 required = False, … … 210 211 """ 211 212 date_of_birth = schema.Date( 212 title = u'Date of Birth',213 title = _(u'Date of Birth'), 213 214 required = True, 214 215 ) 215 216 216 217 clearance_locked = schema.Bool( 217 title = u'Clearance form locked',218 title = _(u'Clearance form locked'), 218 219 default = False, 219 220 ) 220 221 221 222 clr_code = schema.TextLine( 222 title = u'CLR Activation Code',223 title = _(u'CLR Activation Code'), 223 224 default = u'', 224 225 required = False, … … 228 229 nationality = schema.Choice( 229 230 source = nats_vocab, 230 title = u'Nationality',231 title = _(u'Nationality'), 231 232 default = 'nigeria', 232 233 required = True, … … 238 239 """ 239 240 perm_address = schema.Text( 240 title = u'Permanent Address',241 title = _(u'Permanent Address'), 241 242 required = False, 242 243 ) … … 252 253 """ 253 254 reg_number = schema.TextLine( 254 title = u'Registration Number',255 title = _(u'Registration Number'), 255 256 default = None, 256 257 required = False, … … 262 263 """ 263 264 matric_number = schema.TextLine( 264 title = u'Matriculation Number',265 title = _(u'Matriculation Number'), 265 266 default = None, 266 267 required = False, … … 272 273 """ 273 274 certificate = schema.Choice( 274 title = u'Certificate',275 title = _(u'Certificate'), 275 276 source = CertificateSource(), 276 277 default = None, … … 279 280 280 281 entry_mode = schema.Choice( 281 title = u'Entry Mode',282 title = _(u'Entry Mode'), 282 283 source = StudyModeSource(), 283 284 default = u'ug_ft', … … 287 288 288 289 entry_session = schema.Choice( 289 title = u'Entry Session',290 title = _(u'Entry Session'), 290 291 source = academic_sessions_vocab, 291 292 #default = datetime.now().year, … … 296 297 297 298 current_session = schema.Choice( 298 title = u'Current Session',299 title = _(u'Current Session'), 299 300 source = academic_sessions_vocab, 300 301 default = None, … … 304 305 305 306 current_level = schema.Choice( 306 title = u'Current Level',307 title = _(u'Current Level'), 307 308 source = StudyLevelSource(), 308 309 default = None, … … 312 313 313 314 current_verdict = schema.Choice( 314 title = u'Current Verdict',315 title = _(u'Current Verdict'), 315 316 source = VerdictSource(), 316 317 default = '0', … … 319 320 320 321 previous_verdict = schema.Choice( 321 title = u'Previous Verdict',322 title = _(u'Previous Verdict'), 322 323 source = VerdictSource(), 323 324 default = '0', … … 334 335 335 336 level_session = schema.Choice( 336 title = u'Session',337 title = _(u'Session'), 337 338 source = academic_sessions_vocab, 338 339 default = None, … … 341 342 342 343 level_verdict = schema.Choice( 343 title = u'Verdict',344 title = _(u'Verdict'), 344 345 source = VerdictSource(), 345 346 default = '0', … … 360 361 361 362 mandatory = schema.Bool( 362 title = u'Mandatory',363 title = _(u'Mandatory'), 363 364 default = False, 364 365 required = False, … … 367 368 368 369 score = schema.Int( 369 title = u'Score',370 title = _(u'Score'), 370 371 default = 0, 371 372 required = False, … … 374 375 375 376 automatic = schema.Bool( 376 title = u'Automatical Creation',377 title = _(u'Automatical Creation'), 377 378 default = False, 378 379 required = False, … … 381 382 382 383 carry_over = schema.Bool( 383 title = u'Carry-over Course',384 title = _(u'Carry-over Course'), 384 385 default = False, 385 386 required = False, … … 400 401 """ 401 402 course = schema.Choice( 402 title = u'Course',403 title = _(u'Course'), 403 404 source = CourseSource(), 404 405 readonly = False, … … 417 418 418 419 bed_coordinates = schema.TextLine( 419 title = u'Bed Coordinates',420 title = _(u'Bed Coordinates'), 420 421 default = None, 421 422 required = False, … … 424 425 425 426 bed_type = schema.TextLine( 426 title = u'Bed Type',427 title = _(u'Bed Type'), 427 428 default = None, 428 429 required = False, … … 431 432 432 433 booking_session = schema.Choice( 433 title = u'Session',434 title = _(u'Session'), 434 435 source = academic_sessions_vocab, 435 436 default = None, … … 439 440 440 441 booking_date = schema.Datetime( 441 title = u'Booking Date',442 title = _(u'Booking Date'), 442 443 required = False, 443 444 readonly = True, … … 445 446 446 447 booking_code = schema.TextLine( 447 title = u'Booking Activation Code',448 title = _(u'Booking Activation Code'), 448 449 default = u'', 449 450 required = False, … … 466 467 """ 467 468 p_session = schema.Choice( 468 title = u'Payment Session',469 title = _(u'Payment Session'), 469 470 source = academic_sessions_vocab, 470 471 required = False, … … 480 481 481 482 reg_number = schema.TextLine( 482 title = u'Registration Number',483 title = _(u'Registration Number'), 483 484 default = None, 484 485 required = True, … … 487 488 488 489 email = schema.ASCIILine( 489 title = u'Email Address',490 title = _(u'Email Address'), 490 491 required = True, 491 492 constraint=validate_email, -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7705 r7723 865 865 self.browser.getLink("Reject clearance").click() 866 866 self.assertTrue('Clearance has been annulled' in self.browser.contents) 867 urlmessage = 'Clearance+has+been+annulled '867 urlmessage = 'Clearance+has+been+annulled.' 868 868 # CO does now see the contact form 869 869 self.assertEqual(self.browser.url, self.student_path + … … 884 884 # clearance requested 885 885 self.browser.open(self.student_path + '/clear') 886 self.assertTrue('Student is in thewrong state'886 self.assertTrue('Student is in wrong state' 887 887 in self.browser.contents) 888 888 # The CO can go to his department throug the my_roles page … … 968 968 self.assertTrue('courses validated' in self.browser.contents) 969 969 self.browser.getLink("Reject courses").click() 970 self.assertTrue('Course list request has been annulled '970 self.assertTrue('Course list request has been annulled.' 971 971 in self.browser.contents) 972 urlmessage = 'Course+list+request+has+been+annulled '972 urlmessage = 'Course+list+request+has+been+annulled.' 973 973 self.assertEqual(self.browser.url, self.student_path + 974 974 '/contactstudent?subject=%s' % urlmessage)
Note: See TracChangeset for help on using the changeset viewer.