[535] | 1 | ## Script (Python) "cpsdocument_edit" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=student=None |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $ |
---|
| 11 | """ |
---|
| 12 | return Info about the current Student |
---|
| 13 | """ |
---|
| 14 | request = context.REQUEST |
---|
[563] | 15 | form = request.form |
---|
| 16 | fget = form.get |
---|
[535] | 17 | wf = context.portal_workflow |
---|
| 18 | mtool = context.portal_membership |
---|
| 19 | member = mtool.getAuthenticatedMember() |
---|
| 20 | path_info = request.get('PATH_INFO').split('/') |
---|
[563] | 21 | roles = member.getRoles() |
---|
[535] | 22 | info = {} |
---|
[603] | 23 | info['is_manager'] = context.isManager |
---|
[535] | 24 | member_id = str(member) |
---|
[639] | 25 | res = context.portal_catalog(portal_type='Student',id=member_id) |
---|
| 26 | if not res: |
---|
| 27 | return None |
---|
| 28 | brain = res[0] |
---|
| 29 | student = brain.getObject() |
---|
| 30 | student_path = brain.getPath() |
---|
| 31 | ##if student is None: |
---|
| 32 | ## students = getattr(context,'students',None) |
---|
| 33 | ## if students is None: |
---|
| 34 | ## students = getattr(context.campus,'students',None) |
---|
| 35 | ## student = getattr(students,member_id,None) |
---|
| 36 | ## if student is None: |
---|
| 37 | ## return None |
---|
[535] | 38 | info['review_state'] = wf.getInfoFor(student,'review_state','keiner') |
---|
| 39 | #info['wf_state'] = 'keiner' |
---|
| 40 | info['student'] = student |
---|
[584] | 41 | info['id'] = student.getId() |
---|
[538] | 42 | info['student_doc'] = student.getContent() |
---|
[535] | 43 | info['app'] = student.application |
---|
| 44 | info['app_doc'] = student.application.getContent() |
---|
| 45 | info['per'] = student.personal |
---|
| 46 | info['per_doc'] = student.personal.getContent() |
---|
[635] | 47 | info['sex'] = 'male' |
---|
| 48 | if info['per_doc'].sex: |
---|
| 49 | info['sex'] = 'female' |
---|
[639] | 50 | res = context.portal_catalog(container_path=student_path, |
---|
| 51 | portal_type='StudentAccommodation') |
---|
| 52 | if res: |
---|
| 53 | acco = res[0].getObject() |
---|
| 54 | info['acco'] = acco |
---|
| 55 | info['acco_doc'] = acco.getContent() |
---|
| 56 | else: |
---|
| 57 | info['acco'] = None |
---|
[535] | 58 | return info |
---|