source: waeup_product/trunk/skins/waeup_student/eligibility.py @ 179

Last change on this file since 179 was 179, checked in by joachim, 19 years ago

=post-primary results adding

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1##parameters=REQUEST=None
2# $Id: eligibility.py 179 2005-11-16 16:44:13Z joachim $
3"""
4process the Admission Form
5return html renderer + psm
6"""
7request = REQUEST
8rget = request.get
9rset = request.set
10fget = request.form.get
11fhas = request.form.has_key
12
13
14lt = context.portal_layouts
15pr = context.portal_registration
16pm = context.portal_membership
17eli = context.ELIGIBILITY.getContent()
18sr = eli.schoolresults
19
20res,psm,ds = lt.renderLayout(layout_id= 'student_schoolresults',
21                      schema_id= 'student_eligibility',
22                      context=context,
23                      mapping=request,
24                      ob={},
25                      layout_mode='create',
26                      formaction = "eligibility",
27                      schoolresults = sr,
28                      )
29
30inr = 0
31if fhas('add') and (fget('type') or fget('subject') or fget('result')):
32    sr.append((fget('type'),fget('subject'),fget('result')))
33    psm = "new result added"
34elif fhas('change') and fget('keys'):
35    for k in fget('keys'):
36        sr[int(k)] = (fget('type_%s' % k),fget('subject_%s' % k),fget('result_%s' % k))
37        inr += 1
38    psm = "%s items changed" % inr
39elif fhas('delete') and fget('keys'):
40    new = []
41    todelete = fget('keys')
42    for k in range(len(sr)):
43        if str(k) not in todelete:
44            new.append(sr[k])
45    inr = len(todelete)
46    sr = new
47    psm = "%s items deleted" % inr
48else:
49    psm = ''
50eli.edit(mapping={'schoolresults': sr})
51res,dummy,ds = lt.renderLayout(layout_id= 'student_schoolresults',
52                      schema_id= 'student_eligibility',
53                      context=context,
54                      mapping=request,
55                      ob={},
56                      layout_mode='create',
57                      formaction = "eligibility",
58                      schoolresults = sr,
59                      )
60
61return context.eligibility_form(rendered = res,
62                                 #psm = str(ds),
63                                 psm = psm,
64                                 )
65##elif psm == '':
66##    return context.eligibility_form(rendered = res,
67##                                 psm = None,
68##                                 ds = ds,
69##                                 )
70##elif psm == 'valid':
71##    s_personal = context.PERSONAL.getContent()
72##    s_personal.edit(mapping={'email': ds.get('email')})
73##    #pw = REQUEST.get("widget__pw")
74##    #pm.setPassword(pw)
75##psm = 'Email has been successfully set.'
76##return context.REQUEST.RESPONSE.redirect('%s' % context.portal_url.getUrlFromRpath('/students'))
77##
78####return context.eligibility_form(rendered = res,
79####                                 psm = psm,
80####                                 ds = ds,
81####                                 )
Note: See TracBrowser for help on using the repository browser.