diff --git a/addressbook/add.php b/addressbook/add.php index 520f55b6ca..237d94933d 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -1,16 +1,16 @@ * -* -------------------------------------------- * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 2 of the License, or (at your * -* option) any later version. * -\**************************************************************************/ + /**************************************************************************\ + * phpGroupWare - addressbook * + * http://www.phpgroupware.org * + * Written by Joseph Engo * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ -/* $Id$ */ + /* $Id$ */ if ($submit || $AddVcard) { $phpgw_info["flags"] = array( @@ -42,7 +42,7 @@ if ($AddVcard){ Header("Location: " . $phpgw->link("/addressbook/vcardin.php")); } else if ($add_email) { - list($fields["firstname"],$fields["lastname"]) = explode(" ", $name); + list($fields["n_given"],$fields["n_family"]) = explode(" ", $name); $fields["email"] = $add_email; addressbook_form("","add.php","Add",$fields,'',$cat_id); } else if (! $submit && ! $add_email) { @@ -164,9 +164,9 @@ addressbook_add_entry($phpgw_info["user"]["account_id"],$fields,$fields["access"],$fields["cat_id"]); $ab_id = addressbook_get_lastid(); - + $referer = urlencode($referer); Header("Location: " - . $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&cat_id=$cat_id")); + . $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&cat_id=$cat_id&referer=$referer")); $phpgw->common->phpgw_exit(); } diff --git a/addressbook/edit.php b/addressbook/edit.php index 1dce23fe64..82fa9631ed 100755 --- a/addressbook/edit.php +++ b/addressbook/edit.php @@ -177,9 +177,9 @@ } addressbook_update_entry($ab_id,$userid,$fields,$fields['access'],$fields["cat_id"]); - + $referer = urlencode($referer); Header("Location: " - . $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); + . $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id&referer=$referer")); $phpgw->common->phpgw_exit(); } diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index d858856a57..339fe44374 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -222,7 +222,7 @@ // Folowing used for add/edit function addressbook_form($format,$action,$title="",$fields="",$customfields="",$cat_id="") { - global $phpgw, $phpgw_info; + global $phpgw, $phpgw_info,$referer; $t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t->set_file(array( "form" => "form.tpl")); @@ -429,7 +429,7 @@ } if ($action) { - echo "
link('/addressbook/' . $action)."\" method=\"post\">\n"; + echo "link('/addressbook/' . $action.'?referer='.urlencode($referer))."\" method=\"post\">\n"; } if (! ereg("^http://",$url)) { diff --git a/addressbook/view.php b/addressbook/view.php index 9172044723..6ef2329146 100755 --- a/addressbook/view.php +++ b/addressbook/view.php @@ -138,13 +138,28 @@ if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id'])) { - $t->set_var('edit_link',''); + if ($referer) + { + $t->set_var('edit_link',''); + } + else + { + $t->set_var('edit_link',''); + } $t->set_var('edit_button',''); } $copylink = ''; $vcardlink = ''; - $donelink = ''; + if ($referer) + { + $referer = ereg_replace('/phpgroupware','',$referer); + $donelink = ''; + } + else + { + $donelink = ''; + } $t->set_var("access_link",$access_link); $t->set_var("ab_id",$ab_id);