src/pyams_content/shared/view/interfaces.py
changeset 1090 d6d041577ae0
parent 1060 29b1aaf9e080
child 1121 852aa448da04
equal deleted inserted replaced
1089:be585890d0e1 1090:d6d041577ae0
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 
    12 
    13 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    14 
    14 
       
    15 from collections import OrderedDict
       
    16 
    15 from zope.interface import Attribute, Interface
    17 from zope.interface import Attribute, Interface
    16 from zope.schema import Bool, Choice, Int, Set
    18 from zope.schema import Bool, Choice, Int, Set
    17 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
    19 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
    18 
    20 
    19 from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, ISharedContent, ISharedTool, \
    21 from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, ISharedContent, ISharedTool, \
   153 
   155 
   154 VIEW_REFERENCES_SETTINGS_KEY = 'pyams_content.view.references'
   156 VIEW_REFERENCES_SETTINGS_KEY = 'pyams_content.view.references'
   155 
   157 
   156 ALWAYS_REFERENCE_MODE = 'always'
   158 ALWAYS_REFERENCE_MODE = 'always'
   157 IFEMPTY_REFERENCE_MODE = 'if_empty'
   159 IFEMPTY_REFERENCE_MODE = 'if_empty'
   158 
   160 ONLY_REFERENCE_MODE = 'only'
   159 REFERENCES_MODES = {
   161 
   160     ALWAYS_REFERENCE_MODE: _("Always include selected internal references"),
   162 REFERENCES_MODES = OrderedDict((
   161     IFEMPTY_REFERENCE_MODE: _("Include selected internal references only if empty")
   163     (ALWAYS_REFERENCE_MODE, _("Always include selected internal references")),
   162 }
   164     (IFEMPTY_REFERENCE_MODE, _("Include selected internal references only if view is empty")),
       
   165     (ONLY_REFERENCE_MODE, _("Include ONLY selected references (no search will be made)"))
       
   166 ))
   163 
   167 
   164 REFERENCES_MODES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in REFERENCES_MODES.items()])
   168 REFERENCES_MODES_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in REFERENCES_MODES.items()])
   165 
   169 
   166 
   170 
   167 class IViewInternalReferencesSettings(IViewSettings, IInternalReferencesList):
   171 class IViewInternalReferencesSettings(IViewSettings, IInternalReferencesList):