source: WAeUP_SRP/base/skins/waeup_academics/getLevelInfo.py @ 3473

Last change on this file since 3473 was 3473, checked in by joachim, 17 years ago

remove Title from all StudentObjects?,
adjust templates to use getStudentObjectitles,
remove waeup_academics.getDocumentInfo (was duplicate),
do not use portal_catalog for listing faculties and departments.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## Script (Python) "getLevelInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None
8##title=
9##
10# $Id: getLevelInfo.py 3473 2008-04-29 09:24:51Z joachim $
11"""
12return Info about the Level
13"""
14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19request = context.REQUEST
20
21wf = context.portal_workflow
22mtool = context.portal_membership
23academics_path = "%s/campus/academics" % context.portal_url()
24path_info = request.get('PATH_INFO').split('/')
25try:
26    i = int(path_info[-1])
27    p = 0
28except:
29    p = 1
30info = {}
31pt = request.get('PATH_INFO').split('/')
32
33dep_id = pt[-(3+p)]
34cert_id = pt[-(2+p)]
35level_id = pt[-(1+p)]
36info['action'] = "%s" % context.absolute_url()
37info['choosen_ids'] = request.get('ids',[])
38info['doc'] = context.getContent()
39info['dep_id'] = dep_id
40info['cert_id'] = cert_id
41
42
43first = []
44second = []
45combined = []
46set_trace()
47for course_id,course in context.objectItems():
48    row = {}
49    course_doc = course.getContent()
50    row = context.getCourseInfo(course_id)
51    row['id'] = course_id
52    row['core'] = course_doc.core_or_elective
53    row['url'] = course.absolute_url()
54    row['review_state'] = wf.getInfoFor(course,'review_state','None')
55    editable = row['is_editable'] = mtool.checkPermission('Modify portal content', course)
56    if editable:
57        row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path,
58                                                           row['faculty'],
59                                                           row['department'],
60                                                           course_id)
61
62    # The course objects contain strings (old schema) and integers (new schema) as semester values
63    row['semester'] = str(row['semester'])
64    if row['semester'] == '1':
65        first.append(row)
66    elif row['semester'] == '2':
67        second.append(row)       
68    else:
69        combined.append(row)
70first.sort()
71second.sort()
72combined.sort()
73info['first'] = first
74info['second'] = second
75info['combined'] = combined
76
77return info
Note: See TracBrowser for help on using the repository browser.