Ignore:
Timestamp:
14 Dec 2011, 07:04:05 (13 years ago)
Author:
Henrik Bettermann
Message:

Add StudentApplication? view components.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

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

    r7337 r7340  
    5858from waeup.sirp.students.vocabularies import StudyLevelSource
    5959from waeup.sirp.browser.resources import toggleall
     60from waeup.sirp.applicants.interfaces import IApplicantBaseData
    6061from waeup.sirp.hostels.hostel import NOT_OCCUPIED
    6162from waeup.sirp.utils.helpers import send_mail
     
    100101    def title(self):
    101102        return self.context.fullname
     103
     104class ApplicationBreadcrumb(Breadcrumb):
     105    """A breadcrumb for the application data.
     106    """
     107    grok.context(IApplicantBaseData)
     108    title = 'Application'
    102109
    103110class SudyCourseBreadcrumb(Breadcrumb):
     
    468475            write_log_message(self, 'saved: % s' % fields_string)
    469476        return
     477
     478class StudentApplicationDisplayFormPage(SIRPDisplayFormPage):
     479    """ Page to display application data
     480    """
     481    grok.context(IApplicantBaseData)
     482    grok.name('index')
     483    grok.require('waeup.viewStudent')
     484    form_fields = grok.AutoFields(IApplicantBaseData)
     485    title = 'Application Data'
     486    pnav = 4
     487
     488    @property
     489    def label(self):
     490        return '%s: Application Data' % self.context.getStudent().fullname
    470491
    471492class StudentClearanceDisplayFormPage(SIRPDisplayFormPage):
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7337 r7340  
    368368        self.assertMatches('...Student admitted by zope.mgr...',
    369369                           self.browser.contents)
     370        # Only the StudentApplication object does not exist
     371        self.assertFalse('Application Data' in self.browser.contents)
    370372        return
    371373
  • main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py

    r7321 r7340  
    6565    text = u'Base Data'
    6666
     67class StudentManageApplicationLink(StudentManageLink):
     68    grok.order(2)
     69    link = 'application'
     70    text = u'Application Data'
     71
     72    def render(self):
     73        application = self.context.getStudent().get(self.link)
     74        if application is not None:
     75            url = self.view.url(application)
     76            return u'<div class="portlet"><a href="%s">%s</a></div>' % (
     77                    url, self.text)
     78        return ''
     79
    6780class StudentManageClearanceLink(StudentManageLink):
    68     grok.order(2)
     81    grok.order(3)
    6982    link = 'view_clearance'
    7083    text = u'Clearance Data'
    7184
    7285class StudentManagePersonalLink(StudentManageLink):
    73     grok.order(2)
     86    grok.order(4)
    7487    link = 'view_personal'
    7588    text = u'Personal Data'
    7689
    7790class StudentManageStudyCourseLink(StudentManageLink):
    78     grok.order(3)
     91    grok.order(5)
    7992    link = 'studycourse'
    8093    text = u'Study Course'
    8194
    8295class StudentManagePaymentsLink(StudentManageLink):
    83     grok.order(4)
     96    grok.order(6)
    8497    grok.require('waeup.payStudent')
    8598    link = 'payments'
     
    87100
    88101class StudentManageAccommodationLink(StudentManageLink):
    89     grok.order(5)
     102    grok.order(7)
    90103    grok.require('waeup.handleAccommodation')
    91104    link = 'accommodation'
     
    93106
    94107class StudentManageHistoryLink(StudentManageLink):
    95     grok.order(6)
     108    grok.order(8)
    96109    link = 'history'
    97110    text = u'History'
     
    128141    text = u'Base Data'
    129142
     143class StudentApplicationLink(StudentLink):
     144    grok.order(2)
     145    link = 'application'
     146    text = u'Application Data'
     147
     148    @property
     149    def target_url(self):
     150        application = self.context.getStudent().get(self.link)
     151        if application is not None:
     152            return self.view.url(application)
     153        return
     154
    130155class StudentClearanceLink(StudentLink):
    131     grok.order(2)
     156    grok.order(3)
    132157    link = 'view_clearance'
    133158    text = u'Clearance Data'
    134159
    135160class StudentPersonalLink(StudentLink):
    136     grok.order(2)
     161    grok.order(4)
    137162    link = 'view_personal'
    138163    text = u'Personal Data'
    139164
    140165class StudentStudyCourseLink(StudentLink):
    141     grok.order(3)
     166    grok.order(5)
    142167    link = 'studycourse'
    143168    text = u'Study Course'
    144169
    145170class StudentPaymentsLink(StudentLink):
    146     grok.order(4)
     171    grok.order(6)
    147172    link = 'payments'
    148173    text = u'Payments'
    149174
    150175class StudentAccommodationLink(StudentLink):
    151     grok.order(5)
     176    grok.order(7)
    152177    link = 'accommodation'
    153178    text = u'Accommodation'
    154179
    155180class StudentHistoryLink(StudentLink):
    156     grok.order(6)
     181    grok.order(8)
    157182    link = 'history'
    158183    text = u'History'
Note: See TracChangeset for help on using the changeset viewer.