diff --git a/infolog/csv_import.php b/infolog/csv_import.php index 4fddfdbf7c..f200e8d0c8 100644 --- a/infolog/csv_import.php +++ b/infolog/csv_import.php @@ -12,53 +12,53 @@ /* $Id$ */ - $GLOBALS['phpgw_info']['flags'] = array( + $GLOBALS['egw_info']['flags'] = array( 'currentapp' => 'infolog', 'noheader' => True, 'enable_contacts_class' => True, ); include('../header.inc.php'); - if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || - !$GLOBALS['phpgw_info']['user']['apps']['admin']) // no admin + if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || + !$GLOBALS['egw_info']['user']['apps']['admin']) // no admin { - $GLOBALS['phpgw']->redirect_link('/home.php'); + $GLOBALS['egw']->redirect_link('/home.php'); } if (isset($_FILES['csvfile']['tmp_name'])) { - $csvfile = tempnam($GLOBALS['phpgw_info']['server']['temp_dir'],$GLOBALS['phpgw_info']['flags']['currentapp']."_"); - $GLOBALS['phpgw']->session->appsession('csvfile','',$csvfile); + $csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_"); + $GLOBALS['egw']->session->appsession('csvfile','',$csvfile); $_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ? 'download' : ''; } else { - $csvfile = $GLOBALS['phpgw']->session->appsession('csvfile'); + $csvfile = $GLOBALS['egw']->session->appsession('csvfile'); } if ($_POST['cancel']) { @unlink($csvfile); - $GLOBALS['phpgw']->redirect_link('/admin/index.php'); + $GLOBALS['egw']->redirect_link('/admin/index.php'); } - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File'); - $GLOBALS['phpgw']->common->phpgw_header(); + $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File'); + $GLOBALS['egw']->common->egw_header(); $boinfolog = createobject('infolog.boinfolog'); - $GLOBALS['phpgw']->template->set_file(array('import_t' => 'csv_import.tpl')); - $GLOBALS['phpgw']->template->set_block('import_t','filename','filenamehandle'); - $GLOBALS['phpgw']->template->set_block('import_t','fheader','fheaderhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','fields','fieldshandle'); - $GLOBALS['phpgw']->template->set_block('import_t','ffooter','ffooterhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','imported','importedhandle'); - $GLOBALS['phpgw']->template->set_block('import_t','import','importhandle'); + $GLOBALS['egw']->template->set_file(array('import_t' => 'csv_import.tpl')); + $GLOBALS['egw']->template->set_block('import_t','filename','filenamehandle'); + $GLOBALS['egw']->template->set_block('import_t','fheader','fheaderhandle'); + $GLOBALS['egw']->template->set_block('import_t','fields','fieldshandle'); + $GLOBALS['egw']->template->set_block('import_t','ffooter','ffooterhandle'); + $GLOBALS['egw']->template->set_block('import_t','imported','importedhandle'); + $GLOBALS['egw']->template->set_block('import_t','import','importhandle'); if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb')))) { $_POST['action'] = ''; } - $GLOBALS['phpgw']->template->set_var("action_url",$GLOBALS['phpgw']->link("/infolog/csv_import.php")); + $GLOBALS['egw']->template->set_var("action_url",$GLOBALS['egw']->link("/infolog/csv_import.php")); $PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans $ASep = '|>'; // Assignment-Separator, separats pattern and replacesment @@ -111,22 +111,22 @@ function cat_id($cats) } else { - if (!is_object($GLOBALS['phpgw']->categories)) + if (!is_object($GLOBALS['egw']->categories)) { - $GLOBALS['phpgw']->categories = createobject('phpgwapi.categories'); + $GLOBALS['egw']->categories = createobject('phpgwapi.categories'); } - if (is_numeric($cat) && $GLOBALS['phpgw']->categories->id2name($cat) != '--') + if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--') { $cat2id[$cat] = $ids[$cat] = $cat; } - elseif ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) )) + elseif ($id = $GLOBALS['egw']->categories->name2id( addslashes($cat) )) { // cat exists $cat2id[$cat] = $ids[$cat] = $id; } else { // create new cat - $GLOBALS['phpgw']->categories->add( array('name' => $cat,'descr' => $cat )); - $cat2id[$cat] = $ids[$cat] = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) ); + $GLOBALS['egw']->categories->add( array('name' => $cat,'descr' => $cat )); + $cat2id[$cat] = $ids[$cat] = $GLOBALS['egw']->categories->name2id( addslashes($cat) ); } } } @@ -139,45 +139,45 @@ function cat_id($cats) return $id_str; } - if (!is_object($GLOBALS['phpgw']->html)) + if (!is_object($GLOBALS['egw']->html)) { - $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); + $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); } if ($_POST['next']) $_POST['action'] = 'next'; switch ($_POST['action']) { case '': // Start, ask Filename - $GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename')); - $GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); - $GLOBALS['phpgw']->template->set_var('lang_charset',lang('Charset of file')); - $GLOBALS['phpgw']->template->set_var('select_charset', - $GLOBALS['phpgw']->html->select('charset','', - $GLOBALS['phpgw']->translation->get_installed_charsets()+ + $GLOBALS['egw']->template->set_var('lang_csvfile',lang('CSV-Filename')); + $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('select_charset', + $GLOBALS['egw']->html->select('charset','', + $GLOBALS['egw']->translation->get_installed_charsets()+ array('utf-8' => 'utf-8 (Unicode)'),True)); - $GLOBALS['phpgw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); - $GLOBALS['phpgw']->template->set_var('submit',lang('Import')); - $GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); + $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); + $GLOBALS['egw']->template->set_var('submit',lang('Import')); + $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); - $GLOBALS['phpgw']->template->parse('rows','filename'); + $GLOBALS['egw']->template->parse('rows','filename'); break; case 'continue': case 'download': - $GLOBALS['phpgw']->preferences->read_repository(); - $defaults = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['cvs_import']; + $GLOBALS['egw']->preferences->read_repository(); + $defaults = $GLOBALS['egw_info']['user']['preferences']['infolog']['cvs_import']; if (!is_array($defaults)) { $defaults = array(); } - $GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname')); - $GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname')); - $GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' '.lang('help').''); - $GLOBALS['phpgw']->template->set_var('submit', - $GLOBALS['phpgw']->html->submit_button('convert','Import') . ' '. - $GLOBALS['phpgw']->html->submit_button('cancel','Cancel')); - $GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); - $GLOBALS['phpgw']->template->parse('rows','fheader'); + $GLOBALS['egw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname')); + $GLOBALS['egw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname')); + $GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' '.lang('help').''); + $GLOBALS['egw']->template->set_var('submit', + $GLOBALS['egw']->html->submit_button('convert','Import') . ' '. + $GLOBALS['egw']->html->submit_button('cancel','Cancel')); + $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); + $GLOBALS['egw']->template->parse('rows','fheader'); $info_names = array( 'type' => 'Type: char(10) task,phone,note,confirm,reject,email,fax', @@ -221,41 +221,41 @@ function cat_id($cats) $info_name_options = "