source: WAeUP_SRP/trunk/skins/waeup_student/student_index.py @ 1477

Last change on this file since 1477 was 1380, checked in by joachim, 18 years ago

course registration

M waeup_student/student_index.py
M waeup_student/study_level_view.pt
M waeup_student/getStudyLevelInfo.py
M waeup_student/study_course_view.pt
M waeup_student/getStudyCourseInfo.py
AM waeup_academics/getCourseInfo.py

reindex entry_mode

M waeup_utilities/getFromData_entry_mode.py
M waeup_utilities/reindex_entry_mode.py

  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1## Script (Python) "student_index"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=batch=None
8##title=
9##
10# $Id: student_index.py 1380 2007-01-31 16:24:18Z joachim $
11"""
12return the current student_index_html
13"""
14from Products.AdvancedQuery import Eq, Between, Le,In
15evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
16
17request = context.REQUEST
18session = request.SESSION
19response = request.RESPONSE
20redirect = response.redirect
21pm = context.portal_membership
22member = pm.getAuthenticatedMember()
23
24#from Products.zdb import set_trace;set_trace()
25if context.isStaff():
26    if context.portal_type == 'StudentStudyCourse':
27        return context.study_course_view()
28    elif context.portal_type == 'StudentStudyLevel':
29        return context.study_level_view()
30    elif context.portal_type == 'StudentClearance':
31        return context.clearance_view()
32    elif context.portal_type == 'PaymentsFolder':
33        return context.payments_view()
34    elif context.portal_type == 'Student':
35        return redirect("%s/student_view" % context.absolute_url())
36    elif context.portal_type == 'Payment':
37        return context.payment_receipt()       
38    return redirect("%s/waeup_document_view" % context.absolute_url())
39if context.isStudent():
40    if context.portal_type == 'PaymentsFolder':
41        return context.payments_view()
42    elif context.portal_type == 'Payment':
43        return context.payment_receipt()
44    elif context.portal_type == 'StudentStudyLevel':
45        if context.objectIds():
46            return context.study_level_view()
47        student = context.students_catalog(id=context.getStudentId())[0]
48        cert_id = student.course
49        in_progress =  session.get('in_progress','finished')
50        if in_progress == 'finished':
51            session.set('in_progress','started')
52            view = context.in_progress_view(refresh=3,page='study_level_view')
53            response.setHeader('Content-type','text/html; charset=ISO-8859-15')
54            response.setHeader('Content-length','%d' % (len(view)))
55            response.setStatus('OK')
56            response.write(view)
57            response.write('')
58        elif in_progress == 'started':
59            return
60        #from Products.zdb import set_trace;set_trace()
61        results = context.results_import(matric_no = student.matric_no)
62        carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
63        l = []
64        for co in carry_overs:
65            d = context.getCourseInfo(co.CosCode)
66            d['grade'] = co.GRADE
67            d['carry_level'] = co.CarryLevel
68            cr_id = context.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
69            getattr(context,cr_id).getContent().edit(mapping=d)
70        res = context.portal_catalog(portal_type="Certificate", id = cert_id)
71        l = []
72        if res:
73            cert = res[0]
74            path = cert.getPath()
75            query = Eq("path",path) &\
76                    Eq('portal_type','CertificateCourse') &\
77                    Eq('SearchableText', "%s" % student.level)
78            courses = evalAdvancedQuery(query)
79            for c in courses:
80                d = context.getCourseInfo(c.getId)
81                cr_id = context.invokeFactory('StudentCourseResult',c.getId)
82                d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
83                getattr(context,cr_id).getContent().edit(mapping=d)
84        session.set('in_progress','finished')
85        return "finished"
86    students_url = "%s/campus/students" % (context.portal_url())
87    id = str(member)
88    return redirect("%s/%s/student_view" % (students_url, id))
89
90return redirect("%s/srp_anonymous_view" % context.portal_url())
91
Note: See TracBrowser for help on using the repository browser.