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 Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po Wed Aug 29 17:49:34 2018 +0200
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-08-29 10:31+0200\n"
+"POT-Creation-Date: 2018-08-29 16:28+0200\n"
"PO-Revision-Date: 2015-09-10 10:42+0200\n"
"Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
"Language-Team: French\n"
@@ -410,7 +410,6 @@
#: src/pyams_content/component/extfile/interfaces/__init__.py:36
#: src/pyams_content/component/links/interfaces/__init__.py:35
#: src/pyams_content/shared/imagemap/interfaces/__init__.py:55
-#: src/pyams_content/shared/site/interfaces/__init__.py:114
msgid "Alternate title"
msgstr "Titre de substitution"
@@ -560,7 +559,7 @@
#: src/pyams_content/component/paragraph/interfaces/pictogram.py:41
#: src/pyams_content/component/association/interfaces/__init__.py:42
#: src/pyams_content/shared/form/interfaces/__init__.py:87
-#: src/pyams_content/shared/site/interfaces/__init__.py:118
+#: src/pyams_content/shared/site/interfaces/__init__.py:144
#: src/pyams_content/features/alert/interfaces.py:54
#: src/pyams_content/features/menu/interfaces/__init__.py:59
msgid "Visible?"
@@ -3250,13 +3249,13 @@
#: src/pyams_content/shared/common/interfaces/__init__.py:168
#: src/pyams_content/shared/site/zmi/folder.py:78
-#: src/pyams_content/shared/site/interfaces/__init__.py:67
+#: src/pyams_content/shared/site/interfaces/__init__.py:76
msgid "Notepad"
msgstr "Bloc-notes"
#: src/pyams_content/shared/common/interfaces/__init__.py:169
#: src/pyams_content/shared/site/zmi/folder.py:79
-#: src/pyams_content/shared/site/interfaces/__init__.py:68
+#: src/pyams_content/shared/site/interfaces/__init__.py:77
msgid "Internal information to be known about this content"
msgstr ""
"Pour prendre note d'informations internes utiles ou importantes à propos de "
@@ -4093,7 +4092,7 @@
msgid "Image map template"
msgstr "Mode de rendu"
-#: src/pyams_content/shared/site/folder.py:59
+#: src/pyams_content/shared/site/folder.py:62
msgid "Site folder"
msgstr "Rubrique"
@@ -4118,10 +4117,14 @@
msgid "Site folder management"
msgstr "Gérer cette rubrique"
-#: src/pyams_content/shared/site/zmi/folder.py:188
+#: src/pyams_content/shared/site/zmi/folder.py:189
msgid "Site folder properties"
msgstr "Propriétés de la rubrique"
+#: src/pyams_content/shared/site/zmi/folder.py:206
+msgid "Navigation properties"
+msgstr "Propriétés de navigation"
+
#: src/pyams_content/shared/site/zmi/folder.py:71
#: src/pyams_content/interfaces/__init__.py:102
msgid "Visible label used to display content"
@@ -4248,37 +4251,70 @@
msgid "A site manager is already registered with this name!!"
msgstr "Un site est déjà inscrit dans le registre avec ce nom !"
-#: src/pyams_content/shared/site/interfaces/__init__.py:96
+#: src/pyams_content/shared/site/interfaces/__init__.py:121
msgid "Topic"
msgstr "Article"
-#: src/pyams_content/shared/site/interfaces/__init__.py:59
+#: src/pyams_content/shared/site/interfaces/__init__.py:42
+msgid "Redirect to first visible sub-folder or content"
+msgstr "Re-diriger vers le premier contenu publié"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:43
+msgid "Use presentation template"
+msgstr "Afficher le modèle de présentation de la rubrique"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:72
msgid "Heading"
msgstr "Chapô"
-#: src/pyams_content/shared/site/interfaces/__init__.py:60
+#: src/pyams_content/shared/site/interfaces/__init__.py:73
msgid "Heading displayed according to presentation template"
msgstr ""
"Ce chapô pourra être affiché ou non en fonction du modèle de présentation "
"retenu"
-#: src/pyams_content/shared/site/interfaces/__init__.py:63
+#: src/pyams_content/shared/site/interfaces/__init__.py:80
+#: src/pyams_content/shared/site/interfaces/__init__.py:139
msgid "Navigation title"
msgstr "Titre de navigation"
-#: src/pyams_content/shared/site/interfaces/__init__.py:64
-msgid "Title displayed in navigation items"
+#: src/pyams_content/shared/site/interfaces/__init__.py:81
+msgid ""
+"Folder's title displayed in navigation pages; original title will be used if "
+"none is specified"
msgstr ""
-"Libellé utilisé en lieu et place du titre dans les blocs de navigation, "
-"notamment dans les pages carrefours"
-
-#: src/pyams_content/shared/site/interfaces/__init__.py:115
-msgid "Content title, as shown in front-office"
-msgstr "Titre présenté aux internautes"
-
-#: src/pyams_content/shared/site/interfaces/__init__.py:119
+"Titre de substitution affiché dans les composants de navigation ; "
+"si rien n'est indiqué, le titre original de la rubrique sera utilisé"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:85
+msgid "Navigation mode"
+msgstr "Mode de navigation"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:86
+msgid "Folder behaviour when navigating to folder URL"
+msgstr "Comportement à adopter lorsqu'un internaute accède à cette rubrique"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:91
+msgid "Visible in folders list"
+msgstr "Visible dans la liste des rubriques ?"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:92
+msgid "If 'no', folder will not be displayed into folders list"
+msgstr ""
+"Si 'non', cette rubrique ne sera pas affichée dans la liste des "
+"rubriques affichée par un composant de navigation"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:140
+msgid ""
+"Alternate content's title displayed in navigation pages; original title will "
+"be used if none is specified"
+msgstr ""
+"Titre de substitution affiché dans les composants de navigation ; "
+"si rien n'est indiqué, le titre original du contenu référencé sera utilisé"
+
+#: src/pyams_content/shared/site/interfaces/__init__.py:145
msgid "If 'no', link is not visible"
-msgstr "Si 'non', le lien ne sera pas visible"
+msgstr "Si 'non', le lien ne sera pas visible même si le contenu référencé est publié"
#: src/pyams_content/shared/logo/paragraph.py:95
msgid "no selected logo"
@@ -5651,6 +5687,14 @@
msgid "Hidden header"
msgstr "Ne pas afficher d'en-tête de pages"
+#~ msgid "Title displayed in navigation items"
+#~ msgstr ""
+#~ "Libellé utilisé en lieu et place du titre dans les blocs de navigation, "
+#~ "notamment dans les pages carrefours"
+
+#~ msgid "Content title, as shown in front-office"
+#~ msgstr "Titre présenté aux internautes"
+
#~ msgid "Success"
#~ msgstr "Levée d'alerte"
@@ -5987,9 +6031,6 @@
#~ msgid "Visible gallery?"
#~ msgstr "Galerie visible ?"
-#~ msgid "If 'no', this gallery won't be displayed in front office"
-#~ msgstr "Si 'non', cette galerie ne sera pas affichée en front-office"
-
#~ msgid "Contained galleries"
#~ msgstr "Galeries d'images"
--- a/src/pyams_content/locales/pyams_content.pot Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/locales/pyams_content.pot Wed Aug 29 17:49:34 2018 +0200
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-08-29 10:31+0200\n"
+"POT-Creation-Date: 2018-08-29 16:28+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"
@@ -397,7 +397,6 @@
#: ./src/pyams_content/component/extfile/interfaces/__init__.py:36
#: ./src/pyams_content/component/links/interfaces/__init__.py:35
#: ./src/pyams_content/shared/imagemap/interfaces/__init__.py:55
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:114
msgid "Alternate title"
msgstr ""
@@ -540,7 +539,7 @@
#: ./src/pyams_content/component/paragraph/interfaces/pictogram.py:41
#: ./src/pyams_content/component/association/interfaces/__init__.py:42
#: ./src/pyams_content/shared/form/interfaces/__init__.py:87
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:118
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:144
#: ./src/pyams_content/features/alert/interfaces.py:54
#: ./src/pyams_content/features/menu/interfaces/__init__.py:59
msgid "Visible?"
@@ -3064,13 +3063,13 @@
#: ./src/pyams_content/shared/common/interfaces/__init__.py:168
#: ./src/pyams_content/shared/site/zmi/folder.py:78
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:67
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:76
msgid "Notepad"
msgstr ""
#: ./src/pyams_content/shared/common/interfaces/__init__.py:169
#: ./src/pyams_content/shared/site/zmi/folder.py:79
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:68
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:77
msgid "Internal information to be known about this content"
msgstr ""
@@ -3822,7 +3821,7 @@
msgid "Image map template"
msgstr ""
-#: ./src/pyams_content/shared/site/folder.py:59
+#: ./src/pyams_content/shared/site/folder.py:62
msgid "Site folder"
msgstr ""
@@ -3847,10 +3846,14 @@
msgid "Site folder management"
msgstr ""
-#: ./src/pyams_content/shared/site/zmi/folder.py:188
+#: ./src/pyams_content/shared/site/zmi/folder.py:189
msgid "Site folder properties"
msgstr ""
+#: ./src/pyams_content/shared/site/zmi/folder.py:206
+msgid "Navigation properties"
+msgstr ""
+
#: ./src/pyams_content/shared/site/zmi/folder.py:71
#: ./src/pyams_content/interfaces/__init__.py:102
msgid "Visible label used to display content"
@@ -3973,31 +3976,60 @@
msgid "A site manager is already registered with this name!!"
msgstr ""
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:96
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:121
msgid "Topic"
msgstr ""
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:59
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:42
+msgid "Redirect to first visible sub-folder or content"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:43
+msgid "Use presentation template"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:72
msgid "Heading"
msgstr ""
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:60
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:73
msgid "Heading displayed according to presentation template"
msgstr ""
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:63
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:80
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:139
msgid "Navigation title"
msgstr ""
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:64
-msgid "Title displayed in navigation items"
-msgstr ""
-
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:115
-msgid "Content title, as shown in front-office"
-msgstr ""
-
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:119
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:81
+msgid ""
+"Folder's title displayed in navigation pages; original title will be used if "
+"none is specified"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:85
+msgid "Navigation mode"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:86
+msgid "Folder behaviour when navigating to folder URL"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:91
+msgid "Visible in folders list"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:92
+msgid "If 'no', folder will not be displayed into folders list"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:140
+msgid ""
+"Alternate content's title displayed in navigation pages; original title will "
+"be used if none is specified"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:145
msgid "If 'no', link is not visible"
msgstr ""
--- a/src/pyams_content/shared/site/folder.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/folder.py Wed Aug 29 17:49:34 2018 +0200
@@ -53,8 +53,11 @@
roles_interface = ISiteFolderRoles
heading = FieldProperty(ISiteFolder['heading'])
+ notepad = FieldProperty(ISiteFolder['notepad'])
+
+ visible_in_list = FieldProperty(ISiteFolder['visible_in_list'])
navigation_title = FieldProperty(ISiteFolder['navigation_title'])
- notepad = FieldProperty(ISiteFolder['notepad'])
+ navigation_mode = FieldProperty(ISiteFolder['navigation_mode'])
content_name = _("Site folder")
--- a/src/pyams_content/shared/site/interfaces/__init__.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/interfaces/__init__.py Wed Aug 29 17:49:34 2018 +0200
@@ -14,6 +14,7 @@
# import standard library
+from collections import OrderedDict
# import interfaces
from pyams_content.interfaces import IBaseContent
@@ -28,11 +29,23 @@
from pyams_i18n.schema import I18nTextLineField, I18nTextField
from zope.container.constraints import containers, contains
from zope.interface import Interface, Attribute
-from zope.schema import Text, Bool
+from zope.schema import Text, Bool, Choice
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from pyams_content import _
+FOLDER_REDIRECT_DISPLAY_MODE = 'redirect'
+FOLDER_TEMPLATE_DISPLAY_MODE = 'template'
+
+FOLDER_DISPLAY_MODES = OrderedDict((
+ (FOLDER_REDIRECT_DISPLAY_MODE, _("Redirect to first visible sub-folder or content")),
+ (FOLDER_TEMPLATE_DISPLAY_MODE, _("Use presentation template"))
+))
+
+FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in FOLDER_DISPLAY_MODES.items()])
+
+
class ISiteElement(IContained, IDeletableElement):
"""Base site element interface"""
@@ -60,14 +73,26 @@
description=_("Heading displayed according to presentation template"),
required=False)
- navigation_title = I18nTextLineField(title=_("Navigation title"),
- description=_("Title displayed in navigation items"),
- required=False)
-
notepad = Text(title=_("Notepad"),
description=_("Internal information to be known about this content"),
required=False)
+ visible_in_list = Bool(title=_("Visible in folders list"),
+ description=_("If 'no', folder will not be displayed into folders list"),
+ required=True,
+ default=True)
+
+ navigation_title = I18nTextLineField(title=_("Navigation title"),
+ description=_("Folder's title displayed in navigation pages; "
+ "original title will be used if none is specified"),
+ required=False)
+
+ navigation_mode = Choice(title=_("Navigation mode"),
+ description=_("Folder behaviour when navigating to folder URL"),
+ required=True,
+ vocabulary=FOLDER_DISPLAY_MODE_VOCABULARY,
+ default=FOLDER_REDIRECT_DISPLAY_MODE)
+
class ISiteFolderFactory(Interface):
"""Site folder factory interface"""
@@ -111,9 +136,10 @@
class IContentLink(ISiteElement, IInternalReference, IAttributeAnnotatable):
"""Rented content interface"""
- alt_title = I18nTextLineField(title=_("Alternate title"),
- description=_("Content title, as shown in front-office"),
- required=False)
+ navigation_title = I18nTextLineField(title=_("Navigation title"),
+ description=_("Alternate content's title displayed in navigation pages; "
+ "original title will be used if none is specified"),
+ required=False)
visible = Bool(title=_("Visible?"),
description=_("If 'no', link is not visible"),
--- a/src/pyams_content/shared/site/link.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/link.py Wed Aug 29 17:49:34 2018 +0200
@@ -43,7 +43,7 @@
"""
reference = FieldProperty(IContentLink['reference'])
- alt_title = FieldProperty(IContentLink['alt_title'])
+ navigation_title = FieldProperty(IContentLink['navigation_title'])
visible = FieldProperty(IContentLink['visible'])
content_name = _("Content link")
--- a/src/pyams_content/shared/site/zmi/container.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py Wed Aug 29 17:49:34 2018 +0200
@@ -334,7 +334,7 @@
icon_class = 'fa-eye-slash text-danger opaque'
return '<i class="fa fa-fw {icon_class} hint align-base" title="{title}" data-ams-hint-gravity="e"></i>'.format(
icon_class=icon_class,
- title=self.request.localizer.translate(self.icon_hint))
+ title=self.request.localizer.translate(self.get_icon_hint(item)))
def get_icon_hint(self, item):
translate = self.request.localizer.translate
--- a/src/pyams_content/shared/site/zmi/folder.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/folder.py Wed Aug 29 17:49:34 2018 +0200
@@ -9,6 +9,8 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_form.group import NamedWidgetsGroup
+from pyams_form.interfaces.form import IInnerSubForm
__docformat__ = 'restructuredtext'
@@ -31,7 +33,7 @@
# import packages
from pyams_content.shared.common.zmi.manager import SharedToolPropertiesEditForm
from pyams_content.shared.site.zmi.widget import SiteManagerFoldersSelectorFieldWidget
-from pyams_form.form import AJAXAddForm, AJAXEditForm, ajax_config
+from pyams_form.form import AJAXAddForm, ajax_config
from pyams_i18n.schema import I18nTextLineField
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.table import DefaultElementEditorAdapter
@@ -42,10 +44,9 @@
from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogAddForm
+from pyams_zmi.form import AdminDialogAddForm, InnerAdminEditForm
from pyramid.events import subscriber
from pyramid.path import DottedNameResolver
-from pyramid.view import view_config
from z3c.form import field
from zope.interface import Interface, Invalid
from zope.schema import Text, Int
@@ -182,16 +183,45 @@
@pagelet_config(name='properties.html', context=ISiteFolder, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
+@ajax_config(name='properties.json', context=ISiteFolder, layer=IPyAMSLayer)
class SiteFolderPropertiesEditForm(SharedToolPropertiesEditForm):
"""Site folder properties edit form"""
legend = _("Site folder properties")
- fields = field.Fields(ISiteFolder).select('title', 'short_name', 'heading', 'navigation_title', 'notepad') + \
+ fields = field.Fields(ISiteFolder).select('title', 'short_name', 'heading', 'notepad') + \
field.Fields(IBaseSharedTool).select('shared_content_workflow')
-@view_config(name='properties.json', context=ISiteFolder, request_type=IPyAMSLayer,
- permission=MANAGE_TOOL_PERMISSION, renderer='json', xhr=True)
-class SiteFolderPropertiesAJAXEditForm(AJAXEditForm, SiteFolderPropertiesEditForm):
- """Site folder properties edit form, JSON renderer"""
+@adapter_config(name='navigation', context=(ISiteFolder, IPyAMSLayer, SiteFolderPropertiesEditForm),
+ provides=IInnerSubForm)
+class SiteFolderNavigationPropertiesEditForm(InnerAdminEditForm):
+ """Site folder navigation properties edit form"""
+
+ prefix = 'navigation_form.'
+
+ css_class = 'form-group'
+ padding_class = ''
+ fieldset_class = 'bordered margin-top-10 padding-y-5'
+
+ legend = None
+ main_group_legend = _("Navigation properties")
+ main_group_class = 'inner switcher no-y-padding'
+
+ fields = field.Fields(ISiteFolder).select('visible_in_list', 'navigation_title', 'navigation_mode')
+
+ weight = 5
+
+ def check_mode(self):
+ if self.parent_form is not None:
+ self.mode = self.parent_form.mode
+
+ def updateGroups(self):
+ self.add_group(NamedWidgetsGroup(self, 'navigation', self.widgets,
+ ('visible_in_list', 'navigation_title', 'navigation_mode'),
+ fieldset_class=self.fieldset_class,
+ legend=self.main_group_legend,
+ css_class=self.main_group_class,
+ switch=True,
+ display_mode='auto'))
+ super(SiteFolderNavigationPropertiesEditForm, self).updateGroups()
--- a/src/pyams_content/shared/site/zmi/link.py Wed Aug 29 15:07:13 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/link.py Wed Aug 29 17:49:34 2018 +0200
@@ -75,7 +75,7 @@
legend = _("Rent existing content")
- fields = field.Fields(IContentLinkAddFormFields).select('reference', 'alt_title', 'parent')
+ fields = field.Fields(IContentLinkAddFormFields).select('reference', 'navigation_title', 'parent')
fields['parent'].widgetFactory = SiteManagerFoldersSelectorFieldWidget
edit_permission = CREATE_CONTENT_PERMISSION
@@ -93,7 +93,7 @@
def update_content(self, content, data):
data = data.get(self, data)
content.reference = data.get('reference')
- content.alt_title = data['alt_title']
+ content.navigation_title = data['navigation_title']
intids = get_utility(IIntIds)
parent = intids.queryObject(data.get('parent'))
if parent is not None:
@@ -114,7 +114,7 @@
@property
def name(self):
- title = II18n(self.context).query_attribute('alt_title', request=self.request)
+ title = II18n(self.context).query_attribute('navigation_title', request=self.request)
if not title:
target = self.context.get_target()
if target is not None:
@@ -133,7 +133,7 @@
legend = _("Edit content link properties")
- fields = field.Fields(IContentLink).omit('__parent__', '__name__')
+ fields = field.Fields(IContentLink).omit('__parent__', '__name__', 'visible')
edit_permission = MANAGE_CONTENT_PERMISSION
def get_ajax_output(self, changes):