source: WAeUP_SRP/trunk/skins/waeup_academics/academics_index.py @ 598

Last change on this file since 598 was 598, checked in by joachim, 19 years ago

added is_editable for showing the edit link and the review_state

File size: 1.6 KB
Line 
1## Script (Python) "academics_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_edit.py 486 2006-09-06 10:09:39Z joachim $
11"""
12return the appropriate page in the academics section
13"""
14
15request = context.REQUEST
16redirect = request.RESPONSE.redirect
17pm = context.portal_membership
18
19if pm.isAnonymousUser():
20    return redirect("%s/academics_contents" % context.absolute_url())
21
22campus = context.portal_catalog(meta_type = "University")[-1].getObject()
23member = pm.getAuthenticatedMember()
24roles = member.getRolesInContext(context)
25isManager = "Manager" in roles or "SectionManager" in roles
26isStudent = "Student" in roles
27isStaff = "Staff" in roles
28
29if isStaff or isManager:
30    if context.portal_type == 'AcademicsFolder':
31        return context.academics.academics_index_view()
32    elif context.portal_type == 'Faculty':
33        return context.faculty_index_view()
34    elif context.portal_type == 'Department':
35        return context.department_index_view()
36    elif context.portal_type == 'CoursesFolder':
37        return context.courses_index_view()
38    elif context.portal_type == 'Certificate':
39        return context.certificate_index_view()
40    elif context.portal_type == 'StudyLevel':
41        return context.level_index_view()
42    elif context.portal_type in ('CertificateCourse','Course'):
43        return context.academics_document_view()
44    return redirect("%s/academics_contents" % context.absolute_url())
45if isStudent:
46    return redirect("%s/academics_contents" % context.absolute_url())
47
Note: See TracBrowser for help on using the repository browser.