## Script (Python) "getLevelInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: getLevelInfo.py 2614 2007-11-09 21:30:03Z henrik $ """ return Info about the Faculties """ request = context.REQUEST wf = context.portal_workflow mtool = context.portal_membership academics_path = "%s/campus/academics" % context.portal_url() path_info = request.get('PATH_INFO').split('/') try: i = int(path_info[-1]) p = 0 except: p = 1 info = {} pt = request.get('PATH_INFO').split('/') dep_id = pt[-(3+p)] cert_id = pt[-(2+p)] level_id = pt[-(1+p)] info['action'] = "%s" % context.absolute_url() info['choosen_ids'] = request.get('ids',[]) info['doc'] = context.getContent() info['dep_id'] = dep_id info['cert_id'] = cert_id first = [] second = [] combined = [] for course_id,course in context.objectItems(): row = {} course_doc = course.getContent() row = context.getCourseInfo(course_id) row['id'] = course_id row['core'] = course_doc.core_or_elective row['url'] = course.absolute_url() row['review_state'] = wf.getInfoFor(course,'review_state','None') editable = row['is_editable'] = mtool.checkPermission('Modify portal content', course) if editable: row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path, row['faculty'], row['department'], course_id) # The course objects contain strings (old schema) and integers (new schema) as semester values row['semester'] = str(row['semester']) if row['semester'] == '1': first.append(row) elif row['semester'] == '2': second.append(row) else: combined.append(row) first.sort() second.sort() combined.sort() info['first'] = first info['second'] = second info['combined'] = combined return info