source: WAeUP_SRP/trunk/skins/waeup_academics/academics_view.py @ 331

Last change on this file since 331 was 296, checked in by joachim, 18 years ago

=backoffice enhencements

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1##parameters=REQUEST=None
2# $Id: academics_view.py 296 2006-07-14 13:52:50Z joachim $
3"""
4"""
5request = REQUEST
6rget = request.get
7rset = request.set
8fget = request.form.get
9form = request.form
10fhas = request.form.has_key
11
12
13lt = context.portal_layouts
14pr = context.portal_registration
15pm = context.portal_membership
16items = context.contentValues()
17
18validate = fhas('add') or fhas('change') or fhas('delete')
19res,psm,ds = lt.renderLayout(layout_id='faculty_row',
20                      schema_id= 'faculty_row',
21                      context=context,
22                      mapping= {},#validate and request,
23                      ob={},
24                      layout_mode='edit',
25                      formaction = "academics_view",
26                      items=items,
27                      )
28#return res
29
30if True:# or psm == 'invalid':
31    return context.academics_view_form(rendered = res,
32                                 psm = 'Please correct your errors',
33                                 ds = ds,
34                                 )
35elif psm == '':
36    return context.academics_view_form(rendered = res,
37                                 psm = psm,
38                                 ds = ds,
39                                 )
40inr = 0
41if fhas('add') and (fget('type') or fget('subject') or fget('result')):
42    sr.append((fget('type'),fget('subject'),fget('result')))
43    psm = "new result added"
44elif fhas('change') and fget('keys'):
45    for k in fget('keys'):
46        sr[int(k)] = (fget('type_%s' % k),fget('subject_%s' % k),fget('result_%s' % k))
47        inr += 1
48    psm = "%s items changed" % inr
49elif fhas('delete') and fget('keys'):
50    new = []
51    todelete = fget('keys')
52    for k in range(len(sr)):
53        if str(k) not in todelete:
54            new.append(sr[k])
55    inr = len(todelete)
56    sr = new
57    psm = "%s items deleted" % inr
58elif psm == 'valid':
59    psm = "Your changes have been saved."
60
61res,dummy,fds = lt.renderLayout(layout_id= 'faculty_row',
62                      schema_id= 'faculty_row',
63                      context=context,
64                      mapping=request,
65                      ob={},
66                      layout_mode='create',
67                      formaction = "academics_view",
68                      )
69
70return context.academic_view_form(rendered = res,
71                                 #psm = "%s <br /> %s" % (str(ds),str(lt.faculty_row.getLayoutDefinition()))
72                                 psm = psm,
73                                 )
Note: See TracBrowser for help on using the repository browser.