Ignore:
Timestamp:
6 Jul 2022, 11:38:52 (2 years ago)
Author:
Henrik Bettermann
Message:

Configure registration form.

Location:
main/kofacustom.lpng/trunk/src/kofacustom/lpng
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/applicant.py

    r16983 r16997  
    2323from kofacustom.nigeria.applicants.applicant import NigeriaApplicant
    2424from kofacustom.lpng.applicants.interfaces import(
    25     ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     25    ICustomApplicant,)
    2626
    2727class CustomApplicant(NigeriaApplicant):
    2828
    29     grok.implements(ICustomApplicant, ICustomUGApplicantEdit,
    30         ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     29    grok.implements(ICustomApplicant)
    3130    grok.provides(ICustomApplicant)
    3231
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/browser.py

    r16983 r16997  
    1919"""
    2020import grok
     21from zope.formlib.textwidgets import BytesDisplayWidget
     22from waeup.kofa.applicants.pdf import PDFApplicationSlip
    2123from waeup.kofa.applicants.browser import (
    22     ApplicantRegistrationPage, ApplicantsContainerPage)
    23 from kofacustom.nigeria.applicants.browser import (
    24     NigeriaApplicantDisplayFormPage,
    25     NigeriaApplicantManageFormPage,
    26     NigeriaApplicantEditFormPage,
    27     NigeriaPDFApplicationSlip)
     24    ApplicantRegistrationPage, ApplicantsContainerPage,
     25    ApplicantDisplayFormPage,
     26    ApplicantManageFormPage,
     27    ApplicantEditFormPage)
    2828
    29 from kofacustom.nigeria.applicants.interfaces import (
    30     INigeriaPGApplicant, INigeriaUGApplicant,
    31     INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
    32     INigeriaApplicantOnlinePayment,
    33     UG_OMIT_DISPLAY_FIELDS,
    34     UG_OMIT_PDF_FIELDS,
    35     UG_OMIT_MANAGE_FIELDS,
    36     UG_OMIT_EDIT_FIELDS,
    37     PG_OMIT_DISPLAY_FIELDS,
    38     PG_OMIT_PDF_FIELDS,
    39     PG_OMIT_MANAGE_FIELDS,
    40     PG_OMIT_EDIT_FIELDS,
    41     )
    4229from kofacustom.lpng.applicants.interfaces import (
    43     ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant,
    44     ICustomPGApplicantEdit, ICustomUGApplicantEdit,
     30    ICustomApplicant,
    4531    ICustomApplicantOnlinePayment,
    4632    )
     
    4834from kofacustom.lpng.interfaces import MessageFactory as _
    4935
    50 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     36       
     37class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
     38    """A display view for applicant data.
     39    """
     40
     41    @property
     42    def form_fields(self):
     43        form_fields = grok.AutoFields(ICustomApplicant)
     44        form_fields['perm_address'].custom_widget = BytesDisplayWidget
     45        form_fields['notice'].custom_widget = BytesDisplayWidget
     46        if not getattr(self.context, 'student_id'):
     47            form_fields = form_fields.omit('student_id')
     48        return form_fields
     49
     50class CustomPDFApplicationSlip(PDFApplicationSlip):
     51
     52    @property
     53    def form_fields(self):
     54        form_fields = grok.AutoFields(ICustomApplicant)
     55        if not getattr(self.context, 'student_id'):
     56            form_fields = form_fields.omit('student_id')
     57        return form_fields
     58
     59class CustomApplicantManageFormPage(ApplicantManageFormPage):
     60    """A full edit view for applicant data.
     61    """
     62
     63    @property
     64    def form_fields(self):
     65        form_fields = grok.AutoFields(ICustomApplicant)
     66        if not getattr(self.context, 'student_id'):
     67            form_fields = form_fields.omit('student_id')
     68        form_fields['applicant_id'].for_display = True
     69        return form_fields
     70
     71class CustomApplicantEditFormPage(ApplicantEditFormPage):
    5172    """An applicant-centered edit view for applicant data.
    5273    """
     
    5576        return True
    5677
     78    @property
     79    def form_fields(self):
     80        form_fields = grok.AutoFields(ICustomApplicant)
     81        form_fields = form_fields.omit('notice')
     82        if not getattr(self.context, 'student_id'):
     83            form_fields = form_fields.omit('student_id')
     84        form_fields['applicant_id'].for_display = True
     85        form_fields['reg_number'].for_display = True
     86        return form_fields
     87
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/export.py

    r16983 r16997  
    2222from waeup.kofa.utils.helpers import iface_names
    2323from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
    24 from kofacustom.nigeria.applicants.interfaces import (
    25     INigeriaUGApplicant, INigeriaPGApplicant)
    2624from kofacustom.lpng.applicants.interfaces import (
    27     ICustomUGApplicant, ICustomPGApplicant)
     25    ICustomApplicant,)
    2826
    2927class CustomApplicantExporter(NigeriaApplicantExporter):
     
    3230
    3331    fields = tuple(sorted(set(
    34         iface_names(ICustomUGApplicant) +
    35         iface_names(ICustomPGApplicant) +
    36         iface_names(INigeriaUGApplicant) +
    37         iface_names(INigeriaPGApplicant) +
     32        iface_names(ICustomApplicant) +
    3833        iface_names(IApplicantBaseData)
    3934        ))) + (
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/interfaces.py

    r16983 r16997  
    2020
    2121from zope import schema
     22from zope.interface import Interface, Attribute, implements, directlyProvides
    2223from waeup.kofa.applicants.interfaces import (
    2324    IApplicantBaseData,
     
    2526from waeup.kofa.schoolgrades import ResultEntryField
    2627from waeup.kofa.interfaces import (
    27     SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
    28 from waeup.kofa.schema import FormattedDate, TextLineChoice
    29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
     28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
     29    IKofaObject)
     30from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
     31from waeup.kofa.students.vocabularies import (
     32  nats_vocab, GenderSource,RegNumberSource)
    3033from waeup.kofa.applicants.interfaces import contextual_reg_num_source
    31 from kofacustom.nigeria.applicants.interfaces import (
    32     LGASource, high_qual, high_grade, exam_types,
    33     INigeriaUGApplicant, INigeriaPGApplicant,
    34     INigeriaApplicantOnlinePayment,
    35     INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
    36     INigeriaApplicantUpdateByRegNo,
    37     IPUTMEApplicantEdit,
    38     )
    3934from kofacustom.lpng.interfaces import MessageFactory as _
    4035from kofacustom.lpng.payments.interfaces import ICustomOnlinePayment
    41 
    42 class ICustomUGApplicant(INigeriaUGApplicant):
    43     """An undergraduate applicant.
    44 
    45     This interface defines the least common multiple of all fields
    46     in ug application forms. In customized forms, fields can be excluded by
    47     adding them to the UG_OMIT* tuples.
    48     """
    49 
    50 class ICustomPGApplicant(INigeriaPGApplicant):
    51     """A postgraduate applicant.
    52 
    53     This interface defines the least common multiple of all fields
    54     in pg application forms. In customized forms, fields can be excluded by
    55     adding them to the PG_OMIT* tuples.
    56     """
    57 
    58 
    59 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
     36from kofacustom.nigeria.interfaces import LGASource
     37from kofacustom.nigeria.applicants.interfaces import (
     38    INigeriaApplicantOnlinePayment,)
     39
     40class IApplicantBaseData(IKofaObject):
     41    """This is a base interface of an applicant with no field
     42    required. For use with processors, forms, etc., please use one of
     43    the derived interfaces below, which set more fields to required
     44    state, depending on use-case.
     45    """
     46    state = Attribute('Application state of an applicant')
     47    history = Attribute('Object history, a list of messages')
     48    display_fullname = Attribute('The fullname of an applicant')
     49    application_number = Attribute('The key under which the record is stored')
     50    container_code = Attribute('Code of the parent container plus additional information if record is used or not')
     51    translated_state = Attribute('Real name of the application state')
     52    special = Attribute('True if special application')
     53    payments = Attribute('List of payment objects stored in the applicant container')
     54
     55    application_date = Attribute('UTC datetime of submission, used for export only')
     56    password = Attribute('Encrypted password of an applicant')
     57
     58
     59    suspended = schema.Bool(
     60        title = _(u'Account suspended'),
     61        default = False,
     62        required = False,
     63        )
     64
     65    applicant_id = schema.TextLine(
     66        title = _(u'Applicant Id'),
     67        required = False,
     68        readonly = False,
     69        )
     70
     71    reg_number = TextLineChoice(
     72        title = _(u'Registration Number'),
     73        readonly = False,
     74        required = False,
     75        source = contextual_reg_num_source,
     76        )
     77
     78    firstname = schema.TextLine(
     79        title = _(u'First Name'),
     80        required = True,
     81        )
     82
     83    middlename = schema.TextLine(
     84        title = _(u'Middle Name'),
     85        required = False,
     86        )
     87
     88    lastname = schema.TextLine(
     89        title = _(u'Last Name (Surname)'),
     90        required = True,
     91        )
     92
     93    date_of_birth = FormattedDate(
     94        title = _(u'Date of Birth'),
     95        required = True,
     96        show_year = True,
     97        )
     98
     99    sex = schema.Choice(
     100        title = _(u'Gender'),
     101        source = GenderSource(),
     102        required = True,
     103        )
     104
     105    profession = schema.ASCIILine(
     106        title = _(u'Profession'),
     107        required = False,
     108        )
     109       
     110    occupation = schema.ASCIILine(
     111        title = _(u'Occupation'),
     112        required = False,
     113        )
     114
     115    nationality = schema.Choice(
     116        source = nats_vocab,
     117        title = _(u'Nationality'),
     118        required = False,
     119        )
     120       
     121    state_of_residence = schema.Choice(
     122        source = nats_vocab,
     123        title = _(u'State of Residence'),
     124        required = False,
     125        )
     126
     127    perm_address = schema.Text(
     128        title = _(u'Residential Address'),
     129        required = False,
     130        )
     131               
     132    lga = schema.Choice(
     133        source = LGASource(),
     134        title = _(u'Local Government (Nigerians only)'),
     135        required = False,
     136        )
     137       
     138    ward = schema.ASCIILine(
     139        title = _(u'Ward'),
     140        required = False,
     141        )
     142
     143    phone = PhoneNumber(
     144        title = _(u'Phone'),
     145        description = u'',
     146        required = False,
     147        )
     148
     149    email = schema.ASCIILine(
     150        title = _(u'Email Address'),
     151        required = True,
     152        constraint=validate_email,
     153        )
     154
     155    notice = schema.Text(
     156        title = _(u'Notice'),
     157        required = False,
     158        )
     159
     160    student_id = schema.TextLine(
     161        title = _(u'Student Id'),
     162        required = False,
     163        readonly = False,
     164        )
     165
     166    locked = schema.Bool(
     167        title = _(u'Form locked'),
     168        default = False,
     169        required = False,
     170        )
     171
     172
     173class ICustomApplicant(IApplicantBaseData):
    60174    """An interface for both types of applicants.
    61175
     
    76190        """
    77191
    78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
    79     """An undergraduate applicant interface for edit forms.
    80 
    81     Here we can repeat the fields from base data and set the
    82     `required` and `readonly` attributes to True to further restrict
    83     the data access. Or we can allow only certain certificates to be
    84     selected by choosing the appropriate source.
    85 
    86     We cannot omit fields here. This has to be done in the
    87     respective form page.
    88     """
    89 
    90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
    91     """A postgraduate applicant interface for editing.
    92 
    93     Here we can repeat the fields from base data and set the
    94     `required` and `readonly` attributes to True to further restrict
    95     the data access. Or we can allow only certain certificates to be
    96     selected by choosing the appropriate source.
    97 
    98     We cannot omit fields here. This has to be done in the
    99     respective form page.
    100     """
    101 
    102192class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
    103193    """An applicant payment via payment gateways.
     
    105195    """
    106196
    107 class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
    108     """An undergraduate applicant interface for editing.
    109 
    110     Here we can repeat the fields from base data and set the
    111     `required` and `readonly` attributes to True to further restrict
    112     the data access. Or we can allow only certain certificates to be
    113     selected by choosing the appropriate source.
    114 
    115     We cannot omit fields here. This has to be done in the
    116     respective form page.
    117     """
    118 
    119 class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
     197class ICustomApplicantUpdateByRegNo(ICustomApplicant):
    120198    """Representation of an applicant.
    121199
     
    123201    the applicant object.
    124202    """
     203
     204    reg_number = schema.TextLine(
     205        title = u'Registration Number',
     206        required = False,
     207        )
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/tests/test_browser.py

    r16983 r16997  
    8080        self.browser.open(self.manage_path)
    8181        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    82         self.fill_correct_values()
     82        self.browser.getControl(name="form.firstname").value = 'John'
     83        self.browser.getControl(name="form.middlename").value = 'Anthony'
     84        self.browser.getControl(name="form.lastname").value = 'Tester'
     85        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
     86        self.browser.getControl(name="form.sex").value = ['m']
     87        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    8388        self.browser.getControl("Save").click()
    8489        IWorkflowState(self.applicant).setState('submitted')
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/utils.py

    r16983 r16997  
    2929    """A collection of parameters and methods subject to customization.
    3030    """
     31   
     32    APP_TYPES_DICT = {
     33      'app': ['Membership Application', 'APP'],
     34      #'special': ['Special Application', 'SPE'],
     35      }
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/interswitch/tests.py

    r16994 r16997  
    210210        self.browser.open(self.manage_path)
    211211        #IWorkflowState(self.student).setState('started')
    212         super(InterswitchTestsApplicants, self).fill_correct_values()
     212        self.browser.getControl(name="form.firstname").value = 'John'
     213        self.browser.getControl(name="form.middlename").value = 'Anthony'
     214        self.browser.getControl(name="form.lastname").value = 'Tester'
     215        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
     216        self.browser.getControl(name="form.sex").value = ['m']
     217        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    213218        self.applicantscontainer.application_fee = 1000.0
    214219        self.browser.getControl(name="form.nationality").value = ['NG']
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/locales/en/LC_MESSAGES/waeup.kofa.po

    r16993 r16997  
    4848msgstr "Registration Period"
    4949
     50msgid "Application State"
     51msgstr "Registration State"
     52
    5053msgid "Find applicants"
    5154msgstr "Find registrants"
     
    7073msgstr "User Name, Registrant Id or Registration Number"
    7174
     75msgid "Admit applicant"
     76msgstr "Register applicant"
     77
     78msgid "Applicant admitted"
     79msgstr "Applicant registered"
     80
     81msgid "Student record created"
     82msgstr "Membership record created"
     83
     84msgid "admitted"
     85msgstr "registered"
     86
     87msgid "not admitted"
     88msgstr "not registered"
     89
     90msgid ""
     91"I confirm that the Passport Photograph uploaded on this form is a true "
     92"picture of me."
     93msgstr ""
     94"I accept and subscribe to the Manifesto, Constitution and Programme of the "
     95"party based on the ideology and ideals of Socio Democracy."
     96
     97#: waeup/kofa/interfaces.py:704
     98msgid "Name of University"
     99msgstr "Name of Institution"
     100
     101#: waeup/kofa/interfaces.py:705
     102msgid "Sample University"
     103msgstr "Sample Institution"
     104
     105#: waeup/kofa/interfaces.py:710
     106msgid "Abbreviated Title of University"
     107msgstr "Abbreviated Title of Institution"
     108
    72109#. Default: "You don't have an account because you are a fresh student, or your student record has just been created? Acquire a Password Activation Code (PWD) and inititialize your student account <strong><a href=\"setpassword\"> here</a></strong>."
    73110msgid "login_trouble2"
Note: See TracChangeset for help on using the changeset viewer.