Category selection on import

This commit is contained in:
Miles Lott 2001-03-27 17:17:46 +00:00
parent 9917a39116
commit bb2a6c38c4
9 changed files with 25 additions and 22 deletions

View File

@ -52,11 +52,14 @@
}
$t->set_var("lang_cancel",lang("Cancel"));
$t->set_var("cancel_url",$phpgw->link("/addressbook/index.php"));
$t->set_var("lang_cat",lang("Select Category"));
$t->set_var("cancel_url",$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$t->set_var("navbar_bg",$phpgw_info["theme"]["navbar_bg"]);
$t->set_var("navbar_text",$phpgw_info["theme"]["navbar_text"]);
$t->set_var("import_text",lang("Import from Outlook (CSV) or Netscape (LDIF)"));
$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("cat_id",cat_option($cat_id,True));
$t->set_var("tsvfilename","");
$t->set_var("conv",$conv);
$t->set_var("debug",lang("Debug output in browser"));
@ -148,13 +151,13 @@
}
}
} else {
$buffer = $this->import_end_record($buffer,$private);
$buffer = $this->import_end_record($buffer);
}
}
}
fclose($fp);
$buffer = $this->import_end_file($buffer);
$buffer = $this->import_end_file($buffer,$private,$cat_id);
if ($download == "") {
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" ) {

View File

@ -70,18 +70,17 @@
return $buffer;
}
function import_end_record($buffer,$private="private") {
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>'.$this->id.': '.$name.' => '.$value;
}
$buffer[$this->id]['access'] = $private;
return $buffer;
}
function import_end_file($buffer) {
function import_end_file($buffer,$access="private",$cat_id=0) {
global $phpgw,$phpgw_info;
$contacts = CreateObject("phpgwapi.contacts");
@ -96,7 +95,7 @@
$entry[$i]['adr_one_type'] = 'intl';
$entry[$i]['adr_two_type'] = 'intl';
//echo '<br>';
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i]);
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i],$access,$cat_id);
}
$num = $i - 1;
return "Successfully imported $num records into your addressbook.";

View File

@ -136,18 +136,17 @@
return $buffer;
}
function import_end_record($buffer,$private="private") {
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;
}
$buffer[$this->id]['access'] = $private;
return $buffer;
}
function import_end_file($buffer) {
function import_end_file($buffer,$access="private",$cat_id=0) {
global $phpgw,$phpgw_info;
$contacts = CreateObject("phpgwapi.contacts");
@ -162,7 +161,7 @@
$entry[$i]['adr_one_type'] = 'intl';
$entry[$i]['adr_two_type'] = 'intl';
//echo '<br>';
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i]);
$contacts->add($phpgw_info["user"]["account_id"],$entry[$i],$access,$cat_id);
}
$num = $i - 1;
return "Successfully imported $num records into your addressbook.";

View File

@ -59,7 +59,7 @@
return $buffer;
}
function import_end_record($buffer,$private="private") {
function import_end_record($buffer) {
global $phpgw_info;
$buffer[$this->id]="";
while ( list($name, $value) = each($this->currentrecord)) {
@ -67,11 +67,10 @@
//$buffer[$this->id]["private"] = $private;
//echo '<br>'.$name.' => '.$value;
}
$buffer[$this->id]['access'] = $private;
return $buffer;
}
function import_end_file($buffer) {
function import_end_file($buffer,$access="private",$cat_id=0) {
global $phpgw,$phpgw_info;
for ($i=1;$i<=count($buffer);$i++) {
@ -80,7 +79,7 @@
// bogus values that get stuffed in.
$entry = $this->vcard->in($buffer[$i]);
// Now actually add the new entry
$this->contacts->add($phpgw_info["user"]["account_id"],$entry);
$this->contacts->add($phpgw_info["user"]["account_id"],$entry,$access,$cat_id);
}
$num = $i - 1;
return "Successfully imported $num records into your addressbook.";

View File

@ -12,21 +12,24 @@
<TR>
<TD><FORM ENCTYPE="multipart/form-data" action="{action_url}" method="post">
<OL>
<LI>In Outlook, select your Contacts folder, select <b>Import
<LI>In Netscape, open the Addressbook and select <b>Export</b> from the <b>File</b> menu.
The file exported will be in LDIF format.
<P>Or, in Outlook, select your Contacts folder, select <b>Import
and Export...</b> from the <b>File</b>
menu and export your contacts into a comma separated text file.
<P>Or, in Netscape, open the Addressbook and select <b>Export</b> from the <b>File</b> menu.
The file exported will be in LDIF format.<P>
menu and export your contacts into a comma separated text (CSV) file.
<P>Or, in Palm Desktop 4.0 or greater, visit your addressbook and select <b>Export</b> from the <b>File</b> menu.
The file exported will be in VCard format.<P>
</LI>
<LI>Enter the path to the exported file here:
<INPUT NAME="tsvfile" SIZE=48 TYPE="file" VALUE="{tsvfilename}"><P></LI>
<LI>Select the type of conversion (Import types will perform an actual import. Debug will display output in browser or via a download.):<BR>
<LI>Select the type of conversion:
<SELECT NAME="conv_type">
<OPTION VALUE="none">&lt;none&gt;</OPTION>
{conv}
</SELECT><P></LI>
<LI><INPUT NAME="download" TYPE="checkbox" VALUE="{debug}" CHECKED>Debug output in browser (Uncheck to download output.)</LI>
<LI>{lang_cat}:{cat_id}</LI>
<LI><INPUT NAME="private" TYPE="checkbox" VALUE="private" CHECKED>Mark records as private</LI>
<LI><INPUT NAME="download" TYPE="checkbox" VALUE="{debug}" CHECKED>Debug output in browser</LI>
<LI><INPUT NAME="convert" TYPE="submit" VALUE="{download}"></LI>
</OL>
</FORM></TD>