## Script (Python) "cpsdocument_edit" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $ """ return Info about the Faculties """ request = context.REQUEST wf = context.portal_workflow mtool = context.portal_membership path_info = request.get('PATH_INFO').split('/') info = {} info['is_manager'] = context.isManager() info['is_student'] = context.isStudent() info['action'] = "%s" % context.campus.absolute_url() info['choosen_ids'] = request.get('ids',[]) items = [] halls = context.portal_catalog(portal_type='AccoHall') for f in halls: row = {} fo = f.getObject() fd = fo.getContent() row['id'] = fo.getId() row['title'] = fd.Title() row['url'] = fo.absolute_url() row['is_editable'] = mtool.checkPermission('Modify portal content', fo) items.append(row) info['items'] = items pa = context.portal_accommodation bed_types = pa.uniqueValuesFor('bed_type') bt_list = [] bt_names = context.getBedTypeNames() for bt in bed_types: res = pa(bed_type=bt) bt_list.append({'name': bt_names[bt], 'count': len(res)}) info['bed_types'] = bt_list reserved = pa.uniqueValuesFor('student') res_list = [] if reserved > 1: for st in reserved: if st: res = pa(student=st) bt_list.append({'student': st, 'bed': res[0].bed }) info['reserved'] = res_list return info