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

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

see ticket 36

Please check the modifications.

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