Binary file src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo has changed
--- a/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po Tue Jul 17 18:01:26 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po Tue Jul 17 18:01:54 2018 +0200
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-07-17 14:54+0200\n"
+"POT-Creation-Date: 2018-07-17 17:31+0200\n"
"PO-Revision-Date: 2015-09-10 10:42+0200\n"
"Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
"Language-Team: French\n"
@@ -2095,8 +2095,7 @@
msgid ""
"You must confirm that you checked this content before requesting "
"publication!!"
-msgstr ""
-"Vous devez avoir audité ce contenu avant de pouvoir le publier !!"
+msgstr "Vous devez avoir audité ce contenu avant de pouvoir le publier !!"
#: src/pyams_content/shared/common/zmi/workflow.py:84
#: src/pyams_content/workflow/__init__.py:648
@@ -3625,7 +3624,7 @@
"Trier tous les résultats sur la date de première publication (du plus récent "
"au plus ancien)"
-#: src/pyams_content/shared/view/zmi/properties.py:40
+#: src/pyams_content/shared/view/zmi/properties.py:45
msgid "Main view settings"
msgstr "Paramètres de la vue"
@@ -3726,7 +3725,7 @@
"uniquement sur les paramètres de la vue."
#: src/pyams_content/shared/view/portlet/interfaces.py:91
-#: src/pyams_content/shared/view/interfaces/__init__.py:86
+#: src/pyams_content/shared/view/interfaces/__init__.py:102
msgid "Results count limit"
msgstr "Limite de résultats"
@@ -3745,139 +3744,161 @@
msgid "No selected view"
msgstr "Aucune vue sélectionnée."
-#: src/pyams_content/shared/view/interfaces/__init__.py:32
+#: src/pyams_content/shared/view/interfaces/__init__.py:34
msgid "View"
msgstr "Vue"
-#: src/pyams_content/shared/view/interfaces/__init__.py:150
+#: src/pyams_content/shared/view/interfaces/__init__.py:166
msgid "Always include selected internal references"
msgstr "Toujours inclure toutes les références internes"
-#: src/pyams_content/shared/view/interfaces/__init__.py:151
+#: src/pyams_content/shared/view/interfaces/__init__.py:167
msgid "Include selected internal references only if empty"
msgstr "Inclure les références internes seulement lorsque la vue est vide"
-#: src/pyams_content/shared/view/interfaces/__init__.py:41
+#: src/pyams_content/shared/view/interfaces/__init__.py:43
#: src/pyams_content/interfaces/__init__.py:113
#: src/pyams_content/features/review/interfaces.py:74
msgid "Creation date"
msgstr "Date de création"
-#: src/pyams_content/shared/view/interfaces/__init__.py:42
+#: src/pyams_content/shared/view/interfaces/__init__.py:44
msgid "Last update date"
msgstr "Date de dernière modification"
-#: src/pyams_content/shared/view/interfaces/__init__.py:43
+#: src/pyams_content/shared/view/interfaces/__init__.py:45
msgid "Current publication date"
msgstr "Date de publication de la version actuelle"
-#: src/pyams_content/shared/view/interfaces/__init__.py:44
+#: src/pyams_content/shared/view/interfaces/__init__.py:46
msgid "First publication date"
msgstr "Date de première publication"
-#: src/pyams_content/shared/view/interfaces/__init__.py:62
+#: src/pyams_content/shared/view/interfaces/__init__.py:64
msgid "Select context type?"
-msgstr "Type du contexte ?"
-
-#: src/pyams_content/shared/view/interfaces/__init__.py:63
+msgstr "Gabarit du contexte ?"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:65
msgid "If 'yes', content type will be extracted from context"
msgstr ""
-"Si 'oui', seuls des contenus du même type que le contexte seront "
+"Si 'oui', seuls des contenus du même gabarit que le contexte seront "
"automatiquement sélectionnés"
-#: src/pyams_content/shared/view/interfaces/__init__.py:67
+#: src/pyams_content/shared/view/interfaces/__init__.py:69
msgid "Other content types"
-msgstr "Autres types de contenus"
-
-#: src/pyams_content/shared/view/interfaces/__init__.py:68
+msgstr "Autres gabarits"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:70
msgid "Selected content types; leave empty for all"
msgstr ""
-"Autres types de contenus sélectionnés ; si l'on n'extrait pas le type du "
-"contexte et si cette sélection est vide, tous les types seront pris en charge"
-
-#: src/pyams_content/shared/view/interfaces/__init__.py:75
+"Autres gabarits sélectionnés ; si l'on n'extrait pas le gabarit du contexte "
+"et si cette sélection est vide, tous les gabarits seront pris en charge"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:77
+msgid "Select context data type?"
+msgstr "Type du contexte ?"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:78
+msgid ""
+"If 'yes', content data type (if available) will be extracted from context"
+msgstr ""
+"Si 'oui', et si le contexte de la vue est \"typé\", seuls des contenus du même type "
+"que le contexte seront automatiquement sélectionnés"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:83
+msgid "Other data types"
+msgstr "Autres types de contenus"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:84
+msgid "Selected data types; leave empty for all"
+msgstr ""
+"Autres types de contenus sélectionnés ; si l'on n'extrait pas le type du contexte "
+"et si cette sélection est vide, tous les contenus (typés ou non) seront "
+"pris en charge"
+
+#: src/pyams_content/shared/view/interfaces/__init__.py:91
msgid "Order by"
msgstr "Ordre de tri"
-#: src/pyams_content/shared/view/interfaces/__init__.py:76
+#: src/pyams_content/shared/view/interfaces/__init__.py:92
msgid "Property to use to sort results"
msgstr ""
"Propriété utilisée pour trier les résultats ; par défaut, le tri se fait en "
"ordre inverse, donc du plus récent au plus ancien"
-#: src/pyams_content/shared/view/interfaces/__init__.py:81
+#: src/pyams_content/shared/view/interfaces/__init__.py:97
msgid "Reversed order?"
msgstr "Ordre inverse ?"
-#: src/pyams_content/shared/view/interfaces/__init__.py:82
+#: src/pyams_content/shared/view/interfaces/__init__.py:98
msgid "If 'yes', items order will be reversed"
msgstr ""
"Si 'non', le tri se fera en ordre \"naturel\", donc du plus ancien au plus "
"récent"
-#: src/pyams_content/shared/view/interfaces/__init__.py:87
+#: src/pyams_content/shared/view/interfaces/__init__.py:103
msgid "Maximum number of results that the view may retrieve"
msgstr "Nombre maximal de résultats que la vue doit renvoyer"
-#: src/pyams_content/shared/view/interfaces/__init__.py:160
+#: src/pyams_content/shared/view/interfaces/__init__.py:176
msgid "Internal references usage"
msgstr "Utilisation des références internes"
-#: src/pyams_content/shared/view/interfaces/__init__.py:161
+#: src/pyams_content/shared/view/interfaces/__init__.py:177
msgid "Specify how selected references are included into view results"
msgstr ""
"Indique comment les références internes indiquées seront intégrées à la "
"liste des résultats"
-#: src/pyams_content/shared/view/interfaces/__init__.py:166
+#: src/pyams_content/shared/view/interfaces/__init__.py:182
msgid "Exclude context?"
msgstr "Exclure le contexte ?"
-#: src/pyams_content/shared/view/interfaces/__init__.py:167
+#: src/pyams_content/shared/view/interfaces/__init__.py:183
msgid "If 'yes', context will be excluded from results list"
msgstr ""
"Si 'oui', le contexte d'application de la vue sera automatiquement exclus de "
"la liste des résultats"
-#: src/pyams_content/shared/view/interfaces/__init__.py:178
+#: src/pyams_content/shared/view/interfaces/__init__.py:194
msgid "Select context tags?"
msgstr "Tags du contexte ?"
-#: src/pyams_content/shared/view/interfaces/__init__.py:179
+#: src/pyams_content/shared/view/interfaces/__init__.py:195
msgid "If 'yes', tags will be extracted from context"
msgstr ""
"Si 'oui', les tags associés au contexte d'application de la vue seront "
"automatiquement sélectionnés"
-#: src/pyams_content/shared/view/interfaces/__init__.py:183
+#: src/pyams_content/shared/view/interfaces/__init__.py:199
msgid "Other tags"
msgstr "Autres tags"
-#: src/pyams_content/shared/view/interfaces/__init__.py:199
+#: src/pyams_content/shared/view/interfaces/__init__.py:215
msgid "Select context themes?"
msgstr "Thèmes du contexte ?"
-#: src/pyams_content/shared/view/interfaces/__init__.py:200
+#: src/pyams_content/shared/view/interfaces/__init__.py:216
msgid "If 'yes', themes will be extracted from context"
msgstr ""
"Si 'oui', les thèmes associés au contexte d'application de la vue seront "
"automatiquement sélectionnés"
-#: src/pyams_content/shared/view/interfaces/__init__.py:204
+#: src/pyams_content/shared/view/interfaces/__init__.py:220
msgid "Other themes"
msgstr "Autres thèmes"
-#: src/pyams_content/shared/view/interfaces/__init__.py:220
+#: src/pyams_content/shared/view/interfaces/__init__.py:236
msgid "Select context collections?"
msgstr "Collections du contexte ?"
-#: src/pyams_content/shared/view/interfaces/__init__.py:221
+#: src/pyams_content/shared/view/interfaces/__init__.py:237
msgid "If 'yes', collections will be extracted from context"
msgstr ""
"Si 'oui', les collections associées au contexte d'application de la vue "
"seront automatiquement sélectionnés"
-#: src/pyams_content/shared/view/interfaces/__init__.py:225
+#: src/pyams_content/shared/view/interfaces/__init__.py:241
msgid "Other collections"
msgstr "Autres collections"
--- a/src/pyams_content/locales/pyams_content.pot Tue Jul 17 18:01:26 2018 +0200
+++ b/src/pyams_content/locales/pyams_content.pot Tue Jul 17 18:01:54 2018 +0200
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-07-17 14:54+0200\n"
+"POT-Creation-Date: 2018-07-17 17:31+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3396,7 +3396,7 @@
msgid "Sort all results by first publication date"
msgstr ""
-#: ./src/pyams_content/shared/view/zmi/properties.py:40
+#: ./src/pyams_content/shared/view/zmi/properties.py:45
msgid "Main view settings"
msgstr ""
@@ -3482,7 +3482,7 @@
msgstr ""
#: ./src/pyams_content/shared/view/portlet/interfaces.py:91
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:86
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:102
msgid "Results count limit"
msgstr ""
@@ -3499,121 +3499,138 @@
msgid "No selected view"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:32
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:34
msgid "View"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:150
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:166
msgid "Always include selected internal references"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:151
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:167
msgid "Include selected internal references only if empty"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:41
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:43
#: ./src/pyams_content/interfaces/__init__.py:113
#: ./src/pyams_content/features/review/interfaces.py:74
msgid "Creation date"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:42
-msgid "Last update date"
-msgstr ""
-
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:43
-msgid "Current publication date"
-msgstr ""
-
#: ./src/pyams_content/shared/view/interfaces/__init__.py:44
+msgid "Last update date"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:45
+msgid "Current publication date"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:46
msgid "First publication date"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:62
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:64
msgid "Select context type?"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:63
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:65
msgid "If 'yes', content type will be extracted from context"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:67
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:69
msgid "Other content types"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:68
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:70
msgid "Selected content types; leave empty for all"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:75
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:77
+msgid "Select context data type?"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:78
+msgid ""
+"If 'yes', content data type (if available) will be extracted from context"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:83
+msgid "Other data types"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:84
+msgid "Selected data types; leave empty for all"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:91
msgid "Order by"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:76
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:92
msgid "Property to use to sort results"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:81
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:97
msgid "Reversed order?"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:82
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:98
msgid "If 'yes', items order will be reversed"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:87
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:103
msgid "Maximum number of results that the view may retrieve"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:160
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:176
msgid "Internal references usage"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:161
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:177
msgid "Specify how selected references are included into view results"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:166
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:182
msgid "Exclude context?"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:167
-msgid "If 'yes', context will be excluded from results list"
-msgstr ""
-
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:178
-msgid "Select context tags?"
-msgstr ""
-
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:179
-msgid "If 'yes', tags will be extracted from context"
-msgstr ""
-
#: ./src/pyams_content/shared/view/interfaces/__init__.py:183
-msgid "Other tags"
+msgid "If 'yes', context will be excluded from results list"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:194
+msgid "Select context tags?"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:195
+msgid "If 'yes', tags will be extracted from context"
msgstr ""
#: ./src/pyams_content/shared/view/interfaces/__init__.py:199
+msgid "Other tags"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:215
msgid "Select context themes?"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:200
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:216
msgid "If 'yes', themes will be extracted from context"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:204
-msgid "Other themes"
-msgstr ""
-
#: ./src/pyams_content/shared/view/interfaces/__init__.py:220
+msgid "Other themes"
+msgstr ""
+
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:236
msgid "Select context collections?"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:221
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:237
msgid "If 'yes', collections will be extracted from context"
msgstr ""
-#: ./src/pyams_content/shared/view/interfaces/__init__.py:225
+#: ./src/pyams_content/shared/view/interfaces/__init__.py:241
msgid "Other collections"
msgstr ""
--- a/src/pyams_content/shared/view/__init__.py Tue Jul 17 18:01:26 2018 +0200
+++ b/src/pyams_content/shared/view/__init__.py Tue Jul 17 18:01:54 2018 +0200
@@ -9,6 +9,7 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_content.shared.common.interfaces.types import IWfTypedSharedContent
__docformat__ = 'restructuredtext'
@@ -65,6 +66,8 @@
select_context_type = FieldProperty(IWfView['select_context_type'])
selected_content_types = FieldProperty(IWfView['selected_content_types'])
+ select_context_datatype = FieldProperty(IWfView['select_context_datatype'])
+ selected_datatypes = FieldProperty(IWfView['selected_datatypes'])
order_by = FieldProperty(IWfView['order_by'])
reversed_order = FieldProperty(IWfView['reversed_order'])
limit = FieldProperty(IWfView['limit'])
@@ -89,6 +92,16 @@
content_types |= set(self.selected_content_types)
return list(content_types)
+ def get_data_types(self, context):
+ data_types = set()
+ if self.select_context_datatype:
+ content = IWfTypedSharedContent(context, None)
+ if content is not None:
+ data_types.add(content.data_type)
+ if self.selected_datatypes:
+ data_types |= set(self.selected_datatypes)
+ return list(data_types)
+
def get_results(self, context, sort_index=None, reverse=None, limit=None, ignore_cache=False):
results = _MARKER
if not ignore_cache:
@@ -153,6 +166,10 @@
content_types = view.get_content_types(context)
if content_types:
params &= Any(catalog['content_type'], content_types)
+ # check data types
+ data_types = view.get_data_types(context)
+ if data_types:
+ params &= Any(catalog['data_type'], data_types)
# check workflow states
wf_params = None
for workflow in registry.getAllUtilitiesRegisteredFor(IWorkflow):
--- a/src/pyams_content/shared/view/interfaces/__init__.py Tue Jul 17 18:01:26 2018 +0200
+++ b/src/pyams_content/shared/view/interfaces/__init__.py Tue Jul 17 18:01:54 2018 +0200
@@ -16,13 +16,15 @@
# import standard library
# import interfaces
-from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool
+from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool, \
+ CONTENT_TYPES_VOCABULARY
+from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
from pyams_sequence.interfaces import IInternalReferencesList
# import packages
from pyams_thesaurus.schema import ThesaurusTermsListField
from zope.interface import Interface, Attribute
-from zope.schema import List, Choice, Bool, Int
+from zope.schema import List, Set, Choice, Bool, Int
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from pyams_content import _
@@ -64,14 +66,28 @@
required=True,
default=False)
- selected_content_types = List(title=_("Other content types"),
- description=_("Selected content types; leave empty for all"),
- value_type=Choice(vocabulary='PyAMS content types'),
- required=False)
+ selected_content_types = Set(title=_("Other content types"),
+ description=_("Selected content types; leave empty for all"),
+ value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY),
+ required=False)
def get_content_types(self, context):
"""Get content types for given context"""
+ select_context_datatype = Bool(title=_("Select context data type?"),
+ description=_("If 'yes', content data type (if available) will be extracted from "
+ "context"),
+ required=True,
+ default=False)
+
+ selected_datatypes = Set(title=_("Other data types"),
+ description=_("Selected data types; leave empty for all"),
+ value_type=Choice(vocabulary=ALL_DATA_TYPES_VOCABULARY),
+ required=False)
+
+ def get_data_types(self, context):
+ """Get data types for given context"""
+
order_by = Choice(title=_("Order by"),
description=_("Property to use to sort results"),
vocabulary=VIEW_ORDER_VOCABULARY,
--- a/src/pyams_content/shared/view/zmi/properties.py Tue Jul 17 18:01:26 2018 +0200
+++ b/src/pyams_content/shared/view/zmi/properties.py Tue Jul 17 18:01:54 2018 +0200
@@ -14,17 +14,22 @@
# import standard library
+import json
# import interfaces
from pyams_content.shared.view.interfaces import IWfView
from pyams_form.interfaces.form import IInnerSubForm
from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces.data import IObjectData
# import packages
+from pyams_content.shared.common.types import get_all_data_types
from pyams_content.shared.common.zmi.properties import SharedContentPropertiesEditForm
+from pyams_form.widget import HiddenSelect2FieldWidget
from pyams_utils.adapter import adapter_config
from pyams_zmi.form import InnerAdminEditForm
from z3c.form import field
+from zope.interface import alsoProvides
from pyams_content import _
@@ -41,5 +46,19 @@
fieldset_class = 'bordered no-x-margin margin-y-10'
fields = field.Fields(IWfView).select('select_context_type', 'selected_content_types',
+ 'select_context_datatype', 'selected_datatypes',
'order_by', 'reversed_order', 'limit')
+ fields['selected_datatypes'].widgetFactory = HiddenSelect2FieldWidget
+
weight = 1
+
+ def updateWidgets(self, prefix=None):
+ super(ViewPropertiesEditForm, self).updateWidgets(prefix)
+ if 'selected_datatypes' in self.widgets:
+ widget = self.widgets['selected_datatypes']
+ # widget.multiple = True
+ widget.object_data = {
+ 'ams-select2-multiple': True,
+ 'ams-select2-data': json.dumps(get_all_data_types(self.request))
+ }
+ alsoProvides(widget, IObjectData)