--- taxonomy_switch.module	2008-12-20 22:06:05.000000000 -0500
+++ taxonomy_switchNew.module	2008-12-20 23:17:53.000000000 -0500
@@ -11,10 +11,16 @@
 /**
  * Implementation of hook_help().
  */
-function taxonomy_switch_help($section) {
+function taxonomy_switch_help($path, $arg) {
   global $base_url;
-  switch ($section) {
+  switch ($path) {
     case 'admin/content/taxonomy/switch':
+/* TODO The 'op' element in the form values is deprecated.
+   Each button can have #validate and #submit functions associated with it.
+   Thus, there should be one button that submits the form and which invokes
+   the normal form_id_validate and form_id_submit handlers. Any additional
+   buttons which need to invoke different validate or submit functionality
+   should have button-specific functions. */
       $op = $_POST['op']; // $form_values['op'];
       switch ($op) {
 	case "":
@@ -31,7 +37,7 @@ function taxonomy_switch_help($section) 
           return $help_message;
       }
     case 'admin/help#taxonomy_switch':
-		return '<h2>'.t('Moving terms between vocabularies').'</h2><p>'.t("This module allows you to move a term, together with all its sub-terms and associated nodes, from one vocabulary to another. The switch is carried out in two steps: first choose the source and target vocabularies, then choose the source and target terms. The selected source term will be moved such that it becomes a sub-term of the selected target term.").'</p><p>'.t("The module will also maintain the coherence of the vocabulary definition: <ol><li>If the target vocabulary does not allow the definition of a term hierarchy, then the target term cannot be selected and the source term is moved to the root level of the target vocabulary.</li><li>If the source vocabulary classifies content types which are not classified by the target vocabulary, then the latter is updated to classify the missing types</li></ol></p><p>You can access the switch module from a tab on the categories administration page; note that the module requires 'administer taxonomy' user permissions").'<h2>'.t('Easy node classification').'</h2><p>'.t("A 'classify' tab is provided on node pages: this allows you to reclassify a node without the overhead of up- and down-loading the actual node content").'</p><h2>'.t('Constraints').'</h2><p>'.t("There are certain <strong>important limitations</strong> to this module:<ol><li>The module is unable at present to switch terms from vocabularies with multiple hierarchy enabled: these vocabularies are excluded from the 'From' list</li><li>Moving the term will lose all 'Relations' information for this term, since Relations can only be defined within a single vocabulary</li></ol></p>");
+      return '<h2>'.t('Moving terms between vocabularies').'</h2><p>'.t("This module allows you to move a term, together with all its sub-terms and associated nodes, from one vocabulary to another. The switch is carried out in two steps: first choose the source and target vocabularies, then choose the source and target terms. The selected source term will be moved such that it becomes a sub-term of the selected target term.").'</p><p>'.t("The module will also maintain the coherence of the vocabulary definition: <ol><li>If the target vocabulary does not allow the definition of a term hierarchy, then the target term cannot be selected and the source term is moved to the root level of the target vocabulary.</li><li>If the source vocabulary classifies content types which are not classified by the target vocabulary, then the latter is updated to classify the missing types</li></ol></p><p>You can access the switch module from a tab on the categories administration page; note that the module requires 'administer taxonomy' user permissions").'<h2>'.t('Easy node classification').'</h2><p>'.t("A 'classify' tab is provided on node pages: this allows you to reclassify a node without the overhead of up- and down-loading the actual node content").'</p><h2>'.t('Constraints').'</h2><p>'.t("There are certain <strong>important limitations</strong> to this module:<ol><li>The module is unable at present to switch terms from vocabularies with multiple hierarchy enabled: these vocabularies are excluded from the 'From' list</li><li>Moving the term will lose all 'Relations' information for this term, since Relations can only be defined within a single vocabulary</li></ol></p>");
   }
 }
 
@@ -40,13 +46,33 @@ function taxonomy_switch_help($section) 
  * 
  * @note See hook_menu for a description of parameters and return values.
  */
-function taxonomy_switch_menu($may_cache) {
+function taxonomy_switch_menu() {
   $items = array();
+/* TODO
+   Non menu code that was placed in hook_menu under the '!$may_cache' block
+   so that it could be run during initialization, should now be moved to hook_init.
+   Previously we called hook_init twice, once early in the bootstrap process, second
+   just after the bootstrap has finished. The first instance is now called boot
+   instead of init.
+   
+   In Drupal 6, there are now two hooks that can be used by modules to execute code
+   at the beginning of a page request. hook_boot() replaces hook_boot() in Drupal 5
+   and runs on each page request, even for cached pages. hook_boot() now only runs
+   for non-cached pages and thus can be used for code that was previously placed in
+   hook_menu() with $may_cache = FALSE:
+   
+   Dynamic menu items under a '!$may_cache' block can often be simplified
+   to remove references to arg(n) and use of '%<function-name>' to check
+   conditions. See http://drupal.org/node/103114.
+   
+   The title and description arguments should not have strings wrapped in t(),
+   because translation of these happen in a later stage in the menu system.
+*/
   if (!$may_cache) {
-    $items[] = array('path' => 'admin/content/taxonomy/switch',
-      'title' => t('Switch'),
-      'access' => user_access('administer taxonomy'),
-      'callback' => 'taxonomy_switch',
+    $items['admin/content/taxonomy/switch'] = array(
+      'title' => 'Switch',
+      'access arguments' => array('administer taxonomy'),
+      'page callback' => 'taxonomy_switch',
       'type' => MENU_LOCAL_TASK);
     if (arg(0) == 'node' && is_numeric(arg(1)) && user_access('administer taxonomy')) {
       $items[] = array('path' => 'node/'. arg(1) .'/classify', 'title' => t('classify'),
@@ -65,6 +91,12 @@ function taxonomy_switch_menu($may_cache
  */
 function taxonomy_switch() {
 $output = '';
+/* TODO The 'op' element in the form values is deprecated.
+   Each button can have #validate and #submit functions associated with it.
+   Thus, there should be one button that submits the form and which invokes
+   the normal form_id_validate and form_id_submit handlers. Any additional
+   buttons which need to invoke different validate or submit functionality
+   should have button-specific functions. */
   $op = $_POST['op']; // $form_values['op'];
 $edit = $_POST;
   if (empty($op)) {
@@ -96,11 +128,11 @@ global $user;
 //  arg(1) is the nid
   if ($op) {
     $node = module_invoke('node', 'load', arg(1));
-    taxonomy_node_save($node->nid, $edit['taxonomy']);
+    taxonomy_node_save($node, $edit['taxonomy']);
     if (module_exists('checkout')) {
       module_invoke('checkout', 'checkin', arg(1));
       }
-    watchdog('content', t('%type: reclassified %title.', array('%type' => $node->type, '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
+    watchdog('content', '%type: reclassified %title.', array('%type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
     drupal_set_message(t('The document has been reclassified'));
     print theme('page', $output);
     return;
@@ -137,7 +169,7 @@ function taxonomy_switch_classify_form($
 	  $node_vocabs = module_invoke('taxonomy', 'get_vocabularies', $node->type);
 	  foreach ($node_vocabs as $i => $vid) {
 	    $form['taxonomy'][$vid->vid] = module_invoke('taxonomy', 'form', $vid->vid);
-	    $node_terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vid->vid);
+	    $node_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid->vid);
 	    if ($vid->tags == 1) {
               $typed_string = array();
 	      foreach($node_terms as $ix => $n_tid) {
@@ -163,7 +195,7 @@ function taxonomy_switch_classify_form($
 	  '#type' => 'submit',
 	  '#value' => t("Classify"),
 	  );
-  $form['#redirect'] = FALSE;
+//  $form['#redirect'] = FALSE;
   return $form;
 }
 
@@ -171,8 +203,8 @@ function taxonomy_switch_classify_form($
  * Move term from one vocabulary to another and display result
  */
 function taxonomy_switch_execute($edit) {
-  $from_vid = module_invoke('taxonomy', 'get_vocabulary', $edit['taxonomy_switch_from_vid']);
-  $to_vid = module_invoke('taxonomy', 'get_vocabulary', $edit['taxonomy_switch_to_vid']);
+  $from_vid = module_invoke('taxonomy', 'vocabulary_load', $edit['taxonomy_switch_from_vid']);
+  $to_vid = module_invoke('taxonomy', 'vocabulary_load', $edit['taxonomy_switch_to_vid']);
   $from_term = module_invoke('taxonomy', 'get_term', $edit['taxonomy_switch_from_term']);
   $output = t('The term ').'<b>'.$from_term->name.'</b>'.t(' has been moved from the source vocabulary ').'<b>'.$from_vid->name.'</b>'.t(' to the target vocabulary ').'<b>'.$to_vid->name.'</b>'.'<br />';
   $output .= t('The term has been moved ');
@@ -226,7 +258,7 @@ $max_depth The number of levels of the t
 /**
  * taxonomy_switch_vocab_form
  */
-function taxonomy_switch_vocab_form($form_values = NULL) {
+function taxonomy_switch_vocab_form(&$form_state, $form_values = NULL) {
   if (!$form_values['vid']) {
     $form_values['vid'] = 0;
   }
@@ -260,7 +292,7 @@ $form['#method'] = 'POST';
 $form['#action'] = url('admin/content/taxonomy/switch');
 $form['#attributes'] = array('enctype' => 'multipart/form-data');
 
-  $form['#redirect'] = FALSE;
+//  $form['#redirect'] = FALSE;
 
 return $form;
 }
@@ -270,9 +302,9 @@ return $form;
  * Form to select source and target vocabularies
  */
 
-function taxonomy_switch_term_form($form_values = NULL) {
-  $vid_from = module_invoke('taxonomy', 'get_vocabulary', $form_values['vid_from']);
-  $vid_to = module_invoke('taxonomy', 'get_vocabulary', $form_values['vid_to']);
+function taxonomy_switch_term_form(&$form_state, $form_values = NULL) {
+  $vid_from = module_invoke('taxonomy', 'vocabulary_load', $form_values['vid_from']);
+  $vid_to = module_invoke('taxonomy', 'vocabulary_load', $form_values['vid_to']);
 // Control 1 - don't move terms with sub-terms into a vocabulary that does not support sub-terms
   $no_children = FALSE;
   if ($vid_to->hierarchy == 0 && $vid_from->hierarchy > 0) {
@@ -385,7 +417,7 @@ $form['#method'] = 'POST';
 $form['#action'] = url('admin/content/taxonomy/switch');
 $form['#attributes'] = array('enctype' => 'multipart/form-data');
 
-  $form['#redirect'] = FALSE;
+//  $form['#redirect'] = FALSE;
 
   return $form;
 }
