From 8ea623c23ad302a46d05a66d77901348f04a6f80 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 10 Jun 2002 21:36:22 +0000 Subject: [PATCH] started to templatize the tab-widget. each element of the widget should be constructed from an eTemplate to allow template-sets to costomize the look --- etemplate/inc/class.tab_widget.inc.php | 35 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.tab_widget.inc.php b/etemplate/inc/class.tab_widget.inc.php index 6c31e4dcb8..1e3691c0c4 100644 --- a/etemplate/inc/class.tab_widget.inc.php +++ b/etemplate/inc/class.tab_widget.inc.php @@ -37,6 +37,8 @@ $cell['type'] = 'template'; $templ = new etemplate(); + $tab = new etemplate('etemplate.tab_widget.tab'); + $tab_active = new etemplate('etemplate.tab_widget.tab_active'); $templ->init('*** generated tab_widget','','',0,'',0,0); // make an empty template @@ -44,15 +46,27 @@ while (list($k,$name) = each($names)) { $tcell = $templ->empty_cell(); - $tcell['name'] = "_tab_widget[$name]"; +/* $tcell['name'] = "_tab_widget[$name]"; $tcell['type'] = 'button'; $tcell['label'] = $labels[$k]; $tcell['help'] = $helps[$k]; - if (is_array($value['_tab_widget']) && isset($value['_tab_widget'][$name])) +*/ if (is_array($value['_tab_widget']) && isset($value['_tab_widget'][$name])) { - $tcell['span'] = ',nmh'; // set tab as selected +// $tcell['span'] = ',nmh'; // set tab as selected $GLOBALS['phpgw_info']['etemplate']['extension_data']['tab_widget'][$cell['name']] = $selected_tab = $name; + $tcell['name'] = $tab_active; } + else + { + $tcell['name'] = $tab; + } + $tcell['type'] = 'template'; + $tcell['size'] = "_tab_widget[$name]"; + $value['_tab_widget'][$name] = array( + 'name' => "_tab_widget[$name]", + 'label' => $labels[$k], + 'help' => $helps[$k] + ); $tabs[$templ->num2chrs($k)] = $tcell; } // add one empty cell to take all the space of the row @@ -61,20 +75,29 @@ if (!isset($selected_tab)) { - $tabs['A']['span'] = ',nmh'; + //$tabs['A']['span'] = ',nmh'; + $tabs['A']['name'] = $tab_active; $GLOBALS['phpgw_info']['etemplate']['extension_data']['tab_widget'][$cell['name']] = $selected_tab = $names[0]; } $templ->data[1] = $tabs; + $tcell = $templ->empty_cell(); // make the tabwidget-header + $tcell['label'] = ' '; + $tcell['span'] = 'all'; + $templ->data[2]['A'] = $tcell; + $templ->data[0]['c2'] = 'nmh'; + $tcell = $templ->empty_cell(); // make the tabwidget-body $tcell['type'] = 'template'; $tcell['name'] = $selected_tab; $tcell['span'] = 'all'; - $templ->data[2]['A'] = $tcell; + $templ->data[3]['A'] = $tcell; - $templ->rows = 2; + $templ->rows = 3; $templ->cols = sizeof($tabs); + $templ->size = ',,,,0'; + $cell['type'] = 'template'; $cell['name'] = $templ; $cell['label'] = $cell['help'] = '';