source: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getFacultiesInfo.py @ 11107

Last change on this file since 11107 was 1724, checked in by joachim, 18 years ago

improve or fix id_rename and catalog handling

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1## Script (Python) "getFacultiesInfo"
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:getFacultiesInfo.py 486 2006-09-06 10:09:39Z joachim $
11"""
12return Info about the Faculties
13"""
14request = context.REQUEST
15def cmp_id(a,b):
16    s1 = "%(id)s" % a
17    s2 = "%(id)s" % b
18    if s1 == s2:
19        return 0
20    if s1 > s2:
21        return 1
22    return -1
23
24wf = context.portal_workflow
25mtool = context.portal_membership
26path_info = request.get('PATH_INFO').split('/')
27
28info = {}
29info['action'] = "%s" % context.campus.absolute_url()
30info['choosen_ids'] = request.get('ids',[])
31items = []
32facs = context.portal_catalog(portal_type='Faculty')
33for f in facs:
34    row = {}
35    fo = f.getObject()
36    fd = fo.getContent()
37    row['id'] = fo.getId()
38    row['title'] = fd.LongTitle()
39    row['url'] = fo.absolute_url()
40    row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
41    items.append(row)
42items.sort(cmp_id)
43info['items'] = items
44return info
Note: See TracBrowser for help on using the repository browser.