mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Fix export, remove incomplete Italian import file
This commit is contained in:
parent
86e928a092
commit
6b990a110e
@ -236,7 +236,7 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list') . '">'.lang("OK").'</a>';
|
||||
echo '<a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list') . '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
@ -245,14 +245,14 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list'). '">'.lang("OK").'</a>';
|
||||
echo '<a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'). '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
|
||||
function export()
|
||||
function export($cat_id='')
|
||||
{
|
||||
global $phpgw_info;
|
||||
global $phpgw_info,$conv_type;
|
||||
|
||||
include (PHPGW_APP_INC . '/export/' . $conv_type);
|
||||
$buffer=array();
|
||||
@ -285,7 +285,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$buffer = $contacts->export_start_file($buffer);
|
||||
$buffer = $contacts->export_start_file($buffer);
|
||||
}
|
||||
|
||||
for ($i=0;$i<count($contacts->ids);$i++)
|
||||
|
@ -138,7 +138,7 @@
|
||||
|
||||
if($uploadedfile == 'none' || $uploadedfile == '')
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/main.php','menuaction=addressbook.uivcard.in&action=GetFile'));
|
||||
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uivcard.in&action=GetFile'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -165,7 +165,7 @@
|
||||
/* Delete the temp file. */
|
||||
unlink($filename);
|
||||
unlink($filename . '.info');
|
||||
Header('Location: ' . $phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id));
|
||||
Header('Location: ' . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
$ab_id = $this->get_lastid();
|
||||
|
||||
Header('Location: '
|
||||
. $phpgw->link('/addressbook/main.php',"menuaction=addressbook.uiaddressbook.view&ab_id=$ab_id&referer=$referer"));
|
||||
. $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.view&ab_id=$ab_id&referer=$referer"));
|
||||
}
|
||||
|
||||
function OLDcopy_entry($ab_id)
|
||||
@ -217,7 +217,7 @@
|
||||
}
|
||||
|
||||
$ab_id = $this->get_lastid();
|
||||
Header("Location: " . $phpgw->link('/addressbook/main.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id"));
|
||||
Header("Location: " . $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.edit&ab_id=$ab_id"));
|
||||
}
|
||||
|
||||
function add_entry($userid,$fields)
|
||||
|
@ -34,17 +34,18 @@
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
$this->template = &$phpgw->template;
|
||||
$this->template = $phpgw->template;
|
||||
$this->cat = CreateObject('phpgwapi.categories');
|
||||
$this->bo = CreateObject('addressbook.boXport',True);
|
||||
$this->browser = CreateObject('phpgwapi.browser');
|
||||
|
||||
$this->start = &$this->bo->start;
|
||||
$this->limit = &$this->bo->limit;
|
||||
$this->query = &$this->bo->query;
|
||||
$this->sort = &$this->bo->sort;
|
||||
$this->order = &$this->bo->order;
|
||||
$this->filter = &$this->bo->filter;
|
||||
$this->cat_id = &$this->bo->cat_id;
|
||||
$this->start = $this->bo->start;
|
||||
$this->limit = $this->bo->limit;
|
||||
$this->query = $this->bo->query;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->filter = $this->bo->filter;
|
||||
$this->cat_id = $this->bo->cat_id;
|
||||
}
|
||||
|
||||
/* Return a select form element with the categories option dialog in it */
|
||||
@ -94,7 +95,7 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list') . '">'.lang("OK").'</a>';
|
||||
echo '<a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list') . '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
@ -103,7 +104,7 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list'). '">'.lang("OK").'</a>';
|
||||
echo '<a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'). '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
|
||||
@ -136,11 +137,11 @@
|
||||
|
||||
$this->template->set_var('lang_cancel',lang('Cancel'));
|
||||
$this->template->set_var('lang_cat',lang('Select Category'));
|
||||
$this->template->set_var('cancel_url',$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||
$this->template->set_var('cancel_url',$phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||
$this->template->set_var('navbar_bg',$phpgw_info['theme']['navbar_bg']);
|
||||
$this->template->set_var('navbar_text',$phpgw_info['theme']['navbar_text']);
|
||||
$this->template->set_var('import_text',lang('Import from LDIF, CSV, or VCard'));
|
||||
$this->template->set_var('action_url',$phpgw->link('/addressbook/main.php','menuaction=addressbook.boXport.import'));
|
||||
$this->template->set_var('action_url',$phpgw->link('/index.php','menuaction=addressbook.boXport.import'));
|
||||
$this->template->set_var('cat_link',$this->cat_option($this->cat_id,True,False));
|
||||
$this->template->set_var('tsvfilename','');
|
||||
$this->template->set_var('conv',$conv);
|
||||
@ -160,11 +161,11 @@
|
||||
|
||||
function export()
|
||||
{
|
||||
global $phpgw,$phpgw_info,$convert,$tsvfilename;
|
||||
global $phpgw,$phpgw_info,$convert,$tsvfilename,$cat_id,$download,$conv_type;
|
||||
|
||||
if ($convert)
|
||||
{
|
||||
$buffer = $this->bo->export();
|
||||
$buffer = $this->bo->export($cat_id);
|
||||
|
||||
if ($conv_type == 'none')
|
||||
{
|
||||
@ -173,7 +174,7 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo lang('<b>No conversion type <none> could be located.</b> Please choose a conversion type from the list');
|
||||
echo ' <a href="'.$phpgw->link('/addressbook/main.php','menuaction=addressbook.uiXport.export') . '">'.lang('OK').'</a>';
|
||||
echo ' <a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiXport.export') . '">' . lang('OK') . '</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
@ -181,15 +182,17 @@
|
||||
if ( ($download == 'on') || ($o->type == 'pdb') )
|
||||
{
|
||||
// filename, default application/octet-stream, length of file, default nocache True
|
||||
$phpgw->browser->content_header($tsvfilename,'application/octet-stream',strlen($buffer));
|
||||
$this->browser->content_header($tsvfilename,'application/octet-stream',strlen($buffer));
|
||||
echo $buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo "<pre>\n";
|
||||
echo $buffer;
|
||||
echo "\n</pre>\n";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/index.php','menuaction=addressbook.uiaddressbook.get_list') . '">'.lang('OK').'</a>';
|
||||
echo '<a href="'.$phpgw->link('/index.php','menuaction=addressbook.uiXport.export') . '">' . lang('OK') . '</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
@ -226,7 +229,7 @@
|
||||
$this->template->set_var('navbar_bg',$phpgw_info['theme']['navbar_bg']);
|
||||
$this->template->set_var('navbar_text',$phpgw_info['theme']['navbar_text']);
|
||||
$this->template->set_var('export_text',lang('Export from Addressbook'));
|
||||
$this->template->set_var('action_url',$phpgw->link('/addressbook/export.php'));
|
||||
$this->template->set_var('action_url',$phpgw->link('/index.php','menuaction=addressbook.uiXport.export'));
|
||||
$this->template->set_var('filename',lang('Export file name'));
|
||||
$this->template->set_var('conv',$conv);
|
||||
$this->template->set_var('debug',lang(''));
|
||||
|
@ -681,6 +681,11 @@
|
||||
|
||||
$fields['ab_id'] = $entry['ab_id'];
|
||||
$fields['tid'] = $entry['tid'];
|
||||
if (!$fields['tid'])
|
||||
{
|
||||
$fields['tid'] = 'n';
|
||||
}
|
||||
|
||||
$fields['referer'] = $entry['referer'];
|
||||
/* _debug_array($fields);exit; */
|
||||
return $fields;
|
||||
@ -1086,7 +1091,7 @@
|
||||
|
||||
function add_email()
|
||||
{
|
||||
global $phpgw_info,$name,$referer;
|
||||
global $phpgw,$phpgw_info,$name,$refereri,$add_email;
|
||||
|
||||
$named = explode(' ', $name);
|
||||
for ($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; }
|
||||
@ -1107,7 +1112,7 @@
|
||||
$referer = urlencode($referer);
|
||||
|
||||
$this->bo->add_entry($phpgw_info['user']['account_id'],$fields);
|
||||
$ab_id = $this->get_lastid();
|
||||
$ab_id = $this->bo->get_lastid();
|
||||
|
||||
Header('Location: '
|
||||
. $phpgw->link('/index.php',"menuaction=addressbook.uiaddressbook.view&ab_id=$ab_id&referer=$referer"));
|
||||
@ -1446,7 +1451,10 @@
|
||||
{
|
||||
$extra_vars = array('cd' => 16,'query' => $this->query,'cat_id' => $this->cat_id);
|
||||
|
||||
if ($referer) $extra_vars += array( 'referer' => urlencode($referer));
|
||||
if ($referer)
|
||||
{
|
||||
$extra_vars += array('referer' => urlencode($referer));
|
||||
}
|
||||
|
||||
$this->template->set_var('edit_button',$this->html_1button_form('edit','Edit',array(),'/index.php','menuaction=addressbook.uiaddressbook.edit&ab_id=' .$ab_id));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
$this->template->set_file(array('vcardin' => 'vcardin.tpl'));
|
||||
|
||||
$this->template->set_var('vcard_header','<p> <b>' . lang('Address book - VCard in') . '</b><hr><p>');
|
||||
$this->template->set_var('action_url',$phpgw->link('/addressbook/main.php','menuaction=addressbook.boaddressbook.add_vcard'));
|
||||
$this->template->set_var('action_url',$phpgw->link('/index.php','menuaction=addressbook.boaddressbook.add_vcard'));
|
||||
$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);
|
||||
@ -92,7 +92,7 @@
|
||||
|
||||
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||
{
|
||||
Header("Location: " . $phpgw->link('/addressbook/main.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||
Header("Location: " . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list'));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
@ -123,11 +123,11 @@
|
||||
if($lastname == '')
|
||||
{
|
||||
/* Run away here. */
|
||||
Header('Location: ' . $phpgw->link('/addressbook/main.php',"menuaction=addressbook.uivcard.out&nolname=1&ab_id=$ab_id"));
|
||||
Header('Location: ' . $phpgw->link('/index.php',"menuaction=addressbook.uivcard.out&nolname=1&ab_id=$ab_id"));
|
||||
}
|
||||
if($firstname == '')
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/main.php',"menuaction=addressbook.uivcard.out&nofname=1&ab_id=$ab_id"));
|
||||
Header('Location: ' . $phpgw->link('/index.php',"menuaction=addressbook.uivcard.out&nofname=1&ab_id=$ab_id"));
|
||||
}
|
||||
|
||||
if ($email)
|
||||
|
@ -1,210 +0,0 @@
|
||||
<?php
|
||||
// This file defines a set of functions and an associative array.
|
||||
// The key of the array corresponds to a header in the source
|
||||
// import file and the value of the array item will be used in
|
||||
// the creation of the output file.
|
||||
//
|
||||
// An exported Outlook file looks like this:
|
||||
//
|
||||
// Title<tab>First Name<tab>Middle Name<tab>Last Name<tab>...
|
||||
// <tab>Patrick<tab><tab>Walsh<tab>...
|
||||
//
|
||||
// Where the first line explains each optional field. This is what
|
||||
// will be looked up in the key.
|
||||
//
|
||||
// The array need not be in any order and any fields not defined will
|
||||
// not be transferred. If the val='+', the value will be appended to
|
||||
// the previous field and any text after the '+' will be appended
|
||||
// before the value. For example, the following would add a comma and
|
||||
// a space between LastName and FirstName and store it in FullName:
|
||||
//
|
||||
// array('LastName' => 'FullName','FirstName' => '+, ');
|
||||
//
|
||||
// Also start with a '#' symbol and a comma separated list will be
|
||||
// turned into a number of the same entries.
|
||||
|
||||
class import_conv
|
||||
{
|
||||
var $currentrecord = array(); //used for buffering to allow uid lines to go first
|
||||
var $id;
|
||||
var $type = 'csv';
|
||||
|
||||
var $import = array(
|
||||
'Nome'
|
||||
'Cognome'
|
||||
'Secondo nome'
|
||||
'Nome e cognome'
|
||||
'Alternativo'
|
||||
'Indirizzo di posta elettronica'
|
||||
'Via (ab.)'
|
||||
'Città (ab.)'
|
||||
'CAP (ab.)'
|
||||
'Provincia (ab.)'
|
||||
'Paese (ab.)'
|
||||
'Telefono (ab.)'
|
||||
'Fax (ab.)'
|
||||
'Cellulare'
|
||||
'Pagina Web personale'
|
||||
'Via (uff.)'
|
||||
'Città (uff.)'
|
||||
'CAP (uff.)'
|
||||
'Provincia (uff.)'
|
||||
'Paese (uff.)'
|
||||
'Pagina Web professionale'
|
||||
'Telefono (uff.)'
|
||||
'Fax (uff.):'
|
||||
'Cercapersone'
|
||||
'Società'
|
||||
'Posizione'
|
||||
'Reparto'
|
||||
'Ufficio'
|
||||
'Note'
|
||||
);
|
||||
|
||||
var $import = array(
|
||||
'Title' => 'title',
|
||||
'First Name' => 'n_given',
|
||||
'Middle Name' => 'n_middle',
|
||||
'Last Name' => 'n_family',
|
||||
'Suffix' => 'n_suffix',
|
||||
'Company' => 'org_name', //objectclass: organization
|
||||
'Department' => 'org_unit', //objectclass: organizationalPerson
|
||||
'Job Title' => 'title', //objectclass: organizationalPerson
|
||||
'Business Street' => 'adr_one_street',
|
||||
'Business Street 2' => 'address2',
|
||||
'Business Street 3' => 'address3',
|
||||
'Business City' => 'adr_one_locality',
|
||||
'Business State' => 'adr_one_region',
|
||||
'Business Postal Code' => 'adr_one_postalcode',
|
||||
'Business Country' => 'adr_one_countryname',
|
||||
'Home Street' => 'adr_two_street',
|
||||
'Home City' => 'adr_two_locality',
|
||||
'Home State' => 'adr_two_region',
|
||||
'Home Postal Code' => 'adr_two_postalcode',
|
||||
'Home Country' => 'adr_two_countryname',
|
||||
'Home Street 2' => '',
|
||||
'Home Street 3' => '',
|
||||
'Other Street' => '',
|
||||
'Other City' => '',
|
||||
'Other State' => '',
|
||||
'Other Postal Code' => '',
|
||||
'Other Country' => '',
|
||||
"Assistant's Phone" => 'tel_msg',
|
||||
'Business Fax' => 'tel_fax',
|
||||
'Business Phone' => 'tel_work',
|
||||
'Business Phone 2' => 'ophone',
|
||||
'Callback' => '',
|
||||
'Car Phone' => 'tel_car',
|
||||
'Company Main Phone' => '',
|
||||
'Home Fax' => '',
|
||||
'Home Phone' => 'tel_home',
|
||||
'Home Phone 2' => '', //This will make another homePhone entry
|
||||
'ISDN' => 'tel_isdn',
|
||||
'Mobile Phone' => 'tel_cell', //newPilotPerson
|
||||
'Other Fax' => '',
|
||||
'Other Phone' => '',
|
||||
'Pager' => 'tel_pager',
|
||||
'Primary Phone' => '',
|
||||
'Radio Phone' => '',
|
||||
'TTY/TDD Phone' => '',
|
||||
'Telex' => '', //organization
|
||||
'Account' => '',
|
||||
'Anniversary' => '',
|
||||
"Assistant's Name" => '', //newPilotPerson
|
||||
'Billing Information' => '',
|
||||
'Birthday' => 'bday',
|
||||
'Categories' => '',
|
||||
'Children' => '',
|
||||
'Directory Server' => '',
|
||||
'E-mail Address' => 'email',
|
||||
'E-mail Display Name' => '',
|
||||
'E-mail 2 Address' => 'email_home',
|
||||
'E-mail 2 Display Name' => '',
|
||||
'E-mail 3 Address' => '', //add another...
|
||||
'E-mail 3 Display Name' => '',
|
||||
'Gender' => '',
|
||||
'Government ID Number' => '',
|
||||
'Hobby' => '',
|
||||
'Initials' => '',
|
||||
'Internet Free Busy' => '',
|
||||
'Keywords' => '',
|
||||
'Language' => '',
|
||||
'Location' => '',
|
||||
"Manager's Name" => '',
|
||||
'Mileage' => '',
|
||||
'Notes' => 'note',
|
||||
'Office Location' => '',
|
||||
'Organizational ID Number' => '',
|
||||
'PO Box' => '',
|
||||
'Priority' => '',
|
||||
'Private Profession' => '',
|
||||
'Referred By' => '',
|
||||
'Sensitivity' => '',
|
||||
'Spouse' => '',
|
||||
'User 1' => '',
|
||||
'User 2' => '',
|
||||
'User 3' => '',
|
||||
'User 4' => '',
|
||||
'Web Page' => 'url'
|
||||
);
|
||||
|
||||
function import_start_file($buffer)
|
||||
{
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function import_start_record($buffer)
|
||||
{
|
||||
$top=array();
|
||||
++$this->id;
|
||||
$this->currentrecord = $top;
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function import_new_attrib($buffer,$name,$value)
|
||||
{
|
||||
$value = trim($value);
|
||||
$value = str_replace('\n','<BR>',$value);
|
||||
$value = str_replace('\r','',$value);
|
||||
$this->currentrecord += array($name => $value);
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function import_end_record($buffer)
|
||||
{
|
||||
global $phpgw_info;
|
||||
$buffer[$this->id]='';
|
||||
while ( list($name, $value) = each($this->currentrecord))
|
||||
{
|
||||
$buffer[$this->id][$name] = $value;
|
||||
//echo '<br>'.$name.' => '.$value;
|
||||
}
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
function import_end_file($buffer,$access='private',$cat_id=0)
|
||||
{
|
||||
global $phpgw,$phpgw_info;
|
||||
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
//echo '<br>';
|
||||
for ($i=1;$i<=count($buffer);$i++)
|
||||
{
|
||||
while ( list($name,$value) = @each($buffer[$i]) )
|
||||
{
|
||||
//echo '<br>'.$i.': '.$name.' => '.$value;
|
||||
$entry[$i][$name] = $value;
|
||||
}
|
||||
$entry[$i]['email_type'] = 'INTERNET';
|
||||
$entry[$i]['email_home_type'] = 'INTERNET';
|
||||
$entry[$i]['adr_one_type'] = 'intl';
|
||||
$entry[$i]['adr_two_type'] = 'intl';
|
||||
//echo '<br>';
|
||||
$contacts->add($phpgw_info['user']['account_id'],$entry[$i],$access,$cat_id);
|
||||
}
|
||||
$num = $i - 1;
|
||||
return lang('Successfully imported x records into your addressbook.',$num);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user