Changeset 6153 for main


Ignore:
Timestamp:
19 May 2011, 20:47:07 (14 years ago)
Author:
Henrik Bettermann
Message:

Ad breadcrumb and leftsidbar link for applicants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r6110 r6153  
    22## browser.py
    33## Login : <uli@pu.smp.net>
    4 ## Started on  Sun Jun 27 11:03:10 2010 Uli Fouquet
     4## Started on  Sun Jun 27 11:03:10 2010 Uli Fouquet & Henrik Bettermann
    55## $Id$
    66##
     
    2929from zope.interface import Invalid
    3030from zope.securitypolicy.interfaces import IPrincipalRoleManager
     31from zope.traversing.browser import absoluteURL
    3132
    3233from waeup.sirp.browser import (
     
    3637from waeup.sirp.browser.layout import NullValidator
    3738from waeup.sirp.browser.resources import datepicker, tabs, datatable
    38 from waeup.sirp.browser.viewlets import ManageActionButton, PrimaryNavTab
     39from waeup.sirp.browser.viewlets import (
     40    ManageActionButton, PrimaryNavTab, LeftSidebarLink
     41    )
    3942from waeup.sirp.image.browser.widget import (
    4043    ThumbnailWidget, EncodingImageFileWidget,
     
    4952    MultiListWidget, MultiListDisplayWidget)
    5053
    51 from waeup.sirp.applicants import ResultEntry, Applicant
     54from waeup.sirp.applicants import ResultEntry, Applicant, get_applicant_data
    5255from waeup.sirp.applicants.interfaces import (
    5356    IApplicant, IApplicantPrincipal, IApplicantPDEEditData,
     
    7174    grok.context(IApplicantsRoot)
    7275    grok.name('index')
     76    grok.require('waeup.Public')
    7377    title = 'Applicants'
    7478    label = 'Application Section'
     
    182186    """
    183187    grok.context(IApplicantsRoot)
    184     title = u'Applicants'
     188    title = u'Application Section'
    185189
    186190class ApplicantsContainerBreadcrumb(Breadcrumb):
     
    188192    """
    189193    grok.context(IApplicantsContainer)
     194   
     195class ApplicantBreadcrumb(Breadcrumb):
     196    """A breadcrumb for applicants.
     197    """
     198    grok.context(IApplicant)
     199   
     200    @property
     201    def title(self):
     202        """Get a title for a context.
     203        """
     204        return self.context.access_code
    190205
    191206class ApplicantsTab(PrimaryNavTab):
    192     """Faculties-tab in primary navigation.
     207    """Applicants tab in primary navigation.
    193208    """
    194209
     
    210225    grok.context(IApplicantsContainer)
    211226    grok.name('index')
     227    grok.require('waeup.Public')
    212228    grok.template('applicantscontainerpage')
    213229    pnav = 3
     
    242258    form_fields['startdate'].custom_widget = FriendlyDateWidget('le')
    243259    form_fields['enddate'].custom_widget = FriendlyDateWidget('le')
     260    grok.require('waeup.manageUniversity')
    244261
    245262    @property
     
    283300    grok.context(IApplicantsContainer)
    284301    grok.name('login')
    285     grok.require('zope.Public')
     302    grok.require('waeup.Public')
    286303
    287304    @property
     
    327344        self.redirect(self.url(self.context[pin], 'edit'))
    328345        return
     346       
     347class AccessCodeLink(LeftSidebarLink):
     348    grok.order(1)
     349    grok.require('waeup.Public')
     350
     351    def render(self):
     352        if not IApplicantPrincipal.providedBy(self.request.principal):
     353            return ''
     354        access_code = getattr(self.request.principal,'access_code',None)
     355        if access_code:
     356            applicant_object = get_applicant_data(access_code)
     357            url = absoluteURL(applicant_object, self.request)
     358            return u'<div class="portlet"><a href="%s">%s</a></div>' % (
     359                url,access_code)
     360        return ''
    329361
    330362class DisplayApplicant(WAeUPDisplayFormPage):
Note: See TracChangeset for help on using the changeset viewer.