Ignore:
Timestamp:
16 Apr 2024, 06:29:43 (3 years ago)
Author:
Henrik Bettermann
Message:

More adjustments.

Location:
main/kofacustom.udss/trunk/src/kofacustom/udss/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.udss/trunk/src/kofacustom/udss/students/browser.py

    r17689 r17737  
    2121from zope.component import getUtility
    2222from zope.security import checkPermission
     23from zope.formlib.textwidgets import BytesDisplayWidget
    2324from hurry.workflow.interfaces import IWorkflowInfo
    2425from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils
    … …  
    2728from waeup.kofa.browser.layout import action, jsaction
    2829from waeup.kofa.students.browser import (
    29     StudyLevelEditFormPage, StudyLevelDisplayFormPage,
    30     StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
    31     CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
    32     PaymentsManageFormPage, msave, emit_lock_message)
     30    StudentPersonalDisplayFormPage,
     31    StudentPersonalManageFormPage,
     32    StudentPersonalEditFormPage,
     33    StudentClearanceDisplayFormPage,
     34    StudentClearanceManageFormPage,
     35    StudentClearanceEditFormPage,
     36    ExportPDFClearanceSlip,
     37    StudyLevelEditFormPage,
     38    StudyLevelDisplayFormPage,
     39    StudentBasePDFFormPage,
     40    ExportPDFCourseRegistrationSlip,
     41    CourseTicketDisplayFormPage,
     42    StudentTriggerTransitionFormPage,
     43    PaymentsManageFormPage,
     44    msave, emit_lock_message)
    3345from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket
    3446from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
    … …  
    3951    NigeriaOnlinePaymentAddFormPage,
    4052    NigeriaExportPDFPaymentSlip,
    41     NigeriaExportPDFClearanceSlip,
    4253    )
    4354
    4455from kofacustom.udss.students.interfaces import (
    45     ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
    46     ICustomStudentStudyLevel)
     56    ICustomStudentOnlinePayment,
     57    ICustomStudentStudyCourse,
     58    ICustomStudentStudyLevel,
     59    ICustomStudentPersonal,
     60    ICustomStudentClearance)
    4761from kofacustom.udss.interfaces import MessageFactory as _
    4862
    … …  
    5569    def manage_payments_allowed(self):
    5670        return checkPermission('waeup.manageStudent', self.context)
     71
     72class CustomStudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage):
     73    """ Page to display student personal data
     74    """
     75    form_fields = grok.AutoFields(ICustomStudentPersonal)
     76    form_fields['perm_address'].custom_widget = BytesDisplayWidget
     77    form_fields['mother_res_address'].custom_widget = BytesDisplayWidget
     78    form_fields['father_res_address'].custom_widget = BytesDisplayWidget
     79    form_fields['sponsor_res_address'].custom_widget = BytesDisplayWidget
     80    form_fields[
     81        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     82
     83class CustomStudentPersonalEditFormPage(StudentPersonalEditFormPage):
     84    """ Page to edit personal data
     85    """
     86    form_fields = grok.AutoFields(ICustomStudentPersonal).omit('personal_updated')
     87
     88class CustomStudentPersonalManageFormPage(StudentPersonalManageFormPage):
     89    """ Page to edit personal data
     90    """
     91    form_fields = grok.AutoFields(ICustomStudentPersonal)
     92    form_fields['personal_updated'].for_display = True
     93    form_fields[
     94        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     95
     96class CustomStudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage):
     97    """ Page to display student clearance data
     98    """
     99
     100    @property
     101    def form_fields(self):
     102        form_fields = grok.AutoFields(
     103            ICustomStudentClearance).omit('clearance_locked')
     104        if not getattr(self.context, 'officer_comment'):
     105            form_fields = form_fields.omit('officer_comment')
     106        else:
     107            form_fields['officer_comment'].custom_widget = BytesDisplayWidget
     108        return form_fields
     109
     110class CustomExportPDFClearanceSlip(ExportPDFClearanceSlip):
     111    """Deliver a PDF slip of the context.
     112    """
     113    omit_fields = ('password', 'suspended', 'suspended_comment',
     114        'phone', 'adm_code', 'email', 'date_of_birth', 'current_level',
     115        'flash_notice')
     116
     117    @property
     118    def form_fields(self):
     119        form_fields = grok.AutoFields(
     120            ICustomStudentClearance).omit('clearance_locked')
     121        if not getattr(self.context, 'officer_comment'):
     122            form_fields = form_fields.omit('officer_comment')
     123        return form_fields
     124
     125class CustomStudentClearanceManageFormPage(StudentClearanceManageFormPage):
     126    """ Page to edit student clearance data
     127    """
     128
     129    @property
     130    def form_fields(self):
     131        form_fields = grok.AutoFields(
     132            ICustomStudentClearance).omit('clr_code')
     133        return form_fields
     134
     135class CustomStudentClearanceEditFormPage(StudentClearanceEditFormPage):
     136    """ View to edit student clearance data by student
     137    """
     138
     139    @property
     140    def form_fields(self):
     141        form_fields = grok.AutoFields(ICustomStudentClearance).omit(
     142            'clearance_locked', 'clr_code', 'officer_comment',
     143            'physical_clearance_date')
     144        return form_fields
  • main/kofacustom.udss/trunk/src/kofacustom/udss/students/interfaces.py

    r17689 r17737  
    1818
    1919from zope import schema
     20from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
    2021from waeup.kofa.students.vocabularies import StudyLevelSource
     22from waeup.kofa.students.interfaces import IStudentPersonal, IUGStudentClearance
    2123from kofacustom.nigeria.students.interfaces import (
    2224    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
    … …  
    3335    """
    3436
    35 class ICustomStudentPersonal(INigeriaStudentPersonal):
     37class ICustomStudentPersonal(IStudentPersonal):
    3638    """Student personal data.
    3739
    3840    """
    3941
    40 class ICustomUGStudentClearance(INigeriaUGStudentClearance):
     42    religion = schema.Choice(
     43        title = u'Religion',
     44        default = 'no_say',
     45        required = False,
     46        vocabulary = SimpleKofaVocabulary(
     47            (_('Muslim'), 'muslim'),
     48            (_('Christian'), 'christian'),
     49            (_('Others'), 'others'),
     50            (_('Prefer not to say'), 'no_say'),)
     51        )
     52
     53    disabled = schema.Bool(
     54        title = u'Disabled',
     55        default = False,
     56        required = False,
     57        )
     58
     59    father_firstname = schema.TextLine(
     60        title = _(u'First Name of Father'),
     61        required = False,
     62        )
     63    father_middlename = schema.TextLine(
     64        title = _(u'Middle Name of Father'),
     65        required = False,
     66        )
     67    father_lastname = schema.TextLine(
     68        title = _(u'Last Name (Surname) of Father'),
     69        required = False,
     70        )
     71    father_status = schema.TextLine(
     72        title = _(u'Father\'s Status and Rank'),
     73        required = False,
     74        )
     75    father_employer = schema.TextLine(
     76        title = _(u'Father\'s Employer'),
     77        required = False,
     78        )
     79    father_res_address = schema.Text(
     80        title = _(u'Father\'s Residential Address'),
     81        required = False,
     82        )
     83    father_contact_address = schema.Text(
     84        title = _(u'Father\'s Contact Address (incl. P.O. Box)'),
     85        required = False,
     86        )
     87    mother_firstname = schema.TextLine(
     88        title = _(u'First Name of Mother'),
     89        required = False,
     90        )
     91    mother_middlename = schema.TextLine(
     92        title = _(u'Middle Name of Mother'),
     93        required = False,
     94        )
     95    mother_lastname = schema.TextLine(
     96        title = _(u'Last Name (Surname) of Mother'),
     97        required = False,
     98        )
     99    mother_status = schema.TextLine(
     100        title = _(u'Mother\'s Status and Rank'),
     101        required = False,
     102        )
     103    mother_employer = schema.TextLine(
     104        title = _(u'Mother\'s Employer'),
     105        required = False,
     106        )
     107    mother_res_address = schema.Text(
     108        title = _(u'Mother\'s Residential Address'),
     109        required = False,
     110        )
     111    mother_contact_address = schema.Text(
     112        title = _(u'Mother\'s Contact Address (incl. P.O. Box)'),
     113        required = False,
     114        )
     115    sponsor_firstname = schema.TextLine(
     116        title = _(u'First Name of sponsor'),
     117        required = False,
     118        )
     119    sponsor_middlename = schema.TextLine(
     120        title = _(u'Middle Name of Sponsor'),
     121        required = False,
     122        )
     123    sponsor_lastname = schema.TextLine(
     124        title = _(u'Last Name (Surname) of Sponsor'),
     125        required = False,
     126        )
     127    sponsor_status = schema.TextLine(
     128        title = _(u'Sponsor\'s Status and Rank'),
     129        required = False,
     130        )
     131    sponsor_employer = schema.TextLine(
     132        title = _(u'Sponsor\'s Employer'),
     133        required = False,
     134        )
     135    sponsor_res_address = schema.Text(
     136        title = _(u'Sponsor\'s Residential Address'),
     137        required = False,
     138        )
     139    sponsor_contact_address = schema.Text(
     140        title = _(u'Sponsor\'s Contact Address (incl. P.O. Box)'),
     141        required = False,
     142        )
     143
     144class ICustomStudentClearance(IUGStudentClearance):
    41145    """Representation of ug student clearance data.
    42146
    43147    """
    44148
    45 class ICustomPGStudentClearance(INigeriaPGStudentClearance):
    46     """Representation of pg student clearance data.
    47 
    48     """
    49 
    50 
    51 class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
    52     ICustomPGStudentClearance,ICustomStudentPersonal):
     149class ICustomStudent(ICustomStudentBase,ICustomStudentClearance,
     150    ICustomStudentPersonal):
    53151    """Representation of a student.
    54152
Note: See TracChangeset for help on using the changeset viewer.