Changeset 7304 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 7 Dec 2011, 08:53:50 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7277 r7304 825 825 return students_utils.renderPDF( 826 826 self,'Course Registration', 'course_registration.pdf', 827 self.context.getStudent, studentview) 827 self.context.getStudent, studentview, 828 tableheader=[('Code','code'), ('Title','title'), 829 ('Department','dcode'), ('Faculty','fcode'), 830 ('Credits', 'credits'), 831 ('Mandatory', 'core_or_elective'), 832 ('Score', 'score'),('Auto', 'automatic') 833 ], 834 tabledata=self.context.values()) 828 835 829 836 class StudyLevelManageActionButton(ManageActionButton): … … 919 926 ticket.faculty = course.__parent__.__parent__.__parent__.title 920 927 ticket.department = course.__parent__.__parent__.title 928 ticket.fcode = course.__parent__.__parent__.__parent__.code 929 ticket.dcode = course.__parent__.__parent__.code 921 930 ticket.credits = course.credits 922 931 ticket.passmark = course.passmark -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7256 r7304 328 328 faculty = Attribute('faculty of the original course') 329 329 department = Attribute('department of the original course') 330 fcode = Attribute('faculty code of the original course') 331 dcode = Attribute('department code of the original course') 330 332 331 333 core_or_elective = schema.Bool( -
main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py
r7256 r7304 60 60 ticket.faculty = val.course.__parent__.__parent__.__parent__.title 61 61 ticket.department = val.course.__parent__.__parent__.title 62 ticket.fcode = val.course.__parent__.__parent__.__parent__.code 63 ticket.dcode = val.course.__parent__.__parent__.code 62 64 ticket.credits = val.course.credits 63 65 ticket.passmark = val.course.passmark -
main/waeup.sirp/trunk/src/waeup/sirp/students/studylevel.py
r7256 r7304 77 77 self.faculty = None 78 78 self.department = None 79 self.fcode = None 80 self.dcode = None 79 81 self.credits = None 80 82 self.passmark = None -
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r7280 r7304 37 37 ) 38 38 39 CONTENT_STYLE = TableStyle( 40 [('VALIGN',(0,0),(-1,-1),'TOP')] 41 ) 42 39 43 def generate_student_id(students,letter): 40 44 if letter == '?': … … 67 71 img = getUtility(IExtFileStore).getFileByContext( 68 72 studentview.context, attr='passport.jpg') 69 #import pdb; pdb.set_trace()70 73 if img is None: 71 74 from waeup.sirp.browser import DEFAULT_PASSPORT_IMAGE_PATH … … 77 80 if widget.name == 'form.adm_code': 78 81 continue 79 f_label = '<font size=12>%s</font>:' % widget.label.strip() 82 f_label = '<font size=12>%s</font>:' % ( 83 widget.label.strip()) 80 84 f_label = Paragraph(f_label, style["Normal"]) 81 85 f_text = '<font size=12>%s</font>' % widget() … … 83 87 data.append([f_label,f_text]) 84 88 table = Table(data,style=SLIP_STYLE) 89 return table 90 91 def render_table_data(tableheader,tabledata): 92 data = [] 93 data.append([Spacer(1, 12)]) 94 line = [] 95 style = getSampleStyleSheet() 96 for element in tableheader: 97 field = '<strong><font size=10>%s</font></strong>' % element[0] 98 field = Paragraph(field, style["BodyText"]) 99 line.append(field) 100 data.append(line) 101 for ticket in tabledata: 102 line = [] 103 for element in tableheader: 104 fieldcontent = getattr(ticket,element[1],u' ') 105 field = '<font size=10>%s</font>' % fieldcontent 106 field = Paragraph(field, style["BodyText"]) 107 line.append(field) 108 data.append(line) 109 # ToDo: The table does not show up if there are too many line 110 # and it thus doesn't fit on the page 111 table = Table(data,splitByRow=True,style=CONTENT_STYLE) 85 112 return table 86 113 … … 147 174 148 175 def renderPDF(self, view, subject='', filename='slip.pdf', 149 student=None, studentview=None ):176 student=None, studentview=None, tableheader=None, tabledata=None): 150 177 # (0,0),(-1,-1) = whole table 151 178 # (0,0),(0,-1) = first column … … 173 200 frame_body = Frame(1*cm,1*cm,width-(2*cm),height-(3.5*cm)) 174 201 story.append(Paragraph(view.label, style["Heading2"])) 175 #story.append(HRFlowable()) 202 203 # Insert student data table 176 204 if student: 177 205 story.append(Spacer(1, 12)) 178 206 studenttable = render_student_data(student, studentview) 179 207 story.append(studenttable) 208 180 209 story.append(Spacer(1, 12)) 181 210 set_up_widgets(view) … … 218 247 view.flash('Error in image file.') 219 248 return view.redirect(view.url(view.context)) 249 250 # Insert content table 251 if tabledata and tableheader: 252 story = [] 253 story.append(Spacer(1, 12)) 254 contenttable = render_table_data(tableheader,tabledata) 255 story.append(contenttable) 256 #import pdb; pdb.set_trace() 257 frame_body.addFromList(story,pdf) 258 220 259 story = [] 221 260 frame_footer = Frame(1*cm,0,width-(2*cm),1*cm)
Note: See TracChangeset for help on using the changeset viewer.