Changing tabs to spaces, hope this still works.

This commit is contained in:
Miles Lott 2001-02-10 12:56:49 +00:00
parent 2aea2d586c
commit d6ea3f792f
14 changed files with 1345 additions and 1385 deletions

View File

@ -1,98 +1,96 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($submit || $AddVcard) { if ($submit || $AddVcard) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["currentapp"] = "addressbook";
$phpgw_info["flags"]["enable_addressbook_class"] = True;
include("../header.inc.php");
#$t = new Template($phpgw_info["server"]["app_tpl"]);
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array("add" => "add.tpl"));
$this = CreateObject("phpgwapi.contacts");
if ($AddVcard){
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] .
"/addressbook/vcardin.php"));
} else if ($add_email) {
list($fields["firstname"],$fields["lastname"]) = explode(" ", $name);
$fields["email"] = $add_email;
form("","add.php","Add",$fields);
} else if (! $submit && ! $add_email) {
form("","add.php","Add","","","");
} else {
if (! $bday_month && ! $bday_day && ! $bday_year) {
$bday = "";
} else {
$bday = "$bday_month/$bday_day/$bday_year";
}
if ($access != "private" && $access != "public") {
$access = $phpgw->accounts->array_to_string($access,$n_groups);
}
if ($url == "http://") {
$url = "";
}
$phpgw_info["flags"]["currentapp"] = "addressbook"; $fields["org_name"] = $company;
$phpgw_info["flags"]["enable_addressbook_class"] = True; $fields["org_unit"] = $department;
include("../header.inc.php"); $fields["n_given"] = $firstname;
$fields["n_family"] = $lastname;
#$t = new Template($phpgw_info["server"]["app_tpl"]); $fields["n_middle"] = $middle;
$t = new Template($phpgw->common->get_tpl_dir("addressbook")); $fields["n_prefix"] = $prefix;
$t->set_file(array( "add" => "add.tpl")); $fields["n_suffix"] = $suffix;
if ($prefix) { $pspc = " "; }
if ($middle) { $mspc = " "; }
if ($suffix) { $sspc = " "; }
$fields["fn"] = $prefix.$pspc.$firstname.$mspc.$middle.$mspc.$lastname.$sspc.$suffix;
$fields["d_email"] = $email;
$fields["d_emailtype"] = $email_type;
$fields["title"] = $title;
$fields["a_tel"] = $wphone;
$fields["b_tel"] = $hphone;
$fields["c_tel"] = $fax;
$fields["pager"] = $pager;
$fields["mphone"] = $mphone;
$fields["ophone"] = $ophone;
$fields["adr_street"] = $street;
$fields["address2"] = $address2;
$fields["adr_locality"] = $city;
$fields["adr_region"] = $state;
$fields["adr_postalcode"] = $zip;
$fields["adr_Countryname"] = $country;
$fields["tz"] = $timezone;
$fields["bday"] = $bday;
$fields["url"] = $url;
$fields["notes"] = $notes;
$fields["access"] = $access;
$this->add($phpgw_info["user"]["account_id"],$fields);
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]."/addressbook/","cd=14"));
}
$this = CreateObject("phpgwapi.contacts"); $t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_clear",lang("clear"));
if ($AddVcard){ $t->set_var("lang_cancel",lang("cancel"));
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . $t->set_var("cancel_url",$phpgw->link("index.php?sort=$sort&order=$order&filter=$filter&start=$start"));
"/addressbook/vcardin.php")); $t->parse("out","add");
} $t->pparse("out","add");
else if ($add_email) {
list($fields["firstname"],$fields["lastname"]) = explode(" ", $name); $phpgw->common->phpgw_footer();
$fields["email"] = $add_email;
form("","add.php","Add",$fields);
} else if (! $submit && ! $add_email) {
form("","add.php","Add","","","");
} else {
if (! $bday_month && ! $bday_day && ! $bday_year) {
$bday = "";
} else {
$bday = "$bday_month/$bday_day/$bday_year";
}
if ($access != "private" && $access != "public") {
$access = $phpgw->accounts->array_to_string($access,$n_groups);
}
if ($url == "http://") {
$url = "";
}
$fields["org_name"] = $company;
$fields["org_unit"] = $department;
$fields["n_given"] = $firstname;
$fields["n_family"] = $lastname;
$fields["n_middle"] = $middle;
$fields["n_prefix"] = $prefix;
$fields["n_suffix"] = $suffix;
if ($prefix) { $pspc = " "; }
if ($middle) { $mspc = " "; }
if ($suffix) { $sspc = " "; }
$fields["fn"] = $prefix . $pspc . $firstname . $mspc . $middle . $mspc . $lastname . $sspc . $suffix;
$fields["d_email"] = $email;
$fields["d_emailtype"] = $email_type;
$fields["title"] = $title;
$fields["a_tel"] = $wphone;
$fields["b_tel"] = $hphone;
$fields["c_tel"] = $fax;
$fields["pager"] = $pager;
$fields["mphone"] = $mphone;
$fields["ophone"] = $ophone;
$fields["adr_street"] = $street;
$fields["address2"] = $address2;
$fields["adr_locality"] = $city;
$fields["adr_region"] = $state;
$fields["adr_postalcode"] = $zip;
$fields["adr_Countryname"] = $country;
$fields["tz"] = $timezone;
$fields["bday"] = $bday;
$fields["url"] = $url;
$fields["notes"] = $notes;
$fields["access"] = $access;
$this->add($phpgw_info["user"]["account_id"],$fields);
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/",
"cd=14"));
}
$t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_clear",lang("clear"));
$t->set_var("lang_cancel",lang("cancel"));
$t->set_var("cancel_url",$phpgw->link("index.php?sort=$sort&order=$order&filter=$filter&start=$start"));
$t->parse("out","add");
$t->pparse("out","add");
$phpgw->common->phpgw_footer();
?> ?>

View File

@ -27,14 +27,14 @@ class outlook_conv {
var $currentrecord; //used for buffering to allow uid lines to go first var $currentrecord; //used for buffering to allow uid lines to go first
var $outlook = array( var $outlook = 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" => "address2", "Business Street" => "address2",
"Business Street 2" => "", "Business Street 2" => "",
"Business Street 3" => "", "Business Street 3" => "",
@ -42,11 +42,11 @@ class outlook_conv {
"Business State" => "", "Business State" => "",
"Business Postal Code" => "", "Business Postal Code" => "",
"Business Country" => "", "Business Country" => "",
"Home Street" => "ADR_Street", "Home Street" => "adr_street",
"Home City" => "ADR_Locality", "Home City" => "adr_locality",
"Home State" => "ADR_Region", "Home State" => "adr_region",
"Home Postal Code" => "ADR_PostalCode", "Home Postal Code" => "adr_postalcode",
"Home Country" => "ADR_CountryName", "Home Country" => "adr_countryname",
"Home Street 2" => "", "Home Street 2" => "",
"Home Street 3" => "", "Home Street 3" => "",
"Other Street" => "", "Other Street" => "",
@ -55,14 +55,14 @@ class outlook_conv {
"Other Postal Code" => "", "Other Postal Code" => "",
"Other Country" => "", "Other Country" => "",
"Assistant's Phone" => "", "Assistant's Phone" => "",
"Business Fax" => "C_TEL", "Business Fax" => "c_tel",
"Business Phone" => "B_TEL", "Business Phone" => "b_tel",
"Business Phone 2" => "ophone", "Business Phone 2" => "ophone",
"Callback" => "", "Callback" => "",
"Car Phone" => "", "Car Phone" => "",
"Company Main Phone" => "", "Company Main Phone" => "",
"Home Fax" => "", "Home Fax" => "",
"Home Phone" => "A.TEL", "Home Phone" => "a.tel",
"Home Phone 2" => "", //This will make another homePhone entry "Home Phone 2" => "", //This will make another homePhone entry
"ISDN" => "", "ISDN" => "",
"Mobile Phone" => "mphone", //newPilotPerson "Mobile Phone" => "mphone", //newPilotPerson
@ -81,7 +81,7 @@ class outlook_conv {
"Categories" => "", "Categories" => "",
"Children" => "", "Children" => "",
"Directory Server" => "", "Directory Server" => "",
"E-mail Address" => "D_EMAIL", "E-mail Address" => "d_email",
"E-mail Display Name" => "", "E-mail Display Name" => "",
"E-mail 2 Address" => "", "E-mail 2 Address" => "",
"E-mail 2 Display Name" => "", "E-mail 2 Display Name" => "",

View File

@ -28,12 +28,12 @@ class outlook_conv {
var $outlook = array( var $outlook = 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" => "address2", "Business Street" => "address2",
"Business Street 2" => "", "Business Street 2" => "",
@ -42,11 +42,11 @@ class outlook_conv {
"Business State" => "", "Business State" => "",
"Business Postal Code" => "", "Business Postal Code" => "",
"Business Country" => "", "Business Country" => "",
"Home Street" => "ADR.Street", "Home Street" => "ADR_Street",
"Home City" => "ADR.Locality", "Home City" => "ADR_Locality",
"Home State" => "ADR.Region", "Home State" => "ADR_Region",
"Home Postal Code" => "ADR.PostalCode", "Home Postal Code" => "ADR_PostalCode",
"Home Country" => "ADR.Country", "Home Country" => "ADR_CountryName",
"Home Street 2" => "", "Home Street 2" => "",
"Home Street 3" => "", "Home Street 3" => "",
"Other Street" => "", "Other Street" => "",
@ -55,8 +55,8 @@ class outlook_conv {
"Other Postal Code" => "", "Other Postal Code" => "",
"Other Country" => "", "Other Country" => "",
"Assistant's Phone" => "", "Assistant's Phone" => "",
"Business Fax" => "C.TEL", "Business Fax" => "C_TEL",
"Business Phone" => "B.TEL", "Business Phone" => "B_TEL",
"Business Phone 2" => "ophone", "Business Phone 2" => "ophone",
"Callback" => "", "Callback" => "",
"Car Phone" => "", "Car Phone" => "",
@ -81,7 +81,7 @@ class outlook_conv {
"Categories" => "", "Categories" => "",
"Children" => "", "Children" => "",
"Directory Server" => "", "Directory Server" => "",
"E-mail Address" => "D.EMAIL", "E-mail Address" => "D_EMAIL",
"E-mail Display Name" => "", "E-mail Display Name" => "",
"E-mail 2 Address" => "", "E-mail 2 Address" => "",
"E-mail 2 Display Name" => "", "E-mail 2 Display Name" => "",
@ -146,7 +146,7 @@ function outlook_end_record($buffer,$private="private") {
for ($i=0;$i<count($lines)-1;$i++) { for ($i=0;$i<count($lines)-1;$i++) {
list($name, $value) = split("%%",$lines[$i]); list($name, $value) = split("%%",$lines[$i]);
$row++; $row++;
$namelist = $namelist.array($name => $value); $namelist .= array($name => $value);
} }
return $buffer.$namelist; return $buffer.$namelist;

View File

@ -1,57 +1,55 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($confirm) { if ($confirm) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
$phpgw_info["flags"]["enable_addressbook_class"] = True; $phpgw_info["flags"]["enable_addressbook_class"] = True;
include("../header.inc.php"); include("../header.inc.php");
if (! $ab_id) { if (! $ab_id) {
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/")); @Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/"));
} }
$this = CreateObject("phpgwapi.contacts"); $this = CreateObject("phpgwapi.contacts");
#$t = new Template($phpgw_info["server"]["app_tpl"]); #$t = new Template($phpgw_info["server"]["app_tpl"]);
$t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array("delete" => "delete.tpl")); $t->set_file(array("delete" => "delete.tpl"));
if ($confirm != "true") { if ($confirm != "true") {
$fields = $this->read($ab_id, array("owner" => $owner)); $fields = $this->read($ab_id, array("owner" => $owner));
if ($fielfs["owner"] != $phpgw_info["user"]["account_id"]) { if ($fielfs["owner"] != $phpgw_info["user"]["account_id"]) {
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/")); @Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/"));
} }
$t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?")); $t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?"));
$t->set_var(no_link,$phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); $t->set_var(no_link,$phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
$t->set_var(lang_no,lang("NO")); $t->set_var(lang_no,lang("NO"));
$t->set_var(yes_link,$phpgw->link("delete.php","ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); $t->set_var(yes_link,$phpgw->link("delete.php","ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
$t->set_var(lang_yes,lang("YES")); $t->set_var(lang_yes,lang("YES"));
$t->pparse("out","delete"); $t->pparse("out","delete");
$phpgw->common->phpgw_footer();
} else { $phpgw->common->phpgw_footer();
$this->account_id=$phpgw_info["user"]["account_id"]; } else {
$this->delete($ab_id); $this->account_id=$phpgw_info["user"]["account_id"];
$this->delete($ab_id);
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/", @Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/","cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); }
}
?> ?>

View File

@ -1,117 +1,115 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($submit || ! $ab_id) { if ($submit || ! $ab_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
$phpgw_info["flags"]["enable_addressbook_class"] = True; $phpgw_info["flags"]["enable_addressbook_class"] = True;
include("../header.inc.php"); include("../header.inc.php");
#$t = new Template($phpgw_info["server"]["app_tpl"]);
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array( "edit" => "edit.tpl"));
if (! $ab_id) { #$t = new Template($phpgw_info["server"]["app_tpl"]);
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/", $t = new Template($phpgw->common->get_tpl_dir("addressbook"));
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); $t->set_file(array( "edit" => "edit.tpl"));
$phpgw->common->phpgw_exit();
}
$this = CreateObject("phpgwapi.contacts"); if (! $ab_id) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/","cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
$phpgw->common->phpgw_exit();
}
if (! $submit) { $this = CreateObject("phpgwapi.contacts");
// merge in what are now extra fields
$extrafields = array ("pager" => "pager", if (!$submit) {
"mphone" => "mphone", // merge in extra fields
"ophone" => "ophone", $extrafields = array ("pager" => "pager",
"access" => "access", "mphone" => "mphone",
"address2" => "address2", "ophone" => "ophone",
"bday" => "bday", "access" => "access",
"url" => "url", "address2" => "address2",
"notes" => "notes"); "bday" => "bday",
$qfields = $this->stock_contact_fields + $extrafields; "url" => "url",
$fields = $this->read_single_entry($ab_id,$qfields); "notes" => "notes");
form("","edit.php","Edit",$fields[0]); $qfields = $this->stock_contact_fields + $extrafields;
} else { $fields = $this->read_single_entry($ab_id,$qfields);
if ($url == "http://") { form("","edit.php","Edit",$fields[0]);
$url = ""; } else {
} if ($url == "http://") {
if (! $bday_month && ! $bday_day && ! $bday_year) { $url = "";
$bday = ""; }
} else { if (! $bday_month && ! $bday_day && ! $bday_year) {
$bday = "$bday_month/$bday_day/$bday_year"; $bday = "";
} } else {
if ($access != "private" && $access != "public") { $bday = "$bday_month/$bday_day/$bday_year";
$access = $phpgw->accounts->array_to_string($access,$n_groups); }
} if ($access != "private" && $access != "public") {
$access = $phpgw->accounts->array_to_string($access,$n_groups);
}
$fields["org_name"] = $company; $fields["org_name"] = $company;
$fields["org_unit"] = $department; $fields["org_unit"] = $department;
$fields["n_given"] = $firstname; $fields["n_given"] = $firstname;
$fields["n_family"] = $lastname; $fields["n_family"] = $lastname;
$fields["n_middle"] = $middle; $fields["n_middle"] = $middle;
$fields["n_prefix"] = $prefix; $fields["n_prefix"] = $prefix;
$fields["n_suffix"] = $suffix; $fields["n_suffix"] = $suffix;
if ($prefix) { $pspc = " "; } if ($prefix) { $pspc = " "; }
if ($middle) { $mspc = " "; } if ($middle) { $mspc = " "; }
if ($suffix) { $sspc = " "; } if ($suffix) { $sspc = " "; }
$fields["fn"] = $prefix . $pspc . $firstname . $mspc . $middle . $mspc . $lastname . $sspc . $suffix; $fields["fn"] = $prefix.$pspc.$firstname.$mspc.$middle.$mspc.$lastname.$sspc.$suffix;
$fields["d_email"] = $email; $fields["d_email"] = $email;
$fields["d_emailtype"] = $email_type; $fields["d_emailtype"] = $email_type;
$fields["title"] = $title; $fields["title"] = $title;
$fields["a_tel"] = $wphone; $fields["a_tel"] = $wphone;
$fields["b_tel"] = $hphone; $fields["b_tel"] = $hphone;
$fields["c_tel"] = $fax; $fields["c_tel"] = $fax;
$fields["pager"] = $pager; $fields["pager"] = $pager;
$fields["mphone"] = $mphone; $fields["mphone"] = $mphone;
$fields["ophone"] = $ophone; $fields["ophone"] = $ophone;
$fields["adr_street"] = $street; $fields["adr_street"] = $street;
$fields["address2"] = $address2; $fields["address2"] = $address2;
$fields["adr_locality"] = $city; $fields["adr_locality"] = $city;
$fields["adr_region"] = $state; $fields["adr_region"] = $state;
$fields["adr_postalcode"] = $zip; $fields["adr_postalcode"] = $zip;
$fields["adr_countryname"] = $country; $fields["adr_countryname"] = $country;
$fields["tz"] = $timezone; $fields["tz"] = $timezone;
$fields["bday"] = $bday; $fields["bday"] = $bday;
$fields["url"] = $url; $fields["url"] = $url;
$fields["notes"] = $notes; $fields["notes"] = $notes;
$fields["access"] = $access; $fields["access"] = $access;
$this->update($ab_id,$phpgw_info["user"]["account_id"],$fields); $this->update($ab_id,$phpgw_info["user"]["account_id"],$fields);
Header("Location: " . $phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=" Header("Location: " . $phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start"));
. "$filter&start=$start")); $phpgw->common->phpgw_exit();
$phpgw->common->phpgw_exit(); }
}
$t->set_var("ab_id",$ab_id); $t->set_var("ab_id",$ab_id);
$t->set_var("sort",$sort); $t->set_var("sort",$sort);
$t->set_var("order",$order); $t->set_var("order",$order);
$t->set_var("filter",$filter); $t->set_var("filter",$filter);
$t->set_var("start",$start); $t->set_var("start",$start);
$t->set_var("lang_ok",lang("ok")); $t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_clear",lang("clear")); $t->set_var("lang_clear",lang("clear"));
$t->set_var("lang_cancel",lang("cancel")); $t->set_var("lang_cancel",lang("cancel"));
$t->set_var("lang_delete",lang("delete")); $t->set_var("lang_delete",lang("delete"));
$t->set_var("lang_submit",lang("submit")); $t->set_var("lang_submit",lang("submit"));
$t->set_var("cancel_link",'<form action="'.$phpgw->link("index.php","sort=$sort&order=$order&filter=$filter&start=$start") . '">'); $t->set_var("cancel_link",'<form action="'.$phpgw->link("index.php","sort=$sort&order=$order&filter=$filter&start=$start") . '">');
$t->set_var("delete_link",'<form action="'.$phpgw->link("delete.php","ab_id=$ab_id") . '">'); $t->set_var("delete_link",'<form action="'.$phpgw->link("delete.php","ab_id=$ab_id") . '">');
$t->parse("out","edit"); $t->parse("out","edit");
$t->pparse("out","edit"); $t->pparse("out","edit");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,48 +1,48 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare API - Accounts manager for SQL * * phpGroupWare API - Accounts manager for SQL *
* This file written by Joseph Engo <jengo@phpgroupware.org> * * This file written by Joseph Engo <jengo@phpgroupware.org> *
* View and manipulate contact records using SQL * * View and manipulate contact records using SQL *
* Copyright (C) 2001 Joseph Engo * * Copyright (C) 2001 Joseph Engo *
* -------------------------------------------------------------------------* * -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API * * This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api * * http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ * * ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it * * This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by * * under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, * * the Free Software Foundation; either version 2.1 of the License, *
* or any later version. * * or any later version. *
* This library is distributed in the hope that it will be useful, but * * This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of * * WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. * * See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License * * You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, * * along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
/* /*
phpgw_addressbook_extra ( phpgw_addressbook_extra (
contact_id int, contact_id int,
contact_owner int, contact_owner int,
contact_name varchar(255), contact_name varchar(255),
contact_value varchar(255) contact_value varchar(255)
); );
*/ */
/* ldap is a copy of sql for now */ /* ldap is a copy of sql for now */
class contacts_ class contacts_
{ {
var $db; var $db;
var $std_table="phpgw_addressbook"; var $std_table="phpgw_addressbook";
var $ext_table="phpgw_addressbook_extra"; var $ext_table="phpgw_addressbook_extra";
var $account_id; var $account_id;
var $stock_contact_fields; // This is an array of almost the fields in the phpgw_addressbook table, except id,owner,lid,tid var $stock_contact_fields; // This is an array of almost the fields in the phpgw_addressbook table, except id,owner,lid,tid
var $email_types; // VCard email type array var $email_types; // VCard email type array
var $total_records; // This will contain numrows for data retrieved var $total_records; // This will contain numrows for data retrieved
function contacts_() function contacts_()
{ {

File diff suppressed because it is too large Load Diff

View File

@ -12,18 +12,18 @@
/* $ Id $ */ /* $ Id $ */
{ {
echo "<p>\n"; echo "<p>\n";
$imgfile = $phpgw->common->get_image_dir("addressbook")."/" . $appname .".gif"; $imgfile = $phpgw->common->get_image_dir($appname)."/" . $appname .".gif";
if (file_exists($imgfile)) { if (file_exists($imgfile)) {
$imgpath = $phpgw->common->get_image_path("addressbook")."/" . $appname .".gif"; $imgpath = $phpgw->common->get_image_path($appname)."/" . $appname .".gif";
} else { } else {
$imgfile = $phpgw->common->get_image_dir("addressbook")."/navbar.gif"; $imgfile = $phpgw->common->get_image_dir($appname)."/navbar.gif";
if (file_exists($imgfile)) { if (file_exists($imgfile)) {
$imgpath = $phpgw->common->get_image_path("addressbook")."/navbar.gif"; $imgpath = $phpgw->common->get_image_path($appname)."/navbar.gif";
} else { } else {
$imgpath = ""; $imgpath = "";
} }
} }
section_start("Address Book",$imgpath); section_start(ucfirst($appname),$imgpath);
$pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/preferences.php"); $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/preferences.php");
echo "<a href=".$pg.">" . lang("Addressbook preferences") . "</a><br>"; echo "<a href=".$pg.">" . lang("Addressbook preferences") . "</a><br>";

View File

@ -1,168 +1,158 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "addressbook", $phpgw_info["flags"] = array("currentapp" =>
"enable_contacts_class" => True, "addressbook","enable_contacts_class" => True,
"enable_nextmatchs_class" => True); "enable_nextmatchs_class" => True);
include("../header.inc.php"); include("../header.inc.php");
#$t = new Template($phpgw_info["server"]["app_tpl"]); #$t = new Template($phpgw_info["server"]["app_tpl"]);
$t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array( "addressbook_header" => "header.tpl", $t->set_file(array( "addressbook_header" => "header.tpl",
"column" => "column.tpl", "column" => "column.tpl",
"row" => "row.tpl", "row" => "row.tpl",
"addressbook_footer" => "footer.tpl" )); "addressbook_footer" => "footer.tpl" ));
$this = CreateObject("phpgwapi.contacts"); $this = CreateObject("phpgwapi.contacts");
while ($column = each($this->stock_contact_fields)) { while ($column = each($this->stock_contact_fields)) {
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) && if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) &&
$phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) { $phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) {
$showcol = display_name($column[0]); $showcol = display_name($column[0]);
$cols .= " <td height=\"21\">\n"; $cols .= " <td height=\"21\">\n";
$cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">'; $cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">';
$cols .= $phpgw->nextmatchs->show_sort_order($sort, $column[0],$order,"index.php",lang($showcol)); $cols .= $phpgw->nextmatchs->show_sort_order($sort, $column[0],$order,"index.php",lang($showcol));
$cols .= "</font>\n </td>"; $cols .= "</font>\n </td>";
$cols .= "\n"; $cols .= "\n";
// To be used when displaying the rows // To be used when displaying the rows
$columns_to_display[$column[0]] = True; $columns_to_display[$column[0]] = True;
} }
} }
if (! $start) if (! $start)
$start = 0; $start = 0;
if($phpgw_info["user"]["preferences"]["common"]["maxmatchs"] && if($phpgw_info["user"]["preferences"]["common"]["maxmatchs"] && $phpgw_info["user"]["preferences"]["common"]["maxmatchs"] > 0) {
$phpgw_info["user"]["preferences"]["common"]["maxmatchs"] > 0) { $offset = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
$offset = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]; } else {
} else { $offset = 30;
$offset = 30; }
}
// insert acl stuff here in lieu of old access perms // insert acl stuff here in lieu of old access perms
// following sets up the filter for read, then restores the filter string for later checking // following sets up the filter for read, then restores the filter string for later checking
if ($filter == "none") { $filter = ""; } if ($filter == "none") { $filter = ""; }
$savefilter = $filter; $savefilter = $filter;
if ($filter != "" ) { $filter = "access=$filter"; } if ($filter != "" ) { $filter = "access=$filter"; }
$qfilter = $filter; $qfilter = $filter;
$filter = $savefilter; $filter = $savefilter;
if (!$columns_to_display ) { if (!$columns_to_display ) {
$columns_to_display = array("n_given","n_family","org_name"); $columns_to_display = array("n_given","n_family","org_name");
$noprefs=lang("Please set your preferences for this app"); $noprefs=lang("Please set your preferences for this app");
} }
$qcols = $columns_to_display + array("access"); $qcols = $columns_to_display + array("access");
// read the entry list // read the entry list
$entries = $this->read($start,$offset,$qcols,$query,$qfilter,$sort,$order); $entries = $this->read($start,$offset,$qcols,$query,$qfilter,$sort,$order);
$search_filter = $phpgw->nextmatchs->show_tpl("index.php", $search_filter = $phpgw->nextmatchs->show_tpl("index.php",$start, $this->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query","75%", $phpgw_info["theme"]["th_bg"]);
$start, $this->total_records,
"&order=$order&filter=$filter&sort=$sort&query=$query",
"75%", $phpgw_info["theme"]["th_bg"]);
if ($this->total_records > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) { if ($this->total_records > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) {
$lang_showing=lang("showing x - x of x",($start + 1), $lang_showing=lang("showing x - x of x",($start + 1),($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$this->total_records);
($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]), } else {
$this->total_records); $lang_showing=lang("showing x",$this->total_records);
} else { }
$lang_showing=lang("showing x",$this->total_records);
}
// set basic vars and parse the header // set basic vars and parse the header
$t->set_var(font,$phpgw_info["theme"]["font"]); $t->set_var(font,$phpgw_info["theme"]["font"]);
$t->set_var("lang_view",lang("View")); $t->set_var("lang_view",lang("View"));
$t->set_var("lang_vcard",lang("VCard")); $t->set_var("lang_vcard",lang("VCard"));
$t->set_var("lang_edit",lang("Edit")); $t->set_var("lang_edit",lang("Edit"));
$t->set_var(searchreturn,$noprefs . " " . $searchreturn);
$t->set_var(lang_showing,$lang_showing);
$t->set_var(search_filter,$search_filter);
$t->set_var("lang_addressbook",lang("Address book"));
$t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$t->set_var("th_font",$phpgw_info["theme"]["font"]);
$t->set_var("th_text",$phpgw_info["theme"]["th_text"]);
$t->set_var("lang_add",lang("Add"));
$t->set_var("lang_addvcard",lang("AddVCard"));
$t->set_var("lang_import",lang("Import File"));
$t->set_var("import_url",$phpgw->link("import.php"));
$t->set_var("start",$start);
$t->set_var("sort",$sort);
$t->set_var("order",$order);
$t->set_var("filter",$filter);
$t->set_var("qfield",$qfield);
$t->set_var("query",$query);
$t->set_var("actionurl",$phpgw->link("add.php","sort=$sort&order=$order&filter=$filter&start=$start"));
$t->set_var("start",$start);
$t->set_var("filter",$filter);
$t->set_var("cols",$cols);
$t->pparse("out","addressbook_header");
// Show the entries
for ($i=0;$i<count($entries);$i++) { // each entry
if ( ($entries[$i]["access"] == $filter) ||
($entries[$i]["access"] == "," . $filter . ",") ||
($filter == "") || ($filter == "none")) {
$t->set_var(columns,"");
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var(row_tr_color,$tr_color);
$myid = $entries[$i]["id"];
$myowner = $entries[$i]["owner"];
$t->set_var(searchreturn,$noprefs . " " . $searchreturn); while ($column = each($columns_to_display)) { // each entry column
$t->set_var(lang_showing,$lang_showing); $ref=$data="";
$t->set_var(search_filter,$search_filter); $coldata = $entries[$i][$column[0]];
$t->set_var("lang_addressbook",lang("Address book")); // Some fields require special formatting.
$t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); if ($column[0] == "url") {
$t->set_var("th_font",$phpgw_info["theme"]["font"]); $ref='<a href="'.$coldata.'" target="_new">';
$t->set_var("th_text",$phpgw_info["theme"]["th_text"]); $data=$coldata.'</a>';
$t->set_var("lang_add",lang("Add")); } elseif ($column[0] == "email") {
$t->set_var("lang_addvcard",lang("AddVCard")); if ($phpgw_info["user"]["apps"]["email"]) {
$t->set_var("lang_import",lang("Import File")); $ref='<a href="'.$phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
$t->set_var("import_url",$phpgw->link("import.php")); } else {
$t->set_var("start",$start); //changed frmo a patch posted on sf, have not fully tested. Seek3r, Jan 30 2001
$t->set_var("sort",$sort); // $ref='<a href="mailto:"'.$coldata.'">'.$coldata.'</a>';
$t->set_var("order",$order); $ref='<a href="mailto:'.$coldata.'">';
$t->set_var("filter",$filter); }
$t->set_var("qfield",$qfield); $data=$coldata."</a>";
$t->set_var("query",$query); } else { // But these do not
$t->set_var("actionurl",$phpgw->link("add.php","sort=$sort&order=$order&filter=$filter&start=$start")); $ref=""; $data=$coldata;
$t->set_var("start",$start); }
$t->set_var("filter",$filter); $t->set_var(col_data,$ref.$data);
$t->set_var("cols",$cols); $t->parse("columns","column",True);
}
$t->pparse("out","addressbook_header");
// Show the entries
for ($i=0;$i<count($entries);$i++) { // each entry
if ( ($entries[$i]["access"] == $filter) ||
($entries[$i]["access"] == "," . $filter . ",") ||
($filter == "") ||
($filter == "none")) {
//strpos(' ,'.$entries[$i]["access"].', ',','.$filter.',')
$t->set_var(columns,"");
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var(row_tr_color,$tr_color);
$myid = $entries[$i]["id"];
$myowner = $entries[$i]["owner"];
while ($column = each($columns_to_display)) { // each entry column
$ref=$data="";
$coldata = $entries[$i][$column[0]];
// Some fields require special formatting.
if ($column[0] == "url") {
$ref='<a href="'.$coldata.'" target="_new">';
$data=$coldata.'</a>';
} elseif ($column[0] == "email") {
if ($phpgw_info["user"]["apps"]["email"]) {
$ref='<a href="'.$phpgw->link($phpgw_info["server"]["webserver_url"]
. "/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
} else {
//changed frmo a patch posted on sf, have not fully tested. Seek3r, Jan 30 2001
// $ref='<a href="mailto:"'.$coldata.'">'.$coldata.'</a>';
$ref='<a href="mailto:'.$coldata.'">';
}
$data=$coldata."</a>";
} else { // But these do not
$ref=""; $data=$coldata;
}
$t->set_var(col_data,$ref.$data);
$t->parse("columns","column",True);
}
$t->set_var(row_view_link,$phpgw->link("view.php","ab_id=$myid&start=$start&order=$order&filter=" $t->set_var(row_view_link,$phpgw->link("view.php","ab_id=$myid&start=$start&order=$order&filter="
. "$filter&query=$query&sort=$sort")); . "$filter&query=$query&sort=$sort"));
$t->set_var(row_vcard_link,$phpgw->link("vcardout.php","ab_id=$myid&start=$start&order=$order&filter=" $t->set_var(row_vcard_link,$phpgw->link("vcardout.php","ab_id=$myid&start=$start&order=$order&filter="
. "$filter&query=$query&sort=$sort")); . "$filter&query=$query&sort=$sort"));
$t->set_var(row_edit_link,$phpgw->common->check_owner($myowner,"edit.php",lang("edit"),"ab_id=" $t->set_var(row_edit_link,$phpgw->common->check_owner($myowner,"edit.php",lang("edit"),"ab_id="
.$myid."&start=".$start."&sort=".$sort."&order=".$order."&query=".$query."&sort=".$sort)); .$myid."&start=".$start."&sort=".$sort."&order=".$order."&query=".$query."&sort=".$sort));
$t->parse("rows","row",True);
$t->pparse("out","row");
reset($columns_to_display); // If we don't reset it, our inside while won't loop
}
}
$t->parse("rows","row",True); $t->pparse("out","addressbook_footer");
$t->pparse("out","row"); $phpgw->common->phpgw_footer();
reset($columns_to_display); // If we don't reset it, our inside while won't loop
}
}
$t->pparse("out","addressbook_footer");
$phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,30 +1,30 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "addressbook", $phpgw_info["flags"] = array("currentapp" => "addressbook",
"enable_contact_class" => True, "enable_contact_class" => True,
"noheader" => True, "nonavbar" => True); "noheader" => True, "nonavbar" => True);
include("../header.inc.php"); include("../header.inc.php");
if($access == "group") if($access == "group")
$access = $n_groups; $access = $n_groups;
//echo $access . "<BR>"; //echo $access . "<BR>";
parsevcard($filename,$access); parsevcard($filename,$access);
// Delete the temp file. // Delete the temp file.
unlink($filename); unlink($filename);
unlink($filename . ".info"); unlink($filename . ".info");
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", "cd=14")); Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", "cd=14"));
?> ?>

View File

@ -1,101 +1,102 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - Address Book * * phpGroupWare - Address Book *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("noheader" => True,
"nonavbar" => True, $phpgw_info["flags"] = array("noheader" => True,
"currentapp" => "addressbook", "nonavbar" => True,
"enable_addressbook_class" => True, "currentapp" => "addressbook",
"enable_nextmatchs_class" => True); "enable_addressbook_class" => True,
"enable_nextmatchs_class" => True);
include("../header.inc.php"); include("../header.inc.php");
$this = CreateObject("phpgwapi.contacts"); $this = CreateObject("phpgwapi.contacts");
if ($submit) { if ($submit) {
$totalerrors = 0; $totalerrors = 0;
if (! count($ab_selected)) { if (! count($ab_selected)) {
$errors[$totalerrors++] = lang("You must select at least 1 column to display"); $errors[$totalerrors++] = lang("You must select at least 1 column to display");
} }
if (! $totalerrors) { if (! $totalerrors) {
$phpgw->preferences->read_repository(); $phpgw->preferences->read_repository();
while (list($pref[0]) = each($this->stock_contact_fields)) { while (list($pref[0]) = each($this->stock_contact_fields)) {
if ($ab_selected["$pref[0]"]) { if ($ab_selected["$pref[0]"]) {
$phpgw->preferences->change("addressbook",$pref[0],"addressbook_" . $ab_selected["$pref[0]"]); $phpgw->preferences->change("addressbook",$pref[0],"addressbook_" . $ab_selected["$pref[0]"]);
} else { } else {
$phpgw->preferences->delete("addressbook",$pref[0],"addressbook_" . $ab_selected["$pref[0]"]); $phpgw->preferences->delete("addressbook",$pref[0],"addressbook_" . $ab_selected["$pref[0]"]);
} }
} }
if ($mainscreen_showbirthdays) { if ($mainscreen_showbirthdays) {
$phpgw->preferences->delete("addressbook","mainscreen_showbirthdays"); $phpgw->preferences->delete("addressbook","mainscreen_showbirthdays");
$phpgw->preferences->add("addressbook","mainscreen_showbirthdays"); $phpgw->preferences->add("addressbook","mainscreen_showbirthdays");
} else { } else {
$phpgw->preferences->delete("addressbook","mainscreen_showbirthdays"); $phpgw->preferences->delete("addressbook","mainscreen_showbirthdays");
} }
$phpgw->preferences->save_repository(True); $phpgw->preferences->save_repository(True);
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php")); Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php"));
} }
} }
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
if ($totalerrors) { if ($totalerrors) {
echo "<p><center>" . $phpgw->common->error_list($errors) . "</center>"; echo "<p><center>" . $phpgw->common->error_list($errors) . "</center>";
} }
echo "<p><b>" . lang("Addressbook preferences") . ":" . "</b><hr><p>"; echo "<p><b>" . lang("Addressbook preferences") . ":" . "</b><hr><p>";
?> ?>
<form method="POST" action="<?php echo $phpgw->link(); ?>"> <form method="POST" action="<?php echo $phpgw->link(); ?>">
<table border="0" align="center" cellspacing="1" cellpadding="1"> <table border="0" align="center" cellspacing="1" cellpadding="1">
<?php <?php
// I need to create a common function to handle displaying multiable columns // I need to create a common function to handle displaying multiable columns
echo "<tr bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"><td colspan=\"3\">&nbsp;</td></tr>\n"; echo "<tr bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"><td colspan=\"3\">&nbsp;</td></tr>\n";
$i = 0; $j = 0; $i = 0; $j = 0;
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo "<tr bgcolor=\"" . $tr_color . "\">\n"; echo "<tr bgcolor=\"" . $tr_color . "\">\n";
while (list($col, $descr) = each($this->stock_contact_fields)) { while (list($col, $descr) = each($this->stock_contact_fields)) {
// echo "<br>test: $col - $i $j - " . count($abc); // echo "<br>test: $col - $i $j - " . count($abc);
$i++; $j++; $i++; $j++;
$showcol = display_name($descr); $showcol = display_name($descr);
if ($showcol) { if ($showcol) {
echo "\t<td><input type=\"checkbox\" name=\"ab_selected[" . $col . "]\" value=\"True\"" echo "\t<td><input type=\"checkbox\" name=\"ab_selected[" . $col . "]\" value=\"True\""
. ($phpgw_info["user"]["preferences"]["addressbook"][$col]?" checked":"") . '>' . lang($showcol) . ($phpgw_info["user"]["preferences"]["addressbook"][$col]?" checked":"") . '>' . lang($showcol)
. "</option></td>\n"; . "</option></td>\n";
} else { } else {
$i--; $i--;
next; next;
} }
if ($i == 3) { if ($i == 3) {
echo "</tr>\n"; echo "</tr>\n";
$i = 0; $i = 0;
} }
if ($i == 0 && $showcol) { if ($i == 0 && $showcol) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo "<tr bgcolor=\"" . $tr_color . "\">\n"; echo "<tr bgcolor=\"" . $tr_color . "\">\n";
} }
if ($j == count($this->stock_contact_fields)) { if ($j == count($this->stock_contact_fields)) {
if ($i == 1) { if ($i == 1) {
echo "\t<td>&nbsp;</td><td>&nbsp;</td>\n"; echo "\t<td>&nbsp;</td><td>&nbsp;</td>\n";
} }
if ($i == 2) { if ($i == 2) {
echo "\t<td>&nbsp;</td>\n"; echo "\t<td>&nbsp;</td>\n";
} }
echo "</tr>\n"; echo "</tr>\n";
} }
} }
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?> ?>
<tr bgcolor="<?php echo $tr_color; ?>"> <tr bgcolor="<?php echo $tr_color; ?>">
<td colspan="2"><?php echo lang("show birthday reminders on main screen"); ?></td> <td colspan="2"><?php echo lang("show birthday reminders on main screen"); ?></td>
@ -109,5 +110,5 @@
</table> </table>
</form> </form>
<?php <?php
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,74 +1,72 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - E-Mail * * phpGroupWare - E-Mail *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* This file written by Joseph Engo <jengo@phpgroupware.org> * * This file written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($action == "Load Vcard"){ if ($action == "Load Vcard"){
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "addressbook", "enable_addressbook_class" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "addressbook", "enable_addressbook_class" => True);
include("../header.inc.php"); include("../header.inc.php");
}else{ } else {
$phpgw_info["flags"] = array("currentapp" => "addressbook", "enable_addressbook_class" => True); $phpgw_info["flags"] = array("currentapp" => "addressbook", "enable_addressbook_class" => True);
include("../header.inc.php"); include("../header.inc.php");
echo '<body bgcolor="' . $phpgw_info["theme"]["bg_color"] . '">'; echo '<body bgcolor="' . $phpgw_info["theme"]["bg_color"] . '">';
} }
// Some of the methods where borrowed from // Some of the methods where borrowed from
// Squirrelmail <Luke Ehresman> http://www.squirrelmail.org // Squirrelmail <Luke Ehresman> http://www.squirrelmail.org
$sep = $phpgw->common->filesystem_separator(); $sep = $phpgw->common->filesystem_separator();
$uploaddir = $phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"] . $sep; $uploaddir = $phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"] . $sep;
if ($action == "Load Vcard") { if ($action == "Load Vcard") {
if($uploadedfile == "none" || $uploadedfile == "") { if($uploadedfile == "none" || $uploadedfile == "") {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/vcardin.php","action=GetFile"));
"/addressbook/vcardin.php","action=GetFile")); } else {
} else { srand((double)microtime()*1000000);
srand((double)microtime()*1000000); $random_number = rand(100000000,999999999);
$random_number = rand(100000000,999999999); $newfilename = md5("$uploadedfile, $uploadedfile_name, " . $phpgw_info["user"]["sessionid"]
$newfilename = md5("$uploadedfile, $uploadedfile_name, " . $phpgw_info["user"]["sessionid"] . time() . getenv("REMOTE_ADDR") . $random_number );
. time() . getenv("REMOTE_ADDR") . $random_number );
copy($uploadedfile, $uploaddir . $newfilename); copy($uploadedfile, $uploaddir . $newfilename);
$ftp = fopen($uploaddir . $newfilename . ".info","w"); $ftp = fopen($uploaddir . $newfilename . ".info","w");
fputs($ftp,"$uploadedfile_type\n$uploadedfile_name\n"); fputs($ftp,"$uploadedfile_type\n$uploadedfile_name\n");
fclose($ftp); fclose($ftp);
// This has to be non-interactive in case of a multi-entry vcard. // This has to be non-interactive in case of a multi-entry vcard.
$filename = $uploaddir . $newfilename; $filename = $uploaddir . $newfilename;
$n_groups = $phpgw->accounts->array_to_string($access,$n_groups); $n_groups = $phpgw->accounts->array_to_string($access,$n_groups);
if($access == "group") if($access == "group")
$access = $n_groups; $access = $n_groups;
//echo $access . "<BR>"; //echo $access . "<BR>";
parsevcard($filename,$access); parsevcard($filename,$access);
// Delete the temp file. // Delete the temp file.
unlink($filename); unlink($filename);
unlink($filename . ".info"); unlink($filename . ".info");
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", "cd=14")); Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", "cd=14"));
} }
} }
if (! file_exists($phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"])) if (! file_exists($phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"]))
mkdir($phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"],0700); mkdir($phpgw_info["server"]["temp_dir"] . $sep . $phpgw_info["user"]["sessionid"],0700);
if ($action == "GetFile"){ if ($action == "GetFile"){
echo "<B><CENTER>You must select a vcard. (*.vcf)</B></CENTER><BR><BR>"; echo "<B><CENTER>You must select a vcard. (*.vcf)</B></CENTER><BR><BR>";
} }
?> ?>
<form ENCTYPE="multipart/form-data" method="POST" action="<?php echo $phpgw->link("vcardin.php")?>"> <form ENCTYPE="multipart/form-data" method="POST" action="<?php echo $phpgw->link("vcardin.php")?>">
<table border=0> <table border=0>
<tr> <tr>
@ -116,7 +114,6 @@ if ($action == "Load Vcard"){
<?php <?php
if ($action != "Load Vcard")
if ($action != "Load Vcard") $phpgw->common->phpgw_footer();
$phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,152 +1,144 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($nolname || $nofname) { if ($nolname || $nofname) {
$phpgw_info["flags"] = array("noheader" => False, "nonavbar" => False); $phpgw_info["flags"] = array("noheader" => False, "nonavbar" => False);
} else { } else {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"]["enable_addressbook_class"] = True; $phpgw_info["flags"]["enable_addressbook_class"] = True;
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
include("../header.inc.php"); include("../header.inc.php");
if (! $ab_id) {
Header("Location: " . $phpgw->link("index.php"));
$phpgw->common->phpgw_exit();
}
if (! $ab_id) { $this = CreateObject("phpgwapi.contacts");
Header("Location: " . $phpgw->link("index.php"));
$phpgw->common->phpgw_exit();
}
$this = CreateObject("phpgwapi.contacts"); if ($filter != "private")
$filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access");
$fields = $this->read_single_entry($ab_id,$this->stock_contact_fields);
$email = $fields[0]["d_email"];
$fullname = $fields[0]["fn"];
$prefix = $fields[0]["n_prefix"];
$firstname = $fields[0]["n_given"];
$middle = $fields[0]["n_middle"];
$lastname = $fields[0]["n_family"];
$suffix = $fields[0]["n_suffix"];
$title = $fields[0]["title"];
$hphone = $fields[0]["a_tel"];
$wphone = $fields[0]["b_tel"];
$fax = $fields[0]["c_tel"];
$pager = $fields[0]["pager"];
$mphone = $fields[0]["mphone"];
$ophone = $fields[0]["ophone"];
$street = $fields[0]["adr_street"];
$address2 = $fields[0]["address2"];
$city = $fields[0]["adr_locality"];
$state = $fields[0]["adr_region"];
$zip = $fields[0]["adr_postalcode"];
$country = $fields[0]["adr_countryname"];
$company = $fields[0]["org_name"];
$dept = $fields[0]["org_unit"];
$bday = $fields[0]["bday"];
$notes = $fields[0]["notes"];
$access = $fields[0]["access"];
$url = $fields[0]["url"];
if(!$nolname && !$nofname) {
/* First name and last must be in the vcard. */
if($lastname == "") {
/* Run away here. */
Header("Location: " . $phpgw->link("vcardout.php","nolname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort"));
}
if($firstname == "" ) {
Header("Location: " . $phpgw->link("vcardout.php","nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort"));
}
if ($filter != "private") header("Content-type: text/X-VCARD");
$filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access"); $fn = explode("@",$email);
$filename = sprintf("%s.vcf", $fn[0]);
$fields = $this->read_single_entry($ab_id,$this->stock_contact_fields);
$email = $fields[0]["d_email"]; header("Content-Disposition: attachment; filename=$filename");
$fullname = $fields[0]["fn"];
$prefix = $fields[0]["n_prefix"]; printf("BEGIN:VCARD\r\n");
$firstname = $fields[0]["n_given"]; printf("N:%s;%s\r\n", $lastname, $firstname);
$middle = $fields[0]["n_middle"]; if (!$fullname) { printf("FN:%s %s\r\n", $firstname, $lastname); }
$lastname = $fields[0]["n_family"]; else { printf("FN:%s\r\n", $fullname); }
$suffix = $fields[0]["n_suffix"];
$title = $fields[0]["title"];
$hphone = $fields[0]["a_tel"];
$wphone = $fields[0]["b_tel"];
$fax = $fields[0]["c_tel"];
$pager = $fields[0]["pager"];
$mphone = $fields[0]["mphone"];
$ophone = $fields[0]["ophone"];
$street = $fields[0]["adr_street"];
$address2 = $fields[0]["address2"];
$city = $fields[0]["adr_locality"];
$state = $fields[0]["adr_region"];
$zip = $fields[0]["adr_postalcode"];
$country = $fields[0]["adr_countryname"];
$company = $fields[0]["org_name"];
$dept = $fields[0]["org_unit"];
$bday = $fields[0]["bday"];
$notes = $fields[0]["notes"];
$access = $fields[0]["access"];
$url = $fields[0]["url"];
if(!$nolname && !$nofname) /* This stuff is optional. */
{ if($title != "") /* Title */
/* First name and last must be in the vcard. */ printf("TITLE:%s\r\n",$title);
if($lastname == "") if($email != "") /* E-mail */
{ printf("EMAIL;INTERNET:%s\r\n", $email);
/* Run away here. */ if($hphone != "") /* Home Phone */
Header("Location: " . $phpgw->link("vcardout.php","nolname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort")); printf("TEL;HOME:%s\r\n", $hphone);
} if($wphone != "") /* Work Phone */
if($firstname == "" ) printf("TEL;WORK:%s\r\n", $wphone);
{ if($mphone != "") /* Mobile Phone */
Header("Location: " . $phpgw->link("vcardout.php","nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort")); printf("TEL;CELL:%s\r\n", $mphone);
} if($fax != "") /* Fax Number */
printf("TEL;FAX:%s\r\n", $fax);
if($pager != "") /* Pager Number */
printf("TEL;PAGER:%s\r\n", $pager);
//if($ophone != "") /* Other Phone */
//$NOTES .= "Other Phone: " . $ophone;
/* The address one is pretty icky. Send it if ANY of the fields are present. */
if($address2 != "" || /* Street Line 1 */
$street != "" || /* Street Line 2 */
$city != "" || /* City */
$state != "" || /* State */
$zip != "") /* Zip */
printf("ADR:;%s;%s;%s;%s;%s;%s\r\n", $address2,
$street,$city,$state,$zip,$country);
header("Content-type: text/X-VCARD"); if($bday != "" && $bday != "//") /* Birthday */
$fn = explode("@",$email); printf("BDAY:%s\r\n", $bday); /* This is not the right format. */
$filename = sprintf("%s.vcf", $fn[0]); if($company != "") /* Company Name (Really isn't company_name?) */
printf("ORG:%s %s\r\n", $company, $dept);
if($notes != "") /* Notes */
$NOTES .= $notes;
if($NOTES != "") /* All of the notes. */
printf("NOTE:%s\r\n", $NOTES);
/* End of Stuff. */
printf("VERSION:2.1\r\n");
printf("END:VCARD\r\n");
} /* !nolname && !nofname */
header("Content-Disposition: attachment; filename=$filename"); if($nofname) {
echo "<BR><BR><CENTER>";
echo lang("This person's first name was not in the address book.") ."<BR>";
echo lang("Vcards require a first name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "</CENTER>";
}
printf("BEGIN:VCARD\r\n"); if($nolname) {
printf("N:%s;%s\r\n", $lastname, $firstname); echo "<BR><BR><CENTER>";
if (!$fullname) { printf("FN:%s %s\r\n", $firstname, $lastname); } echo lang("This person's last name was not in the address book.") . "<BR>";
else { printf("FN:%s\r\n", $fullname); } echo lang("Vcards require a last name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "</CENTER>";
}
/* This stuff is optional. */ if($nolname || $nofname)
if($title != "") /* Title */ $phpgw->common->phpgw_footer();
printf("TITLE:%s\r\n",$title); /* End of php. */
if($email != "") /* E-mail */
printf("EMAIL;INTERNET:%s\r\n", $email);
if($hphone != "") /* Home Phone */
printf("TEL;HOME:%s\r\n", $hphone);
if($wphone != "") /* Work Phone */
printf("TEL;WORK:%s\r\n", $wphone);
if($mphone != "") /* Mobile Phone */
printf("TEL;CELL:%s\r\n", $mphone);
if($fax != "") /* Fax Number */
printf("TEL;FAX:%s\r\n", $fax);
if($pager != "") /* Pager Number */
printf("TEL;PAGER:%s\r\n", $pager);
//if($ophone != "") /* Other Phone */
//$NOTES .= "Other Phone: " . $ophone;
/* The address one is pretty icky. Send it if ANY of the fields are present. */
if($address2 != "" || /* Street Line 1 */
$street != "" || /* Street Line 2 */
$city != "" || /* City */
$state != "" || /* State */
$zip != "") /* Zip */
printf("ADR:;%s;%s;%s;%s;%s;%s\r\n", $address2,
$street,$city,$state,$zip,$country
);
if($bday != "" && $bday != "//") /* Birthday */
printf("BDAY:%s\r\n", $bday); /* This is not the right format. */
if($company != "") /* Company Name (Really isn't company_name?) */
printf("ORG:%s %s\r\n", $company, $dept);
if($notes != "") /* Notes */
$NOTES .= $notes;
if($NOTES != "") /* All of the notes. */
printf("NOTE:%s\r\n", $NOTES);
/* End of Stuff. */
printf("VERSION:2.1\r\n");
printf("END:VCARD\r\n");
} /* !nolname && !nofname */
if($nofname)
{
echo "<BR><BR><CENTER>";
echo lang("This person's first name was not in the address book.") ."<BR>";
echo lang("Vcards require a first name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "</CENTER>";
}
if($nolname)
{
echo "<BR><BR><CENTER>";
echo lang("This person's last name was not in the address book.") . "<BR>";
echo lang("Vcards require a last name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "</CENTER>";
}
if($nolname || $nofname)
$phpgw->common->phpgw_footer();
/* End of php. */
?> ?>

View File

@ -1,116 +1,120 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - addressbook * * phpGroupWare - addressbook *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> * * Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($submit || ! $ab_id) { if ($submit || ! $ab_id) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
} }
$phpgw_info["flags"] = array("currentapp" => "addressbook", $phpgw_info["flags"] = array("currentapp" => "addressbook",
"enable_contacts_class" => True, "enable_contacts_class" => True,
"enable_nextmatchs_class" => True); "enable_nextmatchs_class" => True);
include("../header.inc.php"); include("../header.inc.php");
#$t = new Template($phpgw_info["server"]["app_tpl"]); #$t = new Template($phpgw_info["server"]["app_tpl"]);
$t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array( "view" => "view.tpl")); $t->set_file(array( "view" => "view.tpl"));
$this = CreateObject("phpgwapi.contacts");
if (! $ab_id) {
Header("Location: " . $phpgw->link("index.php"));
}
$this = CreateObject("phpgwapi.contacts"); while ($column = each($this->stock_contact_fields)) {
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
$columns_to_display[$column[0]] = True;
$colname[$column[0]] = $column[1];
}
}
// merge in extra fields
$extrafields = array ("pager" => "pager",
"mphone" => "mphone",
"ophone" => "ophone",
"address2" => "address2",
"bday" => "bday",
"url" => "url",
"notes" => "notes",
"access" => "access");
$qfields = $this->stock_contact_fields + $extrafields;
$fields = $this->read_single_entry($ab_id,$qfields);
$owner = $fields[0]["owner"];
$access = $fields[0]["access"];
$view_header = "<p>&nbsp;<b>" . lang("Address book - view") . "</b><hr><p>";
$view_header .= '<table border="0" cellspacing="2" cellpadding="2" width="80%" align="center">';
while ($column = each($columns_to_display)) { // each entry column
$columns_html .= "<tr><td><b>" . lang(display_name($colname[$column[0]])) . "</b>:</td>";
$ref=$data="";
$coldata = $fields[0][$column[0]];
// Some fields require special formatting.
if ($column[0] == "url") {
$ref='<a href="'.$coldata.'" target="_new">';
$data=$coldata.'</a>';
} elseif ($column[0] == "email") {
if ($phpgw_info["user"]["apps"]["email"]) {
$ref='<a href="'.$phpgw->link($phpgw_info["server"]["webserver_url"]
. "/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
} else {
$ref='<a href="mailto:'.$coldata.'">';
}
$data=$coldata."</a>";
} else { // But these do not
$ref=""; $data=$coldata;
}
$columns_html .= "<td>" . $ref . $data . "</td>";
}
if (! $ab_id) { if ($access == "private") {
Header("Location: " . $phpgw->link("index.php")); $access_link .= lang("Record Access") . " - " . $access;
} } elseif ($access != "private" && $access != "public") {
$access_link .= lang("Group access") . " - " . $phpgw->accounts->convert_string_to_names_access($access);
} else {
$access_link ="";
}
while ($column = each($this->stock_contact_fields)) { $columns_html .= '<tr><td colspan="4">&nbsp;</td></tr>'
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && . '<tr><td><b>' . lang("Record owner") . '</b></td><td>'
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { . $phpgw->common->grab_owner_name($owner) . '</td><td><b>'
$columns_to_display[$column[0]] = True; . $access_link . '</b></td><td></table>';
$colname[$column[0]] = $column[1];
} $editlink = $phpgw->common->check_owner($owner,"edit.php",lang("edit"),"ab_id=" . $ab_id . "&start=".$start."&sort=".$sort."&order=".$order);
} $vcardlink = '<form action="'.$phpgw->link("vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
// merge in what are now extra fields $donelink = '<form action="'.$phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
$extrafields = array ("pager" => "pager",
"mphone" => "mphone", $t->set_var("access_link",$access_link);
"ophone" => "ophone", $t->set_var("ab_id",$ab_id);
"address2" => "address2", $t->set_var("sort",$sort);
"bday" => "bday", $t->set_var("order",$order);
"url" => "url", $t->set_var("filter",$filter);
"notes" => "notes"); $t->set_var("start",$start);
$qfields = $this->stock_contact_fields + $extrafields; $t->set_var("view_header",$view_header);
$fields = $this->read_single_entry($ab_id,$qfields); $t->set_var("cols",$columns_html);
$t->set_var("lang_ok",lang("ok"));
//$access = $fields[0]["access"]; $t->set_var("lang_done",lang("done"));
$owner = $fields[0]["owner"]; $t->set_var("lang_edit",lang("edit"));
$t->set_var("lang_submit",lang("submit"));
$view_header = "<p>&nbsp;<b>" . lang("Address book - view") . "</b><hr><p>"; $t->set_var("lang_vcard",lang("vcard"));
$view_header .= '<table border="0" cellspacing="2" cellpadding="2" width="80%" align="center">'; $t->set_var("done_link",$donelink);
$t->set_var("edit_link",$editlink);
while ($column = each($columns_to_display)) { // each entry column $t->set_var("vcard_link",$vcardlink);
$columns_html .= "<tr><td><b>" . lang(display_name($colname[$column[0]])) . "</b>:</td>";
$ref=$data=""; $t->parse("out","view");
$coldata = $fields[0][$column[0]]; $t->pparse("out","view");
// Some fields require special formatting.
if ($column[0] == "url") { $phpgw->common->phpgw_footer();
$ref='<a href="'.$coldata.'" target="_new">';
$data=$coldata.'</a>';
} elseif ($column[0] == "email") {
if ($phpgw_info["user"]["apps"]["email"]) {
$ref='<a href="'.$phpgw->link($phpgw_info["server"]["webserver_url"]
. "/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
} else {
$ref='<a href="mailto:'.$coldata.'">';
}
$data=$coldata."</a>";
} else { // But these do not
$ref=""; $data=$coldata;
}
$columns_html .= "<td>" . $ref . $data . "</td>";
}
$columns_html .= '<tr><td colspan="4">&nbsp;</td></tr>'
. '<tr><td><b>' . lang("Record owner") . '</b></td><td>'
. $phpgw->common->grab_owner_name($owner) . '</td><td><b>'
. lang("Record Access") . '</b></td><td></table>';
if ($access != "private" && $access != "public") {
$access_link .= lang("Group access") . " - " . $phpgw->accounts->convert_string_to_names_access($access);
} else {
$access_link .= $access;
}
$editlink = $phpgw->common->check_owner($owner,"edit.php",lang("edit"),"ab_id=" . $ab_id . "&start=".$start."&sort=".$sort."&order=".$order);
$vcardlink = '<form action="'.$phpgw->link("vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
$donelink = '<form action="'.$phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
$t->set_var("ab_id",$ab_id);
$t->set_var("sort",$sort);
$t->set_var("order",$order);
$t->set_var("filter",$filter);
$t->set_var("start",$start);
$t->set_var("view_header",$view_header);
$t->set_var("cols",$columns_html);
$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_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("vcard_link",$vcardlink);
$t->parse("out","view");
$t->pparse("out","view");
$phpgw->common->phpgw_footer();
?> ?>