Updated pictogram selection
authorThierry Florac <thierry.florac@onf.fr>
Mon, 04 Jun 2018 16:43:56 +0200
changeset 576 12171cf62cc4
parent 575 e61e7effa80a
child 577 b7ded033d298
Updated pictogram selection
src/pyams_content/component/paragraph/interfaces/pictogram.py
src/pyams_content/component/paragraph/zmi/pictogram.py
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po
src/pyams_content/locales/pyams_content.pot
src/pyams_content/reference/pictograms/zmi/__init__.py
--- a/src/pyams_content/component/paragraph/interfaces/pictogram.py	Mon Jun 04 15:00:16 2018 +0200
+++ b/src/pyams_content/component/paragraph/interfaces/pictogram.py	Mon Jun 04 16:43:56 2018 +0200
@@ -45,7 +45,7 @@
 
     pictogram_name = Choice(title=_("Pictogram"),
                             description=_("Name of the pictogram to select"),
-                            required=True,
+                            required=False,
                             vocabulary=SELECTED_PICTOGRAM_VOCABULARY)
 
     pictogram = Attribute("Select pictogram object")
--- a/src/pyams_content/component/paragraph/zmi/pictogram.py	Mon Jun 04 15:00:16 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/pictogram.py	Mon Jun 04 16:43:56 2018 +0200
@@ -23,13 +23,15 @@
 from pyams_content.component.paragraph.zmi import IParagraphContainerView, IParagraphEditFormButtons
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_content.reference.pictograms.interfaces import IPictogramTable
 from pyams_content.shared.common import IWfSharedContent
 from pyams_form.interfaces.form import IInnerForm, IInnerSubForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IWidgetTitleViewletManager
 from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces.data import IObjectData
 from pyams_zmi.interfaces import IPropertiesEditForm
-from z3c.form.interfaces import INPUT_MODE
+from z3c.form.interfaces import INPUT_MODE, IDataExtractedEvent
 from z3c.table.interfaces import IValues, IColumn
 
 # import packages
@@ -48,6 +50,7 @@
 from pyams_skin.table import BaseTable, SorterColumn, I18nColumn, TrashColumn, VisibilitySwitcherColumn
 from pyams_skin.viewlet.toolbar import ToolbarAction
 from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+from pyams_utils.registry import query_utility
 from pyams_utils.text import get_text_start
 from pyams_utils.traversing import get_parent
 from pyams_utils.url import absolute_url
@@ -55,10 +58,11 @@
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from pyams_zmi.zmi.table import InnerTableView
 from pyramid.decorator import reify
+from pyramid.events import subscriber
 from pyramid.view import view_config
 from z3c.form import field, button
 from z3c.table.column import GetAttrColumn
-from zope.interface import implementer, Interface
+from zope.interface import implementer, alsoProvides, Interface, Invalid
 
 from pyams_content import _
 
@@ -333,6 +337,22 @@
 
     def updateWidgets(self, prefix=None):
         super(PictogramAddForm, self).updateWidgets(prefix)
+        if 'pictogram_name' in self.widgets:
+            pictograms = query_utility(IPictogramTable)
+            if pictograms is not None:
+                label_id = '{0}_pictogram_label'.format(self.id)
+                widget = self.widgets['pictogram_name']
+                widget.after_widget_notice = '<span id="{0}" class="text-info">{1}</span>'.format(
+                    label_id,
+                    self.request.localizer.translate(_("Default header: --")))
+                widget.object_data = {
+                    'ams-change-handler': 'MyAMS.helpers.select2ChangeHelper',
+                    'ams-stop-propagation': 'true',
+                    'ams-select2-helper-type': 'html',
+                    'ams-select2-helper-url': absolute_url(pictograms, self.request, 'get-pictogram-header.html'),
+                    'ams-select2-helper-target': '#{0}'.format(label_id)
+                }
+                alsoProvides(widget, IObjectData)
         if 'body' in self.widgets:
             self.widgets['body'].widget_css_class = 'textarea height-100'
 
@@ -356,6 +376,14 @@
         }
 
 
+@subscriber(IDataExtractedEvent, form_selector=PictogramAddForm)
+def handle_pictogram_add_form_data_extraction(event):
+    """Handle pictogram add form data extraction"""
+    data = event.data
+    if not data.get('pictogram_name'):
+        event.form.widgets.errors += (Invalid(_("You must select a pictogram!")), )
+
+
 @pagelet_config(name='properties.html', context=IPictogramItem, layer=IPyAMSLayer, permission=MANAGE_CONTENT_PERMISSION)
 class PictogramPropertiesEditForm(AdminDialogEditForm):
     """Pictogram properties edit form"""
@@ -371,6 +399,28 @@
 
     def updateWidgets(self, prefix=None):
         super(PictogramPropertiesEditForm, self).updateWidgets(prefix)
+        if 'pictogram_name' in self.widgets:
+            pictograms = query_utility(IPictogramTable)
+            if pictograms is not None:
+                pictogram = pictograms.get(self.context.pictogram_name)
+                label_id = '{0}_pictogram_label'.format(self.id)
+                widget = self.widgets['pictogram_name']
+                widget.required = True
+                if pictogram is None:
+                    widget.after_widget_notice = '<span id="{0}" class="text-info">{1}</span>'.format(label_id, '--')
+                else:
+                    widget.after_widget_notice = '<span id="{0}" class="text-info">{1}</span>'.format(
+                        label_id,
+                        self.request.localizer.translate(_("Default header: {0}")).format(
+                            II18n(pictogram).query_attribute('header', request=self.request) or '--'))
+                widget.object_data = {
+                    'ams-change-handler': 'MyAMS.helpers.select2ChangeHelper',
+                    'ams-stop-propagation': 'true',
+                    'ams-select2-helper-type': 'html',
+                    'ams-select2-helper-url': absolute_url(pictograms, self.request, 'get-pictogram-header.html'),
+                    'ams-select2-helper-target': '#{0}'.format(label_id)
+                }
+                alsoProvides(widget, IObjectData)
         if 'body' in self.widgets:
             self.widgets['body'].widget_css_class = 'textarea height-100'
 
@@ -388,3 +438,11 @@
             output.setdefault('events', []).append(
                 get_json_table_row_refresh_event(target, self.request, PictogramsTable, self.context))
         return output
+
+
+@subscriber(IDataExtractedEvent, form_selector=PictogramPropertiesEditForm)
+def handle_pictogram_edit_form_data_extraction(event):
+    """Handle pictogram edit form data extraction"""
+    data = event.data
+    if not data.get('pictogram_name'):
+        event.form.widgets.errors += (Invalid(_("You must select a pictogram!")), )
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	Mon Jun 04 15:00:16 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Mon Jun 04 16:43:56 2018 +0200
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-05-30 17:02+0200\n"
+"POT-Creation-Date: 2018-06-04 16:44+0200\n"
 "PO-Revision-Date: 2015-09-10 10:42+0200\n"
 "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
 "Language-Team: French\n"
@@ -280,7 +280,7 @@
 #: src/pyams_content/shared/site/zmi/folder.py:64
 #: src/pyams_content/root/zmi/templates/advanced-search.pt:188
 #: src/pyams_content/interfaces/__init__.py:99
-#: src/pyams_content/reference/pictograms/zmi/__init__.py:162
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:165
 msgid "Title"
 msgstr "Titre"
 
@@ -517,7 +517,7 @@
 
 #: src/pyams_content/component/paragraph/milestone.py:199
 #: src/pyams_content/component/paragraph/milestone.py:222
-#: src/pyams_content/component/paragraph/zmi/milestone.py:297
+#: src/pyams_content/component/paragraph/zmi/milestone.py:303
 msgid "Milestones"
 msgstr "Chronologie"
 
@@ -552,7 +552,7 @@
 
 #: src/pyams_content/component/paragraph/pictogram.py:189
 #: src/pyams_content/component/paragraph/pictogram.py:212
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:301
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:305
 msgid "Pictograms"
 msgstr "Pictogrammes"
 
@@ -566,7 +566,7 @@
 
 #: src/pyams_content/component/paragraph/keynumber.py:183
 #: src/pyams_content/component/paragraph/keynumber.py:207
-#: src/pyams_content/component/paragraph/zmi/keynumber.py:279
+#: src/pyams_content/component/paragraph/zmi/keynumber.py:282
 msgid "Key numbers"
 msgstr "Chiffres-clés"
 
@@ -634,29 +634,29 @@
 msgid "Edit milestone paragraph properties"
 msgstr "Propriétés de la chronologie"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:255
+#: src/pyams_content/component/paragraph/zmi/milestone.py:258
 #: src/pyams_content/component/paragraph/interfaces/milestone.py:49
 msgid "Associated label"
 msgstr "Information associée"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:264
+#: src/pyams_content/component/paragraph/zmi/milestone.py:270
 #: src/pyams_content/component/paragraph/interfaces/milestone.py:53
 msgid "Anchor"
 msgstr "Ancre"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:312
+#: src/pyams_content/component/paragraph/zmi/milestone.py:318
 msgid "Add milestone"
 msgstr "Ajouter un jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:323
+#: src/pyams_content/component/paragraph/zmi/milestone.py:329
 msgid "Add new milestone"
 msgstr "Ajout d'un jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:356
+#: src/pyams_content/component/paragraph/zmi/milestone.py:362
 msgid "Edit milestone properties"
 msgstr "Propriétés du jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:345
+#: src/pyams_content/component/paragraph/zmi/milestone.py:351
 msgid "Milestone was correctly added"
 msgstr "Le jalon a été ajouté."
 
@@ -792,49 +792,65 @@
 "Vérifiez le paramétrage des types de blocs de contenu autorisés pour pouvoir "
 "ajouter de nouveaux blocs."
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:79
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:83
 msgid "Pictograms..."
 msgstr "Pictogrammes"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:90
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:94
 msgid "Add new pictogram paragraph"
 msgstr "Ajout de pictogrammes"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:122
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:126
 msgid "Edit pictogram paragraph properties"
 msgstr "Propriétés des pictogrammes"
 
 #. Default: Header
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:264
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:268
 msgid "pictogram-item-header"
 msgstr "En-tête"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:279
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:283
 #: src/pyams_content/component/paragraph/zmi/keynumber.py:263
 #: src/pyams_content/component/paragraph/interfaces/pictogram.py:58
 #: src/pyams_content/component/paragraph/interfaces/keynumber.py:54
 msgid "Associated text"
 msgstr "Texte associé"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:316
-#: src/pyams_content/reference/pictograms/zmi/__init__.py:59
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:320
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:62
 msgid "Add pictogram"
 msgstr "Ajouter un pictogramme"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:327
-#: src/pyams_content/reference/pictograms/zmi/__init__.py:70
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:331
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:73
 msgid "Add new pictogram"
 msgstr "Ajout d'un pictogramme"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:365
-#: src/pyams_content/reference/pictograms/zmi/__init__.py:100
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:393
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:103
 msgid "Edit pictogram properties"
 msgstr "Propriétés du pictogramme"
 
-#: src/pyams_content/component/paragraph/zmi/pictogram.py:354
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:374
 msgid "Pictogram was correctly added"
 msgstr "Le pictogramme a été ajouté."
 
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:384
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:448
+msgid "You must select a pictogram!"
+msgstr "Vous devez sélectionner un pictogramme !"
+
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:347
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:186
+msgid "Default header: --"
+msgstr "En-tête par défaut : --"
+
+#: src/pyams_content/component/paragraph/zmi/pictogram.py:414
+#: src/pyams_content/reference/pictograms/zmi/__init__.py:190
+#, python-format
+msgid "Default header: {0}"
+msgstr "En-tête par défaut : {0}"
+
 #: src/pyams_content/component/paragraph/zmi/keynumber.py:76
 msgid "Key numbers..."
 msgstr "Chiffres-clés"
@@ -858,19 +874,19 @@
 msgid "key-number-label"
 msgstr "En-tête"
 
-#: src/pyams_content/component/paragraph/zmi/keynumber.py:294
+#: src/pyams_content/component/paragraph/zmi/keynumber.py:297
 msgid "Add keynumber"
 msgstr "Ajouter un chiffre-clé"
 
-#: src/pyams_content/component/paragraph/zmi/keynumber.py:305
+#: src/pyams_content/component/paragraph/zmi/keynumber.py:308
 msgid "Add new keynumber"
 msgstr "Ajout d'un chiffre-clé"
 
-#: src/pyams_content/component/paragraph/zmi/keynumber.py:338
+#: src/pyams_content/component/paragraph/zmi/keynumber.py:341
 msgid "Edit keynumber properties"
 msgstr "Propriétés du chiffre-clé"
 
-#: src/pyams_content/component/paragraph/zmi/keynumber.py:327
+#: src/pyams_content/component/paragraph/zmi/keynumber.py:330
 msgid "Key number was correctly added"
 msgstr "Le chiffre-clé a été ajouté."
 
@@ -1183,33 +1199,33 @@
 msgstr "Fonction du contact"
 
 #: src/pyams_content/component/paragraph/interfaces/contact.py:57
-msgid "Photo"
-msgstr "Photo"
+msgid "Email address"
+msgstr "Adresse de messagerie"
 
 #: src/pyams_content/component/paragraph/interfaces/contact.py:58
+msgid "Contact email address"
+msgstr "Adresse de messagerie \"stricte\", soit uniquement \"xxx@yyy.com\""
+
+#: src/pyams_content/component/paragraph/interfaces/contact.py:61
+msgid "Contact form"
+msgstr "Formulaire de contact"
+
+#: src/pyams_content/component/paragraph/interfaces/contact.py:62
+msgid "Reference of contact form"
+msgstr "Référence d'un formulaire de contact"
+
+#: src/pyams_content/component/paragraph/interfaces/contact.py:66
+msgid "Photo"
+msgstr "Photo"
+
+#: src/pyams_content/component/paragraph/interfaces/contact.py:67
 msgid "Use 'browse' button to select contact picture"
 msgstr "Utilisez le bouton 'Parcourir' pour sélectionner la photo du contact"
 
-#: src/pyams_content/component/paragraph/interfaces/contact.py:66
+#: src/pyams_content/component/paragraph/interfaces/contact.py:75
 msgid "Address"
 msgstr "Adresse"
 
-#: src/pyams_content/component/paragraph/interfaces/contact.py:69
-msgid "Email address"
-msgstr "Adresse de messagerie"
-
-#: src/pyams_content/component/paragraph/interfaces/contact.py:70
-msgid "Contact email address"
-msgstr "Adresse de messagerie \"stricte\", soit uniquement \"xxx@yyy.com\""
-
-#: src/pyams_content/component/paragraph/interfaces/contact.py:73
-msgid "Contact form"
-msgstr "Formulaire de contact"
-
-#: src/pyams_content/component/paragraph/interfaces/contact.py:74
-msgid "Reference of contact form"
-msgstr "Référence d'un formulaire de contact"
-
 #: src/pyams_content/component/paragraph/interfaces/contact.py:78
 msgid "Contact template"
 msgstr "Mode de rendu"
@@ -1218,11 +1234,11 @@
 msgid "Presentation template used for this contact"
 msgstr "Modèle de présentation utilisé pour ce contact"
 
-#: src/pyams_content/component/paragraph/interfaces/contact.py:62
+#: src/pyams_content/component/paragraph/interfaces/contact.py:71
 msgid "GPS location"
 msgstr "Position GPS"
 
-#: src/pyams_content/component/paragraph/interfaces/contact.py:63
+#: src/pyams_content/component/paragraph/interfaces/contact.py:72
 msgid "GPS coordinates used to locate contact"
 msgstr "Coordonnées GPS de situation du contact"
 
--- a/src/pyams_content/locales/pyams_content.pot	Mon Jun 04 15:00:16 2018 +0200
+++ b/src/pyams_content/locales/pyams_content.pot	Mon Jun 04 16:43:56 2018 +0200
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-05-30 17:02+0200\n"
+"POT-Creation-Date: 2018-06-04 16:44+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"
@@ -270,7 +270,7 @@
 #: ./src/pyams_content/shared/site/zmi/folder.py:64
 #: ./src/pyams_content/root/zmi/templates/advanced-search.pt:188
 #: ./src/pyams_content/interfaces/__init__.py:99
-#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:162
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:165
 msgid "Title"
 msgstr ""
 
@@ -490,7 +490,7 @@
 
 #: ./src/pyams_content/component/paragraph/milestone.py:199
 #: ./src/pyams_content/component/paragraph/milestone.py:222
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:297
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:303
 msgid "Milestones"
 msgstr ""
 
@@ -525,7 +525,7 @@
 
 #: ./src/pyams_content/component/paragraph/pictogram.py:189
 #: ./src/pyams_content/component/paragraph/pictogram.py:212
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:301
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:305
 msgid "Pictograms"
 msgstr ""
 
@@ -539,7 +539,7 @@
 
 #: ./src/pyams_content/component/paragraph/keynumber.py:183
 #: ./src/pyams_content/component/paragraph/keynumber.py:207
-#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:279
+#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:282
 msgid "Key numbers"
 msgstr ""
 
@@ -607,29 +607,29 @@
 msgid "Edit milestone paragraph properties"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:255
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:258
 #: ./src/pyams_content/component/paragraph/interfaces/milestone.py:49
 msgid "Associated label"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:264
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:270
 #: ./src/pyams_content/component/paragraph/interfaces/milestone.py:53
 msgid "Anchor"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:312
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:318
 msgid "Add milestone"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:323
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:329
 msgid "Add new milestone"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:356
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:362
 msgid "Edit milestone properties"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:345
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:351
 msgid "Milestone was correctly added"
 msgstr ""
 
@@ -753,49 +753,65 @@
 msgid "Check allowed paragraph types to be able to create new paragraphs."
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:79
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:83
 msgid "Pictograms..."
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:90
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:94
 msgid "Add new pictogram paragraph"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:122
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:126
 msgid "Edit pictogram paragraph properties"
 msgstr ""
 
 #. Default: Header
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:264
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:268
 msgid "pictogram-item-header"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:279
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:283
 #: ./src/pyams_content/component/paragraph/zmi/keynumber.py:263
 #: ./src/pyams_content/component/paragraph/interfaces/pictogram.py:58
 #: ./src/pyams_content/component/paragraph/interfaces/keynumber.py:54
 msgid "Associated text"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:316
-#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:59
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:320
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:62
 msgid "Add pictogram"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:327
-#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:70
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:331
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:73
 msgid "Add new pictogram"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:365
-#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:100
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:393
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:103
 msgid "Edit pictogram properties"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:354
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:374
 msgid "Pictogram was correctly added"
 msgstr ""
 
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:384
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:448
+msgid "You must select a pictogram!"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:347
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:186
+msgid "Default header: --"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/zmi/pictogram.py:414
+#: ./src/pyams_content/reference/pictograms/zmi/__init__.py:190
+#, python-format
+msgid "Default header: {0}"
+msgstr ""
+
 #: ./src/pyams_content/component/paragraph/zmi/keynumber.py:76
 msgid "Key numbers..."
 msgstr ""
@@ -819,19 +835,19 @@
 msgid "key-number-label"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:294
+#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:297
 msgid "Add keynumber"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:305
+#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:308
 msgid "Add new keynumber"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:338
+#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:341
 msgid "Edit keynumber properties"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:327
+#: ./src/pyams_content/component/paragraph/zmi/keynumber.py:330
 msgid "Key number was correctly added"
 msgstr ""
 
@@ -1132,33 +1148,33 @@
 msgstr ""
 
 #: ./src/pyams_content/component/paragraph/interfaces/contact.py:57
-msgid "Photo"
+msgid "Email address"
 msgstr ""
 
 #: ./src/pyams_content/component/paragraph/interfaces/contact.py:58
-msgid "Use 'browse' button to select contact picture"
+msgid "Contact email address"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:61
+msgid "Contact form"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:62
+msgid "Reference of contact form"
 msgstr ""
 
 #: ./src/pyams_content/component/paragraph/interfaces/contact.py:66
+msgid "Photo"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:67
+msgid "Use 'browse' button to select contact picture"
+msgstr ""
+
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:75
 msgid "Address"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:69
-msgid "Email address"
-msgstr ""
-
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:70
-msgid "Contact email address"
-msgstr ""
-
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:73
-msgid "Contact form"
-msgstr ""
-
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:74
-msgid "Reference of contact form"
-msgstr ""
-
 #: ./src/pyams_content/component/paragraph/interfaces/contact.py:78
 msgid "Contact template"
 msgstr ""
@@ -1167,11 +1183,11 @@
 msgid "Presentation template used for this contact"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:62
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:71
 msgid "GPS location"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/interfaces/contact.py:63
+#: ./src/pyams_content/component/paragraph/interfaces/contact.py:72
 msgid "GPS coordinates used to locate contact"
 msgstr ""
 
--- a/src/pyams_content/reference/pictograms/zmi/__init__.py	Mon Jun 04 15:00:16 2018 +0200
+++ b/src/pyams_content/reference/pictograms/zmi/__init__.py	Mon Jun 04 16:43:56 2018 +0200
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from z3c.form.interfaces import NOVALUE, NO_VALUE
 
 __docformat__ = 'restructuredtext'
 
@@ -43,6 +44,8 @@
 from pyams_utils.url import absolute_url
 from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
+from pyramid.httpexceptions import HTTPNotFound, HTTPBadRequest
+from pyramid.response import Response
 from pyramid.view import view_config
 from z3c.form import field
 from z3c.table.column import GetAttrColumn
@@ -169,3 +172,20 @@
     """Pictograms table contents view"""
 
     table_class = PictogramTableContentsTable
+
+
+@view_config(name='get-pictogram-header.html', context=IPictogramTable, request_type=IPyAMSLayer,
+             permission=VIEW_SYSTEM_PERMISSION)
+def get_pictogram_label(request):
+    """Get alternate label associated with a given pictogram"""
+    name = request.params.get('value')
+    if not name:
+        raise HTTPBadRequest()
+    translate = request.localizer.translate
+    if name == '--NOVALUE--':
+        return Response(translate(_("Default header: --")))
+    pictogram = request.context.get(name)
+    if pictogram is None:
+        raise HTTPNotFound()
+    return Response(translate(_("Default header: {0}")).format(
+        II18n(pictogram).query_attribute('header', request=request) or '--'))