Added internal references to shared contents
authorThierry Florac <tflorac@ulthar.net>
Fri, 04 Jan 2019 12:20:10 +0100
changeset 1207 a97f2023131a
parent 1206 32697298e136
child 1208 0ec8963e088e
Added internal references to shared contents
src/pyams_content/shared/blog/__init__.py
src/pyams_content/shared/blog/interfaces.py
src/pyams_content/shared/common/zmi/reference.py
src/pyams_content/shared/logo/interfaces.py
src/pyams_content/shared/logo/paragraph.py
src/pyams_content/shared/logo/zmi/paragraph.py
src/pyams_content/shared/news/__init__.py
src/pyams_content/shared/news/interfaces.py
src/pyams_content/shared/resource/__init__.py
src/pyams_content/shared/resource/interfaces.py
src/pyams_content/shared/site/__init__.py
src/pyams_content/shared/site/interfaces.py
src/pyams_content/shared/topic/__init__.py
src/pyams_content/shared/topic/interfaces.py
src/pyams_content/shared/view/interfaces.py
src/pyams_content/shared/view/reference.py
src/pyams_content/shared/view/zmi/reference.py
--- a/src/pyams_content/shared/blog/__init__.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/blog/__init__.py	Fri Jan 04 12:20:10 2019 +0100
@@ -12,23 +12,19 @@
 
 __docformat__ = 'restructuredtext'
 
+from zope.interface import implementer, provider
+from zope.schema.fieldproperty import FieldProperty
 
-# import standard library
-
-# import interfaces
 from pyams_content.component.illustration import IIllustrationTarget, ILinkIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
 from pyams_content.component.theme.interfaces import ITagsTarget, IThemesTarget
 from pyams_content.features.preview.interfaces import IPreviewTarget
 from pyams_content.features.review.interfaces import IReviewTarget
-from pyams_content.shared.blog.interfaces import IWfBlogPost, BLOG_CONTENT_TYPE, BLOG_CONTENT_NAME, IBlogPost, \
+from pyams_content.shared.blog.interfaces import BLOG_CONTENT_NAME, BLOG_CONTENT_TYPE, IBlogPost, IWfBlogPost, \
     IWfBlogPostFactory
-from pyams_workflow.interfaces import IWorkflow, IWorkflowVersions, IWorkflowState
-
-# import packages
-from pyams_content.shared.common import WfSharedContent, register_content_type, SharedContent, IWfSharedContentFactory
+from pyams_content.shared.common import IWfSharedContentFactory, SharedContent, WfSharedContent, register_content_type
 from pyams_utils.adapter import adapter_config
-from zope.interface import implementer, provider
+from pyams_workflow.interfaces import IWorkflow, IWorkflowState, IWorkflowVersions
 
 
 @implementer(IWfBlogPost, IParagraphContainerTarget, ITagsTarget, IThemesTarget, IIllustrationTarget,
@@ -39,6 +35,8 @@
     content_type = BLOG_CONTENT_TYPE
     content_name = BLOG_CONTENT_NAME
 
+    references = FieldProperty(IWfBlogPost['references'])
+
 register_content_type(WfBlogPost)
 
 
--- a/src/pyams_content/shared/blog/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/blog/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -17,20 +17,19 @@
 from zope.interface import Attribute, Interface
 from zope.schema import Text
 
-from pyams_content.shared.common.interfaces import ISharedSite, IBaseSharedTool, ISharedContent, \
-    IDeletableElement, IWfSharedContentPortalContext
+from pyams_content import _
+from pyams_content.shared.common.interfaces import IBaseSharedTool, IDeletableElement, ISharedContent, ISharedSite, \
+    IWfSharedContentPortalContext
 from pyams_i18n.schema import I18nTextField
-from pyams_sequence.interfaces import ISequentialIdTarget
+from pyams_sequence.interfaces import IInternalReferencesList, ISequentialIdTarget
 from pyams_workflow.interfaces import IWorkflowPublicationSupport
 
-from pyams_content import _
-
 
 BLOG_CONTENT_TYPE = 'blog'
 BLOG_CONTENT_NAME = _("Blog post")
 
 
-class IWfBlogPost(IWfSharedContentPortalContext):
+class IWfBlogPost(IWfSharedContentPortalContext, IInternalReferencesList):
     """Blog topic interface"""
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/zmi/reference.py	Fri Jan 04 12:20:10 2019 +0100
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2008-2019 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 z3c.form import button, field
+from z3c.form.interfaces import INPUT_MODE
+from zope.interface import Interface, implementer
+
+from pyams_content import _
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_form.form import ajax_config
+from pyams_form.help import FormHelp
+from pyams_form.interfaces.form import IFormHelp, IUncheckedEditFormButtons, IWidgetForm
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_sequence.interfaces import IInternalReferencesList
+from pyams_skin.interfaces import IInnerPage
+from pyams_skin.layer import IPyAMSLayer
+from pyams_skin.viewlet.menu import MenuItem
+from pyams_utils.adapter import adapter_config
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+from pyams_viewlet.viewlet import viewlet_config
+from pyams_zmi.form import AdminEditForm
+from pyams_zmi.interfaces.menu import IPropertiesMenu
+from pyams_zmi.layer import IAdminLayer
+
+
+@viewlet_config(name='references.menu', context=IInternalReferencesList, layer=IAdminLayer,
+                manager=IPropertiesMenu, permission=VIEW_SYSTEM_PERMISSION, weight=80)
+class ReferencesMenu(MenuItem):
+    """Internal references menu"""
+
+    label = _("References...")
+    icon_class = 'fa-external-link-square fa-rotate-90'
+    url = '#references.html'
+
+
+@pagelet_config(name='references.html', context=IInternalReferencesList, layer=IPyAMSLayer,
+                permission=VIEW_SYSTEM_PERMISSION)
+@ajax_config(name='references.json', context=IInternalReferencesList, layer=IPyAMSLayer,
+             permission=MANAGE_CONTENT_PERMISSION)
+@implementer(IWidgetForm, IInnerPage)
+class InternalReferencesEditForm(AdminEditForm):
+    """Internal references edit form"""
+
+    legend = _("Internal references settings")
+
+    fields = field.Fields(IInternalReferencesList)
+
+    @property
+    def buttons(self):
+        if self.mode == INPUT_MODE:
+            return button.Buttons(IUncheckedEditFormButtons)
+        else:
+            return button.Buttons(Interface)
+
+
+@adapter_config(context=(IInternalReferencesList, IPyAMSLayer, InternalReferencesEditForm), provides=IFormHelp)
+class InternalReferencesEditFormHelp(FormHelp):
+    """Internal references edit form help"""
+
+    message = _("Internal references selected here will be usable by views which are using references "
+                "defined by their application context.")
+    message_format = 'rest'
--- a/src/pyams_content/shared/logo/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/logo/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -15,15 +15,14 @@
 from zope.interface import Interface
 from zope.schema import Choice, TextLine, URI
 
+from pyams_content import _
 from pyams_content.component.paragraph import IBaseParagraph
 from pyams_content.shared.common.interfaces import ISharedContent, ISharedTool, IWfSharedContent
 from pyams_file.schema import ImageField
 from pyams_i18n.schema import I18nTextLineField
-from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList
+from pyams_sequence.interfaces import IInternalReference
 from pyams_sequence.schema import InternalReferenceField, InternalReferencesListField
 
-from pyams_content import _
-
 
 LOGO_CONTENT_TYPE = 'logo'
 LOGO_CONTENT_NAME = _("Logo")
@@ -81,12 +80,15 @@
 LOGOS_PARAGRAPH_RENDERERS = 'PyAMS.shared.logos.renderers'
 
 
-class ILogosParagraph(IBaseParagraph, IInternalReferencesList):
+class ILogosParagraph(IBaseParagraph):
     """Logos paragraph"""
 
-    references = InternalReferencesListField(title=_("Logos references"),
-                                             description=_("List of internal logos references"),
-                                             content_type=LOGO_CONTENT_TYPE)
+    logos = InternalReferencesListField(title=_("Logos references"),
+                                        description=_("List of internal logos references"),
+                                        content_type=LOGO_CONTENT_TYPE)
+
+    def get_logos(self, status=None):
+        """Get logos from internal references"""
 
     renderer = Choice(title=_("Logos template"),
                       description=_("Presentation template used for this paragraph"),
--- a/src/pyams_content/shared/logo/paragraph.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/logo/paragraph.py	Fri Jan 04 12:20:10 2019 +0100
@@ -16,6 +16,7 @@
 from zope.schema.fieldproperty import FieldProperty
 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 
+from pyams_content import _
 from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory, \
     IParagraphFactory
 from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker, MISSING_LANG_VALUE, MISSING_VALUE
@@ -31,8 +32,6 @@
 from pyams_utils.vocabulary import vocabulary_config
 from pyams_workflow.interfaces import IWorkflow, IWorkflowState
 
-from pyams_content import _
-
 
 @implementer(ILogosParagraph)
 class LogosParagraph(BaseParagraph):
@@ -41,11 +40,11 @@
     icon_class = 'fa-th-large'
     icon_hint = LOGOS_PARAGRAPH_NAME
 
-    references = FieldProperty(ILogosParagraph['references'])
+    logos = FieldProperty(ILogosParagraph['logos'])
     renderer = FieldProperty(ILogosParagraph['renderer'])
 
-    def get_targets(self, state=None, with_reference=False):
-        for reference in self.references or ():
+    def get_logos(self, state=None, with_reference=False):
+        for reference in self.logos or ():
             if with_reference:
                 yield reference, get_reference_target(reference, state)
             else:
--- a/src/pyams_content/shared/logo/zmi/paragraph.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/logo/zmi/paragraph.py	Fri Jan 04 12:20:10 2019 +0100
@@ -12,11 +12,11 @@
 
 __docformat__ = 'restructuredtext'
 
-from pyramid.view import view_config
 from z3c.form import button, field
 from z3c.form.interfaces import INPUT_MODE
 from zope.interface import implementer
 
+from pyams_content import _
 from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget, \
     PARAGRAPH_HIDDEN_FIELDS
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
@@ -39,8 +39,6 @@
 from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm
 
-from pyams_content import _
-
 
 @viewlet_config(name='add-logos-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600)
--- a/src/pyams_content/shared/news/__init__.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/news/__init__.py	Fri Jan 04 12:20:10 2019 +0100
@@ -12,22 +12,18 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
+from zope.interface import implementer, provider
+from zope.schema.fieldproperty import FieldProperty
 
-from zope.interface import implementer, provider
-
-# import interfaces
 from pyams_content.component.illustration.interfaces import IIllustrationTarget, ILinkIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
 from pyams_content.component.theme.interfaces import ITagsTarget, IThemesTarget
 from pyams_content.features.preview.interfaces import IPreviewTarget
 from pyams_content.features.review.interfaces import IReviewTarget
-# import packages
 from pyams_content.shared.common import SharedContent, WfSharedContent, register_content_type
 from pyams_content.shared.common.interfaces import IWfSharedContentFactory
-from pyams_content.shared.news.interfaces import INewsEvent, IWfNewsEvent, NEWS_CONTENT_TYPE, NEWS_CONTENT_NAME, \
-    IWfNewsEventFactory
+from pyams_content.shared.news.interfaces import INewsEvent, IWfNewsEvent, IWfNewsEventFactory, NEWS_CONTENT_NAME, \
+    NEWS_CONTENT_TYPE
 from pyams_utils.adapter import adapter_config
 
 
@@ -39,6 +35,8 @@
     content_type = NEWS_CONTENT_TYPE
     content_name = NEWS_CONTENT_NAME
 
+    references = FieldProperty(IWfNewsEvent['references'])
+
 register_content_type(WfNewsEvent)
 
 
--- a/src/pyams_content/shared/news/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/news/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -12,17 +12,12 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
-
-# import interfaces
-from pyams_content.shared.common.interfaces import ISharedContent, \
-    IWfSharedContentPortalContext, ISharedToolPortalContext
-
-# import packages
 from zope.interface import Interface
 
 from pyams_content import _
+from pyams_content.shared.common.interfaces import ISharedContent, ISharedToolPortalContext, \
+    IWfSharedContentPortalContext
+from pyams_sequence.interfaces import IInternalReferencesList
 
 
 NEWS_CONTENT_TYPE = 'news'
@@ -37,7 +32,7 @@
     """News manager factory interface"""
 
 
-class IWfNewsEvent(IWfSharedContentPortalContext):
+class IWfNewsEvent(IWfSharedContentPortalContext, IInternalReferencesList):
     """News event interface"""
 
 
--- a/src/pyams_content/shared/resource/__init__.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/resource/__init__.py	Fri Jan 04 12:20:10 2019 +0100
@@ -25,8 +25,8 @@
 from pyams_content.shared.common import SharedContent, register_content_type
 from pyams_content.shared.common.interfaces import IWfSharedContentFactory
 from pyams_content.shared.common.types import WfTypedSharedContent
-from pyams_content.shared.resource.interfaces import IWfResource, RESOURCE_CONTENT_TYPE, RESOURCE_CONTENT_NAME, IResourceInfo, \
-    RESOURCE_INFO_ANNOTATIONS_KEY, IWfResourceFactory, IResource
+from pyams_content.shared.resource.interfaces import IResource, IResourceInfo, IWfResource, IWfResourceFactory, \
+    RESOURCE_CONTENT_NAME, RESOURCE_CONTENT_TYPE, RESOURCE_INFO_ANNOTATIONS_KEY
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
 
 
@@ -38,6 +38,7 @@
     content_type = RESOURCE_CONTENT_TYPE
     content_name = RESOURCE_CONTENT_NAME
 
+    references = FieldProperty(IWfResource['references'])
 
 register_content_type(WfResource)
 
--- a/src/pyams_content/shared/resource/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/resource/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -17,12 +17,12 @@
 from zope.interface import Interface
 from zope.schema import Choice, Float, Int, TextLine, URI
 
+from pyams_content import _
 from pyams_content.shared.common import ISharedContent
 from pyams_content.shared.common.interfaces.types import ITypedSharedToolPortalContext, \
     IWfTypedSharedContentPortalContext
 from pyams_i18n.schema import I18nHTMLField, I18nTextField
-
-from pyams_content import _
+from pyams_sequence.interfaces import IInternalReferencesList
 
 
 RESOURCE_CONTENT_TYPE = 'resource'
@@ -37,7 +37,7 @@
     """Resource manager factory interface"""
 
 
-class IWfResource(IWfTypedSharedContentPortalContext):
+class IWfResource(IWfTypedSharedContentPortalContext, IInternalReferencesList):
     """Resource content interface"""
 
 
--- a/src/pyams_content/shared/site/__init__.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/site/__init__.py	Fri Jan 04 12:20:10 2019 +0100
@@ -13,6 +13,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope.interface import implementer, provider
+from zope.schema.fieldproperty import FieldProperty
 
 from pyams_content.component.illustration import IIllustrationTarget, ILinkIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
@@ -34,6 +35,7 @@
     content_type = SITE_TOPIC_CONTENT_TYPE
     content_name = SITE_TOPIC_CONTENT_NAME
 
+    references = FieldProperty(IWfSiteTopic['references'])
 
 register_content_type(WfSiteTopic)
 
--- a/src/pyams_content/shared/site/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/site/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -17,20 +17,19 @@
 from zope.annotation.interfaces import IAttributeAnnotatable
 from zope.container.constraints import containers, contains
 from zope.container.interfaces import IContained, IContainer
-from zope.interface import Attribute, Interface, invariant
+from zope.interface import Attribute, Interface
 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.topic.interfaces import ITopic, IWfTopic, IWfTopicFactory
 from pyams_i18n.schema import I18nTextField, I18nTextLineField
-from pyams_sequence.interfaces import IInternalReference, ISequentialIdTarget
+from pyams_sequence.interfaces import IInternalReference, IInternalReferencesList, ISequentialIdTarget
 from pyams_workflow.interfaces import IWorkflowPublicationSupport
 
-from pyams_content import _
-
 
 FOLDER_REDIRECT_DISPLAY_MODE = 'redirect'
 FOLDER_TEMPLATE_DISPLAY_MODE = 'template'
@@ -147,7 +146,7 @@
 SITE_TOPIC_CONTENT_NAME = _("Site topic")
 
 
-class IWfSiteTopic(IWfTopic):
+class IWfSiteTopic(IWfTopic, IInternalReferencesList):
     """Site topic interface"""
 
 
--- a/src/pyams_content/shared/topic/__init__.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/topic/__init__.py	Fri Jan 04 12:20:10 2019 +0100
@@ -13,6 +13,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope.interface import implementer, provider
+from zope.schema.fieldproperty import FieldProperty
 
 from pyams_content.component.illustration.interfaces import IIllustrationTarget, ILinkIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
@@ -34,6 +35,7 @@
     content_type = TOPIC_CONTENT_TYPE
     content_name = TOPIC_CONTENT_NAME
 
+    references = FieldProperty(IWfTopic['references'])
 
 register_content_type(WfTopic)
 
--- a/src/pyams_content/shared/topic/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/topic/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -17,6 +17,7 @@
 from pyams_content import _
 from pyams_content.shared.common.interfaces import ISharedContent, ISharedToolPortalContext, \
     IWfSharedContentPortalContext
+from pyams_sequence.interfaces import IInternalReferencesList
 
 
 TOPIC_CONTENT_TYPE = 'topic'
@@ -31,7 +32,7 @@
     """Topic manager factory interface"""
 
 
-class IWfTopic(IWfSharedContentPortalContext):
+class IWfTopic(IWfSharedContentPortalContext, IInternalReferencesList):
     """Topic interface"""
 
 
--- a/src/pyams_content/shared/view/interfaces.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/view/interfaces.py	Fri Jan 04 12:20:10 2019 +0100
@@ -18,14 +18,14 @@
 from zope.schema import Bool, Choice, Int, Set
 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 
+from pyams_content import _
 from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, ISharedContent, ISharedTool, \
     IWfSharedContent
 from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
 from pyams_sequence.interfaces import IInternalReferencesList
+from pyams_sequence.schema import InternalReferencesListField
 from pyams_thesaurus.schema import ThesaurusTermsListField
 
-from pyams_content import _
-
 
 VIEW_CONTENT_TYPE = 'view'
 VIEW_CONTENT_NAME = _('View')
@@ -203,6 +203,15 @@
 class IViewInternalReferencesSettings(IViewSettings, IInternalReferencesList):
     """View internal references settings"""
 
+    select_context_references = Bool(title=_("Select context references?"),
+                                     description=_("If 'non', references imposed by the context will not be used"),
+                                     required=False,
+                                     default=True)
+
+    references = InternalReferencesListField(title=_("Other references"),
+                                             description=_("List of internal references"),
+                                             required=False)
+
     references_mode = Choice(title=_("Internal references usage"),
                              description=_("Specify how selected references are included into view results"),
                              vocabulary=REFERENCES_MODES_VOCABULARY,
@@ -214,6 +223,9 @@
                            required=True,
                            default=True)
 
+    def get_references(self, context):
+        """Get all references for given context"""
+
 
 VIEW_TAGS_SETTINGS_KEY = 'pyams_content.view.tags'
 
--- a/src/pyams_content/shared/view/reference.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/view/reference.py	Fri Jan 04 12:20:10 2019 +0100
@@ -25,7 +25,7 @@
     IViewQueryFilterExtension, IViewQueryParamsExtension, IViewSettings, IWfView, ONLY_REFERENCE_MODE, \
     VIEW_REFERENCES_SETTINGS_KEY
 from pyams_content.workflow import VISIBLE_STATES
-from pyams_sequence.interfaces import ISequentialIdInfo
+from pyams_sequence.interfaces import IInternalReferencesList, ISequentialIdInfo
 from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter
 from pyams_utils.registry import get_utility
 
@@ -34,13 +34,24 @@
 class ViewInternalReferencesSettings(Persistent, Contained):
     """View internal references settings"""
 
+    select_context_references = FieldProperty(IViewInternalReferencesSettings['select_context_references'])
     references = FieldProperty(IViewInternalReferencesSettings['references'])
     references_mode = FieldProperty(IViewInternalReferencesSettings['references_mode'])
     exclude_context = FieldProperty(IViewInternalReferencesSettings['exclude_context'])
 
     @property
     def is_using_context(self):
-        return False
+        return self.select_context_references
+
+    def get_references(self, context):
+        refs = []
+        if self.select_context_references:
+            references = IInternalReferencesList(context, None)
+            if references is not None:
+                refs.extend(references.references)
+        if self.references:
+            refs.extend(self.references)
+        return refs
 
 
 @adapter_config(context=IWfView, provides=IViewInternalReferencesSettings)
--- a/src/pyams_content/shared/view/zmi/reference.py	Thu Jan 03 17:52:15 2019 +0100
+++ b/src/pyams_content/shared/view/zmi/reference.py	Fri Jan 04 12:20:10 2019 +0100
@@ -12,30 +12,24 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
-
-# import interfaces
-from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.view.interfaces import IWfView, IViewInternalReferencesSettings
-from pyams_form.interfaces.form import IWidgetForm, IUncheckedEditFormButtons
-from pyams_skin.interfaces import IInnerPage
-from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
-from pyams_zmi.interfaces.menu import IPropertiesMenu
-from pyams_zmi.layer import IAdminLayer
+from z3c.form import button, field
 from z3c.form.interfaces import INPUT_MODE
-
-# import packages
-from pyams_form.form import ajax_config
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.viewlet.menu import MenuItem, MenuDivider
-from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminEditForm
-from z3c.form import field, button
 from zope.interface import Interface, implementer
 
 from pyams_content import _
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_content.shared.view.interfaces import IViewInternalReferencesSettings, IWfView
+from pyams_form.form import ajax_config
+from pyams_form.interfaces.form import IUncheckedEditFormButtons, IWidgetForm
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.interfaces import IInnerPage
+from pyams_skin.layer import IPyAMSLayer
+from pyams_skin.viewlet.menu import MenuDivider, MenuItem
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+from pyams_viewlet.viewlet import viewlet_config
+from pyams_zmi.form import AdminEditForm
+from pyams_zmi.interfaces.menu import IPropertiesMenu
+from pyams_zmi.layer import IAdminLayer
 
 
 @viewlet_config(name='references.divider', context=IWfView, layer=IAdminLayer,
@@ -50,7 +44,7 @@
     """View references menu"""
 
     label = _("References...")
-    icon_class = 'fa-link'
+    icon_class = 'fa-external-link-square fa-rotate-90'
     url = '#references.html'