? sites/default/files
? sites/default/settings.php
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.57
diff -u -p -r1.57 content_types.inc
--- modules/node/content_types.inc 16 Jul 2008 21:59:27 -0000 1.57
+++ modules/node/content_types.inc 30 Aug 2008 21:59:09 -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)) {
$type = new stdClass();
$type->type = $type->name = $type->module = $type->description = $type->help = '';
@@ -74,6 +75,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 30 Aug 2008 21:59:09 -0000
@@ -0,0 +1,22 @@
+Drupal.behaviors.contentTypes = 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(' (Type: ').append($(''+ machine +'').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();
+ }
+}
\ No newline at end of file