Working on merging in a patch for the addressbook, but first cleaning up some code

This commit is contained in:
jengo 2000-11-01 10:26:14 +00:00
parent 46ca74feff
commit 793040b5ba
9 changed files with 157 additions and 149 deletions

View File

@ -12,6 +12,24 @@
/* $Id$ */
$abc = array('company' => 'company', // AddressBook Columns and their descriptions
'firstname' => 'first name',
'lastname' => 'last name',
'email' => 'email',
'wphone' => 'work phone',
'hphone' => 'home phone',
'fax' => 'fax',
'pager' => 'pager',
'mphone' => 'mobile phone',
'ophone' => 'other phone',
'street' => 'street',
'city' => 'city',
'state' => 'state',
'zip' => 'zip code',
'bday' => 'birthday',
'url' => 'URL'
);
function form($format,$action,$title,$fields)
{
global $phpgw;

View File

@ -52,7 +52,7 @@
. "%$query%' OR a.ab_firstname like '%$query%' OR a.ab_email like '%$query%' OR "
. "a.ab_street like '%$query%' OR a.ab_city like '%$query%' OR a.ab_state "
. "like '%$query%' OR a.ab_zip like '%$query%' OR a.ab_notes like "
. "'%$query%' OR c.company_name like '%$query%')");
. "'%$query%' OR c.company_name like '%$query%' OR a.ab_url like '%$query%')");
// . "'%$query%' OR c.company_name like '%$query%')"
// . " $ordermethod limit $limit");
} else {
@ -62,7 +62,7 @@
. "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
. "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
. "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
. "'%$query%' OR ab_company like '%$query%')");
. "'%$query%' OR ab_company like '%$query%' OR ab_url like '%$query$%')");
// . "'%$query%' OR ab_company like '%$query%')"
// . " $ordermethod limit $limit");
}
@ -100,39 +100,17 @@
<table width=75% border=0 cellspacing=1 cellpadding=3>
<tr bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>">
<?php
if ($phpgw_info["user"]["preferences"]["addressbook"]["company"]) {
while ($column = each($abc)) {
if ($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,$company_sortorder,$order,"index.php",lang("Company Name"));
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1]));
echo '</font></td>';
echo "\n";
// To be used when displaying the rows
$columns_to_display[$column[0]] = True;
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_lastname",$order,"index.php",
lang("Last Name"));
echo '</font></td>';
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_firstname",$order,"index.php",
lang("First Name"));
echo '</font></td>';
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_email",$order,"index.php",
lang("Email"));
echo '</font></td>';
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_wphone",$order,"index.php",
lang("Work Phone"));
echo '</font></td>';
}
?>
@ -149,7 +127,6 @@
</tr>
</form>
<?php
if ($query) {
if ($phpgw_info["apps"]["timetrack"]["enabled"]){
@ -178,66 +155,50 @@
. "from addressbook as a, customers as c where a.ab_company_id = c.company_id "
. "AND $filtermethod $ordermethod limit $limit");
} else {
$phpgw->db->query("SELECT ab_id,ab_owner,ab_firstname,ab_lastname,"
. "ab_email,ab_wphone,ab_company "
. "from addressbook "
. "WHERE $filtermethod $ordermethod limit $limit");
}
$phpgw->db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit");
}
} // else $query
while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo '<tr bgcolor="#' . $tr_color . '">';
$firstname = $phpgw->db->f("ab_firstname");
$lastname = $phpgw->db->f("ab_lastname");
$email = $phpgw->db->f("ab_email");
while ($column = each($columns_to_display)) {
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$company = $phpgw->db->f("company_name");
if ($column[0] == "company") {
$field = $phpgw->db->f("company_name");
} else {
$company = $phpgw->db->f("ab_company");
$field = $phpgw->db->f("ab_company");
}
} else {
$field = $phpgw->db->f("ab_" . $column[0]);
}
$wphone = $phpgw->db->f("ab_wphone");
$ab_id = $phpgw->db->f("ab_id");
if ($firstname == "") $firstname = "&nbsp;";
if ($lastname == "") $lastname = "&nbsp;";
if ($email == "") $email = "&nbsp;";
if ($company == "") $company = "&nbsp;";
if ($wphone == "") $wphone = "&nbsp;";
if (! $field) {
$field = "&nbsp;";
} else {
$field = htmlentities($field);
}
?>
<?php
echo '<tr bgcolor="#'.$tr_color.'";>';
if ($phpgw_info["user"]["preferences"]["addressbook"]["company"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $company;
echo '</font></td>';
};
if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $lastname;
echo '</font></td>';
};
if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $firstname;
echo '</font></td>';
};
if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo '<a href="mailto:' . $email . '">' . $email . '</a>';
echo '</font></td>';
};
if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $wphone;
echo '</font></td>';
};
// Some fields require special formating.
if ($column[0] == "url") {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="' . $field . '" target="_top">' . $field. '</a></font></td>';
} else if ($column[0] == "email") {
if ($phpgw_info["user"]["apps"]["email"]) {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php",
"to=" . urlencode($field)) . '" target="_top">' . $field . '</a></font></td>';
} else {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="mailto:' . $field . '" target="_top">' . $field. '</a></font></td>';
}
} else {
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. $field . '</font></td>';
}
}
?>
<td valign=top width=3%>
<font face=Arial, Helvetica, sans-serif size=2>

View File

@ -47,12 +47,13 @@
// 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>';
$abc = get_abc(); # AddressBook Columns
$i = 0; $j = 0;
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo '<tr bgcolor="' . $tr_color . '">';
while (list($col, $descr) = each($abc)) {
// echo "<br>test: $col - $i $j - " . count($abc);
$i++; $j++;
echo '<td><input type="checkbox" name="ab_selected[' . $col . ']" value="True"'
. ($phpgw_info["user"]["preferences"]["addressbook"][$col]?" checked":"") . '>' . $descr
. '</option></td>';
@ -66,6 +67,12 @@
echo '<tr bgcolor="' . $tr_color . '">';
}
if ($j == count($abc)) {
if ($i == 1) {
echo "<td>&nbsp;</td><td>&nbsp;</td>";
}
if ($i == 2) {
echo "<td>&nbsp;</td>";
}
echo "</tr>";
}
}

View File

@ -19,6 +19,7 @@
- mcrypt should be working correctly now.
- Fixed problem with email's addressbook not retrieving records.
- Applied patch for accounts->listusers(). Thanks Mathieu van Loon <mathieu@playcollevtive.com>
- Fixed check for new version not working.
[0.9.2] - Fixed sorting bug in currentusers.php
- Cleaned up error reporting and form in newaccount.php

View File

@ -34,7 +34,16 @@
$phpgw->common->read_preferences($phpgw_info["user"]["userid"],"email",True);
$phpgw->common->read_preferences($phpgw_info["user"]["userid"],"calendar",True);
if ($phpgw_info["user"]["permissions"]["admin"] && $phpgw_info["server"]["checkfornewversion"]) {
if ($phpgw_info["user"]["apps"]["admin"]) {
if ($phpgw_info["server"]["version"] > $phpgw_info["server"]["phpgroupware_api_version"]) {
echo "<p><b>" . lang("Your are running a newer version of phpGroupWare then your database is setup for")
. "<br>" . lang("It is recommend that you run setup to upgrade your tables to the current version")
. "</b>";
}
}
if ($phpgw_info["user"]["apps"]["admin"] && $phpgw_info["server"]["checkfornewversion"]) {
$phpgw->network->set_addcrlf(False);
if ($phpgw->network->open_port("phpgroupware.org",80,30)) {
$phpgw->network->write_port("GET /currentversion HTTP/1.0\nHOST: www.phpgroupware.org\n\n");

View File

@ -224,7 +224,8 @@
)";
$db->query($sql);
$sql = "create table domains (
// I decied too hold off on this table until 0.9.4pre1 (jengo)
/* $sql = "create table domains (
domain_id int NOT NULL auto_increment,
domain_name varchar(255),
domain_database varchar(255),
@ -232,5 +233,6 @@
primary key(domain_id)
)";
$db->query($sql);
*/
?>

View File

@ -127,4 +127,5 @@
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','lastname','True','addressbook')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','company','True','addressbook')");
$db->query("insert into config (config_name, config_value) values ('phpgroupware_api_version','" . $phpgw_info["server"]["version"] . "')");
?>

View File

@ -294,8 +294,10 @@
if ($currentver == "0.9.3pre4") {
$db->query("alter table config change config_name config_name varchar(255) NOT NULL");
$db->query("create table domains (domain_id int NOT NULL auto_increment, domain_name varchar(255),"
. "domain_database varchar(255),domain_status enum('Active,Disabled'),primary key(domain_id))");
// I decied too hold off on this table until 0.9.4pre1 (jengo)
// $db->query("create table domains (domain_id int NOT NULL auto_increment, domain_name varchar(255),"
// . "domain_database varchar(255),domain_status enum('Active,Disabled'),primary key(domain_id))");
$currentver = "0.9.3pre5";
update_version_table();
}
@ -331,6 +333,9 @@
v0_9_1to0_9_2();
v0_9_2to0_9_3();
$db->query("update config set config_value='" . $phpgw_info["server"]["version"] . "' where "
. "config_name='phpgroupware_api_version'");
if (!$tablechanges == True){
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>No table changes were needed. The script only updated your version setting.</td>\n";

View File

@ -310,6 +310,10 @@
v0_9_2to0_9_3pre5();
$db->query("update applications set app_version='".$phpgw_info["server"]["version"]."' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps')");
$db->query("update config set config_value='" . $phpgw_info["server"]["version"] . "' where "
. "config_name='phpgroupware_api_version'");
if (!$didupgrade == True){
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>No table changes were needed. The script only updated your version setting.</td>\n";