Updated workflow forms messages
authorThierry Florac <thierry.florac@onf.fr>
Mon, 11 Sep 2017 14:52:15 +0200
changeset 138 1643b6a9a02a
parent 137 d17090a555a5
child 139 99a481dc4c89
Updated workflow forms messages
src/pyams_content/shared/common/zmi/templates/dashboard.pt
src/pyams_content/shared/common/zmi/templates/wf-operator-warning.pt
src/pyams_content/shared/common/zmi/templates/wf-owner-warning.pt
src/pyams_content/shared/common/zmi/workflow.py
--- a/src/pyams_content/shared/common/zmi/templates/dashboard.pt	Mon Sep 11 14:50:56 2017 +0200
+++ b/src/pyams_content/shared/common/zmi/templates/dashboard.pt	Mon Sep 11 14:52:15 2017 +0200
@@ -8,20 +8,30 @@
 		<tal:var content="structure provider:pyams.toolbar" />
 	</header>
 	<div class="widget-body">
-		<form class="ams-form clearfix margin-bottom-10" method="post" action="quick-search.html"
-			  data-async data-ams-form-submit-target="#search_results">
-			<div class="form-group">
-				<div class="col-md-push-6 col-md-4">
-					<label class="input">
-						<button type="submit" class="icon-append fa fa-fw fa-search no-border no-padding"
-								data-ams-form-hide-loading="true"></button>
-						<input type="text" name="query" placeholder="Quick search..." i18n:attributes="placeholder" />
-					</label>
-					<a class="nowrap btn-sm col-md-2" href="#advanced-search.html"
-					   i18n:translate="">Advanced search...</a>
-				</div>
+		<div class="ams-widget">
+			<header>
+				<h2 i18n:translate="">SEARCH - Between all contents of type &laquo;&nbsp;<span i18n:name="type"
+					tal:content="request.localizer.translate(context.shared_content_factory.content_class.content_name)">type</span>&nbsp;&raquo;</h2>
+			</header>
+			<div class="padding-10 padding-bottom-0">
+				<form class="ams-form clearfix margin-bottom-10" method="post" action="quick-search.html"
+					  data-async data-ams-form-submit-target="#search_results">
+					<div class="form-group">
+						<div class="col-md-6">
+							<label class="input">
+								<button type="submit" class="icon-append fa fa-fw fa-search no-border no-padding"
+										data-ams-form-hide-loading="true"></button>
+								<input type="text" name="query" placeholder="Quick search..." i18n:attributes="placeholder" />
+							</label>
+						</div>
+						<div class="col-md-6">
+							<a class="nowrap btn-sm col-md-2" href="#advanced-search.html"
+							   i18n:translate="">Advanced search...</a>
+						</div>
+					</div>
+				</form>
 			</div>
-		</form>
+		</div>
 		<div id="search_results" tal:define="global dashboard_length 0">
 			<tal:loop repeat="table view.tables">
 				<tal:if condition="table.values">
--- a/src/pyams_content/shared/common/zmi/templates/wf-operator-warning.pt	Mon Sep 11 14:50:56 2017 +0200
+++ b/src/pyams_content/shared/common/zmi/templates/wf-operator-warning.pt	Mon Sep 11 14:52:15 2017 +0200
@@ -1,3 +1,3 @@
-<div class="alert alert-danger padding-5 margin-bottom-5 persistent" i18n:domain="pyams_content" i18n:translate="">
+<div class="alert alert-danger margin-bottom-5 padding-5 persistent" i18n:domain="pyams_content" i18n:translate="">
 	WARNING: this request was made by a contributor which is not the owner of this content.
 </div>
--- a/src/pyams_content/shared/common/zmi/templates/wf-owner-warning.pt	Mon Sep 11 14:50:56 2017 +0200
+++ b/src/pyams_content/shared/common/zmi/templates/wf-owner-warning.pt	Mon Sep 11 14:52:15 2017 +0200
@@ -1,3 +1,3 @@
-<div class="alert alert-danger margin-bottom-5 padding-5" i18n:domain="pyams_content" i18n:translate="">
+<div class="alert alert-danger margin-bottom-5 padding-5 persistent" i18n:domain="pyams_content" i18n:translate="">
 	RECALL: you are not the owner of the content on which you are intervening.
 </div>
--- a/src/pyams_content/shared/common/zmi/workflow.py	Mon Sep 11 14:50:56 2017 +0200
+++ b/src/pyams_content/shared/common/zmi/workflow.py	Mon Sep 11 14:52:15 2017 +0200
@@ -19,8 +19,7 @@
 # import interfaces
 from pyams_content.interfaces import PUBLISH_CONTENT_PERMISSION, CREATE_CONTENT_PERMISSION, MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common.interfaces import IWfSharedContent, ISharedTool, ISharedContent
-from pyams_form.interfaces.form import IFormPrefixViewletsManager, IWidgetsPrefixViewletsManager, \
-    IFormSuffixViewletsManager
+from pyams_form.interfaces.form import IWidgetsPrefixViewletsManager, IFormSuffixViewletsManager
 from pyams_security.interfaces import ISecurityManager
 from pyams_skin.layer import IPyAMSLayer
 from pyams_workflow.interfaces import IWorkflowInfo, IWorkflowTransitionInfo, IWorkflowPublicationInfo, \
@@ -169,8 +168,7 @@
     comment = (data.get('comment') or '').strip()
     if not comment:
         event.form.widgets.errors += (Invalid(_("A comment is required")), )
-    if data.get('publication_expiration_date') and not data.get('push_end_date'):
-        data['push_end_date'] = data['publication_expiration_date']
+        event.form.widgets['comment'].error = Invalid(_("A comment is required"))
 
 
 @viewlet_config(name='wf-propose-message', context=IWfSharedContent, layer=IPyAMSLayer, view=PublicationRequestForm,
@@ -275,8 +273,15 @@
         event.form.widgets.errors += (Invalid(_("A comment is required")), )
 
 
+@viewlet_config(name='wf-refuse-message', context=IWfSharedContent, layer=IPyAMSLayer,
+                view=PublicationRequestRefuseForm, manager=IWidgetsPrefixViewletsManager, weight=20)
+@template_config(template='templates/wf-refuse-propose-message.pt')
+class PublicationRequestRefuseFormMessage(Viewlet):
+    """Publication request refuse form info message"""
+
+
 @viewlet_config(name='wf-refuse-operator-warning', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationRequestRefuseForm, manager=IFormPrefixViewletsManager, weight=10)
+                view=PublicationRequestRefuseForm, manager=IWidgetsPrefixViewletsManager, weight=30)
 @template_config(template='templates/wf-operator-warning.pt')
 class PublicationRequestRefuseFormWarning(Viewlet):
     """Publication request refuse form warning message"""
@@ -288,13 +293,6 @@
         return Viewlet.__new__(cls)
 
 
-@viewlet_config(name='wf-refuse-message', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationRequestRefuseForm, manager=IWidgetsPrefixViewletsManager, weight=20)
-@template_config(template='templates/wf-refuse-propose-message.pt')
-class PublicationRequestRefuseFormMessage(Viewlet):
-    """Publication request refuse form info message"""
-
-
 #
 # Publish form
 #
@@ -353,12 +351,17 @@
     data = event.data
     if not data.get('publication_effective_date'):
         event.form.widgets.errors += (Invalid(_("Publication start date is required")), )
-    if data.get('publication_expiration_date') and not data.get('push_end_date'):
-        data['push_end_date'] = data['publication_expiration_date']
+
+
+@viewlet_config(name='wf-publish-message', context=IWfSharedContent, layer=IPyAMSLayer,
+                view=PublicationForm, manager=IWidgetsPrefixViewletsManager, weight=20)
+@template_config(template='templates/wf-publish-message.pt')
+class PublicationFormMessage(Viewlet):
+    """Shared content publication form info message"""
 
 
 @viewlet_config(name='wf-publish-operator-warning', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationForm, manager=IFormPrefixViewletsManager, weight=10)
+                view=PublicationForm, manager=IWidgetsPrefixViewletsManager, weight=30)
 @template_config(template='templates/wf-operator-warning.pt')
 class PublicationFormWarning(Viewlet):
     """Shared content publication form warning message"""
@@ -370,13 +373,6 @@
         return Viewlet.__new__(cls)
 
 
-@viewlet_config(name='wf-publish-message', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationForm, manager=IWidgetsPrefixViewletsManager, weight=20)
-@template_config(template='templates/wf-publish-message.pt')
-class PublicationFormMessage(Viewlet):
-    """Shared content publication form info message"""
-
-
 #
 # Publication retire request form
 #
@@ -508,8 +504,15 @@
     """Shared content publication retire form, JSON renderer"""
 
 
+@viewlet_config(name='wf-retire-message', context=IWfSharedContent, layer=IPyAMSLayer,
+                view=PublicationRetireForm, manager=IWidgetsPrefixViewletsManager, weight=20)
+@template_config(template='templates/wf-retire-message.pt')
+class PublicationRetireFormMessage(Viewlet):
+    """Publication retire form info message"""
+
+
 @viewlet_config(name='wf-retire-operator-warning', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationRetireForm, manager=IFormPrefixViewletsManager, weight=10)
+                view=PublicationRetireForm, manager=IWidgetsPrefixViewletsManager, weight=30)
 @template_config(template='templates/wf-operator-warning.pt')
 class PublicationRetireFormWarning(Viewlet):
     """Publication retire form warning message"""
@@ -521,13 +524,6 @@
         return Viewlet.__new__(cls)
 
 
-@viewlet_config(name='wf-retire-message', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationRetireForm, manager=IWidgetsPrefixViewletsManager, weight=20)
-@template_config(template='templates/wf-retire-message.pt')
-class PublicationRetireFormMessage(Viewlet):
-    """Publication retire form info message"""
-
-
 #
 # Publication archive request form
 #
@@ -647,8 +643,15 @@
     """Shared content publication archive form, JSON renderer"""
 
 
+@viewlet_config(name='wf-archive-message', context=IWfSharedContent, layer=IPyAMSLayer,
+                view=PublicationArchiveForm, manager=IWidgetsPrefixViewletsManager, weight=20)
+@template_config(template='templates/wf-archive-message.pt')
+class PublicationArchiveFormMessage(Viewlet):
+    """Publication archive form info message"""
+
+
 @viewlet_config(name='wf-archive-operator-warning', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationArchiveForm, manager=IFormPrefixViewletsManager, weight=10)
+                view=PublicationArchiveForm, manager=IWidgetsPrefixViewletsManager, weight=30)
 @template_config(template='templates/wf-operator-warning.pt')
 class PublicationArchiveFormWarning(Viewlet):
     """Publication archive form warning message"""
@@ -660,13 +663,6 @@
         return Viewlet.__new__(cls)
 
 
-@viewlet_config(name='wf-archive-message', context=IWfSharedContent, layer=IPyAMSLayer,
-                view=PublicationArchiveForm, manager=IWidgetsPrefixViewletsManager, weight=20)
-@template_config(template='templates/wf-archive-message.pt')
-class PublicationArchiveFormMessage(Viewlet):
-    """Publication archive form info message"""
-
-
 #
 # Clone form
 #