source: WAeUP_SRP/trunk/skins/waeup_student/getMemberInfo.py @ 1542

Last change on this file since 1542 was 1541, checked in by Henrik Bettermann, 18 years ago

review state added

File size: 2.7 KB
RevLine 
[1220]1## Script (Python) "getMemberInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: getApplicationInfo.py 1161 2006-12-31 07:50:50Z henrik $
11"""
12return Info about the current Student
13"""
14import logging
15logger = logging.getLogger('Student.Member.Info')
16
17request = context.REQUEST
18mtool = context.portal_membership
19wf = context.portal_workflow
20member = mtool.getAuthenticatedMember()
21member_id = str(member)
22path_info = request.get('PATH_INFO').split('/')
23##from Products.zdb import set_trace
24##set_trace()
25if mtool.isAnonymousUser():
26    return None
27info = {}
28requested_id = context.getStudentId()
29if requested_id and not context.isStaff() and member_id != requested_id:
30    logger.info('"%s", "accessed personal object of", "%s"' % (member_id,requested_id))
31    student_id = requested_id
32elif context.isStaff():
33    student_id = requested_id
34else:
35    student_id = member_id
36
37
38students_object = context.portal_url.getPortalObject().campus.students
39student = getattr(students_object, student_id)
[1223]40
[1281]41if hasattr(student,"application"):
[1254]42
[1281]43    info['student'] = student
44    info['id'] = student_id
45    info['review_state'] = wf.getInfoFor(student,'review_state',None)
46    info['per'] = student.personal
47    info['app'] = student.application
48    info['per_doc'] = student.personal.getContent()
49    info['app_doc'] = student.application.getContent()
50    info['clear_doc'] = student.clearance.getContent()
51    info['password'] = context.waeup_tool.getCredential(student_id)
52
53    if info['per_doc'].email:
54        info['email'] = info['per_doc'].email
55    else:
56        info['email'] = info['app_doc'].app_email
57
58    msg="""
[1268]59Your SRP Member Details
60-----------------------
61
[1223]62Fullname: %s
63Student Id: %s
64Matriculation Number: %s
65JAMB Registration Number: %s
[1541]66Registration Status: %s
[1254]67Email Address in Application Data: %s
68Email Address in Personal Data: %s
[1223]69Date of Birth: %s
[1316]70Password: '%s'
[1223]71
72"""
73
[1281]74    info['message'] = msg % (
75        student.Title(),
76        student_id,
77        info['clear_doc'].matric_no,
78        info['app_doc'].jamb_reg_no,
[1541]79        info['review_state'],
[1281]80        info['app_doc'].app_email,
81        info['per_doc'].email,
82        info['clear_doc'].birthday,
83        info['password']
84        )
85else:
[1316]86
[1281]87    info['student'] = student
88    info['id'] = student_id
89    info['review_state'] = wf.getInfoFor(student,'review_state',None)
90    info['password'] = context.waeup_tool.getCredential(student_id)
[1448]91    info['email'] = 'N/A'
[1223]92
[1281]93    msg="""
94Your SRP Member Details
95-----------------------
96
97Fullname: %s
98Student Id: %s
99Password: %s
100
101"""
102
103    info['message'] = msg % (
[1448]104        'N/A',
[1281]105        student_id,
106        info['password']
107        )
108
[1316]109
110
111
112
[1220]113return info
Note: See TracBrowser for help on using the repository browser.