source: WAeUP_SRP/base/skins/waeup_documents/getDocumentsInfo.py @ 3474

Last change on this file since 3474 was 3473, checked in by joachim, 17 years ago

remove Title from all StudentObjects?,
adjust templates to use getStudentObjectitles,
remove waeup_academics.getDocumentInfo (was duplicate),
do not use portal_catalog for listing faculties and departments.

File size: 1.4 KB
Line 
1## Script (Python) "getDocumentsInfo"
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.absolute_url()
30info['choosen_ids'] = request.get('ids',[])
31info['doc'] = context.getContent()
32
33# items = []
34# facs = context.portal_catalog(portal_type='WAeUPDocument')
35# for f in facs:
36#     row = {}
37#     fo = f.getObject()
38#     fd = fo.getContent()
39#     row['id'] = fo.getId()
40#     row['title'] = fd.Title()
41#     row['url'] = fo.absolute_url()
42#     row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
43#     items.append(row)
44# items.sort(cmp_id)
45items = []
46for id, doc in context.objectItems():
47    row = {}
48    row['id'] = id
49    row['title'] = doc.getContent().Title()
50    row['url'] = doc.absolute_url()
51    row['is_editable'] = mtool.checkPermission('Modify portal content', doc)
52    items.append(row)
53items.sort(cmp=lambda x,y: cmp(x['id'].lower(), y['id'].lower()))
54info['items'] = items
55return info
Note: See TracBrowser for help on using the repository browser.