--- a/src/pyams_content/shared/blog/zmi/manager.py Tue Jun 05 16:51:00 2018 +0200
+++ b/src/pyams_content/shared/blog/zmi/manager.py Tue Jun 05 17:05:17 2018 +0200
@@ -14,6 +14,9 @@
# import standard library
+from datetime import datetime
+
+# import interfaces
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, IBlogManagerFactory
@@ -25,8 +28,6 @@
from pyams_workflow.interfaces import IWorkflowPublicationInfo
from pyams_zmi.interfaces.menu import IPropertiesMenu, ISiteManagementMenu
from pyams_zmi.layer import IAdminLayer
-
-# import interfaces
from z3c.form.interfaces import IDataExtractedEvent
# import packages
@@ -38,6 +39,7 @@
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.timezone import tztime
from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
@@ -186,6 +188,13 @@
ajax_handler = 'workflow-publication.json'
edit_permission = MANAGE_SITE_PERMISSION
+ def updateWidgets(self, prefix=None):
+ super(BlogManagerWorkflowPublicationEditForm, self).updateWidgets(prefix)
+ if 'publication_effective_date' in self.widgets:
+ widget = self.widgets['publication_effective_date']
+ if not widget.value:
+ widget.value = tztime(datetime.utcnow()).strftime('%d/%m/%y %H:%M')
+
@view_config(name='workflow-publication.json', context=IBlogManager, request_type=IPyAMSLayer,
permission=MANAGE_SITE_PERMISSION, renderer='json', xhr=True)
--- a/src/pyams_content/shared/site/zmi/container.py Tue Jun 05 16:51:00 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py Tue Jun 05 17:05:17 2018 +0200
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from z3c.table.column import GetAttrColumn
__docformat__ = 'restructuredtext'
@@ -17,6 +16,8 @@
# import standard library
import json
+from datetime import datetime
+
# import interfaces
from pyams_content.interfaces import MANAGE_SITE_PERMISSION, MANAGE_CONTENT_PERMISSION
from pyams_content.shared.common.interfaces import ISharedContent
@@ -55,6 +56,7 @@
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextRequestAdapter
from pyams_utils.fanstatic import get_resource_path
from pyams_utils.registry import get_utility
+from pyams_utils.timezone import tztime
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url
from pyams_viewlet.manager import viewletmanager_config
@@ -65,6 +67,7 @@
from pyramid.location import lineage
from pyramid.view import view_config
from z3c.form import field
+from z3c.table.column import GetAttrColumn
from zope.interface import implementer
from zope.lifecycleevent import ObjectMovedEvent
@@ -131,6 +134,13 @@
ajax_handler = 'workflow-publication.json'
edit_permission = MANAGE_SITE_PERMISSION
+ def updateWidgets(self, prefix=None):
+ super(SiteContainerWorkflowPublicationEditForm, self).updateWidgets(prefix)
+ if 'publication_effective_date' in self.widgets:
+ widget = self.widgets['publication_effective_date']
+ if not widget.value:
+ widget.value = tztime(datetime.utcnow()).strftime('%d/%m/%y %H:%M')
+
@view_config(name='workflow-publication.json', context=ISiteContainer, request_type=IPyAMSLayer,
permission=MANAGE_SITE_PERMISSION, renderer='json', xhr=True)