Changeset 9924 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 30 Jan 2013, 08:58:37 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9906 r9924 158 158 view.flash(_('Successfully added ${a}.', 159 159 mapping = {'a':ticket.code})) 160 view.context.writeLogMessage( 161 view,'added: %s|%s|%s' % ( 162 ticket.code, ticket.getLevel(), ticket.getLevelSession())) 160 163 return True 161 164 … … 1257 1260 mapping = {'a':', '.join(deleted)})) 1258 1261 self.context.writeLogMessage( 1259 self,'removed: %s' % ', '.join(deleted)) 1262 self,'removed: %s at %s' % 1263 (', '.join(deleted), self.context.level)) 1260 1264 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 1261 1265 return … … 2317 2321 grok.context(IStudentStudyLevel) 2318 2322 grok.name('edit') 2319 grok.require('waeup. handleStudent')2323 grok.require('waeup.editStudyLevel') 2320 2324 grok.template('studyleveleditpage') 2321 2325 form_fields = grok.AutoFields(IStudentStudyLevel).omit( … … 2381 2385 mapping = {'a':', '.join(deleted)})) 2382 2386 self.context.writeLogMessage( 2383 self,'removed: %s' % ', '.join(deleted)) 2387 self,'removed: %s at %s' % 2388 (', '.join(deleted), self.context.level)) 2384 2389 self.redirect(self.url(self.context, u'@@edit')) 2385 2390 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/permissions.py
r9335 r9924 56 56 grok.name('waeup.validateStudent') 57 57 58 class EditStudyLevel(grok.Permission): 59 grok.name('waeup.editStudyLevel') 60 58 61 class TriggerTransition(grok.Permission): 59 62 grok.name('waeup.triggerTransition') … … 68 71 grok.permissions('waeup.handleStudent', 'waeup.uploadStudentFile', 69 72 'waeup.viewStudent', 'waeup.payStudent', 70 'waeup.handleAccommodation' )73 'waeup.handleAccommodation', 'waeup.editStudyLevel') 71 74 72 75 # Site Roles … … 98 101 grok.name('waeup.StudentsCourseAdviser') 99 102 grok.title(u'Course Adviser (all students)') 100 grok.permissions('waeup.validateStudent','waeup.viewStudent') 103 grok.permissions('waeup.validateStudent','waeup.viewStudent', 104 'waeup.editStudyLevel') 101 105 102 106 class StudentImpersonator(grok.Role): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9922 r9924 750 750 logcontent = open(logfile).read() 751 751 self.assertTrue('zope.mgr - students.browser.StudyLevelManageFormPage ' 752 '- K1000000 - removed: COURSE1 ' in logcontent)752 '- K1000000 - removed: COURSE1 at 100' in logcontent) 753 753 self.browser.getLink("here").click() 754 754 self.browser.getControl(name="form.course").value = ['COURSE1'] … … 1422 1422 cert,studylevel) 1423 1423 L110_student_path = self.studycourse_path + '/110' 1424 # Only in state courses registered and only if the current level 1425 # corresponds with the name of the study level object 1426 # the 100L CA does see the 'Validate' button 1424 # The CA can neither see the Validate nor the Edit button 1427 1425 self.browser.open(L110_student_path) 1428 1426 self.assertFalse('Validate courses' in self.browser.contents) 1427 self.assertFalse('Edit' in self.browser.contents) 1429 1428 IWorkflowInfo(self.student).fireTransition('register_courses') 1430 1429 self.browser.open(L110_student_path) 1431 1430 self.assertFalse('Validate courses' in self.browser.contents) 1431 self.assertFalse('Edit' in self.browser.contents) 1432 # Only in state courses registered and only if the current level 1433 # corresponds with the name of the study level object 1434 # the 100L CA does see the 'Validate' button but not 1435 # the edit button 1432 1436 self.student['studycourse'].current_level = 110 1433 1437 self.browser.open(L110_student_path) 1438 self.assertFalse('Edit' in self.browser.contents) 1434 1439 self.assertTrue('Validate courses' in self.browser.contents) 1435 # ... but a 100L CA does not see the button onother levels1440 # But a 100L CA does not see the button at other levels 1436 1441 studylevel2 = StudentStudyLevel() 1437 1442 studylevel2.level = 200 … … 1440 1445 L200_student_path = self.studycourse_path + '/200' 1441 1446 self.browser.open(L200_student_path) 1447 self.assertFalse('Edit' in self.browser.contents) 1442 1448 self.assertFalse('Validate courses' in self.browser.contents) 1443 1449 self.browser.open(L110_student_path) … … 1471 1477 self.browser.getControl("Send message now").click() 1472 1478 self.assertTrue('Your message has been sent' in self.browser.contents) 1479 # The CA does now see the Edit button and can edit 1480 # current study level 1481 self.browser.open(L110_student_path) 1482 self.browser.getLink("Edit").click() 1483 self.assertTrue('Edit course list of 100 (Year 1) on 1st probation' 1484 in self.browser.contents) 1473 1485 # The CA can't validate courses if not in state 1474 1486 # courses registered … … 2069 2081 self.browser.getControl("Register course list").click() 2070 2082 self.assertTrue('Maximum credits of 50 exceeded' in self.browser.contents) 2071 # Student can now remove the ticket ...2083 # Student can now remove the ticket 2072 2084 ctrl = self.browser.getControl(name='val_id') 2073 2085 ctrl.getControl(value='COURSE1').selected = True 2074 2086 self.browser.getControl("Remove selected", index=0).click() 2075 2087 self.assertTrue('Successfully removed' in self.browser.contents) 2076 # ... and add the same ticket using the edit page directly. 2088 # Removing course tickets is properly logged 2089 logfile = os.path.join( 2090 self.app['datacenter'].storage, 'logs', 'students.log') 2091 logcontent = open(logfile).read() 2092 self.assertTrue('K1000000 - students.browser.StudyLevelEditFormPage ' 2093 '- K1000000 - removed: COURSE1 at 200' in logcontent) 2094 # They can add the same ticket using the edit page directly. 2077 2095 # We can do the same by adding the course on the manage page directly 2078 2096 self.browser.getControl(name="course").value = 'COURSE1' 2079 2097 self.browser.getControl("Add course ticket").click() 2098 # Adding course tickets is logged 2099 logfile = os.path.join( 2100 self.app['datacenter'].storage, 'logs', 'students.log') 2101 logcontent = open(logfile).read() 2102 self.assertTrue('K1000000 - students.browser.StudyLevelEditFormPage - ' 2103 'K1000000 - added: COURSE1|200|2004' in logcontent) 2080 2104 # Course list can be registered 2081 2105 self.browser.getControl("Register course list").click() -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r9865 r9924 583 583 grok.context(IStudentStudyLevel) 584 584 grok.view(StudyLevelDisplayFormPage) 585 grok.require('waeup. handleStudent')585 grok.require('waeup.editStudyLevel') 586 586 text = _('Edit course list') 587 587 target = 'edit'
Note: See TracChangeset for help on using the changeset viewer.