src/pyams_skin/interfaces/configuration.py
changeset 557 bca7a7e058a3
equal deleted inserted replaced
-1:000000000000 557:bca7a7e058a3
       
     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 from zope.location.interfaces import IContained
       
    16 from zope.schema import Bool, Text, TextLine
       
    17 
       
    18 from pyams_file.schema import ImageField
       
    19 
       
    20 from pyams_skin import _
       
    21 
       
    22 
       
    23 SKIN_CONFIGURATION_KEY = 'pyams_skin.configuration'
       
    24 
       
    25 
       
    26 class IConfiguration(IContained):
       
    27     """Dynamic application global configuration
       
    28 
       
    29     These settings are generally managed by an administrator.
       
    30     They are used by default presentation layout.
       
    31     """
       
    32 
       
    33     title = TextLine(title=_("Title"),
       
    34                      description=_("Application title displayed in title bar"),
       
    35                      required=False)
       
    36 
       
    37     short_title = TextLine(title=_("Short title"),
       
    38                            description=_("Application short title visible as title prefix"),
       
    39                            required=False)
       
    40 
       
    41     def get_title_prefix(self, request):
       
    42         """Get title prefix based on current navigation context"""
       
    43 
       
    44     description = Text(title=_("Description"),
       
    45                        description=_("Main application description"),
       
    46                        required=False)
       
    47 
       
    48     author = TextLine(title=_("Author"),
       
    49                       description=_("Public author name"),
       
    50                       required=False)
       
    51 
       
    52     icon = ImageField(title=_("Icon"),
       
    53                       description=_("Browser favourite icon"),
       
    54                       required=False)
       
    55 
       
    56     logo = ImageField(title=_("Logo"),
       
    57                       description=_("Image containing application logo"),
       
    58                       required=False)
       
    59 
       
    60 
       
    61 SKIN_BACK_CONFIGURATION_KEY = 'pyams_skin.back-office.configuration'
       
    62 
       
    63 
       
    64 class IBackOfficeConfiguration(IContained):
       
    65     """Back-office configuration"""
       
    66 
       
    67     title = TextLine(title=_("Title"),
       
    68                      description=_("Application title visible in back-office"),
       
    69                      required=False)
       
    70 
       
    71     short_title = TextLine(title=_("Short title"),
       
    72                            description=_("Application short title visible as title prefix"),
       
    73                            required=False)
       
    74 
       
    75     def get_title_prefix(self, request):
       
    76         """Get title prefix based on current navigation context"""
       
    77 
       
    78     login_header = Text(title=_("Login header"),
       
    79                         description=_("This reStructuredText text will be displayed in login page header"),
       
    80                         required=False)
       
    81 
       
    82     login_footer = Text(title=_("Login footer"),
       
    83                         description=_("This reStructuredText text will be displayed in login page footer"),
       
    84                         required=False)
       
    85 
       
    86     icon = ImageField(title=_("Icon"),
       
    87                       description=_("Browser favourite icon"),
       
    88                       required=False)
       
    89 
       
    90     logo = ImageField(title=_("Logo"),
       
    91                       description=_("Image containing application logo"),
       
    92                       required=False)
       
    93 
       
    94     login_logo = ImageField(title=_("Login logo"),
       
    95                             description=_("Image containing application logo for login form"),
       
    96                             required=False)
       
    97 
       
    98     display_content_icon = Bool(title=_("Display title icon?"),
       
    99                                 description=_("Should icons be displayed into content's title area ?"),
       
   100                                 required=True,
       
   101                                 default=True)
       
   102 
       
   103     display_shared_tool_title = Bool(title=_("Display shared tool title?"),
       
   104                                      description=_("Should shared tool title be displayed into shared content's title "
       
   105                                                    "area?"),
       
   106                                      required=True,
       
   107                                      default=True)