Changeset 4585 for waeup/branches


Ignore:
Timestamp:
29 Dec 2009, 16:48:24 (15 years ago)
Author:
uli
Message:
  • Remove viewing components (they are now in browser subpackage).
  • Remove unneeded imports.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/app.py

    r4579 r4585  
    11import grok
    2 import re
    32from zope.app.authentication.authentication import PluggableAuthentication
    43from zope.app.security.interfaces import IAuthentication
    5 from zope.component import getUtility, getMultiAdapter, createObject
    6 from zope.interface import Interface
     4from zope.component import createObject
    75
    8 from waeup.interfaces import (IUniversity, IStudentContainer, IHostelContainer,
    9                               IFacultyContainer, ICSVDataReceivers)
    10 from waeup.viewlets import (MainArea, LeftSidebar, Index, Manage,
    11                             FormWrapMixin, master_template_path)
     6from waeup.interfaces import IUniversity, ICSVDataReceivers
    127from waeup.authentication import setup_authentication
    138from waeup.datacenter import DataCenter
    149from waeup.users import UserContainer
    15 from waeup.widgets.interfaces import ITableProvider
    16 
    17 master_template = grok.PageTemplateFile(master_template_path)
    1810
    1911class University(grok.Application, grok.Container):
     
    5648            return self.datacenter
    5749        return None
    58 
    59    
    60 class ManageForm(grok.EditForm):
    61     """Manage the basic properties of a `University` instance.
    62     """
    63 
    64     form_fields = grok.AutoFields(IUniversity)
    65     grok.require('waeup.manageUniversity')
    66 
    67     @grok.action('Save')
    68     def save(self, **data):
    69         self.applyData(self.context, **data)
    70         return
    71    
    72     @grok.action('Save and return')
    73     def saveAndReturn(self, **data):
    74         self.applyData(self.context, **data)
    75         self.redirect(self.url(self.context))
    76         return
    77 
    78     @grok.action('Cancel')
    79     def cancel(self, **data):
    80         self.redirect(self.url(self.context))
    81         return
    82 
    83 class ManageUniversity(Manage):
    84     grok.name('manage')
    85     grok.context(IUniversity)
    86     grok.require('waeup.manageUniversity')
    87     grok.template('master_template')
    88    
    89    
    90 class ManageUniversityMain(FormWrapMixin, grok.Viewlet):
    91     """A viewlet that renders the `ManageForm`.
    92     """
    93     grok.viewletmanager(MainArea)
    94     grok.context(IUniversity)
    95     grok.view(Manage)
    96     grok.require('waeup.manageUniversity')
    97    
    98     formview_name = 'manageform' # The name of the formview we want to
    99                                  # be rendered in this viewlet.
    100 
    101 class Content(grok.Viewlet):
    102     grok.viewletmanager(MainArea)
    103     grok.context(IUniversity)
    104     grok.view(Index)
    105 
    106     def update(self):
    107         self.table = ITableProvider(self.context).getTables(self.view)[0]
    108         self.table.need()
    109 
    110 class ManageLink(grok.Viewlet):
    111     grok.viewletmanager(LeftSidebar)
    112     grok.context(IUniversity)
    113     grok.view(Index)
    114     grok.order(5)
    115     # This link is only displayed, if the user is
    116     # allowed to use it!
    117     grok.require('waeup.manageUniversity')
    118    
    119     def render(self):
    120         return u'<div class="portlet"><a href="manage">Settings</a></div>'
    121 
    122 class ManageFacultiesLink(grok.Viewlet):
    123     grok.viewletmanager(LeftSidebar)
    124     grok.context(IUniversity)
    125     grok.view(Index)
    126     grok.order(6)
    127     # This is so cool! This link is only displayed, when the user is
    128     # allowed to use it!
    129     grok.require('waeup.manageUniversity')
    130    
    131     def render(self):
    132         return u'<div class="portlet"><a href="faculties">Manage faculties</a></div>'
    133 
    134 class ManageUsersLink(grok.Viewlet):
    135     grok.viewletmanager(LeftSidebar)
    136     grok.context(IUniversity)
    137     grok.view(Index)
    138     grok.order(6)
    139     grok.require('waeup.manageUsers')
    140 
    141     def render(self):
    142         return u'<div class="portlet"><a href="users">Manage users</a></div>'
    143 
    144 class ManageDataCenter(grok.Viewlet):
    145     grok.viewletmanager(LeftSidebar)
    146     grok.context(IUniversity)
    147     grok.view(Index)
    148     grok.order(6)
    149     grok.require('waeup.manageUniversity')
    150 
    151     def render(self):
    152         return u'<div class="portlet"><a href="datacenter">Data Center</a></div>'
Note: See TracChangeset for help on using the changeset viewer.