Skip to content

Commit

Permalink
Fix: [#771324] (thanks: pacproduct)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeboer committed Jul 5, 2010
1 parent 62ccb07 commit 361ce4d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion revisioning.admin.inc
Expand Up @@ -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 <a href="!link">here</a>',
array('!link' => '/admin/build/workflow/edit'))
array('!link' => '/admin/build/workflow/edit'))
);
}
return system_settings_form($form);
Expand Down
2 changes: 1 addition & 1 deletion revisioning.install
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions revisioning.module
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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))) {
Expand All @@ -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'))
Expand Down

0 comments on commit 361ce4d

Please sign in to comment.