Ignore:
Timestamp:
5 Feb 2020, 22:34:10 (5 years ago)
Author:
Henrik Bettermann
Message:

Provide two ExportPDFExaminationClearanceSlip pages.

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

Legend:

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

    r15985 r15989  
    206206    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level')
    207207
    208 class ExportPDFExaminationClearanceSlip(CustomExportPDFCourseRegistrationSlip):
    209     """Deliver a PDF slip of the context.
    210     """
    211 
    212     grok.name('examination_clearance_slip.pdf')
    213 
     208class ExportPDFExaminationClearanceSlip1(CustomExportPDFCourseRegistrationSlip):
     209    """Deliver a PDF slip of the context.
     210    """
     211    grok.name('examination_clearance_slip_1.pdf')
    214212    form_fields = None
    215 
    216213    omit_fields = (
    217214        'password', 'suspended', 'phone', 'date_of_birth',
     
    219216        'adm_code', 'sex', 'suspended_comment',
    220217        'flash_notice')
    221 
    222     @property
    223     def label(self):
    224         return '%s Examination Clearance' % self.context.level_session
     218    semester = 1
     219    tabletitle =  ['', '', '']
     220
     221    @property
     222    def label(self):
     223        return '%s First Semester Examination Clearance' % self.context.level_session
    225224
    226225    @property
     
    234233            self.redirect(self.url(self.context))
    235234
    236     @property
    237     def tabletitle(self):
    238         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    239         tabletitle = []
    240         tabletitle.append(translate(_('1st Semester Courses'), 'waeup.kofa',
    241             target_language=portal_language))
    242         tabletitle.append('_PB_' + translate(_('2nd Semester Courses'), 'waeup.kofa',
    243             target_language=portal_language))
    244         tabletitle.append(translate(_('Level Courses'), 'waeup.kofa',
    245             target_language=portal_language))
    246         return tabletitle
    247 
    248235    def render(self):
    249236        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    250237        Code = translate('Code', 'waeup.kofa', target_language=portal_language)
    251         #Title = translate('Title', 'waeup.kofa', target_language=portal_language)
    252         #Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language)
    253         #Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language)
    254         #Cred = translate(_('Credits'), 'waeup.uniben', target_language=portal_language)
    255         #Grade = translate('Grade', 'waeup.kofa', target_language=portal_language)
    256238        studentview = StudentBasePDFFormPage(self.context.student,
    257239            self.request, self.omit_fields)
     
    262244        for i in range(1,7):
    263245            tabledata.append(sorted(
    264                 [value for value in self.context.values() if value.semester == i],
    265                 key=lambda value: str(value.semester) + value.code))
     246                [value for value in self.context.values() if i == self.semester == value.semester],
     247                key=lambda value: value.code))
    266248            tableheader.append([(Code,'code', 2.5),
    267                              #(Title,'title', 5),
    268                              #(Dept,'dcode', 1.5), (Faculty,'fcode', 1.5),
    269                              #(Cred, 'credits', 1.5),
    270                              ('Signature','sig', 10),
     249                             ('Invigilator\'s Name','inv', 8),
     250                             ('Signature','sig', 7),
    271251                             ])
    272252        return students_utils.renderPDF(
    273             self, 'examination_clearance_slip.pdf',
     253            self, 'examination_clearance_slip_%s.pdf' % self.semester,
    274254            self.context.student, studentview,
    275255            tableheader=tableheader,
    276256            tabledata=tabledata,
    277257            omit_fields=self.omit_fields,
    278             topMargin=1.1
     258            topMargin=1.3
    279259            )
    280260
     261class ExportPDFExaminationClearanceSlip2(ExportPDFExaminationClearanceSlip1):
     262    """Deliver a PDF slip of the context.
     263    """
     264    grok.name('examination_clearance_slip_2.pdf')
     265    semester = 2
     266
     267    @property
     268    def label(self):
     269        return '%s Second Semester Examination Clearance' % self.context.level_session
    281270
    282271class CustomPaymentsManageFormPage(PaymentsManageFormPage):
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py

    r15977 r15989  
    455455        IWorkflowState(self.student).setState('courses validated')
    456456        self.browser.open(self.student_path + '/studycourse/100')
    457         self.browser.getLink("Download examination clearance slip").click()
     457        self.browser.getLink("Download 1st semester examination clearance slip").click()
    458458        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    459459        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    460         path = os.path.join(samples_dir(), 'examination_clearance_slip.pdf')
     460        path = os.path.join(samples_dir(), 'examination_clearance_slip_1.pdf')
    461461        open(path, 'wb').write(self.browser.contents)
    462         print "Sample PDF examination_clearance_slip.pdf written to %s" % path
     462        print "Sample PDF examination_clearance_slip_1.pdf written to %s" % path
     463        self.browser.open(self.student_path + '/studycourse/100')
     464        self.browser.getLink("Download 2nd semester examination clearance slip").click()
     465        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     466        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     467        path = os.path.join(samples_dir(), 'examination_clearance_slip_2.pdf')
     468        open(path, 'wb').write(self.browser.contents)
     469        print "Sample PDF examination_clearance_slip_2.pdf written to %s" % path
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py

    r15981 r15989  
    5151    grok.require('waeup.manageStudent')
    5252
    53 class ExaminationClearanceSlipActionButton(ManageActionButton):
     53class ExaminationClearanceSlipActionButton1(ManageActionButton):
    5454    grok.order(6)
    5555    grok.context(IStudentStudyLevel)
     
    5757    grok.require('waeup.viewStudent')
    5858    icon = 'actionicon_pdf.png'
    59     text = 'Download examination clearance slip'
    60     target = 'examination_clearance_slip.pdf'
     59    text = 'Download 1st semester examination clearance slip'
     60    target = 'examination_clearance_slip_1.pdf'
    6161
    6262    @property
     
    6969            return ''
    7070        return self.view.url(self.view.context, self.target)
     71
     72class ExaminationClearanceSlipActionButton2(ExaminationClearanceSlipActionButton1):
     73    grok.order(7)
     74    text = 'Download 2nd semester examination clearance slip'
     75    target = 'examination_clearance_slip_2.pdf'
Note: See TracChangeset for help on using the changeset viewer.