--- a/src/pyams_content/shared/blog/zmi/manager.py Sun Nov 26 09:56:51 2017 +0100
+++ b/src/pyams_content/shared/blog/zmi/manager.py Sun Nov 26 09:57:21 2017 +0100
@@ -14,14 +14,16 @@
# import standard library
-from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION
+from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, MANAGE_SITE_PERMISSION
from pyams_content.root.interfaces import ISiteRoot
from pyams_content.shared.blog.interfaces import IBlogManager
-from pyams_content.zmi.interfaces import IUserAddingsMenuLabel
+from pyams_content.zmi.interfaces import IUserAddingsMenuLabel, ISiteTreeTable
from pyams_i18n.interfaces import II18n, INegotiator
from pyams_skin.interfaces.container import ITableElementEditor
from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
from pyams_skin.layer import IPyAMSLayer
+from pyams_workflow.interfaces import IWorkflowPublicationInfo
+from pyams_zmi.interfaces.menu import IPropertiesMenu
from pyams_zmi.layer import IAdminLayer
# import interfaces
@@ -29,17 +31,17 @@
# import packages
from pyams_content.shared.blog.manager import BlogManager
-from pyams_content.shared.zmi.sites import SiteTreeTable
-from pyams_form.form import AJAXAddForm
+from pyams_form.form import AJAXAddForm, AJAXEditForm
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.table import DefaultElementEditorAdapter
+from pyams_skin.viewlet.menu import MenuItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import query_utility
from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogAddForm
+from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
from pyramid.events import subscriber
from pyramid.view import view_config
from z3c.form import field
@@ -48,6 +50,10 @@
from pyams_content import _
+#
+# Blog topic add views
+#
+
@adapter_config(context=(IBlogManager, IAdminLayer), provides=IUserAddingsMenuLabel)
class BlogManagerUserAddingsMenuLabelAdapter(ContextRequestAdapter):
"""Blog manager user addings menu label adapter"""
@@ -60,7 +66,7 @@
@viewlet_config(name='add-blog-manager.menu', context=ISiteRoot, layer=IAdminLayer,
- view=SiteTreeTable, manager=IToolbarAddingMenu, permission=MANAGE_SITE_ROOT_PERMISSION)
+ view=ISiteTreeTable, manager=IToolbarAddingMenu, permission=MANAGE_SITE_ROOT_PERMISSION)
class BlogManagerAddMenu(ToolbarMenuItem):
"""Blog manager add menu"""
@@ -119,9 +125,42 @@
"""Blog manager add form, JSON renderer"""
-@adapter_config(context=(IBlogManager, IAdminLayer, SiteTreeTable), provides=ITableElementEditor)
+@adapter_config(context=(IBlogManager, IAdminLayer, ISiteTreeTable), provides=ITableElementEditor)
class BlogManagerTableElementEditor(DefaultElementEditorAdapter):
"""Blog manager table element editor"""
view_name = 'admin'
modal_target = False
+
+
+#
+# Blog manager publication views
+#
+
+@viewlet_config(name='workflow-publication.menu', context=IBlogManager, layer=IAdminLayer, manager=IPropertiesMenu,
+ permission=MANAGE_SITE_PERMISSION, weight=2)
+class BlogManagerWorkflowPublicationMenu(MenuItem):
+ """Blog manager workflow publication menu"""
+
+ label = _("Publication dates...")
+ icon_class = 'fa-eye'
+ url = 'workflow-publication.html'
+ modal_target = True
+
+
+@pagelet_config(name='workflow-publication.html', context=IBlogManager, layer=IPyAMSLayer,
+ permission=MANAGE_SITE_PERMISSION)
+class BlogManagerWorkflowPublicationEditForm(AdminDialogEditForm):
+ """Blog manager workflow publication edit form"""
+
+ legend = _("Update publication dates")
+
+ fields = field.Fields(IWorkflowPublicationInfo).select('publication_effective_date', 'publication_expiration_date')
+ ajax_handler = 'workflow-publication.json'
+ edit_permission = MANAGE_SITE_PERMISSION
+
+
+@view_config(name='workflow-publication.json', context=IBlogManager, request_type=IPyAMSLayer,
+ permission=MANAGE_SITE_PERMISSION, renderer='json', xhr=True)
+class BlogManagerWorkflowPublicationAJAXEditForm(AJAXEditForm, BlogManagerWorkflowPublicationEditForm):
+ """Blog manager workflow publication edit form, JSON renderer"""