src/pyams_content/shared/view/interfaces/__init__.py
changeset 856 0e8c775ca958
parent 829 f933926ed0a1
child 956 a8723fffbaf6
equal deleted inserted replaced
855:b83aca9d6e2b 856:0e8c775ca958
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool
    19 from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool, \
       
    20     CONTENT_TYPES_VOCABULARY
       
    21 from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
    20 from pyams_sequence.interfaces import IInternalReferencesList
    22 from pyams_sequence.interfaces import IInternalReferencesList
    21 
    23 
    22 # import packages
    24 # import packages
    23 from pyams_thesaurus.schema import ThesaurusTermsListField
    25 from pyams_thesaurus.schema import ThesaurusTermsListField
    24 from zope.interface import Interface, Attribute
    26 from zope.interface import Interface, Attribute
    25 from zope.schema import List, Choice, Bool, Int
    27 from zope.schema import List, Set, Choice, Bool, Int
    26 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
    28 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
    27 
    29 
    28 from pyams_content import _
    30 from pyams_content import _
    29 
    31 
    30 
    32 
    62     select_context_type = Bool(title=_("Select context type?"),
    64     select_context_type = Bool(title=_("Select context type?"),
    63                                description=_("If 'yes', content type will be extracted from context"),
    65                                description=_("If 'yes', content type will be extracted from context"),
    64                                required=True,
    66                                required=True,
    65                                default=False)
    67                                default=False)
    66 
    68 
    67     selected_content_types = List(title=_("Other content types"),
    69     selected_content_types = Set(title=_("Other content types"),
    68                                   description=_("Selected content types; leave empty for all"),
    70                                  description=_("Selected content types; leave empty for all"),
    69                                   value_type=Choice(vocabulary='PyAMS content types'),
    71                                  value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY),
    70                                   required=False)
    72                                  required=False)
    71 
    73 
    72     def get_content_types(self, context):
    74     def get_content_types(self, context):
    73         """Get content types for given context"""
    75         """Get content types for given context"""
       
    76 
       
    77     select_context_datatype = Bool(title=_("Select context data type?"),
       
    78                                    description=_("If 'yes', content data type (if available) will be extracted from "
       
    79                                                  "context"),
       
    80                                    required=True,
       
    81                                    default=False)
       
    82 
       
    83     selected_datatypes = Set(title=_("Other data types"),
       
    84                              description=_("Selected data types; leave empty for all"),
       
    85                              value_type=Choice(vocabulary=ALL_DATA_TYPES_VOCABULARY),
       
    86                              required=False)
       
    87 
       
    88     def get_data_types(self, context):
       
    89         """Get data types for given context"""
    74 
    90 
    75     order_by = Choice(title=_("Order by"),
    91     order_by = Choice(title=_("Order by"),
    76                       description=_("Property to use to sort results"),
    92                       description=_("Property to use to sort results"),
    77                       vocabulary=VIEW_ORDER_VOCABULARY,
    93                       vocabulary=VIEW_ORDER_VOCABULARY,
    78                       required=True,
    94                       required=True,