? .git ? itunes-481072-7.patch Index: itunes.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/itunes/itunes.admin.inc,v retrieving revision 1.6 diff -u -p -r1.6 itunes.admin.inc --- itunes.admin.inc 31 Jul 2009 22:45:06 -0000 1.6 +++ itunes.admin.inc 31 Jul 2009 23:45:05 -0000 @@ -11,6 +11,8 @@ */ function itunes_admin_settings() { $node_types = node_get_types(); + $content_module_exists = module_exists('content'); + $content_types = $content_module_exists ? content_types() : array(); // Build a list of node types that iTunes could operate on. $options = array(); @@ -24,22 +26,22 @@ function itunes_admin_settings() { '#default_value' => variable_get('itunes_types', array('audio')), ); - // If FileField is enabled then let them select the enclosure field. - if (module_exists('content') && module_exists('filefield')) { - $fields = variable_get('itunes_filefields', array()); - $form['itunes_filefields'] = array( + // If FileField is enabled allow selection of the enclosure's source. + if ($content_module_exists && module_exists('filefield')) { + $fields = variable_get('itunes_enclosure_source', array()); + $form['itunes_enclosure_source'] = array( '#tree' => TRUE, ); // Build the node's filefield selector. foreach ($node_types as $type) { - $content = content_types($type->type); + $content = $content_types[$type->type]; $options = array(NULL => t('- None -')); foreach ($content['fields'] as $field_name => $field) { if ($field['type'] == 'filefield') { $options[$field_name] = $field['widget']['label']; } } - $form['itunes_filefields'][$type->type] = array( + $form['itunes_enclosure_source'][$type->type] = array( '#type' => 'select', '#options' => $options, '#default_value' => empty($fields[$type->type]) ? NULL : $fields[$type->type], @@ -48,19 +50,19 @@ function itunes_admin_settings() { } } + // If taxonomy is enabled allow selection of the tags' source. if (module_exists('taxonomy')) { - $vocabs = variable_get('itunes_vocabularies', array()); - $form['itunes_vocabularies'] = array( + $vocabs = variable_get('itunes_keyword_source', array()); + $form['itunes_keyword_source'] = array( '#tree' => TRUE, ); - // Build the node's filefield selector. foreach ($node_types as $type) { $type_vocabs = taxonomy_get_vocabularies($type->type); $options = array(NULL => t('- None -')); foreach ($type_vocabs as $vid => $vocab) { $options[$vid] = $vocab->name; } - $form['itunes_vocabularies'][$type->type] = array( + $form['itunes_keyword_source'][$type->type] = array( '#type' => 'select', '#options' => $options, '#default_value' => empty($vocabs[$type->type]) ? NULL : $vocabs[$type->type], @@ -69,6 +71,34 @@ function itunes_admin_settings() { } } + // Allow selection of the author's source. + $author_source = variable_get('itunes_author_source', array()); + $form['itunes_author_source'] = array( + '#tree' => TRUE, + ); + foreach ($node_types as $type) { + $options = array( + NULL => t('- None -'), + 'node_author' => t('Node author'), + ); + if ($content_module_exists) { + $content = $content_types[$type->type]; + foreach ($content['fields'] as $field_name => $field) { + if ($field['type'] == 'text' && $field['widget']['type'] == 'text_textfield') { + $options[$field_name] = $field['widget']['label']; + } + elseif ($field['type'] == 'userreference') { + $options[$field_name] = $field['widget']['label']; + } + } + } + $form['itunes_author_source'][$type->type] = array( + '#type' => 'select', + '#options' => $options, + '#default_value' => empty($author_source[$type->type]) ? NULL : $author_source[$type->type], + ); + } + $form = system_settings_form($form); $form['#validate'][] = 'itunes_admin_settings_validate'; $form['#theme'] = 'itunes_admin_settings'; @@ -89,14 +119,15 @@ function theme_itunes_admin_settings($fo $has_vocabularies = FALSE; foreach (element_children($form['itunes_types']) as $key) { $row = array(drupal_render($form['itunes_types'][$key])); - if (isset($form['itunes_filefields'][$key])) { - $row[] = drupal_render($form['itunes_filefields'][$key]); + if (isset($form['itunes_enclosure_source'][$key])) { + $row[] = drupal_render($form['itunes_enclosure_source'][$key]); $has_filefields = TRUE; } - if (isset($form['itunes_vocabularies'][$key])) { - $row[] = drupal_render($form['itunes_vocabularies'][$key]); + if (isset($form['itunes_keyword_source'][$key])) { + $row[] = drupal_render($form['itunes_keyword_source'][$key]); $has_vocabularies = TRUE; } + $row[] = drupal_render($form['itunes_author_source'][$key]); $rows[] = $row; } @@ -105,8 +136,9 @@ function theme_itunes_admin_settings($fo $header[] = t('FileField to list in RSS feeds'); } if ($has_vocabularies) { - $header[] = t('Vocabulary for use as keywords'); + $header[] = t('Vocabulary to use as keywords'); } + $header[] = t('Source to use as author'); return theme('table', $header, $rows) . drupal_render($form); } \ No newline at end of file Index: itunes.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/itunes/itunes.install,v retrieving revision 1.5 diff -u -p -r1.5 itunes.install --- itunes.install 31 Jul 2009 22:45:06 -0000 1.5 +++ itunes.install 31 Jul 2009 23:45:05 -0000 @@ -26,8 +26,9 @@ function itunes_install() { function itunes_uninstall() { drupal_uninstall_schema('itunes'); variable_del('itunes_types'); - variable_del('itunes_filefields'); - variable_del('itunes_vocabularies'); + variable_del('itunes_enclosure_source'); + variable_del('itunes_keyword_source'); + variable_del('itunes_author_source'); } /** @@ -78,3 +79,21 @@ function itunes_schema() { return $schema; } +/** + * Rename the source variables. + */ +function itunes_update_6100() { + $ret = array(); + + if ($value = variable_get('itunes_filefields', array())) { + variable_set('itunes_enclosure_source', $value); + variable_del('itunes_filefields'); + } + + if ($value = variable_get('itunes_vocabularies', array())) { + variable_set('itunes_keyword_source', $value); + variable_del('itunes_vocabularies'); + } + + return $ret; +} Index: itunes.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/itunes/itunes.module,v retrieving revision 1.9 diff -u -p -r1.9 itunes.module --- itunes.module 31 Jul 2009 22:45:06 -0000 1.9 +++ itunes.module 31 Jul 2009 23:45:06 -0000 @@ -52,7 +52,8 @@ function itunes_views_api() { function itunes_help($section, $arg) { switch ($section) { case 'admin/settings/itunes': - return t("This form allows you to determine which content types need to be have the iTunes feed item data fields added to them. If the FileField module is installed then you can choose which field to include as an enclosure in RSS feeds.", array('!filefield-url' => url('http://drupal.org/project/filefield'))); + return '
'. t("This form allows you to determine which content types need to be have the iTunes feed item data fields added to them.") .'
'
+ . t("If the FileField module is installed then you can choose which field to include as an enclosure in RSS feeds.", array('!filefield-url' => url('http://drupal.org/project/filefield'))) .'