- Timestamp:
- 26 Jul 2012, 06:58:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r8960 r9056 21 21 from zope.component import getUtility 22 22 from zope.i18n import translate 23 from zope.formlib.textwidgets import BytesDisplayWidget 23 24 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 24 25 from waeup.kofa.students.interfaces import IStudentsUtils … … 38 39 ICustomPGApplicant, ICustomUGApplicant, ICustomPGApplicantEdit, ICustomUGApplicantEdit, 39 40 ICustomApplicantOnlinePayment, IPUTMEApplicantEdit, 40 UG_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS, 41 UG_OMIT_PDF_FIELDS, PG_OMIT_PDF_FIELDS, 42 UG_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS, 43 UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS, 44 UG_OMIT_RESULT_SLIP_FIELDS) 41 UG_OMIT_DISPLAY_FIELDS, 42 UG_OMIT_PDF_FIELDS, 43 UG_OMIT_MANAGE_FIELDS, 44 UG_OMIT_EDIT_FIELDS, 45 PG_OMIT_DISPLAY_FIELDS, 46 PG_OMIT_PDF_FIELDS, 47 PG_OMIT_MANAGE_FIELDS, 48 PG_OMIT_EDIT_FIELDS, 49 PUTME_OMIT_DISPLAY_FIELDS, 50 PUTME_OMIT_PDF_FIELDS, 51 PUTME_OMIT_MANAGE_FIELDS, 52 PUTME_OMIT_EDIT_FIELDS, 53 PUTME_OMIT_RESULT_SLIP_FIELDS, 54 PUDE_OMIT_DISPLAY_FIELDS, 55 PUDE_OMIT_PDF_FIELDS, 56 PUDE_OMIT_MANAGE_FIELDS, 57 PUDE_OMIT_EDIT_FIELDS, 58 PUDE_OMIT_RESULT_SLIP_FIELDS, 59 ) 45 60 from waeup.uniben.interfaces import MessageFactory as _ 46 61 … … 62 77 return _('Download application slip') 63 78 79 80 class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage): 81 """A display view for applicant data. 82 """ 83 84 @property 85 def form_fields(self): 86 target = getattr(self.context.__parent__, 'prefix', None) 87 if target is not None and target.startswith('pg'): 88 form_fields = grok.AutoFields(ICustomPGApplicant) 89 for field in PG_OMIT_DISPLAY_FIELDS: 90 form_fields = form_fields.omit(field) 91 elif target is not None and target.startswith('putme'): 92 form_fields = grok.AutoFields(ICustomUGApplicant) 93 for field in PUTME_OMIT_DISPLAY_FIELDS: 94 form_fields = form_fields.omit(field) 95 elif target is not None and target.startswith('pude'): 96 form_fields = grok.AutoFields(ICustomUGApplicant) 97 for field in PUDE_OMIT_DISPLAY_FIELDS: 98 form_fields = form_fields.omit(field) 99 else: 100 form_fields = grok.AutoFields(ICustomUGApplicant) 101 for field in UG_OMIT_DISPLAY_FIELDS: 102 form_fields = form_fields.omit(field) 103 form_fields['perm_address'].custom_widget = BytesDisplayWidget 104 form_fields['notice'].custom_widget = BytesDisplayWidget 105 return form_fields 64 106 65 107 class CustomPDFApplicationSlip(PDFApplicationSlip): … … 84 126 for field in PG_OMIT_PDF_FIELDS: 85 127 form_fields = form_fields.omit(field) 86 el se:128 elif target is not None and target.startswith('putme'): 87 129 form_fields = grok.AutoFields(ICustomUGApplicant) 88 130 if self._reduced_slip(): 89 for field in UG_OMIT_RESULT_SLIP_FIELDS:131 for field in PUTME_OMIT_RESULT_SLIP_FIELDS: 90 132 form_fields = form_fields.omit(field) 91 133 else: 92 for field in UG_OMIT_PDF_FIELDS: 93 form_fields = form_fields.omit(field) 134 for field in PUTME_OMIT_PDF_FIELDS: 135 form_fields = form_fields.omit(field) 136 elif target is not None and target.startswith('pude'): 137 form_fields = grok.AutoFields(ICustomUGApplicant) 138 if self._reduced_slip(): 139 for field in PUDE_OMIT_RESULT_SLIP_FIELDS: 140 form_fields = form_fields.omit(field) 141 else: 142 for field in PUDE_OMIT_PDF_FIELDS: 143 form_fields = form_fields.omit(field) 144 else: 145 form_fields = grok.AutoFields(ICustomUGApplicant) 146 for field in UG_OMIT_PDF_FIELDS: 147 form_fields = form_fields.omit(field) 94 148 if not getattr(self.context, 'student_id'): 95 149 form_fields = form_fields.omit('student_id') 96 150 return form_fields 97 151 98 class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):99 """A display view for applicant data.100 """101 102 @property103 def form_fields(self):104 target = getattr(self.context.__parent__, 'prefix', None)105 if target is not None and target.startswith('pg'):106 form_fields = grok.AutoFields(ICustomPGApplicant)107 for field in PG_OMIT_DISPLAY_FIELDS:108 form_fields = form_fields.omit(field)109 else:110 form_fields = grok.AutoFields(ICustomUGApplicant)111 for field in UG_OMIT_DISPLAY_FIELDS:112 form_fields = form_fields.omit(field)113 return form_fields114 115 152 class CustomApplicantManageFormPage(ApplicantManageFormPage): 116 153 """A full edit view for applicant data. … … 124 161 for field in PG_OMIT_MANAGE_FIELDS: 125 162 form_fields = form_fields.omit(field) 163 elif target is not None and target.startswith('putme'): 164 form_fields = grok.AutoFields(ICustomUGApplicant) 165 for field in PUTME_OMIT_MANAGE_FIELDS: 166 form_fields = form_fields.omit(field) 167 elif target is not None and target.startswith('pude'): 168 form_fields = grok.AutoFields(ICustomUGApplicant) 169 for field in PUDE_OMIT_MANAGE_FIELDS: 170 form_fields = form_fields.omit(field) 126 171 else: 127 172 form_fields = grok.AutoFields(ICustomUGApplicant) … … 146 191 form_fields = grok.AutoFields(IPUTMEApplicantEdit) 147 192 for field in PUTME_OMIT_EDIT_FIELDS: 193 form_fields = form_fields.omit(field) 194 elif target is not None and target.startswith('pude'): 195 form_fields = grok.AutoFields(ICustomUGApplicant) 196 for field in PUDE_OMIT_EDIT_FIELDS: 148 197 form_fields = form_fields.omit(field) 149 198 else:
Note: See TracChangeset for help on using the changeset viewer.