- Timestamp:
- 18 Apr 2020, 16:42:14 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r16006 r16058 862 862 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 863 863 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 864 prefix = 'form'864 #prefix = 'form' 865 865 note = None 866 866 … … 903 903 grok.name('application_slip.pdf') 904 904 grok.require('waeup.viewApplication') 905 prefix = 'form'905 #prefix = 'form' 906 906 907 907 def update(self): … … 1289 1289 if referee.email_sent: 1290 1290 continue 1291 mandate = RefereeReportMandate( )1291 mandate = RefereeReportMandate(days=7) 1292 1292 mandate.params['name'] = referee.name 1293 1293 mandate.params['email'] = referee.email … … 1682 1682 label = _('Referee Report') 1683 1683 pnav = 3 1684 form_fields = grok.AutoFields(IApplicantRefereeReport) 1685 form_fields[ 1686 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1684 1687 1685 1688 class RefereeReportAddFormPage(KofaAddFormPage): … … 1714 1717 self.redirect(self.application_url()) 1715 1718 return 1719 self.passport_url = self.url(self.context, 'passport.jpg') 1716 1720 if mandate: 1721 # Check the mandate expiration date after redirect again 1722 if mandate.expires < datetime.utcnow(): 1723 self.flash(_('Mandate expired.'), 1724 type='warning') 1725 self.redirect(self.application_url()) 1726 return 1717 1727 # Prefill form with mandate params 1718 1728 self.form_fields.get( … … 1741 1751 return 1742 1752 1753 class ExportPDFReportSlipPage(UtilityView, grok.View): 1754 """Deliver a PDF slip of the context. 1755 """ 1756 grok.context(IApplicantRefereeReport) 1757 grok.name('referee_report_slip.pdf') 1758 grok.require('waeup.manageApplication') 1759 form_fields = grok.AutoFields(IApplicantRefereeReport) 1760 form_fields[ 1761 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1762 #prefix = 'form' 1763 note = None 1764 1765 @property 1766 def title(self): 1767 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 1768 return translate(_('Referee Report'), 'waeup.kofa', 1769 target_language=portal_language) 1770 1771 @property 1772 def label(self): 1773 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 1774 return translate(_('Referee Report Slip'), 1775 'waeup.kofa', target_language=portal_language) \ 1776 + ' %s' % self.context.r_id 1777 1778 def render(self): 1779 applicantview = ApplicantBaseDisplayFormPage(self.context.__parent__, 1780 self.request) 1781 students_utils = getUtility(IStudentsUtils) 1782 return students_utils.renderPDF(self,'referee_report_slip.pdf', 1783 self.context.__parent__, applicantview, note=self.note) 1784 1743 1785 class AdditionalFile(grok.View): 1744 1786 """Renders additional pdf files for applicants. -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/refereereportpage.pt
r16056 r16058 14 14 </strong> 15 15 of the <span i18n:name="app_title" tal:replace="layout/getAppTitle"></span>. 16 16 17 <br /><br /> 17 Please fill and submit the following form. After submission the form will 18 be locked. You can neither view nor edit your report after submission. 18 19 <img tal:condition="python: context.__parent__.with_picture" 20 src="" height="180px" tal:attributes="src view/passport_url" /> 21 22 <br /><br /> 23 24 Please fill and submit the following referee report form. After submission 25 the form will be locked. You can neither view nor edit 26 your report after submission. 19 27 </p> 20 28 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r15833 r16058 668 668 669 669 creation_date = schema.Datetime( 670 title = _(u' Ticket Creation Date'),670 title = _(u'Report Creation Date'), 671 671 readonly = False, 672 672 required = False, … … 674 674 675 675 name = schema.TextLine( 676 title = _(u' Name'),676 title = _(u'Referee Name'), 677 677 required = True, 678 678 ) 679 679 680 680 email = schema.ASCIILine( 681 title = _(u' Email Address'),681 title = _(u'Referee Email Address'), 682 682 required = True, 683 683 constraint=validate_email, … … 685 685 686 686 phone = PhoneNumber( 687 title = _(u' Phone'),687 title = _(u'Referee Phone'), 688 688 description = u'', 689 689 required = False, -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r15943 r16058 38 38 from zope.testbrowser.testing import Browser 39 39 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 40 from waeup.kofa.browser.tests.test_pdf import samples_dir 40 41 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 41 42 from waeup.kofa.app import University … … 1723 1724 self.browser.url, self.view_path + '/%s' % report.r_id) 1724 1725 self.assertTrue('John Referee' in self.browser.contents) 1726 # Managers can download a pdf slip 1727 self.browser.getLink("Download report").click() 1728 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1729 self.assertEqual(self.browser.headers['Content-Type'], 1730 'application/pdf') 1731 path = os.path.join(samples_dir(), 'referee_report_slip.pdf') 1732 open(path, 'wb').write(self.browser.contents) 1733 print "Sample PDF referee_report_slip.pdf written to %s" % path 1725 1734 # Report creation is logged 1726 1735 logfile = os.path.join( -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/viewlets.py
r15843 r16058 23 23 from waeup.kofa.applicants.interfaces import ( 24 24 IApplicant, IApplicantsRoot, IApplicantsContainer, 25 IApplicantOnlinePayment 25 IApplicantOnlinePayment, IApplicantRefereeReport 26 26 ) 27 27 from waeup.kofa.applicants.browser import ( 28 28 ApplicantsRootPage, ApplicantsContainerPage, ApplicantManageFormPage, 29 29 ApplicantDisplayFormPage, OnlinePaymentDisplayFormPage, 30 ApplicantsContainerManageFormPage, ApplicantsStatisticsPage 30 ApplicantsContainerManageFormPage, ApplicantsStatisticsPage, 31 RefereeReportDisplayFormPage 31 32 ) 32 33 … … 285 286 return self.view.url(self.view.context, self.target) 286 287 288 class ReportSlipActionButton(ManageActionButton): 289 grok.order(1) 290 grok.context(IApplicantRefereeReport) 291 grok.view(RefereeReportDisplayFormPage) 292 grok.require('waeup.manageApplication') 293 icon = 'actionicon_pdf.png' 294 text = _('Download report slip') 295 target = 'referee_report_slip.pdf' 296 297 @property 298 def target_url(self): 299 return self.view.url(self.view.context, self.target) 300 287 301 class ApprovePaymentActionButton(ManageActionButton): 288 302 grok.order(8)
Note: See TracChangeset for help on using the changeset viewer.