/[drupal]/contributions/modules/workflow/workflow.module
ViewVC logotype

Diff of /contributions/modules/workflow/workflow.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.83, Thu Jan 1 21:09:16 2009 UTC revision 1.83.2.1, Fri Jun 5 22:05:30 2009 UTC
# Line 1  Line 1 
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
# Line 394  function workflow_node_form(&$form, $for Line 394  function workflow_node_form(&$form, $for
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    
# Line 455  function workflow_form_alter(&$form, $fo Line 455  function workflow_form_alter(&$form, $fo
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;
# Line 481  function workflow_form_alter(&$form, $fo Line 485  function workflow_form_alter(&$form, $fo
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   */   */
# Line 708  function workflow_field_choices($node) { Line 712  function workflow_field_choices($node) {
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);
# Line 984  function workflow_get_all() { Line 993  function workflow_get_all() {
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(
# Line 1335  function _workflow_write_history($node, Line 1344  function _workflow_write_history($node,
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   */   */
# Line 1357  function workflow_get_roles() { Line 1366  function workflow_get_roles() {
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    
# Line 1393  function workflow_cron() { Line 1402  function workflow_cron() {
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    }    }
# Line 1434  function workflow_hook_info() { Line 1443  function workflow_hook_info() {
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) {

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.83.2.1

  ViewVC Help
Powered by ViewVC 1.1.2