Some changes to templates and php files to add some custom fields

This commit is contained in:
Miles Lott 2001-02-02 16:19:37 +00:00
parent 48b42b2db8
commit ca81e77597
11 changed files with 97 additions and 34 deletions

View File

@ -48,26 +48,27 @@
$url = "";
}
$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;
$fields["ORG_Name"] = $company;
$fields["N_Given"] = $firstname;
$fields["N_Family"] = $lastname;
$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_Country"] = $country;
$fields["bday"] = $bday;
$fields["url"] = $url;
$fields["notes"] = $notes;
$this->add($phpgw_info["user"]["account_id"],$access,$fields);

View File

@ -60,6 +60,7 @@
$fields["N_Given"] = $firstname;
$fields["N_Family"] = $lastname;
$fields["D_EMAIL"] = $email;
$fields["D_EMAILTYPE"] = $email_type;
$fields["TITLE"] = $title;
$fields["A_TEL"] = $wphone;
$fields["B_TEL"] = $hphone;
@ -72,6 +73,7 @@
$fields["ADR_Locality"] = $city;
$fields["ADR_Region"] = $state;
$fields["ADR_PostalCode"] = $zip;
$fields["ADR_Country"] = $country;
$fields["bday"] = $bday;
$fields["url"] = $url;
$fields["notes"] = $notes;

View File

@ -38,6 +38,7 @@
var $db;
var $account_id;
var $stock_contact_fields; // This is an array of all the fields in the addressbook
var $email_types;
var $total_records;
function split_ab_and_extras($fields)

View File

@ -24,7 +24,7 @@
/* $Id$ */
/*
contacts_extra (
addressbook_extra (
contact_id int,
contact_owner int,
contact_name varchar(255),
@ -38,7 +38,8 @@
{
var $db;
var $account_id;
var $stock_contact_fields; // This is an array of all the fields in the contacts table
var $stock_contact_fields; // This is an array of all the fields in the addressbook table
var $email_types;
var $total_records; // This will contain numrows for data retrieved
function contacts_()
@ -97,6 +98,11 @@
"D_EMAIL_Work" => "D.EMAIL.Work", //yn
"D_EMAIL_Home" => "D.EMAIL.Home", //yn
);
$this->email_types = array("INTERNET","CompuServe","AOL","Prodigy",
"eWorld","AppleLink","AppleTalk","PowerShare",
"IBMMail","ATTMail","MCIMail","X.400","TLX"
);
}
function read_single_entry($id,$fields)
@ -212,7 +218,7 @@
list($ab_fields,$ab_fieldnames,$extra_fields) = $this->split_ab_and_extras($fields);
//$this->db->lock(array("contacts"));
$this->db->query("insert into contacts (owner,"
$this->db->query("insert into addressbook (owner,"
. implode(",",$this->stock_contact_fields)
. ") values ('$owner','"
. implode("','",$this->loop_addslashes($ab_fields)) . "')",__LINE__,__FILE__);
@ -224,7 +230,7 @@
if (count($extra_fields)) {
while (list($name,$value) = each($extra_fields)) {
$this->db->query("insert into contacts_extra values ('$id','" . $this->account_id . "','"
$this->db->query("insert into addressbook_extra values ('$id','" . $this->account_id . "','"
. addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__);
}
}
@ -240,7 +246,7 @@
function add_single_extra_field($id,$owner,$field_name,$field_value)
{
$this->db->query("insert into contacts_extra values ($id,'$owner','" . addslashes($field_name)
$this->db->query("insert into addressbook_extra values ($id,'$owner','" . addslashes($field_name)
. "','" . addslashes($field_value) . "')",__LINE__,__FILE__);
}
@ -268,7 +274,7 @@
if ($field_s == ",") {
unset($field_s);
}
$this->db->query("update addressbook set owner='$owner', $fields_s where "
$this->db->query("update addressbook set owner='$owner' $fields_s where "
. "id='$id'",__LINE__,__FILE__);
}

View File

@ -55,6 +55,7 @@
$city = $fields["ADR_Locality"];
$state = $fields["ADR_Region"];
$zip = $fields["ADR_PostalCode"];
$country = $fields["ADR_Country"];
$bday = $fields["bday"];
$notes = $fields["notes"];
$company = $fields["ORG_Name"];
@ -76,6 +77,7 @@
$city = "<input name=\"city\" value=\"$city\">";
$state = "<input name=\"state\" value=\"$state\">";
$zip = "<input name=\"zip\" value=\"$zip\">";
$country = "<input name=\"country\" value=\"$country\">";
/*
if($phpgw_info["apps"]["timetrack"]["enabled"]) {
@ -140,6 +142,12 @@
$bday_year = '<input name="bday_year" size="4" maxlength="4">';
}
$email_type = "<select name=email_type>";
while ($type = each($this->email_types)) {
$email_type .= "<option value=\"\" $type[0]> </option>";
}
$email_type .= "</select>";
$notes = '<TEXTAREA cols="60" name="notes" rows="4">' . $notes . '</TEXTAREA>';
} else {
$notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
@ -246,6 +254,8 @@
$t->set_var("title",$title);
$t->set_var("lang_email",lang("Email"));
$t->set_var("email",$email);
$t->set_var("lang_email_type",lang("Email Type"));
$t->set_var("email_type",$email_type);
$t->set_var("lang_url",lang("URL"));
$t->set_var("url",$url);
$t->set_var("lang_hphone",lang("Home Phone"));
@ -272,6 +282,8 @@
$t->set_var("state",$state);
$t->set_var("lang_zip",lang("Zip Code"));
$t->set_var("zip",$zip);
$t->set_var("lang_country",lang("Country"));
$t->set_var("country",$country);
$t->set_var("access_link",$access_link);
$t->set_var("create",$create);
$t->set_var("lang_notes",lang("notes"));

View File

@ -127,7 +127,7 @@
. "$filter&query=$query&sort=$sort"));
$t->set_var(row_vcard_link,$phpgw->link("vcardout.php","ab_id=$myid&start=$start&order=$order&filter="
. "$filter&query=$query&sort=$sort"));
$t->set_var(row_edit_link,$phpgw->common->check_owner($myowner,"edit.php",lang("edit"),"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));
$t->parse("rows","row",True);

View File

@ -29,7 +29,14 @@
{email}
</td>
</tr>
<tr>
<td>
<font color="#000000" face="" size="-1">{lang_email_type}:</font>
</td>
<td>
<font size="-1">{email_type}</font>
</td>
</tr>
<tr>
<td>
<font color="#000000" face="" size="-1">{lang_company}:</font>
@ -129,6 +136,15 @@
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td><font color="#000000" face="" size="-1">{lang_country}:</font></td>
<td>
<font size="-1">
{country}
</font></td>
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td colspan="4"><font size="-1"></font></td>
</tr>

View File

@ -129,6 +129,15 @@
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td><font color="#000000" face="" size="-1">{lang_country}:</font></td>
<td>
<font size="-1">
{country}
</font></td>
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td colspan="4"><font size="-1"></font></td>
</tr>

View File

@ -129,6 +129,15 @@
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td><font color="#000000" face="" size="-1">{lang_country}:</font></td>
<td>
<font size="-1">
{country}
</font></td>
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
<td colspan="4"><font size="-1"></font></td>
</tr>

View File

@ -31,18 +31,25 @@
Header("Location: " . $phpgw->link("index.php"));
}
// Need to replace abc with $this->stock_addressbook_fields
while ($column = each($abc)) {
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 what are now extra fields
$extrafields = array ("pager" => "pager",
"mphone" => "mphone",
"ophone" => "ophone",
"address2" => "address2",
"bday" => "bday",
"url" => "url",
"notes" => "notes");
$qfields = $this->stock_contact_fields + $extrafields;
$fields = $this->read_single_entry($ab_id,$qfields);
$fields = $this->read_single_entry($ab_id,$this->stock_addressbook_fields);
$access = $fields[0]["access"];
//$access = $fields[0]["access"];
$owner = $fields[0]["owner"];
$view_header = "<p>&nbsp;<b>" . lang("Address book - view") . "</b><hr><p>";