| 1 |
<?php |
<?php |
| 2 |
// $Id: workflow.module,v 1.82 2009/01/01 20:53:21 jvandyk Exp $ |
// $Id: workflow.module,v 1.83 2009/01/01 21:09:16 jvandyk Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 394 |
'#description' => t('A comment to put in the workflow log.'), |
'#description' => t('A comment to put in the workflow log.'), |
| 395 |
'#default_value' => $comment, |
'#default_value' => $comment, |
| 396 |
'#rows' => 2, |
'#rows' => 2, |
| 397 |
); |
); |
| 398 |
} |
} |
| 399 |
} |
} |
| 400 |
|
|
| 455 |
); |
); |
| 456 |
} |
} |
| 457 |
|
|
| 458 |
|
$timestamp = NULL; |
| 459 |
|
$comment = ''; |
| 460 |
|
$name = ''; |
| 461 |
|
|
| 462 |
// See if scheduling information is present. |
// See if scheduling information is present. |
| 463 |
if ($node->_workflow_scheduled_timestamp && $node->_workflow_scheduled_sid) { |
if (isset($node->_workflow_scheduled_timestamp) && isset($node->_workflow_scheduled_sid)) { |
| 464 |
// The default value should be the upcoming sid. |
// The default value should be the upcoming sid. |
| 465 |
$current = $node->_workflow_scheduled_sid; |
$current = $node->_workflow_scheduled_sid; |
| 466 |
$timestamp = $node->_workflow_scheduled_timestamp; |
$timestamp = $node->_workflow_scheduled_timestamp; |
| 485 |
* A comment for the node's workflow history. |
* A comment for the node's workflow history. |
| 486 |
* @param $force |
* @param $force |
| 487 |
* If set to TRUE, workflow permissions will be ignored. |
* If set to TRUE, workflow permissions will be ignored. |
| 488 |
* |
* |
| 489 |
* @return int |
* @return int |
| 490 |
* ID of new state. |
* ID of new state. |
| 491 |
*/ |
*/ |
| 712 |
* The ID of the current state. |
* The ID of the current state. |
| 713 |
*/ |
*/ |
| 714 |
function workflow_node_current_state($node) { |
function workflow_node_current_state($node) { |
| 715 |
$sid = db_result(db_query('SELECT sid FROM {workflow_node} WHERE nid = %d', $node->nid)); |
$sid = FALSE; |
| 716 |
|
|
| 717 |
if (!$sid) { |
// There is no nid when creating a node. |
| 718 |
|
if (!empty($node->nid)) { |
| 719 |
|
$sid = db_result(db_query('SELECT sid FROM {workflow_node} WHERE nid = %d', $node->nid)); |
| 720 |
|
} |
| 721 |
|
|
| 722 |
|
if (!$sid && !empty($node->type)) { |
| 723 |
// No current state. Use creation state. |
// No current state. Use creation state. |
| 724 |
$wid = workflow_get_workflow_for_type($node->type); |
$wid = workflow_get_workflow_for_type($node->type); |
| 725 |
$sid = _workflow_creation_state($wid); |
$sid = _workflow_creation_state($wid); |
| 993 |
function workflow_create($name) { |
function workflow_create($name) { |
| 994 |
$workflow = array( |
$workflow = array( |
| 995 |
'name' => $name, |
'name' => $name, |
| 996 |
'options' => serialize(array('comment_log_node' => 1, 'comment_log_tab' => 1)), |
'options' => serialize(array('comment_log_node' => 1, 'comment_log_tab' => 1)), |
| 997 |
); |
); |
| 998 |
drupal_write_record('workflows', $workflow); |
drupal_write_record('workflows', $workflow); |
| 999 |
workflow_state_save(array( |
workflow_state_save(array( |
| 1344 |
|
|
| 1345 |
/** |
/** |
| 1346 |
* Get a list of roles. |
* Get a list of roles. |
| 1347 |
* |
* |
| 1348 |
* @return |
* @return |
| 1349 |
* Array of role names keyed by role ID, including the 'author' role. |
* Array of role names keyed by role ID, including the 'author' role. |
| 1350 |
*/ |
*/ |
| 1366 |
function workflow_cron() { |
function workflow_cron() { |
| 1367 |
$clear_cache = FALSE; |
$clear_cache = FALSE; |
| 1368 |
|
|
| 1369 |
// If the time now is greater than the time to execute a |
// If the time now is greater than the time to execute a |
| 1370 |
// transition, do it. |
// transition, do it. |
| 1371 |
$nodes = db_query('SELECT * FROM {workflow_scheduled_transition} s WHERE s.scheduled > 0 AND s.scheduled < %d', time()); |
$nodes = db_query('SELECT * FROM {workflow_scheduled_transition} s WHERE s.scheduled > 0 AND s.scheduled < %d', time()); |
| 1372 |
|
|
| 1402 |
*/ |
*/ |
| 1403 |
function workflow_action_info_alter(&$info) { |
function workflow_action_info_alter(&$info) { |
| 1404 |
foreach (array_keys($info) as $key) { |
foreach (array_keys($info) as $key) { |
| 1405 |
// Modify each action's hooks declaration, changing it to say |
// Modify each action's hooks declaration, changing it to say |
| 1406 |
// that the action supports any hook. |
// that the action supports any hook. |
| 1407 |
$info[$key]['hooks'] = 'any'; |
$info[$key]['hooks'] = 'any'; |
| 1408 |
} |
} |
| 1443 |
|
|
| 1444 |
/** |
/** |
| 1445 |
* Implementation of hook_menu_alter(). |
* Implementation of hook_menu_alter(). |
| 1446 |
* |
* |
| 1447 |
* Work around loss of menu local task inheritance in Drupal 6.2. |
* Work around loss of menu local task inheritance in Drupal 6.2. |
| 1448 |
*/ |
*/ |
| 1449 |
function workflow_menu_alter(&$callbacks) { |
function workflow_menu_alter(&$callbacks) { |