Added new content-type column in site tree view
authorThierry Florac <thierry.florac@onf.fr>
Tue, 05 Jun 2018 16:51:00 +0200
changeset 580 51bea2402bba
parent 579 5e4875a9f692
child 581 e8befd0dd932
Added new content-type column in site tree view
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/shared/site/__init__.py
src/pyams_content/shared/site/folder.py
src/pyams_content/shared/site/interfaces/__init__.py
src/pyams_content/shared/site/link.py
src/pyams_content/shared/site/zmi/container.py
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 Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Tue Jun 05 16:51:00 2018 +0200
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-06-05 15:41+0200\n"
+"POT-Creation-Date: 2018-06-05 16:32+0200\n"
 "PO-Revision-Date: 2015-09-10 10:42+0200\n"
 "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
 "Language-Team: French\n"
@@ -399,7 +399,7 @@
 #: src/pyams_content/component/extfile/interfaces/__init__.py:36
 #: src/pyams_content/component/links/interfaces/__init__.py:33
 #: src/pyams_content/shared/imagemap/interfaces/__init__.py:54
-#: src/pyams_content/shared/site/interfaces/__init__.py:103
+#: src/pyams_content/shared/site/interfaces/__init__.py:105
 msgid "Alternate title"
 msgstr "Titre de substitution"
 
@@ -968,7 +968,7 @@
 #: src/pyams_content/component/paragraph/interfaces/keynumber.py:40
 #: src/pyams_content/component/association/interfaces/__init__.py:42
 #: src/pyams_content/shared/form/interfaces/__init__.py:86
-#: src/pyams_content/shared/site/interfaces/__init__.py:107
+#: src/pyams_content/shared/site/interfaces/__init__.py:109
 #: src/pyams_content/features/alert/interfaces.py:54
 msgid "Visible?"
 msgstr "Visible ?"
@@ -3014,13 +3014,13 @@
 
 #: src/pyams_content/shared/common/interfaces/__init__.py:155
 #: src/pyams_content/shared/site/zmi/folder.py:74
-#: src/pyams_content/shared/site/interfaces/__init__.py:56
+#: src/pyams_content/shared/site/interfaces/__init__.py:58
 msgid "Notepad"
 msgstr "Bloc-notes"
 
 #: src/pyams_content/shared/common/interfaces/__init__.py:156
 #: src/pyams_content/shared/site/zmi/folder.py:75
-#: src/pyams_content/shared/site/interfaces/__init__.py:57
+#: src/pyams_content/shared/site/interfaces/__init__.py:59
 msgid "Internal information to be known about this content"
 msgstr ""
 "Pour prendre note d'informations internes utiles ou importantes à propos de "
@@ -3682,6 +3682,14 @@
 msgid "Image map template"
 msgstr "Mode de rendu"
 
+#: src/pyams_content/shared/site/folder.py:56
+msgid "Site folder"
+msgstr "Rubrique"
+
+#: src/pyams_content/shared/site/link.py:46
+msgid "Content link"
+msgstr "Contenu lié"
+
 #: src/pyams_content/shared/site/zmi/folder.py:57
 msgid "Add site folder..."
 msgstr "Ajouter une rubrique"
@@ -3744,50 +3752,55 @@
 msgid "Edit content link properties"
 msgstr "Propriétés du lien"
 
-#: src/pyams_content/shared/site/zmi/container.py:102
-#: src/pyams_content/shared/site/zmi/container.py:114
+#: src/pyams_content/shared/site/zmi/container.py:103
+#: src/pyams_content/shared/site/zmi/container.py:115
 #: src/pyams_content/shared/blog/zmi/manager.py:158
 #: src/pyams_content/shared/blog/zmi/manager.py:170
 msgid "Publication dates..."
 msgstr "Dates de publication"
 
-#: src/pyams_content/shared/site/zmi/container.py:127
+#: src/pyams_content/shared/site/zmi/container.py:128
 #: src/pyams_content/shared/blog/zmi/manager.py:183
 msgid "Update publication dates"
 msgstr "Dates de publication"
 
-#: src/pyams_content/shared/site/zmi/container.py:172
-#: src/pyams_content/shared/site/zmi/container.py:182
+#: src/pyams_content/shared/site/zmi/container.py:173
+#: src/pyams_content/shared/site/zmi/container.py:183
 #: src/pyams_content/root/zmi/sites.py:68
 msgid "Site tree"
 msgstr "Arborescence du site"
 
-#: src/pyams_content/shared/site/zmi/container.py:301
-#: src/pyams_content/shared/site/zmi/container.py:151
+#: src/pyams_content/shared/site/zmi/container.py:302
+#: src/pyams_content/shared/site/zmi/container.py:152
 msgid "Visible element?"
 msgstr "Élément visible ?"
 
-#: src/pyams_content/shared/site/zmi/container.py:302
+#: src/pyams_content/shared/site/zmi/container.py:303
 msgid "Switch element visibility"
 msgstr "Cliquez pour rendre l'élément visible ou non"
 
-#: src/pyams_content/shared/site/zmi/container.py:363
+#: src/pyams_content/shared/site/zmi/container.py:364
 msgid "Folders and topics"
-msgstr "Rubriques et articles"
-
-#: src/pyams_content/shared/site/zmi/container.py:483
+msgstr "Rubriquage"
+
+#: src/pyams_content/shared/site/zmi/container.py:400
+#: src/pyams_content/root/zmi/__init__.py:798
+msgid "Content"
+msgstr "Contenu"
+
+#: src/pyams_content/shared/site/zmi/container.py:496
 msgid "Delete site item"
 msgstr "Supprimer ce contenu"
 
-#: src/pyams_content/shared/site/zmi/container.py:372
+#: src/pyams_content/shared/site/zmi/container.py:373
 msgid "Click to open/close all folders"
 msgstr "Afficher/masquer toutes les rubriques"
 
-#: src/pyams_content/shared/site/zmi/container.py:388
+#: src/pyams_content/shared/site/zmi/container.py:389
 msgid "Click to show/hide inner folders"
 msgstr "Cliquer pour afficher ou cache les sous-niveaux"
 
-#: src/pyams_content/shared/site/zmi/container.py:258
+#: src/pyams_content/shared/site/zmi/container.py:259
 msgid "Can't reparent object to one of it's children. Reloading..."
 msgstr ""
 "Impossible de déplacer une rubrique dans l'une de ses sous-rubriques ou "
@@ -3819,15 +3832,15 @@
 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:85
+#: src/pyams_content/shared/site/interfaces/__init__.py:87
 msgid "Topic"
 msgstr "Article"
 
-#: src/pyams_content/shared/site/interfaces/__init__.py:104
+#: src/pyams_content/shared/site/interfaces/__init__.py:106
 msgid "Content title, as shown in front-office"
 msgstr "Titre présenté aux internautes"
 
-#: src/pyams_content/shared/site/interfaces/__init__.py:108
+#: src/pyams_content/shared/site/interfaces/__init__.py:110
 msgid "If 'no', link is not visible"
 msgstr "Si 'non', le lien ne sera pas visible"
 
@@ -3987,10 +4000,6 @@
 msgid "Home"
 msgstr "Accueil"
 
-#: src/pyams_content/root/zmi/__init__.py:798
-msgid "Content"
-msgstr "Contenu"
-
 #: src/pyams_content/root/zmi/templates/dashboard.pt:7
 msgid "Your contents dashboard"
 msgstr "Les contenus qui me concernent"
--- a/src/pyams_content/locales/pyams_content.pot	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/locales/pyams_content.pot	Tue Jun 05 16:51:00 2018 +0200
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-06-05 15:41+0200\n"
+"POT-Creation-Date: 2018-06-05 16:32+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"
@@ -386,7 +386,7 @@
 #: ./src/pyams_content/component/extfile/interfaces/__init__.py:36
 #: ./src/pyams_content/component/links/interfaces/__init__.py:33
 #: ./src/pyams_content/shared/imagemap/interfaces/__init__.py:54
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:103
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:105
 msgid "Alternate title"
 msgstr ""
 
@@ -929,7 +929,7 @@
 #: ./src/pyams_content/component/paragraph/interfaces/keynumber.py:40
 #: ./src/pyams_content/component/association/interfaces/__init__.py:42
 #: ./src/pyams_content/shared/form/interfaces/__init__.py:86
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:107
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:109
 #: ./src/pyams_content/features/alert/interfaces.py:54
 msgid "Visible?"
 msgstr ""
@@ -2846,13 +2846,13 @@
 
 #: ./src/pyams_content/shared/common/interfaces/__init__.py:155
 #: ./src/pyams_content/shared/site/zmi/folder.py:74
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:56
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:58
 msgid "Notepad"
 msgstr ""
 
 #: ./src/pyams_content/shared/common/interfaces/__init__.py:156
 #: ./src/pyams_content/shared/site/zmi/folder.py:75
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:57
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:59
 msgid "Internal information to be known about this content"
 msgstr ""
 
@@ -3469,6 +3469,14 @@
 msgid "Image map template"
 msgstr ""
 
+#: ./src/pyams_content/shared/site/folder.py:56
+msgid "Site folder"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/link.py:46
+msgid "Content link"
+msgstr ""
+
 #: ./src/pyams_content/shared/site/zmi/folder.py:57
 msgid "Add site folder..."
 msgstr ""
@@ -3529,50 +3537,55 @@
 msgid "Edit content link properties"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:102
-#: ./src/pyams_content/shared/site/zmi/container.py:114
+#: ./src/pyams_content/shared/site/zmi/container.py:103
+#: ./src/pyams_content/shared/site/zmi/container.py:115
 #: ./src/pyams_content/shared/blog/zmi/manager.py:158
 #: ./src/pyams_content/shared/blog/zmi/manager.py:170
 msgid "Publication dates..."
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:127
+#: ./src/pyams_content/shared/site/zmi/container.py:128
 #: ./src/pyams_content/shared/blog/zmi/manager.py:183
 msgid "Update publication dates"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:172
-#: ./src/pyams_content/shared/site/zmi/container.py:182
+#: ./src/pyams_content/shared/site/zmi/container.py:173
+#: ./src/pyams_content/shared/site/zmi/container.py:183
 #: ./src/pyams_content/root/zmi/sites.py:68
 msgid "Site tree"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:301
-#: ./src/pyams_content/shared/site/zmi/container.py:151
-msgid "Visible element?"
-msgstr ""
-
 #: ./src/pyams_content/shared/site/zmi/container.py:302
+#: ./src/pyams_content/shared/site/zmi/container.py:152
+msgid "Visible element?"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/zmi/container.py:303
 msgid "Switch element visibility"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:363
+#: ./src/pyams_content/shared/site/zmi/container.py:364
 msgid "Folders and topics"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:483
+#: ./src/pyams_content/shared/site/zmi/container.py:400
+#: ./src/pyams_content/root/zmi/__init__.py:798
+msgid "Content"
+msgstr ""
+
+#: ./src/pyams_content/shared/site/zmi/container.py:496
 msgid "Delete site item"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:372
+#: ./src/pyams_content/shared/site/zmi/container.py:373
 msgid "Click to open/close all folders"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:388
+#: ./src/pyams_content/shared/site/zmi/container.py:389
 msgid "Click to show/hide inner folders"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/zmi/container.py:258
+#: ./src/pyams_content/shared/site/zmi/container.py:259
 msgid "Can't reparent object to one of it's children. Reloading..."
 msgstr ""
 
@@ -3602,15 +3615,15 @@
 msgid "A site manager is already registered with this name!!"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:85
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:87
 msgid "Topic"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:104
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:106
 msgid "Content title, as shown in front-office"
 msgstr ""
 
-#: ./src/pyams_content/shared/site/interfaces/__init__.py:108
+#: ./src/pyams_content/shared/site/interfaces/__init__.py:110
 msgid "If 'no', link is not visible"
 msgstr ""
 
@@ -3770,10 +3783,6 @@
 msgid "Home"
 msgstr ""
 
-#: ./src/pyams_content/root/zmi/__init__.py:798
-msgid "Content"
-msgstr ""
-
 #: ./src/pyams_content/root/zmi/templates/dashboard.pt:7
 msgid "Your contents dashboard"
 msgstr ""
--- a/src/pyams_content/shared/site/__init__.py	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/shared/site/__init__.py	Tue Jun 05 16:51:00 2018 +0200
@@ -47,6 +47,8 @@
 class Topic(SharedContent):
     """WOrkflow managed topic class"""
 
+    content_name = TOPIC_CONTENT_NAME
+
     def is_deletable(self):
         workflow = IWorkflow(self)
         for version in IWorkflowVersions(self).get_versions():
--- a/src/pyams_content/shared/site/folder.py	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/shared/site/folder.py	Tue Jun 05 16:51:00 2018 +0200
@@ -41,6 +41,8 @@
 from zope.schema.fieldproperty import FieldProperty
 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
 
+from pyams_content import _
+
 
 @implementer(IDefaultProtectionPolicy, ISiteFolder, ISiteFolderRoles,
              IIllustrationTarget, IPortalContext, IPreviewTarget, IAttributeAnnotatable)
@@ -51,6 +53,8 @@
 
     notepad = FieldProperty(ISiteFolder['notepad'])
 
+    content_name = _("Site folder")
+
     sequence_name = ''  # use default sequence generator
     sequence_prefix = ''
 
--- a/src/pyams_content/shared/site/interfaces/__init__.py	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/shared/site/interfaces/__init__.py	Tue Jun 05 16:51:00 2018 +0200
@@ -37,6 +37,8 @@
 
     containers('.ISiteContainer')
 
+    content_name = Attribute("Content name")
+
 
 class ISiteContainer(IContainer, IContained, IWorkflowPublicationSupport):
     """Base site container interface"""
--- a/src/pyams_content/shared/site/link.py	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/shared/site/link.py	Tue Jun 05 16:51:00 2018 +0200
@@ -28,6 +28,8 @@
 from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
 
+from pyams_content import _
+
 
 @implementer(IContentLink)
 class ContentLink(Persistent, Contained):
@@ -41,6 +43,8 @@
     alt_title = FieldProperty(IContentLink['alt_title'])
     visible = FieldProperty(IContentLink['visible'])
 
+    content_name = _("Content link")
+
     def is_deletable(self):
         return True
 
--- a/src/pyams_content/shared/site/zmi/container.py	Tue Jun 05 15:41:26 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py	Tue Jun 05 16:51:00 2018 +0200
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from z3c.table.column import GetAttrColumn
 
 __docformat__ = 'restructuredtext'
 
@@ -47,7 +48,7 @@
 from pyams_skin.event import get_json_table_cell_refresh_event
 from pyams_skin.page import DefaultPageHeaderAdapter
 from pyams_skin.table import BaseTable, TrashColumn, DefaultElementEditorAdapter, NameColumn, SorterColumn, \
-    JsActionColumn
+    JsActionColumn, I18nColumn
 from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
 from pyams_skin.viewlet.menu import MenuItem
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
@@ -392,6 +393,18 @@
                    title=name or super(SiteContainerTreeNameColumn, self).renderCell(item))
 
 
+@adapter_config(name='content-type', context=(ISiteContainer, IPyAMSLayer, ISiteTreeTable), provides=IColumn)
+class SiteContainerContentTypeColumn(I18nColumn, GetAttrColumn):
+    """Site container content type column"""
+
+    _header = _("Content")
+
+    weight = 12
+
+    def getValue(self, obj):
+        return self.request.localizer.translate(obj.content_name)
+
+
 @adapter_config(name='sequence', context=(ISiteContainer, IPyAMSLayer, ISiteTreeTable), provides=IColumn)
 class SiteContainerTreeSequenceColumn(SharedToolDashboardSequenceColumn):
     """Site container tree OID column"""