Source code for pyams_content.component.theme.interfaces

#
# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#

__docformat__ = 'restructuredtext'

from zope.interface import Interface, invariant, Invalid
from zope.schema import Bool, Choice

from pyams_sequence.schema import InternalReferenceField
from pyams_thesaurus.interfaces.thesaurus import IThesaurusContextManager, IThesaurusContextManagerTarget
from pyams_thesaurus.schema import ThesaurusTermsListField

from pyams_content import _


#
# Tags management
#

TAGS_MANAGER_KEY = 'pyams_content.tags.manager'
TAGS_INFO_KEY = 'pyams_content.tags.info'


[docs]class ITagsManager(IThesaurusContextManager): """Tags manager interface""" enable_tags_search = Bool(title=_("Enable search by tag?"), description=_("If 'yes', displayed tags will lead to a search engine " "displaying contents matching given tag"), required=True, default=False) tags_search_target = InternalReferenceField(title=_("Tags search target"), description=_("Site or folder where tags search is displayed"), required=False) @invariant def check_search_target(self): if self.enable_tags_search and not self.tags_search_target: raise Invalid(_("You must specify search target when activating search by tags!")) enable_glossary = Bool(title=_("Enable glossary?"), description=_(""), required=True, default=False) glossary_thesaurus_name = Choice(title=_("Glossary thesaurus name"), vocabulary='PyAMS thesaurus names', required=False) @invariant def check_glossary_thesaurus(self): if self.enable_glossary and not self.glossary_thesaurus_name: raise Invalid(_("You must specify a glossary thesaurus to activate it!"))
[docs]class ITagsManagerTarget(IThesaurusContextManagerTarget): """Marker interface for tags manager"""
[docs]class ITagsInfo(Interface): """Tags information interface""" tags = ThesaurusTermsListField(title=_("Tags"), required=False)
[docs]class ITagsTarget(Interface): """Tags target interface"""
PORTLET_SETTINGS_TAGS_KEY = 'pyams_content.portlet.tags.settings'
[docs]class IPortletTagsSettings(Interface): """Interface for portlet settings managing tags""" tags = ThesaurusTermsListField(title=_("Tags"), required=False)
[docs]class IPortletTagsSettingsTarget(Interface): """Marker interface for portlet settings managing tags"""
# # Themes management # THEMES_MANAGER_KEY = 'pyams_content.themes.manager' THEMES_INFO_KEY = 'pyams_content.themes.info'
[docs]class IThemesManager(IThesaurusContextManager): """Themes manager interface"""
[docs]class IThemesManagerTarget(IThesaurusContextManagerTarget): """Marker interface for tools managing themes"""
[docs]class IThemesInfo(Interface): """Themes information interface""" themes = ThesaurusTermsListField(title=_("Themes"), required=False)
[docs]class IThemesTarget(Interface): """Themes target interface"""
PORTLET_SETTINGS_THEMES_KEY = 'pyams_content.portlet.themes.settings'
[docs]class IPortletThemesSettings(Interface): """Interface for portlet settings managing themes""" themes = ThesaurusTermsListField(title=_("Themes"), required=False)
[docs]class IPortletThemesSettingsTarget(Interface): """Marker interface for portlet settings managing themes"""
# # Collections management # COLLECTIONS_MANAGER_KEY = 'pyams_content.collections.manager' COLLECTIONS_INFO_KEY = 'pyams_content.collections.info'
[docs]class ICollectionsManager(IThesaurusContextManager): """Collections manager interface"""
[docs]class ICollectionsManagerTarget(IThesaurusContextManagerTarget): """Marker interface for tools managing collections"""
[docs]class ICollectionsInfo(Interface): """Collections information interface""" collections = ThesaurusTermsListField(title=_("Collections"), required=False)
[docs]class ICollectionsTarget(Interface): """Collections target interface"""
PORTLET_SETTINGS_COLLECTIONS_KEY = 'pyams_content.portlet.collections.settings'
[docs]class IPortletCollectionsSettings(Interface): """Interface for portlet settings managing collections""" collections = ThesaurusTermsListField(title=_("Collections"), required=False)
[docs]class IPortletCollectionsSettingsTarget(Interface): """Marker interface for portlet settings managing collections"""