source: WAeUP_SRP/base/skins/waeup_academics/getDepartmentsInfo.py @ 2427

Last change on this file since 2427 was 2273, checked in by joachim, 17 years ago

fix for #1 fceokene

  • 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 2273 2007-09-25 09:24:06Z joachim $
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['action'] = "%s" % context.absolute_url()
25info['choosen_ids'] = request.get('ids',[])
26items = []
27info['doc'] = context.getContent()
28brain = context.portal_catalog(meta_type="Faculty", id = context.getId())[-1]
29cp = brain.getPath()
30info['container_path'] = cp
31res = context.portal_catalog(container_path=cp)
32for r in res:
33    row = {}
34    try:
35        ro = r.getObject()
36        rd = ro.getContent()
37        row['id'] = r.getId
38        row['title'] = rd.LongTitle()
39        row['url'] = ro.absolute_url()
40        row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
41        items.append(row)
42    except AttributeError:
43        continue
44       
45info['items'] = items
46return info
Note: See TracBrowser for help on using the repository browser.