##parameters=REQUEST=None # $Id: academics_view.py 296 2006-07-14 13:52:50Z joachim $ """ """ request = REQUEST rget = request.get rset = request.set fget = request.form.get form = request.form fhas = request.form.has_key lt = context.portal_layouts pr = context.portal_registration pm = context.portal_membership items = context.contentValues() validate = fhas('add') or fhas('change') or fhas('delete') res,psm,ds = lt.renderLayout(layout_id='faculty_row', schema_id= 'faculty_row', context=context, mapping= {},#validate and request, ob={}, layout_mode='edit', formaction = "academics_view", items=items, ) #return res if True:# or psm == 'invalid': return context.academics_view_form(rendered = res, psm = 'Please correct your errors', ds = ds, ) elif psm == '': return context.academics_view_form(rendered = res, psm = psm, ds = ds, ) inr = 0 if fhas('add') and (fget('type') or fget('subject') or fget('result')): sr.append((fget('type'),fget('subject'),fget('result'))) psm = "new result added" elif fhas('change') and fget('keys'): for k in fget('keys'): sr[int(k)] = (fget('type_%s' % k),fget('subject_%s' % k),fget('result_%s' % k)) inr += 1 psm = "%s items changed" % inr elif fhas('delete') and fget('keys'): new = [] todelete = fget('keys') for k in range(len(sr)): if str(k) not in todelete: new.append(sr[k]) inr = len(todelete) sr = new psm = "%s items deleted" % inr elif psm == 'valid': psm = "Your changes have been saved." res,dummy,fds = lt.renderLayout(layout_id= 'faculty_row', schema_id= 'faculty_row', context=context, mapping=request, ob={}, layout_mode='create', formaction = "academics_view", ) return context.academic_view_form(rendered = res, #psm = "%s
%s" % (str(ds),str(lt.faculty_row.getLayoutDefinition())) psm = psm, )