diff --git a/addressbook/inc/class.addressbook_import_vcard.inc.php b/addressbook/inc/class.addressbook_import_vcard.inc.php index 38fb8af6bb..69768c9bfb 100644 --- a/addressbook/inc/class.addressbook_import_vcard.inc.php +++ b/addressbook/inc/class.addressbook_import_vcard.inc.php @@ -109,6 +109,8 @@ class addressbook_import_vcard implements importexport_iface_import_plugin { // fetch the addressbook bo $this->bocontacts = new addressbook_vcal(); + $charset = $_definition->plugin_options['charset']; + // Start counting successes $this->current = 0; $count = 0; diff --git a/addressbook/inc/class.addressbook_wizard_import_vcard.inc.php b/addressbook/inc/class.addressbook_wizard_import_vcard.inc.php index 5c9ca22b87..8f1791f376 100644 --- a/addressbook/inc/class.addressbook_wizard_import_vcard.inc.php +++ b/addressbook/inc/class.addressbook_wizard_import_vcard.inc.php @@ -20,11 +20,57 @@ class addressbook_wizard_import_vcard extends addressbook_import_vcard { $this->steps = array( + 'wizard_step40' => lang('Choose charset'), 'wizard_step60' => lang('Choose owner of imported data'), ); } + 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_step60($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']; + } + $sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+ + array( + 'user' => lang('User preference'), + ); + + // 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)); + } + + $preserv = $content; + unset ($preserv['button']); + return 'addressbook.importexport_wizard_vcard_charset'; + } + } + function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) { if($this->debug) error_log(__METHOD__.print_r($content,true)); diff --git a/addressbook/setup/etemplates.inc.php b/addressbook/setup/etemplates.inc.php index bdd446506b..522de11824 100755 --- a/addressbook/setup/etemplates.inc.php +++ b/addressbook/setup/etemplates.inc.php @@ -2,7 +2,7 @@ /** * EGroupware - eTemplates for Application addressbook * http://www.egroupware.org - * generated by soetemplate::dump4setup() 2012-09-25 11:00 + * generated by soetemplate::dump4setup() 2012-10-01 11:46 * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package addressbook @@ -72,6 +72,8 @@ $templ_data[] = array('name' => 'addressbook.export_explode_fields','template' = $templ_data[] = array('name' => 'addressbook.importexport_wizard_chooseowner','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:1:{s:2:"h2";s:14:",@no_owner_map";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:30:"Use field from CSV if possible";s:4:"name";s:14:"owner_from_csv";}}i:3;a:1:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:13:"contact_owner";}}i:4;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}i:5;a:1:{s:1:"A";a:3:{s:4:"type";s:11:"select-bool";s:5:"label";s:32:"Change addressbook when updating";s:4:"name";s:12:"change_owner";}}}s:4:"rows";i:5;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1320351347',); +$templ_data[] = array('name' => 'addressbook.importexport_wizard_vcard_charset','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:1:"B";s:5:"180px";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:15:"Charset of file";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"charset";s:4:"span";s:9:",width180";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '.width180 select { width:150px;}','modified' => '1349113607',); + $templ_data[] = array('name' => 'addressbook.importexport_wizard_vcard_chooseowner','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:13:"contact_owner";}}i:3;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1347980440',); $templ_data[] = array('name' => 'addressbook.importexport_wizzard_chooseowner','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:4:"name";s:13:"contact_owner";s:4:"size";s:4:"None";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146646360',); diff --git a/addressbook/templates/default/importexport_wizard_vcard_charset.xet b/addressbook/templates/default/importexport_wizard_vcard_charset.xet new file mode 100644 index 0000000000..c46ae5d26c --- /dev/null +++ b/addressbook/templates/default/importexport_wizard_vcard_charset.xet @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file