source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/interfaces.py @ 5757

Last change on this file since 5757 was 5757, checked in by uli, 14 years ago

Remove interface that moved to applicants interfaces.

File size: 5.7 KB
RevLine 
[5247]1##
2## interfaces.py
3## Login : <uli@pu.smp.net>
4## Started on  Sun Jun 27 11:06:23 2010 Uli Fouquet
5## $Id$
6##
7## Copyright (C) 2010 Uli Fouquet
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21##
22"""Interfaces for JAMB data tables and related components.
23"""
[5686]24import os
25import waeup.sirp.browser
26from hurry.file import HurryFile
[5319]27from zc.sourcefactory.basic import BasicSourceFactory
[5251]28from zope import schema
[5686]29from zope.app.file.interfaces import IImage
[5432]30from zope.interface import Interface, Attribute
31from zope.pluggableauth.interfaces import IPrincipalInfo
32from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal
[5686]33from waeup.sirp.interfaces import IWAeUPObject
34from waeup.sirp.image.schema import ImageFile
[5753]35from waeup.sirp.applicants.interfaces import IApplicantBaseData
[5247]36
[5432]37
[5723]38class IJAMBDataRoot(IWAeUPObject):
39    """A container that holds JAMB data tables.
40    """
[5271]41       
[5268]42
[5319]43class IApplicantPDEImportData(IApplicantBaseData):
44    """Data for applicants, that passed PDE screening.
45
46    This data set should be suitable for imports from JAMB tables. It
47    is also basicall the basic applicant data from
48    :class:`IApplicantBaseData` only with the required fields set.
49
50    """
51    firstname = schema.TextLine(
52        title = u'First Name',
53        required = True,
54        )
55    middlenames = schema.TextLine(
56        title = u'Middle Names',
57        required = True,
58        )
59    lastname = schema.TextLine(
60        title = u'Surname/Full Name',
61        required = True,
62        )
63    date_of_birth = schema.Date(
64        title = u'Date of Birth',
65        required = True,
66        )
67    jamb_state = schema.TextLine(
68        title = u'State (provided by JAMB)',
69        required = True,
70        )
71    jamb_lga = schema.TextLine(
72        title = u'LGA (provided by JAMB)',
73        required = True,
74        )
75    course1 = schema.TextLine(
76        title = u'1st Choice Course of Study',
77        required = True,
78        )
79    screening_date = schema.Date(
80        title = u'Screening Date',
81        required = True,
82        )
83    screening_type = schema.TextLine(
84        # XXX: schould be choice
85        title = u'Screening Type',
86        required = True,
87        )
88    screening_venue = schema.TextLine(
89        title = u'Screening Venue',
90        required = True,
91        )
92    entry_session = schema.TextLine(
93        # XXX: should be choice
94        # XXX: should have sensible default: upcoming session
95        title = u'Entry Session',
96        required = True,
97        )
98   
[5269]99class IApplicantContainer(IWAeUPObject):
100    """A container for applicants.
101    """
[5432]102
103class IApplicantPrincipalInfo(IPrincipalInfo):
104    """Infos about principals that are applicants.
105    """
106    reg_no = Attribute("The JAMB registration no. of the user")
107
108    access_code = Attribute("The Access Code the user purchased")
109
110class IApplicantPrincipal(IPrincipal):
111    """A principal that is an applicant.
112
113    This interface extends zope.security.interfaces.IPrincipal and
114    requires also an `id` and other attributes defined there.
115    """
116    reg_no = schema.TextLine(
117        title = u'Registration number',
118        description = u'The JAMB registration number',
119        required = True,
120        readonly = True)
121
122    access_code = schema.TextLine(
123        title = u'Access Code',
124        description = u'The access code purchased by the user.',
125        required = True,
126        readonly = True)
[5436]127
[5437]128class IApplicantsFormChallenger(Interface):
[5436]129    """A challenger that uses a browser form to collect applicant
130       credentials.
131    """
132    loginpagename = schema.TextLine(
133        title = u'Loginpagename',
134        description = u"""Name of the login form used by challenger.
135
136        The form must provide an ``access_code`` input field.
[5439]137        """)
[5436]138
[5439]139    accesscode_field = schema.TextLine(
[5436]140        title = u'Access code field',
141        description = u'''Field of the login page which is looked up for
142                          access_code''',
143        default = u'access_code',
144        )
145
[5439]146class IJAMBApplicantsFormChallenger(IApplicantsFormChallenger):
[5436]147    """A challenger that uses a browser form to collect applicant
148       credentials for applicants in JAMB process.
149
150       JAMB-screened applicants have to provide an extra registration
151       no. provided by JAMB.
152    """
[5439]153    jamb_reg_no_field = schema.TextLine(
[5436]154        title = u'JAMB registration no.',
155        description = u'''Field of the login page which is looked up for
156                          the JAMB registration number.''',
157        default = u'jamb_reg_no',
158        )
[5438]159
160class IApplicantSessionCredentials(Interface):
161    """Interface for storing and accessing applicant credentials in a
162       session.
163    """
164
165    def __init__(access_code):
[5471]166        """Create applicant session credentials."""
[5438]167
168    def getAccessCode():
169        """Return the access code."""
170
171
172class IJAMBApplicantSessionCredentials(IApplicantSessionCredentials):
173    """Interface for storing and accessing JAMB applicant credentials in a
174       session.
175    """
176
177    def __init__(access_code, jamb_reg_no):
[5471]178        """Create credentials for JAMB screened applicants."""
[5438]179
180    def getJAMBRegNo():
181        """Return the JAMB registration no."""
Note: See TracBrowser for help on using the repository browser.