Updated plug-ins add menus
authorThierry Florac <thierry.florac@onf.fr>
Tue, 03 Mar 2015 16:41:23 +0100
changeset 17 fb914030a05b
parent 16 fc2ffccae559
child 18 92dd47c4bc99
Updated plug-ins add menus
src/pyams_security/zmi/plugin/admin.py
src/pyams_security/zmi/plugin/directory.py
src/pyams_security/zmi/plugin/group.py
src/pyams_security/zmi/plugin/social.py
src/pyams_security/zmi/plugin/userfolder.py
--- a/src/pyams_security/zmi/plugin/admin.py	Mon Mar 02 11:02:31 2015 +0100
+++ b/src/pyams_security/zmi/plugin/admin.py	Tue Mar 03 16:41:23 2015 +0100
@@ -16,8 +16,8 @@
 
 # import interfaces
 from pyams_security.interfaces import IAdminAuthenticationPlugin, ISecurityManager
-from pyams_security.zmi.interfaces import ISecurityManagerToolbarAddingMenu
 from pyams_skin.interfaces import IContentHelp
+from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from z3c.form.interfaces import DISPLAY_MODE, IDataExtractedEvent
 from zope.component.interfaces import ISite
@@ -44,7 +44,7 @@
 
 
 @viewlet_config(name='add-admin-authentication.menu', context=ISite, layer=IAdminLayer,
-                view=SecurityManagerPluginsTable, manager=ISecurityManagerToolbarAddingMenu,
+                view=SecurityManagerPluginsTable, manager=IToolbarAddingMenu,
                 permission='system.manage', weight=1)
 class AdminAuthenticationAddMenu(ToolbarMenuItem):
     """Admin authentication add menu"""
--- a/src/pyams_security/zmi/plugin/directory.py	Mon Mar 02 11:02:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-
-# import packages
--- a/src/pyams_security/zmi/plugin/group.py	Mon Mar 02 11:02:31 2015 +0100
+++ b/src/pyams_security/zmi/plugin/group.py	Tue Mar 03 16:41:23 2015 +0100
@@ -17,9 +17,8 @@
 
 # import interfaces
 from pyams_security.interfaces import IGroupsFolderPlugin, ISecurityManager, ILocalGroup
-from pyams_security.zmi.interfaces import ISecurityManagerToolbarAddingMenu
 from pyams_skin.interfaces import IPageHeader, IInnerPage
-from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.interfaces.viewlet import IToolbarViewletManager, IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.layer import IAdminLayer
 from z3c.form.interfaces import DISPLAY_MODE, IDataExtractedEvent
@@ -54,7 +53,7 @@
 #
 
 @viewlet_config(name='add-groups-folder.menu', context=ISite, layer=IAdminLayer,
-                view=SecurityManagerPluginsTable, manager=ISecurityManagerToolbarAddingMenu,
+                view=SecurityManagerPluginsTable, manager=IToolbarAddingMenu,
                 permission='system.manage', weight=20)
 class GroupsFolderAddMenu(ToolbarMenuItem):
     """Local groups folder add menu"""
--- a/src/pyams_security/zmi/plugin/social.py	Mon Mar 02 11:02:31 2015 +0100
+++ b/src/pyams_security/zmi/plugin/social.py	Tue Mar 03 16:41:23 2015 +0100
@@ -18,9 +18,9 @@
 # import interfaces
 from pyams_security.interfaces import ISecurityManager, ISocialUsersFolderPlugin, ISocialUser, \
     ISocialLoginConfiguration, ISocialLoginProviderConnection
-from pyams_security.zmi.interfaces import ISecurityManagerToolbarAddingMenu, ISecurityManagerMenu
+from pyams_security.zmi.interfaces import ISecurityManagerMenu
 from pyams_skin.interfaces import IPageHeader, IInnerPage
-from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.interfaces.viewlet import IToolbarViewletManager, IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.layer import IAdminLayer
 from z3c.form.interfaces import DISPLAY_MODE, IDataExtractedEvent
@@ -36,7 +36,7 @@
 from pyams_security.zmi.utility import SecurityManagerPluginsTable
 from pyams_skin.container import ContainerView
 from pyams_skin.skin import apply_skin
-from pyams_skin.table import I18nColumn, BaseTable, ActionColumn
+from pyams_skin.table import I18nColumn, BaseTable, ActionColumn, TrashColumn
 from pyams_skin.viewlet.menu import MenuItem
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem, ToolbarAction
 from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
@@ -60,7 +60,7 @@
 #
 
 @viewlet_config(name='add-social-users-folder.menu', context=ISite, layer=IAdminLayer,
-                view=SecurityManagerPluginsTable, manager=ISecurityManagerToolbarAddingMenu,
+                view=SecurityManagerPluginsTable, manager=IToolbarAddingMenu,
                 permission='system.manage', weight=50)
 class SocialUsersFolderAddMenu(ToolbarMenuItem):
     """Social users folder add menu"""
@@ -293,8 +293,7 @@
         manager = query_utility(ISecurityManager)
         if manager is not None:
             return {'table': {'data-ams-location': absolute_url(ISocialLoginConfiguration(manager), self.request),
-                              'data-ams-plugins': 'pyams_security',
-                              'data-ams-plugin-pyams_security-src': '/--static--/pyams_security/js/security.js'},
+                              'data-ams-delete-target': 'delete-provider.json'},
                     'tr': {'data-ams-element-name': lambda x: x.provider_name,
                            'data-ams-url': lambda x: absolute_url(x, self.request, 'properties.html'),
                            'data-toggle': 'modal'}}
@@ -332,10 +331,9 @@
 
 
 @adapter_config(name='trash', context=(Interface, IAdminLayer, SecurityManagerSocialProvidersTable), provides=IColumn)
-class SecurityManagerSocialProvidersTrashColumn(ActionColumn):
+class SecurityManagerSocialProvidersTrashColumn(TrashColumn):
     """Security manager plugins trash column"""
 
-    url = "PyAMS_security.social.deleteProvider"
     icon_class = 'fa fa-fw fa-trash'
     icon_hint = _("Delete provider")
     weight = 100
@@ -475,7 +473,7 @@
 def delete_social_provider(request):
     """Delete social provider from security manager"""
     translate = request.localizer.translate
-    name = request.params.get('provider_name')
+    name = request.params.get('object_name')
     if not name:
         return {'status': 'message',
                 'messagebox': {'status': 'error',
--- a/src/pyams_security/zmi/plugin/userfolder.py	Mon Mar 02 11:02:31 2015 +0100
+++ b/src/pyams_security/zmi/plugin/userfolder.py	Tue Mar 03 16:41:23 2015 +0100
@@ -18,8 +18,7 @@
 
 # import interfaces
 from pyams_security.interfaces import IUsersFolderPlugin, ISecurityManager, ILocalUser, IUserRegistrationInfo
-from pyams_security.zmi.interfaces import ISecurityManagerToolbarAddingMenu
-from pyams_skin.interfaces.viewlet import IToolbarViewletManager
+from pyams_skin.interfaces.viewlet import IToolbarViewletManager, IToolbarAddingMenu
 from pyams_skin.interfaces import IPageHeader
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.layer import IAdminLayer
@@ -58,7 +57,7 @@
 #
 
 @viewlet_config(name='add-users-folder.menu', context=ISite, layer=IAdminLayer,
-                view=SecurityManagerPluginsTable, manager=ISecurityManagerToolbarAddingMenu,
+                view=SecurityManagerPluginsTable, manager=IToolbarAddingMenu,
                 permission='system.manage', weight=10)
 class UsersFolderAddMenu(ToolbarMenuItem):
     """Local users folder add menu"""