src/pyams_scheduler/zmi/scheduler.py
changeset 11 2746eb7b3437
parent 2 7b56f247a0c4
child 19 687d616d7dfb
equal deleted inserted replaced
10:1caa81990b67 11:2746eb7b3437
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager
       
    13 from pyams_template.template import template_config
       
    14 from pyams_utils.date import format_datetime
       
    15 from pyams_utils.interfaces.zeo import IZEOConnection
       
    16 
    12 
    17 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    18 
    14 
    19 
    15 
    20 # import standard library
    16 # import standard library
    22 logger = logging.getLogger('PyAMS (scheduler)')
    18 logger = logging.getLogger('PyAMS (scheduler)')
    23 
    19 
    24 from datetime import datetime
    20 from datetime import datetime
    25 
    21 
    26 # import interfaces
    22 # import interfaces
       
    23 from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager
    27 from pyams_scheduler.interfaces import IScheduler, SCHEDULER_HANDLER_KEY
    24 from pyams_scheduler.interfaces import IScheduler, SCHEDULER_HANDLER_KEY
    28 from pyams_scheduler.zmi.interfaces import ISchedulerMenu
    25 from pyams_scheduler.zmi.interfaces import ISchedulerMenu
    29 from pyams_skin.interfaces import IInnerPage, IPageHeader
    26 from pyams_skin.interfaces import IInnerPage, IPageHeader
    30 from pyams_skin.interfaces.container import ITableElementEditor
    27 from pyams_skin.interfaces.container import ITableElementEditor
    31 from pyams_skin.layer import IPyAMSLayer
    28 from pyams_skin.layer import IPyAMSLayer
    37 # import packages
    34 # import packages
    38 import zmq
    35 import zmq
    39 from pyams_form.form import AJAXEditForm
    36 from pyams_form.form import AJAXEditForm
    40 from pyams_pagelet.pagelet import pagelet_config
    37 from pyams_pagelet.pagelet import pagelet_config
    41 from pyams_skin.container import ContainerView
    38 from pyams_skin.container import ContainerView
       
    39 from pyams_skin.page import DefaultPageHeaderAdapter
    42 from pyams_skin.table import DefaultElementEditorAdapter, BaseTable, I18nColumn, TrashColumn, ActionColumn
    40 from pyams_skin.table import DefaultElementEditorAdapter, BaseTable, I18nColumn, TrashColumn, ActionColumn
    43 from pyams_skin.viewlet.menu import MenuItem
    41 from pyams_skin.viewlet.menu import MenuItem
       
    42 from pyams_template.template import template_config
    44 from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
    43 from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
    45 from pyams_utils.registry import query_utility, get_utility
    44 from pyams_utils.date import format_datetime
       
    45 from pyams_utils.registry import query_utility
    46 from pyams_utils.traversing import get_parent
    46 from pyams_utils.traversing import get_parent
    47 from pyams_utils.url import absolute_url
    47 from pyams_utils.url import absolute_url
    48 from pyams_viewlet.manager import viewletmanager_config
    48 from pyams_viewlet.manager import viewletmanager_config
    49 from pyams_viewlet.viewlet import viewlet_config, Viewlet
    49 from pyams_viewlet.viewlet import viewlet_config, Viewlet
    50 from pyams_zmi.form import AdminDialogEditForm, AdminDialogDisplayForm
    50 from pyams_zmi.form import AdminDialogEditForm, AdminDialogDisplayForm
   223     def __init__(self, context, request):
   223     def __init__(self, context, request):
   224         super(SchedulerTasksView, self).__init__(context, request)
   224         super(SchedulerTasksView, self).__init__(context, request)
   225 
   225 
   226 
   226 
   227 @adapter_config(context=(ISite, IAdminLayer, SchedulerTasksView), provides=IPageHeader)
   227 @adapter_config(context=(ISite, IAdminLayer, SchedulerTasksView), provides=IPageHeader)
   228 class SchedulerTasksHeaderAdapter(ContextRequestViewAdapter):
   228 class SchedulerTasksHeaderAdapter(DefaultPageHeaderAdapter):
   229     """Scheduler tasks header adapter"""
   229     """Scheduler tasks header adapter"""
   230 
   230 
   231     icon_class = 'fa fa-fw fa-clock-o'
   231     icon_class = 'fa fa-fw fa-clock-o'
   232     title = _("Tasks scheduler")
   232     title = _("Control panel")
   233     subtitle = _("Scheduled tasks")
   233     subtitle = _("Tasks scheduler")
   234 
   234 
   235 
   235 
   236 @viewlet_config(name='scheduler.properties.menu', context=ISite, layer=IAdminLayer,
   236 @viewlet_config(name='scheduler.properties.menu', context=ISite, layer=IAdminLayer,
   237                 manager=ISchedulerMenu, permission='system.view', weight=1)
   237                 manager=ISchedulerMenu, permission='system.view', weight=1)
   238 class SchedulerPropertiesMenuItem(MenuItem):
   238 class SchedulerPropertiesMenuItem(MenuItem):