2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - addressbook *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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$ */
|
|
|
|
|
2001-02-02 02:34:22 +01:00
|
|
|
$phpgw_info["flags"] = array("currentapp" => "addressbook",
|
|
|
|
"enable_contacts_class" => True,
|
2000-11-16 09:10:43 +01:00
|
|
|
"enable_nextmatchs_class" => True);
|
2000-08-18 05:24:22 +02:00
|
|
|
include("../header.inc.php");
|
|
|
|
|
2001-02-04 12:11:34 +01:00
|
|
|
#$t = new Template($phpgw_info["server"]["app_tpl"]);
|
|
|
|
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->set_file(array( "addressbook_header" => "header.tpl",
|
2001-01-23 05:28:06 +01:00
|
|
|
"column" => "column.tpl",
|
|
|
|
"row" => "row.tpl",
|
2001-01-13 20:06:36 +01:00
|
|
|
"addressbook_footer" => "footer.tpl" ));
|
|
|
|
|
2001-02-02 02:34:22 +01:00
|
|
|
$this = CreateObject("phpgwapi.contacts");
|
2001-01-13 20:06:36 +01:00
|
|
|
|
2001-02-02 07:29:27 +01:00
|
|
|
while ($column = each($this->stock_contact_fields)) {
|
|
|
|
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) &&
|
|
|
|
$phpgw_info["user"]["preferences"]["addressbook"][$column[1]]) {
|
2001-02-04 04:55:06 +01:00
|
|
|
$showcol = display_name($column[0]);
|
2001-02-02 02:34:22 +01:00
|
|
|
$cols .= " <td height=\"21\">\n";
|
|
|
|
$cols .= ' <font size="-1" face="Arial, Helvetica, sans-serif">';
|
2001-02-04 04:55:06 +01:00
|
|
|
$cols .= $phpgw->nextmatchs->show_sort_order($sort, $column[0],$order,"index.php",lang($showcol));
|
2001-02-02 02:34:22 +01:00
|
|
|
$cols .= "</font>\n </td>";
|
|
|
|
$cols .= "\n";
|
|
|
|
|
|
|
|
// To be used when displaying the rows
|
|
|
|
$columns_to_display[$column[0]] = True;
|
|
|
|
}
|
2001-01-13 20:06:36 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-02 02:34:22 +01:00
|
|
|
if (! $start)
|
|
|
|
$start = 0;
|
|
|
|
|
|
|
|
$offset = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
|
|
|
|
|
2001-02-04 21:59:05 +01:00
|
|
|
// insert acl stuff here in lieu of old access perms
|
|
|
|
// following sets up the filter for read, then restores the filter string for later checking
|
2001-02-04 11:45:07 +01:00
|
|
|
if ($filter == "none") { $filter = ""; }
|
2001-02-04 21:59:05 +01:00
|
|
|
$savefilter = $filter;
|
2001-02-04 12:11:34 +01:00
|
|
|
if ($filter != "" ) { $filter = "access=$filter"; }
|
2001-02-04 11:45:07 +01:00
|
|
|
|
2001-02-04 21:59:05 +01:00
|
|
|
$qfilter = $filter;
|
|
|
|
$filter = $savefilter;
|
|
|
|
|
|
|
|
$qcols = $columns_to_display + array("access");
|
|
|
|
|
|
|
|
// read the entry list
|
|
|
|
$entries = $this->read($start,$offset,$qcols,$query,$qfilter,$sort,$order);
|
2001-02-02 02:34:22 +01:00
|
|
|
|
|
|
|
$search_filter = $phpgw->nextmatchs->show_tpl("index.php",
|
|
|
|
$start, $this->total_records,
|
|
|
|
"&order=$order&filter=$filter&sort=$sort&query=$query",
|
|
|
|
"75%", $phpgw_info["theme"]["th_bg"]);
|
|
|
|
|
|
|
|
if ($this->total_records > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) {
|
|
|
|
$lang_showing=lang("showing x - x of x",($start + 1),
|
|
|
|
($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),
|
|
|
|
$this->total_records);
|
|
|
|
} else {
|
|
|
|
$lang_showing=lang("showing x",$this->total_records);
|
|
|
|
}
|
|
|
|
|
|
|
|
// set basic vars and parse the header
|
2001-01-23 05:28:06 +01:00
|
|
|
$t->set_var(font,$phpgw_info["theme"]["font"]);
|
|
|
|
$t->set_var("lang_view",lang("View"));
|
|
|
|
$t->set_var("lang_vcard",lang("VCard"));
|
|
|
|
$t->set_var("lang_edit",lang("Edit"));
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-02 02:34:22 +01:00
|
|
|
$t->set_var(searchreturn,$searchreturn);
|
|
|
|
$t->set_var(lang_showing,$lang_showing);
|
|
|
|
$t->set_var(search_filter,$search_filter);
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->set_var("lang_addressbook",lang("Address book"));
|
|
|
|
$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"));
|
2001-01-13 20:25:38 +01:00
|
|
|
$t->set_var("lang_addvcard",lang("AddVCard"));
|
2001-01-14 22:35:04 +01:00
|
|
|
$t->set_var("lang_import",lang("Import File"));
|
|
|
|
$t->set_var("import_url",$phpgw->link("import.php"));
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->set_var("start",$start);
|
2001-01-14 03:43:14 +01:00
|
|
|
$t->set_var("sort",$sort);
|
|
|
|
$t->set_var("order",$order);
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->set_var("filter",$filter);
|
|
|
|
$t->set_var("qfield",$qfield);
|
|
|
|
$t->set_var("query",$query);
|
2001-01-22 07:30:37 +01:00
|
|
|
$t->set_var("actionurl",$phpgw->link("add.php","sort=$sort&order=$order&filter=$filter&start=$start"));
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->set_var("start",$start);
|
|
|
|
$t->set_var("filter",$filter);
|
2001-02-02 02:34:22 +01:00
|
|
|
$t->set_var("cols",$cols);
|
2001-01-13 20:06:36 +01:00
|
|
|
|
|
|
|
$t->pparse("out","addressbook_header");
|
2001-01-23 05:28:06 +01:00
|
|
|
|
2001-02-02 02:34:22 +01:00
|
|
|
// Show the entries
|
|
|
|
for ($i=0;$i<count($entries);$i++) { // each entry
|
2001-02-04 21:59:05 +01:00
|
|
|
if ( ($entries[$i]["access"] == $filter) ||
|
|
|
|
($entries[$i]["access"] == "," . $filter . ",") ||
|
|
|
|
($filter == "") ||
|
|
|
|
($filter == "none")) {
|
|
|
|
$t->set_var(columns,"");
|
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$t->set_var(row_tr_color,$tr_color);
|
|
|
|
$myid = $entries[$i]["id"];
|
|
|
|
$myowner = $entries[$i]["owner"];
|
|
|
|
|
|
|
|
while ($column = each($columns_to_display)) { // each entry column
|
|
|
|
$ref=$data="";
|
|
|
|
$coldata = $entries[$i][$column[0]];
|
|
|
|
// Some fields require special formatting.
|
|
|
|
if ($column[0] == "url") {
|
|
|
|
$ref='<a href="'.$coldata.'" target="_new">';
|
|
|
|
$data=$coldata.'</a>';
|
|
|
|
} elseif ($column[0] == "email") {
|
|
|
|
if ($phpgw_info["user"]["apps"]["email"]) {
|
|
|
|
$ref='<a href="'.$phpgw->link($phpgw_info["server"]["webserver_url"]
|
|
|
|
. "/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
|
|
|
|
} else {
|
2001-01-30 11:26:15 +01:00
|
|
|
//changed frmo a patch posted on sf, have not fully tested. Seek3r, Jan 30 2001
|
|
|
|
// $ref='<a href="mailto:"'.$coldata.'">'.$coldata.'</a>';
|
2001-02-04 21:59:05 +01:00
|
|
|
$ref='<a href="mailto:'.$coldata.'">';
|
|
|
|
}
|
|
|
|
$data=$coldata."</a>";
|
|
|
|
} else { // But these do not
|
|
|
|
$ref=""; $data=$coldata;
|
2001-01-23 05:28:06 +01:00
|
|
|
}
|
2001-02-04 21:59:05 +01:00
|
|
|
$t->set_var(col_data,$ref.$data);
|
|
|
|
$t->parse("columns","column",True);
|
2001-01-23 05:28:06 +01:00
|
|
|
}
|
|
|
|
|
2001-02-04 21:59:05 +01:00
|
|
|
$t->set_var(row_view_link,$phpgw->link("view.php","ab_id=$myid&start=$start&order=$order&filter="
|
|
|
|
. "$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"),"ab_id="
|
|
|
|
.$myid."&start=".$start."&sort=".$sort."&order=".$order."&query=".$query."&sort=".$sort));
|
2001-01-23 05:28:06 +01:00
|
|
|
|
2001-02-04 21:59:05 +01:00
|
|
|
$t->parse("rows","row",True);
|
|
|
|
$t->pparse("out","row");
|
2001-02-02 02:34:22 +01:00
|
|
|
|
2001-02-04 21:59:05 +01:00
|
|
|
reset($columns_to_display); // If we don't reset it, our inside while won't loop
|
|
|
|
}
|
2001-01-23 05:28:06 +01:00
|
|
|
}
|
|
|
|
|
2001-01-13 20:06:36 +01:00
|
|
|
$t->pparse("out","addressbook_footer");
|
2000-09-29 07:24:18 +02:00
|
|
|
$phpgw->common->phpgw_footer();
|
2000-10-27 04:07:59 +02:00
|
|
|
?>
|