diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8b77a863317fcf9b88c894df403ecd1e2d843615..38e5f13acfa6211fdc39466e5d4af7144552c7d1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,8 @@ Feeds 7.x 2.0 XXXXXXXXXXXXXXXXXXX --------------------------------- +- #930018 alex_b: Don't show file upload when 'Supply path directly' is + selected. - #927892 alex_b: Add "Process in background" feature. Allows one-off imports to be processed in the background rather than using Batch API. Useful for very large imports. diff --git a/plugins/FeedsFileFetcher.inc b/plugins/FeedsFileFetcher.inc index a893345dd1cfca25fa0033a9c95a1634f82bb9ff..9a7ab19ac33c38547d44268940f262cfa1fc8ac5 100644 --- a/plugins/FeedsFileFetcher.inc +++ b/plugins/FeedsFileFetcher.inc @@ -101,20 +101,28 @@ class FeedsFileFetcher extends FeedsFetcher { '#type' => 'value', '#value' => empty($source_config['fid']) ? 0 : $source_config['fid'], ); - $form['source'] = array( - '#type' => empty($this->config['direct']) ? 'value' : 'textfield', - '#title' => t('File'), - '#description' => t('Specify a path to a file or a directory starting with @scheme://. Alternatively upload a file below.', array('@scheme' => file_default_scheme())), - '#default_value' => empty($source_config['source']) ? '' : $source_config['source'], - ); - $form['upload'] = array( - '#type' => 'file', - '#title' => empty($this->config['direct']) ? t('File') : NULL, - '#description' => empty($source_config['source']) ? t('Select the file to be imported from your local system.') : t('Select a different file to be imported from your local system.'), - '#theme' => 'feeds_upload', - '#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']), - '#size' => 10, - ); + if (empty($this->config['direct'])) { + $form['source'] = array( + '#type' => 'value', + '#value' => empty($source_config['source']) ? '' : $source_config['source'], + ); + $form['upload'] = array( + '#type' => 'file', + '#title' => empty($this->config['direct']) ? t('File') : NULL, + '#description' => empty($source_config['source']) ? t('Select a file from your local system.') : t('Select a different file from your local system.'), + '#theme' => 'feeds_upload', + '#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']), + '#size' => 10, + ); + } + else { + $form['source'] = array( + '#type' => 'textfield', + '#title' => t('File'), + '#description' => t('Specify a path to a file or a directory. Path must start with @scheme://', array('@scheme' => file_default_scheme())), + '#default_value' => empty($source_config['source']) ? '' : $source_config['source'], + ); + } return $form; } @@ -199,8 +207,10 @@ class FeedsFileFetcher extends FeedsFetcher { ); $form['direct'] = array( '#type' =>'checkbox', - '#title' => t('Supply path to file directly'), - '#description' => t('For experts. Lets users specify a path to a file or a directory of files directly. This is useful when the files that need to be imported are already on the server.'), + '#title' => t('Supply path to file or directory directly'), + '#description' => t('For experts. Lets users specify a path to a file <em>or a directory of files</em> directly, + instead of a file upload through the browser. This is useful when the files that need to be imported + are already on the server.'), '#default_value' => $this->config['direct'], ); return $form; diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test index 68c3a86234d6d29e0210a58eedd4e74e9066c28c..e806cbabbd3631256f656a7df8efed3b368a0d91 100644 --- a/tests/feeds_processor_node.test +++ b/tests/feeds_processor_node.test @@ -95,7 +95,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $this->drupalGet('node'); $this->assertRaw('<span class="username">Anonymous (not verified)</span>'); $this->assertDevseedFeedContent(); - + // Assert DB status. $count = db_query("SELECT COUNT(*) FROM {node} n INNER JOIN {feeds_node_item} fn ON n.nid = fn.nid")->fetchField(); $this->assertEqual($count, 10, 'Accurate number of items in database.'); @@ -315,7 +315,6 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { $edit = array( 'allowed_extensions' => 'rss2', - 'direct' => 1, ); $this->drupalPost('admin/structure/feeds/edit/syndication_standalone/settings/FeedsFileFetcher', $edit, 'Save');