Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.58 diff -u -p -r1.58 content_types.inc --- modules/node/content_types.inc 8 Oct 2008 03:27:56 -0000 1.58 +++ modules/node/content_types.inc 1 Nov 2008 02:46:13 -0000 @@ -49,6 +49,7 @@ function node_overview_types() { * Generates the node type editing form. */ function node_type_form(&$form_state, $type = NULL) { + drupal_add_js(drupal_get_path('module', 'node') .'/content_types.js'); if (!isset($type->type)) { // This is a new type. Node module managed types are custom and unlocked. $type = node_type_set_defaults(array('custom' => 1, 'locked' => 0)); @@ -67,6 +68,7 @@ function node_type_form(&$form_state, $t '#default_value' => $type->name, '#description' => t('The human-readable name of this content type. This text will be displayed as part of the list on the create content page. It is recommended that this name begin with a capital letter and contain only letters, numbers, and spaces. This name must be unique.'), '#required' => TRUE, + '#field_suffix' => '  ', ); if (!$type->locked) { Index: modules/node/content_types.js =================================================================== RCS file: modules/node/content_types.js diff -N modules/node/content_types.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/node/content_types.js 1 Nov 2008 02:46:13 -0000 @@ -0,0 +1,24 @@ +Drupal.behaviors.contentTypes = { + attach: function() { + if ($('#edit-type').val() == $('#edit-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('#edit-type').val() == '') { + $('#edit-type-wrapper').hide(); + $('#edit-name').keyup(function() { + var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_'); + if (machine != '_' && machine != '') { + $('#edit-type').val(machine); + $('#node-type-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($(''+ Drupal.t('Edit') +'').click(function() { + $('#edit-type-wrapper').show(); + $('#node-type-name-suffix').hide(); + $('#edit-name').unbind('keyup'); + return false; + })).append(']'); + } + else { + $('#edit-type').val(machine); + $('#node-type-name-suffix').text(''); + } + }); + $('#edit-name').keyup(); + } + } +};