From 2384932adaffa04e8f5dfc444bc51f43b10be260 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sat, 13 Jan 2001 19:06:36 +0000 Subject: [PATCH] Begin template enabling of addressbook. See oldindex.php. --- addressbook/index.php | 233 +++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 137 deletions(-) diff --git a/addressbook/index.php b/addressbook/index.php index e432d3d8cb..7d1789aab6 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -16,12 +16,20 @@ "enable_nextmatchs_class" => True); include("../header.inc.php"); - echo "
" . lang("Address book"); //echo "
Time track = " . $phpgw_info["apps"]["timetrack"]["enabled"]; if (! $start) $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); if ($order) @@ -70,10 +78,11 @@ $phpgw->db->next_record(); if ($phpgw->db->f(0) == 1) - echo "
" . lang("your search returned 1 match"); + $t->set_var(searchreturn,lang("your search returned 1 match")); else - echo "
" . 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 { + $t->set_var(searchreturn,""); $phpgw->db->query("select count(*) from addressbook where $filtermethod",__LINE__,__FILE__); $phpgw->db->next_record(); } @@ -86,54 +95,26 @@ //$phpgw->db->next_record(); if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) - echo "
" . lang("showing x - x of x",($start + 1), - ($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$phpgw->db->f(0)); + $t->set_var(lang_showing,lang("showing x - x of x",($start + 1),($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$phpgw->db->f(0))); else - echo "
" . 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"])); -nextmatchs->show("index.php",$start,$phpgw->db->f(0),"&order=$order&filter=$filter&sort=" - . "$sort&query=$query", "75%", $phpgw_info["theme"]["th_bg"]); -?> - - - "> - '; - echo ''; - echo $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1])); - echo ''; - echo "\n"; + while ($column = each($abc)) { + if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && + $phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { + $cols .= ''; + $cols .= "\n"; - // To be used when displaying the rows - $columns_to_display[$column[0]] = True; - } - } - ?> + // To be used when displaying the rows + $columns_to_display[$column[0]] = True; + } + } - - - - - - -db->query("SELECT * from addressbook WHERE $filtermethod $ordermethod limit $limit",__LINE__,__FILE__); } } // else $query - + $rows=""; while ($phpgw->db->next_record()) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - echo ''; + $rows .= ''; $ab_id = $phpgw->db->f("ab_id"); - while ($column = each($columns_to_display)) { - if ($column[0] == "company") { + while ($column = each($columns_to_display)) { + if ($column[0] == "company") { if ($phpgw_info["apps"]["timetrack"]["enabled"]) { - $field = $phpgw->db->f("company_name"); - } else { - $field = $phpgw->db->f("ab_company"); - } - } else { - $field = $phpgw->db->f("ab_" . $column[0]); - } + $field = $phpgw->db->f("company_name"); + } else { + $field = $phpgw->db->f("ab_company"); + } + } else { + $field = $phpgw->db->f("ab_" . $column[0]); + } -/* - 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); - $field = htmlentities($field); - - // Some fields require special formating. - if ($column[0] == "url") { - if (! ereg("^http://",$field)) { - $data = "http://" . $field; - } - echo ''; - } else if ($column[0] == "email") { + // Some fields require special formating. + if ($column[0] == "url") { + if (! ereg("^http://",$field)) { + $data = "http://" . $field; + } + $rows .= ''; + } else if ($column[0] == "email") { if ($phpgw_info["user"]["apps"]["email"]) { - echo ''; + $rows .= ''; } else { - echo ''; + $rows .= ''; } - } else { - echo ''; - } - + } else { + $rows .= ''; + } + #echo ''; } reset($columns_to_display); // If we don't reset it, our inside while won't loop - ?> - - -
'; + $cols .= ''; + $cols .= $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1])); + $cols .= ' - - - - - - Vcard - - - - - -
' - . '' . $field. ' ' + . '' . $field. ' ' - . '' . $field . ' ' + . '' . $field . ' ' - . '' . $field. ' ' + . '' . $field. ' ' - . $field . ' ' + . $field . ' 
- " size="2"> - "> + $rows .= ' + + '.lang("View").' - " size=2> - ">Vcard + + '.lang("VCard").' - " size="2"> - 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")).'
+ $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")); + $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); -
"> - - - - - - - - - - - - - - - - - - - - -
-
- "> -
-
-
- -
-
  
-
-
+ $t->parse("out","addressbook_header"); + $t->pparse("out","addressbook_header"); + $t->parse("out","searchfilter"); + $t->pparse("out","searchfilter"); + $t->parse("out","body"); + $t->pparse("out","body"); + $t->parse("out","addressbook_footer"); + $t->pparse("out","addressbook_footer"); -common->phpgw_footer(); ?>