Ignore:
Timestamp:
8 Jan 2010, 01:39:46 (15 years ago)
Author:
uli
Message:

Remove viewing components. They moved to browser-subpackage.

File:
1 edited

Legend:

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

    r4510 r4724  
    55from zope.component.interfaces import IFactory
    66from waeup.interfaces import ICourse
    7 from waeup.viewlets import MainArea, Index, Manage, FormWrapMixin
    8 from waeup.utils.helpers import getName
    97
    108class Course(grok.Model):
     9    """A university course.
     10    """
    1111    grok.implements(ICourse)
    1212
     
    3939    def getInterfaces(self):
    4040        return implementedBy(Course)
    41 
    42 class DisplayForm(grok.DisplayForm):
    43     grok.context(ICourse)
    44     form_fields = grok.AutoFields(ICourse)
    45 
    46    
    47 class Content(FormWrapMixin, grok.Viewlet):
    48     """A viewlet that wraps the `AddDepartmentForm`.
    49     """
    50     grok.viewletmanager(MainArea)
    51     grok.context(ICourse)
    52     grok.view(Index)
    53     grok.require('waeup.manageUniversity')
    54     grok.order(3)
    55 
    56     formview_name = 'displayform' # The name of the formview we want
    57                                   # to be rendered in this viewlet.
    58 
    59 class ContentHeader(grok.Viewlet):
    60     """A viewlet that renders the faculty, department and course title.
    61     """
    62     grok.viewletmanager(MainArea)
    63     grok.context(ICourse)
    64     grok.view(Index)
    65     grok.order(2)
    66 
    67     def render(self):
    68         return '''<h5>%s</h5><h4>%s</h4><h3>%s</h3>''' % (
    69             getName(self.context.__parent__.__parent__.__parent__),
    70             getName(self.context.__parent__.__parent__),
    71             self.context.title)
    72        
    73 class ManageForm(grok.EditForm):
    74     """Manage the basic properties of a `Course` instance.
    75     """
    76 
    77     form_fields = grok.AutoFields(ICourse)
    78 
    79     @property
    80     def label(self):
    81         # Set department name as form label
    82         #return self.form_fields['title'].field.get(self.context)
    83         return ''
    84    
    85     @grok.action('Save')
    86     def save(self, **data):
    87         self.applyData(self.context, **data)
    88         return
    89    
    90     @grok.action('Save and return')
    91     def saveAndReturn(self, **data):
    92         self.applyData(self.context, **data)
    93         self.redirect(self.url(self.context))
    94         return
    95 
    96     @grok.action('Cancel')
    97     def cancel(self, **data):
    98         self.redirect(self.url(self.context))
    99         return
    100 
    101 class ManageCourse(FormWrapMixin, grok.Viewlet):
    102     """A viewlet that renders the `ManageForm`.
    103     """
    104     grok.viewletmanager(MainArea)
    105     grok.context(ICourse)
    106     grok.view(Manage)
    107     grok.require('waeup.manageUniversity')
    108    
    109     formview_name = 'manageform' # The name of the formview we want to
    110                                  # be rendered in this viewlet.
Note: See TracChangeset for help on using the changeset viewer.