Execute the property workflow

This commit is contained in:
Ovidiu Miron 2014-02-04 11:00:06 +02:00
parent a8dc5dd3f0
commit a9d0cb574b
2 changed files with 4 additions and 5 deletions

View File

@ -151,7 +151,7 @@
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: form_url, url: form_url,
data: "workflow_action=publish", data: data,
context: trigger, context: trigger,
success: function (msg) { success: function (msg) {
// remove button (trigger object can't be directly removed) // remove button (trigger object can't be directly removed)

View File

@ -131,12 +131,11 @@ class PublishComment(BrowserView):
comment = aq_inner(self.context) comment = aq_inner(self.context)
content_object = aq_parent(aq_parent(comment)) content_object = aq_parent(aq_parent(comment))
workflowTool = getToolByName(comment, 'portal_workflow', None) workflowTool = getToolByName(comment, 'portal_workflow', None)
current_state = workflowTool.getInfoFor(comment, 'review_state') workflow_action = self.request.form.get('workflow_action', 'publish')
if current_state != 'published': workflowTool.doActionFor(comment, workflow_action)
workflowTool.doActionFor(comment, 'publish')
comment.reindexObject() comment.reindexObject()
content_object.reindexObject() content_object.reindexObject()
IStatusMessage(self.context.REQUEST).addStatusMessage( StatusMessage(self.context.REQUEST).addStatusMessage(
_("Comment approved."), _("Comment approved."),
type="info") type="info")
came_from = self.context.REQUEST.HTTP_REFERER came_from = self.context.REQUEST.HTTP_REFERER