这是我的做法。它至少适用于 plone 4.2.4。
由于问题是显示问题,我只需要调整我的 historyviewlet。因此,我创建了一个以viewlets我的产品根目录命名的文件夹并创建了一个__init__.py和一个configure.zcml文件。然后我将content_history.pt, history_view.pt,review_history.pt和content.py从plone/app/layout/viewlets/(omelette) 复制到新创建的文件夹中。
configure.zcml包含两个视图注册:
<browser:view
for="*"
name="my-contenthistory"
class=".content.ContentHistoryView"
permission="zope2.View"
/>
<browser:page
for="*"
name="my-historyview"
template="history_view.pt"
permission="zope2.View"
/>
此外,我将整个WorkflowHistoryViewlet班级从复制content.py到不同的班级名称。TransferHistory在这种情况下。然后我主要更改了与工作流状态变量相对应的部分,它不是review_state,而是transfer_state。我进一步发现,第二个工作流程的初始使用还在第二个工作流程created的历史记录中创建了一个条目,我刚刚过滤了 .
transfer_history = [x for x in transfer_history if x['action'] != None]
我将视图名称更正history_view.pt为我的新视图名称。
<div tal:replace="structure here/@@my-contenthistory">Content History</div>
最后,我将我的班级作为父母添加到ContentHistoryViewlet班级中content.py
class ContentHistoryViewlet(WorkflowHistoryViewlet, TransferHistoryViewlet):
index = ViewPageTemplateFile("content_history.pt")
@memoize
def getUserInfo(self, userid):
[...]
def fullHistory(self):
history = self.workflowHistory() + self.revisionHistory() + self.transferHistory()
if len(history) == 0:
return None
history.sort(key=lambda x: x["time"], reverse=True)
return history
并在产品中注册了.zcmlconfigure.zcml
<include package=".viewlets" />
然后我修改content_history.pt并更改了action_id文件上部的定义。
[...]
action_id python:item['action'] or item.get('review_state', False) or item.get('transfer_state', False);
[...]
重新启动怪物并重新安装产品后,两个工作流的所有状态更改都显示在 my-historyview 中。