[10770] | 1 | ## $Id: browser.py 10800 2013-11-28 09:23:57Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | """UI components for basic applicants and related components. |
---|
| 19 | """ |
---|
| 20 | import grok |
---|
[10800] | 21 | from hurry.workflow.interfaces import IWorkflowState |
---|
[10794] | 22 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
[10770] | 23 | from waeup.kofa.applicants.browser import ( |
---|
| 24 | ApplicantRegistrationPage, ApplicantsContainerPage) |
---|
[10800] | 25 | from waeup.kofa.applicants.pdf import PDFApplicationSlip |
---|
[10794] | 26 | from kofacustom.ekodisco.applicants.interfaces import ( |
---|
| 27 | ICustomApplicant, ICustomApplicantEdit) |
---|
[10770] | 28 | from kofacustom.nigeria.applicants.browser import ( |
---|
| 29 | NigeriaApplicantDisplayFormPage, |
---|
[10788] | 30 | ApplicantDisplayFormPage, |
---|
| 31 | ApplicantManageFormPage, |
---|
| 32 | ApplicantEditFormPage) |
---|
[10770] | 33 | |
---|
[10800] | 34 | |
---|
| 35 | from kofacustom.ekodisco.applicants.workflow import STARTED |
---|
| 36 | |
---|
[10770] | 37 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
| 38 | |
---|
[10788] | 39 | class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage): |
---|
| 40 | """A display view for applicant data. |
---|
| 41 | """ |
---|
| 42 | grok.template('applicantdisplaypage') |
---|
| 43 | |
---|
[10794] | 44 | form_fields = grok.AutoFields(ICustomApplicant).omit( |
---|
[10788] | 45 | 'locked', 'course_admitted', 'password', 'suspended', |
---|
[10794] | 46 | 'course2', 'notice', 'student_id', 'sex') |
---|
[10788] | 47 | |
---|
[10794] | 48 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
| 49 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
| 50 | |
---|
[10788] | 51 | class CustomApplicantManageFormPage(ApplicantManageFormPage): |
---|
| 52 | """A full edit view for applicant data. |
---|
| 53 | """ |
---|
| 54 | grok.template('applicanteditpage') |
---|
| 55 | |
---|
[10794] | 56 | form_fields = grok.AutoFields(ICustomApplicant).omit( |
---|
| 57 | 'course2', 'notice', 'student_id', 'sex') |
---|
[10788] | 58 | form_fields['applicant_id'].for_display = True |
---|
| 59 | |
---|
| 60 | class CustomApplicantEditFormPage(ApplicantEditFormPage): |
---|
| 61 | """An applicant-centered edit view for applicant data. |
---|
| 62 | """ |
---|
| 63 | grok.template('applicanteditpage') |
---|
| 64 | |
---|
[10794] | 65 | form_fields = grok.AutoFields(ICustomApplicantEdit).omit( |
---|
[10788] | 66 | 'locked', 'course_admitted', 'student_id', |
---|
[10794] | 67 | 'suspended', 'course2', 'notice', 'sex' |
---|
[10788] | 68 | ) |
---|
| 69 | form_fields['applicant_id'].for_display = True |
---|
| 70 | form_fields['reg_number'].for_display = True |
---|
[10800] | 71 | |
---|
| 72 | submit_state = STARTED |
---|
| 73 | |
---|
| 74 | @property |
---|
| 75 | def display_actions(self): |
---|
| 76 | state = IWorkflowState(self.context).getState() |
---|
| 77 | actions = [[],[]] |
---|
| 78 | if state == STARTED: |
---|
| 79 | actions = [[_('Save'), _('Final Submit')], []] |
---|
| 80 | return actions |
---|
| 81 | |
---|
| 82 | class CustomPDFApplicationSlip(PDFApplicationSlip): |
---|
| 83 | """Bypass NigeriaPDFApplicationSlip |
---|
| 84 | """ |
---|