Changeset 7438


Ignore:
Timestamp:
22 Dec 2011, 18:24:35 (13 years ago)
Author:
Henrik Bettermann
Message:

Put viewlets into their own module.

Remove unneeded imports.

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  
    2020from cStringIO import StringIO
    2121from grok import index
    22 from zope.component import getUtility, createObject, getUtility, getAdapter
     22from zope.component import getUtility, createObject, getAdapter
    2323from zope.component.interfaces import IFactory
    2424from zope.event import notify
    25 from zope.catalog.interfaces import ICatalog
    2625from zope.securitypolicy.interfaces import IPrincipalRoleManager
    2726from zope.interface import implementedBy
     
    3534from waeup.sirp.students.vocabularies import RegNumNotInSource
    3635from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal
    37 from waeup.sirp.applicants.interfaces import (
    38     IApplicant, IApplicantEdit, IApplicantBaseData,
    39     )
    40 
     36from waeup.sirp.applicants.interfaces import IApplicant, IApplicantEdit
    4137
    4238class Applicant(grok.Container):
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r7437 r7438  
    2727from hurry.workflow.interfaces import (
    2828    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
    29 from reportlab.pdfgen import canvas
    30 from reportlab.lib.units import cm
    31 from reportlab.lib.pagesizes import A4
    32 from reportlab.lib.styles import getSampleStyleSheet
    33 from reportlab.platypus import (Frame, Paragraph, Image,
    34     Table, Spacer)
    35 from reportlab.platypus.tables import TableStyle
    3629from waeup.sirp.applicants.interfaces import (
    3730    IApplicant, IApplicantEdit, IApplicantsRoot,
     
    4538from waeup.sirp.browser.interfaces import ICaptchaManager
    4639from waeup.sirp.browser.breadcrumbs import Breadcrumb
    47 from waeup.sirp.browser.layout import NullValidator, jsaction, JSAction
     40from waeup.sirp.browser.layout import NullValidator, jsaction
    4841from waeup.sirp.browser.pages import add_local_role, del_local_roles
    4942from waeup.sirp.browser.resources import datepicker, tabs, datatable, warning
    50 from waeup.sirp.browser.viewlets import ManageActionButton, PrimaryNavTab
    5143from waeup.sirp.interfaces import (
    5244    ISIRPObject, ILocalRolesAssignable, IExtFileStore, IPDF,
    5345    IFileStoreNameChooser, IPasswordValidator, IUserAccount, ISIRPUtils)
    5446from waeup.sirp.permissions import get_users_with_local_roles
    55 from waeup.sirp.students.viewlets import PrimaryStudentNavTab
    5647from waeup.sirp.students.interfaces import IStudentsUtils
    57 from waeup.sirp.university.interfaces import ICertificate
    5848from waeup.sirp.utils.helpers import string_from_bytes, file_size
    5949from waeup.sirp.widgets.datewidget import (
     
    7767        datatable.need()
    7868        return
    79 
    80 class ManageApplicantsRootActionButton(ManageActionButton):
    81     grok.context(IApplicantsRoot)
    82     grok.view(ApplicantsRootPage)
    83     grok.require('waeup.manageApplication')
    84     text = 'Manage application section'
    8569
    8670class ApplicantsRootManageFormPage(SIRPEditFormPage):
     
    229213        return self.context.p_id
    230214
    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 = 3
    238     tab_title = u'Applicants'
    239 
    240     @property
    241     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 the
    248     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     @property
    256     def link_target(self):
    257         if self.request.principal.id == 'zope.anybody':
    258             return self.view.application_url('applicants')
    259         return
    260 
    261 class MyApplicationDataTab(PrimaryStudentNavTab):
    262     """MyData-tab in primary navigation.
    263     """
    264     grok.order(3)
    265     grok.require('waeup.viewMyApplicationDataTab')
    266     pnav = 3
    267     tab_title = u'My Data'
    268 
    269     @property
    270     def link_target(self):
    271         try:
    272             container, application_number = self.request.principal.id.split('_')
    273         except ValueError:
    274             return
    275         rel_link = '/applicants/%s/%s' % (container, application_number)
    276         return self.view.application_url() + rel_link
    277 
    278215class ApplicantsContainerPage(SIRPDisplayFormPage):
    279216    """The standard view for regular applicant containers.
     
    297234    def label(self):
    298235        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'
    315236
    316237class ApplicantsContainerManageFormPage(SIRPEditFormPage):
     
    514435    def update(self):
    515436        p_category = 'acceptance'
    516         d = {}
    517437        session = str(self.context.__parent__.year)
    518438        try:
     
    573493            self.context.__parent__.display_fullname,self.context.p_id)
    574494
    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     @property
    585     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     @property
    600     def target_url(self):
    601         if self.context.p_state != 'unpaid':
    602             return ''
    603         return self.view.url(self.view.context, self.target)
    604 
    605495class OnlinePaymentCallbackPage(grok.View):
    606496    """ Callback view
     
    661551        return students_utils.renderPDF(self,'payment_receipt.pdf',
    662552            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'
    671553
    672554class ExportPDFPage(grok.View):
     
    713595            'Content-Type', 'application/pdf')
    714596        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     @property
    733     def target_url(self):
    734         """Get a URL to the target...
    735         """
    736         if self.context.locked:
    737             return
    738         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     @property
    749     def target_url(self):
    750         """Get a URL to the target...
    751         """
    752         if IWorkflowState(self.context).getState() != 'admitted':
    753             return
    754         return self.view.url(self.view.context, self.target)
    755597
    756598def handle_img_upload(upload, context, view):
     
    1007849        return
    1008850
    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 
    1017851class PassportImage(grok.View):
    1018852    """Renders the passport image for applicants.
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r7436 r7438  
    3636    lgas_vocab, CertificateSource, GenderSource)
    3737from waeup.sirp.applicants.vocabularies import (
    38     application_types_vocab, application_pins_vocab,
    39     AppCatCertificateSource)
     38    application_types_vocab, AppCatCertificateSource)
    4039from waeup.sirp.payments.interfaces import IOnlinePayment
    4140
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/pdf.py

    r7415 r7438  
    2929from zope.component import getUtility
    3030from zope.formlib.form import setUpEditWidgets
    31 from zope.interface import Interface
    3231from zope.publisher.browser import TestRequest
    3332from waeup.sirp.applicants.interfaces import IApplicant
Note: See TracChangeset for help on using the changeset viewer.