- Timestamp:
- 22 Dec 2011, 18:24:35 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py
r7436 r7438 20 20 from cStringIO import StringIO 21 21 from grok import index 22 from zope.component import getUtility, createObject, get Utility, getAdapter22 from zope.component import getUtility, createObject, getAdapter 23 23 from zope.component.interfaces import IFactory 24 24 from zope.event import notify 25 from zope.catalog.interfaces import ICatalog26 25 from zope.securitypolicy.interfaces import IPrincipalRoleManager 27 26 from zope.interface import implementedBy … … 35 34 from waeup.sirp.students.vocabularies import RegNumNotInSource 36 35 from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal 37 from waeup.sirp.applicants.interfaces import ( 38 IApplicant, IApplicantEdit, IApplicantBaseData, 39 ) 40 36 from waeup.sirp.applicants.interfaces import IApplicant, IApplicantEdit 41 37 42 38 class Applicant(grok.Container): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r7437 r7438 27 27 from hurry.workflow.interfaces import ( 28 28 IWorkflowInfo, IWorkflowState, InvalidTransitionError) 29 from reportlab.pdfgen import canvas30 from reportlab.lib.units import cm31 from reportlab.lib.pagesizes import A432 from reportlab.lib.styles import getSampleStyleSheet33 from reportlab.platypus import (Frame, Paragraph, Image,34 Table, Spacer)35 from reportlab.platypus.tables import TableStyle36 29 from waeup.sirp.applicants.interfaces import ( 37 30 IApplicant, IApplicantEdit, IApplicantsRoot, … … 45 38 from waeup.sirp.browser.interfaces import ICaptchaManager 46 39 from waeup.sirp.browser.breadcrumbs import Breadcrumb 47 from waeup.sirp.browser.layout import NullValidator, jsaction , JSAction40 from waeup.sirp.browser.layout import NullValidator, jsaction 48 41 from waeup.sirp.browser.pages import add_local_role, del_local_roles 49 42 from waeup.sirp.browser.resources import datepicker, tabs, datatable, warning 50 from waeup.sirp.browser.viewlets import ManageActionButton, PrimaryNavTab51 43 from waeup.sirp.interfaces import ( 52 44 ISIRPObject, ILocalRolesAssignable, IExtFileStore, IPDF, 53 45 IFileStoreNameChooser, IPasswordValidator, IUserAccount, ISIRPUtils) 54 46 from waeup.sirp.permissions import get_users_with_local_roles 55 from waeup.sirp.students.viewlets import PrimaryStudentNavTab56 47 from waeup.sirp.students.interfaces import IStudentsUtils 57 from waeup.sirp.university.interfaces import ICertificate58 48 from waeup.sirp.utils.helpers import string_from_bytes, file_size 59 49 from waeup.sirp.widgets.datewidget import ( … … 77 67 datatable.need() 78 68 return 79 80 class ManageApplicantsRootActionButton(ManageActionButton):81 grok.context(IApplicantsRoot)82 grok.view(ApplicantsRootPage)83 grok.require('waeup.manageApplication')84 text = 'Manage application section'85 69 86 70 class ApplicantsRootManageFormPage(SIRPEditFormPage): … … 229 213 return self.context.p_id 230 214 231 class ApplicantsAuthTab(PrimaryNavTab):232 """Applicants tab in primary navigation.233 """234 grok.context(ISIRPObject)235 grok.order(3)236 grok.require('waeup.viewApplicantsTab')237 pnav = 3238 tab_title = u'Applicants'239 240 @property241 def link_target(self):242 return self.view.application_url('applicants')243 244 class ApplicantsAnonTab(ApplicantsAuthTab):245 """Applicants tab in primary navigation.246 247 Display tab only for anonymous. Authenticated users can call the248 form from the user navigation bar.249 """250 grok.require('waeup.Anonymous')251 tab_title = u'Application'252 253 # Also zope.manager has role Anonymous.254 # To avoid displaying this tab, we have to check the principal id too.255 @property256 def link_target(self):257 if self.request.principal.id == 'zope.anybody':258 return self.view.application_url('applicants')259 return260 261 class MyApplicationDataTab(PrimaryStudentNavTab):262 """MyData-tab in primary navigation.263 """264 grok.order(3)265 grok.require('waeup.viewMyApplicationDataTab')266 pnav = 3267 tab_title = u'My Data'268 269 @property270 def link_target(self):271 try:272 container, application_number = self.request.principal.id.split('_')273 except ValueError:274 return275 rel_link = '/applicants/%s/%s' % (container, application_number)276 return self.view.application_url() + rel_link277 278 215 class ApplicantsContainerPage(SIRPDisplayFormPage): 279 216 """The standard view for regular applicant containers. … … 297 234 def label(self): 298 235 return self.context.title 299 300 class ApplicantsContainerManageActionButton(ManageActionButton):301 grok.order(1)302 grok.context(IApplicantsContainer)303 grok.view(ApplicantsContainerPage)304 grok.require('waeup.manageApplication')305 text = 'Manage applicants container'306 307 class ApplicantRegisterActionButton(ManageActionButton):308 grok.order(2)309 grok.context(IApplicantsContainer)310 grok.view(ApplicantsContainerPage)311 grok.require('waeup.Anonymous')312 icon = 'actionicon_login.png'313 text = 'Register for application'314 target = 'register'315 236 316 237 class ApplicantsContainerManageFormPage(SIRPEditFormPage): … … 514 435 def update(self): 515 436 p_category = 'acceptance' 516 d = {}517 437 session = str(self.context.__parent__.year) 518 438 try: … … 573 493 self.context.__parent__.display_fullname,self.context.p_id) 574 494 575 class PaymentReceiptActionButton(ManageActionButton):576 grok.order(1)577 grok.context(IApplicantOnlinePayment)578 grok.view(OnlinePaymentDisplayFormPage)579 grok.require('waeup.viewApplication')580 icon = 'actionicon_pdf.png'581 text = 'Download payment receipt'582 target = 'payment_receipt.pdf'583 584 @property585 def target_url(self):586 if self.context.p_state != 'paid':587 return ''588 return self.view.url(self.view.context, self.target)589 590 class RequestCallbackActionButton(ManageActionButton):591 grok.order(2)592 grok.context(IApplicantOnlinePayment)593 grok.view(OnlinePaymentDisplayFormPage)594 grok.require('waeup.payApplicant')595 icon = 'actionicon_call.png'596 text = 'Request callback'597 target = 'callback'598 599 @property600 def target_url(self):601 if self.context.p_state != 'unpaid':602 return ''603 return self.view.url(self.view.context, self.target)604 605 495 class OnlinePaymentCallbackPage(grok.View): 606 496 """ Callback view … … 661 551 return students_utils.renderPDF(self,'payment_receipt.pdf', 662 552 self.context.__parent__, applicantview) 663 664 class PDFActionButton(ManageActionButton):665 grok.order(3)666 grok.context(IApplicant)667 grok.require('waeup.viewApplication')668 icon = 'actionicon_pdf.png'669 text = 'Download application slip'670 target = 'application_slip.pdf'671 553 672 554 class ExportPDFPage(grok.View): … … 713 595 'Content-Type', 'application/pdf') 714 596 return pdfstream 715 716 class ApplicantManageActionButton(ManageActionButton):717 grok.order(1)718 grok.context(IApplicant)719 grok.view(ApplicantDisplayFormPage)720 grok.require('waeup.manageApplication')721 text = 'Manage application record'722 target = 'manage'723 724 class ApplicantEditActionButton(ManageActionButton):725 grok.order(2)726 grok.context(IApplicant)727 grok.view(ApplicantDisplayFormPage)728 grok.require('waeup.handleApplication')729 text = 'Edit application record'730 target ='edit'731 732 @property733 def target_url(self):734 """Get a URL to the target...735 """736 if self.context.locked:737 return738 return self.view.url(self.view.context, self.target)739 740 class StudentCreateActionButton(ManageActionButton):741 grok.order(4)742 grok.context(IApplicant)743 grok.require('waeup.manageApplication')744 icon = 'actionicon_entrance.png'745 text = 'Create student record'746 target ='createstudent'747 748 @property749 def target_url(self):750 """Get a URL to the target...751 """752 if IWorkflowState(self.context).getState() != 'admitted':753 return754 return self.view.url(self.view.context, self.target)755 597 756 598 def handle_img_upload(upload, context, view): … … 1007 849 return 1008 850 1009 class ApplicantViewActionButton(ManageActionButton):1010 grok.context(IApplicant)1011 grok.view(ApplicantManageFormPage)1012 grok.require('waeup.viewApplication')1013 icon = 'actionicon_view.png'1014 text = 'View application record'1015 target = 'index'1016 1017 851 class PassportImage(grok.View): 1018 852 """Renders the passport image for applicants. -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r7436 r7438 36 36 lgas_vocab, CertificateSource, GenderSource) 37 37 from waeup.sirp.applicants.vocabularies import ( 38 application_types_vocab, application_pins_vocab, 39 AppCatCertificateSource) 38 application_types_vocab, AppCatCertificateSource) 40 39 from waeup.sirp.payments.interfaces import IOnlinePayment 41 40 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/pdf.py
r7415 r7438 29 29 from zope.component import getUtility 30 30 from zope.formlib.form import setUpEditWidgets 31 from zope.interface import Interface32 31 from zope.publisher.browser import TestRequest 33 32 from waeup.sirp.applicants.interfaces import IApplicant
Note: See TracChangeset for help on using the changeset viewer.