Ignore:
Timestamp:
22 Aug 2023, 13:47:07 (15 months ago)
Author:
Henrik Bettermann
Message:

Add application type and category.

Add examination clearance slip.

Location:
main/kofacustom.unidel/trunk/src/kofacustom/unidel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/utils.py

    r17506 r17554  
    4141        'de': ['Direct Entry Programmes', 'DEP'],
    4242        'df': ['Digital Forensic for Professionals and Academia', 'DF'],
     43        'law': ['Certificate in Law Programme', 'CL'],
    4344        }
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py

    r17325 r17554  
    2626from waeup.kofa.browser.layout import KofaEditFormPage
    2727from waeup.kofa.browser.layout import action, jsaction
     28from waeup.kofa.students.workflow import (CREATED, ADMITTED, PAID,
     29    CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED,
     30    GRADUATED, TRANSREQ, TRANSVAL, TRANSREL, FORBIDDEN_POSTGRAD_TRANS)
    2831from waeup.kofa.students.browser import (
    2932    StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudyLevelManageFormPage,
     
    3134    CourseTicketDisplayFormPage, CourseTicketManageFormPage,
    3235    StudentTriggerTransitionFormPage,
     36    ExportPDFAdmissionSlip,
    3337    PaymentsManageFormPage, msave, emit_lock_message)
    34 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket
     38from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket, IStudentBase
    3539from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
    3640from kofacustom.nigeria.students.browser import (
     
    4650    )
    4751from kofacustom.unidel.students.interfaces import (
     52    ICustomStudent,
    4853    ICustomStudentOnlinePayment,
    4954    ICustomStudentStudyCourse,
     
    228233    form_fields['carry_over'].for_display = True
    229234    form_fields['ticket_session'].for_display = True
     235
     236
     237class ExaminationClearanceSlip(NigeriaExportPDFClearanceSlip):
     238    """Deliver a PDF slip of the context.
     239    """
     240
     241    grok.name('examclearance_slip.pdf')
     242    omit_fields = (
     243        'suspended',
     244        #'phone',
     245        'email',
     246        'adm_code', 'suspended_comment',
     247        'date_of_birth',
     248        #'current_level',
     249        'current_mode',
     250        'entry_session',
     251        'flash_notice',
     252        'parents_email',
     253        'certificate',
     254        'faculty',
     255        'department',
     256        'reg_number')
     257    form_fields = None
     258
     259    note = '''
     260You have been cleared to write second semester examination.
     261'''
     262
     263    def update(self):
     264        if not  self.context.state in (VALIDATED, REGISTERED):
     265            self.flash(_('Your course list has not yet been registered.'),
     266                type="warning")
     267            self.redirect(self.url(self.context))
     268            return
     269
     270    @property
     271    def label(self):
     272        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     273        return translate(_('Examination Clearance Slip of'),
     274            'waeup.kofa', target_language=portal_language) \
     275            + ' %s' % self.context.display_fullname
     276
     277    def _sigsInFooter(self):
     278        #isStudent = getattr(
     279        #    self.request.principal, 'user_type', None) == 'student'
     280        #if not isStudent and self.context.state in (CLEARED, RETURNING):
     281
     282        return (_('Date, DICT Signature'),
     283                _('Date, Dean\'s Signature'),
     284                    )
     285    def render(self):
     286        studentview = StudentBasePDFFormPage(self.context.student,
     287            self.request, self.omit_fields)
     288        students_utils = getUtility(IStudentsUtils)
     289        return students_utils.renderPDF(
     290            self, 'examclearance_slip.pdf',
     291            self.context.student, studentview, signatures=None,
     292            sigs_in_footer=self._sigsInFooter(), show_scans=False,
     293            omit_fields=self.omit_fields,
     294            note=self.note)
     295
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py

    r16721 r17554  
    3333from waeup.kofa.interfaces import (
    3434    IExtFileStore, IFileStoreNameChooser)
     35from waeup.kofa.browser.tests.test_pdf import samples_dir
    3536from waeup.kofa.students.interfaces import IStudentsUtils
    3637from kofacustom.unidel.testing import FunctionalLayer
     
    4243    layer = FunctionalLayer
    4344
    44     def test_dummytest(self):
    45         return
     45    def test_student_examclearance_slip(self):
     46        self.certificate.study_mode = 'ug_ft'
     47        # Student cant login if their password is not set
     48        IWorkflowState(self.student).setState('courses registered')
     49        self.browser.open(self.login_path)
     50        self.browser.getControl(name="form.login").value = self.student_id
     51        self.browser.getControl(name="form.password").value = 'spwd'
     52        self.browser.getControl("Login").click()
     53        self.assertMatches(
     54            '...You logged in...', self.browser.contents)
     55        self.browser.getLink("Base Data").click()
     56        self.browser.getLink("Download examination clearance slip").click()
     57        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     58        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     59        path = os.path.join(samples_dir(), 'examclearance_slip.pdf')
     60        open(path, 'wb').write(self.browser.contents)
     61        print "Sample exampclearance_slip.pdf written to %s" % path
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/viewlets.py

    r16721 r17554  
    2020from waeup.kofa.interfaces import REQUESTED
    2121from waeup.kofa.browser.viewlets import ManageActionButton
    22 from kofacustom.unidel.students.interfaces import (
     22from kofacustom.unidel.students.interfaces import (ICustomStudent,
    2323    ICustomStudentStudyCourse, ICustomStudentStudyLevel)
    2424from waeup.kofa.students.fileviewlets import (
    2525    StudentFileDisplay, StudentFileUpload, StudentImage)
    26 from waeup.kofa.students.browser import (
     26from waeup.kofa.students.browser import (StudentBaseDisplayFormPage,
    2727    ExportPDFClearanceSlip, StudyCourseDisplayFormPage,
    2828    StudyLevelDisplayFormPage)
    2929
    3030from kofacustom.nigeria.interfaces import MessageFactory as _
     31
     32class ExamClearanceSlipActionButton(ManageActionButton):
     33    grok.order(10)
     34    grok.context(ICustomStudent)
     35    grok.view(StudentBaseDisplayFormPage)
     36    grok.require('waeup.viewStudent')
     37    text = _('Download examination clearance slip')
     38    target = 'examclearance_slip.pdf'
     39    icon = 'actionicon_pdf.png'
     40
     41    @property
     42    def target_url(self):
     43        #if not self.context.state in :
     44        #    return ''
     45        return self.view.url(self.view.context, self.target)
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/utils/utils.py

    r17506 r17554  
    8181        'ug_pt': 'Undergraduate Part-Time Programmes',
    8282        'df': 'Digital Forensic for Professionals and Academia',
     83        'law': 'Certificate in Law Programme',
    8384        }
    8485
Note: See TracChangeset for help on using the changeset viewer.