? getid3
? getid3-1.7.8b1
? getid3-1.7.8b1.zip
Index: audio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.module,v
retrieving revision 1.105.2.1
diff -u -p -r1.105.2.1 audio.module
--- audio.module	17 Apr 2007 16:54:37 -0000	1.105.2.1
+++ audio.module	12 Jun 2007 17:46:43 -0000
@@ -677,48 +677,56 @@ function audio_form(&$node) {
     $node->title_format = variable_get('audio_default_title_format', '!title by !artist');
   }
 
-  $form['#attributes'] = array('enctype' => 'multipart/form-data');
+  $type = node_get_types('type', $node);
 
-  // sometimes folks want to hide the ugly title and unneeded body fields. for now, not worth the clutter on the settings page.
-  if (variable_get('audio_show_form_title', TRUE)) {
+  if ($type->has_title) {
     $form['title_format'] = array(
-      '#type' => 'textfield', '#title' => t('Title'),
+      '#type' => 'textfield',
+      '#title' => check_plain($type->title_label),
       '#default_value' => $node->title_format,
       '#description' => t("The title can use the file's metadata. Depending on what's filled out, you maybe able to use any of the following variables: " ) .'!filename !'. implode(' !', audio_get_tags_allowed()),
       '#required' => TRUE,
       '#weight' => -5,
     );
+  }
 
+  if ($type->has_body) {
     $form['body_filter']['#weight'] = -4;
     $form['body_filter']['body'] = array(
-      '#type' => 'textarea', '#title' => t('Body'),
+      '#type' => 'textarea',
+      '#title' => check_plain($type->body_label),
       '#default_value' => $node->body,
       '#rows' => 5,
-      '#required' => FALSE,
+      '#required' => ($type->min_word_count > 0),
       );
     $form['body_filter']['format'] = filter_form($node->format);
   }
 
+  $form['#attributes'] = array('enctype' => 'multipart/form-data');
   $form['audio_fileinfo'] = array(
-    '#type' => 'fieldset', '#title' => t('Audio File Info'),
+    '#type' => 'fieldset',
+    '#title' => t('Audio File Info'),
     '#collapsible'=> TRUE,
     '#weight' => -1,
     '#tree' => TRUE,
   );
   $form['audio_fileinfo']['filepath'] = array(
-    '#type' => 'item', '#title' => t('Current File'),
+    '#type' => 'item',
+    '#title' => t('Current File'),
     '#value' => t('No file is attached.'),
     '#weight' => -1,
   );
   $form['audio_fileinfo']['audio_upload'] = array(
     '#tree' => FALSE, // this is so we can nest the control and still leave the upload where check_upload expects it
-    '#type' => 'file', '#title' => t('Add a new audio file'),
+    '#type' => 'file',
+    '#title' => t('Add a new audio file'),
     '#description' => t('Click "Browse..." to select an audio file to upload. Only files with the following extensions are allowed: %allowed-extensions.', array('%allowed-extensions' => variable_get('audio_allowed_extensions', 'mp3 wav ogg'))) .'<br />'
       . t('<strong>NOTE:</strong> the current PHP configuration limits uploads to %maxsize.', array('%maxsize' => format_size(file_upload_max_size()))),
     '#weight' => 19,
   );
   $form['audio_fileinfo']['downloadable'] = array(
-    '#type' => 'checkbox', '#title' => t('Allow file downloads.'),
+    '#type' => 'checkbox',
+    '#title' => t('Allow file downloads.'),
     '#default_value' => isset($node->audio_fileinfo['downloadable']) ? $node->audio_fileinfo['downloadable'] : variable_get('audio_default_downloadable', 1),
     '#description' => t('If checked, a link will be displayed allowing visitors to download this audio file on to their own computer.') .'<br />'
       . t('<strong>WARNING:</strong> even if you leave this unchecked, clever users will be able to find a way to download the file. This just makes them work a little harder to find the link.'),
@@ -730,7 +738,8 @@ function audio_form(&$node) {
   // the file's info
   if (isset($node->audio_file)) {
     $form['audio_tags'] = array(
-      '#type' => 'fieldset', '#title' => t('Audio Metadata'),
+      '#type' => 'fieldset',
+      '#title' => t('Audio Metadata'),
       '#collapsible'=> TRUE,
       '#tree' => TRUE,
       '#weight' => -3,
@@ -744,42 +753,51 @@ function audio_form(&$node) {
     $form['audio_fileinfo']['filepath']['#value'] = $node->audio_file->filepath;
     $form['audio_fileinfo']['audio_upload']['#title'] = t('Replace this with a new file');
     $form['audio_fileinfo']['fileformat'] = array(
-      '#type' => 'textfield', '#title' => t('Format'),
+      '#type' => 'textfield',
+      '#title' => t('Format'),
       '#default_value' => $node->audio_fileinfo['fileformat'],
     );
     $form['audio_fileinfo']['filesize'] = array(
-      '#type' => 'textfield', '#title' => t('Size (in bytes)'),
+      '#type' => 'textfield',
+      '#title' => t('Size (in bytes)'),
       '#default_value' => $node->audio_fileinfo['filesize'],
     );
     $form['audio_fileinfo']['playtime'] = array(
-      '#type' => 'textfield', '#title' => t('Length'),
+      '#type' => 'textfield',
+      '#title' => t('Length'),
       '#default_value' => $node->audio_fileinfo['playtime'],
     );
     $form['audio_fileinfo']['sample_rate'] = array(
-      '#type' => 'textfield', '#title' => t('Sample rate'),
+      '#type' => 'textfield',
+      '#title' => t('Sample rate'),
       '#default_value' => $node->audio_fileinfo['sample_rate'],
     );
     $form['audio_fileinfo']['channel_mode'] = array(
-      '#type' => 'textfield', '#title' => t('Channel mode'),
+      '#type' => 'textfield',
+      '#title' => t('Channel mode'),
       '#default_value' => $node->audio_fileinfo['channel_mode'],
     );
     $form['audio_fileinfo']['bitrate'] = array(
-      '#type' => 'textfield', '#title' => t('Bitrate'),
+      '#type' => 'textfield',
+      '#title' => t('Bitrate'),
       '#default_value' => $node->audio_fileinfo['bitrate'],
     );
     $form['audio_fileinfo']['bitrate_mode'] = array(
-      '#type' => 'textfield', '#title' => t('Bitrate mode'),
+      '#type' => 'textfield',
+      '#title' => t('Bitrate mode'),
       '#default_value' => $node->audio_fileinfo['bitrate_mode'],
     );
 
     // Users shouldn't be able to change the play and download counts so we'll
     // put these for viewing...
     $form['audio_fileinfo']['display_play_count'] = array(
-      '#type' => 'item', '#title' => t('Play count'),
+      '#type' => 'item',
+      '#title' => t('Play count'),
       '#value' => $node->audio_fileinfo['play_count'],
     );
     $form['audio_fileinfo']['display_download_count'] = array(
-      '#type' => 'item', '#title' => t('Download count'),
+      '#type' => 'item',
+      '#title' => t('Download count'),
       '#value' => $node->audio_fileinfo['download_count'],
     );
     // ...and these are what we'll save back to the node
