egroupware/addressbook/inc/functions.inc.php

287 lines
9.8 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
/**************************************************************************\
* phpGroupWare - addressbook *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@mail.com> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
function form($format,$action,$title,$fields)
{
global $phpgw;
$email = $fields["email"];
$firstname = $fields["firstname"];
$lastname = $fields["lastname"];
$hphone = $fields["hphone"];
$wphone = $fields["wphone"];
$fax = $fields["fax"];
$pager = $fields["pager"];
$mphone = $fields["mphone"];
$ophone = $fields["ophone"];
$street = $fields["street"];
$city = $fields["city"];
$state = $fields["state"];
$zip = $fields["zip"];
$bday = $fields["bday"];
$notes = $fields["notes"];
$access = $fields["access"];
$company = $fields["company"];
if ($format != "view") {
$email = "<input name=\"email\" value=\"$email\">";
$firstname = "<input name=\"firstname\" value=\"$firstname\">";
$lastname = "<input name=\"lastname\" value=\"$lastname\">";
$hphone = "<input name=\"hphone\" value=\"$hphone\">";
$wphone = "<input name=\"wphone\" value=\"$wphone\">";
$fax = "<input name=\"fax\" value=\"$fax\">";
$pager = "<input name=\"pager\" value=\"$pager\">";
$mphone = "<input name=\"mphone\" value=\"$mphone\">";
$ophone = "<input name=\"ophone\" value=\"$ophone\">";
$street = "<input name=\"street\" value=\"$street\">";
$city = "<input name=\"city\" value=\"$city\">";
$state = "<input name=\"state\" value=\"$state\">";
$zip = "<input name=\"zip\" value=\"$zip\">";
$company = "<input name=\"company\" value=\"$company\">";
if (strlen($bday) > 2) {
list( $month, $day, $year ) = split( '/', $bday );
$temp_month[$month] = "SELECTED";
$bday ="<select name=bday_month>"
. "<option value=\"\" $temp_month[0]> </option>"
. "<option value=1 $temp_month[1]>January</option>"
. "<option value=2 $temp_month[2]>February</option>"
. "<option value=3 $temp_month[3]>March</option>"
. "<option value=4 $temp_month[4]>April</option>"
. "<option value=5 $temp_month[5]>May</option>"
. "<option value=6 $temp_month[6]>June</option>"
. "<option value=7 $temp_month[7]>July</option>"
. "<option value=8 $temp_month[8]>August</option>"
. "<option value=9 $temp_month[9]>September</option>"
. "<option value=10 $temp_month[10]>October</option>"
. "<option value=11 $temp_month[11]>November</option>"
. "<option value=12 $temp_month[12]>December</option>"
. "</select>"
. "<input maxlength=2 name=bday_day value=\"$day\" size=2>"
. "<input maxlength=4 name=bday_year value=\"$year\" size=4>"
. "<font face=\"$theme[font]\" size=\"-2\">(e.g. 1969)</font>";
} else {
$bday ="<select name=bday_month>"
. "<option value=\"\" SELECTED> </option>"
. "<option value=1>January</option>"
. "<option value=2>February</option>"
. "<option value=3>March</option>"
. "<option value=4>April</option>"
. "<option value=5>May</option>"
. "<option value=6>June</option>"
. "<option value=7>July</option>"
. "<option value=8>August</option>"
. "<option value=9>September</option>"
. "<option value=10>October</option>"
. "<option value=11>November</option>"
. "<option value=12>December</option>"
. "</select>"
. "<input maxlength=2 name=bday_day size=2>"
. "<input maxlength=4 name=bday_year size=4>"
. "<font face=\"$theme[font]\" size=\"-2\">(e.g. 1969)</font>";
}
$notes = "<TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
. $notes . "</TEXTAREA>";
} else {
$notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
. $notes . "</TEXTAREA></form>";
if ($bday == "//")
$bday = "";
}
if ($action) {
2000-09-03 21:30:13 +02:00
echo "<FORM action=\"".$phpgw->link($action)."\" method=\"post\">\n";
2000-08-18 05:24:22 +02:00
}
?>
<table width="75%" border="0" align="center">
<tr>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Last Name"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $lastname; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("First Name"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $firstname; ?>
</font></td>
</tr>
<tr>
<td>
2000-09-08 00:47:52 +02:00
<font color="#000000" face="" size="-1"><?php echo lang("E-mail"); ?>:</font>
2000-08-18 05:24:22 +02:00
</td>
<td>
<font size="-1">
<?php echo $email; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Company Name"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $company; ?>
</font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Home Phone"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $hphone; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Fax"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $fax; ?>
</font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Work Phone"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $wphone; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Pager"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $pager; ?>
</font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("Mobile"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $mphone; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font face="" size="-1" color="#000000"><?php echo lang("Other number"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $ophone; ?>
</font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font face="" size="-1"><?php echo lang("Street"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $street; ?>
</font></td>
2000-09-08 00:47:52 +02:00
<td><font face="" size="-1"><?php echo lang("Birthday"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $bday; ?>
</font> </td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font face="" size="-1"><?php echo lang("City"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $city; ?>
</font></td>
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font color="#000000" face="" size="-1"><?php echo lang("State"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $state; ?>
</font></td>
<td><font size="-1"></font></td>
<td><font size="-1"></font></td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font face="" size="-1"><?php echo lang("ZIP Code"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td>
<font size="-1">
<?php echo $zip; ?>
</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>
<tr>
<?php
if ($format == "view") {
if ($access != "private" && $access != "public") {
2000-09-08 00:47:52 +02:00
echo "<td><font size=\"-1\">" . lang("Group access") . ":</font></td>"
2000-08-18 05:24:22 +02:00
. "<td colspan=\"3\"><font size=\"-1\">"
2000-09-05 09:31:20 +02:00
. $phpgw->accounts->convert_string_to_names($access);
2000-08-18 05:24:22 +02:00
} else {
2000-09-08 00:47:52 +02:00
echo "<td><font size=\"-1\">" . lang("access") . ":</font></td>"
2000-08-18 05:24:22 +02:00
. "<td colspan=\"3\"><font size=\"-1\">"
. $access;
}
} else {
?>
2000-09-08 00:47:52 +02:00
<td><font size="-1"><?php echo lang("Access"); ?>:</font></td>
2000-08-18 05:24:22 +02:00
<td colspan="3">
<font size="-1">
<select name="access">
<option value="private"<?php
2000-09-08 00:47:52 +02:00
if ($access == "private") echo " selected"; ?>><?php echo lang("private"); ?></option>
2000-08-18 05:24:22 +02:00
<option value="public"<?php
2000-09-08 00:47:52 +02:00
if ($access == "public") echo " selected"; ?>><?php echo lang("Global Public"); ?></option>
2000-08-18 05:24:22 +02:00
<option value="group"<?php
if ($access != "public" && $access != "private" && $access != "")
echo " selected";
2000-09-08 00:47:52 +02:00
echo ">" . lang("Group Public") . "</option></select>";
2000-08-18 05:24:22 +02:00
}
?>
</tr>
<?php
if ($format != "view") {
2000-09-08 00:47:52 +02:00
echo "<tr><td><font size=\"-1\">" . lang("Which groups")
2000-08-18 05:24:22 +02:00
. ":</font></td><td colspan=\"3\"><select name=\"n_groups[]\" "
. "multiple size=\"5\">";
2000-08-28 02:09:45 +02:00
$user_groups = $phpgw->accounts->read_group_names($fields["owner"]);
2000-08-18 05:24:22 +02:00
for ($i=0;$i<count($user_groups);$i++) {
echo "<option value=\"" . $user_groups[$i][0] . "\"";
if (ereg(",".$user_groups[$i][0].",",$access))
echo " selected";
echo ">" . $user_groups[$i][1] . "</option>\n";
}
echo "</select></font></td></tr>";
}
if ($format == "view")
2000-09-08 00:47:52 +02:00
echo "<tr><td><font size=\"-1\">" . lang("Created by") . ":</font></td>"
2000-08-18 05:24:22 +02:00
. "<td colspan=\"3\"><font size=\"-1\">"
. grab_owner_name($fields[owner]);
?></font>
</td>
</tr>
<tr>
2000-09-08 00:47:52 +02:00
<td><font size="-1"><?php echo lang("Notes"); ?>:
2000-08-18 05:24:22 +02:00
</font></td>
<td colspan="3">
<font size="-1">
<?php echo $notes; ?>
</font></td>
</tr>
</table>
<?php
}