[10765] | 1 | ## $Id: browser.py 11844 2014-10-15 07:06:39Z 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 |
---|
[11844] | 21 | from waeup.kofa.widgets.datewidget import ( |
---|
| 22 | FriendlyDateDisplayWidget, FriendlyDateDisplayWidget,) |
---|
[10765] | 23 | from waeup.kofa.applicants.browser import ( |
---|
[11843] | 24 | ApplicantRegistrationPage, |
---|
| 25 | ApplicantsContainerPage, |
---|
| 26 | ApplicantDisplayFormPage, |
---|
| 27 | ApplicantManageFormPage, |
---|
[11844] | 28 | ApplicantEditFormPage, |
---|
| 29 | ) |
---|
| 30 | from waeup.kofa.applicants.pdf import PDFApplicationSlip |
---|
[11840] | 31 | from waeup.kofa.applicants.viewlets import ( |
---|
| 32 | StudentCreateActionButton, |
---|
[11843] | 33 | ApplicantsRootCreateStudentsActionButton, |
---|
[11840] | 34 | ) |
---|
[11843] | 35 | from kofacustom.pcn.applicants.interfaces import ( |
---|
| 36 | ICustomApplicant, ICustomApplicantEdit) |
---|
[11832] | 37 | from kofacustom.pcn.interfaces import MessageFactory as _ |
---|
[10765] | 38 | |
---|
[11840] | 39 | class StudentCreateActionButton(StudentCreateActionButton): |
---|
| 40 | |
---|
| 41 | @property |
---|
| 42 | def target_url(self): |
---|
| 43 | """Get a URL to the target... |
---|
| 44 | """ |
---|
| 45 | return |
---|
| 46 | |
---|
| 47 | class ApplicantsRootCreateStudentsActionButton(ApplicantsRootCreateStudentsActionButton): |
---|
| 48 | |
---|
| 49 | @property |
---|
| 50 | def target_url(self): |
---|
| 51 | """Get a URL to the target... |
---|
| 52 | """ |
---|
[11843] | 53 | return |
---|
| 54 | |
---|
| 55 | class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage): |
---|
| 56 | """A display view for applicant data. |
---|
| 57 | """ |
---|
| 58 | grok.template('applicantdisplaypage') |
---|
| 59 | |
---|
| 60 | @property |
---|
| 61 | def form_fields(self): |
---|
| 62 | form_fields = grok.AutoFields(ICustomApplicant).omit( |
---|
| 63 | 'locked', 'course_admitted', 'password', 'suspended') |
---|
| 64 | return form_fields |
---|
| 65 | |
---|
| 66 | class CustomApplicantManageFormPage(ApplicantManageFormPage): |
---|
| 67 | """A full edit view for applicant data. |
---|
| 68 | """ |
---|
| 69 | grok.template('applicanteditpage') |
---|
| 70 | |
---|
| 71 | @property |
---|
| 72 | def form_fields(self): |
---|
| 73 | form_fields = grok.AutoFields(ICustomApplicant) |
---|
| 74 | form_fields['applicant_id'].for_display = True |
---|
| 75 | return form_fields |
---|
| 76 | |
---|
| 77 | class CustomApplicantEditFormPage(ApplicantEditFormPage): |
---|
| 78 | """An applicant-centered edit view for applicant data. |
---|
| 79 | """ |
---|
| 80 | grok.template('applicanteditpage') |
---|
| 81 | |
---|
| 82 | @property |
---|
| 83 | def form_fields(self): |
---|
| 84 | form_fields = grok.AutoFields(ICustomApplicantEdit).omit( |
---|
| 85 | 'locked', 'course_admitted', |
---|
| 86 | 'suspended' |
---|
| 87 | ) |
---|
| 88 | form_fields['applicant_id'].for_display = True |
---|
| 89 | form_fields['reg_number'].for_display = True |
---|
[11844] | 90 | return form_fields |
---|
| 91 | |
---|
| 92 | class CustomPDFApplicationSlip(PDFApplicationSlip): |
---|
| 93 | """Bypass NigeriaPDFApplicationSlip |
---|
| 94 | """ |
---|
| 95 | |
---|
| 96 | form_fields = grok.AutoFields(ICustomApplicant).omit( |
---|
| 97 | 'locked', 'course_admitted', 'suspended', 'sex', 'course2' |
---|
| 98 | ) |
---|
| 99 | form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') |
---|