# HG changeset patch # User Thierry Florac # Date 1507877158 -7200 # Node ID f08f65ad0818cff3fa7474089a70b02a01d1a35e # Parent fbca11f0c1f4738b20cae05e1df470a083bfec3a Updated preview management diff -r fbca11f0c1f4 -r f08f65ad0818 src/pyams_content/shared/view/zmi/preview.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/view/zmi/preview.py Fri Oct 13 08:45:58 2017 +0200 @@ -0,0 +1,39 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# 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.zmi import IPreviewForm +from pyams_content.shared.view.interfaces import IWfView +from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager +from pyams_skin.layer import IPyAMSLayer +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION + +# import packages +from pyams_template.template import template_config +from pyams_viewlet.viewlet import viewlet_config + + +@viewlet_config(name='view-preview', context=IWfView, layer=IPyAMSLayer, + view=IPreviewForm, manager=IWidgetsSuffixViewletsManager, + permission=VIEW_SYSTEM_PERMISSION, weight=100) +@template_config(template='templates/preview.pt', layer=IPyAMSLayer) +class SharedViewPreview(object): + """Shared view preview""" + + @property + def items(self): + return self.context.get_results(self.context) diff -r fbca11f0c1f4 -r f08f65ad0818 src/pyams_content/shared/view/zmi/summary.py --- a/src/pyams_content/shared/view/zmi/summary.py Fri Oct 13 08:44:18 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -# -# Copyright (c) 2008-2015 Thierry Florac -# 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.zmi import IInnerSummaryView -from pyams_content.shared.view.interfaces import IWfView -from pyams_form.interfaces.form import IInnerTabForm -from pyams_skin.layer import IPyAMSLayer -from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION - -# import packages -from pyams_content.shared.common.zmi.summary import SharedContentSummaryForm -from pyams_pagelet.pagelet import pagelet_config -from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config -from pyams_zmi.form import InnerAdminDisplayForm -from z3c.form import field -from zope.interface import implementer, Interface - -from pyams_content import _ - - -@adapter_config(name='view-summary', - context=(IWfView, IPyAMSLayer, SharedContentSummaryForm), - provides=IInnerTabForm) -class SharedViewSummaryForm(InnerAdminDisplayForm): - """Shared view summary""" - - weight = 20 - tab_label = _("Quick preview") - tab_target = 'view-summary.html' - - fields = field.Fields(Interface) - - -@pagelet_config(name='view-summary.html', context=IWfView, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION) -@template_config(template='templates/summary.pt', layer=IPyAMSLayer) -@implementer(IInnerSummaryView) -class SharedViewSummaryView(object): - """Shared view summary view""" - - def __init__(self, context, request): - super(SharedViewSummaryView, self).__init__(context, request) - - @property - def items(self): - return self.context.get_results(self.context) diff -r fbca11f0c1f4 -r f08f65ad0818 src/pyams_content/shared/view/zmi/templates/preview.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/view/zmi/templates/preview.pt Fri Oct 13 08:45:58 2017 +0200 @@ -0,0 +1,9 @@ +
+ View result items +
+ WARNING: items displayed in this preview are out of context!! +
+ +
+
+
diff -r fbca11f0c1f4 -r f08f65ad0818 src/pyams_content/shared/view/zmi/templates/summary.pt --- a/src/pyams_content/shared/view/zmi/templates/summary.pt Fri Oct 13 08:44:18 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -
- View result items - -
-
-