Ignore:
Timestamp:
9 Jan 2013, 09:33:01 (12 years ago)
Author:
Henrik Bettermann
Message:

Fix typo.

Add course result slip and remove grade column from course registration slip.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r9831 r9848  
    9494        #    return _('No second sitting result uploaded.')
    9595        if not store.getFileByContext(self.context, attr=u'secr_cults.jpg'):
    96             return _('No affidavit of non-menbership of secret cults uploaded.')
     96            return _('No affidavit of non-membership of secret cults uploaded.')
    9797        return False
    9898
     
    112112    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    113113
    114 
    115 ## In case we need to deactivate clearance
    116 #class CustomStudentClearPage(StudentClearPage):
    117 #    """ Clear student by clearance officer
    118 #    """
    119 #    def update(self):
    120 #        self.flash('Clearance temporarily disabled!')
    121 #        self.redirect(self.url(self.context,'view_clearance'))
    122 #        return
    123 
    124 #class CustomStudentRejectClearancePage(StudentRejectClearancePage):
    125 #    """ Reject clearance by clearance officers
    126 #    """
    127 
    128 #    def update(self):
    129 #        self.flash('Clearance temporarily disabled!')
    130 #        self.redirect(self.url(self.context,'view_clearance'))
    131 #        return
    132114
    133115class CustomExportPDFClearanceSlipPage(NigeriaExportPDFClearanceSlipPage):
     
    217199    def render(self):
    218200        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    219         Sem = translate(_('Sem.'), 'waeup.kofa', target_language=portal_language)
    220         Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language)
    221         Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language)
    222         Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language)
    223         Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language)
    224         Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language)
    225         Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language)
    226         Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language)
     201        Sem = translate('Sem.', 'waeup.kofa', target_language=portal_language)
     202        Code = translate('Code', 'waeup.kofa', target_language=portal_language)
     203        Title = translate('Title', 'waeup.kofa', target_language=portal_language)
     204        Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language)
     205        Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language)
     206        Cred = translate('Cred.', 'waeup.kofa', target_language=portal_language)
     207        Mand = translate('Requ.', 'waeup.kofa', target_language=portal_language)
     208        studentview = StudentBasePDFFormPage(self.context.student,
     209            self.request, self.omit_fields)
     210        students_utils = getUtility(IStudentsUtils)
     211        tabledata = sorted(self.context.values(),
     212            key=lambda value: str(value.semester) + value.code)
     213        return students_utils.renderPDF(
     214            self, 'course_registration_slip.pdf',
     215            self.context.student, studentview,
     216            tableheader=[(Sem,'semester', 1.5),(Code,'code', 2.5),
     217                         (Title,'title', 5),
     218                         (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5),
     219                         (Cred, 'credits', 1.5),
     220                         (Mand, 'mandatory', 1.5),
     221                         ],
     222            tabledata=tabledata)
     223
     224class UnibenExportPDFCourseResultSlipPage(ExportPDFCourseRegistrationSlipPage):
     225    """Deliver a PDF slip of the context.
     226    """
     227
     228    grok.name('course_result_slip.pdf')
     229
     230    @property
     231    def label(self):
     232        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     233        lang = self.request.cookies.get('kofa.language', portal_language)
     234        level_title = translate(self.context.level_title, 'waeup.kofa',
     235            target_language=lang)
     236        return translate(_('Course Result Slip'),
     237            'waeup.uniben', target_language=portal_language) \
     238            + ' %s' % level_title
     239
     240    def render(self):
     241        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     242        Sem = translate('Sem.', 'waeup.kofa', target_language=portal_language)
     243        Code = translate('Code', 'waeup.kofa', target_language=portal_language)
     244        Title = translate('Title', 'waeup.kofa', target_language=portal_language)
     245        Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language)
     246        Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language)
     247        Cred = translate('Cred.', 'waeup.kofa', target_language=portal_language)
     248        Mand = translate('Requ.', 'waeup.kofa', target_language=portal_language)
     249        Grade = translate('Grade', 'waeup.kofa', target_language=portal_language)
    227250        studentview = StudentBasePDFFormPage(self.context.student,
    228251            self.request, self.omit_fields)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r9831 r9848  
    191191        #self.browser.getControl("Save and request clearance").click()
    192192
    193         self.assertTrue('No affidavit of non-menbership of secret cults uploaded'
     193        self.assertTrue('No affidavit of non-membership of secret cults uploaded'
    194194            in self.browser.contents)
    195195        secr_cults = 'My non-membership scan'
     
    362362        self.browser.open(self.student_path + '/studycourse/100')
    363363        self.browser.getLink("Download course registration slip").click()
     364        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     365        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     366        # Students can open the special Uniben pdf course result slip
     367        self.browser.open(self.student_path + '/studycourse/100')
     368        self.browser.getLink("Download course result slip").click()
    364369        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    365370        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
  • main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py

    r9439 r9848  
    2020from waeup.kofa.interfaces import REQUESTED
    2121from waeup.kofa.browser.viewlets import ManageActionButton
    22 from waeup.uniben.students.interfaces import ICustomStudentStudyCourse
     22from waeup.uniben.students.interfaces import (
     23    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
    2324from waeup.kofa.students.viewlets import (
    2425    FileDisplay, FileUpload, Image)
    2526from waeup.kofa.students.browser import (
    26     ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage)
     27    ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage,
     28    StudyLevelDisplayFormPage)
    2729
    2830from kofacustom.nigeria.interfaces import MessageFactory as _
     
    4143            return self.view.url(self.view.context, self.target)
    4244        return False
     45
     46class CourseResultSlipActionButton(ManageActionButton):
     47    grok.order(6)
     48    grok.context(ICustomStudentStudyLevel)
     49    grok.view(StudyLevelDisplayFormPage)
     50    grok.require('waeup.viewStudent')
     51    icon = 'actionicon_pdf.png'
     52    text = _('Download course result slip')
     53    target = 'course_result_slip.pdf'
     54
     55    @property
     56    def target_url(self):
     57        is_current = self.context.__parent__.is_current
     58        if not is_current:
     59            return ''
     60        return self.view.url(self.view.context, self.target)
    4361
    4462# JAMB Letter
Note: See TracChangeset for help on using the changeset viewer.