Index: nodeorder.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeorder/nodeorder.info,v
retrieving revision 1.3
diff -u -r1.3 nodeorder.info
--- nodeorder.info	18 Jun 2007 22:53:51 -0000	1.3
+++ nodeorder.info	9 Sep 2008 15:29:25 -0000
@@ -1,3 +1,4 @@
 name = "nodeorder"
 description = "Allows the ordering of nodes within taxonomy terms."
-dependencies[] = jquery_interface
+dependencies[] = interface_sortable
+core = 6.x
Index: nodeorder.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeorder/nodeorder.module,v
retrieving revision 1.9
diff -u -r1.9 nodeorder.module
--- nodeorder.module	23 May 2007 23:25:08 -0000	1.9
+++ nodeorder.module	9 Sep 2008 15:29:26 -0000
@@ -13,7 +13,7 @@
 /**
  * Implementation of hook_form_alter().
  */
-function nodeorder_form_alter(&$form, $form_id, $form_state) {
+function nodeorder_form_alter(&$form, $form_state, $form_id) {
   if ($form_id == 'taxonomy_form_vocabulary') {
     $is_orderable = $form['module']['#value'] == 'nodeorder';
     
@@ -33,11 +33,11 @@
 /**
  * Accept the form submission for a vocabulary and save the results.
  */
-function nodeorder_taxonomy_form_vocabulary_submit($form_values, $form, $form_state) {
-  $vid = $form_values['vid'];
+function nodeorder_taxonomy_form_vocabulary_submit($form, $form_state) {
+  $vid = $form_state['values']['vid'];
   
-  if ($form_values['orderable']) {
-    if ($form_values['module'] != 'nodeorder') {
+  if ($form_state['values']['orderable']) {
+    if ($form_state['values']['module'] != 'nodeorder') {
       // Switching from non-orderable to orderable...
       
       // Set weight_in_tid to nid for all rows in term_node where
@@ -60,7 +60,7 @@
     }
   }
   else {
-    if ($form_values['module'] == 'nodeorder') {
+    if ($form_state['values']['module'] == 'nodeorder') {
       // Switching from orderable to non-orderable...
       db_query("UPDATE {vocabulary} SET module = '%s' WHERE vid = %d", 'taxonomy', $vid);
       
@@ -187,7 +187,8 @@
           }
 
           $output .= taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE, $order));
-          $output .= theme('feed_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'));
+          $output .= theme('feed_icon', url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'),
+                                        t('RSS - ' . $title));
           return $output;
           break;
 
@@ -308,31 +309,33 @@
   $list_div_id = 'node-sort-list-'. $tid;
   $count = 0;
   $result = nodeorder_select_nodes(array($tid), 'and', 0, FALSE, $order, $count);
-  if (db_num_rows($result) > 0) {
-    $output = "<div id=\"$list_div_id\" class=\"node-sort-list\">\n";
-    while ($node = db_fetch_object($result)) {
-      $loaded_node = node_load($node->nid);
-      $node_div_id = $list_div_id .'_'. $node->nid .'_'. $node->vid;
-      
-      $output .= "<div id=\"$node_div_id\" class=\"sort-wrapper\">\n";
+  while ($node = db_fetch_object($result)) {
+    $loaded_node = node_load($node->nid);
+    $node_div_id = $list_div_id .'_'. $node->nid .'_'. $node->vid;
+    
+    $output .= "<div id=\"$node_div_id\" class=\"sort-wrapper\">\n";
 
-      $title_only_while_ordering =  variable_get('nodeorder_minimal_ordering_text', 0);
-      
-      if ($title_only_while_ordering) {
-        $output .= "<div class=\"node node-shell\"><h2>". l($loaded_node->title, "node/$loaded_node->nid") ."</h2></div>\n";
-      }
-      else {
-        $output .= node_view($loaded_node, 1);
-      }
-      
-      $output .= "</div>\n";
-      
-      $nids[] = $node->nid;
-      $vids[] = $loaded_node->vid;
-      $weights[] = $loaded_node->nodeorder[$tid];
+    $title_only_while_ordering =  variable_get('nodeorder_minimal_ordering_text', 0);
+    
+    if ($title_only_while_ordering) {
+      $output .= "<div class=\"node node-shell\"><h2>". l($loaded_node->title, "node/$loaded_node->nid") ."</h2></div>\n";
+    }
+    else {
+      $output .= node_view($loaded_node, 1);
     }
+    
+    $output .= "</div>\n";
+    
+    $nids[] = $node->nid;
+    $vids[] = $loaded_node->vid;
+    $weights[] = $loaded_node->nodeorder[$tid];
+  }
+  if (count($nids)) {
+    $output = "<div id=\"$list_div_id\" class=\"node-sort-list\">\n". $output;
     $output .= "\n</div>\n";
     
+    $url = url('nodeorder/reordered');
+    
     // Set up the page with the initial values (nids) and weights.  When a node gets
     // dragged & dropped, we'll update the initialNids and initialVids with the new node
     // order.  The weights will stay the same since our algorithm just swaps weights
@@ -349,7 +352,7 @@
         $.ajax(
           {
             type: "POST",
-            url: "/nodeorder/reordered",
+            url: "$url",
             data: 'new-nids='+newNids+'&new-vids='+newVids+'&initial-nids='+initialNids+'&initial-weights='+initialWeights+'&tid='+$tid+'&list-id=$list_div_id'
           }
         );
@@ -437,7 +440,8 @@
     'description' => 'Allows the ordering of nodes within taxonomy terms.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('nodeorder_admin'),
-    'type' => MENU_NORMAL_ITEM
+    'type' => MENU_NORMAL_ITEM,
+    'access arguments' => array('administer site configuration')
   );
   $items['nodeorder/term'] = array(
     'title' => 'nodeorder term',
@@ -524,17 +528,17 @@
   }
 
   $result = db_query($sql, $tid, $weight);
+   
+  $node1 = db_fetch_object($result);
+  $node2 = db_fetch_object($result);
   
   // Now we just need to swap the weights of the two nodes...
-  if (db_num_rows($result) != 2) {
+  if (!$node1 || !$node2) {
     drupal_set_message('There was a problem moving the node within its category.');
     drupal_access_denied();
     return;
   }
   
-  $node1 = db_fetch_object($result);
-  $node2 = db_fetch_object($result);
-  
   $sql = "UPDATE {term_node} SET weight_in_tid = %d WHERE nid = %d AND vid = %d AND tid = %d";
   
   db_query($sql, $node1->weight_in_tid, $node2->nid, $node2->vid, $tid);
@@ -554,7 +558,7 @@
   $sql = "SELECT v.vid AS vid FROM {vocabulary_node_types} vnt JOIN {vocabulary} v ON vnt.vid = v.vid WHERE vnt.type = '%s' AND v.module = 'nodeorder'";
   $result = db_query($sql, $node->type);
   
-  if (db_num_rows($result)) {
+  if (db_fetch_object($result)) {
     return TRUE;
   }
   
@@ -587,7 +591,7 @@
   $sql = "SELECT * FROM {vocabulary} WHERE module = 'nodeorder' AND vid = %d";
   $result = db_query($sql, $vid);
   
-  if (db_num_rows($result)) {
+  if (db_fetch_object($result)) {
     return TRUE;
   }
   
@@ -745,4 +749,4 @@
       'arguments' => array('path', 'name')
     )
   );
-}
\ No newline at end of file
+}
