--- a/src/pyams_i18n/zmi/language.py Thu Oct 08 09:25:29 2015 +0200
+++ b/src/pyams_i18n/zmi/language.py Thu Oct 08 09:26:24 2015 +0200
@@ -9,16 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyramid.view import view_config
-from pyams_form.form import AJAXEditForm
-from pyams_i18n.interfaces import II18nManager
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.layer import IPyAMSLayer
-from pyams_skin.viewlet.menu import MenuItem
-from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogEditForm
-from pyams_zmi.interfaces.menu import IPropertiesMenu
-from pyams_zmi.layer import IAdminLayer
__docformat__ = 'restructuredtext'
@@ -26,9 +16,23 @@
# import standard library
# import interfaces
+from pyams_form.interfaces.form import IWidgetForm
+from pyams_i18n.interfaces import II18nManager
+from pyams_skin.interfaces import IInnerPage
+from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_PERMISSION
+from pyams_zmi.interfaces.menu import ISiteManagementMenu
+from pyams_zmi.layer import IAdminLayer
# import packages
+from pyams_form.form import AJAXEditForm
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.viewlet.menu import MenuItem
+from pyams_viewlet.viewlet import viewlet_config
+from pyams_zmi.form import AdminEditForm
+from pyramid.view import view_config
from z3c.form import field
+from zope.interface import implementer
from pyams_i18n import _
@@ -38,29 +42,29 @@
#
@viewlet_config(name='languages.menu', context=II18nManager, layer=IAdminLayer,
- manager=IPropertiesMenu, permission='system.view', weight=11)
+ manager=ISiteManagementMenu, permission=VIEW_SYSTEM_PERMISSION, weight=10)
class I18nManagerLanguagesMenu(MenuItem):
"""I18n manager languages menu"""
- label = _("Languages...")
+ label = _("Languages")
icon_class = 'fa-flag'
- url = 'languages.html'
- modal_target = True
+ url = '#languages.html'
-@pagelet_config(name='languages.html', context=II18nManager, layer=IPyAMSLayer, permission='system.view')
-class I18nManagerLanguagesEditForm(AdminDialogEditForm):
+@pagelet_config(name='languages.html', context=II18nManager, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@implementer(IInnerPage, IWidgetForm)
+class I18nManagerLanguagesEditForm(AdminEditForm):
"""I18n manager languages edit form"""
legend = _("Content languages")
fields = field.Fields(II18nManager)
ajax_handler = 'languages.json'
- edit_permission = 'system.view'
+ edit_permission = MANAGE_PERMISSION
@view_config(name='languages.json', context=II18nManager, request_type=IPyAMSLayer,
- permission='system.view', renderer='json', xhr=True)
+ permission=MANAGE_PERMISSION, renderer='json', xhr=True)
class I18nManagerLanguagesAJAXEditForm(AJAXEditForm, I18nManagerLanguagesEditForm):
"""I18n manager languages edit form, JSON renderer"""
--- a/src/pyams_i18n/zmi/negotiator.py Thu Oct 08 09:25:29 2015 +0200
+++ b/src/pyams_i18n/zmi/negotiator.py Thu Oct 08 09:26:24 2015 +0200
@@ -18,6 +18,7 @@
# import interfaces
from pyams_i18n.interfaces import INegotiator
from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
# import packages
from pyams_form.form import AJAXEditForm
@@ -29,7 +30,7 @@
from pyams_i18n import _
-@pagelet_config(name='properties.html', context=INegotiator, layer=IPyAMSLayer, permission='system.view')
+@pagelet_config(name='properties.html', context=INegotiator, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
class NegotiatorPropertiesEditForm(AdminDialogEditForm):
"""Negotiator properties edit form"""
@@ -41,7 +42,7 @@
fields = field.Fields(INegotiator)
ajax_handler = 'properties.json'
- edit_permission = 'system.manage'
+ edit_permission = MANAGE_SYSTEM_PERMISSION
def updateWidgets(self, prefix=None):
super(NegotiatorPropertiesEditForm, self).updateWidgets()
@@ -50,6 +51,6 @@
@view_config(name='properties.json', context=INegotiator, request_type=IPyAMSLayer,
- permission='system.manage', renderer='json', xhr=True)
+ permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True)
class NegotiatorPropertiesAJAXEditForm(AJAXEditForm, NegotiatorPropertiesEditForm):
"""Negotiator properties edit form, AJAX renderer"""