source: WAeUP_SRP/trunk/skins/waeup_academics/create_certificate.py @ 14230

Last change on this file since 14230 was 892, checked in by Henrik Bettermann, 18 years ago

all psm checked and edited

  • Property svn:keywords set to Id
File size: 1.6 KB
RevLine 
[238]1##parameters=REQUEST=None
[486]2# $Id: create_certificate.py 892 2006-11-18 21:14:18Z henrik $
[238]3"""
4Create a Course
5
6"""
[256]7type_name = 'Certificate'
[238]8REQUEST.set('type_name',type_name)
9
10ti = context.portal_types[type_name]
11pr = context.portal_registration
12pm = context.portal_membership
13
14validate = REQUEST.has_key("cpsdocument_create_button")
15
16lt = context.portal_layouts
17
[256]18res,psm,ds = lt.renderLayout(layout_id= 'certificate',
19                      schema_id = 'certificate',
[238]20                      context=context,
21                      mapping=validate and REQUEST,
22                      ob={},
23                      layout_mode='create',
[256]24                      create_action = 'create_certificate',
[238]25                      )
26if  psm == 'invalid':
27    return context.common_edit_form(rendered = res,
28                                 create = 1,
29                                 type_name = type_name,
[892]30                                 psm = 'Please correct your errors!',
[238]31                                 )
32elif psm == '':
33    return context.common_edit_form(rendered = res,
34                                 create = 1,
35                                 type_name = type_name,
36                                 psm = psm,
37                                 )
[892]38
[238]39elif psm == 'valid':
40    oid = "%s" % ds.get('code').replace(' ','')
[892]41    context.invokeFactory(type_name,oid)
[238]42    object = getattr(context,oid)
43    ds.set('Title',ds.get('heading'))
44    object.getContent().edit(mapping=ds,proxy=object)
45    context.notifyCPSDocumentCreation(ob=object)
[892]46    psm = 'new %s created!' % oid
47    context_ti = context.portal_types[context.portal_type]
[238]48    index = context_ti.getActionById('view','university_view')
49    return getattr(context,index)(psm=psm)
50
Note: See TracBrowser for help on using the repository browser.