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
|
Rev | Line | |
---|
[1] | 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 | |
---|
| 11 | from Products.CMFCore.utils import getToolByName |
---|
| 12 | from Products.qSiloGroup.utils import getCurrentFolder |
---|
| 13 | |
---|
| 14 | CONTEXT = getCurrentFolder(context) |
---|
| 15 | |
---|
| 16 | items = CONTEXT.getProperty('silo_items', None) |
---|
| 17 | |
---|
| 18 | if not items: |
---|
| 19 | return {} |
---|
| 20 | |
---|
| 21 | links = getToolByName(context, 'portal_catalog').searchResults(path="/".join(CONTEXT.getPhysicalPath()), portal_type="Link") |
---|
| 22 | links_dict = {} |
---|
| 23 | for l in links: |
---|
| 24 | links_dict[l.getId] = l.getRemoteUrl |
---|
| 25 | |
---|
| 26 | prop_dict = {} |
---|
| 27 | for 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 | |
---|
| 44 | return prop_dict |
---|
Note: See
TracBrowser
for help on using the repository browser.