大佬教程收集整理的这篇文章主要介绍了如何获取为自定义portlet管理器分配的Calendar portlet的portlet-hash css类?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<div id="calendar" tal:content="structure provider:my.custom.portletmanager" />
不幸的是,管理器没有为我渲染带有哈希的包装器,所以我试图手动将kssattr-portlethash css类附加到上面的< div>标签,以使月导航工作(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信息,例如经理,类别,密钥和名称,以便正确计算?
我希望我有来自plone.app.portlets.browser.templates的column.pt及其类columnPortletManagerRenderer(portlets / manager.py)所描述的行为,但我不知道如何让我的自定义管理器提供那些(即:like默认经理做).
class MyCustomPortletManagerRenderer(columnPortletManagerRenderer) : """ This custom version of columnPortletManagerRenderer points to a new template so that HTML can be customised. """ adapts(Interface,IThemeSpecific,IBrowserview,IMyCustomPortletManager) template = ViewPageTemplateFile('column.pt') def can_manage_portlets(self): context = self._context() if not ILocalPortletAssignable.providedBy(context): return false mtool = getToolByName(context,'portal_membership') return mtool.checkPermission("Portlets: Manage portlets",context) class MyCustomEditPortletManagerRenderer(ContextualEditPortletManagerRenderer): """To allow edit support of the above. """ adapts(Interface,IManageContextualPortletsView,IMyCustomPortletManager) template = ViewPageTemplateFile('edit-column.pt')
column.pt的位置如下:
<tal:block repeat="portlet options/portlets"> <div tal:attributes="class String:portletWrapper kssattr-portlethash-${portlet/hash};" tal:content="structure python:view.safe_render(portlet['renderer'])" /> </tal:block>
以上是大佬教程为你收集整理的如何获取为自定义portlet管理器分配的Calendar portlet的portlet-hash css类?全部内容,希望文章能够帮你解决如何获取为自定义portlet管理器分配的Calendar portlet的portlet-hash css类?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。