Added edit forms prefix
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Apr 2018 11:11:01 +0200
changeset 34 2bab2a8e8853
parent 33 75ed0e4b3d2a
child 35 51bf736cbaf6
Added edit forms prefix
src/pyams_ldap/zmi/plugin.py
--- a/src/pyams_ldap/zmi/plugin.py	Mon Apr 09 14:35:33 2018 +0200
+++ b/src/pyams_ldap/zmi/plugin.py	Wed Apr 11 11:11:01 2018 +0200
@@ -121,7 +121,8 @@
 class LDAPPluginConnectionAddForm(InnerAdminAddForm):
     """LDAP plug-in add form connection"""
 
-    id = 'ldap_connection_form'
+    prefix = 'ldap_connection_form.'
+
     tab_label = _("Connection")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('server_uri', 'bind_dn', 'bind_password', 'use_tls',
@@ -133,7 +134,8 @@
 class LDAPPluginUsersAddForm(InnerAdminAddForm):
     """LDAP plug-in add form users schema"""
 
-    id = 'ldap_users_form'
+    prefix = 'ldap_users_form.'
+
     tab_label = _("Users schema")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('base_dn', 'search_scope', 'login_attribute', 'login_query',
@@ -149,7 +151,8 @@
 class LDAPPluginGroupsAddForm(InnerAdminAddForm):
     """LDAP plug-in add form groups schema"""
 
-    id = 'ldap_groups_form'
+    prefix = 'ldap_groups_form.'
+
     tab_label = _("Groups schema")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('groups_base_dn', 'groups_search_scope', 'group_prefix',
@@ -168,7 +171,8 @@
 class LDAPPluginSearchAddForm(InnerAdminAddForm):
     """LDAP plug-in add form search settings"""
 
-    id = 'ldap_search_form'
+    prefix = 'ldap_search_form.'
+
     tab_label = _("Search settings")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('users_select_query', 'users_search_query',
@@ -189,6 +193,8 @@
 class LDAPPluginEditForm(AdminDialogEditForm):
     """LDAP users folder plug-in edit form"""
 
+    prefix = 'ldap_properties.'
+
     @property
     def title(self):
         return self.context.title
@@ -227,7 +233,8 @@
 class LDAPPluginConnectionEditForm(InnerAdminEditForm):
     """LDAP plug-in connection edit form"""
 
-    id = 'ldap_connection_form'
+    prefix = 'ldap_connection_form.'
+
     tab_label = _("Connection")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('server_uri', 'bind_dn', 'bind_password', 'use_tls',
@@ -241,7 +248,8 @@
 class LDAPPluginUsersEditForm(InnerAdminEditForm):
     """LDAP plug-in users schema edit form"""
 
-    id = 'ldap_users_form'
+    prefix = 'ldap_users_form.'
+
     tab_label = _("Users schema")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('base_dn', 'search_scope', 'login_attribute', 'login_query',
@@ -258,7 +266,8 @@
 class LDAPPluginGroupsEditForm(InnerAdminEditForm):
     """LDAP plug-in groups schema edit form"""
 
-    id = 'ldap_groups_form'
+    prefix = 'ldap_groups_form.'
+
     tab_label = _("Groups schema")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('groups_base_dn', 'groups_search_scope', 'group_prefix',
@@ -278,7 +287,8 @@
 class LDAPPluginSearchEditForm(InnerAdminEditForm):
     """LDAP plug-in search settings"""
 
-    id = 'ldap_search_form'
+    prefix = 'ldap_search_form.'
+
     tab_label = _("Search settings")
     legend = None
     fields = field.Fields(ILDAPPlugin).select('users_select_query', 'users_search_query',
@@ -327,13 +337,15 @@
 
     @property
     def data_attributes(self):
-        return {'tr': {'data-ams-element-name': lambda x, col: x[0],
-                       'data-ams-url':
-                           lambda x, col: '{url}?dn={dn}'.format(url=absolute_url(self.context,
-                                                                                  self.request,
-                                                                                  'user-properties.html'),
-                                                                 dn=x[0]),
-                       'data-toggle': 'modal'}}
+        return {
+            'tr': {
+                'data-ams-element-name': lambda x, col: x[0],
+                'data-ams-url': lambda x, col: '{url}?dn={dn}'.format(
+                    url=absolute_url(self.context, self.request, 'user-properties.html'),
+                    dn=x[0]),
+                'data-toggle': 'modal'
+            }
+        }
 
     def __init__(self, context, request):
         super(LDAPPluginSearchResultsView, self).__init__(context, request)