defining used tabs on runtime and using a single tab template

This commit is contained in:
Ralf Becker 2013-05-09 09:38:12 +00:00
parent afee7030be
commit 77099cf331
3 changed files with 10 additions and 117 deletions

View File

@ -268,12 +268,11 @@ class preferences_settings
{
case 'section':
$tab = 'tab'.(1+count($tabs));
$tabs[$tab] = $setting['title'];
$tpl->setElementAttribute($tab, 'label', $setting['title']);
if (count($tabs) > 5)
{
throw new egw_exception_assertion_failed("App $appname has more then 4 preference tabs!");
}
$tabs[] = array(
'id' => $tab,
'template' => 'preferences.settings.tab1',
'label' => $setting['title'],
);
// fall through
case 'subsection': // is in old code, but never seen it used
continue 2;
@ -357,14 +356,8 @@ class preferences_settings
$content[$tab][$setting['name']] = $GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']];
//if ($old_type == 'multiselect') $content[$tab][$setting['name']] = explode(',', $content[$tab][$setting['name']]);
}
// disabling not used tabs, does NOT work in new eT
$readonlys['tabs'] = array(
'tab2' => !isset($tabs['tab2']),
'tab3' => !isset($tabs['tab3']),
'tab4' => !isset($tabs['tab4']),
'tab5' => !isset($tabs['tab5']),
);
$tpl->setElementAttribute('tabs', 'label', implode('|', $tabs)); // old eT
// defining used tabs on run-time
if ($tabs) $tpl->setElementAttribute('tabs', 'tabs', $tabs);
$content['appname'] = $appname;
$sel_options['appname'] = array();

View File

@ -2,7 +2,7 @@
/**
* EGroupware - eTemplates for Application preferences
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2013-05-03 17:22
* generated by soetemplate::dump4setup() 2013-05-09 11:36
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package preferences
@ -12,19 +12,7 @@
$templ_version=1;
$templ_data[] = array('name' => 'preferences.settings','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:5:{i:0;a:3:{s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";}i:1;a:4:{s:4:"type";s:6:"select";s:4:"name";s:4:"type";s:8:"onchange";i:1;s:4:"span";s:9:",prefType";}i:2;a:5:{s:4:"type";s:6:"select";s:4:"name";s:7:"appname";s:4:"size";s:18:"Common preferences";s:8:"onchange";i:1;s:4:"span";s:8:",prefApp";}i:3;a:3:{s:4:"name";s:29:"tabs=tab1|tab2|tab3|tab4|tab5";s:4:"type";s:3:"tab";s:5:"label";s:29:"Tab 1|Tab 2|Tab 3|Tab 4|Tab 5";}i:4;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"type";s:6:"button";}i:2;a:3:{s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"type";s:6:"button";}i:3;a:3:{s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"type";s:6:"button";}}}','size' => '','style' => '','modified' => '1367564824',);
$templ_data[] = array('name' => 'preferences.settings.general','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:7:"general";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:2:{s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"name";s:13:"${row}[value]";s:4:"type";s:4:"text";s:4:"span";s:10:",prefValue";s:4:"size";s:13:"@${row}[size]";}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:16:"100%,,,prefTable";s:7:"options";a:2:{i:3;s:9:"prefTable";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable','style' => '','modified' => '1367140794',);
$templ_data[] = array('name' => 'preferences.settings','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:5:{i:0;a:3:{s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";}i:1;a:4:{s:4:"type";s:6:"select";s:4:"name";s:4:"type";s:8:"onchange";i:1;s:4:"span";s:9:",prefType";}i:2;a:5:{s:4:"type";s:6:"select";s:4:"name";s:7:"appname";s:4:"size";s:18:"Common preferences";s:8:"onchange";i:1;s:4:"span";s:8:",prefApp";}i:3;a:3:{s:4:"name";s:9:"tabs=tab1";s:4:"type";s:3:"tab";s:5:"label";s:8:"Settings";}i:4;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"type";s:6:"button";}i:2;a:3:{s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"type";s:6:"button";}i:3;a:3:{s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"type";s:6:"button";}}}','size' => '','style' => '','modified' => '1367564824',);
$templ_data[] = array('name' => 'preferences.settings.tab1','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab1";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"${row}[value]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:13:"@${row}[type]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1367565943',);
$templ_data[] = array('name' => 'preferences.settings.tab2','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab2";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"${row}[value]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:13:"@${row}[type]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1367566575',);
$templ_data[] = array('name' => 'preferences.settings.tab3','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab3";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"${row}[value]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:13:"@${row}[type]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1367566588',);
$templ_data[] = array('name' => 'preferences.settings.tab4','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab4";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"${row}[value]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:13:"@${row}[type]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1367566604',);
$templ_data[] = array('name' => 'preferences.settings.tab5','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab5";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"${row}[value]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:5:"label";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:13:"@${row}[type]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1367583114',);
$templ_data[] = array('name' => 'preferences.test','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:5:"Label";s:4:"name";s:2:"id";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1367563385',);

View File

@ -21,86 +21,6 @@
</rows>
</grid>
</template>
<template id="preferences.settings.tab2" template="" lang="" group="0" version="1.9.001">
<grid width="100%" class="prefTable egwGridView_grid">
<columns>
<column width="50%"/>
<column/>
</columns>
<rows>
<row class="prefRow">
<box class="prefName">
<description for="@${row}[name]" id="${row}[label]"/>
<description id="${row}[help]" class="prefHelp"/>
</box>
<box>
<widget type="@${row}[type]" id="@${row}[name]" no_lang="1" class="prefValue"/>
<description id="${row}[default]" no_lang="1" class="prefDefault"/>
</box>
</row>
</rows>
</grid>
</template>
<template id="preferences.settings.tab3" template="" lang="" group="0" version="1.9.001">
<grid width="100%" class="prefTable egwGridView_grid">
<columns>
<column width="50%"/>
<column/>
</columns>
<rows>
<row class="prefRow">
<box class="prefName">
<description for="@${row}[name]" id="${row}[label]"/>
<description id="${row}[help]" class="prefHelp"/>
</box>
<box>
<widget type="@${row}[type]" id="@${row}[name]" no_lang="1" class="prefValue"/>
<description id="${row}[default]" no_lang="1" class="prefDefault"/>
</box>
</row>
</rows>
</grid>
</template>
<template id="preferences.settings.tab4" template="" lang="" group="0" version="1.9.001">
<grid width="100%" class="prefTable egwGridView_grid">
<columns>
<column width="50%"/>
<column/>
</columns>
<rows>
<row class="prefRow">
<box class="prefName">
<description for="@${row}[name]" id="${row}[label]"/>
<description id="${row}[help]" class="prefHelp"/>
</box>
<box>
<widget type="@${row}[type]" id="@${row}[name]" no_lang="1" class="prefValue"/>
<description id="${row}[default]" no_lang="1" class="prefDefault"/>
</box>
</row>
</rows>
</grid>
</template>
<template id="preferences.settings.tab5" template="" lang="" group="0" version="1.9.001">
<grid width="100%" class="prefTable egwGridView_grid">
<columns>
<column width="50%"/>
<column/>
</columns>
<rows>
<row class="prefRow">
<box class="prefName">
<description for="@${row}[name]" id="${row}[label]"/>
<description id="${row}[help]" class="prefHelp"/>
</box>
<box>
<widget type="@${row}[type]" id="@${row}[name]" no_lang="1" class="prefValue"/>
<description id="${row}[default]" no_lang="1" class="prefDefault"/>
</box>
</row>
</rows>
</grid>
</template>
<template id="preferences.settings" template="" lang="" group="0" version="1.9.001">
<description id="msg" class="redItalic"/>
<menulist>
@ -111,18 +31,10 @@
</menulist>
<tabbox id="tabs">
<tabs>
<tab id="tab1" label="Tab 1"/>
<tab id="tab2" label="Tab 2"/>
<tab id="tab3" label="Tab 3"/>
<tab id="tab4" label="Tab 4"/>
<!-- tab id="tab5" label="Tab 5"/ -->
<tab id="tab1" label="Settings"/>
</tabs>
<tabpanels>
<template id="preferences.settings.tab1" content="tab1"/>
<template id="preferences.settings.tab2" content="tab2"/>
<template id="preferences.settings.tab3" content="tab3"/>
<template id="preferences.settings.tab4" content="tab4"/>
<!-- template id="preferences.settings.tab5" content="tab5"/ -->
</tabpanels>
</tabbox>
<hbox>