source: products/qSiloGroup/trunk/skins/qSiloGroup/getSiloNavigationDictionary.py @ 1

Last change on this file since 1 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1## Controller Python Script "getSiloNavigationDictionary"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##title=Update Folder Property
8##parameters=
9#
10
11from Products.CMFCore.utils import getToolByName
12from Products.qSiloGroup.utils import getCurrentFolder
13
14CONTEXT = getCurrentFolder(context)
15
16items = CONTEXT.getProperty('silo_items', None)
17
18if not items:
19    return {}
20
21links = getToolByName(context, 'portal_catalog').searchResults(path="/".join(CONTEXT.getPhysicalPath()), portal_type="Link")
22links_dict = {}
23for l in links:
24    links_dict[l.getId] = l.getRemoteUrl
25
26prop_dict = {}
27for i in items:
28    s = map(str, i.split('|'))
29    id = s[0]
30    path = id
31    link = False
32    try:
33        if len(s) == 2:
34            title = s[1]
35        else:
36            title = s[2]
37            path += s[1] and ('/'+s[1]) or s[1]
38        if id in links_dict.keys():
39            link = True
40            path = links_dict[id]
41        prop_dict[id] = {'id': id, 'path':path, 'title':title, 'link':link}
42    except: continue
43
44return prop_dict
Note: See TracBrowser for help on using the repository browser.