X-Git-Url: https://scm.cri.mines-paristech.fr/git/MosaicDocument.git/blobdiff_plain/475bb3cd9bd15fe1dd3e03f0ab26cc7c343a2702..4eff9af578856f91276dbd2ab353f9bdb5e190b3:/skins/xml_nav_tree.py diff --git a/skins/xml_nav_tree.py b/skins/xml_nav_tree.py index 05967d9..79c069c 100644 --- a/skins/xml_nav_tree.py +++ b/skins/xml_nav_tree.py @@ -1,4 +1,4 @@ -##parameters=filter='' +##parameters=root_name='',expansion='',filter='' from ZTUtils import SimpleTreeMaker stm = SimpleTreeMaker() def replaceXMLEntities(text) : @@ -11,10 +11,12 @@ rmBadAttrChars = maketrans('<&"', ' ') filter = filter.split(',') -root = context +childs = list(context.listNearestFolderContents(contentFilter={'portal_type':filter})) +childs.sort(lambda x, y : cmp(y.title_or_id().lower(), x.title_or_id().lower())) + context.REQUEST.RESPONSE.setHeader('content-type', 'text/xml; charset=utf-8') print '' -for ob in context.listNearestFolderContents(contentFilter={'portal_type':filter}) : +for ob in childs : icon = context.restrictedTraverse(ob.getIcon()) state = 0 if not getattr(ob, 'isPortalContent', False) : @@ -33,5 +35,5 @@ for ob in context.listNearestFolderContents(contentFilter={'portal_type':filter} print '' - +context.REQUEST.RESPONSE.setCookie('%s-state' % root_name, expansion, path='/') return printed \ No newline at end of file