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

Last change on this file since 595 was 573, checked in by joachim, 18 years ago

fixed button functions, level_index_view

File size: 1.6 KB
Line 
1## Script (Python) "cpsdocument_edit"
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: student_edit.py 486 2006-09-06 10:09:39Z joachim $
11"""
12return Info about the Faculties
13"""
14request = context.REQUEST
15
16wf = context.portal_workflow
17mtool = context.portal_membership
18member = mtool.getAuthenticatedMember()
19path_info = request.get('PATH_INFO').split('/')
20try:
21    i = int(path_info[-1])
22    p = 0
23except:
24    p = 1
25info = {}
26member_id = str(member)
27pt = request.get('PATH_TRANSLATED').split('/')
28
29dep_id = pt[-(3+p)]
30cert_id = pt[-(2+p)]
31level_id = pt[-(1+p)]
32roles = member.getRoles()
33info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles
34info['is_student'] = 'Student' in roles
35info['action'] = "%s" % context.absolute_url()
36info['choosen_ids'] = request.get('ids',[])
37info['doc'] = context.getContent()
38brain = context.portal_catalog(meta_type="Certificate",id = cert_id)[-1]
39cp = brain.getPath()
40info['container_path'] = cp
41info['dep_id'] = dep_id
42info['cert_id'] = cert_id
43
44res = context.portal_catalog(container_path="%s/%s" % (cp,level_id))
45first = []
46second = []
47for r in res:
48    row = {}
49    ro = r.getObject()
50    rd = ro.getContent()
51    row['id'] = r.getId
52    row['title'] = rd.Title()
53    row['core'] = rd.core_or_elective
54    row['semester'] = rd.semester
55    row['url'] = ro.absolute_url()
56    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
57    if rd.semester == 'first':
58        first.append(row)
59    else:
60        second.append(row)
61first.sort()
62second.sort()
63info['first'] = first
64info['second'] = second
65return info
Note: See TracBrowser for help on using the repository browser.