Index: /main/waeup.uniben/trunk/CHANGES.txt
===================================================================
--- /main/waeup.uniben/trunk/CHANGES.txt	(revision 12855)
+++ /main/waeup.uniben/trunk/CHANGES.txt	(revision 12856)
@@ -4,4 +4,6 @@
 1.2dev (unreleased)
 ===================
+
+* Add parent_email. This field is only editable by managers.
 
 * Students are only allowed to download course registration slips if they are
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 12855)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 12856)
@@ -19,4 +19,5 @@
 from zope.i18n import translate
 from zope.schema.interfaces import ConstraintNotSatisfied
+from zope.formlib.textwidgets import BytesDisplayWidget
 from zope.component import getUtility
 from hurry.workflow.interfaces import IWorkflowInfo
@@ -44,12 +45,16 @@
     NigeriaExportPDFPaymentSlipPage,
     NigeriaExportPDFClearanceSlipPage,
+    NigeriaStudentPersonalDisplayFormPage,
+    NigeriaStudentPersonalManageFormPage
     )
 
 from waeup.uniben.students.interfaces import (
     ICustomStudent,
-    ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
+    ICustomStudentOnlinePayment,
+    ICustomStudentStudyCourse,
     ICustomStudentStudyLevel,
     ICustomUGStudentClearance,
-    ICustomPGStudentClearance)
+    ICustomPGStudentClearance,
+    ICustomStudentPersonal)
 from waeup.uniben.interfaces import MessageFactory as _
 
@@ -203,4 +208,25 @@
             omit_fields=self.omit_fields,
             note=self.note)
+
+class CustomStudentPersonalDisplayFormPage(
+    NigeriaStudentPersonalDisplayFormPage):
+    """ Page to display student personal data
+    """
+
+    form_fields = grok.AutoFields(ICustomStudentPersonal)
+    form_fields['perm_address'].custom_widget = BytesDisplayWidget
+    form_fields['next_kin_address'].custom_widget = BytesDisplayWidget
+    form_fields[
+        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+
+class CustomStudentPersonalManageFormPage(
+    NigeriaStudentPersonalManageFormPage):
+    """ Page to manage personal data
+    """
+
+    form_fields = grok.AutoFields(ICustomStudentPersonal)
+    form_fields['personal_updated'].for_display = True
+    form_fields[
+        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
 
 class StudyCourseCOEditFormPage(KofaEditFormPage):
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/export.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/export.py	(revision 12856)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/export.py	(revision 12856)
@@ -0,0 +1,75 @@
+## $Id: export.py 12084 2014-11-28 09:54:10Z henrik $
+##
+## Copyright (C) 2015 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""Exporters for student related stuff.
+"""
+from waeup.uniben.students.interfaces import (
+    ICustomStudent,
+    ICustomStudentStudyCourse,
+    ICustomStudentStudyLevel,
+    ICustomCourseTicket,
+    ICustomStudentOnlinePayment)
+from kofacustom.nigeria.students.export import (
+    NigeriaStudentExporter,
+    NigeriaStudentStudyCourseExporter,
+    NigeriaStudentStudyLevelExporter,
+    NigeriaCourseTicketExporter,
+    NigeriaStudentPaymentsExporter)
+from waeup.kofa.utils.helpers import iface_names
+
+class CustomStudentExporter(NigeriaStudentExporter):
+    """Exporter for Students.
+    """
+
+    fields = tuple(sorted(iface_names(
+        ICustomStudent, omit=['loggerInfo']))) + (
+        'password', 'state', 'history', 'certcode', 'is_postgrad',
+        'current_level', 'current_session')
+
+class CustomStudentStudyCourseExporter(NigeriaStudentStudyCourseExporter):
+    """Exporter for StudentStudyCourses.
+    """
+
+    fields = tuple(
+        sorted(iface_names(ICustomStudentStudyCourse))) + ('student_id',)
+
+class CustomStudentStudyLevelExporter(NigeriaStudentStudyLevelExporter):
+    """Exporter for StudentStudyLevels.
+    """
+    #: Fieldnames considered by this exporter
+    fields = tuple(sorted(iface_names(
+        ICustomStudentStudyLevel) + ['level'])) + (
+        'student_id', 'number_of_tickets','certcode')
+
+class CustomCourseTicketExporter(NigeriaCourseTicketExporter):
+    """Exporter for CourseTickets.
+    """
+
+    fields = tuple(sorted(iface_names(ICustomCourseTicket) +
+        ['level', 'code', 'level_session'])) + ('student_id',
+        'certcode', 'display_fullname')
+
+class CustomStudentPaymentsExporter(NigeriaStudentPaymentsExporter):
+    """Exporter for OnlinePayment instances.
+    """
+
+    fields = tuple(
+        sorted(iface_names(
+            ICustomStudentOnlinePayment, exclude_attribs=False,
+            omit=['display_item']))) + (
+            'student_id','state','current_session')
+
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 12855)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 12856)
@@ -18,4 +18,5 @@
 
 from zope import schema
+from waeup.kofa.interfaces import validate_email
 from kofacustom.nigeria.students.interfaces import (
     INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
@@ -37,4 +38,10 @@
     """
 
+    parent_email = schema.ASCIILine(
+        title = _(u'Parent Email'),
+        required = False,
+        constraint=validate_email,
+        )
+
 class ICustomUGStudentClearance(INigeriaUGStudentClearance):
     """Representation of ug student clearance data.
@@ -48,6 +55,6 @@
 
 
-class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
-    ICustomPGStudentClearance,ICustomStudentPersonal):
+class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance,
+    ICustomPGStudentClearance, ICustomStudentPersonal):
     """Representation of a student.
 
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py	(revision 12856)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py	(revision 12856)
@@ -0,0 +1,111 @@
+import datetime
+from zope.component import queryUtility
+from zope.interface.verify import verifyObject, verifyClass
+from waeup.kofa.interfaces import ICSVExporter
+from waeup.kofa.schoolgrades import ResultEntry
+from waeup.kofa.students.tests.test_batching import StudentImportExportSetup
+from waeup.uniben.utils.utils import CustomKofaUtils
+from waeup.uniben.students.export import (
+    CustomStudentExporter, CustomStudentPaymentsExporter)
+from waeup.uniben.testing import FunctionalLayer
+
+
+class CustomStudentExporterTest(StudentImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(CustomStudentExporterTest, self).setUp()
+        self.setup_for_export()
+        result_entry = ResultEntry(
+            CustomKofaUtils.EXAM_SUBJECTS_DICT.keys()[0],
+            CustomKofaUtils.EXAM_GRADES[0][0]
+            )
+        self.student.alr_results = [
+            result_entry]
+        self.student.fst_sit_results = [
+            result_entry]
+        self.student.scd_sit_results = [
+            result_entry]
+        return
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = CustomStudentExporter()
+        verifyObject(ICSVExporter, obj)
+        verifyClass(ICSVExporter, CustomStudentExporter)
+        return
+
+
+    def test_export_all(self):
+        # we can really export students
+        # set values we can expect in export file
+        self.setup_student(self.student)
+        exporter = CustomStudentExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertMatches(
+            'adm_code,alr_date,alr_fname,alr_no,alr_results,clearance_locked,'
+            'clr_code,date_of_birth,def_adm,disabled,email,emp2_end,'
+            'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,'
+            'emp_reason,emp_start,employer,employer2,firstname,former_matric,'
+            'fst_sit_date,fst_sit_fname,fst_sit_no,fst_sit_results,'
+            'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
+            'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
+            'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
+            'marit_stat,matric_number,middlename,nationality,'
+            'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
+            'nysc_lga,nysc_location,nysc_year,officer_comment,parent_email,'
+            'perm_address,personal_updated,phone,physical_clearance_date,reg_number,'
+            'religion,scd_sit_date,scd_sit_fname,scd_sit_no,'
+            'scd_sit_results,scd_sit_type,sex,student_id,'
+            'suspended,suspended_comment,password,state,history,certcode,is_postgrad,'
+            'current_level,current_session\r\nmy adm code,,,,'
+            '"[(\'printing_craft_practice\', \'A1\')]",0,my clr code,1981-02-04#,,,'
+            'anna@sample.com,,,,,,,,,,,Anna,,,,,"[(\'printing_craft_practice\', \'A1\')]"'
+            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,,'
+            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,123,,,,,'
+            '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,created,'
+            '[u\'2012-11-06 13:16:41 WAT - Record created by system\'],'
+            'CERT1,0,200,2012\r\n',
+            result
+            )
+        return
+
+class CustomStudentPaymentsExporterTest(StudentImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(CustomStudentPaymentsExporterTest, self).setUp()
+        self.setup_for_export()
+        return
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = CustomStudentPaymentsExporter()
+        verifyObject(ICSVExporter, obj)
+        verifyClass(ICSVExporter, CustomStudentPaymentsExporter)
+        return
+
+    def test_export_all(self):
+        # we can really export students
+        # set values we can expect in export file
+        self.setup_student(self.student)
+        self.student['payments']['my-payment'].r_company = 'interswatch'
+        self.student['payments']['my-payment'].r_card_num = '789'
+        exporter = CustomStudentPaymentsExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertMatches(
+            'ac,amount_auth,creation_date,gateway_amt,p_category,p_current,'
+            'p_id,p_item,p_level,p_session,p_state,payment_date,provider_amt,'
+            'r_amount_approved,r_card_num,r_code,r_company,r_desc,'
+            'r_pay_reference,thirdparty_amt,student_id,state,'
+            'current_session\r\n'
+            '666,12.12,2012-04-01 13:12:01#,,schoolfee,1,my-id,p-item,'
+            '100,2012,paid,2012-04-01 14:12:01#,,12.12,'
+            '789,r-code,interswatch,,,,A111111,created,2012\r\n',
+            result
+            )
+        return
