src/pyams_content/shared/view/zmi/preview.py
changeset 232 f08f65ad0818
parent 92 3facc843c06f
child 268 b8b918680c52
equal deleted inserted replaced
231:fbca11f0c1f4 232:f08f65ad0818
       
     1 #
       
     2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from pyams_content.shared.common.interfaces.zmi import IPreviewForm
       
    20 from pyams_content.shared.view.interfaces import IWfView
       
    21 from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager
       
    22 from pyams_skin.layer import IPyAMSLayer
       
    23 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
       
    24 
       
    25 # import packages
       
    26 from pyams_template.template import template_config
       
    27 from pyams_viewlet.viewlet import viewlet_config
       
    28 
       
    29 
       
    30 @viewlet_config(name='view-preview', context=IWfView, layer=IPyAMSLayer,
       
    31                 view=IPreviewForm, manager=IWidgetsSuffixViewletsManager,
       
    32                 permission=VIEW_SYSTEM_PERMISSION, weight=100)
       
    33 @template_config(template='templates/preview.pt', layer=IPyAMSLayer)
       
    34 class SharedViewPreview(object):
       
    35     """Shared view preview"""
       
    36 
       
    37     @property
       
    38     def items(self):
       
    39         return self.context.get_results(self.context)