Last change
on this file since 3013 was
2282,
checked in by joachim, 17 years ago
|
add import for courses, certificates, certificate_courses
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Rev | Line | |
---|
[845] | 1 | ## Script (Python) "getFacultiesInfo" |
---|
[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 | ## |
---|
[801] | 10 | # $Id:getFacultiesInfo.py 486 2006-09-06 10:09:39Z joachim $ |
---|
[551] | 11 | """ |
---|
| 12 | return Info about the Faculties |
---|
| 13 | """ |
---|
| 14 | request = context.REQUEST |
---|
[1724] | 15 | def 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 |
---|
[551] | 23 | |
---|
| 24 | wf = context.portal_workflow |
---|
| 25 | mtool = context.portal_membership |
---|
| 26 | path_info = request.get('PATH_INFO').split('/') |
---|
| 27 | |
---|
| 28 | info = {} |
---|
[2028] | 29 | info['action'] = "%s" % context.absolute_url() |
---|
[551] | 30 | info['choosen_ids'] = request.get('ids',[]) |
---|
| 31 | items = [] |
---|
| 32 | facs = context.portal_catalog(portal_type='Faculty') |
---|
| 33 | for f in facs: |
---|
| 34 | row = {} |
---|
[2273] | 35 | try: |
---|
| 36 | fo = f.getObject() |
---|
| 37 | fd = fo.getContent() |
---|
| 38 | row['id'] = fo.getId() |
---|
| 39 | row['title'] = fd.LongTitle() |
---|
| 40 | row['url'] = fo.absolute_url() |
---|
| 41 | row['is_editable'] = mtool.checkPermission('Modify portal content', fo) |
---|
| 42 | items.append(row) |
---|
| 43 | except AttributeError: |
---|
| 44 | continue |
---|
[1724] | 45 | items.sort(cmp_id) |
---|
[551] | 46 | info['items'] = items |
---|
| 47 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.