--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/zmi/preview.py Fri Oct 13 08:37:49 2017 +0200
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_content.shared.common.interfaces.zmi import IPreviewForm
+from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+from pyams_zmi.layer import IAdminLayer
+
+# import packages
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.viewlet.toolbar import ToolbarAction
+from pyams_viewlet.viewlet import viewlet_config
+from pyams_zmi.form import AdminDialogDisplayForm
+from z3c.form import field
+from zope.interface import implementer, Interface
+
+from pyams_content import _
+
+
+@viewlet_config(name='preview.action', context=IWfSharedContent, layer=IAdminLayer, view=Interface,
+ manager=IToolbarViewletManager, permisison=VIEW_SYSTEM_PERMISSION, weight=50)
+class WfSharedContentPreviewAction(ToolbarAction):
+ """Shared content preview action"""
+
+ label = _("Preview")
+
+ group_css_class = 'btn-group margin-right-10'
+ label_css_class = 'fa fa-newspaper-o'
+ css_class = 'btn btn-xs btn-default'
+
+ url = 'preview.html'
+ modal_target = True
+
+
+@pagelet_config(name='preview.html', context=IWfSharedContent, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@implementer(IPreviewForm)
+class WfSharedContentPreviewForm(AdminDialogDisplayForm):
+ """Shared content preview"""
+
+ legend = _("Content preview")
+ dialog_class = 'modal-max'
+
+ fields = field.Fields(Interface)