Rev | Line | |
---|
[845] | 1 | ## Script (Python) "getDepartmentsInfo" |
---|
[551] | 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: getDepartmentsInfo.py 1988 2007-07-05 11:14:12Z joachim $ |
---|
[551] | 11 | """ |
---|
| 12 | return Info about the Faculties |
---|
| 13 | """ |
---|
[1988] | 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
[551] | 19 | request = context.REQUEST |
---|
| 20 | |
---|
| 21 | wf = context.portal_workflow |
---|
| 22 | mtool = context.portal_membership |
---|
| 23 | member = mtool.getAuthenticatedMember() |
---|
[1988] | 24 | #path_info = request.get('PATH_INFO').split('/') |
---|
[551] | 25 | |
---|
| 26 | info = {} |
---|
| 27 | member_id = str(member) |
---|
[598] | 28 | roles = member.getRolesInContext(context) |
---|
[573] | 29 | info['action'] = "%s" % context.absolute_url() |
---|
[551] | 30 | info['choosen_ids'] = request.get('ids',[]) |
---|
| 31 | items = [] |
---|
| 32 | info['doc'] = context.getContent() |
---|
[1988] | 33 | # set_trace() |
---|
| 34 | # brain = context.portal_catalog(portal_type="Faculty", id = context.getId())[-1] |
---|
| 35 | # cp = brain.getPath() |
---|
| 36 | cp = request.get('PATH_INFO') |
---|
[551] | 37 | info['container_path'] = cp |
---|
| 38 | res = context.portal_catalog(container_path=cp) |
---|
| 39 | for r in res: |
---|
| 40 | row = {} |
---|
| 41 | ro = r.getObject() |
---|
| 42 | rd = ro.getContent() |
---|
| 43 | row['id'] = r.getId |
---|
| 44 | row['title'] = rd.LongTitle() |
---|
| 45 | row['url'] = ro.absolute_url() |
---|
[598] | 46 | row['is_editable'] = mtool.checkPermission('Modify portal content', ro) |
---|
[551] | 47 | items.append(row) |
---|
| 48 | info['items'] = items |
---|
| 49 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.