12b0392fa657095cba2708859f7487d1b4b8171b
1 ## Script (Python) "imagelist.xml"
2 ##bind container=container
6 ##bind subpath=traverse_subpath
7 ##parameters=all=False, size=600, duration=4
10 from ZTUtils
import Batch
11 from ZTUtils
import LazyFilter
12 from Products
.CMFCore
.utils
import getToolByName
13 from Products
.CMFDefault
.utils
import toUnicode
15 ptool
= getToolByName(script
, 'portal_properties')
16 stool
= getToolByName(script
, 'portal_syndication')
17 mtool
= getToolByName(script
, 'portal_membership')
20 req
.other
['disable_cookie_login__'] = 1
24 options
['channel_info'] = { 'base': stool
.getHTML4UpdateBase(context
),
25 'description': context
.Description(),
26 'frequency': stool
.getUpdateFrequency(context
),
27 'period': stool
.getUpdatePeriod(context
),
28 'title': context
.title_or_id(),
29 'url': context
.absolute_url(),
30 'author': mtool
.getMemberFullNameById(context
.Creator(), nameBefore
=0),
31 'size': '%s_%s' % (size
, size
),
34 key
, reverse
= context
.getDefaultSorting()
35 items
= stool
.getSyndicatableContent(context
)
36 items
= sequence
.sort( items
, ((key
, 'cmp', reverse
and 'desc' or 'asc'),) )
37 items
= LazyFilter(items
, skip
='View')
38 b_size
= stool
.getMaxItems(context
)
40 batch_obj
= Batch(items
, b_size
, 0, orphan
=0)
44 raise ValueError, "all must be a boolean value."
46 for item
in batch_obj
:
47 items
.append( { 'date': item
.modified().rfc822(),
48 'description': item
.Description(),
49 'listCreators': item
.listCreators(),
50 'listSubjects': item
.Subject(),
51 'publisher': item
.Publisher(),
52 'rights': item
.Rights(),
53 'title': item
.title_or_id(),
54 'url': item
.absolute_url(),
55 'length': item
.get_size(),
56 'image' : '%s/apic' % item
.absolute_url() } )
57 options
['listItemInfos'] = tuple(items
)
59 options
= toUnicode( options
, ptool
.getProperty('default_charset', None) )
60 return context
.imagelist_template(**options
)