Ignore:
Timestamp:
5 Apr 2013, 11:32:22 (12 years ago)
Author:
Henrik Bettermann
Message:

Add browser components to facilitate transfer reversion.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
1 added
3 edited

Legend:

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

    r10039 r10060  
    10721072        return
    10731073
     1074class RevertTransferFormPage(KofaEditFormPage):
     1075    """View that reverts the previous transfer.
     1076    """
     1077    grok.context(IStudent)
     1078    grok.name('revert_transfer')
     1079    grok.require('waeup.manageStudent')
     1080    grok.template('reverttransfer')
     1081    label = _('Revert previous transfer')
     1082
     1083    def update(self):
     1084        warning.need()
     1085        if not self.context.has_key('studycourse_1'):
     1086            self.flash(_('No previous transfer.'))
     1087            self.redirect(self.url(self.context))
     1088            return
     1089        return
     1090
     1091    @jsaction(_('Revert now'))
     1092    def transferStudent(self, **data):
     1093        self.context.revert_transfer()
     1094        self.flash(_('Previous transfer reverted.'))
     1095        self.redirect(self.url(self.context, 'studycourse'))
     1096        return
     1097
    10741098class StudyLevelDisplayFormPage(KofaDisplayFormPage):
    10751099    """ Page to display student study levels
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10030 r10060  
    17501750        self.assertTrue('The requested form is locked' in self.browser.contents)
    17511751
     1752        # Revert transfer
     1753        self.browser.open(self.student_path + '/studycourse_1')
     1754        self.browser.getLink("Reactivate").click()
     1755        self.browser.getControl("Revert now").click()
     1756        self.assertTrue('Previous transfer reverted' in self.browser.contents)
     1757        results = list(
     1758            cat.searchResults(
     1759            certcode=('CERT1', 'CERT1')))
     1760        self.assertTrue(results[0] is self.student)
     1761        self.assertEqual([i for i in self.student.keys()],
     1762            [u'accommodation', u'payments', u'studycourse'])
     1763
    17521764    def test_login_as_student(self):
    17531765        # StudentImpersonators can login as student
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r10021 r10060  
    344344        return False
    345345
     346class RevertTransferActionButton(ManageActionButton):
     347    grok.order(1)
     348    grok.context(IStudentStudyCourse)
     349    grok.view(StudyCourseDisplayFormPage)
     350    grok.require('waeup.manageStudent')
     351    icon = 'actionicon_undo.png'
     352    text = _('Reactivate this study course (revert previous transfer)')
     353    target = 'revert_transfer'
     354
     355    @property
     356    def target_url(self):
     357        if self.context.is_previous:
     358            return self.view.url(self.view.context.__parent__, self.target)
     359        return False
     360
    346361class StudyLevelManageActionButton(ManageActionButton):
    347362    grok.order(1)
Note: See TracChangeset for help on using the changeset viewer.