Keep previous CSV-only preview around too

This commit is contained in:
Nathan Gray 2012-10-12 19:54:39 +00:00
parent 2b96aff758
commit f34afea1c7

View File

@ -252,9 +252,13 @@
* *
*/ */
protected function preview(importexport_iface_import_plugin &$plugin, &$stream, importexport_definition &$definition_obj) protected function preview(importexport_iface_import_plugin &$plugin, &$stream, importexport_definition &$definition_obj)
{
if(method_exists($plugin, 'preview'))
{ {
$preview = $plugin->preview($stream, $definition_obj); $preview = $plugin->preview($stream, $definition_obj);
/* }
elseif($definition_obj->plugin_options['csv_fields'])
{
$import_csv = new importexport_import_csv( $stream, array( $import_csv = new importexport_import_csv( $stream, array(
'fieldsep' => $definition_obj->plugin_options['fieldsep'], 'fieldsep' => $definition_obj->plugin_options['fieldsep'],
'charset' => $definition_obj->plugin_options['charset'], 'charset' => $definition_obj->plugin_options['charset'],
@ -271,7 +275,8 @@
if($import_csv->get_current_position() <= $definition_obj->plugin_options['num_header_lines']) $row--; if($import_csv->get_current_position() <= $definition_obj->plugin_options['num_header_lines']) $row--;
} }
$preview = html::table($rows); $preview = html::table($rows);
*/ rewind($stream);
}
return '<h2>' . lang('Preview') . ' - ' . $plugin->get_name() . '</h2>' . $preview; return '<h2>' . lang('Preview') . ' - ' . $plugin->get_name() . '</h2>' . $preview;
} }