mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
Allow to set an explicit name for a tab_widget: "tabs=one|two|three"
In the example the tab itself is named "tabs", with tabs "one", "two" and "three". Therefore the name of the tab-widget (where the select tab gets reported and used to disable a single tab) does no longer depend on the available tabs. This allows for a deeper customization. Examples on how to use it are in the next two commits: tracker and pm
This commit is contained in:
parent
c2ca3760b7
commit
3b962e7064
@ -957,7 +957,12 @@ class etemplate extends boetemplate
|
|||||||
$show_c,$show_row,$content['.c'],$content['.row'],$content));
|
$show_c,$show_row,$content['.c'],$content['.row'],$content));
|
||||||
}
|
}
|
||||||
$name = $this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
|
$name = $this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
|
||||||
|
// allow names like "tabs=one|two|three", which will be equal to just "tabs"
|
||||||
|
// eg. for tabs to use a name independent of the tabs contained
|
||||||
|
if (is_string($name) && strpos($name,'=') !== false)
|
||||||
|
{
|
||||||
|
list($name) = explode('=',$name);
|
||||||
|
}
|
||||||
$form_name = $this->form_name($cname,$name);
|
$form_name = $this->form_name($cname,$name);
|
||||||
|
|
||||||
$value = $this->get_array($content,$name);
|
$value = $this->get_array($content,$name);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @package etemplate
|
* @package etemplate
|
||||||
|
* @subpackage extensions
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -15,11 +16,6 @@
|
|||||||
* See the example in 'etemplate.tab_widget.test'
|
* See the example in 'etemplate.tab_widget.test'
|
||||||
*
|
*
|
||||||
* This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function
|
* This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function
|
||||||
*
|
|
||||||
* @package etemplate
|
|
||||||
* @subpackage extensions
|
|
||||||
* @author RalfBecker-AT-outdoor-training.de
|
|
||||||
* @license GPL
|
|
||||||
*/
|
*/
|
||||||
class tab_widget
|
class tab_widget
|
||||||
{
|
{
|
||||||
@ -69,8 +65,12 @@
|
|||||||
}
|
}
|
||||||
$labels = explode('|',$cell['label']);
|
$labels = explode('|',$cell['label']);
|
||||||
$helps = explode('|',$cell['help']);
|
$helps = explode('|',$cell['help']);
|
||||||
$names = explode('|',$cell['name']);
|
if (strpos($cell_name=$tab_names=$cell['name'],'=') !== false)
|
||||||
|
{
|
||||||
|
list($cell_name,$tab_names) = explode('=',$cell['name']);
|
||||||
|
$cell['name'] = $cell_name;
|
||||||
|
}
|
||||||
|
$names = explode('|',$tab_names);
|
||||||
// disable tab mentioned in readonlys
|
// disable tab mentioned in readonlys
|
||||||
foreach(is_array($readonlys) ? $readonlys : array($readonlys => true) as $name => $disable)
|
foreach(is_array($readonlys) ? $readonlys : array($readonlys => true) as $name => $disable)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@
|
|||||||
{
|
{
|
||||||
$tcell['type'] = 'button';
|
$tcell['type'] = 'button';
|
||||||
$tcell['onchange'] = '1';
|
$tcell['onchange'] = '1';
|
||||||
$tcell['name'] = $cell['name'].'['.$name.']';
|
$tcell['name'] = $cell_name.'['.$name.']';
|
||||||
}
|
}
|
||||||
$tcell['label'] = $labels[$k];
|
$tcell['label'] = $labels[$k];
|
||||||
$tcell['help'] = $helps[$k];
|
$tcell['help'] = $helps[$k];
|
||||||
@ -156,7 +156,7 @@
|
|||||||
$tab_widget->set_cell_attribute('body','type','deck');
|
$tab_widget->set_cell_attribute('body','type','deck');
|
||||||
$tab_widget->set_cell_attribute('body','size',count($names));
|
$tab_widget->set_cell_attribute('body','size',count($names));
|
||||||
$tab_widget->set_cell_attribute('body','span',',tab_body');
|
$tab_widget->set_cell_attribute('body','span',',tab_body');
|
||||||
$tab_widget->set_cell_attribute('body','name',$cell['name']);
|
$tab_widget->set_cell_attribute('body','name',$cell_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,11 @@
|
|||||||
case 'tabbox':
|
case 'tabbox':
|
||||||
$labels = explode('|',$cell['label']); unset($cell['label']);
|
$labels = explode('|',$cell['label']); unset($cell['label']);
|
||||||
$helps = explode('|',$cell['help']); unset($cell['help']);
|
$helps = explode('|',$cell['help']); unset($cell['help']);
|
||||||
$names = explode('|',$cell['name']); unset($cell['name']);
|
if (strpos($tab_names=$cell['name'],'=') !== false)
|
||||||
|
{
|
||||||
|
list($cell['name'],$tab_names) = explode('=',$cell['name']);
|
||||||
|
}
|
||||||
|
$names = explode('|',$tab_names);
|
||||||
for ($n = 0; $n < count($labels); ++$n)
|
for ($n = 0; $n < count($labels); ++$n)
|
||||||
{
|
{
|
||||||
$tab =& new xmlnode('tab');
|
$tab =& new xmlnode('tab');
|
||||||
|
Loading…
Reference in New Issue
Block a user