diff --git a/addressbook/add.php b/addressbook/add.php index 10cbef0108..2e9c3399ad 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -50,7 +50,7 @@ $this->id = $ab_id; $this->company = $company; - $this->company_id = $company_id; + //$this->company_id = $company_id; $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; diff --git a/addressbook/inc/class.addressbook_shared.inc.php b/addressbook/inc/class.addressbook_shared.inc.php index 6b1b77e07f..8a54894a5e 100644 --- a/addressbook/inc/class.addressbook_shared.inc.php +++ b/addressbook/inc/class.addressbook_shared.inc.php @@ -13,7 +13,7 @@ /* $Id$ */ class addressbook extends addressbook_ { - function colname($column,$listid) { + function coldata($column,$listid) { if ($column == "company") return $this->company[$listid]; elseif ($column == "firstname") return $this->firstname[$listid]; elseif ($column == "lastname") return $this->lastname[$listid]; diff --git a/addressbook/index.php b/addressbook/index.php index 5258807854..6150b2a9af 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -24,13 +24,13 @@ $t = new Template($phpgw_info["server"]["app_tpl"]); $t->set_file(array( "addressbook_header" => "header.tpl", "searchfilter" => "searchfilter.tpl", - "body" => "list.tpl", + "column" => "column.tpl", + "row" => "row.tpl", "addressbook_footer" => "footer.tpl" )); $this = CreateObject("addressbook.addressbook"); $entries = $this->get_entries($query,$filter,$sort,$order,$start); - $rows=""; $columns_to_display=$this->columns_to_display; if($phpgw_info["user"]["preferences"]["common"]["maxmatchs"] ) { $limit = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]; @@ -38,56 +38,10 @@ $limit = 15; } - for ($i=0;$i<$limit;$i++) { // each entry - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $rows .= ''; - while ($column = each($columns_to_display)) { // each entry column - $colname = $this->colname($column[0],$i); - $myid = $entries->ab_id[$i]; - $myowner = $entries->owner[$i]; - // Some fields require special formatting. - if ($column[0] == "url") { - $rows .= '' - . '' . $colname . ' '; - } else if ($column[0] == "email") { - if ($phpgw_info["user"]["apps"]["email"]) { - $rows .= '' - . '' . $colname . ' '; - } else { - $rows .= '' - . '' . $colname . ' '; - } - } else { // But these do not - $rows .= '' - . $colname . ' '; - } - } - - reset($columns_to_display); // If we don't reset it, our inside while won't loop - - $rows .= ' - - '.lang("View").' - - - - - '.lang("vcard").' - - - - - '.$phpgw->common->check_owner($myowner,"edit.php",lang("edit"),"ab_id=".$myid."&start=".$start."&sort=".$sort."&order=".$order."&query=".$query."&sort=".$sort).' - - - -'; - } + $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")); $t->set_var(searchreturn,$this->searchreturn); $t->set_var(lang_showing,$this->lang_showing); @@ -100,9 +54,6 @@ $t->set_var("lang_addvcard",lang("AddVCard")); $t->set_var("lang_import",lang("Import File")); $t->set_var("import_url",$phpgw->link("import.php")); - $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("sort",$sort); $t->set_var("order",$order); @@ -113,15 +64,51 @@ $t->set_var("start",$start); $t->set_var("filter",$filter); $t->set_var("cols",$this->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"); + + for ($i=0;$i<$limit;$i++) { // each entry + $t->set_var(columns,""); + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $t->set_var(row_tr_color,$tr_color); + while ($column = each($columns_to_display)) { // each entry column + $ref=$data=""; + $coldata = $this->coldata($column[0],$i); + $myid = $entries->ab_id[$i]; + $myowner = $entries->owner[$i]; + // Some fields require special formatting. + if ($column[0] == "url") { + $ref=''; + $data=$coldata.''; + } elseif ($column[0] == "email") { + if ($phpgw_info["user"]["apps"]["email"]) { + $ref=''; + } else { + $ref=''.$coldata.''; + } + $data=$coldata.""; + } else { // But these do not + $ref=" "; $data=$coldata; + } + $t->set_var(col_data,$ref.$data); + $t->parse("columns","column",True); + } + + reset($columns_to_display); // If we don't reset it, our inside while won't loop + + $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)); + + $t->parse("rows","row",True); + $t->pparse("out","row"); + } + $t->pparse("out","addressbook_footer"); $phpgw->common->phpgw_footer(); diff --git a/addressbook/templates/default/column.tpl b/addressbook/templates/default/column.tpl new file mode 100644 index 0000000000..d1a508ca69 --- /dev/null +++ b/addressbook/templates/default/column.tpl @@ -0,0 +1,3 @@ + + {col_data}  + diff --git a/addressbook/templates/default/footer.tpl b/addressbook/templates/default/footer.tpl index f70240d967..01a2db77ee 100644 --- a/addressbook/templates/default/footer.tpl +++ b/addressbook/templates/default/footer.tpl @@ -1,4 +1,5 @@ +
diff --git a/addressbook/templates/default/list.tpl b/addressbook/templates/default/list.tpl deleted file mode 100644 index 08a2e97152..0000000000 --- a/addressbook/templates/default/list.tpl +++ /dev/null @@ -1,8 +0,0 @@ - - - - {rows} - - - - diff --git a/addressbook/templates/default/row.tpl b/addressbook/templates/default/row.tpl new file mode 100644 index 0000000000..7659c4d193 --- /dev/null +++ b/addressbook/templates/default/row.tpl @@ -0,0 +1,14 @@ + + +{columns} + + {lang_view} + + + {lang_vcard} + + + {row_edit_link} + + + diff --git a/addressbook/templates/justweb/column.tpl b/addressbook/templates/justweb/column.tpl new file mode 100644 index 0000000000..d1a508ca69 --- /dev/null +++ b/addressbook/templates/justweb/column.tpl @@ -0,0 +1,3 @@ + + {col_data}  + diff --git a/addressbook/templates/justweb/footer.tpl b/addressbook/templates/justweb/footer.tpl index f70240d967..01a2db77ee 100644 --- a/addressbook/templates/justweb/footer.tpl +++ b/addressbook/templates/justweb/footer.tpl @@ -1,4 +1,5 @@ + diff --git a/addressbook/templates/justweb/list.tpl b/addressbook/templates/justweb/list.tpl deleted file mode 100644 index 08a2e97152..0000000000 --- a/addressbook/templates/justweb/list.tpl +++ /dev/null @@ -1,8 +0,0 @@ - - - - {rows} - - - - diff --git a/addressbook/templates/justweb/row.tpl b/addressbook/templates/justweb/row.tpl new file mode 100644 index 0000000000..7659c4d193 --- /dev/null +++ b/addressbook/templates/justweb/row.tpl @@ -0,0 +1,14 @@ + + +{columns} + + {lang_view} + + + {lang_vcard} + + + {row_edit_link} + + + diff --git a/addressbook/templates/verdilak/column.tpl b/addressbook/templates/verdilak/column.tpl new file mode 100644 index 0000000000..d1a508ca69 --- /dev/null +++ b/addressbook/templates/verdilak/column.tpl @@ -0,0 +1,3 @@ + + {col_data}  + diff --git a/addressbook/templates/verdilak/footer.tpl b/addressbook/templates/verdilak/footer.tpl index f70240d967..01a2db77ee 100644 --- a/addressbook/templates/verdilak/footer.tpl +++ b/addressbook/templates/verdilak/footer.tpl @@ -1,4 +1,5 @@ + diff --git a/addressbook/templates/verdilak/list.tpl b/addressbook/templates/verdilak/list.tpl deleted file mode 100644 index 08a2e97152..0000000000 --- a/addressbook/templates/verdilak/list.tpl +++ /dev/null @@ -1,8 +0,0 @@ - - - - {rows} - - - - diff --git a/addressbook/templates/verdilak/row.tpl b/addressbook/templates/verdilak/row.tpl new file mode 100644 index 0000000000..7659c4d193 --- /dev/null +++ b/addressbook/templates/verdilak/row.tpl @@ -0,0 +1,14 @@ + + +{columns} + + {lang_view} + + + {lang_vcard} + + + {row_edit_link} + + +