mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 16:29:22 +01:00
"use static method of link class"
This commit is contained in:
parent
602cfd1edc
commit
9763f202b5
@ -5,64 +5,64 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @package infolog
|
* @package infolog
|
||||||
* @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2003-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$GLOBALS['egw_info']['flags'] = array(
|
$GLOBALS['egw_info']['flags'] = array(
|
||||||
'currentapp' => 'infolog',
|
'currentapp' => 'infolog',
|
||||||
'noheader' => True,
|
'noheader' => True,
|
||||||
'enable_contacts_class' => True,
|
'enable_contacts_class' => True,
|
||||||
);
|
);
|
||||||
include('../header.inc.php');
|
include('../header.inc.php');
|
||||||
|
|
||||||
if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) ||
|
if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) ||
|
||||||
!$GLOBALS['egw_info']['user']['apps']['admin']) // no admin
|
!$GLOBALS['egw_info']['user']['apps']['admin']) // no admin
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->redirect_link('/home.php');
|
$GLOBALS['egw']->redirect_link('/home.php');
|
||||||
}
|
}
|
||||||
if (isset($_FILES['csvfile']['tmp_name']))
|
if (isset($_FILES['csvfile']['tmp_name']))
|
||||||
{
|
{
|
||||||
$csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
$csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
||||||
$GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
|
$GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
|
||||||
$_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ?
|
$_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ?
|
||||||
'download' : '';
|
'download' : '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$csvfile = $GLOBALS['egw']->session->appsession('csvfile');
|
$csvfile = $GLOBALS['egw']->session->appsession('csvfile');
|
||||||
}
|
}
|
||||||
if ($_POST['cancel'])
|
if ($_POST['cancel'])
|
||||||
{
|
{
|
||||||
@unlink($csvfile);
|
@unlink($csvfile);
|
||||||
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
||||||
}
|
}
|
||||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File');
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File');
|
||||||
$GLOBALS['egw']->common->egw_header();
|
$GLOBALS['egw']->common->egw_header();
|
||||||
|
|
||||||
$boinfolog = createobject('infolog.boinfolog');
|
$boinfolog = createobject('infolog.boinfolog');
|
||||||
|
|
||||||
$GLOBALS['egw']->template->set_file(array('import_t' => 'csv_import.tpl'));
|
$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','filename','filenamehandle');
|
||||||
$GLOBALS['egw']->template->set_block('import_t','fheader','fheaderhandle');
|
$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','fields','fieldshandle');
|
||||||
$GLOBALS['egw']->template->set_block('import_t','ffooter','ffooterhandle');
|
$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','imported','importedhandle');
|
||||||
$GLOBALS['egw']->template->set_block('import_t','import','importhandle');
|
$GLOBALS['egw']->template->set_block('import_t','import','importhandle');
|
||||||
|
|
||||||
|
|
||||||
if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb'))))
|
if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb'))))
|
||||||
{
|
{
|
||||||
$_POST['action'] = '';
|
$_POST['action'] = '';
|
||||||
}
|
}
|
||||||
$GLOBALS['egw']->template->set_var("action_url",$GLOBALS['egw']->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
|
$PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans
|
||||||
$ASep = '|>'; // Assignment-Separator, separats pattern and replacesment
|
$ASep = '|>'; // Assignment-Separator, separats pattern and replacesment
|
||||||
$VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace
|
$VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace
|
||||||
$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
|
$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
|
||||||
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
|
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
|
||||||
|
|
||||||
function addr_id( $n_family,$n_given=null,$org_name=null )
|
function addr_id( $n_family,$n_given=null,$org_name=null )
|
||||||
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
|
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
|
||||||
@ -158,10 +158,10 @@ function cat_id($cats)
|
|||||||
return $id_str;
|
return $id_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['next']) $_POST['action'] = 'next';
|
if ($_POST['next']) $_POST['action'] = 'next';
|
||||||
switch ($_POST['action'])
|
switch ($_POST['action'])
|
||||||
{
|
{
|
||||||
case '': // Start, ask Filename
|
case '': // Start, ask Filename
|
||||||
$GLOBALS['egw']->template->set_var('lang_csvfile',lang('CSV-Filename'));
|
$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_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'));
|
||||||
@ -176,8 +176,8 @@ function cat_id($cats)
|
|||||||
$GLOBALS['egw']->template->parse('rows','filename');
|
$GLOBALS['egw']->template->parse('rows','filename');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'continue':
|
case 'continue':
|
||||||
case 'download':
|
case 'download':
|
||||||
$GLOBALS['egw']->preferences->read_repository();
|
$GLOBALS['egw']->preferences->read_repository();
|
||||||
$defaults = $GLOBALS['egw_info']['user']['preferences']['infolog']['cvs_import'];
|
$defaults = $GLOBALS['egw_info']['user']['preferences']['infolog']['cvs_import'];
|
||||||
if (!is_array($defaults))
|
if (!is_array($defaults))
|
||||||
@ -216,7 +216,7 @@ function cat_id($cats)
|
|||||||
'percent' => 'Percent completed: int',
|
'percent' => 'Percent completed: int',
|
||||||
// 'confirm' => 'Confirmation: char(10) not,accept,finish,both when to confirm',
|
// 'confirm' => 'Confirmation: char(10) not,accept,finish,both when to confirm',
|
||||||
'project_id' => 'Link to Projectmanager, use Project-ID, Title or @project_id(id_or_title)',
|
'project_id' => 'Link to Projectmanager, use Project-ID, Title or @project_id(id_or_title)',
|
||||||
'addr_id' => 'Link to Addressbook, use nlast,nfirst[,org] or @addr_id(nlast,nfirst,org)',
|
'addr_id' => 'Link to Addressbook, use nlast,nfirst[,org] or contact_id from addressbook',
|
||||||
'link_1' => '1. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
'link_1' => '1. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
||||||
'link_2' => '2. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
'link_2' => '2. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
||||||
'link_3' => '3. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
'link_3' => '3. link: appname:appid the entry should be linked to, eg.: addressbook:123',
|
||||||
@ -326,11 +326,11 @@ function cat_id($cats)
|
|||||||
$GLOBALS['egw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
|
$GLOBALS['egw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'next':
|
case 'next':
|
||||||
$_POST['info_fields'] = unserialize(stripslashes($_POST['info_fields']));
|
$_POST['info_fields'] = unserialize(stripslashes($_POST['info_fields']));
|
||||||
$_POST['trans'] = unserialize(stripslashes($_POST['trans']));
|
$_POST['trans'] = unserialize(stripslashes($_POST['trans']));
|
||||||
// fall-through
|
// fall-through
|
||||||
case 'import':
|
case 'import':
|
||||||
$hiddenvars = html::input_hidden(array(
|
$hiddenvars = html::input_hidden(array(
|
||||||
'action' => 'continue',
|
'action' => 'continue',
|
||||||
'fieldsep'=> $_POST['fieldsep'],
|
'fieldsep'=> $_POST['fieldsep'],
|
||||||
@ -519,7 +519,7 @@ function cat_id($cats)
|
|||||||
if ($app && $app_id)
|
if ($app && $app_id)
|
||||||
{
|
{
|
||||||
//echo "<p>linking infolog:$id with $app:$app_id</p>\n";
|
//echo "<p>linking infolog:$id with $app:$app_id</p>\n";
|
||||||
$link_id = $boinfolog->link->link('infolog',$id,$app,$app_id);
|
$link_id = egw_link::link('infolog',$id,$app,$app_id);
|
||||||
if ($link_id && !$info_link_id)
|
if ($link_id && !$info_link_id)
|
||||||
{
|
{
|
||||||
$to_write = array(
|
$to_write = array(
|
||||||
@ -546,7 +546,7 @@ function cat_id($cats)
|
|||||||
$GLOBALS['egw']->template->set_var('log',$log);
|
$GLOBALS['egw']->template->set_var('log',$log);
|
||||||
$GLOBALS['egw']->template->parse('rows','imported');
|
$GLOBALS['egw']->template->parse('rows','imported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$GLOBALS['egw']->template->set_var('hiddenvars',str_replace('{','{',$hiddenvars));
|
$GLOBALS['egw']->template->set_var('hiddenvars',str_replace('{','{',$hiddenvars));
|
||||||
$GLOBALS['egw']->template->pfp('phpgw_body','import');
|
$GLOBALS['egw']->template->pfp('phpgw_body','import');
|
||||||
$GLOBALS['egw']->common->egw_footer();
|
$GLOBALS['egw']->common->egw_footer();
|
||||||
|
Loading…
Reference in New Issue
Block a user