--- a/src/pyams_content/root/__init__.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/root/__init__.py Wed Jun 20 08:25:29 2018 +0200
@@ -47,6 +47,8 @@
from pyramid.events import subscriber
from zope.interface import implementer
+from pyams_content import _
+
@implementer(IDefaultProtectionPolicy, ISiteRoot, ISiteRootRoles, IPortalContext,
IIllustrationTarget, IHeaderTarget, IFooterTarget, IAlertTarget, IPreviewTarget)
@@ -62,6 +64,8 @@
operators = RolePrincipalsFieldProperty(ISiteRootRoles['operators'])
templates_managers = RolePrincipalsFieldProperty(ISiteRootRoles['templates_managers'])
+ content_name = _("Site root")
+
@utility_config(provides=ISiteRootFactory)
class SiteRootFactory(object):
--- a/src/pyams_content/root/zmi/__init__.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/root/zmi/__init__.py Wed Jun 20 08:25:29 2018 +0200
@@ -25,7 +25,8 @@
from pyams_content.skin.zmi.interfaces import IDashboardMenu, IMyDashboardMenu, IAllContentsMenu
from pyams_i18n.interfaces import II18n
from pyams_skin.interfaces import IInnerPage, IPageHeader
-from pyams_skin.interfaces.configuration import IBackOfficeConfiguration
+from pyams_skin.interfaces.configuration import IBackOfficeConfiguration, IConfiguration
+from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor
from pyams_skin.interfaces.viewlet import IBreadcrumbItem
from pyams_skin.layer import IPyAMSLayer
from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
@@ -45,11 +46,11 @@
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.container import ContainerView
from pyams_skin.page import DefaultPageHeaderAdapter
-from pyams_skin.table import I18nColumn
+from pyams_skin.table import I18nColumn, DefaultElementEditorAdapter
from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
from pyams_skin.viewlet.menu import MenuItem
from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextRequestAdapter
from pyams_utils.list import unique
from pyams_utils.registry import get_utility, get_all_utilities_registered_for
from pyams_viewlet.manager import viewletmanager_config
@@ -77,6 +78,24 @@
label = _("Home")
+@adapter_config(context=(ISiteRoot, IPyAMSLayer), provides=ITableElementName)
+class SiteRootTableElementNameAdapter(ContextRequestAdapter):
+ """Site root table element name adapter"""
+
+ @property
+ def name(self):
+ configuration = IConfiguration(self.context)
+ return II18n(configuration).query_attribute('short_title', request=self.request)
+
+
+@adapter_config(context=(ISiteRoot, IAdminLayer, Interface), provides=ITableElementEditor)
+class SiteRootTableElementEditorAdapter(DefaultElementEditorAdapter):
+ """Site root table element editor adapter"""
+
+ view_name = 'admin#site-tree.html'
+ modal_target = False
+
+
#
# Main dashboard menu
#
@@ -800,4 +819,7 @@
weight = 1
def getValue(self, obj):
- return self.request.localizer.translate(obj.content_name)
+ try:
+ return self.request.localizer.translate(obj.content_name)
+ except AttributeError:
+ return '--'
--- a/src/pyams_content/shared/site/folder.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/shared/site/folder.py Wed Jun 20 08:25:29 2018 +0200
@@ -42,6 +42,8 @@
from pyams_content import _
+from pyams_content import _
+
@implementer(IDefaultProtectionPolicy, ISiteFolder, ISiteFolderRoles,
IIllustrationTarget, ILinkIllustrationTarget, IPortalContext, IPreviewTarget)
--- a/src/pyams_content/shared/site/manager.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/shared/site/manager.py Wed Jun 20 08:25:29 2018 +0200
@@ -50,6 +50,8 @@
from zope.schema.fieldproperty import FieldProperty
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+from pyams_content import _
+
@implementer(ISiteManager, IParagraphFactorySettings, IThemesManagerTarget, IPictogramManagerTarget,
IIllustrationTarget, ILinkIllustrationTarget, IPortalContext, IHeaderTarget,
@@ -63,6 +65,8 @@
sequence_name = '' # use default sequence generator
sequence_prefix = ''
+ content_name = _("Site manager")
+
@property
def folder_factory(self):
return ISiteFolderFactory(self, SiteFolder)
--- a/src/pyams_content/shared/site/zmi/folder.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/folder.py Wed Jun 20 08:25:29 2018 +0200
@@ -20,6 +20,7 @@
from pyams_content.shared.common.interfaces import IBaseSharedTool
from pyams_content.shared.site.interfaces import ISiteContainer, ISiteManager, ISiteFolder
from pyams_i18n.interfaces import INegotiator, II18n
+from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor
from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IMenuHeader
from pyams_skin.layer import IPyAMSLayer
from pyams_zmi.interfaces.menu import ISiteManagementMenu
@@ -33,6 +34,7 @@
from pyams_form.form import AJAXAddForm, AJAXEditForm, ajax_config
from pyams_i18n.schema import I18nTextLineField
from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.table import DefaultElementEditorAdapter
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import get_utility
@@ -164,6 +166,23 @@
# Site folder edit form
#
+@adapter_config(context=(ISiteFolder, IPyAMSLayer), provides=ITableElementName)
+class SiteFolderTableElementNameAdapter(ContextRequestAdapter):
+ """Site folder table element name adapter"""
+
+ @property
+ def name(self):
+ return II18n(self.context).query_attribute('short_name', request=self.request)
+
+
+@adapter_config(context=(ISiteFolder, IAdminLayer, Interface), provides=ITableElementEditor)
+class SiteFolderTableElementEditorAdapter(DefaultElementEditorAdapter):
+ """Site folder table element editor adapter"""
+
+ view_name = 'admin#site-tree.html'
+ modal_target = False
+
+
@pagelet_config(name='properties.html', context=ISiteFolder, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
class SiteFolderPropertiesEditForm(SharedToolPropertiesEditForm):
"""Site folder properties edit form"""
--- a/src/pyams_content/shared/site/zmi/manager.py Wed Jun 20 08:24:53 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/manager.py Wed Jun 20 08:25:29 2018 +0200
@@ -21,7 +21,7 @@
from pyams_content.shared.site.interfaces import ISiteManager, ISiteManagerFactory
from pyams_content.skin.zmi.interfaces import ISiteTreeTable, IUserAddingsMenuLabel
from pyams_i18n.interfaces import II18n, INegotiator
-from pyams_skin.interfaces.container import ITableElementEditor
+from pyams_skin.interfaces.container import ITableElementEditor, ITableElementName
from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IBreadcrumbItem, IMenuHeader
from pyams_skin.layer import IPyAMSLayer
from pyams_zmi.interfaces.menu import ISiteManagementMenu
@@ -45,7 +45,7 @@
from pyramid.events import subscriber
from pyramid.path import DottedNameResolver
from z3c.form import field
-from zope.interface import Invalid
+from zope.interface import Invalid, Interface
from pyams_content import _
@@ -68,6 +68,31 @@
css_class = 'strong'
+@adapter_config(context=(ISiteManager, IPyAMSLayer), provides=ITableElementName)
+class SiteManagerTableElementNameAdapter(ContextRequestAdapter):
+ """Site manager table element name adapter"""
+
+ @property
+ def name(self):
+ return II18n(self.context).query_attribute('short_name', request=self.request)
+
+
+@adapter_config(context=(ISiteManager, IAdminLayer, Interface), provides=ITableElementEditor)
+class SiteManagerTableElementEditorAdapter(DefaultElementEditorAdapter):
+ """Site manager table element editor adapter"""
+
+ view_name = 'admin#site-tree.html'
+ modal_target = False
+
+
+@adapter_config(context=(ISiteManager, IAdminLayer, ISiteTreeTable), provides=ITableElementEditor)
+class SiteManagerTableElementEditor(DefaultElementEditorAdapter):
+ """Site tree table element editor"""
+
+ view_name = 'admin#site-tree.html'
+ modal_target = False
+
+
@adapter_config(context=(ISiteManager, IAdminLayer), provides=IUserAddingsMenuLabel)
class SiteManagerUserAddingsMenuLabelAdapter(ContextRequestAdapter):
"""Site manager user addings menu label adapter"""
@@ -137,11 +162,3 @@
site = query_utility(ISiteManager, name=short_name)
if site is not None:
event.form.widgets.errors += (Invalid(_("A site manager is already registered with this name!!")),)
-
-
-@adapter_config(context=(ISiteManager, IAdminLayer, ISiteTreeTable), provides=ITableElementEditor)
-class SiteManagerTableElementEditor(DefaultElementEditorAdapter):
- """Site tree table element editor"""
-
- view_name = 'admin#site-tree.html'
- modal_target = False