Changeset 11843


Ignore:
Timestamp:
14 Oct 2014, 17:45:38 (10 years ago)
Author:
Henrik Bettermann
Message:

Adjust registration forms. Add localization.

Location:
main/kofacustom.pcn/trunk/src/kofacustom/pcn
Files:
9 added
4 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.pcn/trunk/src/kofacustom/pcn/applicants/browser.py

    r11840 r11843  
    2020import grok
    2121from waeup.kofa.applicants.browser import (
    22     ApplicantRegistrationPage, ApplicantsContainerPage)
     22    ApplicantRegistrationPage,
     23    ApplicantsContainerPage,
     24    ApplicantDisplayFormPage,
     25    ApplicantManageFormPage,
     26    ApplicantEditFormPage)
    2327from waeup.kofa.applicants.viewlets import (
    2428    StudentCreateActionButton,
    25     ApplicantsRootCreateStudentsActionButton
     29    ApplicantsRootCreateStudentsActionButton,
    2630    )
     31from kofacustom.pcn.applicants.interfaces import (
     32    ICustomApplicant, ICustomApplicantEdit)
    2733from kofacustom.pcn.interfaces import MessageFactory as _
    2834
     
    4248        """
    4349        return
     50
     51class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
     52    """A display view for applicant data.
     53    """
     54    grok.template('applicantdisplaypage')
     55
     56    @property
     57    def form_fields(self):
     58        form_fields = grok.AutoFields(ICustomApplicant).omit(
     59            'locked', 'course_admitted', 'password', 'suspended')
     60        return form_fields
     61
     62class CustomApplicantManageFormPage(ApplicantManageFormPage):
     63    """A full edit view for applicant data.
     64    """
     65    grok.template('applicanteditpage')
     66
     67    @property
     68    def form_fields(self):
     69        form_fields = grok.AutoFields(ICustomApplicant)
     70        form_fields['applicant_id'].for_display = True
     71        return form_fields
     72
     73class CustomApplicantEditFormPage(ApplicantEditFormPage):
     74    """An applicant-centered edit view for applicant data.
     75    """
     76    grok.template('applicanteditpage')
     77
     78    @property
     79    def form_fields(self):
     80        form_fields = grok.AutoFields(ICustomApplicantEdit).omit(
     81            'locked', 'course_admitted',
     82            'suspended'
     83            )
     84        form_fields['applicant_id'].for_display = True
     85        form_fields['reg_number'].for_display = True
     86        return form_fields
  • main/kofacustom.pcn/trunk/src/kofacustom/pcn/applicants/interfaces.py

    r11832 r11843  
    1818"""Customized interfaces of the university application package.
    1919"""
    20 
     20from datetime import datetime
     21from grokcore.content.interfaces import IContainer
     22from zc.sourcefactory.contextual import BasicContextualSourceFactory
     23from zope import schema
     24from zope.component import queryUtility, getUtility
     25from zope.catalog.interfaces import ICatalog
     26from zope.interface import Interface, Attribute, implements, directlyProvides
     27from zope.schema.interfaces import (
     28    ValidationError, ISource, IContextSourceBinder)
     29from waeup.kofa.browser.interfaces import IApplicantBase
     30from waeup.kofa.schema import TextLineChoice, FormattedDate
     31from waeup.kofa.interfaces import (
     32    IKofaObject, validate_email,
     33    SimpleKofaVocabulary)
     34from waeup.kofa.interfaces import MessageFactory as _
     35from waeup.kofa.payments.interfaces import IOnlinePayment
     36from waeup.kofa.schema import PhoneNumber
     37from waeup.kofa.students.vocabularies import GenderSource, RegNumberSource
     38from waeup.kofa.university.vocabularies import (
     39    AppCatSource, CertificateSource, SpecialApplicationSource)
    2140from waeup.kofa.applicants.interfaces import (
    22     IApplicantBaseData,
    23     IApplicantOnlinePayment,
    24     IApplicantEdit,
    25     )
     41    contextual_reg_num_source, AppCatCertificateSource,
     42    IApplicantOnlinePayment)
    2643from kofacustom.pcn.interfaces import MessageFactory as _
    2744
    28 class ICustomApplicant(IApplicantBaseData):
    29     """A custom applicant.
     45class ICustomApplicant(IApplicantBase):
     46    """The data for an applicant.
    3047
     48    This is a base interface with no field
     49    required. For use with processors, forms, etc., please use one of
     50    the derived interfaces below, which set more fields to required
     51    state, depending on use-case.
    3152    """
    3253
    33 class ICustomApplicantEdit(IApplicantEdit):
     54    def writeLogMessage(view, comment):
     55        """Adds an INFO message to the log file
     56        """
     57
     58    def createStudent():
     59        """Create a student object from applicatnt data
     60        and copy applicant object.
     61        """
     62
     63    history = Attribute('Object history, a list of messages')
     64    state = Attribute('The application state of an applicant')
     65    display_fullname = Attribute('The fullname of an applicant')
     66    application_date = Attribute('UTC datetime of submission, used for export only')
     67    password = Attribute('Encrypted password of a applicant')
     68    application_number = Attribute('The key under which the record is stored')
     69
     70    suspended = schema.Bool(
     71        title = _(u'Account suspended'),
     72        default = False,
     73        required = False,
     74        )
     75
     76    applicant_id = schema.TextLine(
     77        title = _(u'Applicant Id'),
     78        required = False,
     79        readonly = False,
     80        )
     81    reg_number = TextLineChoice(
     82        title = _(u'Registration Number'),
     83        readonly = False,
     84        required = True,
     85        source = contextual_reg_num_source,
     86        )
     87    firstname = schema.TextLine(
     88        title = _(u'First Name'),
     89        required = True,
     90        )
     91    middlename = schema.TextLine(
     92        title = _(u'Middle Name'),
     93        required = False,
     94        )
     95    lastname = schema.TextLine(
     96        title = _(u'Last Name (Surname)'),
     97        required = True,
     98        )
     99    date_of_birth = FormattedDate(
     100        title = _(u'Date of Birth'),
     101        required = False,
     102        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
     103        show_year = True,
     104        )
     105    sex = schema.Choice(
     106        title = _(u'Sex'),
     107        source = GenderSource(),
     108        required = True,
     109        )
     110    email = schema.ASCIILine(
     111        title = _(u'Email Address'),
     112        required = False,
     113        constraint=validate_email,
     114        )
     115    phone = PhoneNumber(
     116        title = _(u'Phone'),
     117        description = u'',
     118        required = False,
     119        )
     120    course1 = schema.Choice(
     121        title = _(u'1st Choice Course of Study'),
     122        source = AppCatCertificateSource(),
     123        required = True,
     124        )
     125
     126    notice = schema.Text(
     127        title = _(u'Notice'),
     128        required = False,
     129        )
     130
     131    course_admitted = schema.Choice(
     132        title = _(u'Admitted Course of Study'),
     133        source = CertificateSource(),
     134        required = False,
     135        )
     136    locked = schema.Bool(
     137        title = _(u'Form locked'),
     138        default = False,
     139        required = False,
     140        )
     141
     142class ICustomApplicantEdit(ICustomApplicant):
    34143    """A custom applicant interface for editing.
    35144
     
    41150    We cannot omit fields here. This has to be done in the
    42151    respective form page.
     152
    43153    """
     154
     155    email = schema.ASCIILine(
     156        title = _(u'Email Address'),
     157        required = True,
     158        constraint=validate_email,
     159        )
     160    course1 = schema.Choice(
     161        title = _(u'1st Choice Course of Study'),
     162        source = AppCatCertificateSource(),
     163        required = True,
     164        )
     165    course_admitted = schema.Choice(
     166        title = _(u'Admitted Course of Study'),
     167        source = CertificateSource(),
     168        required = False,
     169        readonly = True,
     170        )
     171    notice = schema.Text(
     172        title = _(u'Notice'),
     173        required = False,
     174        readonly = True,
     175        )
    44176
    45177class ICustomApplicantOnlinePayment(IApplicantOnlinePayment):
  • main/kofacustom.pcn/trunk/src/kofacustom/pcn/locales/en/LC_MESSAGES/waeup.kofa.po

    r11839 r11843  
    1616
    1717msgid "Academic Section"
    18 msgstr "PCN Offices"
     18msgstr "Office Section"
    1919
    2020msgid "Manage academic section"
     
    154154
    155155msgid "No application record found."
    156 msgstr "No registrant record found."
     156msgstr "No registration record found."
    157157
    158158msgid "Manage application section"
    159 msgstr "Manage registrant section"
     159msgstr "Manage registration section"
    160160
    161161msgid "Applicant Id"
     
    166166
    167167msgid "Application Section"
    168 msgstr "Registrant Section"
     168msgstr "Registration Section"
    169169
    170170msgid "Application State"
     
    205205
    206206msgid "Register for application"
    207 msgstr "Subscribe"
     207msgstr "Register"
    208208
    209209msgid "View application record"
Note: See TracChangeset for help on using the changeset viewer.