forked from extern/egroupware
- Add ability for plugin to specify mimetype
- Fix basic export csv wizard header option (wasn't loaded properly)
This commit is contained in:
parent
cc2bee8dd0
commit
7f540ad450
@ -154,11 +154,18 @@ class importexport_export_ui {
|
||||
$content['plugin_selectors_html'] = $plugin_object->get_selectors_html();
|
||||
} else {
|
||||
$options = $plugin_object->get_selectors_etpl();
|
||||
$content['selection'] = (array)$options['content'];
|
||||
$sel_options += (array)$options['sel_options'];
|
||||
$readonlys['selection'] = (array)$options['readonlys'];
|
||||
$preserv['selection'] = (array)$options['preserv'];
|
||||
$content['plugin_selectors_template'] = $options['name'];
|
||||
if(is_array($options)) {
|
||||
$content['selection'] = (array)$options['content'];
|
||||
$sel_options += (array)$options['sel_options'];
|
||||
$readonlys['selection'] = (array)$options['readonlys'];
|
||||
$preserv['selection'] = (array)$options['preserv'];
|
||||
$content['plugin_selectors_template'] = $options['name'];
|
||||
} else {
|
||||
$content['plugin_selectors_template'] = $options;
|
||||
}
|
||||
}
|
||||
if(!$content['plugin_selectors_html'] && !$content['plugin_selectors_template']) {
|
||||
$readonlys[$tabs]['selection_tab'] = true;
|
||||
}
|
||||
} elseif (!$_selection) {
|
||||
$this->js->set_onload("
|
||||
@ -226,7 +233,7 @@ class importexport_export_ui {
|
||||
if($_content['export'] == 'pressed') {
|
||||
fclose($file);
|
||||
$response->addScript("xajax_eT_wrapper();");
|
||||
$response->addScript("opener.location.href='". $GLOBALS['egw']->link('/index.php','menuaction=importexport.importexport_export_ui.download&_filename='. $tmpfname.'&_appname='. $definition->application). "&_suffix=". $plugin_object->get_filesuffix(). "';");
|
||||
$response->addScript("opener.location.href='". $GLOBALS['egw']->link('/index.php','menuaction=importexport.importexport_export_ui.download&_filename='. $tmpfname.'&_appname='. $definition->application). "&_suffix=". $plugin_object->get_filesuffix(). "&_type=".$plugin_object->get_mimetype() ."';");
|
||||
$response->addScript('window.setTimeout("window.close();", 100);');
|
||||
return $response->getXML();
|
||||
}
|
||||
@ -413,9 +420,9 @@ class importexport_export_ui {
|
||||
if (!is_readable($tmpfname)) die();
|
||||
|
||||
$appname = $_GET['_appname'];
|
||||
$nicefname = 'egw_export_'.$appname.'-'.date('y-m-d');
|
||||
$nicefname = 'egw_export_'.$appname.'-'.date('Y-m-d');
|
||||
|
||||
header('Content-type: application/text');
|
||||
header('Content-type: ' . $_GET['_type'] ? $_GET['_type'] : 'application/text');
|
||||
header('Content-Disposition: attachment; filename="'.$nicefname.'.'.$_GET['_suffix'].'"');
|
||||
$file = fopen($tmpfname,'r');
|
||||
while(!feof($file))
|
||||
|
@ -315,6 +315,7 @@ class importexport_helper_functions {
|
||||
);
|
||||
$appnames = $_appname == 'all' ? array_keys($GLOBALS['egw_info']['apps']) : (array)$_appname;
|
||||
$types = $_type == 'all' ? array('import','export') : (array)$_type;
|
||||
$plugins = self::_get_plugins($appnames, $types);
|
||||
|
||||
foreach($plugins as $appname => $types) {
|
||||
if(!in_array($appname, $appnames)) unset($plugins['appname']);
|
||||
|
@ -65,6 +65,13 @@ interface importexport_iface_export_plugin {
|
||||
*/
|
||||
public static function get_filesuffix();
|
||||
|
||||
/**
|
||||
* returns mime type for exported file
|
||||
*
|
||||
* @return string mimetype
|
||||
*/
|
||||
public static function get_mimetype();
|
||||
|
||||
/**
|
||||
* return etemplate components for options.
|
||||
* @abstract We can't deal with etemplate objects here, as an uietemplate
|
||||
|
@ -153,7 +153,7 @@ class importexport_wizard_basic_export_csv
|
||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||
$content['charset'] = $content['plugin_options']['charset'];
|
||||
}
|
||||
if(!array_key_exists($content, 'begin_with_fieldnames') && array_key_exists($content['plugin_options'], 'begin_with_fieldnames')) {
|
||||
if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) {
|
||||
$content['begin_with_fieldnames'] = $content['plugin_options']['begin_with_fieldnames'];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user