extended existing review workflow by stati 'rejected' and 'spam'
removed addional third workflow
This commit is contained in:
parent
f777315da3
commit
c1ec431769
@ -184,11 +184,8 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
|
|||||||
'comment_one_state_workflow' in workflow_chain
|
'comment_one_state_workflow' in workflow_chain
|
||||||
comment_review_workflow_enabled = \
|
comment_review_workflow_enabled = \
|
||||||
'comment_review_workflow' in workflow_chain
|
'comment_review_workflow' in workflow_chain
|
||||||
comment_multiple_state_review_workflow = \
|
|
||||||
'comment_multiple_state_review_workflow' in workflow_chain
|
|
||||||
if one_state_workflow_enabled \
|
if one_state_workflow_enabled \
|
||||||
or comment_review_workflow_enabled \
|
or comment_review_workflow_enabled:
|
||||||
or comment_multiple_state_review_workflow:
|
|
||||||
return
|
return
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -80,124 +80,60 @@ require(["jquery", "pat-registry"], function($, registry) {
|
|||||||
success: function(msg) {
|
success: function(msg) {
|
||||||
if (moderate) {
|
if (moderate) {
|
||||||
let url = location.href;
|
let url = location.href;
|
||||||
$("#review-comments").load(url + " #review-comments", function() {
|
$("#review-comments").load(
|
||||||
init();
|
url + " #review-comments > *",
|
||||||
$(".pat-plone-modal").patPloneModal();
|
function() {
|
||||||
});
|
init();
|
||||||
});
|
$(".pat-plone-modal").patPloneModal();
|
||||||
|
}
|
||||||
|
);
|
||||||
/**********************************************************************
|
} else {
|
||||||
* Bulk actions for comments (delete, publish)
|
location.reload();
|
||||||
**********************************************************************/
|
}
|
||||||
$("input[name='form.button.BulkAction']").click(function (e) {
|
},
|
||||||
e.preventDefault();
|
error: function(msg) {
|
||||||
var form = $(this).closest("form");
|
alert(
|
||||||
var target = $(form).attr('action');
|
"Error transmitting comment. (Error sending AJAX request:" +
|
||||||
var params = $(form).serialize();
|
target +
|
||||||
var valArray = $('input:checkbox:checked');
|
")"
|
||||||
var selectField = $(form).find("[name='form.select.BulkAction']");
|
);
|
||||||
|
}
|
||||||
if (selectField.val() === '-1') {
|
});
|
||||||
// TODO: translate message
|
});
|
||||||
alert("You haven't selected a bulk action. Please select one.");
|
|
||||||
} else if (valArray.length === 0) {
|
|
||||||
// TODO: translate message
|
|
||||||
alert("You haven't selected any comment for this bulk action." +
|
|
||||||
"Please select at least one comment.");
|
|
||||||
} else {
|
|
||||||
$.post(target, params, function (data) {
|
|
||||||
// reset the bulkaction select
|
|
||||||
selectField.find("option[value='-1']").attr('selected', 'selected');
|
|
||||||
// reload filtered comments
|
|
||||||
$("#review-comments").load(window.location + " #review-comments", function() {
|
|
||||||
init();
|
|
||||||
$('.pat-plone-modal').patPloneModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* Check or uncheck all checkboxes from the batch moderation page.
|
|
||||||
**********************************************************************/
|
|
||||||
$("input[name='check_all']").click(function () {
|
|
||||||
if ($(this).val() === '0') {
|
|
||||||
$(this).parents("table")
|
|
||||||
.find("input:checkbox")
|
|
||||||
.prop("checked", true);
|
|
||||||
$(this).val("1");
|
|
||||||
} else {
|
|
||||||
$(this).parents("table")
|
|
||||||
.find("input:checkbox")
|
|
||||||
.prop("checked", false);
|
|
||||||
$(this).val("0");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* select comments with review_state
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
$("input[name='review_state']").click(function () {
|
|
||||||
// location.search = 'review_state=' + $(this).val();
|
|
||||||
let review_state = $(this).val();
|
|
||||||
let url = location.href;
|
|
||||||
if (location.search) {
|
|
||||||
url = location.href.replace(location.search, "?review_state=" + review_state);
|
|
||||||
} else {
|
|
||||||
url = location.href + "?review_state=" + review_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#fieldset-moderate-comments").parent()
|
|
||||||
.load(url + " #fieldset-moderate-comments", function() {
|
|
||||||
init();
|
|
||||||
$('.pat-plone-modal').patPloneModal();
|
|
||||||
let stateObj = { review_state: review_state };
|
|
||||||
history.pushState(stateObj, "moderate comments", url);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Bulk actions for comments (delete, publish)
|
* Bulk actions for comments (delete, publish)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
$("input[name='form.button.BulkAction']").click(function(e) {
|
$("input[name='form.button.BulkAction']").click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var form = $(this).parents("form");
|
var form = $(this).closest("form");
|
||||||
var target = $(form).attr("action");
|
var target = $(form).attr("action");
|
||||||
var params = $(form).serialize();
|
var params = $(form).serialize();
|
||||||
var valArray = $("input:checkbox:checked");
|
var valArray = $("input:checkbox:checked");
|
||||||
var selectField = $(form).find("[name='form.select.BulkAction']");
|
var selectField = $(form).find("[name='form.select.BulkAction']");
|
||||||
|
|
||||||
if (selectField.val() === "-1") {
|
if (selectField.val() === "-1") {
|
||||||
// XXX: translate message
|
// TODO: translate message
|
||||||
alert("You haven't selected a bulk action. Please select one.");
|
alert("You haven't selected a bulk action. Please select one.");
|
||||||
} else if (valArray.length === 0) {
|
} else if (valArray.length === 0) {
|
||||||
// XXX: translate message
|
// TODO: translate message
|
||||||
alert(
|
alert(
|
||||||
"You haven't selected any comment for this bulk action." +
|
"You haven't selected any comment for this bulk action." +
|
||||||
"Please select at least one comment."
|
"Please select at least one comment."
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$.post(target, params, function(data) {
|
$.post(target, params, function(data) {
|
||||||
valArray.each(function() {
|
// reset the bulkaction select
|
||||||
/* Remove all selected lines. */
|
selectField.find("option[value='-1']").attr("selected", "selected");
|
||||||
var row = $(this)
|
// reload filtered comments
|
||||||
.parent()
|
$("#review-comments").load(
|
||||||
.parent();
|
window.location + " #review-comments",
|
||||||
row.fadeOut("normal", function() {
|
function() {
|
||||||
row.remove();
|
init();
|
||||||
});
|
$(".pat-plone-modal").patPloneModal();
|
||||||
});
|
}
|
||||||
// reload page if all comments have been removed
|
);
|
||||||
var comments = $("table#review-comments > tbody > tr");
|
|
||||||
if (comments.length <= valArray.length) {
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
// reset the bulkaction select
|
|
||||||
selectField.find("option[value='-1']").attr("selected", "selected");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -220,31 +156,30 @@ require(["jquery", "pat-registry"], function($, registry) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Comments published: Load history for publishing date.
|
* select comments with review_state
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
$(".last-history-entry").each(function() {
|
|
||||||
var lasthistoryentry = $(this);
|
|
||||||
$.ajax({
|
|
||||||
url: lasthistoryentry.attr("data-href"),
|
|
||||||
success: function (data) {
|
|
||||||
lasthistoryentry.html($(data).find(".historyByLine").first());
|
|
||||||
// format date
|
|
||||||
registry.scan(lasthistoryentry);
|
|
||||||
},
|
|
||||||
error: function (msg) {
|
|
||||||
console.error("Error getting history.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}; // end init
|
|
||||||
|
|
||||||
$("#review-comments").load(url + " #review-comments", function() {
|
$("input[name='review_state']").click(function() {
|
||||||
init();
|
let review_state = $(this).val();
|
||||||
$(".pat-plone-modal").patPloneModal();
|
let url = location.href;
|
||||||
let stateObj = { review_state: review_state };
|
if (location.search) {
|
||||||
history.pushState(stateObj, "moderate comments", url);
|
url = location.href.replace(
|
||||||
});
|
location.search,
|
||||||
|
"?review_state=" + review_state
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
url = location.href + "?review_state=" + review_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#fieldset-moderate-comments")
|
||||||
|
.parent()
|
||||||
|
.load(url + " #fieldset-moderate-comments", function() {
|
||||||
|
init();
|
||||||
|
$(".pat-plone-modal").patPloneModal();
|
||||||
|
let stateObj = { review_state: review_state };
|
||||||
|
history.pushState(stateObj, "moderate comments", url);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@ -269,26 +204,23 @@ require(["jquery", "pat-registry"], function($, registry) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Comments approved: Load history for approved date.
|
* Comments published: Load history for publishing date.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
$(".last-history-entry").each(function() {
|
$(".last-history-entry").each(function() {
|
||||||
var me = $(this);
|
var lasthistoryentry = $(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: me.attr("data-href"),
|
url: lasthistoryentry.attr("data-href"),
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
let first_history_entry = $(data)
|
lasthistoryentry.html(
|
||||||
.find(".historyByLine")
|
$(data)
|
||||||
.first();
|
.find(".historyByLine")
|
||||||
me.html("");
|
.first()
|
||||||
first_history_entry.children().each(function() {
|
);
|
||||||
me.append($(this));
|
|
||||||
me.append("<br/>");
|
|
||||||
});
|
|
||||||
// format date
|
// format date
|
||||||
registry.scan(me);
|
registry.scan(lasthistoryentry);
|
||||||
},
|
},
|
||||||
error: function(msg) {
|
error: function(msg) {
|
||||||
alert("Error getting history.");
|
console.error("Error getting history.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -46,21 +46,12 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form
|
||||||
<form tal:condition="not:items">
|
method="post"
|
||||||
<fieldset id="fieldset-moderate-comments" class="formPanel">
|
|
||||||
<p id="no-comments-message" i18n:translate="message_no_comments">
|
|
||||||
No comments
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<form method="post"
|
|
||||||
action="#"
|
action="#"
|
||||||
tal:condition="moderation_enabled"
|
tal:condition="moderation_enabled"
|
||||||
tal:attributes="action string:${context/absolute_url}/@@bulk-actions"
|
tal:attributes="action string:${context/absolute_url}/@@bulk-actions"
|
||||||
tal:define="batch python:Batch(items, b_size, int(b_start), orphan=1);">
|
tal:define="batch python:Batch(items, b_size, int(b_start), orphan=1);">
|
||||||
|
|
||||||
<fieldset id="fieldset-moderate-comments" class="formPanel">
|
<fieldset id="fieldset-moderate-comments" class="formPanel">
|
||||||
|
|
||||||
<div metal:use-macro="here/batch_macros/macros/navigation" />
|
<div metal:use-macro="here/batch_macros/macros/navigation" />
|
||||||
@ -187,9 +178,11 @@
|
|||||||
class="context"
|
class="context"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Label"
|
value="Label"
|
||||||
tal:attributes="id item/id;
|
tal:attributes="id string:${item/id}_${transition/id};
|
||||||
data-transition transition/id;
|
data-transition transition/id;
|
||||||
value python:translationhelper.translate(transition['title'])"
|
value python:translationhelper.translate(transition['title']);
|
||||||
|
style python:transition['id']=='publish' and 'background-color: #5cb85c;; border-color: #4cae4c;;' or '';
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</tal:transitions>
|
</tal:transitions>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,15 +113,15 @@ class View(BrowserView):
|
|||||||
|
|
||||||
Example: pending
|
Example: pending
|
||||||
|
|
||||||
[{'id': 'mark_as_spam', 'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=mark_as_spam', 'icon': '', 'category': 'workflow', 'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_multiple_state_review_workflow/transitions/mark_as_spam>, 'title': 'Spam', 'link_target': None, 'visible': True, 'available': True, 'allowed': True},
|
[{'id': 'mark_as_spam', 'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=mark_as_spam', 'icon': '', 'category': 'workflow', 'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_review_workflow/transitions/mark_as_spam>, 'title': 'Spam', 'link_target': None, 'visible': True, 'available': True, 'allowed': True},
|
||||||
{'id': 'publish',
|
{'id': 'publish',
|
||||||
'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=publish',
|
'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=publish',
|
||||||
'icon': '',
|
'icon': '',
|
||||||
'category': 'workflow',
|
'category': 'workflow',
|
||||||
'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_multiple_state_review_workflow/transitions/publish>,
|
'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_review_workflow/transitions/publish>,
|
||||||
'title': 'Approve',
|
'title': 'Approve',
|
||||||
'link_target': None, 'visible': True, 'available': True, 'allowed': True},
|
'link_target': None, 'visible': True, 'available': True, 'allowed': True},
|
||||||
{'id': 'reject', 'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=reject', 'icon': '', 'category': 'workflow', 'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_multiple_state_review_workflow/transitions/reject>, 'title': 'Reject', 'link_target': None, 'visible': True, 'available': True, 'allowed': True}]
|
{'id': 'reject', 'url': 'http://localhost:8083/PloneRejected/testfolder/testpage/++conversation++default/1575415863542780/content_status_modify?workflow_action=reject', 'icon': '', 'category': 'workflow', 'transition': <TransitionDefinition at /PloneRejected/portal_workflow/comment_review_workflow/transitions/reject>, 'title': 'Reject', 'link_target': None, 'visible': True, 'available': True, 'allowed': True}]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if obj:
|
if obj:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<object name="portal_workflow" meta_type="Plone Workflow Tool">
|
<object name="portal_workflow" meta_type="Plone Workflow Tool">
|
||||||
<object name="comment_review_workflow" meta_type="Workflow"/>
|
<object name="comment_review_workflow" meta_type="Workflow"/>
|
||||||
<object name="comment_multiple_state_review_workflow" meta_type="Workflow"/>
|
|
||||||
<object name="comment_one_state_workflow" meta_type="Workflow"/>
|
<object name="comment_one_state_workflow" meta_type="Workflow"/>
|
||||||
<bindings>
|
<bindings>
|
||||||
<type type_id="Discussion Item">
|
<type type_id="Discussion Item">
|
||||||
|
@ -1,138 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<dc-workflow
|
|
||||||
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
|
||||||
i18n:domain="plone"
|
|
||||||
workflow_id="comment_multiple_state_review_workflow"
|
|
||||||
title="Comment Multiple State Review Workflow"
|
|
||||||
description="A review workflow for comments with multiple states"
|
|
||||||
state_variable="review_state"
|
|
||||||
initial_state="pending"
|
|
||||||
i18n:attributes="title; description"
|
|
||||||
>
|
|
||||||
<permission>Access contents information</permission>
|
|
||||||
<permission>Modify portal content</permission>
|
|
||||||
<permission>Reply to item</permission>
|
|
||||||
<permission>View</permission>
|
|
||||||
<state state_id="pending" title="Pending">
|
|
||||||
<description>Submitted, pending review.</description>
|
|
||||||
<exit-transition transition_id="mark_as_spam"/>
|
|
||||||
<exit-transition transition_id="publish"/>
|
|
||||||
<exit-transition transition_id="reject"/>
|
|
||||||
<permission-map name="Access contents information" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
<permission-role>Owner</permission-role>
|
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Modify portal content" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
<permission-role>Owner</permission-role>
|
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Reply to item" acquired="False">
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="View" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
<permission-role>Owner</permission-role>
|
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
</state>
|
|
||||||
<state state_id="published" title="Published">
|
|
||||||
<description>Visible to everyone, non-editable.</description>
|
|
||||||
<exit-transition transition_id="mark_as_spam"/>
|
|
||||||
<exit-transition transition_id="recall"/>
|
|
||||||
<exit-transition transition_id="reject"/>
|
|
||||||
<permission-map name="Access contents information" acquired="True">
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Modify portal content" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Reply to item" acquired="True">
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="View" acquired="True">
|
|
||||||
</permission-map>
|
|
||||||
</state>
|
|
||||||
<state state_id="rejected" title="Rejected">
|
|
||||||
<exit-transition transition_id="mark_as_spam"/>
|
|
||||||
<exit-transition transition_id="publish"/>
|
|
||||||
<exit-transition transition_id="recall"/>
|
|
||||||
</state>
|
|
||||||
<state state_id="spam" title="Spam">
|
|
||||||
<exit-transition transition_id="publish"/>
|
|
||||||
<exit-transition transition_id="recall"/>
|
|
||||||
<exit-transition transition_id="reject"/>
|
|
||||||
</state>
|
|
||||||
<transition transition_id="mark_as_spam" title="Mark as spam" new_state="spam" trigger="USER" before_script="" after_script="">
|
|
||||||
<description>Spam comments are invisible to other users.</description>
|
|
||||||
<action url="%(content_url)s/content_status_modify?workflow_action=mark_as_spam" category="workflow" icon="">Spam</action>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Review comments</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</transition>
|
|
||||||
<transition transition_id="publish" title="Reviewer approves content" new_state="published" trigger="USER" before_script="" after_script="">
|
|
||||||
<description>Approving the comment makes it visible to other users.</description>
|
|
||||||
<action url="%(content_url)s/content_status_modify?workflow_action=publish" category="workflow" icon="">Approve</action>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Review comments</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</transition>
|
|
||||||
<transition transition_id="recall" title="Reviewer recalls comment back to pending state" new_state="pending" trigger="USER" before_script="" after_script="">
|
|
||||||
<action url="%(content_url)s/content_status_modify?workflow_action=recall" category="workflow" icon="">Recall</action>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Review comments</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</transition>
|
|
||||||
<transition transition_id="reject" title="Reviewer rejects comment" new_state="rejected" trigger="USER" before_script="" after_script="">
|
|
||||||
<description>Rejected comments are invisible to other users.</description>
|
|
||||||
<action url="%(content_url)s/content_status_modify?workflow_action=reject" category="workflow" icon="">Reject</action>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Review comments</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</transition>
|
|
||||||
<variable variable_id="action" for_catalog="False" for_status="True" update_always="True">
|
|
||||||
<description>Previous transition</description>
|
|
||||||
<default>
|
|
||||||
|
|
||||||
<expression>transition/getId|nothing</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
<variable variable_id="actor" for_catalog="False" for_status="True" update_always="True">
|
|
||||||
<description>The ID of the user who performed the previous transition</description>
|
|
||||||
<default>
|
|
||||||
|
|
||||||
<expression>user/getUserName</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
<variable variable_id="comments" for_catalog="False" for_status="True" update_always="True">
|
|
||||||
<description>Comment about the last transition</description>
|
|
||||||
<default>
|
|
||||||
|
|
||||||
<expression>python:state_change.kwargs.get('comment', '')</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
<variable variable_id="review_history" for_catalog="False" for_status="False" update_always="False">
|
|
||||||
<description>Provides access to workflow history</description>
|
|
||||||
<default>
|
|
||||||
|
|
||||||
<expression>state_change/getHistory</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Request review</guard-permission>
|
|
||||||
<guard-permission>Review portal content</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
<variable variable_id="time" for_catalog="False" for_status="True" update_always="True">
|
|
||||||
<description>When the previous transition was performed</description>
|
|
||||||
<default>
|
|
||||||
|
|
||||||
<expression>state_change/getDateTime</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
</dc-workflow>
|
|
@ -7,125 +7,130 @@
|
|||||||
state_variable="review_state"
|
state_variable="review_state"
|
||||||
initial_state="pending"
|
initial_state="pending"
|
||||||
i18n:attributes="title; description">
|
i18n:attributes="title; description">
|
||||||
|
<permission>Access contents information</permission>
|
||||||
|
<permission>Modify portal content</permission>
|
||||||
|
<permission>Reply to item</permission>
|
||||||
|
<permission>View</permission>
|
||||||
|
<state state_id="pending" title="Pending">
|
||||||
|
<description>Submitted, pending review.</description>
|
||||||
|
<exit-transition transition_id="mark_as_spam"/>
|
||||||
|
<exit-transition transition_id="publish"/>
|
||||||
|
<exit-transition transition_id="reject"/>
|
||||||
|
<permission-map name="Access contents information" acquired="False">
|
||||||
|
<permission-role>Manager</permission-role>
|
||||||
|
<permission-role>Owner</permission-role>
|
||||||
|
<permission-role>Reviewer</permission-role>
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="Modify portal content" acquired="False">
|
||||||
|
<permission-role>Manager</permission-role>
|
||||||
|
<permission-role>Owner</permission-role>
|
||||||
|
<permission-role>Reviewer</permission-role>
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="Reply to item" acquired="False">
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="View" acquired="False">
|
||||||
|
<permission-role>Manager</permission-role>
|
||||||
|
<permission-role>Owner</permission-role>
|
||||||
|
<permission-role>Reviewer</permission-role>
|
||||||
|
</permission-map>
|
||||||
|
</state>
|
||||||
|
<state state_id="published" title="Published">
|
||||||
|
<description>Visible to everyone, non-editable.</description>
|
||||||
|
<exit-transition transition_id="mark_as_spam"/>
|
||||||
|
<exit-transition transition_id="recall"/>
|
||||||
|
<exit-transition transition_id="reject"/>
|
||||||
|
<permission-map name="Access contents information" acquired="True">
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="Modify portal content" acquired="False">
|
||||||
|
<permission-role>Manager</permission-role>
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="Reply to item" acquired="True">
|
||||||
|
</permission-map>
|
||||||
|
<permission-map name="View" acquired="True">
|
||||||
|
</permission-map>
|
||||||
|
</state>
|
||||||
|
<state state_id="rejected" title="Rejected">
|
||||||
|
<exit-transition transition_id="mark_as_spam"/>
|
||||||
|
<exit-transition transition_id="publish"/>
|
||||||
|
<exit-transition transition_id="recall"/>
|
||||||
|
</state>
|
||||||
|
<state state_id="spam" title="Spam">
|
||||||
|
<exit-transition transition_id="publish"/>
|
||||||
|
<exit-transition transition_id="recall"/>
|
||||||
|
<exit-transition transition_id="reject"/>
|
||||||
|
</state>
|
||||||
|
<transition transition_id="mark_as_spam" title="Mark as spam" new_state="spam" trigger="USER" before_script="" after_script="">
|
||||||
|
<description>Spam comments are invisible to other users.</description>
|
||||||
|
<action url="%(content_url)s/content_status_modify?workflow_action=mark_as_spam" category="workflow" icon="">Spam</action>
|
||||||
|
<guard>
|
||||||
|
<guard-permission>Review comments</guard-permission>
|
||||||
|
</guard>
|
||||||
|
</transition>
|
||||||
|
<transition transition_id="publish" title="Reviewer approves content" new_state="published" trigger="USER" before_script="" after_script="">
|
||||||
|
<description>Approving the comment makes it visible to other users.</description>
|
||||||
|
<action url="%(content_url)s/content_status_modify?workflow_action=publish" category="workflow" icon="">Approve</action>
|
||||||
|
<guard>
|
||||||
|
<guard-permission>Review comments</guard-permission>
|
||||||
|
</guard>
|
||||||
|
</transition>
|
||||||
|
<transition transition_id="recall" title="Reviewer recalls comment back to pending state" new_state="pending" trigger="USER" before_script="" after_script="">
|
||||||
|
<action url="%(content_url)s/content_status_modify?workflow_action=recall" category="workflow" icon="">Recall</action>
|
||||||
|
<guard>
|
||||||
|
<guard-permission>Review comments</guard-permission>
|
||||||
|
</guard>
|
||||||
|
</transition>
|
||||||
|
<transition transition_id="reject" title="Reviewer rejects comment" new_state="rejected" trigger="USER" before_script="" after_script="">
|
||||||
|
<description>Rejected comments are invisible to other users.</description>
|
||||||
|
<action url="%(content_url)s/content_status_modify?workflow_action=reject" category="workflow" icon="">Reject</action>
|
||||||
|
<guard>
|
||||||
|
<guard-permission>Review comments</guard-permission>
|
||||||
|
</guard>
|
||||||
|
</transition>
|
||||||
|
<variable variable_id="action" for_catalog="False" for_status="True" update_always="True">
|
||||||
|
<description>Previous transition</description>
|
||||||
|
<default>
|
||||||
|
|
||||||
<permission>Access contents information</permission>
|
<expression>transition/getId|nothing</expression>
|
||||||
<permission>Modify portal content</permission>
|
</default>
|
||||||
<permission>View</permission>
|
<guard>
|
||||||
<permission>Reply to item</permission>
|
</guard>
|
||||||
|
</variable>
|
||||||
|
<variable variable_id="actor" for_catalog="False" for_status="True" update_always="True">
|
||||||
|
<description>The ID of the user who performed the previous transition</description>
|
||||||
|
<default>
|
||||||
|
|
||||||
<state state_id="pending" title="Pending" i18n:attributes="title">
|
<expression>user/getUserName</expression>
|
||||||
<exit-transition transition_id="publish"/>
|
</default>
|
||||||
<description i18n:translate="">
|
<guard>
|
||||||
Submitted, pending review.
|
</guard>
|
||||||
</description>
|
</variable>
|
||||||
<permission-map name="Access contents information" acquired="False">
|
<variable variable_id="comments" for_catalog="False" for_status="True" update_always="True">
|
||||||
<permission-role>Manager</permission-role>
|
<description>Comment about the last transition</description>
|
||||||
<permission-role>Owner</permission-role>
|
<default>
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Modify portal content" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
<permission-role>Owner</permission-role>
|
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="View" acquired="False">
|
|
||||||
<permission-role>Manager</permission-role>
|
|
||||||
<permission-role>Owner</permission-role>
|
|
||||||
<permission-role>Reviewer</permission-role>
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Reply to item" acquired="False">
|
|
||||||
</permission-map>
|
|
||||||
</state>
|
|
||||||
|
|
||||||
<state state_id="published" title="Published" i18n:attributes="title">
|
<expression>python:state_change.kwargs.get('comment', '')</expression>
|
||||||
<description i18n:translate="">
|
</default>
|
||||||
Visible to everyone, non-editable.
|
<guard>
|
||||||
</description>
|
</guard>
|
||||||
<permission-map name="Access contents information" acquired="True">
|
</variable>
|
||||||
</permission-map>
|
<variable variable_id="review_history" for_catalog="False" for_status="False" update_always="False">
|
||||||
<permission-map name="Modify portal content" acquired="False">
|
<description>Provides access to workflow history</description>
|
||||||
<permission-role>Manager</permission-role>
|
<default>
|
||||||
</permission-map>
|
|
||||||
<permission-map name="View" acquired="True">
|
|
||||||
</permission-map>
|
|
||||||
<permission-map name="Reply to item" acquired="True">
|
|
||||||
</permission-map>
|
|
||||||
</state>
|
|
||||||
|
|
||||||
<transition transition_id="publish" new_state="published"
|
<expression>state_change/getHistory</expression>
|
||||||
title="Reviewer approves content"
|
</default>
|
||||||
trigger="USER"
|
<guard>
|
||||||
before_script="" after_script=""
|
<guard-permission>Request review</guard-permission>
|
||||||
i18n:attributes="title">
|
<guard-permission>Review portal content</guard-permission>
|
||||||
<description i18n:translate="">
|
</guard>
|
||||||
Approving the comment makes it visible to other users.
|
</variable>
|
||||||
</description>
|
<variable variable_id="time" for_catalog="False" for_status="True" update_always="True">
|
||||||
<action url="%(content_url)s/content_status_modify?workflow_action=publish"
|
<description>When the previous transition was performed</description>
|
||||||
category="workflow"
|
<default>
|
||||||
i18n:translate="">Approve</action>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Review comments</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</transition>
|
|
||||||
|
|
||||||
<variable variable_id="action" for_catalog="False"
|
<expression>state_change/getDateTime</expression>
|
||||||
for_status="True" update_always="True">
|
</default>
|
||||||
<description i18n:translate="">Previous transition</description>
|
<guard>
|
||||||
<default>
|
</guard>
|
||||||
<expression>transition/getId|nothing</expression>
|
</variable>
|
||||||
</default>
|
</dc-workflow>
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
|
|
||||||
<variable variable_id="actor" for_catalog="False"
|
|
||||||
for_status="True" update_always="True">
|
|
||||||
<description i18n:translate="">
|
|
||||||
The ID of the user who performed the previous transition
|
|
||||||
</description>
|
|
||||||
<default>
|
|
||||||
<expression>user/getUserName</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
|
|
||||||
<variable variable_id="comments" for_catalog="False"
|
|
||||||
for_status="True" update_always="True">
|
|
||||||
<description i18n:translate="">
|
|
||||||
Comment about the last transition
|
|
||||||
</description>
|
|
||||||
<default>
|
|
||||||
<expression>python:state_change.kwargs.get('comment', '')</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
|
|
||||||
<variable variable_id="review_history" for_catalog="False"
|
|
||||||
for_status="False" update_always="False">
|
|
||||||
<description i18n:translate="">
|
|
||||||
Provides access to workflow history
|
|
||||||
</description>
|
|
||||||
<default>
|
|
||||||
<expression>state_change/getHistory</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
<guard-permission>Request review</guard-permission>
|
|
||||||
<guard-permission>Review portal content</guard-permission>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
|
|
||||||
<variable variable_id="time" for_catalog="False"
|
|
||||||
for_status="True" update_always="True">
|
|
||||||
<description i18n:translate="">
|
|
||||||
When the previous transition was performed
|
|
||||||
</description>
|
|
||||||
<default>
|
|
||||||
<expression>state_change/getDateTime</expression>
|
|
||||||
</default>
|
|
||||||
<guard>
|
|
||||||
</guard>
|
|
||||||
</variable>
|
|
||||||
|
|
||||||
</dc-workflow>
|
|
||||||
|
@ -68,7 +68,7 @@ I add a comment and delete it
|
|||||||
Wait Until Page Does Not Contain This is a comment
|
Wait Until Page Does Not Contain This is a comment
|
||||||
|
|
||||||
workflow multiple enabled
|
workflow multiple enabled
|
||||||
Go To ${PLONE_URL}/@@content-controlpanel?type_id=Discussion%20Item&new_workflow=comment_multiple_state_review_workflow
|
Go To ${PLONE_URL}/@@content-controlpanel?type_id=Discussion%20Item&new_workflow=comment_review_workflow
|
||||||
Click Button Save
|
Click Button Save
|
||||||
|
|
||||||
# Then
|
# Then
|
||||||
|
@ -31,7 +31,7 @@ class ModerationBulkActionsViewTest(unittest.TestCase):
|
|||||||
self.context = self.portal
|
self.context = self.portal
|
||||||
self.portal.portal_workflow.setChainForPortalTypes(
|
self.portal.portal_workflow.setChainForPortalTypes(
|
||||||
('Discussion Item',),
|
('Discussion Item',),
|
||||||
'comment_multiple_state_review_workflow',
|
'comment_review_workflow',
|
||||||
)
|
)
|
||||||
self.wf_tool = self.portal.portal_workflow
|
self.wf_tool = self.portal.portal_workflow
|
||||||
# Add a conversation with three comments
|
# Add a conversation with three comments
|
||||||
|
@ -73,7 +73,3 @@ def upgrade_comment_workflows(context):
|
|||||||
|
|
||||||
def add_js_to_plone_legacy(context):
|
def add_js_to_plone_legacy(context):
|
||||||
context.runImportStepFromProfile(default_profile, 'plone.app.registry')
|
context.runImportStepFromProfile(default_profile, 'plone.app.registry')
|
||||||
|
|
||||||
|
|
||||||
def add_multiple_state_workflow(context):
|
|
||||||
upgrade_comment_workflows_retain_current_workflow(context)
|
|
||||||
|
@ -62,15 +62,4 @@
|
|||||||
/>
|
/>
|
||||||
</genericsetup:upgradeSteps>
|
</genericsetup:upgradeSteps>
|
||||||
|
|
||||||
<genericsetup:upgradeSteps
|
|
||||||
source="1001"
|
|
||||||
destination="1002"
|
|
||||||
profile="plone.app.discussion:default">
|
|
||||||
<genericsetup:upgradeStep
|
|
||||||
title="Additional workflow with states pending, published, rejected and spam"
|
|
||||||
description="Additional states allows moderators to review history of publishing and rejection"
|
|
||||||
handler=".upgrades.add_multiple_state_workflow"
|
|
||||||
/>
|
|
||||||
</genericsetup:upgradeSteps>
|
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
Loading…
Reference in New Issue
Block a user