## Script (Python) "getDepartmentsInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: getDepartmentsInfo.py 911 2006-11-20 15:11:29Z henrik $ """ return Info about the Faculties """ request = context.REQUEST wf = context.portal_workflow mtool = context.portal_membership member = mtool.getAuthenticatedMember() path_info = request.get('PATH_INFO').split('/') info = {} member_id = str(member) roles = member.getRolesInContext(context) info['is_sm'] = context.isSectionManager() info['is_so'] = context.isSectionOfficer() info['is_student'] = context.isStudent() info['action'] = "%s" % context.absolute_url() info['choosen_ids'] = request.get('ids',[]) items = [] info['doc'] = context.getContent() brain = context.portal_catalog(meta_type="Faculty", id = context.getId())[-1] cp = brain.getPath() info['container_path'] = cp res = context.portal_catalog(container_path=cp) for r in res: row = {} ro = r.getObject() rd = ro.getContent() row['id'] = r.getId row['title'] = rd.LongTitle() row['url'] = ro.absolute_url() row['is_editable'] = mtool.checkPermission('Modify portal content', ro) items.append(row) info['items'] = items return info