On 07.01.2009 6:55 Uhr, hannesc wrote:
I am busy doing a theme as a stand-alone product and I was wondering if there
was a way of telling Plone 3 to hide all portlets except the one that I
specify (these would be custom templates that I created).
Eg. I need all portlets in column two to be disabled, and only the search
and navigation portlets to be displayed in column one (in that order).
Example code from a late project (you have to adjust it yourself
to your needs):
from Acquisition import aq_inner
from Products.Five.utilities import marker
from plone.app.layout.navigation.interfaces import INavigationRoot
from zope.component import getMultiAdapter, getUtility
from plone.portlets.interfaces import IPortletManager
from plone.portlets.interfaces import ILocalPortletAssignmentManager
from plone.portlets.interfaces import IPortletAssignmentMapping
from plone.app.portlets.interfaces import IPortletPermissionChecker
from plone.portlets.constants import USER_CATEGORY
from plone.portlets.constants import GROUP_CATEGORY
from plone.portlets.constants import CONTENT_TYPE_CATEGORY
from plone.portlets.constants import CONTEXT_CATEGORY
marker.mark(context, INavigationRoot)
for name in ('plone.leftcolumn', 'plone.rightcolumn'):
portletManager = getUtility(IPortletManager, name=name)
assignable = getMultiAdapter((context, portletManager,),
ILocalPortletAssignmentManager)
assignments = getMultiAdapter((context, portletManager),
IPortletAssignmentMapping)
IPortletPermissionChecker(assignments.__of__(aq_inner(context)))()
assignable.setBlacklistStatus(GROUP_CATEGORY, None)
assignable.setBlacklistStatus(CONTENT_TYPE_CATEGORY, None)
assignable.setBlacklistStatus(CONTEXT_CATEGORY, True)
from plone.app.portlets.portlets import navigation
portletManager = getUtility(IPortletManager, name='plone.leftcolumn',
context=context)
left = getMultiAdapter((context, portletManager,),
IPortletAssignmentMapping, context=context)
left[u'navigation'] = navigation.Assignment()
return 'done'
--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [email protected] - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[email protected]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers