Changeset 13610


Ignore:
Timestamp:
13 Jan 2016, 20:59:17 (9 years ago)
Author:
Henrik Bettermann
Message:

Add button and view which allow students to unregister their
current course list unless the courses have not been validated.

Location:
main/waeup.kofa/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r13603 r13610  
    441.4.dev0 (unreleased)
    55=====================
     6
     7* Add button and view which allow students to unregister their
     8  current course list unless the courses have not been validated.
    69
    710* Configure transfer payments and let students enter their desired
  • main/waeup.kofa/trunk/docs/source/userdocs/students/workflow.rst

    r13484 r13610  
    6565    -f: reset5 (= annul payment)
    6666     g: register_courses
    67     -g: reset7 (= reject request)
     67    -g: reset7 (= unregister)
    6868     h: pay_pg_fee, approve_pg_fee
    6969    -h: N/A
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r13574 r13610  
    15131513            return
    15141514        if str(self.context.__parent__.current_level) != self.context.__name__:
    1515             self.flash(_('This level does not correspond current level.'),
     1515            self.flash(_('This is not the student\'s current level.'),
    15161516                       type="danger")
    15171517        elif self.context.student.state == REGISTERED:
     
    15391539            return
    15401540        if str(self.context.__parent__.current_level) != self.context.__name__:
    1541             self.flash(_('This level does not correspond current level.'),
     1541            self.flash(_('This is not the student\'s current level.'),
    15421542                       type="danger")
    15431543            self.redirect(self.url(self.context))
     
    15491549        elif self.context.student.state == REGISTERED:
    15501550            IWorkflowInfo(self.context.student).fireTransition('reset7')
    1551             message = _('Course list request has been rejected.')
     1551            message = _('Course list has been unregistered.')
    15521552            self.flash(message)
    15531553        else:
     
    15581558        self.redirect(self.url(self.context.student) +
    15591559            '/contactstudent?%s' % urlencode(args))
     1560        return
     1561
     1562    def render(self):
     1563        return
     1564
     1565class UnregisterCoursesView(UtilityView, grok.View):
     1566    """Unegister course list by student
     1567    """
     1568    grok.context(IStudentStudyLevel)
     1569    grok.name('unregister_courses')
     1570    grok.require('waeup.handleStudent')
     1571
     1572    def update(self):
     1573        if not self.context.__parent__.is_current:
     1574            emit_lock_message(self)
     1575            return
     1576        elif not self.context.course_registration_allowed:
     1577            self.flash(_(
     1578                "Course registration has ended. "
     1579                "Unregistration is disabled."), type="warning")
     1580        elif str(self.context.__parent__.current_level) != self.context.__name__:
     1581            self.flash(_('This is not your current level.'), type="danger")
     1582        elif self.context.student.state == REGISTERED:
     1583            IWorkflowInfo(self.context.student).fireTransition('reset7')
     1584            message = _('Course list has been unregistered.')
     1585            self.flash(message)
     1586        else:
     1587            self.flash(_('You are in the wrong state.'), type="warning")
     1588        self.redirect(self.url(self.context))
    15601589        return
    15611590
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13574 r13610  
    17481748        self.browser.open(L110_student_path)
    17491749        self.browser.getLink("Reject courses").click()
    1750         self.assertTrue('Course list request has been rejected'
     1750        self.assertTrue('Course list has been unregistered'
    17511751            in self.browser.contents)
    17521752        self.assertTrue('school fee paid' in self.browser.contents)
     
    26272627        self.assertTrue('Course list has been registered' in self.browser.contents)
    26282628        self.assertEqual(self.student.state, 'courses registered')
     2629        # Course list can be unregistered
     2630        self.browser.getLink("Unregister courses").click()
     2631        self.assertEqual(self.student.state, 'school fee paid')
     2632        self.assertTrue('Course list has been unregistered' in self.browser.contents)
     2633        self.browser.open(self.student_path + '/studycourse/200/unregister_courses')
     2634        self.assertTrue('You are in the wrong state' in self.browser.contents)
    26292635        # Students can view the transcript
    26302636        #self.browser.open(self.studycourse_path)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r13457 r13610  
    439439        return self.view.url(self.view.context, self.target)
    440440
     441class StudentUnregisterCoursesActionButton(ManageActionButton):
     442    grok.order(5)
     443    grok.context(IStudentStudyLevel)
     444    grok.view(StudyLevelDisplayFormPage)
     445    grok.require('waeup.handleStudent')
     446    text = _('Unregister courses')
     447    target = 'unregister_courses'
     448    icon = 'actionicon_reject.png'
     449
     450    @property
     451    def target_url(self):
     452        is_current = self.context.__parent__.is_current
     453        if self.context.student.state != REGISTERED or \
     454            str(self.context.__parent__.current_level) != self.context.__name__ or\
     455            not is_current:
     456            return ''
     457        return self.view.url(self.view.context, self.target)
     458
    441459class CourseRegistrationSlipActionButton(ManageActionButton):
    442     grok.order(5)
     460    grok.order(6)
    443461    grok.context(IStudentStudyLevel)
    444462    grok.view(StudyLevelDisplayFormPage)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/workflow.py

    r13103 r13610  
    151151    Transition(
    152152        transition_id = 'reset7',
    153         title = _('Reset to school fee paid'),
    154         msg = _("Reset to 'school fee paid'"),
     153        title = _('Unregister courses'),
     154        msg = _("Courses unregistered"),
    155155        source = REGISTERED,
    156156        destination = PAID),
Note: See TracChangeset for help on using the changeset viewer.