Remove header redirection from bo class - one function left to do

This commit is contained in:
Miles Lott 2003-11-19 14:16:15 +00:00
parent 6c9d475688
commit 71a27f0ae7
2 changed files with 17 additions and 7 deletions

View File

@ -286,13 +286,11 @@
return array(0 => array('No access' => 'No access'));
}
function add_vcard()
function add_vcard($uploadedfile='')
{
global $uploadedfile;
if($uploadedfile == 'none' || $uploadedfile == '')
{
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.in&action=GetFile'));
return False;
}
else
{
@ -317,13 +315,15 @@
$entry['access'] = 'private';
$entry['tid'] = 'n';
/* _debug_array($entry);exit; */
$this->so->add_entry($entry);
$ab_id = $this->get_lastid();
/* Delete the temp file. */
unlink($filename);
unlink($filename . '.info');
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id));
return (int)$ab_id;
}
}

View File

@ -34,7 +34,7 @@
function uivcard()
{
$this->template = $GLOBALS['phpgw']->template;
$this->template = &$GLOBALS['phpgw']->template;
$this->contacts = CreateObject('phpgwapi.contacts');
$this->browser = CreateObject('phpgwapi.browser');
$this->vcard = CreateObject('phpgwapi.vcard');
@ -43,6 +43,7 @@
function in()
{
$uploadedfile = get_var('uploadedfile','FILES');
$action = get_var('action',array('POST','GET'));
$GLOBALS['phpgw']->common->phpgw_header();
@ -50,6 +51,15 @@
echo '<body bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '">';
if($uploadedfile)
{
$ab_id = $this->bo->add_vcard($uploadedfile);
if($done)
{
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id));
}
}
if($action == 'GetFile')
{
echo '<b><center>' . lang('You must select a vcard. (*.vcf)') . '</b></center><br><br>';
@ -58,7 +68,7 @@
$this->template->set_file(array('vcardin' => 'vcardin.tpl'));
$this->template->set_var('vcard_header','<p>&nbsp;<b>' . lang('Address book - VCard in') . '</b><hr><p>');
$this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.boaddressbook.add_vcard'));
$this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.in'));
$this->template->set_var('lang_access',lang('Access'));
$this->template->set_var('lang_groups',lang('Which groups'));
$this->template->set_var('access_option',$access_option);