Changeset 5950 for main/waeup.sirp/trunk/src
- Timestamp:
- 15 Apr 2011, 09:46:16 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r5947 r5950 661 661 >>> ctrl = browser.getControl(name='form.course') 662 662 >>> ctrl.displayOptions 663 ['(no value)', 'COURSE1 Course 1', 'COURSE2Course 2']663 ['(no value)', 'COURSE1 - Course 1', 'COURSE2 - Course 2'] 664 664 665 665 We select the first course and create our certificatecourse: … … 692 692 693 693 >>> browser.open(cert_url + '/COURSE1_100') 694 >>> browser.getLink('Edit c ertificate course').click()694 >>> browser.getLink('Edit course reference').click() 695 695 696 696 Let's set a new level (it was 100 before) and save the form. This will … … 710 710 changed: 711 711 712 >>> browser.getLink('Edit c ertificate course').click()712 >>> browser.getLink('Edit course reference').click() 713 713 >>> browser.getControl(name='form.level').value = "666" 714 714 >>> browser.getControl('Cancel').click() … … 718 718 >>> browser.open(cert_url + '/COURSE1_200') 719 719 >>> print browser.contents 720 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...721 ... Level of this course722 ... 200...720 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 721 ...<td>Level:</td> 722 ...<td>200</td> 723 723 ... 724 724 -
main/waeup.sirp/trunk/src/waeup/sirp/browser/interfaces.py
r5005 r5950 7 7 from waeup.sirp.university.interfaces import ( 8 8 IFacultyContainer, IFaculty, IDepartment, ICourseContainer, ICourse, 9 ICertificateContainer, ICertificate, ICertificateCourse )9 ICertificateContainer, ICertificate, ICertificateCourse, CourseSource) 10 10 11 11 class IBreadcrumb(Interface): … … 55 55 """Get the list of breadcrumbs as real Python list. 56 56 """ 57 58 class ICertificateCourseAdd(ICertificateCourse): 59 """A certificatecourse is a course referenced by a certificate, which 60 provides some own attributes. 61 """ 62 course = schema.Choice( 63 title = u'Course to be referenced', 64 source = CourseSource(), 65 readonly = False, 66 ) 67 68 level = schema.Int( 69 title = u'Level of this course', 70 required = True, 71 default = 100, 72 readonly = False, 73 ) 74 75 core_or_elective = schema.Bool( 76 title = u'Is mandatory course (not elective)', 77 required = True, 78 default = True 79 ) -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5949 r5950 34 34 from waeup.sirp.browser.interfaces import ( 35 35 IUniversity, IFacultyContainer, IFaculty, IDepartment, ICourse, 36 ICertificate, ICertificateCourse )36 ICertificate, ICertificateCourse, ICertificateCourseAdd) 37 37 from waeup.sirp.catalog import search_context 38 38 from waeup.sirp.interfaces import( … … 1183 1183 @property 1184 1184 def title(self): 1185 return " %s (%s)" % (self.context.title, self.context.code)1185 return "Certificate: %s (%s)" % (self.context.title, self.context.code) 1186 1186 1187 1187 def update(self): … … 1236 1236 grok.name('manage') 1237 1237 grok.require('waeup.manageUniversity') 1238 title = u'Edit certificate' 1238 1239 pnav = 1 1239 1240 1240 1241 form_fields = grok.AutoFields(ICertificate) 1241 1242 1242 @property1243 def title(self):1244 # Set certificate name as form label1245 return self.form_fields['title'].field.get(self.context)1243 #@property 1244 #def title(self): 1245 # # Set certificate name as form label 1246 # return self.form_fields['title'].field.get(self.context) 1246 1247 1247 1248 @grok.action('Save') … … 1280 1281 # Certificate course pages... 1281 1282 # 1282 class CertificateCoursePage(WAeUP DisplayFormPage):1283 """C ourse index page.1283 class CertificateCoursePage(WAeUPPage): 1284 """CertificateCourse index page. 1284 1285 """ 1285 1286 grok.context(ICertificateCourse) … … 1291 1292 @property 1292 1293 def title(self): 1293 return self.context.course.title1294 return 'Course Reference: %s' % (self.context.course.code) 1294 1295 1295 1296 class CertificateCourseFormPage(WAeUPEditFormPage): … … 1304 1305 @property 1305 1306 def title(self): 1306 return 'Edit c ertificate course %s' % self.context.course.code1307 return 'Edit course reference' 1307 1308 1308 1309 @grok.action('Save and return') … … 1315 1316 # the key of the entry will change as well... 1316 1317 old_level = self.context.level 1318 data['course'] = self.context.course 1317 1319 parent.addCourseRef(**data) 1318 1320 parent.delCourseRef(data['course'].code, level=old_level) … … 1331 1333 grok.name('addcertificatecourse') 1332 1334 grok.require('waeup.manageUniversity') 1333 form_fields = grok.AutoFields(ICertificateCourse )1334 pnav = 1 1335 title = 'Add course '1336 1337 @grok.action('Add course ')1335 form_fields = grok.AutoFields(ICertificateCourseAdd) 1336 pnav = 1 1337 title = 'Add course reference' 1338 1339 @grok.action('Add course reference') 1338 1340 def addCertcourse(self, **data): 1339 1341 try: 1340 1342 self.context.addCourseRef(**data) 1341 1343 except KeyError: 1342 self.status = Invalid('The chosen course is already part of'1344 self.status = Invalid('The chosen course reference is already part of' 1343 1345 'this certificate') 1344 1346 return 1345 1347 except DuplicationError: 1346 self.status = Invalid('The chosen course is already part of'1348 self.status = Invalid('The chosen course reference is already part of' 1347 1349 'this certificate') 1348 1350 return -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r5942 r5950 344 344 grok.context(ICertificateCourse) 345 345 grok.view(CertificateCoursePage) 346 text = 'Edit c ertificate course'346 text = 'Edit course reference' 347 347 348 348 # -
main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py
r5949 r5950 25 25 26 26 def getTitle(self, value): 27 return "%s %s" % (value.code, value.title[:32])27 return "%s - %s" % (value.code, value.title[:64]) 28 28 29 29 class IFaculty(IWAeUPContainer): … … 190 190 """ 191 191 course = schema.Choice( 192 title = u'Course ',192 title = u'Course referenced', 193 193 source = CourseSource(), 194 readonly = True, 194 195 ) 195 196 … … 197 198 title = u'Level of this course', 198 199 required = True, 199 default = 100 200 default = 100, 201 readonly = False, 200 202 ) 201 203 … … 203 205 title = u'Is mandatory course (not elective)', 204 206 required = True, 205 default = True 207 default = True, 206 208 ) 207 209
Note: See TracChangeset for help on using the changeset viewer.