Index: main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py	(revision 14090)
+++ main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py	(revision 14105)
@@ -21,4 +21,5 @@
 from time import time
 from zope.component import getUtility, createObject
+from zope.formlib.textwidgets import BytesDisplayWidget
 from zope.security import checkPermission
 from zope.i18n import translate
@@ -40,6 +41,44 @@
     NigeriaPDFApplicationSlip)
 from waeup.uniben.applicants.interfaces import (
-    ICustomApplicant, IUnibenRegistration)
+    ICustomApplicant,
+    IUnibenRegistration,
+    ICustomUGApplicant,
+    ICustomPGApplicant,
+    ICustomPGApplicantEdit,
+    ICustomUGApplicantEdit,
+    IPUTMEApplicantEdit)
 from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED
+from kofacustom.nigeria.applicants.interfaces import (
+    UG_OMIT_DISPLAY_FIELDS,
+    UG_OMIT_PDF_FIELDS,
+    UG_OMIT_MANAGE_FIELDS,
+    UG_OMIT_EDIT_FIELDS,
+    CBT_OMIT_DISPLAY_FIELDS,
+    CBT_OMIT_PDF_FIELDS,
+    CBT_OMIT_MANAGE_FIELDS,
+    CBT_OMIT_EDIT_FIELDS,
+    AFFIL_OMIT_DISPLAY_FIELDS,
+    AFFIL_OMIT_PDF_FIELDS,
+    AFFIL_OMIT_MANAGE_FIELDS,
+    AFFIL_OMIT_EDIT_FIELDS,
+    PG_OMIT_DISPLAY_FIELDS,
+    PG_OMIT_PDF_FIELDS,
+    PG_OMIT_MANAGE_FIELDS,
+    PG_OMIT_EDIT_FIELDS,
+    PUTME_OMIT_DISPLAY_FIELDS,
+    PUTME_OMIT_PDF_FIELDS,
+    PUTME_OMIT_MANAGE_FIELDS,
+    PUTME_OMIT_EDIT_FIELDS,
+    PUTME_OMIT_RESULT_SLIP_FIELDS,
+    PUDE_OMIT_DISPLAY_FIELDS,
+    PUDE_OMIT_PDF_FIELDS,
+    PUDE_OMIT_MANAGE_FIELDS,
+    PUDE_OMIT_EDIT_FIELDS,
+    PUDE_OMIT_RESULT_SLIP_FIELDS,
+    PRE_OMIT_DISPLAY_FIELDS,
+    PRE_OMIT_PDF_FIELDS,
+    PRE_OMIT_MANAGE_FIELDS,
+    PRE_OMIT_EDIT_FIELDS,
+    )
 
 from waeup.uniben.interfaces import MessageFactory as _
@@ -165,5 +204,46 @@
                 form_fields = form_fields.omit(field)
             return form_fields
-        form_fields = super(CustomApplicantDisplayFormPage, self).form_fields
+        elif 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)
+        elif self.target is not None and self.target.startswith('pre'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('cbt'): 
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in CBT_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('akj'): 
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ak'):
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in AFFIL_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ase'): # was putme
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in PUTME_OMIT_DISPLAY_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('pude'):
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in PUDE_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')
         if not self.context.admchecking_fee_paid():
             form_fields = form_fields.omit(
@@ -296,5 +376,38 @@
                 form_fields['registration_cats'].for_display = True
             return form_fields
-        form_fields = super(CustomApplicantManageFormPage, self).form_fields
+        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)
+        elif self.target is not None and self.target.startswith('pre'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('cbt'): 
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in CBT_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('akj'): 
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ak'): 
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in AFFIL_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ase'): # was putme
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in PUTME_OMIT_MANAGE_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('pude'):
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in PUDE_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
 
@@ -320,5 +433,38 @@
                 form_fields['registration_cats'].for_display = True
             return form_fields
-        form_fields = super(CustomApplicantEditFormPage, self).form_fields
+        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)
+        elif self.target is not None and self.target.startswith('pre'):
+            form_fields = grok.AutoFields(ICustomPGApplicantEdit)
+            for field in PRE_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('cbt'):
+            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
+            for field in CBT_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('akj'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ak'):
+            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
+            for field in AFFIL_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ase'): # was putme
+            form_fields = grok.AutoFields(IPUTMEApplicantEdit)
+            for field in PUTME_OMIT_EDIT_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('pude'):
+            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
+            for field in PUDE_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
 
@@ -389,5 +535,52 @@
                 form_fields = form_fields.omit(field)
             return form_fields
-        form_fields = super(CustomPDFApplicationSlip, self).form_fields
+        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)
+        elif self.target is not None and self.target.startswith('pre'):
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('cbt'): # uniben
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in CBT_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('akj'): # uniben
+            form_fields = grok.AutoFields(ICustomPGApplicant)
+            for field in PRE_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ak'): # uniben
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            for field in AFFIL_OMIT_PDF_FIELDS:
+                form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('ase'): # was putme
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            if self._reduced_slip():
+                for field in PUTME_OMIT_RESULT_SLIP_FIELDS:
+                    form_fields = form_fields.omit(field)
+            else:
+                for field in PUTME_OMIT_PDF_FIELDS:
+                    form_fields = form_fields.omit(field)
+        elif self.target is not None and self.target.startswith('pude'):
+            form_fields = grok.AutoFields(ICustomUGApplicant)
+            if self._reduced_slip():
+                for field in PUDE_OMIT_RESULT_SLIP_FIELDS:
+                    form_fields = form_fields.omit(field)
+            else:
+                for field in PUDE_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
 
