source: WAeUP_SRP/trunk/skins/waeup_academics/getDepartmentsInfo.py @ 911

Last change on this file since 911 was 911, checked in by Henrik Bettermann, 18 years ago

new local roles implemented
role SectionOfficer? not yet tested

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1## Script (Python) "getDepartmentsInfo"
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##
10# $Id: getDepartmentsInfo.py 911 2006-11-20 15:11:29Z henrik $
11"""
12return Info about the Faculties
13"""
14request = context.REQUEST
15
16wf = context.portal_workflow
17mtool = context.portal_membership
18member = mtool.getAuthenticatedMember()
19path_info = request.get('PATH_INFO').split('/')
20
21info = {}
22member_id = str(member)
23roles = member.getRolesInContext(context)
24info['is_sm'] = context.isSectionManager()
25info['is_so'] = context.isSectionOfficer()
26info['is_student'] = context.isStudent()
27info['action'] = "%s" % context.absolute_url()
28info['choosen_ids'] = request.get('ids',[])
29items = []
30info['doc'] = context.getContent()
31brain = context.portal_catalog(meta_type="Faculty", id = context.getId())[-1]
32cp = brain.getPath()
33info['container_path'] = cp
34res = context.portal_catalog(container_path=cp)
35for r in res:
36    row = {}
37    ro = r.getObject()
38    rd = ro.getContent()
39    row['id'] = r.getId
40    row['title'] = rd.LongTitle()
41    row['url'] = ro.absolute_url()
42    row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
43    items.append(row)
44info['items'] = items
45return info
Note: See TracBrowser for help on using the repository browser.