39b3e92898c7e89c3ec6b32a220099f5721ad58c
1 ##parameters=rootObject, filtered_meta_types=[], userid=''
6 if req
.form
.get('collapse_all', '') == rootObject
.id or req
.get('just_login', False) :
9 from Products
.CMFCore
.permissions
import View
11 def getSubObjects(object) :
12 if getattr(object, 'isPortalContent', False) :
14 childs
= list(object.listNearestFolderContents(contentFilter
={'portal_type':filtered_meta_types
}, userid
=userid
))
15 childs
.sort(lambda x
, y
: cmp(x
.title_or_id().lower(), y
.title_or_id().lower()))
20 from ZTUtils
import SimpleTreeMaker
21 stateName
= rootObject
.id + userid
+ '_tree'
22 cookieName
= stateName
+ '-state'
23 stm
= SimpleTreeMaker(stateName
)
24 stm
.setChildAccess(function
=getSubObjects
)
26 tree
, rows
= stm
.cookieTree(rootObject
)
27 cookieValue
= resp
.cookies
[cookieName
]['value']
28 resp
.setCookie(cookieName
, cookieValue
, path
= '/')
30 return {'tree' : tree
, 'rows' : rows
}