calling translation class static and remove (unnecessary) extra utf-8 charset

This commit is contained in:
Ralf Becker 2009-05-11 08:11:08 +00:00
parent fc141457cf
commit 7209eac430
3 changed files with 23 additions and 25 deletions

View File

@ -119,9 +119,7 @@ switch($_POST['action'])
$GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); $GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
$GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file'));
$GLOBALS['egw']->template->set_var('select_charset', $GLOBALS['egw']->template->set_var('select_charset',
html::select('charset','', html::select('charset','',translation::get_installed_charsets(),True));
$GLOBALS['egw']->translation->get_installed_charsets()+
array('utf-8' => 'utf-8 (Unicode)'),True));
$GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';');
$GLOBALS['egw']->template->set_var('submit',lang('Import')); $GLOBALS['egw']->template->set_var('submit',lang('Import'));
$GLOBALS['egw']->template->set_var('csvfile',$csvfile); $GLOBALS['egw']->template->set_var('csvfile',$csvfile);
@ -163,7 +161,7 @@ switch($_POST['action'])
$addr_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n"; $addr_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n";
} }
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -251,7 +249,7 @@ switch($_POST['action'])
ini_set('auto_detect_line_endings',true); // to allow to import files created eg. on a mac ini_set('auto_detect_line_endings',true); // to allow to import files created eg. on a mac
$fp=fopen($csvfile,'r'); $fp=fopen($csvfile,'r');
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -316,7 +314,7 @@ switch($_POST['action'])
{ {
break; // EOF break; // EOF
} }
$fields = $GLOBALS['egw']->translation->convert($fields,$_POST['charset']); $fields = translation::convert($fields,$_POST['charset']);
$log .= "\t</tr><tr><td>".($start+$anz)."</td>\n"; $log .= "\t</tr><tr><td>".($start+$anz)."</td>\n";

View File

@ -10,9 +10,11 @@
* @version $Id$ * @version $Id$
*/ */
$GLOBALS['egw_info']['flags'] = array( $GLOBALS['egw_info'] = array(
'currentapp' => 'calendar', 'flags' => array(
'noheader' => True 'currentapp' => 'calendar',
'noheader' => True
),
); );
include('../header.inc.php'); include('../header.inc.php');
@ -137,9 +139,7 @@ case '': // Start, ask Filename
$GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file'));
$GLOBALS['egw']->template->set_var('lang_help',lang('Please note: You can configure the field assignments AFTER you uploaded the file.')); $GLOBALS['egw']->template->set_var('lang_help',lang('Please note: You can configure the field assignments AFTER you uploaded the file.'));
$GLOBALS['egw']->template->set_var('select_charset', $GLOBALS['egw']->template->set_var('select_charset',
html::select('charset','', html::select('charset','',translation::get_installed_charsets(),True));
$GLOBALS['egw']->translation->get_installed_charsets()+
array('utf-8' => 'utf-8 (Unicode)'),True));
$GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';');
$GLOBALS['egw']->template->set_var('submit',lang('Import')); $GLOBALS['egw']->template->set_var('submit',lang('Import'));
$GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
@ -201,7 +201,7 @@ case 'download':
$cal_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n"; $cal_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n";
} }
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -290,7 +290,7 @@ case 'import':
@set_time_limit(0); @set_time_limit(0);
$fp=fopen($csvfile,'r'); $fp=fopen($csvfile,'r');
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -359,7 +359,7 @@ case 'import':
{ {
break; // EOF break; // EOF
} }
$fields = $GLOBALS['egw']->translation->convert($fields,$_POST['charset']); $fields = translation::convert($fields,$_POST['charset']);
$log .= "\t<tr>\n\t\t<td>".($start+$anz)."</td>\n"; $log .= "\t<tr>\n\t\t<td>".($start+$anz)."</td>\n";

View File

@ -10,10 +10,12 @@
* @version $Id$ * @version $Id$
*/ */
$GLOBALS['egw_info']['flags'] = array( $GLOBALS['egw_info'] = array(
'currentapp' => 'infolog', 'flags' => array(
'noheader' => True, 'currentapp' => 'infolog',
'enable_contacts_class' => True, 'noheader' => True,
'enable_contacts_class' => True,
),
); );
include('../header.inc.php'); include('../header.inc.php');
@ -171,9 +173,7 @@ case '': // Start, ask Filename
$GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); $GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
$GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file'));
$GLOBALS['egw']->template->set_var('select_charset', $GLOBALS['egw']->template->set_var('select_charset',
html::select('charset','', html::select('charset','',translation::get_installed_charsets(),True));
$GLOBALS['egw']->translation->get_installed_charsets()+
array('utf-8' => 'utf-8 (Unicode)'),True));
$GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';');
$GLOBALS['egw']->template->set_var('submit',lang('Import')); $GLOBALS['egw']->template->set_var('submit',lang('Import'));
$GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
@ -259,7 +259,7 @@ case 'download':
$info_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n"; $info_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n";
} }
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -349,7 +349,7 @@ case 'import':
@set_time_limit(0); @set_time_limit(0);
$fp=fopen($csvfile,'r'); $fp=fopen($csvfile,'r');
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = translation::convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -413,7 +413,7 @@ case 'import':
{ {
break; // EOF break; // EOF
} }
$fields = $GLOBALS['egw']->translation->convert($fields,$_POST['charset']); $fields = translation::convert($fields,$_POST['charset']);
$log .= "\t</tr><tr><td>".($start+$anz)."</td>\n"; $log .= "\t</tr><tr><td>".($start+$anz)."</td>\n";