如何获取分配给自定义 portlet 管理器的日历 portlet 的 portlet-hash css 类?
我正在尝试修复分配给自定义 Portlet 管理器的日历 Portlet 的月份导航。该管理器是从特定的浏览器页面模板调用的:
<div id="calendar"
tal:content="structure provider:my.custom.portletmanager" />
不幸的是,管理器没有为我渲染带有哈希值的包装器,因此我尝试手动将 kssattr-portlethash css 类附加到位于
标记之上,以便月份导航正常工作(refreshPortlet() 需要它)。我尝试了这个:from plone.portlets.utils import hashPortletInfo
class SectionHomeView(BrowserView):
"""SectionHome browser view
"""
implements(ISectionHomeView)
def __init__(self, context, request):
self.context = context
self.request = request
@property
def getHash(self):
info = dict(manager = 'my.custom.portletmanager',
category = 'context',
key = '/my-section',
name = 'mycalendar',
)
return hashPortletInfo(info)
使用此代码我确实得到了哈希值,但日历导航仍然不起作用。 如何访问 portlet 信息(例如管理器、类别、键和名称)以便正确计算它?
我希望我具有 column.pt 所描述的行为 < em>plone.app.portlets.browser.templates 及其类 ColumnPortletManagerRenderer (portlets/manager.py) 但我不知道如何使我的自定义管理器提供那些(即:就像默认管理器一样)。
I'm trying to fix the month navigation of a calendar portlet assigned for a custom portlet manager. This manager is called from a specific browser page template with:
<div id="calendar"
tal:content="structure provider:my.custom.portletmanager" />
Unfortunately the manager doesn't render a wrapper with the hash for me, so I'm trying to manually append a kssattr-portlethash css class to the above <div>
tag in order to make the month navigation work (refreshPortlet() needs it). I tried this:
from plone.portlets.utils import hashPortletInfo
class SectionHomeView(BrowserView):
"""SectionHome browser view
"""
implements(ISectionHomeView)
def __init__(self, context, request):
self.context = context
self.request = request
@property
def getHash(self):
info = dict(manager = 'my.custom.portletmanager',
category = 'context',
key = '/my-section',
name = 'mycalendar',
)
return hashPortletInfo(info)
Using this code I do get a hash, but calendar navigation still doesn't work. How can I access the portlet info such as manager, category, key and name in order to compute it right?
I wish I had the behaviour described by column.pt from plone.app.portlets.browser.templates and its class ColumnPortletManagerRenderer (portlets/manager.py) but I don't know how to make my custom manager provide those (ie: like the default managers do).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要确保安装了知道渲染散列的 PortletManagerRenderer 和 EditPortletManagerRenderer,例如:
其中 column.pt 如下所示:
You need to make sure you have a PortletManagerRenderer and an EditPortletManagerRenderer installed that know to render hashes, such as:
Where column.pt looks like: