Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.66 diff -u -p -r1.66 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 23 Aug 2009 01:05:12 -0000 1.66 +++ modules/taxonomy/taxonomy.admin.inc 24 Aug 2009 04:25:46 -0000 @@ -103,7 +103,6 @@ function theme_taxonomy_overview_vocabul * @see taxonomy_form_vocabulary_submit() */ function taxonomy_form_vocabulary(&$form_state, $edit = array()) { - drupal_add_js(drupal_get_path('module', 'taxonomy') . '/vocabulary.js'); if (!is_array($edit)) { $edit = (array)$edit; } @@ -130,7 +129,20 @@ function taxonomy_form_vocabulary(&$form '#default_value' => $edit['name'], '#maxlength' => 255, '#required' => TRUE, - '#field_suffix' => '  ', + '#field_suffix' => '  ', + ); + $js_settings = array( + 'type' => 'setting', + 'data' => array( + 'machineReadableValue' => array( + 'name' => array( + 'text' => t('Machine name'), + 'target' => 'machine-name', + 'searchPattern' => '[^a-z0-9]+', + 'replaceToken' => '_', + ), + ), + ), ); $form['machine_name'] = array( '#type' => 'textfield', @@ -139,6 +151,7 @@ function taxonomy_form_vocabulary(&$form '#maxlength' => 255, '#description' => t('The unique machine readable name for this vocabulary, used for theme templates, can only contain lowercase letters, numbers and underscores.'), '#required' => TRUE, + '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), ); $form['help'] = array( '#type' => 'textfield', Index: modules/taxonomy/vocabulary.js =================================================================== RCS file: modules/taxonomy/vocabulary.js diff -N modules/taxonomy/vocabulary.js --- modules/taxonomy/vocabulary.js 24 Aug 2009 03:11:34 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,29 +0,0 @@ -// $Id: vocabulary.js,v 1.2 2009/08/24 03:11:34 webchick Exp $ -(function ($) { - -Drupal.behaviors.contentTypes = { - attach: function () { - if ($('#edit-machine-name').val() == $('#edit-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('#edit-machine-name').val() == '') { - $('.form-item-machine-name').hide(); - $('#edit-name').keyup(function () { - var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_'); - if (machine != '_' && machine != '') { - $('#edit-machine-name').val(machine); - $('#vocabulary-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($('' + Drupal.t('Edit') + '').click(function () { - $('.form-item-machine-name').show(); - $('#vocabulary-name-suffix').hide(); - $('#edit-name').unbind('keyup'); - return false; - })).append(']'); - } - else { - $('#edit-machine-name').val(machine); - $('#vocabulary-name-suffix').text(''); - } - }); - $('#edit-name').keyup(); - } - } -}; - -})(jQuery);