src/pyams_zmi/zmi/site.py
changeset 119 f5657a8745df
parent 92 7103aeba5eb7
equal deleted inserted replaced
118:499f2e5f112b 119:f5657a8745df
    22 from pyams_pagelet.pagelet import pagelet_config
    22 from pyams_pagelet.pagelet import pagelet_config
    23 from pyams_skin.interfaces import IContentTitle, IInnerPage, IPageHeader
    23 from pyams_skin.interfaces import IContentTitle, IInnerPage, IPageHeader
    24 from pyams_skin.interfaces.configuration import IBackOfficeConfiguration, IConfiguration
    24 from pyams_skin.interfaces.configuration import IBackOfficeConfiguration, IConfiguration
    25 from pyams_skin.layer import IPyAMSLayer
    25 from pyams_skin.layer import IPyAMSLayer
    26 from pyams_skin.page import DefaultPageHeaderAdapter
    26 from pyams_skin.page import DefaultPageHeaderAdapter
    27 from pyams_skin.viewlet.menu import MenuItem
    27 from pyams_skin.viewlet.menu import MenuDivider, MenuItem
    28 from pyams_utils.adapter import ContextAdapter, ContextRequestViewAdapter, adapter_config
    28 from pyams_utils.adapter import ContextAdapter, ContextRequestViewAdapter, adapter_config
    29 from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION, VIEW_SYSTEM_PERMISSION
    29 from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION, VIEW_SYSTEM_PERMISSION
    30 from pyams_utils.interfaces.site import ISiteRoot
    30 from pyams_utils.interfaces.site import ISiteRoot
    31 from pyams_viewlet.manager import viewletmanager_config
    31 from pyams_viewlet.manager import viewletmanager_config
    32 from pyams_viewlet.viewlet import viewlet_config
    32 from pyams_viewlet.viewlet import viewlet_config
    56     """Site root permission checker"""
    56     """Site root permission checker"""
    57 
    57 
    58     edit_permission = MANAGE_SYSTEM_PERMISSION
    58     edit_permission = MANAGE_SYSTEM_PERMISSION
    59 
    59 
    60 
    60 
    61 @viewlet_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer, manager=ISiteManagementMenu,
    61 @viewlet_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer,
    62                 permission=VIEW_SYSTEM_PERMISSION, weight=15)
    62                 manager=ISiteManagementMenu, permission=VIEW_SYSTEM_PERMISSION, weight=15)
    63 @viewletmanager_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer, provides=IPropertiesMenu)
    63 @viewletmanager_config(name='properties.menu', context=ISiteRoot, layer=IAdminLayer,
       
    64                        provides=IPropertiesMenu)
    64 @implementer(IPropertiesMenu)
    65 @implementer(IPropertiesMenu)
    65 class PropertiesMenuItem(MenuItem):
    66 class PropertiesMenuItem(MenuItem):
    66     """Properties menu"""
    67     """Properties menu"""
    67 
    68 
    68     label = _("Properties")
    69     label = _("Properties")
    69     icon_class = 'fa-edit'
    70     icon_class = 'fa-edit'
    70     url = '#properties.html'
    71     url = '#properties.html'
    71 
    72 
    72 
    73 
    73 @pagelet_config(name='properties.html', context=ISiteRoot, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
    74 @pagelet_config(name='properties.html', context=ISiteRoot, layer=IPyAMSLayer,
       
    75                 permission=VIEW_SYSTEM_PERMISSION)
    74 @ajax_config(name='properties.json', context=ISiteRoot, layer=IPyAMSLayer)
    76 @ajax_config(name='properties.json', context=ISiteRoot, layer=IPyAMSLayer)
    75 @implementer(IWidgetForm, IInnerPage, IPropertiesEditForm)
    77 @implementer(IWidgetForm, IInnerPage, IPropertiesEditForm)
    76 class PropertiesEditForm(AdminEditForm):
    78 class PropertiesEditForm(AdminEditForm):
    77     """Properties edit form"""
    79     """Properties edit form"""
    78 
    80 
   118 
   120 
   119 #
   121 #
   120 # Back-office configuration properties
   122 # Back-office configuration properties
   121 #
   123 #
   122 
   124 
   123 @viewlet_config(name='back-office-properties.menu', context=ISiteRoot, layer=IAdminLayer, manager=IPropertiesMenu,
   125 @viewlet_config(name='back-office-properties.menu', context=ISiteRoot, layer=IAdminLayer,
   124                 permission=MANAGE_SYSTEM_PERMISSION, weight=1)
   126                 manager=IPropertiesMenu, permission=MANAGE_SYSTEM_PERMISSION, weight=990)
   125 class BackOfficePropertiesMenuItem(MenuItem):
   127 class BackOfficePropertiesMenuItem(MenuItem):
   126     """Back-office properties menu"""
   128     """Back-office properties menu"""
   127 
   129 
   128     label = _("Back-office properties...")
   130     label = _("Back-office properties...")
   129     icon_class = 'fa-tachometer'
   131     icon_class = 'fa-tachometer'
   178 
   180 
   179 #
   181 #
   180 # ZMI configuration properties
   182 # ZMI configuration properties
   181 #
   183 #
   182 
   184 
   183 @viewlet_config(name='zmi-configuration.menu', context=ISiteRoot, layer=IAdminLayer, manager=IPropertiesMenu,
   185 @viewlet_config(name='zmi-configuration.divider', context=ISiteRoot, layer=IAdminLayer,
   184                 permission=MANAGE_SYSTEM_PERMISSION, weight=2)
   186                 manager=IPropertiesMenu, permission=MANAGE_SYSTEM_PERMISSION, weight=899)
       
   187 class ZMIConfigurationMenuDivider(MenuDivider):
       
   188     """ZMI configuration menu divider"""
       
   189 
       
   190 
       
   191 @viewlet_config(name='zmi-configuration.menu', context=ISiteRoot, layer=IAdminLayer,
       
   192                 manager=IPropertiesMenu, permission=MANAGE_SYSTEM_PERMISSION, weight=900)
   185 class ZMIConfigurationMenuItem(MenuItem):
   193 class ZMIConfigurationMenuItem(MenuItem):
   186     """ZMI configuration menu"""
   194     """ZMI configuration menu"""
   187 
   195 
   188     label = _("ZMI configuration...")
   196     label = _("ZMI configuration...")
   189     icon_class = 'fa-window-restore'
   197     icon_class = 'fa-window-restore'