source: WAeUP_SRP/trunk/skins/waeup_academics/getLevelInfo.py @ 3827

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

introduce breadcrumbs for the academic-section, use them instead of up one
level.

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