Ciao, perchè non lo posti in un tuo blog e lo segnali sul nostro aggregatore, oppure scrivi un mini howto su Plone.it? Così è certo che i "posteri" lo troveranno molto utile! :)
Vito 2009/11/12 ryuga <[email protected]> > > Ciao a tutti, forse non vi servirà cmq sia sotto il codice per comporre un > menu a tre livelli con neteasy. > In pratica dobrebbe apparire così: > > ____________________________________ > home |cartella A(selezionata)| > > |cartella B(sotto A selezionata) |cartella B2(sotto A) > > cartella C(selezionata)| cartella C2 > _________________________________ > > Mi scuso per il minidisegno che fa praticamente c....e ma spero renda > l'idea, veniamo al codice. > PATH neteasy.plone.subnavbar-1.0.0-py2.4.egg/neteasy/plone/subnavbar > FILE navbar_contents.PY > > NB: IN GRASSETTO LE PARTI AGGIUNTE E/O MODIFICATE > > """ neteasy.plone.subnavbar > Copyright (C) 2008-9, Jim Nelson <[email protected]> > > This program is free software: you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation, either version 3 of the License, or > (at your option) any later version. > > This program is distributed in the hope that it will be useful, > but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU General Public License for more details. > > You should have received a copy of the GNU General Public License > along with this program. If not, see <http://www.gnu.org/licenses/>. > """ > > from Products.CMFCore.utils import getToolByName > > from AccessControl import ModuleSecurityInfo > modulesecurity = ModuleSecurityInfo() > modulesecurity.declarePublic('getSecondLevelList') > modulesecurity.declarePublic('getThirdLevelList') > > def getSecondLevelList(context): > > context = context.aq_inner > > plone_utils = getToolByName(context, 'plone_utils') > > # no reason to display second level nav on siteroot > if (context.meta_type == 'Plone Site'): > return {'selected':None, 'contents':[]} > > # no reason to display second level nav for non-folderish content views > in the siteroot > if (not plone_utils.isStructuralFolder(context)) and > (context.aq_parent.meta_type == 'Plone Site'): > return {'selected':None, 'contents':[]} > > selectedChild = context > item = context > itemparent = context.aq_parent > > # iterate through the acquisition chain to get the first-level folder in > the plone site > while itemparent.meta_type != 'Plone Site': > selectedChild = item > item = itemparent > itemparent = item.aq_parent > > basePath = '/'.join(item.getPhysicalPath()) > > catalog = getToolByName(context, 'portal_catalog') > > query = {} > query['sort_on'] = 'getObjPositionInParent' > query['path'] = {'query' : basePath, 'depth' : 1} > > searchresults = catalog.searchResults(query) > > results = [] > for searchitem in searchresults: > obj = searchitem.getObject() > if not obj.exclude_from_nav() and (obj.id != item.defaultView()): > results.append(obj) > > return {'selected':selectedChild, 'contents':results} > > def getThirdLevelList(context): > > context = context.aq_inner > > plone_utils = getToolByName(context, 'plone_utils') > > selectedChild = context > item = context > itemparent = context.aq_parent > > basePath = '/'.join(itemparent.getPhysicalPath()) > > catalog = getToolByName(context, 'portal_catalog') > > query = {} > query['sort_on'] = 'getObjPositionInParent' > query['path'] = {'query' : basePath, 'depth' : 2} > > searchresults = catalog.searchResults(query) > > results = [] > for searchitem in searchresults: > obj = searchitem.getObject() > if not obj.exclude_from_nav() and (obj.id != item.defaultView()): > if (selectedChild == obj.aq_parent or obj.aq_parent == > itemparent): > if(obj.meta_type == 'ATFolder'): > if(obj.aq_parent.meta_type == 'ATFolder'): > if((obj.aq_parent.aq_parent.aq_parent).meta_type == 'Plone > Site'): > results.append(obj) > > return {'selected':selectedChild, 'contents':results} > > modulesecurity.apply(globals()) > > > spero possa servire a qualcuno :-P > > > ciao ryuga > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > View this message in context: > http://n2.nabble.com/Composizione-Menu-a-3-livelli-con-neteasy-tp3992361p3992361.html > Sent from the Plone - Italy mailing list archive at Nabble.com. > > > _______________________________________________ > Plone-IT mailing list > [email protected] > http://lists.plone.org/mailman/listinfo/plone-it > http://www.nabble.com/Plone---Italy-f21728.html > -- "Design is the method of putting form and content together. Design, just as art, has multiple definitions; there is no single definition. Design can be art. Design can be aesthetics. Design is so simple, that's why it is so complicated." by Paul Rand
_______________________________________________ Plone-IT mailing list [email protected] http://lists.plone.org/mailman/listinfo/plone-it http://www.nabble.com/Plone---Italy-f21728.html
