# HG changeset patch # User Thierry Florac # Date 1599492359 -7200 # Node ID f2cc8872bcc1bc6955cb88e6a79edb0ecb23c565 # Parent d565e0a0c8f3dce7b0f0d68bc8b422ba5f9c92df Added header field to site manager diff -r d565e0a0c8f3 -r f2cc8872bcc1 src/pyams_content/shared/site/interfaces.py --- a/src/pyams_content/shared/site/interfaces.py Wed Sep 02 17:48:47 2020 +0200 +++ b/src/pyams_content/shared/site/interfaces.py Mon Sep 07 17:25:59 2020 +0200 @@ -9,10 +9,6 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # -from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY - - -__docformat__ = 'restructuredtext' from collections import OrderedDict @@ -23,16 +19,22 @@ from zope.schema import Bool, Choice, Text, URI from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary -from pyams_content import _ from pyams_content.interfaces import IBaseContent -from pyams_content.shared.common.interfaces import IBaseContentManagerRoles, IBaseSharedTool, IDeletableElement, \ - ISharedSite +from pyams_content.shared.common.interfaces import IBaseContentManagerRoles, IBaseSharedTool, \ + IDeletableElement, ISharedSite +from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY from pyams_content.shared.topic.interfaces import ITopic, IWfTopic, IWfTopicFactory from pyams_i18n.schema import I18nTextField, I18nTextLineField -from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList, ISequentialIdTarget +from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList, \ + ISequentialIdTarget from pyams_workflow.interfaces import IWorkflowPublicationSupport +__docformat__ = 'restructuredtext' + +from pyams_content import _ + + FOLDER_REDIRECT_DISPLAY_MODE = 'redirect' FOLDER_TEMPLATE_DISPLAY_MODE = 'template' @@ -41,7 +43,8 @@ (FOLDER_TEMPLATE_DISPLAY_MODE, _("Use presentation template")) )) -FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in FOLDER_DISPLAY_MODES.items()]) +FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) + for v, t in FOLDER_DISPLAY_MODES.items()]) class ISiteElement(IContained, IDeletableElement): @@ -85,9 +88,11 @@ required=False) description = I18nTextField(title=_("Meta-description"), - description=_("The folder's description is 'hidden' into HTML's page headers; but it " - "can be seen, for example, in some search engines results as content's " - "description; if description is empty, content's header will be used."), + description=_("The folder's description is 'hidden' into HTML's " + "page headers; but it can be seen, for example, in " + "some search engines results as content's " + "description; if description is empty, content's " + "header will be used."), required=False) notepad = Text(title=_("Notepad"), @@ -95,13 +100,15 @@ required=False) visible_in_list = Bool(title=_("Visible in folders list"), - description=_("If 'no', folder will not be displayed into folders list"), + description=_("If 'no', folder will not be displayed into folders " + "list"), required=True, default=True) navigation_title = I18nTextLineField(title=_("Navigation title"), - description=_("Folder's title displayed in navigation pages; " - "original title will be used if none is specified"), + description=_("Folder's title displayed in navigation " + "pages; original title will be used if " + "none is specified"), required=False) navigation_mode = Choice(title=_("Navigation mode"), @@ -119,7 +126,8 @@ """Site folder roles interface""" -class ISiteManager(ISharedSite, ISiteContainer, IBaseSharedTool, IDeletableElement, ISequentialIdTarget): +class ISiteManager(ISharedSite, ISiteContainer, IBaseSharedTool, + IDeletableElement, ISequentialIdTarget): """Site manager interface""" contains(ISiteElement) @@ -129,10 +137,16 @@ topic_content_type = Attribute("Topic content type") topic_content_factory = Attribute("Topic content factory") + header = I18nTextField(title=_("Header"), + description=_("Site's header is generally displayed in page header"), + required=False) + description = I18nTextField(title=_("Meta-description"), - description=_("The site's description is 'hidden' into HTML's page headers; but it " - "can be seen, for example, in some search engines results as content's " - "description; if description is empty, content's header will be used."), + description=_("The site's description is 'hidden' into HTML's " + "page headers; but it can be seen, for example, in " + "some search engines results as content's " + "description; if description is empty, content's " + "header will be used."), required=False) notepad = Text(title=_("Notepad"), @@ -169,8 +183,9 @@ """Site link interface""" navigation_title = I18nTextLineField(title=_("Navigation title"), - description=_("Alternate content's title displayed in navigation pages; " - "original title will be used if none is specified"), + description=_("Alternate content's title displayed in " + "navigation pages; original title will be " + "used if none is specified"), required=False) show_header = Bool(title=_("Show header?"), @@ -179,8 +194,9 @@ default=True) navigation_header = I18nTextField(title=_("Navigation header"), - description=_("Alternate content's header displayed in navigation pages; " - "original header will be used if none is specified"), + description=_("Alternate content's header displayed in " + "navigation pages; original header will be " + "used if none is specified"), required=False) visible = Bool(title=_("Visible?"), diff -r d565e0a0c8f3 -r f2cc8872bcc1 src/pyams_content/shared/site/manager.py --- a/src/pyams_content/shared/site/manager.py Wed Sep 02 17:48:47 2020 +0200 +++ b/src/pyams_content/shared/site/manager.py Mon Sep 07 17:25:59 2020 +0200 @@ -9,10 +9,6 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # -from pyams_content.shared.common.types import TypedSharedToolMixin - - -__docformat__ = 'restructuredtext' from pyramid.events import subscriber from zope.component.interfaces import ISite @@ -22,10 +18,10 @@ from zope.schema.fieldproperty import FieldProperty from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary -from pyams_content import _ from pyams_content.component.illustration import IIllustrationTarget, ILinkIllustrationTarget from pyams_content.component.paragraph.interfaces import IParagraphFactorySettings -from pyams_content.component.theme.interfaces import ICollectionsManagerTarget, IThemesManagerTarget +from pyams_content.component.theme.interfaces import ICollectionsManagerTarget, \ + IThemesManagerTarget from pyams_content.features.footer.interfaces import IFooterTarget from pyams_content.features.header.interfaces import IHeaderTarget from pyams_content.features.preview.interfaces import IPreviewTarget @@ -34,10 +30,12 @@ from pyams_content.root.interfaces import ISiteRoot from pyams_content.shared.common.interfaces import ISharedContentFactory from pyams_content.shared.common.manager import BaseSharedTool +from pyams_content.shared.common.types import TypedSharedToolMixin from pyams_content.shared.site import SiteTopic from pyams_content.shared.site.container import SiteContainerMixin from pyams_content.shared.site.folder import SiteFolder -from pyams_content.shared.site.interfaces import ISiteContainer, ISiteFolderFactory, ISiteManager, ISiteManagerFactory +from pyams_content.shared.site.interfaces import ISiteContainer, ISiteFolderFactory, \ + ISiteManager, ISiteManagerFactory from pyams_form.interfaces.form import IFormContextPermissionChecker from pyams_i18n.interfaces import II18n from pyams_portal.interfaces import IPortalContext @@ -49,6 +47,11 @@ from pyams_utils.vocabulary import vocabulary_config +__docformat__ = 'restructuredtext' + +from pyams_content import _ + + @implementer(ISiteManager, IParagraphFactorySettings, IThemesManagerTarget, ICollectionsManagerTarget, IPictogramManagerTarget, IIllustrationTarget, ILinkIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget) @@ -56,6 +59,7 @@ UserSkinnableContent): """Site manager persistent class""" + header = FieldProperty(ISiteManager['header']) description = FieldProperty(ISiteManager['description']) notepad = FieldProperty(ISiteManager['notepad']) diff -r d565e0a0c8f3 -r f2cc8872bcc1 src/pyams_content/shared/site/zmi/manager.py --- a/src/pyams_content/shared/site/zmi/manager.py Wed Sep 02 17:48:47 2020 +0200 +++ b/src/pyams_content/shared/site/zmi/manager.py Mon Sep 07 17:25:59 2020 +0200 @@ -162,7 +162,8 @@ legend = _("Site folder properties") - fields = field.Fields(ISiteManager).select('title', 'short_name', 'description', 'notepad') + \ + fields = field.Fields(ISiteManager).select('title', 'short_name', 'header', 'description', + 'notepad') + \ field.Fields(IBaseSharedTool).select('shared_content_workflow')