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

Last change on this file since 611 was 603, checked in by Henrik Bettermann, 18 years ago

batch of fixes to open the frontend for the first time

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
17path_info = request.get('PATH_INFO').split('/')
18try:
19    i = int(path_info[-1])
20    p = 0
21except:
22    p = 1
23info = {}
24pt = request.get('PATH_TRANSLATED').split('/')
25
26dep_id = pt[-(3+p)]
27cert_id = pt[-(2+p)]
28level_id = pt[-(1+p)]
29info['is_manager'] = context.isManager()
30info['is_student'] = context.isStudent()
31info['action'] = "%s" % context.absolute_url()
32info['choosen_ids'] = request.get('ids',[])
33info['doc'] = context.getContent()
34brain = context.portal_catalog(meta_type="Certificate",id = cert_id)[-1]
35cp = brain.getPath()
36info['container_path'] = cp
37info['dep_id'] = dep_id
38info['cert_id'] = cert_id
39
40res = context.portal_catalog(container_path="%s/%s" % (cp,level_id))
41first = []
42second = []
43for r in res:
44    row = {}
45    ro = r.getObject()
46    rd = ro.getContent()
47    row['id'] = r.getId
48    row['title'] = rd.Title()
49    row['core'] = rd.core_or_elective
50    row['semester'] = rd.semester
51    row['url'] = ro.absolute_url()
52    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
53    row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
54    if rd.semester == 'first':
55        first.append(row)
56    else:
57        second.append(row)
58first.sort()
59second.sort()
60info['first'] = first
61info['second'] = second
62return info
Note: See TracBrowser for help on using the repository browser.