src/pyams_skin/interfaces/__init__.py
changeset 0 bb4aabe07487
child 1 7fc1c60c01eb
equal deleted inserted replaced
-1:000000000000 0:bb4aabe07487
       
     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 # import standard library
       
    16 
       
    17 # import interfaces
       
    18 from zope.component.interfaces import IObjectEvent, ObjectEvent
       
    19 
       
    20 # import packages
       
    21 from zope.interface import implementer, Interface, Attribute
       
    22 from zope.configuration.fields import GlobalInterface
       
    23 from zope.schema import Text, TextLine, Choice, Int
       
    24 
       
    25 from pyams_skin import _
       
    26 
       
    27 
       
    28 class ISkin(Interface):
       
    29     """Skin interface
       
    30 
       
    31     Skins are registered as utilities implementing this interface
       
    32     and defining request layer as attribute
       
    33     """
       
    34 
       
    35     label = TextLine(title="Skin name")
       
    36 
       
    37     layer = GlobalInterface(title="Request layer",
       
    38                             description="This interface will be used to tag request layer",
       
    39                             required=True)
       
    40 
       
    41 
       
    42 class ISkinChangedEvent(IObjectEvent):
       
    43     """Skin changed event"""
       
    44 
       
    45 
       
    46 @implementer(ISkinChangedEvent)
       
    47 class SkinChangedEvent(ObjectEvent):
       
    48     """Request skin changed event"""
       
    49 
       
    50 
       
    51 class ISkinnable(Interface):
       
    52     """Skinnable content interface"""
       
    53 
       
    54     def get_skin(self, request=None):
       
    55         """Get skin matching this content"""
       
    56 
       
    57 
       
    58 class IUserSkinnable(ISkinnable):
       
    59     """User skinnable content interface"""
       
    60 
       
    61     skin = Choice(title=_("Presentation skin"),
       
    62                   description=_("This skin will be used to handle presentation templates"),
       
    63                   vocabulary='PyAMS skins')
       
    64 
       
    65 
       
    66 class IFullPage(Interface):
       
    67     """Full page marker interface"""
       
    68 
       
    69 
       
    70 class IModalFullPage(IFullPage):
       
    71     """Full page modal dialog marker interface"""
       
    72 
       
    73     dialog_class = Attribute("Default dialog CSS class")
       
    74 
       
    75 
       
    76 class IInnerPage(Interface):
       
    77     """Inner page marker interface"""
       
    78 
       
    79 
       
    80 class IModalPage(Interface):
       
    81     """Modal page marker interface"""
       
    82 
       
    83 
       
    84 class IDialog(IModalPage):
       
    85     """Modal dialog interface"""
       
    86 
       
    87     modal_class = TextLine(title="Modal dialog CSS class",
       
    88                            default='modal-medium')
       
    89 
       
    90 
       
    91 class IPageHeader(Interface):
       
    92     """Page header interface used by 'header' content provider"""
       
    93 
       
    94     icon_class = TextLine(title='Icon CSS class')
       
    95 
       
    96     title = TextLine(title='Page title')
       
    97 
       
    98     subtitle = TextLine(title='Page sub-title')
       
    99 
       
   100 
       
   101 class IContentHelp(Interface):
       
   102     """Content help block"""
       
   103 
       
   104     outer_margin = Int(title='Outer margin size',
       
   105                        default=0)
       
   106 
       
   107     status = TextLine(title='Help status',
       
   108                       default='info')
       
   109 
       
   110     header = TextLine(title='Help header')
       
   111 
       
   112     message = Text(title='Help message')
       
   113 
       
   114     message_format = Choice(title='Help message format',
       
   115                             vocabulary='PyAMS HTML renderers')
       
   116 
       
   117 
       
   118 class IContentSearch(Interface):
       
   119     """Content search interface"""
       
   120 
       
   121     def get_search_results(self, data):
       
   122         """Extract search results from given data
       
   123 
       
   124         `data` is a dictionary containing search fields
       
   125         """
       
   126 
       
   127 
       
   128 class ISearchPage(Interface):
       
   129     """Search page marker interface"""