Added short name to search folder
authorThierry Florac <tflorac@ulthar.net>
Wed, 19 Dec 2018 10:40:58 +0100
changeset 1187 b55bdf60c6cd
parent 1186 1cefd3e1ba43
child 1188 a3765dd8cbb8
Added short name to search folder
src/pyams_content/features/search/__init__.py
src/pyams_content/features/search/interfaces.py
src/pyams_content/features/search/zmi/properties.py
--- a/src/pyams_content/features/search/__init__.py	Wed Dec 19 10:40:42 2018 +0100
+++ b/src/pyams_content/features/search/__init__.py	Wed Dec 19 10:40:58 2018 +0100
@@ -50,6 +50,8 @@
     sequence_name = ''  # use default sequence generator
     sequence_prefix = ''
 
+    short_name = FieldProperty(ISearchFolder['short_name'])
+
     selected_content_types = FieldProperty(ISearchFolder['selected_content_types'])
     selected_datatypes = FieldProperty(ISearchFolder['selected_datatypes'])
 
--- a/src/pyams_content/features/search/interfaces.py	Wed Dec 19 10:40:42 2018 +0100
+++ b/src/pyams_content/features/search/interfaces.py	Wed Dec 19 10:40:58 2018 +0100
@@ -15,7 +15,8 @@
 from zope.interface import Interface
 from zope.schema import Bool, Choice, Set
 
-from pyams_content.interfaces import GUEST_ROLE, MANAGER_ROLE
+from pyams_content import _
+from pyams_content.interfaces import GUEST_ROLE, IBaseContent, MANAGER_ROLE
 from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY
 from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
 from pyams_content.shared.site.interfaces import IBaseSiteItem, ISiteElement
@@ -26,8 +27,6 @@
 from pyams_security.schema import PrincipalsSet
 from pyams_sequence.interfaces import ISequentialIdTarget
 
-from pyams_content import _
-
 
 class ISearchFolderRoles(Interface):
     """Search folder roles"""
@@ -49,7 +48,7 @@
                            required=False)
 
 
-class ISearchFolder(IBaseSiteItem, ISiteElement, IWfView, ISequentialIdTarget):
+class ISearchFolder(IBaseContent, IBaseSiteItem, ISiteElement, IWfView, ISequentialIdTarget):
     """Search folder interface"""
 
     order_by = Choice(title=_("Order by"),
--- a/src/pyams_content/features/search/zmi/properties.py	Wed Dec 19 10:40:42 2018 +0100
+++ b/src/pyams_content/features/search/zmi/properties.py	Wed Dec 19 10:40:58 2018 +0100
@@ -14,24 +14,39 @@
 
 from z3c.form import field
 
+from pyams_content import _
 from pyams_content.features.search import ISearchFolder
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common.zmi.properties import SharedContentPropertiesEditForm
 from pyams_content.shared.view.zmi.properties import ViewPropertiesEditForm
+from pyams_form.form import ajax_config
 from pyams_form.group import NamedWidgetsGroup
 from pyams_form.interfaces.form import IInnerSubForm
 from pyams_form.widget import HiddenSelect2FieldWidget
+from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.adapter import adapter_config
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
 from pyams_zmi.form import InnerAdminEditForm
 
-from pyams_content import _
+
+@pagelet_config(name='properties.html', context=ISearchFolder, layer=IPyAMSLayer,
+                permission=VIEW_SYSTEM_PERMISSION)
+@ajax_config(name='properties.json', context=ISearchFolder, layer=IPyAMSLayer,
+             permission=MANAGE_CONTENT_PERMISSION)
+class SearchFolderPropertiesEditForm(SharedContentPropertiesEditForm):
+    """Search folder properties edit form"""
+
+    def updateWidgets(self, prefix=None):
+        # don't override base widgets update method
+        super(SharedContentPropertiesEditForm, self).updateWidgets(prefix)
 
 
 @adapter_config(name='view-settings',
                 context=(ISearchFolder, IPyAMSLayer, SharedContentPropertiesEditForm),
                 provides=IInnerSubForm)
-class SearchFolderPropertiesEditForm(ViewPropertiesEditForm):
-    """Search folder properties edit form extension"""
+class SearchFolderSettingsEditSubform(ViewPropertiesEditForm):
+    """Search folder settings edit sub-form extension"""
 
     legend = _("Main search settings")