## Script (Python) "academics_index"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=batch=None
##title=
##
# $Id: academics_index.py 901 2006-11-20 07:33:16Z henrik $
"""
return the appropriate page in the academics section
"""

request = context.REQUEST
redirect = request.RESPONSE.redirect
pm = context.portal_membership

if pm.isAnonymousUser():
    return redirect("%s/srp_anonymous_view" % context.portal_url())
else:
    if context.portal_type == 'AcademicsFolder':
        return context.academics.academics_view()
    elif context.portal_type == 'Faculty':
        return context.faculty_view()
    elif context.portal_type == 'Department':
        return context.department_view()
    elif context.portal_type == 'CoursesFolder':
        return context.courses_view()
    elif context.portal_type == 'CertificatesFolder':
        return context.certificates_view()
    elif context.portal_type == 'Certificate':
        return context.certificate_view()
    elif context.portal_type == 'StudyLevel':
        return context.level_view()
    elif context.portal_type in ('CertificateCourse','Course'):
        return context.waeup_document_view()
    return redirect("%s/srp_view" % context.portal_url())

