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

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

remove some old stuff

  • Property svn:keywords set to Id
File size: 1.9 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 2281 2007-09-27 16:26:41Z joachim $
[556]11"""
12return Info about the Faculties
13"""
14request = context.REQUEST
15
16wf = context.portal_workflow
[614]17mtool = context.portal_membership
[1631]18academics_path = "%s/campus/academics" % context.portal_url()
[556]19path_info = request.get('PATH_INFO').split('/')
[573]20try:
21    i = int(path_info[-1])
22    p = 0
23except:
24    p = 1
[556]25info = {}
[1514]26pt = request.get('PATH_INFO').split('/')
[573]27
28dep_id = pt[-(3+p)]
29cert_id = pt[-(2+p)]
30level_id = pt[-(1+p)]
31info['action'] = "%s" % context.absolute_url()
[556]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
[614]40res = context.portal_catalog(meta_type="CertificateCourse", container_path="%s/%s" % (cp,level_id))
[565]41first = []
42second = []
43for r in res:
44    row = {}
45    ro = r.getObject()
46    rd = ro.getContent()
[2281]47    course_id = r.getId
48    row = context.getCourseInfo(course_id)
49    row['id'] = course_id
50    # row['title'] = rd.Title()
51    # row['semester'] = rd.semester
[603]52    row['core'] = rd.core_or_elective
[565]53    row['url'] = ro.absolute_url()
[573]54    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
[1631]55    editable = row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
56    if editable:
[2281]57        row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path,
58                                                           row['faculty'],
59                                                           row['department'],
60                                                           course_id)
61    if row['semester'] == 1:
[565]62        first.append(row)
63    else:
64        second.append(row)
[566]65first.sort()
66second.sort()
[565]67info['first'] = first
68info['second'] = second
[556]69return info
Note: See TracBrowser for help on using the repository browser.