src/pyams_content/shared/site/interfaces.py
changeset 1420 f2cc8872bcc1
parent 1384 cdf63a1c7dc9
child 1452 f5eca01f0a1d
equal deleted inserted replaced
1419:d565e0a0c8f3 1420:f2cc8872bcc1
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
     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
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY
       
    13 
       
    14 
       
    15 __docformat__ = 'restructuredtext'
       
    16 
    12 
    17 from collections import OrderedDict
    13 from collections import OrderedDict
    18 
    14 
    19 from zope.annotation.interfaces import IAttributeAnnotatable
    15 from zope.annotation.interfaces import IAttributeAnnotatable
    20 from zope.container.constraints import containers, contains
    16 from zope.container.constraints import containers, contains
    21 from zope.container.interfaces import IContained, IContainer
    17 from zope.container.interfaces import IContained, IContainer
    22 from zope.interface import Attribute, Interface
    18 from zope.interface import Attribute, Interface
    23 from zope.schema import Bool, Choice, Text, URI
    19 from zope.schema import Bool, Choice, Text, URI
    24 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
    20 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
    25 
    21 
    26 from pyams_content import _
       
    27 from pyams_content.interfaces import IBaseContent
    22 from pyams_content.interfaces import IBaseContent
    28 from pyams_content.shared.common.interfaces import IBaseContentManagerRoles, IBaseSharedTool, IDeletableElement, \
    23 from pyams_content.shared.common.interfaces import IBaseContentManagerRoles, IBaseSharedTool, \
    29     ISharedSite
    24     IDeletableElement, ISharedSite
       
    25 from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY
    30 from pyams_content.shared.topic.interfaces import ITopic, IWfTopic, IWfTopicFactory
    26 from pyams_content.shared.topic.interfaces import ITopic, IWfTopic, IWfTopicFactory
    31 from pyams_i18n.schema import I18nTextField, I18nTextLineField
    27 from pyams_i18n.schema import I18nTextField, I18nTextLineField
    32 from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList, ISequentialIdTarget
    28 from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList, \
       
    29     ISequentialIdTarget
    33 from pyams_workflow.interfaces import IWorkflowPublicationSupport
    30 from pyams_workflow.interfaces import IWorkflowPublicationSupport
       
    31 
       
    32 
       
    33 __docformat__ = 'restructuredtext'
       
    34 
       
    35 from pyams_content import _
    34 
    36 
    35 
    37 
    36 FOLDER_REDIRECT_DISPLAY_MODE = 'redirect'
    38 FOLDER_REDIRECT_DISPLAY_MODE = 'redirect'
    37 FOLDER_TEMPLATE_DISPLAY_MODE = 'template'
    39 FOLDER_TEMPLATE_DISPLAY_MODE = 'template'
    38 
    40 
    39 FOLDER_DISPLAY_MODES = OrderedDict((
    41 FOLDER_DISPLAY_MODES = OrderedDict((
    40     (FOLDER_REDIRECT_DISPLAY_MODE, _("Redirect to first visible sub-folder or content")),
    42     (FOLDER_REDIRECT_DISPLAY_MODE, _("Redirect to first visible sub-folder or content")),
    41     (FOLDER_TEMPLATE_DISPLAY_MODE, _("Use presentation template"))
    43     (FOLDER_TEMPLATE_DISPLAY_MODE, _("Use presentation template"))
    42 ))
    44 ))
    43 
    45 
    44 FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in FOLDER_DISPLAY_MODES.items()])
    46 FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t)
       
    47                                                    for v, t in FOLDER_DISPLAY_MODES.items()])
    45 
    48 
    46 
    49 
    47 class ISiteElement(IContained, IDeletableElement):
    50 class ISiteElement(IContained, IDeletableElement):
    48     """Base site element interface"""
    51     """Base site element interface"""
    49 
    52 
    83     header = I18nTextField(title=_("Header"),
    86     header = I18nTextField(title=_("Header"),
    84                            description=_("Heading displayed according to presentation template"),
    87                            description=_("Heading displayed according to presentation template"),
    85                            required=False)
    88                            required=False)
    86 
    89 
    87     description = I18nTextField(title=_("Meta-description"),
    90     description = I18nTextField(title=_("Meta-description"),
    88                                 description=_("The folder's description is 'hidden' into HTML's page headers; but it "
    91                                 description=_("The folder's description is 'hidden' into HTML's "
    89                                               "can be seen, for example, in some search engines results as content's "
    92                                               "page headers; but it can be seen, for example, in "
    90                                               "description; if description is empty, content's header will be used."),
    93                                               "some search engines results as content's "
       
    94                                               "description; if description is empty, content's "
       
    95                                               "header will be used."),
    91                                 required=False)
    96                                 required=False)
    92 
    97 
    93     notepad = Text(title=_("Notepad"),
    98     notepad = Text(title=_("Notepad"),
    94                    description=_("Internal information to be known about this content"),
    99                    description=_("Internal information to be known about this content"),
    95                    required=False)
   100                    required=False)
    96 
   101 
    97     visible_in_list = Bool(title=_("Visible in folders list"),
   102     visible_in_list = Bool(title=_("Visible in folders list"),
    98                            description=_("If 'no', folder will not be displayed into folders list"),
   103                            description=_("If 'no', folder will not be displayed into folders "
       
   104                                          "list"),
    99                            required=True,
   105                            required=True,
   100                            default=True)
   106                            default=True)
   101 
   107 
   102     navigation_title = I18nTextLineField(title=_("Navigation title"),
   108     navigation_title = I18nTextLineField(title=_("Navigation title"),
   103                                          description=_("Folder's title displayed in navigation pages; "
   109                                          description=_("Folder's title displayed in navigation "
   104                                                        "original title will be used if none is specified"),
   110                                                        "pages; original title will be used if "
       
   111                                                        "none is specified"),
   105                                          required=False)
   112                                          required=False)
   106 
   113 
   107     navigation_mode = Choice(title=_("Navigation mode"),
   114     navigation_mode = Choice(title=_("Navigation mode"),
   108                              description=_("Folder behaviour when navigating to folder URL"),
   115                              description=_("Folder behaviour when navigating to folder URL"),
   109                              required=True,
   116                              required=True,
   117 
   124 
   118 class ISiteFolderRoles(IBaseContentManagerRoles):
   125 class ISiteFolderRoles(IBaseContentManagerRoles):
   119     """Site folder roles interface"""
   126     """Site folder roles interface"""
   120 
   127 
   121 
   128 
   122 class ISiteManager(ISharedSite, ISiteContainer, IBaseSharedTool, IDeletableElement, ISequentialIdTarget):
   129 class ISiteManager(ISharedSite, ISiteContainer, IBaseSharedTool,
       
   130                    IDeletableElement, ISequentialIdTarget):
   123     """Site manager interface"""
   131     """Site manager interface"""
   124 
   132 
   125     contains(ISiteElement)
   133     contains(ISiteElement)
   126 
   134 
   127     folder_factory = Attribute("Folder factory")
   135     folder_factory = Attribute("Folder factory")
   128 
   136 
   129     topic_content_type = Attribute("Topic content type")
   137     topic_content_type = Attribute("Topic content type")
   130     topic_content_factory = Attribute("Topic content factory")
   138     topic_content_factory = Attribute("Topic content factory")
   131 
   139 
       
   140     header = I18nTextField(title=_("Header"),
       
   141                            description=_("Site's header is generally displayed in page header"),
       
   142                            required=False)
       
   143 
   132     description = I18nTextField(title=_("Meta-description"),
   144     description = I18nTextField(title=_("Meta-description"),
   133                                 description=_("The site's description is 'hidden' into HTML's page headers; but it "
   145                                 description=_("The site's description is 'hidden' into HTML's "
   134                                               "can be seen, for example, in some search engines results as content's "
   146                                               "page headers; but it can be seen, for example, in "
   135                                               "description; if description is empty, content's header will be used."),
   147                                               "some search engines results as content's "
       
   148                                               "description; if description is empty, content's "
       
   149                                               "header will be used."),
   136                                 required=False)
   150                                 required=False)
   137 
   151 
   138     notepad = Text(title=_("Notepad"),
   152     notepad = Text(title=_("Notepad"),
   139                    description=_("Internal information to be known about this content"),
   153                    description=_("Internal information to be known about this content"),
   140                    required=False)
   154                    required=False)
   167 
   181 
   168 class ISiteLink(ISiteElement):
   182 class ISiteLink(ISiteElement):
   169     """Site link interface"""
   183     """Site link interface"""
   170 
   184 
   171     navigation_title = I18nTextLineField(title=_("Navigation title"),
   185     navigation_title = I18nTextLineField(title=_("Navigation title"),
   172                                          description=_("Alternate content's title displayed in navigation pages; "
   186                                          description=_("Alternate content's title displayed in "
   173                                                        "original title will be used if none is specified"),
   187                                                        "navigation pages; original title will be "
       
   188                                                        "used if none is specified"),
   174                                          required=False)
   189                                          required=False)
   175 
   190 
   176     show_header = Bool(title=_("Show header?"),
   191     show_header = Bool(title=_("Show header?"),
   177                        description=_("If 'no', no header will be displayed"),
   192                        description=_("If 'no', no header will be displayed"),
   178                        required=False,
   193                        required=False,
   179                        default=True)
   194                        default=True)
   180 
   195 
   181     navigation_header = I18nTextField(title=_("Navigation header"),
   196     navigation_header = I18nTextField(title=_("Navigation header"),
   182                                       description=_("Alternate content's header displayed in navigation pages; "
   197                                       description=_("Alternate content's header displayed in "
   183                                                     "original header will be used if none is specified"),
   198                                                     "navigation pages; original header will be "
       
   199                                                     "used if none is specified"),
   184                                       required=False)
   200                                       required=False)
   185 
   201 
   186     visible = Bool(title=_("Visible?"),
   202     visible = Bool(title=_("Visible?"),
   187                    description=_("If 'no', link is not visible"),
   203                    description=_("If 'no', link is not visible"),
   188                    required=True,
   204                    required=True,