diff -ur taxonomy_multi_edit/taxonomy_multi_edit.info taxonomy_multi_edit-new/taxonomy_multi_edit.info --- taxonomy_multi_edit/taxonomy_multi_edit.info 2007-03-20 05:45:03.000000000 -0400 +++ taxonomy_multi_edit-new/taxonomy_multi_edit.info 2008-02-16 14:11:43.000000000 -0500 @@ -3,6 +3,7 @@ description = A mass category editor. package = "Content management" ; Information added by drupal.org packaging script on 2007-03-20 -version = "5.x-1.0" +version = "6.x-1.0" +core = "6.x" project = "taxonomy_multi_edit" diff -ur taxonomy_multi_edit/taxonomy_multi_edit.module taxonomy_multi_edit-new/taxonomy_multi_edit.module --- taxonomy_multi_edit/taxonomy_multi_edit.module 2007-03-20 05:35:51.000000000 -0400 +++ taxonomy_multi_edit-new/taxonomy_multi_edit.module 2008-02-16 14:27:35.000000000 -0500 @@ -1,7 +1,7 @@ array( - '#value' => $node->type), - '#node' => $node, - ); + // $form_taxonomy = taxonomy_node_form($node); + $fakeform = array('type' => array( + '#value' => $node->type), + '#node' => $node, + ); if (is_array($fakeform['#node']->taxonomy)) { foreach ($fakeform['#node']->taxonomy as $id => $term) { @@ -54,7 +54,7 @@ } } } - taxonomy_form_alter($node->type. '_node_form', $fakeform); + taxonomy_form_alter($fakeform, array(), $node->type .'_node_form'); unset($fakeform['type'], $fakeform['taxonomy']['#type']); // kill the fieldset and type field // kill description fields foreach ((array)$fakeform['taxonomy'] as $key => $arr) { @@ -64,10 +64,10 @@ } // dprint_r($fakeform); // $form['myform'][$node->nid] = $fakeform; - // TODO: manipulate $form_taxonomy elements so that many nodes can be manipulated on same page. - // $form['title'][$node->nid] = array('#value' => l($node->title, "node/$node->nid", array())); - // $form['nid'][$node->nid] = array('#value' => $node->nid); - $form['nodes'][$node->nid] = $fakeform; + // TODO: manipulate $form_taxonomy elements so that many nodes can be manipulated on same page. + // $form['title'][$node->nid] = array('#value' => l($node->title, "node/$node->nid", array())); + // $form['nid'][$node->nid] = array('#value' => $node->nid); + $form['nodes'][$node->nid] = $fakeform; unset($fakeform); } $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories')); @@ -81,7 +81,7 @@ */ function theme_taxonomy_multi_edit_overview(&$form) { - foreach (element_children($form['nodes']) as $nid) { + foreach (element_children($form['nodes']) as $nid) { $row = array(); $row[] = l(truncate_utf8($form['nodes'][$nid]['#node']->title, 20), "node/$nid"); foreach (element_children($form['nodes'][$nid]['taxonomy']) as $vid) { @@ -104,15 +104,15 @@ /** * Forms API form callback hook */ -function taxonomy_multi_edit_overview_submit($form_id, $form_values) { - drupal_set_message(print_r($form_values,1)); - foreach ($form_values['nodes'] as $nid => $terms) { - if (!$tax = $terms['taxonomy']) { - $tax = $terms['tags']; - } - taxonomy_node_save($nid, $tax); - } - drupal_set_message(t('categories updated.')); +function taxonomy_multi_edit_overview_submit($form, $form_state) { + // drupal_set_message(print_r($form_values, 1)); + foreach ($form_state['values']['nodes'] as $nid => $terms) { + if (!$tax = $terms['taxonomy']) { + $tax = $terms['tags']; + } + taxonomy_node_save($nid, $tax); + } + // drupal_set_message(t('categories updated.')); } /** @@ -124,24 +124,24 @@ /** * Hook Implimentation */ -function taxonomy_multi_edit_form_alter($form_id, &$form) { +function taxonomy_multi_edit_form_alter(&$form, $form_state, $form_id) { // Enhance the node overview page if ($form_id == 'node_admin_nodes') { - taxonomy_multi_edit_content_form_alter($form); + taxonomy_multi_edit_content_form_alter($form, array(), $form_id); } } /** * Add a bulk classification function to the content admin */ -function taxonomy_multi_edit_content_form_alter(&$form){ +function taxonomy_multi_edit_content_form_alter(&$form) { // support bulk classifications $form['options']['operation']['#options']['categorize'] = "Assign to a taxonomy term"; $form['options']['operation']['#attributes']['onchange'] = 'changedOperation(this)'; $form['options']['terms-wrapper'] = array( '#type' => 'fieldset', - '#attributes' => array('id'=>'edit-terms-wrapper', 'style'=>'display:none;'), + '#attributes' => array('id' => 'edit-terms-wrapper', 'style' => 'display:none;'), 'terms' => array( '#type' => 'select', '#title' => t("term"), @@ -153,9 +153,9 @@ '#description' => t("

Warning, using this form may override some of the normal vocabulary restrictions.

"), ), ); // used the extra fieldset because renderer was failing to honour doing the same via #prefix - $form['#submit']['taxonomy_multi_edit_content_form_submit']=array(); + $form['#submit']['taxonomy_multi_edit_content_form_submit'] = array(); - drupal_add_js(taxonomy_multi_edit_content_form_javascript(),'inline'); + drupal_add_js(taxonomy_multi_edit_content_form_javascript(), 'inline'); } @@ -163,21 +163,21 @@ * Capture additional operations on the content managemment page * @see node_admin_nodes_submit() */ -function taxonomy_multi_edit_content_form_submit($form,$edit){ +function taxonomy_multi_edit_content_form_submit($form, $edit) { if ($edit['operation'] == 'categorize') { $terms = $edit['terms']; foreach ($edit['nodes'] as $nid => $value) { - if($value){ + if ($value) { // I could have done this direct to database, // but we'll do it safer via the published methods instead. // Means we can safely merge instead of overwrite $existing = taxonomy_node_get_terms($nid); - foreach($terms as $t){ // cannot array_merge as it messes the indexes + foreach ($terms as $t) { // cannot array_merge as it messes the indexes $existing[$t] = $t; } - taxonomy_node_save($nid,$existing); - drupal_set_message(t('Updated terms on node '.l($node->title?$node->title:$nid, "node/$nid"))); + taxonomy_node_save($nid, $existing); + drupal_set_message(t('Updated terms on node '. l($node->title?$node->title:$nid, "node/$nid"))); } } cache_clear_all(); @@ -185,7 +185,7 @@ } } -function taxonomy_multi_edit_content_form_javascript(){ +function taxonomy_multi_edit_content_form_javascript() { // quoted javascript: return <<