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

Diff of /contributions/modules/weight/weight.module

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

revision 1.23.2.7, Sat Apr 25 15:03:23 2009 UTC revision 1.23.2.8, Sat Apr 25 15:11:36 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: weight.module,v 1.23.2.6 2009/02/25 19:05:39 nancyw Exp $  // $Id: weight.module,v 1.23.2.7 2009/04/25 15:03:23 nancyw Exp $
3  /**  /**
4   * @file   * @file
5   * This module uses the sticky column of the node table   * This module uses the sticky column of the node table
# Line 61  function weight_menu() { Line 61  function weight_menu() {
61  }  }
62    
63  function weight_nodeapi(&$node, $op) {  function weight_nodeapi(&$node, $op) {
64    switch ($op) {          $weight_node_types = variable_get('weight_node_types', array_flip(node_get_types('names')));
65      case 'presave':          if (in_array($node->type, $weight_node_types)) {
66        // Non-weighted nodes have a weight of zero.      switch ($op) {
67        if (is_null($node->node_weight)) {        case 'presave':
68          $node->node_weight = 0;          // Non-weighted nodes have a weight of zero.
69        }          if (is_null($node->node_weight)) {
70              $node->node_weight = 0;
71            }
72    
73        // If the admin wants to use the menu weight, see if there is one.          // If the admin wants to use the menu weight, see if there is one.
74        if (variable_get('weight_use_menu', FALSE)) {          if (variable_get('weight_use_menu', FALSE)) {
75          $node->node_weight = (isset($node->menu['link_title']) && !empty($node->menu['link_title'])) ? $node->menu['weight'] : $node->node_weight;            $node->node_weight = (isset($node->menu['link_title']) && !empty($node->menu['link_title'])) ? $node->menu['weight'] : $node->node_weight;
76        }          }
77    
78        // Encode weight into the sticky value for the database.          // Encode weight into the sticky value for the database.
79        _weight_encode($node);          _weight_encode($node);
80        break;          break;
81    
82      case 'load':        case 'load':
83        _weight_decode($node);          _weight_decode($node);
84        break;          break;
85        }
86    }    }
87  }  }
88    

Legend:
Removed from v.1.23.2.7  
changed lines
  Added in v.1.23.2.8

  ViewVC Help
Powered by ViewVC 1.1.2