Changeset 6007 for main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
- Timestamp:
- 2 May 2011, 07:22:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6006 r6007 1344 1344 return "Certificate: %s (%s)" % (self.context.title, self.context.code) 1345 1345 1346 def update(self):1347 if 'delcourse' in self.request.form:1348 code = self.request.form['code']1349 level = self.request.form['level']1350 self.context.delCourseRef(code, level=level)1351 return1346 #def update(self): 1347 # if 'delcourse' in self.request.form: 1348 # code = self.request.form['code'] 1349 # level = self.request.form['level'] 1350 # self.context.delCourseRef(code, level=level) 1351 # return 1352 1352 1353 1353 def getCourseList(self): … … 1398 1398 1399 1399 class CertificateManageFormPage(WAeUPEditFormPage): 1400 """Manage the basicproperties of a `Certificate` instance.1400 """Manage the properties of a `Certificate` instance. 1401 1401 """ 1402 1402 grok.context(ICertificate) … … 1408 1408 form_fields = grok.AutoFields(ICertificate) 1409 1409 1410 pnav = 1 1411 grok.template('certificatemanagepage') 1412 taboneactions = ['Save','Cancel'] 1413 tabtwoactions = ['Add course referrer', 'Remove selected course referrers','Cancel'] 1414 1415 @property 1416 def label(self): 1417 return 'Manage certificate' 1418 1410 1419 @property 1411 1420 def title(self): 1412 return "Certificate: %s (%s)" % (self.context.title, self.context.code) 1413 1414 #@property 1415 #def title(self): 1416 # # Set certificate name as form label 1417 # return self.form_fields['title'].field.get(self.context) 1418 1421 return "Certificate: %s (%s)" % (self.context.title, self.context.code) 1422 1423 def update(self): 1424 tabs.need() 1425 #warning.need() 1426 return super(CertificateManageFormPage, self).update() 1427 1428 form_fields = grok.AutoFields(ICertificate) 1429 1419 1430 @grok.action('Save') 1420 1431 def save(self, **data): 1421 1432 self.applyData(self.context, **data) 1422 1423 #try: 1424 # self.applyData(self.context, **data) 1425 #except NoTransitionAvailableError: 1426 # self.status = Invalid('Review state cannot be changed to ' 1427 # 'requested state: no such transition ' 1428 # 'available in workflow.') 1429 #return 1430 1431 @grok.action('Save and return') 1432 def saveAndReturn(self, **data): 1433 self.applyData(self.context, **data) 1434 1435 #try: 1436 # self.applyData(self.context, **data) 1437 #except NoTransitionAvailableError: 1438 # self.status = Invalid('Review state cannot be changed to ' 1439 # 'requested state: no such transition ' 1440 # 'available in workflow.') 1441 # return 1442 1443 self.redirect(self.url(self.context)) 1444 return 1445 1433 return 1434 1435 # ToDo: Show warning message before deletion 1436 @grok.action('Remove selected course referrers') 1437 def delCertificateCourses(self, **data): 1438 form = self.request.form 1439 child_id = form['val_id'] 1440 if not isinstance(child_id, list): 1441 child_id = [child_id] 1442 deleted = [] 1443 for id in child_id: 1444 try: 1445 del self.context[id] 1446 deleted.append(id) 1447 except: 1448 self.flash('Could not delete %s: %s: %s' % ( 1449 id, sys.exc_info()[0], sys.exc_info()[1])) 1450 if len(deleted): 1451 self.flash('Successfully removed: %s' % ', '.join(deleted)) 1452 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 1453 return 1454 1455 1456 @grok.action('Add course referrer', validator=NullValidator) 1457 def addCertificateCourse(self, **data): 1458 self.redirect(self.url(self.context, 'addcertificatecourse')) 1459 return 1460 1446 1461 @grok.action('Cancel', validator=NullValidator) 1447 1462 def cancel(self, **data): 1448 1463 self.redirect(self.url(self.context)) 1449 1464 return 1450 1465 1466 1451 1467 class CertificateCourseAddFormPage(WAeUPAddFormPage): 1452 1468 """Add-page to add a course ref to a certificate … … 1475 1491 'this certificate') 1476 1492 return 1477 self.redirect(self.url(self.context ))1493 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 1478 1494 1479 1495 @grok.action('Cancel', validator=NullValidator)
Note: See TracChangeset for help on using the changeset viewer.