[845] | 1 | ## Script (Python) "getAccoFolderInfo" |
---|
[622] | 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 | ## |
---|
[805] | 10 | # $Id: getAccoFolderInfo.py 2845 2007-12-03 21:14:20Z joachim $ |
---|
[622] | 11 | """ |
---|
[1447] | 12 | return Info about the Accommodation-Folder |
---|
[622] | 13 | """ |
---|
[2845] | 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
[622] | 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 = {} |
---|
[635] | 26 | info['action'] = "%s" % context.absolute_url() |
---|
[622] | 27 | info['choosen_ids'] = request.get('ids',[]) |
---|
| 28 | items = [] |
---|
[1441] | 29 | is_editable = mtool.checkPermission('Modify portal content', context) |
---|
[2845] | 30 | #is_editable = False |
---|
| 31 | #halls = context.portal_catalog(portal_type='AccoHall') |
---|
| 32 | for id,hall in context.objectItems(): |
---|
| 33 | hall_doc = hall.getContent() |
---|
[622] | 34 | row = {} |
---|
[2845] | 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) |
---|
[1441] | 39 | #fo = f.getObject() |
---|
| 40 | #row['is_editable'] = mtool.checkPermission('Modify portal content', fo) |
---|
| 41 | row['is_editable'] = is_editable |
---|
[622] | 42 | items.append(row) |
---|
[2845] | 43 | items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id'])) |
---|
[622] | 44 | info['items'] = items |
---|
[1439] | 45 | return info |
---|
[626] | 46 | |
---|