From 6b990a110e6d89624893b0d0c8f38bac7f53168d Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Mon, 9 Jul 2001 23:20:46 +0000 Subject: [PATCH] Fix export, remove incomplete Italian import file --- addressbook/inc/class.boXport.inc.php | 10 +- addressbook/inc/class.boaddressbook.inc.php | 8 +- addressbook/inc/class.uiXport.inc.php | 39 ++-- addressbook/inc/class.uiaddressbook.inc.php | 14 +- addressbook/inc/class.uivcard.inc.php | 8 +- .../inc/import/Import_from_Outlook_-_Italiano | 210 ------------------ 6 files changed, 45 insertions(+), 244 deletions(-) delete mode 100644 addressbook/inc/import/Import_from_Outlook_-_Italiano diff --git a/addressbook/inc/class.boXport.inc.php b/addressbook/inc/class.boXport.inc.php index 5029e64d7d..f5cfa95b2b 100644 --- a/addressbook/inc/class.boXport.inc.php +++ b/addressbook/inc/class.boXport.inc.php @@ -236,7 +236,7 @@ $phpgw->common->phpgw_header(); echo parse_navbar(); echo "
$buffer
"; - echo ''.lang("OK").''; + echo ''.lang("OK").''; $phpgw->common->phpgw_footer(); } } @@ -245,14 +245,14 @@ $phpgw->common->phpgw_header(); echo parse_navbar(); echo "
$buffer
"; - echo ''.lang("OK").''; + echo ''.lang("OK").''; $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;$iids);$i++) diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index 90f740bbef..7aa721fbff 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -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) diff --git a/addressbook/inc/class.uiXport.inc.php b/addressbook/inc/class.uiXport.inc.php index f3d3a4880c..0246b85d42 100644 --- a/addressbook/inc/class.uiXport.inc.php +++ b/addressbook/inc/class.uiXport.inc.php @@ -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 "
$buffer
"; - echo ''.lang("OK").''; + echo ''.lang("OK").''; $phpgw->common->phpgw_footer(); } } @@ -103,7 +104,7 @@ $phpgw->common->phpgw_header(); echo parse_navbar(); echo "
$buffer
"; - echo ''.lang("OK").''; + echo ''.lang("OK").''; $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('No conversion type <none> could be located. Please choose a conversion type from the list'); - echo ' '.lang('OK').''; + echo ' ' . lang('OK') . ''; $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 "
\n";
 					echo $buffer;
 					echo "\n
\n"; - echo ''.lang('OK').''; + echo '' . lang('OK') . ''; $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('')); diff --git a/addressbook/inc/class.uiaddressbook.inc.php b/addressbook/inc/class.uiaddressbook.inc.php index fab61accbf..4bb7e168f6 100644 --- a/addressbook/inc/class.uiaddressbook.inc.php +++ b/addressbook/inc/class.uiaddressbook.inc.php @@ -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)); } diff --git a/addressbook/inc/class.uivcard.inc.php b/addressbook/inc/class.uivcard.inc.php index f2fe6542c1..2cfee973b4 100644 --- a/addressbook/inc/class.uivcard.inc.php +++ b/addressbook/inc/class.uivcard.inc.php @@ -59,7 +59,7 @@ $this->template->set_file(array('vcardin' => 'vcardin.tpl')); $this->template->set_var('vcard_header','

 ' . lang('Address book - VCard in') . '


'); - $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) diff --git a/addressbook/inc/import/Import_from_Outlook_-_Italiano b/addressbook/inc/import/Import_from_Outlook_-_Italiano deleted file mode 100644 index b0bc118330..0000000000 --- a/addressbook/inc/import/Import_from_Outlook_-_Italiano +++ /dev/null @@ -1,210 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// 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','
',$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 '
'.$name.' => '.$value; - } - return $buffer; - } - - function import_end_file($buffer,$access='private',$cat_id=0) - { - global $phpgw,$phpgw_info; - - $contacts = CreateObject('phpgwapi.contacts'); - //echo '
'; - for ($i=1;$i<=count($buffer);$i++) - { - while ( list($name,$value) = @each($buffer[$i]) ) - { - //echo '
'.$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 '
'; - $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); - } - } -?>