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 @@
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.
......
......@@ -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;
......
......@@ -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');
......
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