## $Id: container.py 7853 2012-03-12 17:00:58Z 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
##
"""
Additional containers for university applicants.
"""

import grok
from zope.component.factory import Factory
from zope.component.interfaces import IFactory
from waeup.custom.interfaces import MessageFactory as _
from waeup.kofa.utils.helpers import attrs_to_fields
from waeup.kofa.applicants.container import (
    ApplicantsContainer, generate_applicant_id)
from waeup.kofa.applicants.interfaces import (
    IApplicantsContainer, IApplicantsContainerAdd,
    IApplicantsContainerProvider)
from waeup.custom.applicants.interfaces import IPGApplicant

class PGApplicantsContainer(ApplicantsContainer):
    """A pg applicants container contains postgraduate applicants.
    """
    grok.implements(IApplicantsContainer,IApplicantsContainerAdd)
    container_title = _(u'Postgraduates')
    container_description = _(u'handles postgraduate applicants')
    iface = IPGApplicant
    factory_name = 'waeup.PGApplicant'

PGApplicantsContainer = attrs_to_fields(PGApplicantsContainer)

class PGApplicantsContainerProvider(grok.GlobalUtility):
    """A utility that provides pg applicants containers.
    """
    grok.implements(IApplicantsContainerProvider)
    grok.name('waeup.kofa.applicants.PGApplicantsContainer')
    factory = PGApplicantsContainer

factory = Factory(lambda : PGApplicantsContainer, 'PGApplicantsContainer')
grok.global_utility(factory, IFactory, name='waeup.PGApplicantsContainer')
