mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
First of a few major changes to enable the contacts class
This commit is contained in:
parent
208adb1792
commit
182384fc2e
@ -23,7 +23,7 @@
|
||||
$t = new Template($phpgw_info["server"]["app_tpl"]);
|
||||
$t->set_file(array( "add" => "add.tpl"));
|
||||
|
||||
$this = CreateObject("addressbook.addressbook");
|
||||
$this = CreateObject("phpgwapi.contacts");
|
||||
|
||||
if ($AddVcard){
|
||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] .
|
||||
@ -48,30 +48,28 @@
|
||||
$url = "";
|
||||
}
|
||||
|
||||
$this->id = $ab_id;
|
||||
$this->company = $company;
|
||||
//$this->company_id = $company_id;
|
||||
$this->firstname = $firstname;
|
||||
$this->lastname = $lastname;
|
||||
$this->email = $email;
|
||||
$this->title = $title;
|
||||
$this->wphone = $wphone;
|
||||
$this->hphone = $hphone;
|
||||
$this->fax = $fax;
|
||||
$this->pager = $pager;
|
||||
$this->mphone = $mphone;
|
||||
$this->ophone = $ophone;
|
||||
$this->street = $street;
|
||||
$this->address2 = $address2;
|
||||
$this->city = $city;
|
||||
$this->state = $state;
|
||||
$this->zip = $zip;
|
||||
$this->bday = $bday;
|
||||
$this->url = $url;
|
||||
$this->notes = $notes;
|
||||
$this->access = $access;
|
||||
$fields["company"] = $company;
|
||||
$fields["company_id"] = $company_id;
|
||||
$fields["firstname"] = $firstname;
|
||||
$fields["lastname"] = $lastname;
|
||||
$fields["email"] = $email;
|
||||
$fields["title"] = $title;
|
||||
$fields["wphone"] = $wphone;
|
||||
$fields["hphone"] = $hphone;
|
||||
$fields["fax"] = $fax;
|
||||
$fields["pager"] = $pager;
|
||||
$fields["mphone"] = $mphone;
|
||||
$fields["ophone"] = $ophone;
|
||||
$fields["street"] = $street;
|
||||
$fields["address2"] = $address2;
|
||||
$fields["city"] = $city;
|
||||
$fields["state"] = $state;
|
||||
$fields["zip"] = $zip;
|
||||
$fields["bday"] = $bday;
|
||||
$fields["url"] = $url;
|
||||
$fields["notes"] = $notes;
|
||||
|
||||
$this->add_entry();
|
||||
$this->add($phpgw_info["user"]["account_id"],$access,$fields);
|
||||
|
||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/",
|
||||
"cd=14"));
|
||||
|
55
addressbook/contacts.sql
Normal file
55
addressbook/contacts.sql
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
create table contacts (
|
||||
id int (8) NOT NULL DEFAULT 0,
|
||||
FN varchar (64),
|
||||
SOUND varchar (64),
|
||||
ORG_Name varchar (64),
|
||||
ORG_Unit varchar (64),
|
||||
TITLE varchar (64),
|
||||
N_Family varchar (64),
|
||||
N_Given varchar (64),
|
||||
N_Middle varchar (64),
|
||||
N_Prefix varchar (64),
|
||||
N_Suffix varchar (64),
|
||||
LABEL text,
|
||||
ADR_POAddr varchar (64),
|
||||
ADR_ExtAddr varchar (64),
|
||||
ADR_Street varchar (64),
|
||||
ADR_Locality varchar (32),
|
||||
ADR_Region varchar (32),
|
||||
ADR_PostalCode varchar (32),
|
||||
ADR_CountryName varchar (32),
|
||||
ADR_Work enum('y','n') NOT NULL DEFAULT 'n',
|
||||
ADR_Home enum('y','n') NOT NULL DEFAULT 'n',
|
||||
ADR_Parcel enum('y','n') NOT NULL DEFAULT 'n',
|
||||
ADR_Postal enum('y','n') NOT NULL DEFAULT 'n',
|
||||
TZ varchar (8),
|
||||
GEO varchar (32),
|
||||
A_TEL varchar (40) NOT NULL DEFAULT "+1 (000) 000-0000",
|
||||
A_TEL_Work enum('y','n') NOT NULL DEFAULT 'n',
|
||||
A_TEL_Home enum('y','n') NOT NULL DEFAULT 'n',
|
||||
A_TEL_Voice enum('y','n') NOT NULL DEFAULT 'n',
|
||||
A_TEL_Msg enum('y','n') NOT NULL DEFAULT 'n',
|
||||
A_TEL_Fax enum('y','n') NOT NULL DEFAULT 'n',
|
||||
A_TEL_Prefer enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL varchar (40) NOT NULL DEFAULT "+1 (000) 000-0000",
|
||||
B_TEL_Work enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL_Home enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL_Voice enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL_Msg enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL_Fax enum('y','n') NOT NULL DEFAULT 'n',
|
||||
B_TEL_Prefer enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL varchar (40) NOT NULL DEFAULT "+1 (000) 000-0000",
|
||||
C_TEL_Work enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL_Home enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL_Voice enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL_Msg enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL_Fax enum('y','n') NOT NULL DEFAULT 'n',
|
||||
C_TEL_Prefer enum('y','n') NOT NULL DEFAULT 'n',
|
||||
D_EMAILTYPE enum('INTERNET','CompuServe','AOL','Prodigy','eWorld','AppleLink','AppleTalk','PowerShare','IBMMail','ATTMail','MCIMail','X.400','TLX') NOT NULL DEFAULT "INTERNET",
|
||||
D_EMAIL varchar (64),
|
||||
D_EMAIL_Work enum('y','n') NOT NULL DEFAULT 'n',
|
||||
D_EMAIL_Home enum('y','n') NOT NULL DEFAULT 'n',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE id (id)
|
||||
);
|
@ -24,31 +24,34 @@
|
||||
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/"));
|
||||
}
|
||||
|
||||
$this = CreateObject("addressbook.addressbook");
|
||||
$this = CreateObject("phpgwapi.contacts");
|
||||
|
||||
$t = new Template($phpgw_info["server"]["app_tpl"]);
|
||||
$t->set_file(array("delete" => "delete.tpl"));
|
||||
|
||||
|
||||
if ($confirm != "true") {
|
||||
$phpgw->db->query("select ab_owner from addressbook where ab_id='$ab_id'");
|
||||
$phpgw->db->next_record();
|
||||
$phpgw->db->query("select ab_owner from addressbook where ab_id='$ab_id'");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
if ($phpgw->db->f("ab_owner") != $phpgw_info["user"]["account_id"])
|
||||
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/"));
|
||||
if ($phpgw->db->f("ab_owner") != $phpgw_info["user"]["account_id"]) {
|
||||
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/"));
|
||||
}
|
||||
|
||||
?>
|
||||
<body bgcolor=FFFFFF aLink=0000EE link=0000EE vlink=0000EE>
|
||||
<center><?php echo lang("Are you sure you want to delete this entry ?"); ?><center>
|
||||
<br><center><a href="<?php
|
||||
echo $phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query");
|
||||
?>"><?php echo lang("NO"); ?></a>
|
||||
<a href="<?php echo $phpgw->link("delete.php","ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query");
|
||||
?>"><?php echo lang("YES"); ?></a><center>
|
||||
<?php
|
||||
$phpgw->common->phpgw_footer();
|
||||
$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(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(lang_yes,lang("YES"));
|
||||
$t->pparse("out","delete");
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
|
||||
} else {
|
||||
$this->id = $ab_id;
|
||||
$this->delete_entry();
|
||||
$this->account_id=$phpgw_info["user"]["account_id"];
|
||||
$this->delete($ab_id);
|
||||
|
||||
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/",
|
||||
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
|
||||
@Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]. "/addressbook/",
|
||||
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query"));
|
||||
}
|
||||
?>
|
||||
|
@ -29,11 +29,11 @@
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$this = CreateObject("addressbook.addressbook");
|
||||
$this = CreateObject("phpgwapi.contacts");
|
||||
|
||||
if (! $submit) {
|
||||
$fields = $this->get_entry($ab_id);
|
||||
form("","edit.php","Edit",$fields);
|
||||
$fields = $this->read_single_entry($ab_id,$this->stock_addressbook_fields);
|
||||
form("","edit.php","Edit",$fields[0]);
|
||||
} else {
|
||||
if ($url == "http://") {
|
||||
$url = "";
|
||||
@ -47,30 +47,28 @@
|
||||
$access = $phpgw->accounts->array_to_string($access,$n_groups);
|
||||
}
|
||||
|
||||
$this->id = $ab_id;
|
||||
$this->company = $company;
|
||||
$this->company_id = $company_id;
|
||||
$this->firstname = $firstname;
|
||||
$this->lastname = $lastname;
|
||||
$this->email = $email;
|
||||
$this->title = $title;
|
||||
$this->wphone = $wphone;
|
||||
$this->hphone = $hphone;
|
||||
$this->fax = $fax;
|
||||
$this->pager = $pager;
|
||||
$this->mphone = $mphone;
|
||||
$this->ophone = $ophone;
|
||||
$this->street = $street;
|
||||
$this->address2 = $address2;
|
||||
$this->city = $city;
|
||||
$this->state = $state;
|
||||
$this->zip = $zip;
|
||||
$this->bday = $bday;
|
||||
$this->url = $url;
|
||||
$this->notes = $notes;
|
||||
$this->access = $access;
|
||||
$fields["company"] = $company;
|
||||
$fields["company_id"] = $company_id;
|
||||
$fields["firstname"] = $firstname;
|
||||
$fields["lastname"] = $lastname;
|
||||
$fields["email"] = $email;
|
||||
$fields["title"] = $title;
|
||||
$fields["wphone"] = $wphone;
|
||||
$fields["hphone"] = $hphone;
|
||||
$fields["fax"] = $fax;
|
||||
$fields["pager"] = $pager;
|
||||
$fields["mphone"] = $mphone;
|
||||
$fields["ophone"] = $ophone;
|
||||
$fields["street"] = $street;
|
||||
$fields["address2"] = $address2;
|
||||
$fields["city"] = $city;
|
||||
$fields["state"] = $state;
|
||||
$fields["zip"] = $zip;
|
||||
$fields["bday"] = $bday;
|
||||
$fields["url"] = $url;
|
||||
$fields["notes"] = $notes;
|
||||
|
||||
$this->update_entry();
|
||||
$this->update($ab_id,$phpgw_info["user"]["account_id"],$access,$fields);
|
||||
|
||||
Header("Location: " . $phpgw->link("view.php","&ab_id=$ab_id&order=$order&sort=$sort&filter="
|
||||
. "$filter&start=$start"));
|
||||
|
@ -34,35 +34,34 @@
|
||||
'url' => 'URL'
|
||||
);
|
||||
|
||||
|
||||
function form($format,$action,$title,$fields) { // used for add/edit
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
$t = new Template($phpgw_info["server"]["app_tpl"]);
|
||||
$t->set_file(array( "form" => "form.tpl"));
|
||||
|
||||
$email = $fields->email;
|
||||
$firstname = $fields->firstname;
|
||||
$lastname = $fields->lastname;
|
||||
$title = $fields->title;
|
||||
$hphone = $fields->hphone;
|
||||
$wphone = $fields->wphone;
|
||||
$fax = $fields->fax;
|
||||
$pager = $fields->pager;
|
||||
$mphone = $fields->mphone;
|
||||
$ophone = $fields->ophone;
|
||||
$street = $fields->street;
|
||||
$address2 = $fields->address2;
|
||||
$city = $fields->city;
|
||||
$state = $fields->state;
|
||||
$zip = $fields->zip;
|
||||
$bday = $fields->bday;
|
||||
$notes = $fields->notes;
|
||||
$access = $fields->access;
|
||||
$ab_company = $fields->company;
|
||||
$company_id = $fields->company_id;
|
||||
$company_name = $fields->company;
|
||||
$url = $fields->url;
|
||||
$email = $fields["email"];
|
||||
$firstname = $fields["firstname"];
|
||||
$lastname = $fields["lastname"];
|
||||
$title = $fields["title"];
|
||||
$hphone = $fields["hphone"];
|
||||
$wphone = $fields["wphone"];
|
||||
$fax = $fields["fax"];
|
||||
$pager = $fields["pager"];
|
||||
$mphone = $fields["mphone"];
|
||||
$ophone = $fields["ophone"];
|
||||
$street = $fields["street"];
|
||||
$address2 = $fields["address2"];
|
||||
$city = $fields["city"];
|
||||
$state = $fields["state"];
|
||||
$zip = $fields["zip"];
|
||||
$bday = $fields["bday"];
|
||||
$notes = $fields["notes"];
|
||||
$access = $fields["access"];
|
||||
$company = $fields["company"];
|
||||
$company_id = $fields["company_id"];
|
||||
$company_name = $fields["company"];
|
||||
$url = $fields["url"];
|
||||
|
||||
if ($format != "view") {
|
||||
$email = "<input name=\"email\" value=\"$email\">";
|
||||
@ -81,9 +80,10 @@
|
||||
$state = "<input name=\"state\" value=\"$state\">";
|
||||
$zip = "<input name=\"zip\" value=\"$zip\">";
|
||||
|
||||
/*
|
||||
if($phpgw_info["apps"]["timetrack"]["enabled"]) {
|
||||
$company = '<select name="company">';
|
||||
if (!$ab_company) {
|
||||
if (!$company) {
|
||||
$company .= '<option value="0" SELECTED>'. lang("none").'</option>';
|
||||
} else {
|
||||
$company .= '<option value="0">'. lang("none").'</option>';
|
||||
@ -98,9 +98,9 @@
|
||||
$company .= ">" . $phpgw->db->f("company_name") . "</option>";
|
||||
}
|
||||
$company .= "</select>";
|
||||
} else {
|
||||
$company = "<input name=\"company\" value=\"$ab_company\">";
|
||||
}
|
||||
} else { */
|
||||
$company = "<input name=\"company\" value=\"$company\">";
|
||||
/* } */
|
||||
|
||||
if (strlen($bday) > 2) {
|
||||
list( $month, $day, $year ) = split( '/', $bday );
|
||||
@ -149,11 +149,13 @@
|
||||
. $notes . "</TEXTAREA></form>";
|
||||
if ($bday == "//")
|
||||
$bday = "";
|
||||
|
||||
/*
|
||||
if($phpgw_info["apps"]["timetrack"]["enabled"]) {
|
||||
$company = $company_name;
|
||||
} else {
|
||||
$company = $ab_company;
|
||||
}
|
||||
} else { */
|
||||
$company = $company;
|
||||
/* } */
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
@ -214,7 +216,7 @@
|
||||
. ':</font></td><td colspan="3"><select name="n_groups[]" '
|
||||
. 'multiple size="5">';
|
||||
|
||||
$user_groups = $phpgw->accounts->read_group_names($fields["ab_owner"]);
|
||||
$user_groups = $phpgw->accounts->read_group_names($fields["owner"]);
|
||||
for ($i=0;$i<count($user_groups);$i++) {
|
||||
$access_link .= '<option value="'.$user_groups[$i][0].'"';
|
||||
if (ereg(",".$user_groups[$i][0].",",$access))
|
||||
|
@ -12,39 +12,66 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info["flags"] = array("currentapp" => "addressbook", "enable_addressbook_class" => True,
|
||||
$phpgw_info["flags"] = array("currentapp" => "addressbook",
|
||||
"enable_contacts_class" => True,
|
||||
"enable_nextmatchs_class" => True);
|
||||
include("../header.inc.php");
|
||||
|
||||
//echo "<br>Time track = " . $phpgw_info["apps"]["timetrack"]["enabled"];
|
||||
|
||||
if (! $start)
|
||||
$start = 0;
|
||||
|
||||
$t = new Template($phpgw_info["server"]["app_tpl"]);
|
||||
$t->set_file(array( "addressbook_header" => "header.tpl",
|
||||
"column" => "column.tpl",
|
||||
"row" => "row.tpl",
|
||||
"addressbook_footer" => "footer.tpl" ));
|
||||
|
||||
$this = CreateObject("addressbook.addressbook");
|
||||
$entries = $this->get_entries($query,$filter,$sort,$order,$start);
|
||||
$this = CreateObject("phpgwapi.contacts");
|
||||
|
||||
$columns_to_display=$this->columns_to_display;
|
||||
if($phpgw_info["user"]["preferences"]["common"]["maxmatchs"] ) {
|
||||
$limit = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
|
||||
} else { // this must be broken, but it works
|
||||
$limit = 15;
|
||||
while ($column = each($this->stock_addressbook_fields)) {
|
||||
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
|
||||
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
|
||||
$cols .= " <td height=\"21\">\n";
|
||||
$cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">';
|
||||
$cols .= $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1]));
|
||||
$cols .= "</font>\n </td>";
|
||||
$cols .= "\n";
|
||||
|
||||
// To be used when displaying the rows
|
||||
$columns_to_display[$column[0]] = True;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $start)
|
||||
$start = 0;
|
||||
|
||||
// insert acl stuff here
|
||||
|
||||
$offset = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
|
||||
|
||||
$entries = $this->read($start,$offset,$access,$columns_to_display,$query,$filter,$sort,$order);
|
||||
|
||||
$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"]);
|
||||
|
||||
if ($this->total_records > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) {
|
||||
$lang_showing=lang("showing x - x of x",($start + 1),
|
||||
($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),
|
||||
$this->total_records);
|
||||
} else {
|
||||
$lang_showing=lang("showing x",$this->total_records);
|
||||
}
|
||||
|
||||
// set basic vars and parse the header
|
||||
$t->set_var(font,$phpgw_info["theme"]["font"]);
|
||||
$t->set_var("lang_view",lang("View"));
|
||||
$t->set_var("lang_vcard",lang("VCard"));
|
||||
$t->set_var("lang_edit",lang("Edit"));
|
||||
|
||||
$t->set_var(searchreturn,$this->searchreturn);
|
||||
$t->set_var(lang_showing,$this->lang_showing);
|
||||
$t->set_var(search_filter,$this->search_filter);
|
||||
$t->set_var(searchreturn,$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"]);
|
||||
@ -62,19 +89,21 @@
|
||||
$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",$this->cols);
|
||||
$t->set_var("cols",$cols);
|
||||
|
||||
$t->pparse("out","addressbook_header");
|
||||
|
||||
for ($i=0;$i<$limit;$i++) { // each entry
|
||||
// Show the entries
|
||||
for ($i=0;$i<count($entries);$i++) { // each entry
|
||||
$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 = $this->coldata($column[0],$i);
|
||||
$myid = $entries->ab_id[$i];
|
||||
$myowner = $entries->owner[$i];
|
||||
$coldata = $entries[$i][$column[0]];
|
||||
// Some fields require special formatting.
|
||||
if ($column[0] == "url") {
|
||||
$ref='<a href="'.$coldata.'" target="_new">';
|
||||
@ -96,8 +125,6 @@
|
||||
$t->parse("columns","column",True);
|
||||
}
|
||||
|
||||
reset($columns_to_display); // If we don't reset it, our inside while won't loop
|
||||
|
||||
$t->set_var(row_view_link,$phpgw->link("view.php","ab_id=$myid&start=$start&order=$order&filter="
|
||||
. "$filter&query=$query&sort=$sort"));
|
||||
$t->set_var(row_vcard_link,$phpgw->link("vcardout.php","ab_id=$myid&start=$start&order=$order&filter="
|
||||
@ -107,9 +134,10 @@
|
||||
|
||||
$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->pparse("out","addressbook_footer");
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -1,9 +1,26 @@
|
||||
{errors}
|
||||
{title}
|
||||
<table border="0" align="center" width="70%">
|
||||
<tr>
|
||||
{nml}
|
||||
<td width="40%">
|
||||
<div align="center">
|
||||
<form method="POST" action="{action_url}">
|
||||
{common_hidden_vars}
|
||||
<input type="text" name="query" value="{search_value}">
|
||||
<input type="submit" name="search" value="{search}">
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
{nmr}
|
||||
</tr>
|
||||
</table>
|
||||
<form method="POST" action="{action_url}">
|
||||
<table border="0" align="center" width="50%" cols="4">
|
||||
{row}
|
||||
</table>
|
||||
{common_hidden_vars_form}
|
||||
<input type="hidden" name="processed" value="{processed}">
|
||||
<center><input type="submit" name="submit" value="{submit_lang}"></center>
|
||||
</form>
|
||||
|
||||
|
@ -1,9 +1,26 @@
|
||||
{errors}
|
||||
{title}
|
||||
<table border="0" align="center" width="70%">
|
||||
<tr>
|
||||
{nml}
|
||||
<td width="40%">
|
||||
<div align="center">
|
||||
<form method="POST" action="{action_url}">
|
||||
{common_hidden_vars}
|
||||
<input type="text" name="query" value="{search_value}">
|
||||
<input type="submit" name="search" value="{search}">
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
{nmr}
|
||||
</tr>
|
||||
</table>
|
||||
<form method="POST" action="{action_url}">
|
||||
<table border="0" align="center" width="50%" cols="4">
|
||||
{row}
|
||||
</table>
|
||||
{common_hidden_vars_form}
|
||||
<input type="hidden" name="processed" value="{processed}">
|
||||
<center><input type="submit" name="submit" value="{submit_lang}"></center>
|
||||
</form>
|
||||
|
||||
|
@ -1,9 +1,26 @@
|
||||
{errors}
|
||||
{title}
|
||||
<table border="0" align="center" width="70%">
|
||||
<tr>
|
||||
{nml}
|
||||
<td width="40%">
|
||||
<div align="center">
|
||||
<form method="POST" action="{action_url}">
|
||||
{common_hidden_vars}
|
||||
<input type="text" name="query" value="{search_value}">
|
||||
<input type="submit" name="search" value="{search}">
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
{nmr}
|
||||
</tr>
|
||||
</table>
|
||||
<form method="POST" action="{action_url}">
|
||||
<table border="0" align="center" width="50%" cols="4">
|
||||
{row}
|
||||
</table>
|
||||
{common_hidden_vars_form}
|
||||
<input type="hidden" name="processed" value="{processed}">
|
||||
<center><input type="submit" name="submit" value="{submit_lang}"></center>
|
||||
</form>
|
||||
|
||||
|
2335
addressbook/vcard-21.txt
Normal file
2335
addressbook/vcard-21.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ if ($action == "Load Vcard"){
|
||||
echo '<body bgcolor="' . $phpgw_info["theme"]["bg_color"] . '">';
|
||||
}
|
||||
|
||||
// Some on the methods where borrowed from
|
||||
// Some of the methods where borrowed from
|
||||
// Squirrelmail <Luke Ehresman> http://www.squirrelmail.org
|
||||
|
||||
$sep = $phpgw->common->filesystem_separator();
|
||||
|
@ -13,9 +13,9 @@
|
||||
/* $Id$ */
|
||||
|
||||
if ($nolname || $nofname) {
|
||||
$phpgw_info["flags"] = array("noheader" => False, "nonavbar" => False);
|
||||
}else{
|
||||
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
|
||||
$phpgw_info["flags"] = array("noheader" => False, "nonavbar" => False);
|
||||
} else {
|
||||
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
|
||||
}
|
||||
|
||||
$phpgw_info["flags"]["enable_addressbook_class"] = True;
|
||||
@ -27,111 +27,120 @@
|
||||
$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_addressbook_fields);
|
||||
|
||||
if($phpgw_info["apps"]["timetrack"]["enabled"]) {
|
||||
$phpgw->db->query("SELECT * FROM addressbook as a, customers as c WHERE a.ab_company_id = c.company_id "
|
||||
. "AND ab_id=$ab_id AND (ab_owner='"
|
||||
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
||||
} else {
|
||||
$phpgw->db->query("SELECT * FROM addressbook "
|
||||
. "WHERE ab_id=$ab_id AND (ab_owner='"
|
||||
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
||||
$email = $fields[0]["email"];
|
||||
$firstname = $fields[0]["firstname"];
|
||||
$lastname = $fields[0]["lastname"];
|
||||
$title = $fields[0]["title"];
|
||||
$hphone = $fields[0]["hphone"];
|
||||
$wphone = $fields[0]["wphone"];
|
||||
$fax = $fields[0]["fax"];
|
||||
$pager = $fields[0]["pager"];
|
||||
$mphone = $fields[0]["mphone"];
|
||||
$ophone = $fields[0]["ophone"];
|
||||
$street = $fields[0]["street"];
|
||||
$address2 = $fields[0]["address2"];
|
||||
$city = $fields[0]["city"];
|
||||
$state = $fields[0]["state"];
|
||||
$zip = $fields[0]["zip"];
|
||||
$bday = $fields[0]["bday"];
|
||||
$notes = $fields[0]["notes"];
|
||||
$access = $fields[0]["access"];
|
||||
$company = $fields[0]["company"];
|
||||
$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"));
|
||||
}
|
||||
|
||||
header("Content-type: text/X-VCARD");
|
||||
$fn = explode("@",$email);
|
||||
$filename = sprintf("%s.vcf", $fn[0]);
|
||||
|
||||
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
|
||||
printf("BEGIN:VCARD\r\n");
|
||||
printf("N:%s;%s\r\n", $lastname, $firstname);
|
||||
printf("FN:%s %s\r\n", $firstname, $lastname);
|
||||
|
||||
/* This stuff is optional. */
|
||||
if($title != "") /* Title */
|
||||
printf("TITLE:%s\r\n",$title);
|
||||
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 */
|
||||
// Warning Ugly U.S. centric assumption made here.....
|
||||
printf("ADR:;%s;%s;%s;%s;%s;%s\r\n", $address2,
|
||||
$street,$city,$state,$zip,"United States"
|
||||
);
|
||||
|
||||
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\r\n", $company);
|
||||
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>";
|
||||
}
|
||||
$phpgw->db->next_record();
|
||||
|
||||
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)
|
||||
{
|
||||
if($nolname || $nofname)
|
||||
$phpgw->common->phpgw_footer();
|
||||
|
||||
/* First name and last must be in the vcard. */
|
||||
if($phpgw->db->f("ab_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($phpgw->db->f("ab_firstname") =="" )
|
||||
{
|
||||
Header("Location: " . $phpgw->link("vcardout.php","nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort"));
|
||||
}
|
||||
|
||||
header("Content-type: text/X-VCARD");
|
||||
$fn = explode("@",$phpgw->db->f("ab_email"));
|
||||
$filename = sprintf("%s.vcf", $fn[0]);
|
||||
|
||||
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
|
||||
printf("BEGIN:VCARD\r\n");
|
||||
printf("N:%s;%s\r\n", $phpgw->db->f("ab_lastname"), $phpgw->db->f("ab_firstname"));
|
||||
printf("FN:%s %s\r\n", $phpgw->db->f("ab_firstname"), $phpgw->db->f("ab_lastname"));
|
||||
|
||||
/* This stuff is optional. */
|
||||
if($phpgw->db->f("ab_title") != "") /* Title */
|
||||
printf("TITLE:%s\r\n",$phpgw->db->f("ab_title"));
|
||||
if($phpgw->db->f("ab_email") != "") /* E-mail */
|
||||
printf("EMAIL;INTERNET:%s\r\n", $phpgw->db->f("ab_email"));
|
||||
if($phpgw->db->f("ab_hphone") != "") /* Home Phone */
|
||||
printf("TEL;HOME:%s\r\n", $phpgw->db->f("ab_hphone"));
|
||||
if($phpgw->db->f("ab_wphone") != "") /* Work Phone */
|
||||
printf("TEL;WORK:%s\r\n", $phpgw->db->f("ab_wphone"));
|
||||
if($phpgw->db->f("ab_mphone") != "") /* Mobile Phone */
|
||||
printf("TEL;CELL:%s\r\n", $phpgw->db->f("ab_mphone"));
|
||||
if($phpgw->db->f("ab_fax") != "") /* Fax Number */
|
||||
printf("TEL;FAX:%s\r\n", $phpgw->db->f("ab_fax"));
|
||||
if($phpgw->db->f("ab_pager") != "") /* Pager Number */
|
||||
printf("TEL;PAGER:%s\r\n", $phpgw->db->f("ab_pager"));
|
||||
// if($pgpgw->db->f("ab_ophone") != "") /* Other Phone */
|
||||
// $NOTES .= "Other Phone: " . $phpgw->db->f("ab_ophone");
|
||||
/* The address one is pretty icky. Send it if ANY of the fields are present. */
|
||||
if($phpgw->db->f("ab_address2") != "" || /* Street Line 1 */
|
||||
$phpgw->db->f("ab_street") != "" || /* Street Line 2 */
|
||||
$phpgw->db->f("ab_city") != "" || /* City */
|
||||
$phpgw->db->f("ab_state") != "" || /* State */
|
||||
$phpgw->db->f("ab_zip") != "") /* Zip */
|
||||
// Warning Ugly U.S. centric assumption made here.....
|
||||
printf("ADR:;%s;%s;%s;%s;%s;%s\r\n", $phpgw->db->f("ab_address2"),
|
||||
$phpgw->db->f("ab_street"),$phpgw->db->f("ab_city"),
|
||||
$phpgw->db->f("ab_state"),$phpgw->db->f("ab_zip"),
|
||||
"United States"
|
||||
);
|
||||
if($phpgw->db->f("ab_bday") != "" && $phpgw->db->f("ab_bday") != "//") /* Birthday */
|
||||
printf("BDAY:%s\r\n", $phpgw->db->f("ab_bday")); /* This is not the right format. */
|
||||
if($phpgw->db->f("ab_company") != "") /* Company Name (Really isn't company_name?) */
|
||||
printf("ORG:%s\r\n", $phpgw->db->f("ab_company"));
|
||||
if($phpgw->db->f("ab_notes") != "") /* Notes */
|
||||
$NOTES .= $phpgw->db->f("ab_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. */
|
||||
/* End of php. */
|
||||
?>
|
||||
|
@ -16,94 +16,59 @@
|
||||
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
|
||||
}
|
||||
|
||||
$phpgw_info["flags"]["currentapp"] = "addressbook";
|
||||
$phpgw_info["flags"]["enable_addressbook_class"] = True;
|
||||
$phpgw_info["flags"] = array("currentapp" => "addressbook",
|
||||
"enable_contacts_class" => True,
|
||||
"enable_nextmatchs_class" => True);
|
||||
|
||||
include("../header.inc.php");
|
||||
|
||||
$t = new Template($phpgw_info["server"]["app_tpl"]);
|
||||
$t->set_file(array( "view" => "view.tpl"));
|
||||
|
||||
function checkfor_specialformat($field,$data)
|
||||
{
|
||||
global $phpgw_info, $phpgw;
|
||||
|
||||
if ($field == "email") {
|
||||
if ($phpgw_info["user"]["apps"]["email"]) {
|
||||
$s = '<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php",
|
||||
"to=" . urlencode($data)) . '" target="_new">' . $data . '</a>';
|
||||
} else {
|
||||
$s = '<a href="mailto:' . $data . '">' . $data . '</a>';
|
||||
}
|
||||
} else if ($field == "URL") {
|
||||
if (! ereg("^http://",$data)) {
|
||||
$data = "http://" . $data;
|
||||
}
|
||||
$s = '<a href="' . $data . '" target="_new">' . $data . '</a>';
|
||||
} else if ($field == "birthday") {
|
||||
$date = explode("/",$data);
|
||||
$s = $phpgw->common->dateformatorder($date[2],$date[1],$date[0],True);
|
||||
} else {
|
||||
$s = $data . " ";
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
$this = CreateObject("phpgwapi.contacts");
|
||||
|
||||
if (! $ab_id) {
|
||||
Header("Location: " . $phpgw->link("index.php"));
|
||||
}
|
||||
|
||||
if ($filter != "private") {
|
||||
$filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access");
|
||||
}
|
||||
|
||||
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
|
||||
$phpgw->db->query("SELECT * FROM addressbook as a, customers as c WHERE a.ab_company_id = c.company_id "
|
||||
. "AND ab_id=$ab_id AND (ab_owner='"
|
||||
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
||||
} else {
|
||||
$phpgw->db->query("SELECT * FROM addressbook WHERE ab_id=$ab_id AND (ab_owner='"
|
||||
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
||||
}
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$view_header = "<p> <b>" . lang("Address book - view") . "</b><hr><p>";
|
||||
|
||||
$i = 0;
|
||||
// Need to replace abc with $this->stock_addressbook_fields
|
||||
while ($column = each($abc)) {
|
||||
if ($phpgw->db->f("ab_" . $column[0])) {
|
||||
$columns_to_display[$i]["field_name"] = $column[1];
|
||||
$columns_to_display[$i]["field_value"] = $phpgw->db->f("ab_" . $column[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($phpgw->db->f("ab_notes")) {
|
||||
$columns_to_display[$i]["field_name"] = "Notes";
|
||||
$columns_to_display[$i]["field_value"] = $phpgw->db->f("ab_notes");
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
$fields = $this->read_single_entry($ab_id,$this->stock_addressbook_fields);
|
||||
|
||||
$access = $fields[0]["access"];
|
||||
$owner = $fields[0]["owner"];
|
||||
|
||||
$view_header = "<p> <b>" . lang("Address book - view") . "</b><hr><p>";
|
||||
$view_header .= '<table border="0" cellspacing="2" cellpadding="2" width="80%" align="center">';
|
||||
for ($i=0;$i<200;) { // The $i<200 is only used for a brake
|
||||
if (! $columns_to_display[$i]["field_name"]) break;
|
||||
|
||||
$columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
|
||||
. "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
|
||||
. "</td>";
|
||||
|
||||
$i++;
|
||||
|
||||
if (! $columns_to_display[$i]["field_name"]) break;
|
||||
|
||||
$columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
|
||||
. "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
|
||||
. "</td>";
|
||||
|
||||
$i++;
|
||||
$columns_html .= "</td></tr>";
|
||||
|
||||
while ($column = each($columns_to_display)) { // each entry column
|
||||
$columns_html .= "<tr><td><b>" . lang($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>";
|
||||
}
|
||||
$access = $phpgw->db->f("ab_access");
|
||||
$owner = $phpgw->db->f("ab_owner");
|
||||
$ab_id = $phpgw->db->f("ab_id");
|
||||
|
||||
$columns_html .= '<tr><td colspan="4"> </td></tr>'
|
||||
. '<tr><td><b>' . lang("Record owner") . '</b></td><td>'
|
||||
@ -116,9 +81,9 @@
|
||||
$access_link .= $access;
|
||||
}
|
||||
|
||||
$editlink .= $phpgw->common->check_owner($phpgw->db->f("ab_owner"),"edit.php",lang("edit"),"ab_id=" . $phpgw->db->f("ab_id")."&start=".$start."&sort=".$sort."&order=".$order);
|
||||
$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").'">';
|
||||
$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);
|
||||
|
Loading…
Reference in New Issue
Block a user