forked from extern/egroupware
Formatting, removal of some function params that are not needed
This commit is contained in:
parent
64ce202c13
commit
17de668f88
@ -12,37 +12,26 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
$phpgw_info["flags"]["currentapp"] = "addressbook";
|
$phpgw_info['flags'] = array(
|
||||||
$phpgw_info["flags"]["enable_contacts_class"] = True;
|
'currentapp' => 'addressbook',
|
||||||
$phpgw_info["flags"]["enable_browser_class"] = True;
|
'enable_contacts_class' => True,
|
||||||
include("../header.inc.php");
|
'enable_browser_class' => True
|
||||||
|
);
|
||||||
|
include('../header.inc.php');
|
||||||
|
|
||||||
//$sep = $phpgw_info["server"]["dir_separator"];
|
|
||||||
$sep = SEP;
|
$sep = SEP;
|
||||||
|
|
||||||
// Construct a default basedn for Contacts if using LDAP
|
|
||||||
$tmpbasedn = split(",",$phpgw_info["server"]["ldap_context"]);
|
|
||||||
array_shift($tmpbasedn);
|
|
||||||
for ($i=0;$i<count($tmpbasedn);$i++) {
|
|
||||||
if($i==0) {
|
|
||||||
$basedn = $tmpbasedn[$i];
|
|
||||||
} else {
|
|
||||||
$basedn = $basedn.",".$tmpbasedn[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$context = $phpgw_info["server"]["ldap_contact_context"];
|
|
||||||
|
|
||||||
if (!$convert)
|
if (!$convert)
|
||||||
{
|
{
|
||||||
$t = new Template(PHPGW_APP_TPL);
|
$t = new Template(PHPGW_APP_TPL);
|
||||||
$t->set_file(array("import" => "import.tpl"));
|
$t->set_file(array('import' => 'import.tpl'));
|
||||||
|
|
||||||
$dir_handle=opendir($phpgw_info["server"]["app_root"].$sep."import");
|
$dir_handle=opendir($phpgw_info['server']['app_root'] . $sep . 'import');
|
||||||
$i=0; $myfilearray="";
|
$i=0; $myfilearray='';
|
||||||
while ($file = readdir($dir_handle))
|
while ($file = readdir($dir_handle))
|
||||||
{
|
{
|
||||||
//echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file)." -->";
|
//echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file)." -->";
|
||||||
if ((substr($file, 0, 1) != ".") && is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file) )
|
if ((substr($file, 0, 1) != '.') && is_file($phpgw_info['server']['app_root'] . $sep . 'import' . $sep . $file) )
|
||||||
{
|
{
|
||||||
$myfilearray[$i] = $file;
|
$myfilearray[$i] = $file;
|
||||||
$i++;
|
$i++;
|
||||||
@ -53,46 +42,44 @@
|
|||||||
for ($i=0;$i<count($myfilearray);$i++)
|
for ($i=0;$i<count($myfilearray);$i++)
|
||||||
{
|
{
|
||||||
$fname = ereg_replace('_',' ',$myfilearray[$i]);
|
$fname = ereg_replace('_',' ',$myfilearray[$i]);
|
||||||
$conv .= '<OPTION VALUE="'.$myfilearray[$i].'">'.$fname.'</OPTION>';
|
$conv .= '<OPTION VALUE="' . $myfilearray[$i].'">' . $fname . '</OPTION>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$t->set_var("lang_cancel",lang("Cancel"));
|
$t->set_var('lang_cancel',lang('Cancel'));
|
||||||
$t->set_var("lang_cat",lang("Select Category"));
|
$t->set_var('lang_cat',lang('Select Category'));
|
||||||
$t->set_var("cancel_url",$phpgw->link("/addressbook/index.php"));
|
$t->set_var('cancel_url',$phpgw->link('/addressbook/index.php'));
|
||||||
$t->set_var("navbar_bg",$phpgw_info["theme"]["navbar_bg"]);
|
$t->set_var('navbar_bg',$phpgw_info['theme']['navbar_bg']);
|
||||||
$t->set_var("navbar_text",$phpgw_info["theme"]["navbar_text"]);
|
$t->set_var('navbar_text',$phpgw_info['theme']['navbar_text']);
|
||||||
$t->set_var("import_text",lang("Import from LDIF, CSV, or VCard"));
|
$t->set_var('import_text',lang('Import from LDIF, CSV, or VCard'));
|
||||||
$t->set_var("action_url",$phpgw->link("/addressbook/import.php"));
|
$t->set_var('action_url',$phpgw->link('/addressbook/import.php'));
|
||||||
$t->set_var("cat_link",cat_option($cat_id,True,False));
|
$t->set_var('cat_link',cat_option($cat_id,True,False));
|
||||||
$t->set_var("tsvfilename","");
|
$t->set_var('tsvfilename','');
|
||||||
$t->set_var("conv",$conv);
|
$t->set_var('conv',$conv);
|
||||||
$t->set_var("debug",lang("Debug output in browser"));
|
$t->set_var('debug',lang('Debug output in browser'));
|
||||||
$t->set_var("filetype",lang("LDIF"));
|
$t->set_var('filetype',lang('LDIF'));
|
||||||
$t->set_var("basedn",$basedn);
|
$t->set_var('download',lang('Submit'));
|
||||||
$t->set_var("context",$context);
|
$t->set_var('start',$start);
|
||||||
$t->set_var("download",lang("Submit"));
|
$t->set_var('sort',$sort);
|
||||||
$t->set_var("start",$start);
|
$t->set_var('order',$order);
|
||||||
$t->set_var("sort",$sort);
|
$t->set_var('filter',$filter);
|
||||||
$t->set_var("order",$order);
|
$t->set_var('query',$query);
|
||||||
$t->set_var("filter",$filter);
|
$t->set_var('cat_id',$cat_id);
|
||||||
$t->set_var("query",$query);
|
$t->pparse('out','import');
|
||||||
$t->set_var("cat_id",$cat_id);
|
|
||||||
$t->pparse("out","import");
|
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
include ($phpgw_info["server"]["app_root"].$sep."import".$sep.$conv_type);
|
include ($phpgw_info['server']['app_root'] . $sep . 'import' . $sep . $conv_type);
|
||||||
|
|
||||||
if ($private=="") { $private="public"; }
|
if ($private == '') { $private = 'public'; }
|
||||||
$row=0;
|
$row=0;
|
||||||
$buffer=array();
|
$buffer=array();
|
||||||
$this = new import_conv;
|
$this = new import_conv;
|
||||||
$buffer = $this->import_start_file($buffer,$basedn,$context);
|
$buffer = $this->import_start_file($buffer);
|
||||||
$fp=fopen($tsvfile,"r");
|
$fp=fopen($tsvfile,'r');
|
||||||
if ($this->type == 'csv')
|
if ($this->type == 'csv')
|
||||||
{
|
{
|
||||||
while ($data = fgetcsv($fp,8000,","))
|
while ($data = fgetcsv($fp,8000,','))
|
||||||
{
|
{
|
||||||
$num = count($data);
|
$num = count($data);
|
||||||
$row++;
|
$row++;
|
||||||
@ -106,7 +93,7 @@
|
|||||||
for ($c=0; $c<$num; $c++ )
|
for ($c=0; $c<$num; $c++ )
|
||||||
{
|
{
|
||||||
//Send name/value pairs along with the buffer
|
//Send name/value pairs along with the buffer
|
||||||
if ($this->import[$header[$c]]!="" && $data[$c]!="")
|
if ($this->import[$header[$c]] != '' && $data[$c] != '')
|
||||||
{
|
{
|
||||||
$buffer = $this->import_new_attrib($buffer, $this->import[$header[$c]],$data[$c]);
|
$buffer = $this->import_new_attrib($buffer, $this->import[$header[$c]],$data[$c]);
|
||||||
}
|
}
|
||||||
@ -155,7 +142,7 @@
|
|||||||
$value = $url. ':' . $value;
|
$value = $url. ':' . $value;
|
||||||
}
|
}
|
||||||
//echo '<br>'.$j.': '.$name.' => '.$value;
|
//echo '<br>'.$j.': '.$name.' => '.$value;
|
||||||
if ($this->import[$name] != "" && $value != "")
|
if ($this->import[$name] != '' && $value != '')
|
||||||
{
|
{
|
||||||
$buffer = $this->import_new_attrib($buffer, $this->import[$name],$value);
|
$buffer = $this->import_new_attrib($buffer, $this->import[$name],$value);
|
||||||
}
|
}
|
||||||
@ -200,9 +187,9 @@
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
$buffer = $this->import_end_file($buffer,$private,$cat_id);
|
$buffer = $this->import_end_file($buffer,$private,$cat_id);
|
||||||
|
|
||||||
if ($download == "")
|
if ($download == '')
|
||||||
{
|
{
|
||||||
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" )
|
if($conv_type == 'Debug LDAP' || $conv_type == 'Debug SQL' )
|
||||||
{
|
{
|
||||||
// filename, default application/octet-stream, length of file, default nocache True
|
// filename, default application/octet-stream, length of file, default nocache True
|
||||||
$phpgw->browser->content_header($tsvfilename,'',strlen($buffer));
|
$phpgw->browser->content_header($tsvfilename,'',strlen($buffer));
|
||||||
@ -211,7 +198,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<pre>$buffer</pre>";
|
echo "<pre>$buffer</pre>";
|
||||||
echo '<a href="'.$phpgw->link("/addressbook/index.php",
|
echo '<a href="'.$phpgw->link('/addressbook/index.php',
|
||||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||||
. '">'.lang("OK").'</a>';
|
. '">'.lang("OK").'</a>';
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
@ -220,7 +207,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<pre>$buffer</pre>";
|
echo "<pre>$buffer</pre>";
|
||||||
echo '<a href="'.$phpgw->link("/addressbook/index.php",
|
echo '<a href="'.$phpgw->link('/addressbook/index.php',
|
||||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||||
. '">'.lang("OK").'</a>';
|
. '">'.lang("OK").'</a>';
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// before the value. For example, the following would add a comma and
|
// before the value. For example, the following would add a comma and
|
||||||
// a space between LastName and FirstName and store it in FullName:
|
// a space between LastName and FirstName and store it in FullName:
|
||||||
//
|
//
|
||||||
// array("LastName" => "FullName","FirstName" => "+, ");
|
// array('LastName' => 'FullName','FirstName' => '+, ');
|
||||||
//
|
//
|
||||||
// Also start with a '#' symbol and a comma separated list will be
|
// Also start with a '#' symbol and a comma separated list will be
|
||||||
// turned into a number of the same entries.
|
// turned into a number of the same entries.
|
||||||
@ -22,71 +22,79 @@
|
|||||||
var $type = 'ldif';
|
var $type = 'ldif';
|
||||||
|
|
||||||
var $import = array(
|
var $import = array(
|
||||||
"title" => "title",
|
'title' => 'title',
|
||||||
"givenname" => "n_given",
|
'givenname' => 'n_given',
|
||||||
"sn" => "n_family",
|
'sn' => 'n_family',
|
||||||
"cn" => "fn",
|
'cn' => 'fn',
|
||||||
"o" => "org_name",
|
'o' => 'org_name',
|
||||||
"ou" => "org_unit",
|
'ou' => 'org_unit',
|
||||||
"streetaddress" => "adr_one_street",
|
'streetaddress' => 'adr_one_street',
|
||||||
"locality" => "adr_one_locality",
|
'locality' => 'adr_one_locality',
|
||||||
"st" => "adr_one_region",
|
'st' => 'adr_one_region',
|
||||||
"postalcode" => "adr_one_postalcode",
|
'postalcode' => 'adr_one_postalcode',
|
||||||
"countryname" => "adr_one_countryname",
|
'countryname' => 'adr_one_countryname',
|
||||||
"telephonenumber" => "tel_work",
|
'telephonenumber' => 'tel_work',
|
||||||
"homephone" => "tel_home",
|
'homephone' => 'tel_home',
|
||||||
"facsimiletelephonenumber" => "tel_fax",
|
'facsimiletelephonenumber' => 'tel_fax',
|
||||||
"xmozillaanyphone" => "ophone",
|
'xmozillaanyphone' => 'ophone',
|
||||||
"cellphone" => "tel_cell",
|
'cellphone' => 'tel_cell',
|
||||||
"description" => "note",
|
'description' => 'note',
|
||||||
"pagerphone" => "tel_pager",
|
'pagerphone' => 'tel_pager',
|
||||||
"mail" => "email",
|
'mail' => 'email',
|
||||||
"homeurl" => "url",
|
'homeurl' => 'url',
|
||||||
"xmozillauseconferenceserver" => "",
|
'xmozillauseconferenceserver' => '',
|
||||||
"xmozillanickname" => "",
|
'xmozillanickname' => '',
|
||||||
"xmozillausehtmlmail" => "",
|
'xmozillausehtmlmail' => '',
|
||||||
"modifytimestamp" => "",
|
'modifytimestamp' => '',
|
||||||
"objectclass" => ""
|
'objectclass' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
function import_start_file($buffer,$j="",$k="") {
|
function import_start_file($buffer)
|
||||||
|
{
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_start_record($buffer) {
|
function import_start_record($buffer)
|
||||||
|
{
|
||||||
$top=array();
|
$top=array();
|
||||||
++$this->id;
|
++$this->id;
|
||||||
$this->currentrecord = $top;
|
$this->currentrecord = $top;
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_new_attrib($buffer,$name,$value) {
|
function import_new_attrib($buffer,$name,$value)
|
||||||
|
{
|
||||||
// chop leading space from value
|
// chop leading space from value
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$value = str_replace("\r","",$value);
|
$value = str_replace('\r','',$value);
|
||||||
//echo '<br>'.$name.' => '.$value;
|
//echo '<br>'.$name.' => '.$value;
|
||||||
$this->currentrecord += array($name => $value);
|
$this->currentrecord += array($name => $value);
|
||||||
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_record($buffer) {
|
function import_end_record($buffer)
|
||||||
|
{
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
$buffer[$this->id]="";
|
$buffer[$this->id]='';
|
||||||
while ( list($name, $value) = each($this->currentrecord)) {
|
while ( list($name, $value) = each($this->currentrecord))
|
||||||
|
{
|
||||||
$buffer[$this->id][$name] = $value;
|
$buffer[$this->id][$name] = $value;
|
||||||
//echo '<br>'.$this->id.': '.$name.' => '.$value;
|
//echo '<br>'.$this->id.': '.$name.' => '.$value;
|
||||||
}
|
}
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_file($buffer,$access="private",$cat_id=0) {
|
function import_end_file($buffer,$access='private',$cat_id=0)
|
||||||
|
{
|
||||||
global $phpgw,$phpgw_info;
|
global $phpgw,$phpgw_info;
|
||||||
|
|
||||||
$contacts = CreateObject("phpgwapi.contacts");
|
$contacts = CreateObject('phpgwapi.contacts');
|
||||||
//echo '<br>';
|
//echo '<br>';
|
||||||
for ($i=1;$i<=count($buffer);$i++) {
|
for ($i=1;$i<=count($buffer);$i++)
|
||||||
while ( list($name,$value) = @each($buffer[$i]) ) {
|
{
|
||||||
|
while ( list($name,$value) = @each($buffer[$i]) )
|
||||||
|
{
|
||||||
//echo '<br>'.$i.': '.$name.' => '.$value;
|
//echo '<br>'.$i.': '.$name.' => '.$value;
|
||||||
$entry[$i][$name] = $value;
|
$entry[$i][$name] = $value;
|
||||||
}
|
}
|
||||||
@ -95,10 +103,10 @@
|
|||||||
$entry[$i]['adr_one_type'] = 'intl';
|
$entry[$i]['adr_one_type'] = 'intl';
|
||||||
$entry[$i]['adr_two_type'] = 'intl';
|
$entry[$i]['adr_two_type'] = 'intl';
|
||||||
//echo '<br>';
|
//echo '<br>';
|
||||||
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i],$access,$cat_id);
|
$contacts->add($phpgw_info['user']['account_id'],$entry[$i],$access,$cat_id);
|
||||||
}
|
}
|
||||||
$num = $i - 1;
|
$num = $i - 1;
|
||||||
return "Successfully imported $num records into your addressbook.";
|
return lang('Successfully imported x records into your addressbook.',$num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
// before the value. For example, the following would add a comma and
|
// before the value. For example, the following would add a comma and
|
||||||
// a space between LastName and FirstName and store it in FullName:
|
// a space between LastName and FirstName and store it in FullName:
|
||||||
//
|
//
|
||||||
// array("LastName" => "FullName","FirstName" => "+, ");
|
// array('LastName' => 'FullName','FirstName' => '+, ');
|
||||||
//
|
//
|
||||||
// Also start with a '#' symbol and a comma separated list will be
|
// Also start with a '#' symbol and a comma separated list will be
|
||||||
// turned into a number of the same entries.
|
// turned into a number of the same entries.
|
||||||
@ -30,129 +30,137 @@
|
|||||||
var $type = 'csv';
|
var $type = 'csv';
|
||||||
|
|
||||||
var $import = array(
|
var $import = array(
|
||||||
"Title" => "title",
|
'Title' => 'title',
|
||||||
"First Name" => "n_given",
|
'First Name' => 'n_given',
|
||||||
"Middle Name" => "n_middle",
|
'Middle Name' => 'n_middle',
|
||||||
"Last Name" => "n_family",
|
'Last Name' => 'n_family',
|
||||||
"Suffix" => "n_suffix",
|
'Suffix' => 'n_suffix',
|
||||||
"Company" => "org_name", //objectclass: organization
|
'Company' => 'org_name', //objectclass: organization
|
||||||
"Department" => "org_unit", //objectclass: organizationalPerson
|
'Department' => 'org_unit', //objectclass: organizationalPerson
|
||||||
"Job Title" => "title", //objectclass: organizationalPerson
|
'Job Title' => 'title', //objectclass: organizationalPerson
|
||||||
"Business Street" => "adr_one_street",
|
'Business Street' => 'adr_one_street',
|
||||||
"Business Street 2" => "address2",
|
'Business Street 2' => 'address2',
|
||||||
"Business Street 3" => "address3",
|
'Business Street 3' => 'address3',
|
||||||
"Business City" => "adr_one_locality",
|
'Business City' => 'adr_one_locality',
|
||||||
"Business State" => "adr_one_region",
|
'Business State' => 'adr_one_region',
|
||||||
"Business Postal Code" => "adr_one_postalcode",
|
'Business Postal Code' => 'adr_one_postalcode',
|
||||||
"Business Country" => "adr_one_countryname",
|
'Business Country' => 'adr_one_countryname',
|
||||||
"Home Street" => "adr_two_street",
|
'Home Street' => 'adr_two_street',
|
||||||
"Home City" => "adr_two_locality",
|
'Home City' => 'adr_two_locality',
|
||||||
"Home State" => "adr_two_region",
|
'Home State' => 'adr_two_region',
|
||||||
"Home Postal Code" => "adr_two_postalcode",
|
'Home Postal Code' => 'adr_two_postalcode',
|
||||||
"Home Country" => "adr_two_countryname",
|
'Home Country' => 'adr_two_countryname',
|
||||||
"Home Street 2" => "",
|
'Home Street 2' => '',
|
||||||
"Home Street 3" => "",
|
'Home Street 3' => '',
|
||||||
"Other Street" => "",
|
'Other Street' => '',
|
||||||
"Other City" => "",
|
'Other City' => '',
|
||||||
"Other State" => "",
|
'Other State' => '',
|
||||||
"Other Postal Code" => "",
|
'Other Postal Code' => '',
|
||||||
"Other Country" => "",
|
'Other Country' => '',
|
||||||
"Assistant's Phone" => "tel_msg",
|
"Assistant's Phone" => 'tel_msg',
|
||||||
"Business Fax" => "tel_fax",
|
'Business Fax' => 'tel_fax',
|
||||||
"Business Phone" => "tel_work",
|
'Business Phone' => 'tel_work',
|
||||||
"Business Phone 2" => "ophone",
|
'Business Phone 2' => 'ophone',
|
||||||
"Callback" => "",
|
'Callback' => '',
|
||||||
"Car Phone" => "tel_car",
|
'Car Phone' => 'tel_car',
|
||||||
"Company Main Phone" => "",
|
'Company Main Phone' => '',
|
||||||
"Home Fax" => "",
|
'Home Fax' => '',
|
||||||
"Home Phone" => "tel_home",
|
'Home Phone' => 'tel_home',
|
||||||
"Home Phone 2" => "", //This will make another homePhone entry
|
'Home Phone 2' => '', //This will make another homePhone entry
|
||||||
"ISDN" => "tel_isdn",
|
'ISDN' => 'tel_isdn',
|
||||||
"Mobile Phone" => "tel_cell", //newPilotPerson
|
'Mobile Phone' => 'tel_cell', //newPilotPerson
|
||||||
"Other Fax" => "",
|
'Other Fax' => '',
|
||||||
"Other Phone" => "",
|
'Other Phone' => '',
|
||||||
"Pager" => "tel_pager",
|
'Pager' => 'tel_pager',
|
||||||
"Primary Phone" => "",
|
'Primary Phone' => '',
|
||||||
"Radio Phone" => "",
|
'Radio Phone' => '',
|
||||||
"TTY/TDD Phone" => "",
|
'TTY/TDD Phone' => '',
|
||||||
"Telex" => "", //organization
|
'Telex' => '', //organization
|
||||||
"Account" => "",
|
'Account' => '',
|
||||||
"Anniversary" => "",
|
'Anniversary' => '',
|
||||||
"Assistant's Name" => "", //newPilotPerson
|
"Assistant's Name" => '', //newPilotPerson
|
||||||
"Billing Information" => "",
|
'Billing Information' => '',
|
||||||
"Birthday" => "bday",
|
'Birthday' => 'bday',
|
||||||
"Categories" => "",
|
'Categories' => '',
|
||||||
"Children" => "",
|
'Children' => '',
|
||||||
"Directory Server" => "",
|
'Directory Server' => '',
|
||||||
"E-mail Address" => "email",
|
'E-mail Address' => 'email',
|
||||||
"E-mail Display Name" => "",
|
'E-mail Display Name' => '',
|
||||||
"E-mail 2 Address" => "email_home",
|
'E-mail 2 Address' => 'email_home',
|
||||||
"E-mail 2 Display Name" => "",
|
'E-mail 2 Display Name' => '',
|
||||||
"E-mail 3 Address" => "", //add another...
|
'E-mail 3 Address' => '', //add another...
|
||||||
"E-mail 3 Display Name" => "",
|
'E-mail 3 Display Name' => '',
|
||||||
"Gender" => "",
|
'Gender' => '',
|
||||||
"Government ID Number" => "",
|
'Government ID Number' => '',
|
||||||
"Hobby" => "",
|
'Hobby' => '',
|
||||||
"Initials" => "",
|
'Initials' => '',
|
||||||
"Internet Free Busy" => "",
|
'Internet Free Busy' => '',
|
||||||
"Keywords" => "",
|
'Keywords' => '',
|
||||||
"Language" => "",
|
'Language' => '',
|
||||||
"Location" => "",
|
'Location' => '',
|
||||||
"Manager's Name" => "",
|
"Manager's Name" => '',
|
||||||
"Mileage" => "",
|
'Mileage' => '',
|
||||||
"Notes" => "note",
|
'Notes' => 'note',
|
||||||
"Office Location" => "",
|
'Office Location' => '',
|
||||||
"Organizational ID Number" => "",
|
'Organizational ID Number' => '',
|
||||||
"PO Box" => "",
|
'PO Box' => '',
|
||||||
"Priority" => "",
|
'Priority' => '',
|
||||||
"Private Profession" => "",
|
'Private Profession' => '',
|
||||||
"Referred By" => "",
|
'Referred By' => '',
|
||||||
"Sensitivity" => "",
|
'Sensitivity' => '',
|
||||||
"Spouse" => "",
|
'Spouse' => '',
|
||||||
"User 1" => "",
|
'User 1' => '',
|
||||||
"User 2" => "",
|
'User 2' => '',
|
||||||
"User 3" => "",
|
'User 3' => '',
|
||||||
"User 4" => "",
|
'User 4' => '',
|
||||||
"Web Page" => "url"
|
'Web Page' => 'url'
|
||||||
);
|
);
|
||||||
|
|
||||||
function import_start_file($buffer,$j="",$k="") {
|
function import_start_file($buffer)
|
||||||
|
{
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_start_record($buffer) {
|
function import_start_record($buffer)
|
||||||
|
{
|
||||||
$top=array();
|
$top=array();
|
||||||
++$this->id;
|
++$this->id;
|
||||||
$this->currentrecord = $top;
|
$this->currentrecord = $top;
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_new_attrib($buffer,$name,$value) {
|
function import_new_attrib($buffer,$name,$value)
|
||||||
|
{
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$value = str_replace("\n","<BR>",$value);
|
$value = str_replace('\n','<BR>',$value);
|
||||||
$value = str_replace("\r","",$value);
|
$value = str_replace('\r','',$value);
|
||||||
$this->currentrecord += array($name => $value);
|
$this->currentrecord += array($name => $value);
|
||||||
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_record($buffer) {
|
function import_end_record($buffer)
|
||||||
|
{
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
$buffer[$this->id]="";
|
$buffer[$this->id]='';
|
||||||
while ( list($name, $value) = each($this->currentrecord)) {
|
while ( list($name, $value) = each($this->currentrecord))
|
||||||
|
{
|
||||||
$buffer[$this->id][$name] = $value;
|
$buffer[$this->id][$name] = $value;
|
||||||
//echo '<br>'.$name.' => '.$value;
|
//echo '<br>'.$name.' => '.$value;
|
||||||
}
|
}
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_file($buffer,$access="private",$cat_id=0) {
|
function import_end_file($buffer,$access='private',$cat_id=0)
|
||||||
|
{
|
||||||
global $phpgw,$phpgw_info;
|
global $phpgw,$phpgw_info;
|
||||||
|
|
||||||
$contacts = CreateObject("phpgwapi.contacts");
|
$contacts = CreateObject('phpgwapi.contacts');
|
||||||
//echo '<br>';
|
//echo '<br>';
|
||||||
for ($i=1;$i<=count($buffer);$i++) {
|
for ($i=1;$i<=count($buffer);$i++)
|
||||||
while ( list($name,$value) = @each($buffer[$i]) ) {
|
{
|
||||||
|
while ( list($name,$value) = @each($buffer[$i]) )
|
||||||
|
{
|
||||||
//echo '<br>'.$i.': '.$name.' => '.$value;
|
//echo '<br>'.$i.': '.$name.' => '.$value;
|
||||||
$entry[$i][$name] = $value;
|
$entry[$i][$name] = $value;
|
||||||
}
|
}
|
||||||
@ -161,10 +169,10 @@
|
|||||||
$entry[$i]['adr_one_type'] = 'intl';
|
$entry[$i]['adr_one_type'] = 'intl';
|
||||||
$entry[$i]['adr_two_type'] = 'intl';
|
$entry[$i]['adr_two_type'] = 'intl';
|
||||||
//echo '<br>';
|
//echo '<br>';
|
||||||
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i],$access,$cat_id);
|
$contacts->add($phpgw_info['user']['account_id'],$entry[$i],$access,$cat_id);
|
||||||
}
|
}
|
||||||
$num = $i - 1;
|
$num = $i - 1;
|
||||||
return "Successfully imported $num records into your addressbook.";
|
return lang('Successfully imported x records into your addressbook.',$num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
// before the value. For example, the following would add a comma and
|
// before the value. For example, the following would add a comma and
|
||||||
// a space between LastName and FirstName and store it in FullName:
|
// a space between LastName and FirstName and store it in FullName:
|
||||||
//
|
//
|
||||||
// array("LastName" => "FullName","FirstName" => "+, ");
|
// array('LastName' => 'FullName','FirstName' => '+, ');
|
||||||
//
|
//
|
||||||
// Also start with a '#' symbol and a comma separated list will be
|
// Also start with a '#' symbol and a comma separated list will be
|
||||||
// turned into a number of the same entries.
|
// turned into a number of the same entries.
|
||||||
@ -36,53 +36,60 @@
|
|||||||
// This will be populated via the vcard->import var
|
// This will be populated via the vcard->import var
|
||||||
var $import = array();
|
var $import = array();
|
||||||
|
|
||||||
function import_start_file($buffer,$j="",$k="") {
|
function import_start_file($buffer)
|
||||||
|
{
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
$this->contacts = CreateObject("phpgwapi.contacts");
|
$this->contacts = CreateObject('phpgwapi.contacts');
|
||||||
$this->vcard = CreateObject("phpgwapi.vcard");
|
$this->vcard = CreateObject('phpgwapi.vcard');
|
||||||
$this->import = $this->vcard->import;
|
$this->import = $this->vcard->import;
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_start_record($buffer) {
|
function import_start_record($buffer)
|
||||||
|
{
|
||||||
++$this->id;
|
++$this->id;
|
||||||
$this->currentrecord = array();
|
$this->currentrecord = array();
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_new_attrib($buffer,$name,$value) {
|
function import_new_attrib($buffer,$name,$value)
|
||||||
|
{
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$value = ereg_replace("=0D=0A","\n",$value);
|
$value = ereg_replace('=0D=0A','\n',$value);
|
||||||
//echo '<br>'.$this->id.": ".$name.' => '.$value;
|
//echo '<br>'.$this->id.': '.$name.' => '.$value;
|
||||||
$this->currentrecord += array($name => $value);
|
$this->currentrecord += array($name => $value);
|
||||||
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_record($buffer) {
|
function import_end_record($buffer)
|
||||||
|
{
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
$buffer[$this->id]="";
|
$buffer[$this->id]='';
|
||||||
while ( list($name, $value) = each($this->currentrecord)) {
|
while ( list($name, $value) = each($this->currentrecord))
|
||||||
|
{
|
||||||
$buffer[$this->id][$name] = $value;
|
$buffer[$this->id][$name] = $value;
|
||||||
//$buffer[$this->id]["private"] = $private;
|
//$buffer[$this->id]['private'] = $private;
|
||||||
//echo '<br>'.$name.' => '.$value;
|
//echo '<br>'.$name.' => '.$value;
|
||||||
}
|
}
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_end_file($buffer,$access="private",$cat_id=0) {
|
function import_end_file($buffer,$access='private',$cat_id=0)
|
||||||
|
{
|
||||||
global $phpgw,$phpgw_info;
|
global $phpgw,$phpgw_info;
|
||||||
|
|
||||||
for ($i=1;$i<=count($buffer);$i++) {
|
for ($i=1;$i<=count($buffer);$i++)
|
||||||
|
{
|
||||||
// Send the entire array to the vcard class in function.
|
// Send the entire array to the vcard class in function.
|
||||||
// It will parse the vcard fields and clean the array of extra
|
// It will parse the vcard fields and clean the array of extra
|
||||||
// bogus values that get stuffed in.
|
// bogus values that get stuffed in.
|
||||||
$entry = $this->vcard->in($buffer[$i]);
|
$entry = $this->vcard->in($buffer[$i]);
|
||||||
// Now actually add the new entry
|
// Now actually add the new entry
|
||||||
$this->contacts->add($phpgw_info["user"]["account_id"],$entry,$access,$cat_id);
|
$this->contacts->add($phpgw_info['user']['account_id'],$entry,$access,$cat_id);
|
||||||
}
|
}
|
||||||
$num = $i - 1;
|
$num = $i - 1;
|
||||||
return "Successfully imported $num records into your addressbook.";
|
return lang('Successfully imported x records into your addressbook.',$num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user