## Script (Python) "cpsdocument_edit" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $ """ return Info about the current Student """ request = context.REQUEST form = request.form fget = form.get info = {} wf = context.portal_workflow catalog = context.portal_catalog student_wf_states = wf.waeup_student_wf.states.keys() info['wf_states'] = student_wf_states info['wf_states'][0] = " ----- " mtool = context.portal_membership member = mtool.getAuthenticatedMember() path_info = request.get('PATH_INFO').split('/') roles = member.getRoles() info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles student_id = fget('student_id') jamb_id = fget('jamb_id') matric_no = fget('matric_no') name = fget('name') state = fget('state') if state == " ----- ": state = '' onlyreview = state and not (student_id or jamb_id or matric_no or name) items = [] res = [] portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']} if onlyreview: res = catalog(portal_type=portal_type_query, review_state=state) elif student_id: res = catalog(portal_type='Student', id = student_id.strip()) elif jamb_id: res = catalog(portal_type='StudentApplication', SearchableText="%s*" % jamb_id.strip().lower()) elif matric_no: res = catalog(portal_type='StudentClearance', SearchableText="%s*" % matric_no.strip().lower()) elif name: res = catalog(portal_type=portal_type_query, SearchableText="%s*" % name.strip()) if res: for r in res: row = {} if r.portal_type in ("StudentApplication","StudentPersonal"): items.append(r.getObject().aq_parent) else: items.append(r.getObject()) info['state'] = state info['student_id'] = student_id info['jamb_id'] = jamb_id info['matric_no'] = matric_no info['name'] = name info['students'] = items return info