diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 278d161c324baf55ba0502da97c7b12ecdbf0826..cae261d32348faed3a9017c05a1713eb0cda2002 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,7 +1,12 @@ // $Id$ +Feeds 7.x 2.0 XXXXXXXXXXXXXXXXXXX +--------------------------------- + +- Clean up basic settings form. + Feeds 7.x 2.0 Alpha 1, 2010-09-29 --------------------------------- +--------------------------------- - #925842 alex_b: Support batching through directories on disk. - #625196 mstrelan, alex_b: Fix array_merge(), array_intersect_key() warnings. diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc index e06f9482ef1c0748ffbe17c9530fff7d7062e032..655c37550f3f62caa7540efcc0e6dc2fc42786f5 100644 --- a/feeds_ui/feeds_ui.admin.inc +++ b/feeds_ui/feeds_ui.admin.inc @@ -26,7 +26,7 @@ function feeds_ui_edit_help() { In Basic settings, you can <strong>attach an importer configuration to a content type</strong>. This is useful when many imports of a kind should be created, for example in an RSS aggregation scenario. If you don\'t attach a configuration to a content type, you can use it on the !import page. </li> <li> - Imports can be <strong>refreshed periodically</strong> - see the minimum refresh period in the Basic settings. + Imports can be <strong>scheduled periodically</strong> - see the periodic import select box in the Basic settings. </li> <li> Processors can have <strong>mappings</strong> in addition to settings. Mappings allow you to define what elements of a data feed should be mapped to what content fields on a granular level. For instance, you can specify that a feed item\'s author should be mapped to a node\'s body. @@ -319,7 +319,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { $items = array(); $items[] = t('Attached to: @type', array('@type' => $importer->config['content_type'] ? node_type_get_name($importer->config['content_type']) : t('[none]'))); if ($importer->config['import_period'] == FEEDS_SCHEDULE_NEVER) { - $import_period = t('never'); + $import_period = t('off'); } elseif ($importer->config['import_period'] == 0) { $import_period = t('as often as possible'); @@ -327,7 +327,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') { else { $import_period = t('every !interval', array('!interval' => format_interval($importer->config['import_period']))); } - $items[] = t('Refresh: !import_period', array('!import_period' => $import_period)); + $items[] = t('Periodic import: !import_period', array('!import_period' => $import_period)); $items[] = $importer->config['import_on_create'] ? t('Import on submission') : t('Do not import on submission'); $info['title'] = t('Basic settings'); diff --git a/feeds_ui/tests/feeds_ui.test b/feeds_ui/tests/feeds_ui.test index 8481b2789f11f556edbc73bf6fecae615f3515a4..d790cf2a7a28ce20740ff6d9ea32ff616e17ee4d 100644 --- a/feeds_ui/tests/feeds_ui.test +++ b/feeds_ui/tests/feeds_ui.test @@ -115,7 +115,7 @@ class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase { // Assert results of change. $this->assertText('Edit importer: Syndication'); $this->assertText('Attached to: Page'); - $this->assertText('Refresh: every 1 hour'); + $this->assertText('Periodic import: every 1 hour'); $this->drupalGet('admin/structure/feeds'); $this->assertLink('Page'); // See whether string 'Page' shows up in table. diff --git a/includes/FeedsConfigurable.inc b/includes/FeedsConfigurable.inc index fc241d1ce29ea4d8e5097fdcc422e779cfa23dab..6ef2c6d139a838dfaf484f5b6aee10325edbca2e 100644 --- a/includes/FeedsConfigurable.inc +++ b/includes/FeedsConfigurable.inc @@ -142,9 +142,12 @@ abstract class FeedsConfigurable { /** * Implements getConfig(). + * + * Return configuration array, ensure that all default values are present. */ public function getConfig() { - return $this->config; + $defaults = $this->configDefaults(); + return $this->config + $defaults; } /** diff --git a/includes/FeedsImporter.inc b/includes/FeedsImporter.inc index 9d4f8b6430720d9356c7393df9cbfe578a5bb740..692719bbc60c3fab50f483510742cc34959a5a17 100644 --- a/includes/FeedsImporter.inc +++ b/includes/FeedsImporter.inc @@ -208,7 +208,7 @@ class FeedsImporter extends FeedsConfigurable { foreach (array('fetcher', 'parser', 'processor') as $type) { $this->config[$type]['config'] = $this->$type->getConfig(); } - return $this->config;// Collect information from plugins. + return parent::getConfig(); } /** @@ -239,44 +239,51 @@ class FeedsImporter extends FeedsConfigurable { * Override parent::configForm(). */ public function configForm(&$form_state) { + $config = $this->getConfig(); $form = array(); $form['name'] = array( '#type' => 'textfield', '#title' => t('Name'), - '#description' => t('The name of this configuration.'), - '#default_value' => $this->config['name'], + '#description' => t('A human readable name of this importer.'), + '#default_value' => $config['name'], '#required' => TRUE, ); $form['description'] = array( '#type' => 'textfield', '#title' => t('Description'), - '#description' => t('A description of this configuration.'), - '#default_value' => $this->config['description'], + '#description' => t('A description of this importer.'), + '#default_value' => $config['description'], ); $node_types = node_type_get_names(); array_walk($node_types, 'check_plain'); $form['content_type'] = array( '#type' => 'select', '#title' => t('Attach to content type'), - '#description' => t('If an importer is attached to a content type, content is imported by creating a node. If the standalone form is selected, content is imported by using the standalone form under http://example.com/import.'), + '#description' => t('If "Use standalone form" is selected a source is imported by using a form under !import_form. + If a content type is selected a source is imported by creating a node of that content type.', + array('!import_form' => l(url('import', array('absolute' => TRUE)), 'import', array('attributes' => array('target' => '_new'))))), '#options' => array('' => t('Use standalone form')) + $node_types, - '#default_value' => $this->config['content_type'], + '#default_value' => $config['content_type'], ); + $cron_required = ' ' . l(t('Requires cron to be configured.'), 'http://drupal.org/cron', array('attributes' => array('target' => '_new'))); $period = drupal_map_assoc(array(0, 900, 1800, 3600, 10800, 21600, 43200, 86400, 259200, 604800, 2419200), 'format_interval'); - $period[FEEDS_SCHEDULE_NEVER] = t('Never'); + foreach ($period as &$p) { + $p = t('Every !p', array('!p' => $p)); + } + $period[FEEDS_SCHEDULE_NEVER] = t('off'); $period[0] = t('As often as possible'); $form['import_period'] = array( '#type' => 'select', - '#title' => t('Minimum refresh period'), + '#title' => t('Periodic import'), '#options' => $period, - '#description' => t('This is the minimum time that must elapse before a feed may be refreshed automatically.'), - '#default_value' => $this->config['import_period'], + '#description' => t('Choose how often a source should be imported periodically.') . $cron_required, + '#default_value' => $config['import_period'], ); $form['import_on_create'] = array( '#type' => 'checkbox', '#title' => t('Import on submission'), - '#description' => t('Check if content should be imported at the moment of feed submission.'), - '#default_value' => $this->config['import_on_create'], + '#description' => t('Check if import should be started at the moment of standalone form or node form submission.'), + '#default_value' => $config['import_on_create'], ); return $form; } diff --git a/tests/feeds_scheduler.test b/tests/feeds_scheduler.test index ad522881c9feb07b89d14e0c1dbe5d379f6df772..f7aa2e3d80b26d3746d503e59d4cb841391ad3ff 100644 --- a/tests/feeds_scheduler.test +++ b/tests/feeds_scheduler.test @@ -126,7 +126,7 @@ class FeedsSchedulerTestCase extends FeedsWebTestCase { 'import_period' => 0, ); $this->drupalPost('admin/structure/feeds/edit/syndication/settings', $edit, 'Save'); - $this->assertText('Refresh: as often as possible'); + $this->assertText('Periodic import: as often as possible'); $this->drupalLogout(); // Hit cron once, this should cause Feeds to reschedule all entries.