--- a/src/pyams_content/component/gallery/__init__.py Fri Nov 10 11:53:18 2017 +0100
+++ b/src/pyams_content/component/gallery/__init__.py Fri Nov 10 11:53:47 2017 +0100
@@ -18,8 +18,10 @@
# import interfaces
from pyams_content.component.gallery.interfaces import IGallery, IGalleryTarget, \
GALLERY_CONTAINER_KEY, IGalleryRenderer
+from pyams_content.features.checker.interfaces import IContentChecker
from pyams_content.shared.common.interfaces import IWfSharedContent
from pyams_form.interfaces.form import IFormContextPermissionChecker
+from pyams_i18n.interfaces import II18n
from zope.annotation.interfaces import IAnnotations
from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
from zope.location.interfaces import ISublocations
@@ -27,6 +29,7 @@
# import packages
from pyams_catalog.utils import index_object
+from pyams_content.features.checker import BaseContentChecker
from pyams_utils.adapter import adapter_config, ContextAdapter
from pyams_utils.container import BTreeOrderedContainer
from pyams_utils.request import check_request
@@ -40,6 +43,8 @@
from zope.schema.fieldproperty import FieldProperty
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
+from pyams_content import _
+
#
# Galleries container
@@ -132,6 +137,34 @@
get_current_registry().notify(ObjectModifiedEvent(content))
+@adapter_config(name='gallery', context=IGallery, provides=IContentChecker)
+class GalleryContentChecker(BaseContentChecker):
+ """Gallery content checker"""
+
+ label = _("Gallery")
+ sep = '\n'
+ weight = 60
+
+ def inner_check(self, request):
+ output = []
+ registry = request.registry
+ for image in IGallery(self.context).values():
+ if not image.visible:
+ continue
+ for name, checker in sorted(registry.getAdapters((image, ), IContentChecker),
+ key=lambda x: x[1].weight):
+ output.append('- {0} : '.format(checker.label or
+ II18n(image).query_attribute('title', request=request)))
+ output.append(checker.get_check_output(request))
+ return output
+
+
+@adapter_config(name='gallery', context=IGalleryTarget, provides=IContentChecker)
+def GalleryTargetContentChecker(context):
+ gallery = IGallery(context)
+ return IContentChecker(gallery, None)
+
+
@vocabulary_config(name='PyAMS gallery renderers')
class GalleryRendererVocabulary(SimpleVocabulary):
"""Gallery renderer utilities vocabulary"""