- Timestamp:
- 19 Sep 2011, 08:39:58 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6794 r6795 35 35 IStudentPersonal, IStudentBase, IStudentStudyCourse, IStudentPayments, 36 36 IStudentAccommodation, IStudentClearanceEdit, IStudentStudyLevel, 37 ICourseTicket, ICourseTicketAdd, 37 38 ) 38 39 from waeup.sirp.students.catalog import search 39 40 from waeup.sirp.students.workflow import CLEARANCE 40 from waeup.sirp.students.studylevel import StudentStudyLevel 41 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket 41 42 from waeup.sirp.students.vocabularies import StudyLevelSource 42 43 … … 592 593 pnav = 4 593 594 taboneactions = ['Save','Cancel'] 594 tabtwoactions = ['Remove selected tickets','Cancel'] 595 tabthreeactions = ['Add course ticket'] 595 tabtwoactions = ['Add course ticket','Remove selected tickets','Cancel'] 596 596 597 597 def update(self): … … 615 615 616 616 @grok.action('Add course ticket') 617 def addStudyLevel(self, **data): 618 # We need a ticket catalog 619 return 620 621 #course_code = self.request.form.get('addticket', None) 622 #try: 623 # self.context.addCourseTicket( 624 # self.context.certificate,studylevel) 625 #except KeyError: 626 # self.flash('This ticket exists.') 627 #self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 628 #return 617 def addCourseTicket(self, **data): 618 self.redirect(self.url(self.context, '@@add')) 629 619 630 620 @grok.action('Remove selected tickets') … … 651 641 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 652 642 return 643 644 class CourseTicketAddFormPage(WAeUPAddFormPage): 645 """Add a department to a faculty. 646 """ 647 grok.context(IStudentStudyLevel) 648 grok.name('add') 649 grok.require('waeup.manageStudents') 650 label = 'Add course ticket' 651 form_fields = grok.AutoFields(ICourseTicketAdd).omit('grade', 'score') 652 pnav = 4 653 654 @property 655 def title(self): 656 return 'Study Level %s' % self.context.level_title 657 658 @grok.action('Add course ticket') 659 def addCourseTicket(self, **data): 660 ticket = CourseTicket() 661 #import pdb; pdb.set_trace() 662 course = data['course'] 663 ticket.core_or_elective = data['core_or_elective'] 664 ticket.level = self.context.level 665 ticket.code = course.code 666 ticket.title = course.title 667 ticket.faculty = course.__parent__.__parent__.__parent__.title 668 ticket.department = course.__parent__.__parent__.title 669 ticket.credits = course.credits 670 ticket.passmark = course.passmark 671 ticket.semester = course.semester 672 try: 673 self.context.addCourseTicket(ticket) 674 except KeyError: 675 self.flash('The ticket exists.') 676 return 677 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 678 return 679 680 @grok.action('Cancel') 681 def cancel(self, **data): 682 self.redirect(self.url(self.context)) 653 683 654 684 class PaymentsDisplayFormPage(WAeUPDisplayFormPage): -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studylevelmanagepage.pt
r6794 r6795 100 100 </div> 101 101 102 <br /><br /><br />103 104 <div>105 <span class="actionButtons" tal:condition="view/availableActions">106 <span tal:repeat="action view/actions"107 tal:omit-tag="">108 <input tal:condition="python:action.label in view.tabthreeactions"109 tal:replace="structure action/render"/>110 </span>111 </span>112 113 </div>114 115 102 </div> 116 103 </div> -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6793 r6795 6 6 from waeup.sirp.interfaces import IWAeUPObject 7 7 from waeup.sirp.schema import TextLineChoice 8 from waeup.sirp.university.vocabularies import CourseSource 8 9 from waeup.sirp.students.vocabularies import ( 9 10 CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource, … … 225 226 required = False, 226 227 ) 227 228 228 229 229 class ICourseTicket(IWAeUPObject): … … 238 238 faculty = Attribute('faculty of the original course') 239 239 department = Attribute('department of the original course') 240 core_or_elective = Attribute('core_or_elective of the original course referrer')241 240 level = Attribute('level of the original course referrer') 241 242 core_or_elective = schema.Bool( 243 title = u'Mandatory', 244 default = False, 245 required = False, 246 readonly = False, 247 ) 242 248 243 249 score = schema.Int( … … 255 261 ) 256 262 263 class ICourseTicketAdd(ICourseTicket): 264 """An interface for adding course tickets 265 266 """ 267 course = schema.Choice( 268 title = u'Course', 269 source = CourseSource(), 270 readonly = False, 271 ) 272 257 273 class IStudentAccommodation(IWAeUPObject): 258 274 """A container for student accommodation objects. -
main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py
r6791 r6795 51 51 if val.level != studylevel.level: 52 52 continue 53 ticket = CourseTicket( 54 val.getCourseCode(),55 val.course.title,56 val.course.credits,57 val.course.passmark,58 val.course.semester,59 val.course.__parent__.__parent__.__parent__.title,60 val.course.__parent__.__parent__.title,61 val.level,62 val.core_or_elective)53 ticket = CourseTicket() 54 ticket.code = val.getCourseCode() 55 ticket.level = val.level 56 ticket.core_or_elective = val.core_or_elective 57 ticket.title = val.course.title 58 ticket.faculty = val.course.__parent__.__parent__.__parent__.title 59 ticket.department = val.course.__parent__.__parent__.title 60 ticket.credits = val.course.credits 61 ticket.passmark = val.course.passmark 62 ticket.semester = val.course.semester 63 63 self[str(studylevel.level)][val.getCourseCode()] = ticket 64 64 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/studylevel.py
r6783 r6795 35 35 super(StudentStudyLevel, self).__init__() 36 36 self.level = None 37 self.validation_date = None 38 self.validated_by = None 37 39 return 38 40 … … 69 71 grok.provides(ICourseTicket) 70 72 71 def __init__(self, code, title, credits, 72 passmark, semester, faculty, department, level, core_or_elective): 73 73 def __init__(self): 74 74 super(CourseTicket, self).__init__() 75 self.title = title 76 self.code = code 77 self.faculty = faculty 78 self.department = department 79 self.level = level 80 self.credits = credits 81 self.passmark = passmark 82 self.semester = semester 83 self.core_or_elective = core_or_elective 75 self.code = None 76 self.level = None 77 self.title = None 78 self.faculty = None 79 self.department = None 80 self.credits = None 81 self.passmark = None 82 self.semester = None 84 83 return 85 84 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py
r6783 r6795 37 37 self.studycourse = StudentStudyCourse() 38 38 self.studylevel = StudentStudyLevel() 39 self.courseticket = CourseTicket('CERT', 'Title', 100, 10, 40, 1, 40 'Faculty', 'Department', True) 39 self.courseticket = CourseTicket() 41 40 self.payments = StudentPayments() 42 41 self.accommodation = StudentAccommodation()
Note: See TracChangeset for help on using the changeset viewer.