使用plone.org上的文档以及论坛中的一些文档,我能够在Plone 4.0.8中的内容下面获得一个自定义portlet管理器.实际上,目标是在内容之下安排4个自定义管理器,就像仪表板一样.
无论如何,我的经理只允许我添加静态和集合portlet.在查看代码后,我发现当系统填充"添加新portlet"下拉列表时,它会循环遍历所有portlet.然后,它遍历每个portlet的'for_'属性检查,以查看接口是否由self-my portlet manager提供.
def getAddablePortletTypes(self):
addable = []
for p in getUtilitiesFor(IPortletType):
# BBB - first condition, because starting with Plone 3.1
#every p[1].for_ should be a list
if not isinstance(p[1].for_, list):
logger.warning("Deprecation Warning ..." % p[1].addview)
if p[1].for_ is None or p[1].for_.providedBy(self):
addable.append(p[1])
elif [i for i in p[1].for_ if i.providedBy(self)]:
addable.append(p[1])
return addable
Run Code Online (Sandbox Code Playgroud)
如何将我的经理界面添加到每个portlet的'for_'接口列表中?
您的评论可能是最好的方法.这里的关键是portlet本身被注册到portlet管理器接口,以及上下文,层等的其他接口.例如,另一种方法是在profiles/default/portlets.xml中添加其他注册.将文件添加到您想要添加的每个portlet的portlet管理器界面:
<portlet
addview="portlets.News"
title="News"
description="A portlet which can render a listing of recent news"
i18n:attributes="title;
description"
>
<for interface="your.package.IYourPortletManager" />
</portlet>
Run Code Online (Sandbox Code Playgroud)
然而,你的方式可能是最好的,因为它听起来像你正在创建一个柱状portlet管理器.但是,您可以从基类中删除IPortletManager,因为IColumn已经将它子类化了.