## $Id: browser.py 11844 2014-10-15 07:06:39Z henrik $
##
## Copyright (C) 2011 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
##
"""UI components for basic applicants and related components.
"""
import grok
from waeup.kofa.widgets.datewidget import (
    FriendlyDateDisplayWidget, FriendlyDateDisplayWidget,)
from waeup.kofa.applicants.browser import (
    ApplicantRegistrationPage,
    ApplicantsContainerPage,
    ApplicantDisplayFormPage,
    ApplicantManageFormPage,
    ApplicantEditFormPage,
    )
from waeup.kofa.applicants.pdf import PDFApplicationSlip
from waeup.kofa.applicants.viewlets import (
    StudentCreateActionButton,
    ApplicantsRootCreateStudentsActionButton,
    )
from kofacustom.pcn.applicants.interfaces import (
    ICustomApplicant, ICustomApplicantEdit)
from kofacustom.pcn.interfaces import MessageFactory as _

class StudentCreateActionButton(StudentCreateActionButton):

    @property
    def target_url(self):
        """Get a URL to the target...
        """
        return

class ApplicantsRootCreateStudentsActionButton(ApplicantsRootCreateStudentsActionButton):

    @property
    def target_url(self):
        """Get a URL to the target...
        """
        return

class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
    """A display view for applicant data.
    """
    grok.template('applicantdisplaypage')

    @property
    def form_fields(self):
        form_fields = grok.AutoFields(ICustomApplicant).omit(
            'locked', 'course_admitted', 'password', 'suspended')
        return form_fields

class CustomApplicantManageFormPage(ApplicantManageFormPage):
    """A full edit view for applicant data.
    """
    grok.template('applicanteditpage')

    @property
    def form_fields(self):
        form_fields = grok.AutoFields(ICustomApplicant)
        form_fields['applicant_id'].for_display = True
        return form_fields

class CustomApplicantEditFormPage(ApplicantEditFormPage):
    """An applicant-centered edit view for applicant data.
    """
    grok.template('applicanteditpage')

    @property
    def form_fields(self):
        form_fields = grok.AutoFields(ICustomApplicantEdit).omit(
            'locked', 'course_admitted',
            'suspended'
            )
        form_fields['applicant_id'].for_display = True
        form_fields['reg_number'].for_display = True
        return form_fields

class CustomPDFApplicationSlip(PDFApplicationSlip):
    """Bypass NigeriaPDFApplicationSlip
    """

    form_fields =  grok.AutoFields(ICustomApplicant).omit(
        'locked', 'course_admitted', 'suspended', 'sex', 'course2'
        )
    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')