diff --git a/addressbook/inc/class.addressbook_wizard_export_vcard.inc.php b/addressbook/inc/class.addressbook_wizard_export_vcard.inc.php new file mode 100644 index 0000000000..646ea00697 --- /dev/null +++ b/addressbook/inc/class.addressbook_wizard_export_vcard.inc.php @@ -0,0 +1,80 @@ +steps = array( + 'wizard_step40' => '' + ); + $this->step_templates = array( + 'wizard_step40' => 'addressbook.importexport_wizard_vcard_charset' + ); + + } + + /** + * choose charset + * + * @param array $content + * @param array $sel_options + * @param array $readonlys + * @param array $preserv + * @return string template name + */ + function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv) + { + if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true)); + // return from step40 + if ($content['step'] == 'wizard_step40') { + switch (array_search('pressed', $content['button'])) + { + case 'next': + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); + case 'previous' : + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); + case 'finish': + return 'wizard_finish'; + default : + return $this->wizard_step40($content,$sel_options,$readonlys,$preserv); + } + } + // init step40 + else + { + $content['msg'] = $this->steps['wizard_step40']; + $content['step'] = 'wizard_step40'; + if(!$content['charset'] && $content['plugin_options']['charset']) { + $content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user'; + } + $sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+ + array( + 'user' => lang('User preference'), + ); + $preserv = $content; + + // Add in extra allowed charsets + $config = config::read('importexport'); + $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings()); + if($extra_charsets) + { + $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets)); + } + unset ($preserv['button']); + return $this->step_templates[$content['step']]; + } + } + +} diff --git a/importexport/inc/class.importexport_definitions_ui.inc.php b/importexport/inc/class.importexport_definitions_ui.inc.php index a9c4b7bd6a..326a403d91 100644 --- a/importexport/inc/class.importexport_definitions_ui.inc.php +++ b/importexport/inc/class.importexport_definitions_ui.inc.php @@ -544,7 +544,9 @@ class importexport_definitions_ui $next_step = $this->plugin->$content['step']($content); } else + { $next_step = $this->$content['step']($content); + } } else { die('Cannot find next step'); } @@ -730,9 +732,9 @@ class importexport_definitions_ui { case 'next': // There's no real reason the plugin has to come from any of these, as long as it has a $steps variable - if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv) { + if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) { $content['type'] = 'import'; - } elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv) { + } elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin),'export') !== false) { $content['type'] = 'export'; } else { throw new egw_exception('Invalid plugin'); diff --git a/importexport/inc/class.importexport_export_ui.inc.php b/importexport/inc/class.importexport_export_ui.inc.php index afc6bc40a1..927eb1c723 100644 --- a/importexport/inc/class.importexport_export_ui.inc.php +++ b/importexport/inc/class.importexport_export_ui.inc.php @@ -275,7 +275,17 @@ class importexport_export_ui { if (! $charset = $definition->plugin_options['charset']) { $charset = $GLOBALS['egw']->translation->charset(); } - if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset']; + if($charset == 'user') + { + switch($definition->plugin) + { + case 'addressbook_export_vcard': + $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset']; + break; + default: + $charset = $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset']; + } + } $plugin_object = new $definition->plugin; $result = $plugin_object->export( $file, $definition );