Add copy button on view page to create copy of viewed entry, fix vcard notes

This commit is contained in:
Miles Lott 2001-03-17 23:52:36 +00:00
parent 33e1003670
commit 9eb084831e
4 changed files with 33 additions and 2 deletions

View File

@ -47,6 +47,22 @@
addressbook_form("","add.php","Add",$fields);
} else if (! $submit && ! $add_email) {
addressbook_form("","add.php","Add","");
} elseif ($submit && $fields) {
// This came from the view form, Copy entry
$extrafields = array(
"ophone" => "ophone",
"address2" => "address2",
"address3" => "address3"
);
$qfields = $this->stock_contact_fields + $extrafields + $customfields;
$addnew = unserialize(rawurldecode($fields));
$addnew['note'] .= "\nCopied from ".$phpgw->accounts->id2name($addnew['owner']).", record #".$addnew['id'].".";
$addnew['owner'] = $phpgw_info["user"]["account_id"];
$addnew['id'] = '';
addressbook_add_entry($addnew['owner'],$addnew);
$fields = addressbook_read_last_entry($qfields);
$newid = $fields[0]['id'];
Header("Location: " . $phpgw->link('/addressbook/edit.php',"&ab_id=$newid&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
} else {
if (! $bday_month && ! $bday_day && ! $bday_year) {
$bday = "";

View File

@ -12,6 +12,16 @@
<TD align="left">
{edit_link}
</TD>
<TD align=left>
{copy_link}
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="fields" value="{copy_fields}">
<input type="submit" name="submit" value="{lang_copy}">
</form>
</TD>
<TD align=left>
{vcard_link}
<input type="hidden" name="ab_id" value="{ab_id}">

View File

@ -97,7 +97,7 @@
$company = $fields["org_name"];
$dept = $fields["org_unit"];
$bday = $fields["bday"];
$notes = $fields["note"];
$notes = ereg_replace("\r\n","=0A",$fields["note"]);
$access = $fields["access"];
$url = $fields["url"];
@ -191,7 +191,7 @@
$NOTES .= $notes;
if($NOTES != "") /* All of the notes. */
printf("NOTE:%s\r\n", $NOTES);
printf("NOTE;QUOTED-PRINTABLE:%s\r\n", $NOTES);
/* End of Stuff. */
printf("VERSION:2.1\r\n");
printf("END:VCARD\r\n");

View File

@ -98,7 +98,9 @@
. $phpgw->common->grab_owner_name($record_owner) . '</td><td><b>'
. $access_link . '</b></td><td></table>';
$sfields = rawurlencode(serialize($fields[0]));
$editlink = $phpgw->common->check_owner($record_owner,"/addressbook/edit.php",lang("edit"),"ab_id=" . $ab_id . "&start=".$start."&sort=".$sort."&order=".$order);
$copylink = '<form action="'.$phpgw->link("/addressbook/add.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
$vcardlink = '<form action="'.$phpgw->link("/addressbook/vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
$donelink = '<form action="'.$phpgw->link("/addressbook/index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
@ -113,10 +115,13 @@
$t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_done",lang("done"));
$t->set_var("lang_edit",lang("edit"));
$t->set_var("lang_copy",lang("copy"));
$t->set_var("copy_fields",$sfields);
$t->set_var("lang_submit",lang("submit"));
$t->set_var("lang_vcard",lang("vcard"));
$t->set_var("done_link",$donelink);
$t->set_var("edit_link",$editlink);
$t->set_var("copy_link",$copylink);
$t->set_var("vcard_link",$vcardlink);
$t->parse("out","view");