Move search menu to 'search' module
authorThierry Florac <thierry.florac@onf.fr>
Fri, 08 Dec 2017 10:44:08 +0100
changeset 308 adc7fa946d13
parent 307 01af83bd6054
child 309 7f470b562ab8
Move search menu to 'search' module
src/pyams_content/shared/common/zmi/search.py
--- a/src/pyams_content/shared/common/zmi/search.py	Fri Dec 08 10:43:36 2017 +0100
+++ b/src/pyams_content/shared/common/zmi/search.py	Fri Dec 08 10:44:08 2017 +0100
@@ -20,6 +20,7 @@
 from pyams_content.profile.interfaces import IAdminProfile
 from pyams_content.shared.common.interfaces import IBaseSharedTool
 from pyams_content.shared.common.interfaces.zmi import ISharedToolDashboardTable
+from pyams_content.zmi.interfaces import IAllContentsMenu
 from pyams_i18n.interfaces import INegotiator
 from pyams_pagelet.interfaces import PageletCreatedEvent
 from pyams_sequence.interfaces import ISequentialIntIds
@@ -27,6 +28,7 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
 from pyams_workflow.interfaces import IWorkflowVersions, IWorkflow
+from pyams_zmi.layer import IAdminLayer
 from z3c.table.interfaces import IValues
 from zope.dublincore.interfaces import IZopeDublinCore
 from zope.intid.interfaces import IIntIds
@@ -43,11 +45,13 @@
 from pyams_skin.page import DefaultPageHeaderAdapter
 from pyams_skin.skin import apply_skin
 from pyams_skin.table import BaseTable
+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.list import unique
 from pyams_utils.registry import get_utility
 from pyams_utils.url import absolute_url
+from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.view import AdminView
 from pyramid.view import view_config
 from z3c.form import field
@@ -127,9 +131,19 @@
 
 
 #
-# Advanced search adapters
+# Advanced search views
 #
 
+@viewlet_config(name='advanced-search.menu', context=IBaseSharedTool, layer=IAdminLayer,
+                manager=IAllContentsMenu, permission=VIEW_SYSTEM_PERMISSION, weight=90)
+class SharedToolAdvancedSearchMenu(MenuItem):
+    """Shared tool advanced search menu"""
+
+    label = _("Advanced search")
+    icon_class = None
+    url = '#advanced-search.html'
+
+
 class ISharedToolAdvancedSearchFields(ISearchFields):
     """Shared tool advanced search fields"""