diff -urp sites/all/modules/nodetype/nodetype.info sites/all/modules/nodetype_6/nodetype.info --- sites/all/modules/nodetype/nodetype.info 2007-12-01 04:17:58.035724566 +0100 +++ sites/all/modules/nodetype_6/nodetype.info 2007-12-01 03:08:30.365539957 +0100 @@ -1,7 +1,5 @@ -; $Id: nodetype.info,v 1.1 2007/02/03 14:27:05 timcn Exp $ +; $Id name = Nodetype description = Allows you to change the content type of posts while editing them. -; Information added by drupal.org packaging script on 2007-02-04 -version = "5.x-1.x-dev" +core=6.x project = "nodetype" - diff -urp sites/all/modules/nodetype/nodetype.module sites/all/modules/nodetype_6/nodetype.module --- sites/all/modules/nodetype/nodetype.module 2007-12-01 04:17:58.260645823 +0100 +++ sites/all/modules/nodetype_6/nodetype.module 2007-12-01 04:02:26.225806967 +0100 @@ -15,11 +15,9 @@ function nodetype_perm() { */ function nodetype_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { switch ($op) { - case 'submit': - if (isset($node->nodetype) && $node->nodetype) { - $types = node_get_types(); - drupal_set_message(t('The type of the post %title has been changed from %old to %new.', array('%title' => $node->title, '%old' => $types[$node->type]->name, '%new' => $types[$node->nodetype]->name))); - $node->type = $node->nodetype; + case 'update': + if ($node->type != $node->oldtype) { + drupal_set_message(t('Content type of this post has been changed from %old to %new.', array('%old' => $node->oldtype, '%new' => $node->type))); } break; } @@ -28,7 +26,7 @@ function nodetype_nodeapi(&$node, $op, $ /** * Implementation of hook_form_alter(). */ -function nodetype_form_alter($form_id, &$form) { +function nodetype_form_alter(&$form, $form_state, $form_id) { if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id && isset($form['#node']->nid) && user_access('change node types')) { $types = node_get_types(); @@ -43,12 +41,22 @@ function nodetype_form_alter($form_id, & } $form['nodetype'] = array( + '#type' => 'fieldset', + '#title' => t('Content type'), + '#weight' => 10, + '#collapsible' => 1, + '#collapsed' => 1, + ); + $form['nodetype']['oldtype'] = array( + '#type' => 'value', + '#value' => $current_type->name, + ); + $form['nodetype']['type'] = array( '#type' => 'select', '#title' => t('Content type'), '#description' => t('Select a new content type that this post will be changed to. Only do that if you know what you are doing.'), '#options' => array(0 => '<'. t('leave as is: @type', array('@type' => $current_type->name)) .'>') + $types, '#default_value' => 0, - '#weight' => 10, ); } }