Changeset 5104 for main


Ignore:
Timestamp:
31 Mar 2010, 16:41:11 (15 years ago)
Author:
uli
Message:
  • Make use of new permission.
  • Provide number of used ACs for each batch.
  • Add link on home page to access codes management screen.
File:
1 edited

Legend:

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

    r5088 r5104  
    55from waeup.sirp.browser import WAeUPPage, WAeUPAddFormPage
    66from waeup.sirp.browser.breadcrumbs import Breadcrumb
    7 from waeup.sirp.browser.viewlets import AdminTask, AddActionButton
    8 from waeup.sirp.interfaces import IWAeUPObject
     7from waeup.sirp.browser.pages import UniversityPage
     8from waeup.sirp.browser.viewlets import AdminTask, AddActionButton, LeftSidebar
     9from waeup.sirp.interfaces import IWAeUPObject, IUniversity
    910
    1011from waeup.sirp.accesscodes.accesscodes import AccessCodeBatch
     12from waeup.sirp.accesscodes.catalog import invalidated_num
    1113from waeup.sirp.accesscodes.interfaces import (
    1214    IAccessCodeBatchContainer, IAccessCodeBatch,
     
    1921    grok.context(IAccessCodeBatchContainer)
    2022    grok.template('batchcontainer')
     23    grok.require('waeup.manageACBatches')
    2124
    2225    title = 'Access Code Batches'
    2326    pnav = 0
    2427
     28    def invalidated(self, batch):
     29        return invalidated_num(batch.prefix, batch.num)
     30
     31
    2532class AddBatchPage(WAeUPAddFormPage):
    2633    grok.name('add')
    2734    grok.context(IAccessCodeBatchContainer)
     35    grok.require('waeup.manageACBatches')
    2836
    2937    title = label = 'Create a WAeUP Scratch Card Batch'
     
    3442
    3543    @grok.action('Cancel')
    36     def cancel(self):
     44    def cancel(self, *args, **kw):
    3745        self.flash('Batch creation cancelled.')
    3846        self.redirect(self.url(self.context))
     
    5159class BatchContainerBreadcrumb(Breadcrumb):
    5260    """A breadcrumb for ac batch containers.
    53     """
     61    """
     62    grok.require('waeup.manageACBatches')
    5463    grok.context(IAccessCodeBatchContainer)
    5564    title = u'Access Code Batches'
     
    6069    """
    6170    grok.order(5)
    62     grok.require('waeup.manageUniversity')
     71    grok.require('waeup.manageACBatches')
    6372    grok.template('admintaskacbatches')
    6473
     
    7180    grok.context(IAccessCodeBatchContainer)
    7281    grok.view(BatchContainerPage)
    73     grok.require('waeup.manageUniversity')
     82    grok.require('waeup.manageACBatches')
    7483    text = 'Add Scratch Card Batch'
     84
     85class ManageAccessCodes(grok.Viewlet):
     86    """Link on front page to access code management.
     87    """
     88    grok.viewletmanager(LeftSidebar)
     89    grok.context(IUniversity)
     90    grok.view(UniversityPage)
     91    grok.order(6)
     92    grok.require('waeup.manageACBatches')
     93
     94    def render(self):
     95        return u'<div class="portlet"><a href="accesscodes">Manage access-codes</a></div>'
Note: See TracChangeset for help on using the changeset viewer.