Updated skin selection form
authorThierry Florac <thierry.florac@onf.fr>
Fri, 04 May 2018 09:56:18 +0200
changeset 66 3e45ad0f6af2
parent 65 22b5ec4dc2bf
child 67 c59cf337d102
Updated skin selection form
src/pyams_zmi/locales/fr/LC_MESSAGES/pyams_zmi.mo
src/pyams_zmi/locales/fr/LC_MESSAGES/pyams_zmi.po
src/pyams_zmi/locales/pyams_zmi.pot
src/pyams_zmi/zmi/skin.py
Binary file src/pyams_zmi/locales/fr/LC_MESSAGES/pyams_zmi.mo has changed
--- a/src/pyams_zmi/locales/fr/LC_MESSAGES/pyams_zmi.po	Fri May 04 09:39:23 2018 +0200
+++ b/src/pyams_zmi/locales/fr/LC_MESSAGES/pyams_zmi.po	Fri May 04 09:56:18 2018 +0200
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-03-11 03:18+0100\n"
+"POT-Creation-Date: 2018-05-04 09:40+0200\n"
 "PO-Revision-Date: 2015-02-04 09:50+0100\n"
 "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
 "Language-Team: French <traduc@traduc.org>\n"
@@ -20,73 +20,17 @@
 msgid "PyAMS management skin"
 msgstr "Skin d'administration PyAMS"
 
-#: src/pyams_zmi/viewlet/menu/__init__.py:40
-msgid "Content management"
-msgstr "Suivre l'activité"
-
-#: src/pyams_zmi/viewlet/menu/__init__.py:50
-msgid "Site management"
-msgstr "Gérer le site"
-
-#: src/pyams_zmi/viewlet/menu/__init__.py:60
-msgid "Control panel"
-msgstr "Panneau de configuration"
-
-#: src/pyams_zmi/zmi/site.py:66
-msgid "Properties"
-msgstr "Propriétés"
-
-#: src/pyams_zmi/zmi/site.py:76
-msgid "Update main site properties"
-msgstr "Propriétés de base du site"
-
-#: src/pyams_zmi/zmi/site.py:130
-msgid "Back-office properties..."
-msgstr "Propriétés du back-office"
-
-#: src/pyams_zmi/zmi/site.py:141
-msgid "Update site back-office properties"
-msgstr "Propriétés du back-office du site"
-
-#: src/pyams_zmi/zmi/site.py:193
-msgid "ZMI configuration..."
-msgstr "Configuration ZMI"
-
-#: src/pyams_zmi/zmi/site.py:204
-msgid "Update ZMI configuration"
-msgstr "Configuration de la ZMI"
-
-#: src/pyams_zmi/zmi/skin.py:52
+#: src/pyams_zmi/zmi/skin.py:55
 msgid "Graphic theme..."
 msgstr "Thème graphique"
 
-#: src/pyams_zmi/zmi/skin.py:63
+#: src/pyams_zmi/zmi/skin.py:68
 msgid "Graphic theme elements"
 msgstr "Thème graphique"
 
-#: src/pyams_zmi/zmi/extension.py:53
-msgid "Google Tag Manager..."
-msgstr "Google Tag Manager"
-
-#: src/pyams_zmi/zmi/extension.py:64
-msgid "Update Google Tag Manager properties"
-msgstr "Propriétés du service Google Tag Manager"
-
-#: src/pyams_zmi/zmi/extension.py:89
-msgid "Google Analytics..."
-msgstr "Google Analytics"
-
-#: src/pyams_zmi/zmi/extension.py:100
-msgid "Update Google Analytics properties"
-msgstr "Propriétés du service Google Analytics"
-
-#: src/pyams_zmi/zmi/extension.py:125
-msgid "UserReport settings..."
-msgstr "UserReport"
-
-#: src/pyams_zmi/zmi/extension.py:136
-msgid "Update UserReport service properties"
-msgstr "Propriétés du service UserReport"
+#: src/pyams_zmi/zmi/skin.py:88
+msgid "Don't inherit parent skin"
+msgstr "Ne pas hériter du thème du parent"
 
 #: src/pyams_zmi/zmi/control_panel.py:62
 msgid "Utilities"
@@ -96,35 +40,35 @@
 msgid "Site utilities"
 msgstr "Utilitaires du site"
 
-#: src/pyams_zmi/zmi/control_panel.py:86
+#: src/pyams_zmi/zmi/control_panel.py:88
 msgid "Delete utility"
 msgstr "Supprimer cet utilitaire"
 
-#: src/pyams_zmi/zmi/control_panel.py:150
+#: src/pyams_zmi/zmi/control_panel.py:140
 msgid "Component"
 msgstr "Composant"
 
-#: src/pyams_zmi/zmi/control_panel.py:172
+#: src/pyams_zmi/zmi/control_panel.py:162
 msgid "Registered interface"
 msgstr "Interface enregistrée"
 
-#: src/pyams_zmi/zmi/control_panel.py:187
+#: src/pyams_zmi/zmi/control_panel.py:177
 msgid "Name"
 msgstr "Nom"
 
-#: src/pyams_zmi/zmi/control_panel.py:207
+#: src/pyams_zmi/zmi/control_panel.py:197
 msgid "Local registrations"
 msgstr "Registre local"
 
-#: src/pyams_zmi/zmi/control_panel.py:216
+#: src/pyams_zmi/zmi/control_panel.py:206
 msgid "Local utilities registrations"
 msgstr "Registre local des composants"
 
-#: src/pyams_zmi/zmi/control_panel.py:253
+#: src/pyams_zmi/zmi/control_panel.py:243
 msgid "Local registry utilities"
 msgstr "Le registre local des composants"
 
-#: src/pyams_zmi/zmi/control_panel.py:254
+#: src/pyams_zmi/zmi/control_panel.py:244
 msgid ""
 "A local registry is a registry defining utilities stored into\n"
 "site's Object Database (ZODB).\n"
@@ -143,19 +87,19 @@
 "Vous pouvez gérer ces composants et modifier leurs propriétés pour changer "
 "le comportement du site sans modifier l'application."
 
-#: src/pyams_zmi/zmi/control_panel.py:271
+#: src/pyams_zmi/zmi/control_panel.py:261
 msgid "Global registrations"
 msgstr "Registre global"
 
-#: src/pyams_zmi/zmi/control_panel.py:280
+#: src/pyams_zmi/zmi/control_panel.py:270
 msgid "Global utilities registrations"
 msgstr "Registre global des composants"
 
-#: src/pyams_zmi/zmi/control_panel.py:317
+#: src/pyams_zmi/zmi/control_panel.py:307
 msgid "Global registry utilities"
 msgstr "Le registre global des composants"
 
-#: src/pyams_zmi/zmi/control_panel.py:318
+#: src/pyams_zmi/zmi/control_panel.py:308
 msgid ""
 "The global registry groups local utilities as well as utilities registered "
 "outside\n"
@@ -172,17 +116,73 @@
 "inclusions de paquets ou des directives ZCML) et ne peuvent être modifiés "
 "sans modifier la configuration du site."
 
-#: src/pyams_zmi/zmi/control_panel.py:195
+#: src/pyams_zmi/zmi/control_panel.py:185
 msgid "< no name >"
 msgstr "< pas de nom >"
 
-#: src/pyams_zmi/zmi/control_panel.py:128
-msgid "No provided object_name argument!"
-msgstr "L'argument 'object_name' n'a pas été fourni !"
+#: src/pyams_zmi/zmi/site.py:66
+msgid "Properties"
+msgstr "Propriétés"
+
+#: src/pyams_zmi/zmi/site.py:76
+msgid "Update main site properties"
+msgstr "Propriétés de base du site"
+
+#: src/pyams_zmi/zmi/site.py:132
+msgid "Back-office properties..."
+msgstr "Propriétés du back-office"
+
+#: src/pyams_zmi/zmi/site.py:145
+msgid "Update site back-office properties"
+msgstr "Propriétés du back-office du site"
+
+#: src/pyams_zmi/zmi/site.py:199
+msgid "ZMI configuration..."
+msgstr "Configuration ZMI"
+
+#: src/pyams_zmi/zmi/site.py:212
+msgid "Update ZMI configuration"
+msgstr "Configuration de la ZMI"
+
+#: src/pyams_zmi/zmi/extension.py:53
+msgid "Google Tag Manager..."
+msgstr "Google Tag Manager"
+
+#: src/pyams_zmi/zmi/extension.py:66
+msgid "Update Google Tag Manager properties"
+msgstr "Propriétés du service Google Tag Manager"
 
-#: src/pyams_zmi/zmi/control_panel.py:133
-msgid "Given utility name doesn't exist!"
-msgstr "L'utilitaire indiqué n'existe pas !"
+#: src/pyams_zmi/zmi/extension.py:91
+msgid "Google Analytics..."
+msgstr "Google Analytics"
+
+#: src/pyams_zmi/zmi/extension.py:104
+msgid "Update Google Analytics properties"
+msgstr "Propriétés du service Google Analytics"
+
+#: src/pyams_zmi/zmi/extension.py:129
+msgid "UserReport settings..."
+msgstr "UserReport"
+
+#: src/pyams_zmi/zmi/extension.py:142
+msgid "Update UserReport service properties"
+msgstr "Propriétés du service UserReport"
+
+#: src/pyams_zmi/zmi/templates/inner-table.pt:6
+msgid "View title"
+msgstr "Titre de la vue"
+
+#: src/pyams_zmi/viewlet/menu/__init__.py:40
+msgid "Content management"
+msgstr "Suivre l'activité"
+
+#: src/pyams_zmi/viewlet/menu/__init__.py:50
+msgid "Site management"
+msgstr "Gérer le site"
+
+#: src/pyams_zmi/viewlet/menu/__init__.py:60
+msgid "Control panel"
+msgstr "Panneau de configuration"
 
 #: src/pyams_zmi/interfaces/__init__.py:46
 msgid "Main package"
@@ -338,6 +338,12 @@
 "ATTENTION: ceci va réinitialiser toute la configuration de votre interface!"
 "&lt;/span&gt;"
 
+#~ msgid "No provided object_name argument!"
+#~ msgstr "L'argument 'object_name' n'a pas été fourni !"
+
+#~ msgid "Given utility name doesn't exist!"
+#~ msgstr "L'utilitaire indiqué n'existe pas !"
+
 #~ msgid "Local utilities registry"
 #~ msgstr "Registre local des composants"
 
--- a/src/pyams_zmi/locales/pyams_zmi.pot	Fri May 04 09:39:23 2018 +0200
+++ b/src/pyams_zmi/locales/pyams_zmi.pot	Fri May 04 09:56:18 2018 +0200
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-03-11 03:18+0100\n"
+"POT-Creation-Date: 2018-05-04 09:40+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"
@@ -20,16 +20,86 @@
 msgid "PyAMS management skin"
 msgstr ""
 
-#: ./src/pyams_zmi/viewlet/menu/__init__.py:40
-msgid "Content management"
+#: ./src/pyams_zmi/zmi/skin.py:55
+msgid "Graphic theme..."
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/skin.py:68
+msgid "Graphic theme elements"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/skin.py:88
+msgid "Don't inherit parent skin"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:62
+msgid "Utilities"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:72
+msgid "Site utilities"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:88
+msgid "Delete utility"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:140
+msgid "Component"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:162
+msgid "Registered interface"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:177
+msgid "Name"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:197
+msgid "Local registrations"
 msgstr ""
 
-#: ./src/pyams_zmi/viewlet/menu/__init__.py:50
-msgid "Site management"
+#: ./src/pyams_zmi/zmi/control_panel.py:206
+msgid "Local utilities registrations"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:243
+msgid "Local registry utilities"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:244
+msgid ""
+"A local registry is a registry defining utilities stored into\n"
+"site's Object Database (ZODB).\n"
+"\n"
+"You can manage these utilities and modify their properties and site's behaviour without\n"
+"modifying the application."
 msgstr ""
 
-#: ./src/pyams_zmi/viewlet/menu/__init__.py:60
-msgid "Control panel"
+#: ./src/pyams_zmi/zmi/control_panel.py:261
+msgid "Global registrations"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:270
+msgid "Global utilities registrations"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:307
+msgid "Global registry utilities"
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:308
+msgid ""
+"The global registry groups local utilities as well as utilities registered outside\n"
+"site's Object Database (ZODB).\n"
+"\n"
+"These utilities are declared statically (generally using include or ZCML directives) and can't be setup\n"
+"without modifying site configuration."
+msgstr ""
+
+#: ./src/pyams_zmi/zmi/control_panel.py:185
+msgid "< no name >"
 msgstr ""
 
 #: ./src/pyams_zmi/zmi/site.py:66
@@ -40,130 +110,60 @@
 msgid "Update main site properties"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/site.py:130
+#: ./src/pyams_zmi/zmi/site.py:132
 msgid "Back-office properties..."
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/site.py:141
+#: ./src/pyams_zmi/zmi/site.py:145
 msgid "Update site back-office properties"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/site.py:193
+#: ./src/pyams_zmi/zmi/site.py:199
 msgid "ZMI configuration..."
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/site.py:204
+#: ./src/pyams_zmi/zmi/site.py:212
 msgid "Update ZMI configuration"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/skin.py:52
-msgid "Graphic theme..."
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/skin.py:63
-msgid "Graphic theme elements"
-msgstr ""
-
 #: ./src/pyams_zmi/zmi/extension.py:53
 msgid "Google Tag Manager..."
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/extension.py:64
+#: ./src/pyams_zmi/zmi/extension.py:66
 msgid "Update Google Tag Manager properties"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/extension.py:89
+#: ./src/pyams_zmi/zmi/extension.py:91
 msgid "Google Analytics..."
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/extension.py:100
+#: ./src/pyams_zmi/zmi/extension.py:104
 msgid "Update Google Analytics properties"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/extension.py:125
+#: ./src/pyams_zmi/zmi/extension.py:129
 msgid "UserReport settings..."
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/extension.py:136
+#: ./src/pyams_zmi/zmi/extension.py:142
 msgid "Update UserReport service properties"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/control_panel.py:62
-msgid "Utilities"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:72
-msgid "Site utilities"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:86
-msgid "Delete utility"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:150
-msgid "Component"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:172
-msgid "Registered interface"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:187
-msgid "Name"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:207
-msgid "Local registrations"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:216
-msgid "Local utilities registrations"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:253
-msgid "Local registry utilities"
+#: ./src/pyams_zmi/zmi/templates/inner-table.pt:6
+msgid "View title"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/control_panel.py:254
-msgid ""
-"A local registry is a registry defining utilities stored into\n"
-"site's Object Database (ZODB).\n"
-"\n"
-"You can manage these utilities and modify their properties and site's behaviour without\n"
-"modifying the application."
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:271
-msgid "Global registrations"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:280
-msgid "Global utilities registrations"
+#: ./src/pyams_zmi/viewlet/menu/__init__.py:40
+msgid "Content management"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/control_panel.py:317
-msgid "Global registry utilities"
+#: ./src/pyams_zmi/viewlet/menu/__init__.py:50
+msgid "Site management"
 msgstr ""
 
-#: ./src/pyams_zmi/zmi/control_panel.py:318
-msgid ""
-"The global registry groups local utilities as well as utilities registered outside\n"
-"site's Object Database (ZODB).\n"
-"\n"
-"These utilities are declared statically (generally using include or ZCML directives) and can't be setup\n"
-"without modifying site configuration."
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:195
-msgid "< no name >"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:128
-msgid "No provided object_name argument!"
-msgstr ""
-
-#: ./src/pyams_zmi/zmi/control_panel.py:133
-msgid "Given utility name doesn't exist!"
+#: ./src/pyams_zmi/viewlet/menu/__init__.py:60
+msgid "Control panel"
 msgstr ""
 
 #: ./src/pyams_zmi/interfaces/__init__.py:46
--- a/src/pyams_zmi/zmi/skin.py	Fri May 04 09:39:23 2018 +0200
+++ b/src/pyams_zmi/zmi/skin.py	Fri May 04 09:56:18 2018 +0200
@@ -9,6 +9,9 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
+
+from pyams_form.group import NamedWidgetsGroup
 
 __docformat__ = 'restructuredtext'
 
@@ -68,14 +71,28 @@
 
     @property
     def fields(self):
-        fields = field.Fields(IUserSkinnable)
-        if not self.context.can_inherit_skin:
-            fields = fields.omit('inherit_skin')
+        if self.context.can_inherit_skin:
+            fields = field.Fields(IUserSkinnable).select('no_inherit_skin', 'skin')
+            fields['no_inherit_skin'].widgetFactory = SingleCheckBoxFieldWidget
+        else:
+            fields = field.Fields(IUserSkinnable).select('skin')
         return fields
 
     ajax_handler = 'user-skin-properties.json'
     edit_permission = MANAGE_SKIN_PERMISSION
 
+    def updateGroups(self):
+        if self.context.can_inherit_skin:
+            self.add_group(NamedWidgetsGroup(self, 'skin', self.widgets,
+                                             ('no_inherit_skin', 'skin'),
+                                             legend=_("Don't inherit parent skin"),
+                                             css_class='inner',
+                                             switch=True,
+                                             checkbox_switch=True,
+                                             checkbox_mode='disable',
+                                             checkbox_field=IUserSkinnable['no_inherit_skin']))
+        super(UserSkinnablePropertiesEditForm, self).updateGroups()
+
 
 @view_config(name='user-skin-properties.json', context=IUserSkinnable, request_type=IPyAMSLayer,
              permission=MANAGE_SKIN_PERMISSION, renderer='json', xhr=True)