Ignore:
Timestamp:
2 Dec 2016, 10:34:05 (8 years ago)
Author:
Henrik Bettermann
Message:

Add 'certificate request' components.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/applicants
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/applicant.py

    r14270 r14304  
    2424from waeup.aaue.applicants.interfaces import(
    2525    ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit,
    26     IPUTMEApplicantEdit, ITranscriptApplicant)
     26    IPUTMEApplicantEdit, ITranscriptApplicant, ICertificateRequest)
    2727
    2828class CustomApplicant(NigeriaApplicant):
    2929
    3030    grok.implements(ICustomApplicant, ICustomUGApplicantEdit,
    31         ICustomPGApplicantEdit, IPUTMEApplicantEdit, ITranscriptApplicant)
     31        ICustomPGApplicantEdit, IPUTMEApplicantEdit,
     32        ITranscriptApplicant, ICertificateRequest)
    3233    grok.provides(ICustomApplicant)
    3334
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py

    r14228 r14304  
    4949    ICustomUGApplicantEdit,
    5050    ITranscriptApplicant,
     51    ICertificateRequest,
    5152    ICustomApplicant
    5253    )
     
    230231            form_fields['perm_address'].custom_widget = BytesDisplayWidget
    231232            return form_fields
     233        if self.target is not None and self.target == 'cert':
     234            form_fields = grok.AutoFields(ICertificateRequest).omit(
     235                'locked', 'suspended')
     236            form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
     237            form_fields['perm_address'].custom_widget = BytesDisplayWidget
     238            return form_fields
    232239        # AAUE is using the same interface for all regular applications.
    233240        form_fields = grok.AutoFields(ICustomUGApplicant)
     
    261268    def target_url(self):
    262269        if self.context.state in ('initialized', 'started', 'paid') \
    263             or self.context.special or self.view.target == 'trans':
     270            or self.context.special or self.view.target in ('trans', 'cert'):
    264271            return
    265272        return self.view.url(self.view.context, self.target)
     
    337344            form_fields['applicant_id'].for_display = True
    338345            return form_fields
     346        if self.target is not None and self.target == 'cert':
     347            form_fields = grok.AutoFields(ICertificateRequest)
     348            form_fields['applicant_id'].for_display = True
     349            return form_fields
    339350        # AAUE is using the same interface for all regular applications.
    340351        form_fields = grok.AutoFields(ICustomUGApplicant)
     
    358369    """An applicant-centered edit view for applicant data.
    359370    """
    360 
    361     grok.template('applicanteditpage')
    362371
    363372    def unremovable(self, ticket):
     
    388397        if self.target is not None and self.target == 'trans':
    389398            form_fields = grok.AutoFields(ITranscriptApplicant).omit(
     399                'locked', 'suspended')
     400            form_fields['applicant_id'].for_display = True
     401            return form_fields
     402        if self.target is not None and self.target == 'cert':
     403            form_fields = grok.AutoFields(ICertificateRequest).omit(
    390404                'locked', 'suspended')
    391405            form_fields['applicant_id'].for_display = True
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicantdisplaypage.pt

    r14303 r14304  
    1515</div>
    1616
    17 <img src="" height="180px" tal:attributes="src view/passport_url" />
     17<img  tal:condition="python: not view.target in ('trans', 'cert')"
     18      src="" height="180px" tal:attributes="src view/passport_url" />
    1819
    1920<table i18n:domain="waeup.kofa" class="form-table">
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt

    r14029 r14304  
    2222    <tbody>
    2323      <tal:widgets content="structure provider:widgets" />
    24       <tr>
     24      <tr tal:condition="python: not view.target in ('trans', 'cert')">
    2525        <td class="fieldname" i18n:translate="">
    2626          Passport Photo:
     
    6969  </table>
    7070
    71   <div tal:condition="python: not view.manage_applications and not view.target == 'trans'">
     71  <div tal:condition="python: not view.manage_applications and not view.target in ('trans', 'cert')">
    7272    <input id="confirm_passport" name="confirm_passport"
    7373           type="checkbox" value="True"/>&nbsp;&nbsp;
     
    8282    </span>
    8383  </div>
    84   <div tal:condition="python: not view.manage_applications and view.target == 'trans'">
     84  <div tal:condition="python: not view.manage_applications and view.target in ('trans', 'cert')">
    8585    <input id="confirm_passport" name="confirm_passport"
    8686           type="checkbox" value="True"/>&nbsp;&nbsp;
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/export.py

    r13980 r14304  
    2525    INigeriaUGApplicant, INigeriaPGApplicant)
    2626from waeup.aaue.applicants.interfaces import (
    27     ICustomUGApplicant, ITranscriptApplicant)
     27    ICustomUGApplicant, ITranscriptApplicant, ICertificateRequest)
    2828
    2929class CustomApplicantExporter(NigeriaApplicantExporter):
     
    3636        iface_names(INigeriaPGApplicant) +
    3737        iface_names(IApplicantBaseData) +
    38         iface_names(ITranscriptApplicant)
     38        iface_names(ITranscriptApplicant) +
     39        iface_names(ICertificateRequest)
    3940        ))) + (
    4041        'password', 'state', 'history', 'container_code', 'application_number',
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py

    r14028 r14304  
    607607        )
    608608
     609class ICertificateRequest(IKofaObject):
     610    """A transcript applicant.
     611    """
     612
     613    suspended = schema.Bool(
     614        title = _(u'Account suspended'),
     615        default = False,
     616        required = False,
     617        )
     618
     619    locked = schema.Bool(
     620        title = _(u'Form locked'),
     621        default = False,
     622        required = False,
     623        )
     624
     625    applicant_id = schema.TextLine(
     626        title = _(u'Applicant Id'),
     627        required = False,
     628        readonly = False,
     629        )
     630
     631    firstname = schema.TextLine(
     632        title = _(u'First Name'),
     633        required = True,
     634        )
     635
     636    middlename = schema.TextLine(
     637        title = _(u'Middle Name'),
     638        required = False,
     639        )
     640
     641    lastname = schema.TextLine(
     642        title = _(u'Last Name (Surname)'),
     643        required = True,
     644        )
     645
     646    matric_number = schema.TextLine(
     647        title = _(u'Matriculation Number'),
     648        readonly = False,
     649        required = False,
     650        )
     651
     652    date_of_birth = FormattedDate(
     653        title = _(u'Date of Birth'),
     654        required = False,
     655        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
     656        show_year = True,
     657        )
     658
     659    place_of_birth = schema.TextLine(
     660        title = _(u'Place of Birth'),
     661        readonly = False,
     662        required = False,
     663        )
     664
     665    nationality = schema.Choice(
     666        vocabulary = nats_vocab,
     667        title = _(u'Nationality'),
     668        required = False,
     669        )
     670
     671    email = schema.ASCIILine(
     672        title = _(u'Email Address'),
     673        required = True,
     674        constraint=validate_email,
     675        )
     676
     677    phone = PhoneNumber(
     678        title = _(u'Phone'),
     679        description = u'',
     680        required = False,
     681        )
     682
     683    perm_address = schema.Text(
     684        title = _(u'Current Local Address'),
     685        required = False,
     686        readonly = False,
     687        )
     688
     689    dispatch_address = schema.Text(
     690        title = _(u'Dispatch Address'),
     691        description = u'Address to which certificate should be posted.',
     692        required = False,
     693        readonly = False,
     694        )
     695
     696    entry_session = schema.Choice(
     697        title = _(u'Entry Session'),
     698        source = academic_sessions_vocab,
     699        required = False,
     700        readonly = False,
     701        )
     702
     703    end_session = schema.Choice(
     704        title = _(u'End Session'),
     705        source = academic_sessions_vocab,
     706        required = False,
     707        readonly = False,
     708        )
     709
     710    course_studied = schema.Choice(
     711        title = _(u'Course of Study / Degree'),
     712        source = CertificateSource(),
     713        required = False,
     714        readonly = False,
     715        )
    609716
    610717class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
    611                        ITranscriptApplicant):
     718                       ITranscriptApplicant, ICertificateRequest):
    612719    """An interface for all three types of applicants.
    613720
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py

    r14228 r14304  
    142142        self.assertTrue("Dispatch Address" in self.browser.contents)
    143143
     144    def test_certificate_request_manage(self):
     145        # Add cert applicants container
     146        self.certcontainer = ApplicantsContainer()
     147        self.certcontainer.mode = 'create'
     148        self.certcontainer.code = u'cert%s' % session_1
     149        self.certcontainer.prefix = u'cert'
     150        self.certcontainer.application_category = u'no'
     151        self.certcontainer.year = session_1
     152        self.certcontainer.application_fee = 300.0
     153        self.certcontainer.title = u'This is the cert%s container' % session_1
     154        self.app['applicants'][self.certcontainer.code] = self.certcontainer
     155        delta = datetime.timedelta(days=10)
     156        self.certcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     157        self.certcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     158        # Add applicant
     159        certapplicant = createObject(u'waeup.Applicant')
     160        certapplicant.firstname = u'Anna'
     161        certapplicant.lastname = u'Post'
     162        self.app['applicants'][self.certcontainer.code].addApplicant(certapplicant)
     163        self.certapplication_number = certapplicant.application_number
     164        self.certapplicant = self.app['applicants'][self.certcontainer.code][
     165            self.certapplication_number]
     166        self.certapplicant_path = ('http://localhost/app/applicants/cert%s/%s'
     167            % (session_1, self.certapplication_number))
     168        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     169        self.browser.open(self.certapplicant_path)
     170        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     171        self.assertTrue("Dispatch Address" in self.browser.contents)
     172
    144173    def test_pg_application_manage(self):
    145174        # Add pg applicants container
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py

    r13967 r14304  
    3636        'pgpt': ['Postgraduate Part-Time Programmes', 'PG'],
    3737        'trans': ['Transcript Application', 'TR'],
     38        'cert': ['Certificate Request', 'CR'],
    3839        'ioedp': ['Institute of Education Diploma Programmes', 'IOE'],
    3940        }
Note: See TracChangeset for help on using the changeset viewer.