1 | ## Script (Python) "getAccoFolderInfo" |
---|
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: getAccoFolderInfo.py 2845 2007-12-03 21:14:20Z joachim $ |
---|
11 | """ |
---|
12 | return Info about the Accommodation-Folder |
---|
13 | """ |
---|
14 | try: |
---|
15 | from Products.zdb import set_trace |
---|
16 | except: |
---|
17 | def set_trace(): |
---|
18 | pass |
---|
19 | request = context.REQUEST |
---|
20 | |
---|
21 | wf = context.portal_workflow |
---|
22 | mtool = context.portal_membership |
---|
23 | path_info = request.get('PATH_INFO').split('/') |
---|
24 | |
---|
25 | info = {} |
---|
26 | info['action'] = "%s" % context.absolute_url() |
---|
27 | info['choosen_ids'] = request.get('ids',[]) |
---|
28 | items = [] |
---|
29 | is_editable = mtool.checkPermission('Modify portal content', context) |
---|
30 | #is_editable = False |
---|
31 | #halls = context.portal_catalog(portal_type='AccoHall') |
---|
32 | for id,hall in context.objectItems(): |
---|
33 | hall_doc = hall.getContent() |
---|
34 | row = {} |
---|
35 | row['id'] = id |
---|
36 | row['title'] = hall_doc.Title() |
---|
37 | row['sort_id'] = getattr(hall_doc,'sort_id',0) |
---|
38 | row['url'] = "%s/%s" % (context.absolute_url(),id) |
---|
39 | #fo = f.getObject() |
---|
40 | #row['is_editable'] = mtool.checkPermission('Modify portal content', fo) |
---|
41 | row['is_editable'] = is_editable |
---|
42 | items.append(row) |
---|
43 | items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id'])) |
---|
44 | info['items'] = items |
---|
45 | return info |
---|
46 | |
---|