Skip to content
Snippets Groups Projects
Commit 141a8d44 authored by Alex Barth's avatar Alex Barth
Browse files

#930018: Don't show file upload when 'Supply path directly' is selected.

parent fd0b053d
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
Feeds 7.x 2.0 XXXXXXXXXXXXXXXXXXX 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 - #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 be processed in the background rather than using Batch API. Useful for very
large imports. large imports.
......
...@@ -101,20 +101,28 @@ class FeedsFileFetcher extends FeedsFetcher { ...@@ -101,20 +101,28 @@ class FeedsFileFetcher extends FeedsFetcher {
'#type' => 'value', '#type' => 'value',
'#value' => empty($source_config['fid']) ? 0 : $source_config['fid'], '#value' => empty($source_config['fid']) ? 0 : $source_config['fid'],
); );
$form['source'] = array( if (empty($this->config['direct'])) {
'#type' => empty($this->config['direct']) ? 'value' : 'textfield', $form['source'] = array(
'#title' => t('File'), '#type' => 'value',
'#description' => t('Specify a path to a file or a directory starting with @scheme://. Alternatively upload a file below.', array('@scheme' => file_default_scheme())), '#value' => empty($source_config['source']) ? '' : $source_config['source'],
'#default_value' => empty($source_config['source']) ? '' : $source_config['source'], );
); $form['upload'] = array(
$form['upload'] = array( '#type' => 'file',
'#type' => 'file', '#title' => empty($this->config['direct']) ? t('File') : NULL,
'#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.'),
'#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',
'#theme' => 'feeds_upload', '#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']),
'#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']), '#size' => 10,
'#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; return $form;
} }
...@@ -199,8 +207,10 @@ class FeedsFileFetcher extends FeedsFetcher { ...@@ -199,8 +207,10 @@ class FeedsFileFetcher extends FeedsFetcher {
); );
$form['direct'] = array( $form['direct'] = array(
'#type' =>'checkbox', '#type' =>'checkbox',
'#title' => t('Supply path to file directly'), '#title' => t('Supply path to file or directory 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.'), '#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'], '#default_value' => $this->config['direct'],
); );
return $form; return $form;
......
...@@ -95,7 +95,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { ...@@ -95,7 +95,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$this->drupalGet('node'); $this->drupalGet('node');
$this->assertRaw('<span class="username">Anonymous (not verified)</span>'); $this->assertRaw('<span class="username">Anonymous (not verified)</span>');
$this->assertDevseedFeedContent(); $this->assertDevseedFeedContent();
// Assert DB status. // Assert DB status.
$count = db_query("SELECT COUNT(*) FROM {node} n INNER JOIN {feeds_node_item} fn ON n.nid = fn.nid")->fetchField(); $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.'); $this->assertEqual($count, 10, 'Accurate number of items in database.');
...@@ -315,7 +315,6 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { ...@@ -315,7 +315,6 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$edit = array( $edit = array(
'allowed_extensions' => 'rss2', 'allowed_extensions' => 'rss2',
'direct' => 1,
); );
$this->drupalPost('admin/structure/feeds/edit/syndication_standalone/settings/FeedsFileFetcher', $edit, 'Save'); $this->drupalPost('admin/structure/feeds/edit/syndication_standalone/settings/FeedsFileFetcher', $edit, 'Save');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment