src/pyams_portal/zmi/portlets/context.py
changeset 5 670b7956c689
parent 4 a5f118662d87
child 6 f88ccd965f2d
equal deleted inserted replaced
4:a5f118662d87 5:670b7956c689
     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_pagelet.interfaces import IPagelet
       
    20 from pyams_portal.interfaces import IPortletPreviewer
       
    21 from pyams_portal.portlets.context.interfaces import IContextPortletConfiguration
       
    22 from pyams_skin.layer import IPyAMSLayer
       
    23 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
       
    24 
       
    25 # import packages
       
    26 from pyams_form.form import AJAXEditForm
       
    27 from pyams_pagelet.pagelet import pagelet_config
       
    28 from pyams_portal.portlet import PortletPreviewer
       
    29 from pyams_portal.zmi.portlet import PortletConfigurationEditor
       
    30 from pyams_template.template import template_config
       
    31 from pyams_utils.adapter import adapter_config
       
    32 from zope.interface import Interface
       
    33 
       
    34 
       
    35 @pagelet_config(name='properties.html', context=IContextPortletConfiguration, request_type=IPyAMSLayer,
       
    36                 permission=VIEW_SYSTEM_PERMISSION)
       
    37 class ContextPortletConfigurationEditor(PortletConfigurationEditor):
       
    38     """Context portlet configuration editor"""
       
    39 
       
    40     interface = IContextPortletConfiguration
       
    41 
       
    42 
       
    43 @adapter_config(name='properties.json', context=(IContextPortletConfiguration, IPyAMSLayer), provides=IPagelet)
       
    44 class ContextPortletConfigurationAJAXEditor(AJAXEditForm, ContextPortletConfigurationEditor):
       
    45     """Context portlet configuration editor, AJAX renderer"""
       
    46 
       
    47 
       
    48 @adapter_config(context=(Interface, IPyAMSLayer, Interface, IContextPortletConfiguration),
       
    49                 provides=IPortletPreviewer)
       
    50 @template_config(template='templates/context-preview.pt', layer=IPyAMSLayer)
       
    51 class ContextPortletPreviewer(PortletPreviewer):
       
    52     """Context portlet previewer"""