From 361ce4dae7c0098e13021ff04fa7f06d5430cf22 Mon Sep 17 00:00:00 2001 From: rdeboer Date: Mon, 5 Jul 2010 02:31:21 +0000 Subject: [PATCH] Fix: [#771324] (thanks: pacproduct) --- CHANGELOG.txt | 3 ++- revisioning.admin.inc | 2 +- revisioning.install | 2 +- revisioning.module | 11 +++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a5baa6a..66a401d 100755 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -133,5 +133,6 @@ Fixed "Content summary" View: "Node:Revision moderation filter" broke when no co Enhance fix for [#761010] Feature: [#765950], comment #2 Feature: Block view for Content Summary -Feature: optionally suppress workflow transitions via edit form +Feature: optionally suppress Workflow transitions via edit form +Fix: [#771324] (thanks: pacproduct) diff --git a/revisioning.admin.inc b/revisioning.admin.inc index 6582027..479cb1b 100644 --- a/revisioning.admin.inc +++ b/revisioning.admin.inc @@ -40,7 +40,7 @@ function revisioning_admin_configure() { '#title' => t('Allow workflow state transistion via content edit form'), '#default_value' => variable_get('revisioning_allow_workflow_transition_via_edit_form', TRUE), '#description' => t('If unticked, state transitions are only possible via the Workflow tab. Make sure you have enabled the Workflow tab permissions here', - array('!link' => '/admin/build/workflow/edit')) + array('!link' => '/admin/build/workflow/edit')) ); } return system_settings_form($form); diff --git a/revisioning.install b/revisioning.install index c10a053..efcf14c 100755 --- a/revisioning.install +++ b/revisioning.install @@ -24,7 +24,7 @@ function revisioning_update_6307() { /** * Implementation of hook_update_N(). - * + * * Place ourselves after Workflow so that we can alter some of the forms created * by Workflow. * If Workflow isn't installed at the time that Revisioning is installed, set diff --git a/revisioning.module b/revisioning.module index 36ef2ee..92d2070 100755 --- a/revisioning.module +++ b/revisioning.module @@ -360,6 +360,7 @@ function revisioning_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { // by users with the "administer nodes" permission $node->revision_moderation = node_tools_content_is_moderated($node->type); $node->is_pending = _revisioning_node_is_pending($node); + // Could use following, but this seems old style, i.e. when $node is not a &ref //$node_extras['revision_moderation'] = $node->revision_moderation; //$node_extras['is_pending'] = $node->is_pending; @@ -387,6 +388,8 @@ function revisioning_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { // Update the $node object just before it is saved to the db $node->revision = FALSE; } + // Save title of current revision to restore at $op=='update' time + $node->current_title = db_result(db_query('SELECT title FROM {node} WHERE nid=%d', $node->nid)); if (user_access('publish revisions') && variable_get('revisioning_auto_publish_'. $node->type, FALSE)) { drupal_set_message(t('Auto-publishing this revision.')); $node->status = TRUE; @@ -403,8 +406,8 @@ function revisioning_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { case 'update': // edited node, called from node_save(), after _node_save_revision() if ($node->revision_moderation && $node->current_revision_id // i.e. set and not 0 && $node->current_revision_id != $node->vid) { - // Resetting vid back to its originial value, thus creating pending revision - db_query('UPDATE {node} SET vid=%d WHERE nid=%d', $node->current_revision_id, $node->nid); + // Resetting title and vid back to their originial values, thus creating pending revision. + db_query("UPDATE {node} SET vid=%d, title='%s' WHERE nid=%d", $node->current_revision_id, $node->current_title, $node->nid); //$node->is_pending = TRUE; } break; @@ -603,7 +606,7 @@ function _revisioning_operation_appropriate($revision_op, $node) { case 'publish revisions': // If the node isn't meant to be moderated and the user is not an admin, - // or the revision is not either pending or current but not published, + // or the revision is not either pending or current but not published, // then disallow publication. if ((!$node->revision_moderation && !user_access('administer nodes')) || !($node->is_pending || ($node->is_current && !$node->status))) { @@ -612,7 +615,7 @@ function _revisioning_operation_appropriate($revision_op, $node) { break; case 'unpublish current revision': - // If the node isn't meant to be moderated and the user is not an admin, + // If the node isn't meant to be moderated and the user is not an admin, // or it is unpublished already or we're not looking at the current // revision, then unpublication is not an option. if ((!$node->revision_moderation && !user_access('administer nodes'))