Changeset 6642


Ignore:
Timestamp:
28 Aug 2011, 08:41:05 (13 years ago)
Author:
Henrik Bettermann
Message:

Add viewlet manager 'StudentSitebar?' which is rendered in a block above the LeftSidebar? viewlet manager block. This viewlet manager replaces the plain action buttons recently implemented.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
1 added
10 edited

Legend:

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

    r6465 r6642  
    1414from waeup.sirp.browser.interfaces import ITheme
    1515from waeup.sirp.browser.theming import get_all_themes, WAeUPThemeGray1
     16from waeup.sirp.students.interfaces import IStudentNavigation
    1617
    1718grok.templatedir('templates')
     
    152153        return userid
    153154
     155    def getStudentName(self):
     156        """Return the student name.
     157        """
     158        if IStudentNavigation.providedBy(self.context):
     159            return self.context.getStudent().name
     160        return
     161
    154162    def update(self):
    155163        """Include the resources required by the chosen skin/theme.
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/sitelayout.pt

    r6639 r6642  
    7373        </div>
    7474        <div class="yui-b">
     75          <div class="block" tal:condition="layout/getStudentName">
     76            <div class="hd">
     77              <h2 tal:content="layout/getStudentName">Student name</h2>
     78            </div>
     79            <div class="bd">
     80              <tal:left content="structure provider:left_student" />
     81            </div>
     82          </div>
    7583          <div class="block">
    7684            <div class="hd">
  • main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py

    r6635 r6642  
    2020from grok import index
    2121from zope.component.interfaces import IFactory
    22 from zope.interface import implementedBy
    23 from waeup.sirp.students.interfaces import IStudentAccommodation
     22from waeup.sirp.students.interfaces import (
     23    IStudentAccommodation, IStudentNavigation)
    2424from waeup.sirp.utils.helpers import attrs_to_fields
    2525
     
    2727    """This is a container for accommodation objects.
    2828    """
    29     grok.implements(IStudentAccommodation)
     29    grok.implements(IStudentAccommodation, IStudentNavigation)
    3030    grok.provides(IStudentAccommodation)
    3131
     
    3434        return
    3535
     36    def getStudent(self):
     37        return self.__parent__
     38
    3639StudentAccommodation = attrs_to_fields(StudentAccommodation)
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6638 r6642  
    4545from waeup.sirp.browser.resources import datepicker, tabs, datatable
    4646from waeup.sirp.browser.viewlets import (
    47     ManageActionButton, PrimaryNavTab, LeftSidebarLink,
     47    ManageActionButton, PrimaryNavTab,
    4848    AddActionButton, ActionButton, PlainActionButton,
    4949    )
     
    6565    IStudentsContainer, IStudent, IStudentClearance,
    6666    IStudentPersonal, IStudentBase, IStudentStudyCourse,
    67     IStudentPayments, IStudentAccommodation
     67    IStudentPayments, IStudentAccommodation, IStudentNavigation
    6868    )
    6969from waeup.sirp.students.student import (
     
    119119    grok.require('waeup.viewStudents')
    120120    grok.template('studentscontainerpage')
     121    pnav = 4
    121122
    122123    @property
     
    163164    grok.require('waeup.manageStudents')
    164165    grok.template('studentscontainermanagepage')
     166    pnav = 4
    165167
    166168    @property
     
    225227    title = 'Students'
    226228    label = 'Add student'
     229    pnav = 4
    227230
    228231    @grok.action('Create student record')
     
    250253    grok.template('studentpage')
    251254    form_fields = grok.AutoFields(IStudentBase)
    252 
    253     @property
    254     def title(self):
    255         return 'Student: %s' % self.context.name
     255    pnav = 4
     256    title = 'Base Data'
    256257
    257258    @property
     
    266267    text = 'Edit'
    267268    target = 'edit_base'
    268 
    269 class StudentClearanceViewActionButton(PlainActionButton):
    270     grok.order(2)
    271     grok.context(IStudent)
    272     grok.view(StudentBaseDisplayFormPage)
    273     grok.require('waeup.viewStudents')
    274     text = 'Clearance Data'
    275     target = 'view_clearance'
    276 
    277 class StudentPersonalViewActionButton(PlainActionButton):
    278     grok.order(3)
    279     grok.context(IStudent)
    280     grok.view(StudentBaseDisplayFormPage)
    281     grok.require('waeup.viewStudents')
    282     text = 'Personal Data'
    283     target = 'view_personal'
    284 
    285 class StudyCourseViewActionButton(PlainActionButton):
    286     grok.order(4)
    287     grok.context(IStudent)
    288     grok.view(StudentBaseDisplayFormPage)
    289     grok.require('waeup.viewStudents')
    290     text = 'Study Course'
    291     target = 'studycourse'
    292 
    293 class PaymentsViewActionButton(PlainActionButton):
    294     grok.order(5)
    295     grok.context(IStudent)
    296     grok.view(StudentBaseDisplayFormPage)
    297     grok.require('waeup.viewStudents')
    298     text = 'Payments'
    299     target = 'payments'
    300 
    301 class AccommodationViewActionButton(PlainActionButton):
    302     grok.order(6)
    303     grok.context(IStudent)
    304     grok.view(StudentBaseDisplayFormPage)
    305     grok.require('waeup.viewStudents')
    306     text = 'Accommodation'
    307     target = 'accommodation'
    308 
    309 class HistoryViewActionButton(PlainActionButton):
    310     grok.order(7)
    311     grok.context(IStudent)
    312     grok.view(StudentBaseDisplayFormPage)
    313     grok.require('waeup.viewStudents')
    314     text = 'History'
    315     target = 'history'
    316269
    317270class StudentBaseManageFormPage(WAeUPEditFormPage):
     
    324277    grok.template('studentbasemanagepage')
    325278    label = 'Edit base data'
     279    title = 'Base Data'
     280    pnav = 4
    326281
    327282    def update(self):
     
    330285        self.wf_info = IWorkflowInfo(self.context)
    331286        return
    332 
    333     @property
    334     def title(self):
    335         return 'Student: %s' % self.context.name
    336287
    337288    def getTransitions(self):
     
    368319    grok.require('waeup.viewStudents')
    369320    form_fields = grok.AutoFields(IStudentClearance)
    370 
    371     @property
    372     def title(self):
    373         return 'Student: %s' % self.context.name
     321    title = 'Clearance Data'
     322    pnav = 4
    374323
    375324    @property
     
    393342    form_fields = grok.AutoFields(IStudentClearance)
    394343    label = 'Edit clearance data'
    395 
    396     @property
    397     def title(self):
    398         return 'Student: %s' % self.context.name
     344    title = 'Clearance Data'
     345    pnav = 4
    399346
    400347class StudentPersonalDisplayFormPage(WAeUPDisplayFormPage):
     
    405352    grok.require('waeup.viewStudents')
    406353    form_fields = grok.AutoFields(IStudentPersonal)
    407 
    408     @property
    409     def title(self):
    410         return 'Student: %s' % self.context.name
     354    title = 'Personal Data'
     355    pnav = 4
    411356
    412357    @property
     
    430375    form_fields = grok.AutoFields(IStudentPersonal)
    431376    label = 'Edit personal data'
    432 
    433     @property
    434     def title(self):
    435         return 'Student: %s' % self.context.name
     377    title = 'Personal Data'
     378    pnav = 4
    436379
    437380class StudyCourseDisplayFormPage(WAeUPDisplayFormPage):
     
    443386    form_fields = grok.AutoFields(IStudentStudyCourse)
    444387    #grok.template('studycoursepage')
    445 
    446     @property
    447     def title(self):
    448         return 'Student: %s' % self.context.__parent__.name
    449 
    450     @property
    451     def label(self):
    452         return '%s: Study Course Data' % self.context.__parent__.name
     388    title = 'Study Course'
     389    pnav = 4
     390
     391    @property
     392    def label(self):
     393        return '%s: Study Course' % self.context.__parent__.name
    453394
    454395class PaymentsDisplayFormPage(WAeUPDisplayFormPage):
     
    460401    form_fields = grok.AutoFields(IStudentPayments)
    461402    #grok.template('paymentspage')
    462 
    463     @property
    464     def title(self):
    465         return 'Student: %s' % self.context.__parent__.name
     403    title = 'Payments'
     404    pnav = 4
    466405
    467406    @property
     
    477416    form_fields = grok.AutoFields(IStudentAccommodation)
    478417    #grok.template('accommodationpage')
    479 
    480     @property
    481     def title(self):
    482         return 'Student: %s' % self.context.__parent__.name
     418    title = 'Accommodation'
     419    pnav = 4
    483420
    484421    @property
     
    493430    grok.require('waeup.viewStudents')
    494431    grok.template('studenthistory')
    495 
    496     @property
    497     def title(self):
    498         return 'Student: %s' % self.context.name
     432    title = 'History'
     433    pnav = 4
    499434
    500435    @property
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studentbasemanagepage.pt

    r6638 r6642  
     1<h2 i18n:translate=""
     2    tal:condition="view/label"
     3    tal:content="view/label">Label</h2>
     4
    15<form action="." tal:attributes="action request/URL" method="post"
    26      class="edit-form" enctype="multipart/form-data">
     
    3539      </tal:block>
    3640      <tr>
    37         <td class="label"><label>Application Transition:</label></td>
     41        <td class="label"><label>Registration Transition:</label></td>
    3842        <td>
    3943          <select id="transition" name="transition">
  • main/waeup.sirp/trunk/src/waeup/sirp/students/container.py

    r6637 r6642  
    2020import os
    2121from zope.component.interfaces import IFactory
    22 from zope.interface import implementedBy
    2322from waeup.sirp.students.interfaces import (
    2423    IStudentsContainer, IStudent, IStudentPayments, IStudentAccommodation)
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6637 r6642  
    44from zope import schema
    55from waeup.sirp.interfaces import IWAeUPObject
     6
     7class IStudentNavigation(IWAeUPObject):
     8    """Interface needed for student navigation.
     9    """
     10
     11    def getStudent():
     12        """Return student object.
     13        """
    614
    715class IStudentBase(IWAeUPObject):
     
    5462    """
    5563
    56     def addStudent(faculty):
     64    def addStudent(student):
    5765        """Add an IStudent object and subcontainers.
    5866
  • main/waeup.sirp/trunk/src/waeup/sirp/students/payments.py

    r6635 r6642  
    2020from grok import index
    2121from zope.component.interfaces import IFactory
    22 from zope.interface import implementedBy
    23 from waeup.sirp.students.interfaces import IStudentPayments
     22from waeup.sirp.students.interfaces import IStudentPayments, IStudentNavigation
    2423from waeup.sirp.utils.helpers import attrs_to_fields
    2524
     
    2726    """This is a container for student payments.
    2827    """
    29     grok.implements(IStudentPayments)
     28    grok.implements(IStudentPayments, IStudentNavigation)
    3029    grok.provides(IStudentPayments)
    3130
     
    3433        return
    3534
     35    def getStudent(self):
     36        return self.__parent__
     37
    3638StudentPayments = attrs_to_fields(StudentPayments)
  • main/waeup.sirp/trunk/src/waeup/sirp/students/student.py

    r6637 r6642  
    2323from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    2424from waeup.sirp.interfaces import IObjectHistory
    25 from waeup.sirp.students.interfaces import IStudent
     25from waeup.sirp.students.interfaces import IStudent, IStudentNavigation
    2626from waeup.sirp.utils.helpers import attrs_to_fields
    2727
     
    3030    owned by students.
    3131    """
    32     grok.implements(IStudent)
     32    grok.implements(IStudent, IStudentNavigation)
    3333    grok.provides(IStudent)
    3434
     
    5252        return history
    5353
     54    def getStudent(self):
     55        return self
     56
    5457# Set all attributes of Student required in IStudent as field
    5558# properties. Doing this, we do not have to set initial attributes
  • main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py

    r6633 r6642  
    2121from grok import index
    2222from zope.component.interfaces import IFactory
    23 from zope.interface import implementedBy
    24 from waeup.sirp.students.interfaces import IStudentStudyCourse
     23from waeup.sirp.students.interfaces import (
     24    IStudentStudyCourse, IStudentNavigation)
    2525from waeup.sirp.utils.helpers import attrs_to_fields
    2626
     
    2828    """This is a container for study levels.
    2929    """
    30     grok.implements(IStudentStudyCourse)
     30    grok.implements(IStudentStudyCourse, IStudentNavigation)
    3131    grok.provides(IStudentStudyCourse)
    3232
     
    3535        return
    3636
     37    def getStudent(self):
     38        return self.__parent__
     39
    3740StudentStudyCourse = attrs_to_fields(StudentStudyCourse)
Note: See TracChangeset for help on using the changeset viewer.