Index: main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/browser.py
===================================================================
--- main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/browser.py	(revision 16721)
+++ main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/browser.py	(revision 16734)
@@ -19,4 +19,5 @@
 """
 import grok
+from zope.formlib.textwidgets import BytesDisplayWidget
 from waeup.kofa.applicants.browser import (
     ApplicantRegistrationPage, ApplicantsContainerPage)
@@ -31,8 +32,8 @@
     INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
     INigeriaApplicantOnlinePayment,
-    UG_OMIT_DISPLAY_FIELDS,
-    UG_OMIT_PDF_FIELDS,
-    UG_OMIT_MANAGE_FIELDS,
-    UG_OMIT_EDIT_FIELDS,
+    #UG_OMIT_DISPLAY_FIELDS,
+    #UG_OMIT_PDF_FIELDS,
+    #UG_OMIT_MANAGE_FIELDS,
+    #UG_OMIT_EDIT_FIELDS,
     PG_OMIT_DISPLAY_FIELDS,
     PG_OMIT_PDF_FIELDS,
@@ -48,4 +49,98 @@
 from kofacustom.unidel.interfaces import MessageFactory as _
 
+OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
+    'result_uploaded', 'suspended', 'special_application',
+    'bank_account_number',
+    'bank_account_name',
+    'bank_name')
+
+# UG students are all undergraduate students.
+UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
+    'jamb_subjects_list',
+    'programme_type',)
+UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
+UG_OMIT_MANAGE_FIELDS = (
+    'special_application',
+    'jamb_subjects_list',
+    'programme_type',)
+UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
+    'student_id',
+    'notice',
+    'screening_score',
+    'screening_venue',
+    'screening_date',
+    'jamb_age',
+    #'jamb_subjects',
+    #'jamb_score',
+    #'jamb_reg_number',
+    'aggregate',)
+
+
+class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage):
+    """A display view for applicant data.
+    """
+
+    @property
+    def form_fields(self):
+        if self.target is not None and self.target.startswith('pg'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PG_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        else:
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in UG_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        #form_fields['perm_address'].custom_widget = BytesDisplayWidget
+        form_fields['notice'].custom_widget = BytesDisplayWidget
+        if not getattr(self.context, 'student_id'):
+            form_fields = form_fields.omit('student_id')
+        if not getattr(self.context, 'screening_score'):
+            form_fields = form_fields.omit('screening_score')
+        if not getattr(self.context, 'screening_venue') or self._not_paid():
+            form_fields = form_fields.omit('screening_venue')
+        if not getattr(self.context, 'screening_date') or self._not_paid():
+            form_fields = form_fields.omit('screening_date')
+        return form_fields
+
+class CustomPDFApplicationSlip(NigeriaPDFApplicationSlip):
+
+    @property
+    def form_fields(self):
+        if self.target is not None and self.target.startswith('pg'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PG_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        else:
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in UG_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        if not getattr(self.context, 'student_id'):
+            form_fields = form_fields.omit('student_id')
+        if not getattr(self.context, 'screening_score'):
+            form_fields = form_fields.omit('screening_score')
+        if not getattr(self.context, 'screening_venue'):
+            form_fields = form_fields.omit('screening_venue')
+        if not getattr(self.context, 'screening_date'):
+            form_fields = form_fields.omit('screening_date')
+        return form_fields
+
+class CustomApplicantManageFormPage(NigeriaApplicantManageFormPage):
+    """A full edit view for applicant data.
+    """
+
+    @property
+    def form_fields(self):
+        if self.target is not None and self.target.startswith('pg'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PG_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        else:
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in UG_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        form_fields['student_id'].for_display = True
+        form_fields['applicant_id'].for_display = True
+        return form_fields
+
 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     """An applicant-centered edit view for applicant data.
@@ -55,2 +150,15 @@
         return True
 
+    @property
+    def form_fields(self):
+        if self.target is not None and self.target.startswith('pg'):
+            form_fields = grok.AutoFields(ICustomPGApplicantEdit)
+            for field in PG_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        else:
+            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
+            for field in UG_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        form_fields['applicant_id'].for_display = True
+        form_fields['reg_number'].for_display = True
+        return form_fields
Index: main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/interfaces.py
===================================================================
--- main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/interfaces.py	(revision 16721)
+++ main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/interfaces.py	(revision 16734)
@@ -26,9 +26,10 @@
 from waeup.kofa.interfaces import (
     SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
-from waeup.kofa.schema import FormattedDate, TextLineChoice
+from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
 from waeup.kofa.applicants.interfaces import contextual_reg_num_source
 from kofacustom.nigeria.applicants.interfaces import (
-    LGASource, high_qual, high_grade, exam_types,
+    LGASource, high_qual, high_grade, exam_types, DisabilitiesSource,
+    programme_types_vocab, jambsubjects, validate_jamb_reg_number,
     INigeriaUGApplicant, INigeriaPGApplicant,
     INigeriaApplicantOnlinePayment,
@@ -42,18 +43,239 @@
 class ICustomUGApplicant(INigeriaUGApplicant):
     """An undergraduate applicant.
-
-    This interface defines the least common multiple of all fields
-    in ug application forms. In customized forms, fields can be excluded by
-    adding them to the UG_OMIT* tuples.
-    """
+    """
+
+    disabilities = schema.Choice(
+        title = _(u'Disability'),
+        source = DisabilitiesSource(),
+        required = False,
+        )
+    nationality = schema.Choice(
+        source = nats_vocab,
+        title = _(u'Nationality'),
+        required = False,
+        )
+    lga = schema.Choice(
+        source = LGASource(),
+        title = _(u'State/LGA (Nigerians only)'),
+        required = False,
+        )
+    perm_address = schema.Text(
+        title = _(u'Permanent Address'),
+        required = False,
+        )
+
+    next_kin_name = schema.TextLine(
+        title = _(u'Next of Kin Name'),
+        required = False,
+        readonly = False,
+        )
+
+    next_kin_relation = schema.TextLine(
+        title = _(u'Next of Kin Relationship'),
+        required = False,
+        readonly = False,
+        )
+
+    next_kin_address = schema.Text(
+        title = _(u'Next of Kin Address'),
+        required = False,
+        readonly = False,
+        )
+
+    next_kin_phone = PhoneNumber(
+        title = _(u'Next of Kin Phone'),
+        description = u'',
+        required = False,
+        readonly = False,
+        )
+
+    course1 = schema.Choice(
+        title = _(u'1st Choice Course of Study'),
+        source = AppCatCertificateSource(),
+        required = True,
+        )
+    course2 = schema.Choice(
+        title = _(u'2nd Choice Course of Study'),
+        source = AppCatCertificateSource(),
+        required = False,
+        )
+
+    fst_sit_fname = schema.TextLine(
+        title = _(u'Full Name'),
+        required = False,
+        readonly = False,
+        )
+
+    fst_sit_no = schema.TextLine(
+        title = _(u'Exam Number'),
+        required = False,
+        readonly = False,
+        )
+
+    fst_sit_date = FormattedDate(
+        title = _(u'Exam Date'),
+        required = False,
+        readonly = False,
+        show_year = True,
+        )
+
+    fst_sit_type = schema.Choice(
+        title = _(u'Exam Type'),
+        required = False,
+        readonly = False,
+        vocabulary = exam_types,
+        )
+
+    fst_sit_results = schema.List(
+        title = _(u'Exam Results'),
+        value_type = ResultEntryField(),
+        required = False,
+        readonly = False,
+        defaultFactory=list,
+        )
+
+    scd_sit_fname = schema.TextLine(
+        title = _(u'Full Name'),
+        required = False,
+        readonly = False,
+        )
+
+    scd_sit_no = schema.TextLine(
+        title = _(u'Exam Number'),
+        required = False,
+        readonly = False,
+        )
+
+    scd_sit_date = FormattedDate(
+        title = _(u'Exam Date'),
+        required = False,
+        readonly = False,
+        show_year = True,
+        )
+
+    scd_sit_type = schema.Choice(
+        title = _(u'Exam Type'),
+        required = False,
+        readonly = False,
+        vocabulary = exam_types,
+        )
+
+    scd_sit_results = schema.List(
+        title = _(u'Exam Results'),
+        value_type = ResultEntryField(),
+        required = False,
+        readonly = False,
+        defaultFactory=list,
+        )
+
+    programme_type = schema.Choice(
+        title = _(u'Programme Type'),
+        vocabulary = programme_types_vocab,
+        required = False,
+        )
+
+    hq_type = schema.Choice(
+        title = _(u'Qualification Obtained'),
+        required = False,
+        readonly = False,
+        vocabulary = high_qual,
+        )
+    hq_matric_no = schema.TextLine(
+        title = _(u'Former Matric Number'),
+        required = False,
+        readonly = False,
+        )
+    hq_degree = schema.Choice(
+        title = _(u'Class of Degree'),
+        required = False,
+        readonly = False,
+        vocabulary = high_grade,
+        )
+    hq_school = schema.TextLine(
+        title = _(u'Institution Attended'),
+        required = False,
+        readonly = False,
+        )
+    hq_session = schema.TextLine(
+        title = _(u'Years Attended'),
+        required = False,
+        readonly = False,
+        )
+    hq_disc = schema.TextLine(
+        title = _(u'Discipline'),
+        required = False,
+        readonly = False,
+        )
+    jamb_subjects = schema.Text(
+        title = _(u'Subjects and Scores'),
+        required = False,
+        )
+    jamb_subjects_list = schema.List(
+        title = _(u'JAMB Subjects'),
+        required = False,
+        defaultFactory=list,
+        value_type = schema.Choice(
+            vocabulary = jambsubjects
+            #source = JAMBSubjectSource(),
+            ),
+        )
+    jamb_score = schema.Int(
+        title = _(u'Total JAMB Score'),
+        required = False,
+        )
+    #jamb_age = schema.Int(
+    #    title = _(u'Age (provided by JAMB)'),
+    #    required = False,
+    #    )
+    jamb_reg_number = schema.TextLine(
+        title = _(u'JAMB Registration Number'),
+        required = False,
+        constraint=validate_jamb_reg_number,
+        )
+    notice = schema.Text(
+        title = _(u'Notice'),
+        required = False,
+        )
+    screening_venue = schema.TextLine(
+        title = _(u'Screening Venue'),
+        required = False,
+        )
+    screening_date = schema.TextLine(
+        title = _(u'Screening Date'),
+        required = False,
+        )
+    screening_score = schema.Int(
+        title = _(u'Screening Score (%)'),
+        required = False,
+        )
+    aggregate = schema.Int(
+        title = _(u'Aggregate Score (%)'),
+        description = _(u'(average of relative JAMB and PUTME scores)'),
+        required = False,
+        )
+    result_uploaded = schema.Bool(
+        title = _(u'Result uploaded'),
+        default = False,
+        required = False,
+        )
+    student_id = schema.TextLine(
+        title = _(u'Student Id'),
+        required = False,
+        readonly = False,
+        )
+    course_admitted = schema.Choice(
+        title = _(u'Admitted Course of Study'),
+        source = CertificateSource(),
+        required = False,
+        )
+    locked = schema.Bool(
+        title = _(u'Form locked'),
+        default = False,
+        required = False,
+        )
 
 class ICustomPGApplicant(INigeriaPGApplicant):
     """A postgraduate applicant.
-
-    This interface defines the least common multiple of all fields
-    in pg application forms. In customized forms, fields can be excluded by
-    adding them to the PG_OMIT* tuples.
-    """
-
+    """
 
 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
@@ -76,5 +298,5 @@
         """
 
-class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
+class ICustomUGApplicantEdit(ICustomUGApplicant):
     """An undergraduate applicant interface for edit forms.
 
