## 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 845 2006-11-11 21:29:50Z henrik $ """ return Info about the Faculties """ request = context.REQUEST wf = context.portal_workflow mtool = context.portal_membership path_info = request.get('PATH_INFO').split('/') try: i = int(path_info[-1]) p = 0 except: p = 1 info = {} pt = request.get('PATH_TRANSLATED').split('/') dep_id = pt[-(3+p)] cert_id = pt[-(2+p)] level_id = pt[-(1+p)] info['is_manager'] = context.isManager() info['is_student'] = context.isStudent() info['action'] = "%s" % context.absolute_url() info['choosen_ids'] = request.get('ids',[]) info['doc'] = context.getContent() brain = context.portal_catalog(meta_type="Certificate",id = cert_id)[-1] cp = brain.getPath() info['container_path'] = cp info['dep_id'] = dep_id info['cert_id'] = cert_id res = context.portal_catalog(meta_type="CertificateCourse", container_path="%s/%s" % (cp,level_id)) first = [] second = [] for r in res: row = {} ro = r.getObject() rd = ro.getContent() row['id'] = r.getId row['title'] = rd.Title() row['core'] = rd.core_or_elective row['semester'] = rd.semester row['url'] = ro.absolute_url() row['review_state'] = wf.getInfoFor(ro,'review_state','None') row['is_editable'] = mtool.checkPermission('Modify portal content', ro) if rd.semester == 'first': first.append(row) else: second.append(row) first.sort() second.sort() info['first'] = first info['second'] = second return info