## Script (Python) "student_index"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=batch=None,portal_status_message=None
##title=
##
# $Id: student_index.py 2297 2007-10-01 07:26:30Z henrik $
"""
return the current student_index
"""

request = context.REQUEST
#session = request.SESSION
response = request.RESPONSE
redirect = response.redirect
pm = context.portal_membership
member = pm.getAuthenticatedMember()

#from Products.zdb import set_trace;set_trace()
if context.isStaff():
    if context.portal_type == 'StudentStudyCourse':
        return context.study_course_view()
    elif context.portal_type == 'StudentStudyLevel':
        return context.study_level_view()
    elif context.portal_type == 'StudentClearance':
        return context.clearance_view()
    elif context.portal_type == 'PaymentsFolder':
        return context.payments_view()
    elif context.portal_type == 'Student':
        if portal_status_message:
            return redirect("%s/student_view?portal_status_message=%s" % (context.absolute_url(),portal_status_message))
        else:
            return redirect("%s/student_view" % context.absolute_url())
    elif context.portal_type == 'Payment':
        return context.payment_receipt()
    return redirect("%s/waeup_document_view" % context.absolute_url())
if context.isStudent():
    if context.portal_type == 'PaymentsFolder':
        return context.payments_view()
    elif context.portal_type == 'Payment':
        return context.payment_receipt()
    elif context.portal_type == 'StudentStudyLevel':
        return context.study_level_view()
    elif context.portal_type == 'StudentStudyCourse':
        return context.study_course_view()
    students_url = "%s/campus/students" % (context.portal_url())
    id = str(member)
    return redirect("%s/%s/student_view" % (students_url, id))

return redirect("%s/srp_anonymous_view" % context.portal_url())

