a6b02c9d866ae0f9d38a320a2744fe365f13ddd8
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
)
25 #stm.setStateFunction(expandIfUnauthorized)
27 tree
, rows
= stm
.cookieTree(rootObject
)
28 cookieValue
= resp
.cookies
[cookieName
]['value']
29 resp
.setCookie(cookieName
, cookieValue
, path
= '/')
31 return {'tree' : tree
, 'rows' : rows
}