I am trying to customize the "Event" portlet in Plone 3 that shows the upcoming events. The "view" link in the footer of that portlet goes to the /events URL. But my site is multi-lingual so that URL is not always correct. For example, the correct URL for Dutch events should be /evenementen.
我正在尝试自定义Plone 3中的“事件”portlet,它显示了即将发生的事件。该portlet的页脚中的“视图”链接指向/事件URL。但是我的站点是多语言的,所以URL并不总是正确的。例如,荷兰事件的正确URL应该是/evenementen。
In my setup I use one folder per language. /en holds all English content, /nl holds all Dutch content, etcetera. The plone root has no portlets so I add the "Event" portlet to both the /nl and /en folder separately. I was looking in the ZMI at the events.pt template and it seems that it takes the URL from a property, but where is that property defines and how can I change it? I can't find the portlet configurations in the ZMI. Here is the snippet from plone.app.portlets.portlets/events.pt:
在我的设置中,我使用每个语言的一个文件夹。/en包含所有的英语内容,/nl持有所有荷兰语的内容,等等。plone root没有portlet,因此我将“事件”portlet分别添加到/nl和/en文件夹中。我在event .pt模板中查看了ZMI,它似乎从一个属性中获取了URL,但是这个属性定义了什么,我该如何改变它呢?我在ZMI中找不到portlet配置。这里是plone.app.portlets.portlets.p的片段。
<dd class="portletFooter">
<a href=""
class="tile"
tal:attributes="href view/all_events_link"
i18n:translate="box_upcoming_events">
Upcoming events…
</a>
<span class="portletBottomLeft"></span>
<span class="portletBottomRight"></span>
</dd>
So, can I somewhere change that all_events_link property in the ZMI? If so, where?
那么,我能在ZMI中改变all_events_link属性吗?如果是这样的话,在哪里?
As an alternative I have also tried to add a "Collection" portlet with a collection that lists all events. But the problem is that the collection portlet doesn't want to show the start and end dates for the events.
作为另一种选择,我还尝试添加一个包含所有事件的集合的“集合”portlet。但是问题是集合portlet不想显示事件的开始和结束日期。
1 个解决方案
#1
1
The events portlet uses a view to provide it with data, and the expression 'view/all_events_link' calls a method on that view to provide it with a link. You have 2 options to replace that link:
事件portlet使用视图向它提供数据,表达式'view/all_events_link'调用该视图的方法以提供链接。你有两个选择来取代那个链接:
-
Register your own event portlet that subclasses the old one, and replaces the all_events_link method. This in the heavy customization option, and requires Python coding. See this mail thread on some general pointers on how to achieve this.
注册您自己的事件portlet,将其子类化,并替换all_events_link方法。这在繁重的定制选项中,需要Python编码。关于如何实现这一点,请参阅此邮件线程。
-
Replace just the template with a portlet renderer. Martin Aspeli has documented this method on Plone.org; this only requires some ZCML configuration to get working. You can then copy the events.pt template and replace the portlet footer with one that links to the right location.
仅用portlet渲染器替换模板。Martin Aspeli在Plone.org上记录了这个方法;这只需要一些ZCML配置就可以工作了。然后可以复制events.pt模板并将portlet页脚替换为指向正确位置的链接。
#1
1
The events portlet uses a view to provide it with data, and the expression 'view/all_events_link' calls a method on that view to provide it with a link. You have 2 options to replace that link:
事件portlet使用视图向它提供数据,表达式'view/all_events_link'调用该视图的方法以提供链接。你有两个选择来取代那个链接:
-
Register your own event portlet that subclasses the old one, and replaces the all_events_link method. This in the heavy customization option, and requires Python coding. See this mail thread on some general pointers on how to achieve this.
注册您自己的事件portlet,将其子类化,并替换all_events_link方法。这在繁重的定制选项中,需要Python编码。关于如何实现这一点,请参阅此邮件线程。
-
Replace just the template with a portlet renderer. Martin Aspeli has documented this method on Plone.org; this only requires some ZCML configuration to get working. You can then copy the events.pt template and replace the portlet footer with one that links to the right location.
仅用portlet渲染器替换模板。Martin Aspeli在Plone.org上记录了这个方法;这只需要一些ZCML配置就可以工作了。然后可以复制events.pt模板并将portlet页脚替换为指向正确位置的链接。