Begin template enabling of addressbook. See oldindex.php.

This commit is contained in:
Miles Lott 2001-01-13 19:06:36 +00:00
parent a378bc1efc
commit 2384932ada

View File

@ -16,12 +16,20 @@
"enable_nextmatchs_class" => True); "enable_nextmatchs_class" => True);
include("../header.inc.php"); include("../header.inc.php");
echo "<center>" . lang("Address book");
//echo "<br>Time track = " . $phpgw_info["apps"]["timetrack"]["enabled"]; //echo "<br>Time track = " . $phpgw_info["apps"]["timetrack"]["enabled"];
if (! $start) if (! $start)
$start = 0; $start = 0;
$t = new Template($phpgw_info["server"]["app_tpl"]);
$t->set_file(array( "addressbook_header" => "header.tpl",
"searchfilter" => "searchfilter.tpl",
"body" => "list.tpl",
"addressbook_footer" => "footer.tpl" ));
# $t->set_block("addressbook_header","searchfilter","body",
# "addressbook_footer","output");
$limit =$phpgw->nextmatchs->sql_limit($start); $limit =$phpgw->nextmatchs->sql_limit($start);
if ($order) if ($order)
@ -70,10 +78,11 @@
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->db->f(0) == 1) if ($phpgw->db->f(0) == 1)
echo "<br>" . lang("your search returned 1 match"); $t->set_var(searchreturn,lang("your search returned 1 match"));
else else
echo "<br>" . lang("your search returned x matchs",$phpgw->db->f(0)); $t->set_var(searchreturn,lang("your search returned x matchs",$phpgw->db->f(0)));
} else { } else {
$t->set_var(searchreturn,"");
$phpgw->db->query("select count(*) from addressbook where $filtermethod",__LINE__,__FILE__); $phpgw->db->query("select count(*) from addressbook where $filtermethod",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
} }
@ -86,54 +95,26 @@
//$phpgw->db->next_record(); //$phpgw->db->next_record();
if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"])
echo "<br>" . lang("showing x - x of x",($start + 1), $t->set_var(lang_showing,lang("showing x - x of x",($start + 1),($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$phpgw->db->f(0)));
($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$phpgw->db->f(0));
else else
echo "<br>" . lang("showing x",$phpgw->db->f(0)); $t->set_var(lang_showing,lang("showing x",$phpgw->db->f(0)));
?>
$t->set_var("search_filter",$phpgw->nextmatchs->show_tpl("index.php",$start,$phpgw->db->f(0),"&order=$order&filter=$filter&sort=$sort&query=$query", "75%", $phpgw_info["theme"]["th_bg"]));
<?php while ($column = each($abc)) {
$phpgw->nextmatchs->show("index.php",$start,$phpgw->db->f(0),"&order=$order&filter=$filter&sort=" if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
. "$sort&query=$query", "75%", $phpgw_info["theme"]["th_bg"]); $phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
?> $cols .= '<td height="21">';
$cols .= '<font size="-1" face="Arial, Helvetica, sans-serif">';
<table width=75% border=0 cellspacing=1 cellpadding=3> $cols .= $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1]));
<tr bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"> $cols .= '</font></td>';
<?php $cols .= "\n";
while ($column = each($abc)) {
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
$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,"ab_" . $column[0],$order,"index.php",lang($column[1]));
echo '</font></td>';
echo "\n";
// To be used when displaying the rows // To be used when displaying the rows
$columns_to_display[$column[0]] = True; $columns_to_display[$column[0]] = True;
} }
} }
?>
<td width="3%" height="21">
<font face="Arial, Helvetica, sans-serif" size="-1">
<?php echo lang("View"); ?>
</font>
</td>
<td width="3%" height="21">
<font face="Arial, Helvetica, sans-serif" size="-1">
Vcard
</font>
</td>
<td width="5%" height="21">
<font face="Arial, Helvetica, sans-serif" size="-1">
<?php echo lang("Edit"); ?>
</font>
</td>
</tr>
</form>
<?php
if (isset($query) && $query) { if (isset($query) && $query) {
if (isset($phpgw_info["apps"]["timetrack"]["enabled"]) && if (isset($phpgw_info["apps"]["timetrack"]["enabled"]) &&
$phpgw_info["apps"]["timetrack"]["enabled"]) { $phpgw_info["apps"]["timetrack"]["enabled"]) {
@ -162,121 +143,99 @@
$phpgw->db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit",__LINE__,__FILE__); $phpgw->db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit",__LINE__,__FILE__);
} }
} // else $query } // else $query
$rows="";
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo '<tr bgcolor="#' . $tr_color . '">'; $rows .= '<tr bgcolor="#'.$tr_color . '">';
$ab_id = $phpgw->db->f("ab_id"); $ab_id = $phpgw->db->f("ab_id");
while ($column = each($columns_to_display)) { while ($column = each($columns_to_display)) {
if ($column[0] == "company") { if ($column[0] == "company") {
if ($phpgw_info["apps"]["timetrack"]["enabled"]) { if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$field = $phpgw->db->f("company_name"); $field = $phpgw->db->f("company_name");
} else { } else {
$field = $phpgw->db->f("ab_company"); $field = $phpgw->db->f("ab_company");
} }
} else { } else {
$field = $phpgw->db->f("ab_" . $column[0]); $field = $phpgw->db->f("ab_" . $column[0]);
} }
/* $field = htmlentities($field);
while ($column = each($columns_to_display)) {
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
if ($column[0] == "company") {
$field = $phpgw->db->f("company_name");
} else {
$field = $phpgw->db->f("ab_company");
}
} else {
$field = $phpgw->db->f("ab_" . $column[0]);
} */
$field = htmlentities($field); // Some fields require special formating.
if ($column[0] == "url") {
// Some fields require special formating. if (! ereg("^http://",$field)) {
if ($column[0] == "url") { $data = "http://" . $field;
if (! ereg("^http://",$field)) { }
$data = "http://" . $field; $rows .= '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
} . '<a href="' . $field . '" target="_new">' . $field. '</a>&nbsp;</font></td>';
echo '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">' } else if ($column[0] == "email") {
. '<a href="' . $field . '" target="_new">' . $field. '</a>&nbsp;</font></td>';
} 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">' $rows .= '<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="_new">' . $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">' $rows .= '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. '<a href="mailto:' . $field . '">' . $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">' $rows .= '<td valign="top"><font face="' . $phpgw_info["theme"]["font"] . '" size="2">'
. $field . '&nbsp;</font></td>'; . $field . '&nbsp;</font></td>';
} }
#echo '</tr>';
} }
reset($columns_to_display); // If we don't reset it, our inside while won't loop reset($columns_to_display); // If we don't reset it, our inside while won't loop
?> $rows .= '<td valign="top" width="3%">
<td valign="top" width="3%"> <font face="'.$phpgw_info["theme"]["font"].'" size="2">
<font face="<?php echo $phpgw_info["theme"]["font"]; ?>" size="2"> <a href="'. $phpgw->link("view.php","ab_id=$ab_id&start=$start&order=$order&filter="
<a href="<?php echo $phpgw->link("view.php","ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort").'
. "$filter&query=$query&sort=$sort"); ">'.lang("View").'</a>
?>"> <?php echo lang("View"); ?> </a>
</font> </font>
</td> </td>
<td valign=top width=3%> <td valign=top width=3%>
<font face="<?php echo $phpgw_info["theme"]["font"]; ?>" size=2> <font face="'.$phpgw_info["theme"]["font"].'" size=2>
<a href="<?php echo $phpgw->link("vcardout.php","ab_id=$ab_id&start=$start&order=$order&filter=" <a href="'.$phpgw->link("vcardout.php","ab_id=$ab_id&start=$start&order=$order&filter="
. "$filter&query=$query&sort=$sort"); . "$filter&query=$query&sort=$sort").'
?>">Vcard</a> ">'.lang("VCard").'</a>
</font> </font>
</td> </td>
<td valign="top" width="5%"> <td valign="top" width="5%">
<font face="<?php echo $phpgw_info["theme"]["font"]; ?>" size="2"> <font face="'.$phpgw_info["theme"]["font"].'" size="2">
<?php echo $phpgw->common->check_owner($phpgw->db->f("ab_owner"),"edit.php",lang("edit"),"ab_id=" . $phpgw->db->f("ab_id")); ?> '.$phpgw->common->check_owner($phpgw->db->f("ab_owner"),"edit.php",lang("edit"),"ab_id=" . $phpgw->db->f("ab_id")).'
</font> </font>
</td> </td>
</tr> </tr>
<?php ';
} }
?> $t->set_var("lang_addressbook",lang("Address book"));
</table> $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$t->set_var("th_font",$phpgw_info["theme"]["font"]);
$t->set_var("th_text",$phpgw_info["theme"]["th_text"]);
$t->set_var("lang_add",lang("Add"));
$t->set_var("lang_addvcard",lang("Add VCard"));
$t->set_var("lang_view",lang("View"));
$t->set_var("lang_vcard",lang("VCard"));
$t->set_var("lang_edit",lang("Edit"));
$t->set_var("start",$start);
$t->set_var("filter",$filter);
$t->set_var("qfield",$qfield);
$t->set_var("query",$query);
$t->set_var("actionurl",$phpgw->link("add.php"));
$t->set_var("start",$start);
$t->set_var("filter",$filter);
$t->set_var("cols",$cols);
$t->set_var("rows",$rows);
<form method="POST" action="<?php echo $phpgw->link("add.php"); ?>"> $t->parse("out","addressbook_header");
<?php if(isset($sort) && $sort) { ?> $t->pparse("out","addressbook_header");
<input type="hidden" name="sort" value="<?php echo $sort; ?>"> $t->parse("out","searchfilter");
<?php } ?> $t->pparse("out","searchfilter");
<?php if(isset($order) && $order) { ?> $t->parse("out","body");
<input type="hidden" name="order" value="<?php echo $order; ?>"> $t->pparse("out","body");
<?php } ?> $t->parse("out","addressbook_footer");
<?php if(isset($query) && $query) { ?> $t->pparse("out","addressbook_footer");
<input type="hidden" name="query" value="<?php echo $query; ?>">
<?php } ?>
<input type="hidden" name="start" value="<?php echo $start; ?>">
<?php if(isset($filter) && $filter) { ?>
<input type="hidden" name="filter" value="<?php echo $filter; ?>">
<?php } ?>
<table width="75%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="4%">
<div align="right">
<input type="submit" name="Add" value="<?php echo lang("Add"); ?>">
</div>
</td>
<td width="8%">
<div align="right">
<input type="submit" name="AddVcard" value="Add Vcard">
</div>
</td>
<td width="64%">&nbsp;</td>
<td width="24%">&nbsp;</td>
</tr>
</table>
</form>
</center>
<?php
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>