Changeset 16385 for main/waeup.uniben/trunk
- Timestamp:
- 25 Jan 2021, 12:37:04 (4 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r16383 r16385 780 780 return 781 781 782 783 784 785 from zope.schema.vocabulary import SimpleVocabulary 786 from zope.formlib.itemswidgets import RadioWidget 787 from zope.formlib.itemswidgets import SelectWidget, DropdownWidget 788 789 def CustomBooleanRadioWidget(field, request, true=_('yes'), false=_('no')): 790 vocabulary = SimpleVocabulary.fromItems( ((true, True), (false, False)) ) 791 widget = RadioWidget(field, vocabulary, request) 792 widget.required = False 793 return widget 794 782 795 class StudentMedicalHistoryEditFormPage(KofaEditFormPage): 783 796 """ Page to edit medical data … … 786 799 grok.name('edit_medical') 787 800 grok.require('waeup.handleStudent') 788 form_fields = grok.AutoFields(IMedicalHistory) 789 form_fields['medical_updated'].for_display = True 790 form_fields[ 791 'medical_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') 792 label = _('Edit medical history data') 801 label = _('Medical Questionnaire') 793 802 pnav = 4 803 804 @property 805 def form_fields(self): 806 form_fields = grok.AutoFields(IMedicalHistory) 807 form_fields['medical_updated'].for_display = True 808 for field in ('fever', 'headaches', 'catarrh', 'cough', 'sore_throat', 809 'breathing', 'sneezing', 'weakness', 'body_pains', 810 'smell', 'taste', 'asthma', 'hypertension', 'diabetes', 811 'obesity', 'lagos_abuja', 'outside', 'company_suspected', 812 'company_confirmed', 'positive', 'negative', 813 'vaccination'): 814 form_fields[field].custom_widget = CustomBooleanRadioWidget 815 return form_fields 794 816 795 817 @property … … 808 830 grok.name('manage_medical') 809 831 grok.require('waeup.manageStudent') 810 label = _('Manage medical historydata')832 label = _('Manage medical questionnaire data') 811 833 812 834 class ExportPDFMedicalHistorySlip(grok.View): … … 814 836 """ 815 837 grok.context(ICustomStudent) 816 grok.name('medical_ history_slip.pdf')838 grok.name('medical_questionnaire_slip.pdf') 817 839 grok.require('waeup.viewStudent') 818 840 prefix = 'form' … … 829 851 def title(self): 830 852 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 831 return translate(_('Medical HistoryQuestionnaire'), 'waeup.kofa',853 return translate(_('Medical Questionnaire'), 'waeup.kofa', 832 854 target_language=portal_language) 833 855 … … 835 857 def label(self): 836 858 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 837 return translate(_('Medical HistorySlip of'),859 return translate(_('Medical Questionnaire Slip of'), 838 860 'waeup.kofa', target_language=portal_language) \ 839 861 + ' %s' % self.context.display_fullname … … 844 866 students_utils = getUtility(IStudentsUtils) 845 867 return students_utils.renderPDF( 846 self, 'medical_ history_slip.pdf',868 self, 'medical_questionnaire_slip.pdf', 847 869 self.context.student, studentview, 848 870 omit_fields=self.omit_fields,) -
main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
r16382 r16385 66 66 title = _(u'Fever'), 67 67 default = False, 68 required = False,68 required = True, 69 69 ) 70 70 … … 72 72 title = _(u'Headaches'), 73 73 default = False, 74 required = False,74 required = True, 75 75 ) 76 76 … … 78 78 title = _(u'Catarrh'), 79 79 default = False, 80 required = False,80 required = True, 81 81 ) 82 82 … … 84 84 title = _(u'Cough'), 85 85 default = False, 86 required = False,86 required = True, 87 87 ) 88 88 … … 90 90 title = _(u'Sore throat'), 91 91 default = False, 92 required = False,92 required = True, 93 93 ) 94 94 … … 96 96 title = _(u'Difficulty with breathing'), 97 97 default = False, 98 required = False,98 required = True, 99 99 ) 100 100 … … 102 102 title = _(u'Sneezing'), 103 103 default = False, 104 required = False,104 required = True, 105 105 ) 106 106 … … 108 108 title = _(u'Weakness/tiredness'), 109 109 default = False, 110 required = False,110 required = True, 111 111 ) 112 112 … … 114 114 title = _(u'Body pains'), 115 115 default = False, 116 required = False,116 required = True, 117 117 ) 118 118 … … 120 120 title = _(u'Loss of smell (inability to smell)'), 121 121 default = False, 122 required = False,122 required = True, 123 123 ) 124 124 … … 126 126 title = _(u'Loss of taste'), 127 127 default = False, 128 required = False,128 required = True, 129 129 ) 130 130 … … 134 134 title = _(u'Asthma'), 135 135 default = False, 136 required = False,136 required = True, 137 137 ) 138 138 … … 140 140 title = _(u'Hypertension'), 141 141 default = False, 142 required = False,142 required = True, 143 143 ) 144 144 … … 146 146 title = _(u'Diabetes'), 147 147 default = False, 148 required = False,148 required = True, 149 149 ) 150 150 … … 152 152 title = _(u'Obesity'), 153 153 default = False, 154 required = False,154 required = True, 155 155 ) 156 156 … … 170 170 title = _(u'Have you travelled to Lagos or Abuja in the last two weeks?'), 171 171 default = False, 172 required = False,172 required = True, 173 173 ) 174 174 … … 176 176 title = _(u'Have you travelled outside the country in the last 4 weeks?'), 177 177 default = False, 178 required = False,178 required = True, 179 179 ) 180 180 … … 184 184 title = _(u'Were you in the company of a suspected case of COVID 19 in the last two weeks?'), 185 185 default = False, 186 required = False,186 required = True, 187 187 ) 188 188 … … 190 190 title = _(u'Were you in the company of a confirmed case of COVID 19 in the last two weeks?'), 191 191 default = False, 192 required = False,192 required = True, 193 193 ) 194 194 … … 196 196 title = _(u'Have you had a positive COVID 19 test done?'), 197 197 default = False, 198 required = False,198 required = True, 199 199 ) 200 200 … … 202 202 title = _(u'Have you had a negative COVID 19 test done?'), 203 203 default = False, 204 required = False,204 required = True, 205 205 ) 206 206 … … 208 208 title = _(u'Have you had COVID 19 vaccination?'), 209 209 default = False, 210 required = False,210 required = True, 211 211 ) 212 212 -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r16382 r16385 1169 1169 self.browser.contents) 1170 1170 1171 def test_student_medical_ history(self):1171 def test_student_medical_questionnaire(self): 1172 1172 IWorkflowInfo(self.student).fireTransition('admit') 1173 1173 self.browser.open(self.login_path) … … 1178 1178 '...You logged in...', self.browser.contents) 1179 1179 self.browser.getLink("Base Data").click() 1180 self.browser.getLink(" Edit medical history").click()1181 self.browser.getLink("Download medical historyslip").click()1180 self.browser.getLink("Medical Questionnaire").click() 1181 self.browser.getLink("Download medical questionnaire slip").click() 1182 1182 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1183 1183 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1184 path = os.path.join(samples_dir(), 'medical_ history_slip.pdf')1184 path = os.path.join(samples_dir(), 'medical_questionnaire_slip.pdf') 1185 1185 open(path, 'wb').write(self.browser.contents) 1186 print "Sample PDF medical_ history_slip.pdf written to %s" % path1186 print "Sample PDF medical_questionnaire_slip.pdf written to %s" % path -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r16383 r16385 185 185 grok.view(StudentBaseDisplayFormPage) 186 186 grok.require('waeup.handleStudent') 187 text = _(' Edit medical history')187 text = _('Medical Questionnaire') 188 188 target = 'edit_medical' 189 189 icon = 'actionicon_medical.png' … … 200 200 grok.require('waeup.viewStudent') 201 201 icon = 'actionicon_pdf.png' 202 text = _('Download medical historyslip')203 target = 'medical_ history_slip.pdf'202 text = _('Download medical questionnaire slip') 203 target = 'medical_questionnaire_slip.pdf' 204 204 205 205 # JAMB Letter
Note: See TracChangeset for help on using the changeset viewer.