Added the date preferences into the addressbook, added special formating to view, fixed date preference not working in todo list, and fixed the target of <a href in index.php

This commit is contained in:
jengo 2000-11-12 11:35:51 +00:00
parent 28eeae8ad7
commit 6f675c8c86
5 changed files with 98 additions and 52 deletions

View File

@ -40,6 +40,10 @@
if ($access != "private" && $access != "public") { if ($access != "private" && $access != "public") {
$access = $phpgw->accounts->array_to_string($access,$n_groups); $access = $phpgw->accounts->array_to_string($access,$n_groups);
} }
if ($url == "http://") {
$url = "";
}
if ($phpgw_info["apps"]["timetrack"]["enabled"]) { if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email," $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email,"

View File

@ -59,6 +59,10 @@
form("","edit.php","Edit",$fields); form("","edit.php","Edit",$fields);
} else { } else {
if ($url == "http://") {
$url = "";
}
if (! $bday_month && ! $bday_day && ! $bday_year) { if (! $bday_month && ! $bday_day && ! $bday_year) {
$bday = ""; $bday = "";
} else { } else {

View File

@ -13,14 +13,14 @@
/* $Id$ */ /* $Id$ */
// NOTE: This entire file needs to be rewritten. There is a great deal of code not being used // NOTE: This entire file needs to be rewritten. There is a great deal of code not being used
// anymore. (jengo) // anymore. This should also be converted to templates while where at it (jengo)
$abc = array('company' => 'company', // AddressBook Columns and their descriptions $abc = array('company' => 'company', // AddressBook Columns and their descriptions
'firstname' => 'first name', 'firstname' => 'first name',
'lastname' => 'last name', 'lastname' => 'last name',
'email' => 'email', 'email' => 'email',
'wphone' => 'work phone', 'wphone' => 'work phone',
'hphone' => 'home phone', 'hphone' => 'home phone',
'fax' => 'fax', 'fax' => 'fax',
'pager' => 'pager', 'pager' => 'pager',
'mphone' => 'mobile phone', 'mphone' => 'mobile phone',
@ -76,7 +76,7 @@
$city = "<input name=\"city\" value=\"$city\">"; $city = "<input name=\"city\" value=\"$city\">";
$state = "<input name=\"state\" value=\"$state\">"; $state = "<input name=\"state\" value=\"$state\">";
$zip = "<input name=\"zip\" value=\"$zip\">"; $zip = "<input name=\"zip\" value=\"$zip\">";
$url = "<input name=\"url\" value=\"$url\">"; //$url = "<input name=\"url\" value=\"$url\">";
if($phpgw_info["apps"]["timetrack"]["enabled"]) { if($phpgw_info["apps"]["timetrack"]["enabled"]) {
$company = '<select name="company">'; $company = '<select name="company">';
@ -98,47 +98,50 @@
list( $month, $day, $year ) = split( '/', $bday ); list( $month, $day, $year ) = split( '/', $bday );
$temp_month[$month] = "SELECTED"; $temp_month[$month] = "SELECTED";
$bday ="<select name=bday_month>" $bday_month = "<select name=bday_month>"
. "<option value=\"\" $temp_month[0]> </option>" . "<option value=\"\" $temp_month[0]> </option>"
. "<option value=1 $temp_month[1]>January</option>" . "<option value=1 $temp_month[1]>January</option>"
. "<option value=2 $temp_month[2]>February</option>" . "<option value=2 $temp_month[2]>February</option>"
. "<option value=3 $temp_month[3]>March</option>" . "<option value=3 $temp_month[3]>March</option>"
. "<option value=4 $temp_month[4]>April</option>" . "<option value=4 $temp_month[4]>April</option>"
. "<option value=5 $temp_month[5]>May</option>" . "<option value=5 $temp_month[5]>May</option>"
. "<option value=6 $temp_month[6]>June</option>" . "<option value=6 $temp_month[6]>June</option>"
. "<option value=7 $temp_month[7]>July</option>" . "<option value=7 $temp_month[7]>July</option>"
. "<option value=8 $temp_month[8]>August</option>" . "<option value=8 $temp_month[8]>August</option>"
. "<option value=9 $temp_month[9]>September</option>" . "<option value=9 $temp_month[9]>September</option>"
. "<option value=10 $temp_month[10]>October</option>" . "<option value=10 $temp_month[10]>October</option>"
. "<option value=11 $temp_month[11]>November</option>" . "<option value=11 $temp_month[11]>November</option>"
. "<option value=12 $temp_month[12]>December</option>" . "<option value=12 $temp_month[12]>December</option>"
. "</select>" . "</select>"
. "<input maxlength=2 name=bday_day value=\"$day\" size=2>" ;
. "<input maxlength=4 name=bday_year value=\"$year\" size=4>" $bday_day = '<input maxlength="2" name="bday_day" value="' . $day . '" size="2">'
. "<font face=\"$theme[font]\" size=\"-2\">(e.g. 1969)</font>"; ;
$bday_year = '<input maxlength="4" name="bday_year" value="' . $year . '" size="4">';
} else { } else {
$bday ="<select name=bday_month>" $bday_month = "<select name=bday_month>"
. "<option value=\"\" SELECTED> </option>" . "<option value=\"\" SELECTED> </option>"
. "<option value=1>January</option>" . "<option value=1>January</option>"
. "<option value=2>February</option>" . "<option value=2>February</option>"
. "<option value=3>March</option>" . "<option value=3>March</option>"
. "<option value=4>April</option>" . "<option value=4>April</option>"
. "<option value=5>May</option>" . "<option value=5>May</option>"
. "<option value=6>June</option>" . "<option value=6>June</option>"
. "<option value=7>July</option>" . "<option value=7>July</option>"
. "<option value=8>August</option>" . "<option value=8>August</option>"
. "<option value=9>September</option>" . "<option value=9>September</option>"
. "<option value=10>October</option>" . "<option value=10>October</option>"
. "<option value=11>November</option>" . "<option value=11>November</option>"
. "<option value=12>December</option>" . "<option value=12>December</option>"
. "</select>" . "</select>"
. "<input maxlength=2 name=bday_day size=2>" ;
. "<input maxlength=4 name=bday_year size=4>" $bday_day = '<input name="bday_day" size="2" maxlength="2">'
. "<font face=\"$theme[font]\" size=\"-2\">(e.g. 1969)</font>"; ;
$bday_year = '<input name="bday_year" size="4" maxlength="4">'
;
} }
$notes = "<TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">" $notes = '<TEXTAREA cols="60" name="notes" rows="4">'
. $notes . "</TEXTAREA>"; . $notes . '</TEXTAREA>';
} else { } else {
$notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">" $notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
. $notes . "</TEXTAREA></form>"; . $notes . "</TEXTAREA></form>";
@ -203,9 +206,12 @@
<font color="#000000" face="" size="-1"><?php echo lang("URL"); ?>:</font> <font color="#000000" face="" size="-1"><?php echo lang("URL"); ?>:</font>
</td> </td>
<td> <td>
<font size="-1"> <input name="url" value="<?php
<?php echo $url; ?> if (! ereg("^http://",$url)) {
</font> echo "http://";
}
echo $url;
?>">
</td> </td>
<td><font size="-1"></font></td> <td><font size="-1"></font></td>
</tr> </tr>
@ -254,9 +260,11 @@
</font></td> </font></td>
<td><font face="" size="-1"><?php echo lang("Birthday"); ?>:</font></td> <td><font face="" size="-1"><?php echo lang("Birthday"); ?>:</font></td>
<td> <td>
<font size="-1"> <?php
<?php echo $bday; ?> echo $phpgw->common->dateformatorder($bday_year,$bday_month,$bday_day)
</font> </td> . '<font face="' . $theme["font"] . '" size="-2">(e.g. 1969)</font>';
?>
</td>
</tr> </tr>
<tr> <tr>
<td><font face="" size="-1"><?php echo lang("Line 2"); ?>:</font></td> <td><font face="" size="-1"><?php echo lang("Line 2"); ?>:</font></td>

View File

@ -185,16 +185,19 @@
// Some fields require special formating. // Some fields require special formating.
if ($column[0] == "url") { if ($column[0] == "url") {
if (! ereg("^http://",$field)) {
$data = "http://" . $field;
}
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">' echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="' . $field . '" target="_new">' . $field. '</a>&nbsp;</font></td>'; . '<a href="' . $field . '" target="_new">' . $field. '</a>&nbsp;</font></td>';
} else if ($column[0] == "email") { } else if ($column[0] == "email") {
if ($phpgw_info["user"]["apps"]["email"]) { if ($phpgw_info["user"]["apps"]["email"]) {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">' echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php", . '<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php",
"to=" . urlencode($field)) . '" target="_top">' . $field . '</a>&nbsp;</font></td>'; "to=" . urlencode($field)) . '" target="_new">' . $field . '</a>&nbsp;</font></td>';
} else { } else {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">' echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="mailto:' . $field . '" target="_top">' . $field. '</a>&nbsp;</font></td>'; . '<a href="mailto:' . $field . '">' . $field. '</a>&nbsp;</font></td>';
} }
} else { } else {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">' echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'

View File

@ -19,6 +19,31 @@
$phpgw_info["flags"]["currentapp"] = "addressbook"; $phpgw_info["flags"]["currentapp"] = "addressbook";
include("../header.inc.php"); include("../header.inc.php");
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 . "&nbsp;";
}
return $s;
}
if (! $ab_id) { if (! $ab_id) {
Header("Location: " . $phpgw->link("index.php")); Header("Location: " . $phpgw->link("index.php"));
} }
@ -58,14 +83,16 @@
if (! $columns_to_display[$i]["field_name"]) break; if (! $columns_to_display[$i]["field_name"]) break;
$columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>" $columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
. "<td>" . $columns_to_display[$i]["field_value"] . "</td>"; . "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
. "</td>";
$i++; $i++;
if (! $columns_to_display[$i]["field_name"]) break; if (! $columns_to_display[$i]["field_name"]) break;
$columns_html .= "<td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>" $columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
. "<td>" . $columns_to_display[$i]["field_value"]; . "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
. "</td>";
$i++; $i++;
$columns_html .= "</td></tr>"; $columns_html .= "</td></tr>";