Switch 'Edit settings' popup to etemplate2

This commit is contained in:
Nathan Gray 2013-12-16 18:46:48 +00:00
parent a1e5783da6
commit 34f8da55c3

View File

@ -830,7 +830,7 @@ class filemanager_ui
*/ */
function file(array $content=null,$msg='') function file(array $content=null,$msg='')
{ {
$tpl = new etemplate('filemanager.file'); $tpl = new etemplate_new('filemanager.file');
if (!is_array($content)) if (!is_array($content))
{ {
@ -890,6 +890,12 @@ class filemanager_ui
$path =& $content['path']; $path =& $content['path'];
list($button) = @each($content['button']); unset($content['button']); list($button) = @each($content['button']); unset($content['button']);
if(!$button && $content['sudo'])
{
// Button to stop sudo is not in button namespace
$button = 'sudo';
unset($content['sudo']);
}
// need to check 'setup' button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field // need to check 'setup' button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field
if ($button == 'sudo' && egw_vfs::$is_root || $button == 'setup' && $content['sudo']['user']) if ($button == 'sudo' && egw_vfs::$is_root || $button == 'setup' && $content['sudo']['user'])
{ {
@ -1163,43 +1169,26 @@ class filemanager_ui
} }
if (egw_vfs::$is_root) if (egw_vfs::$is_root)
{ {
$sudo_button =& $tpl->get_widget_by_name('sudo'); $tpl->setElementAttribute('sudo', 'label', 'Logout');
$sudo_button = etemplate::empty_cell('button','button[sudo]',array( $tpl->setElementAttribute('sudo', 'help','Log out as superuser');
'label' => 'Logout', // Need a more complex submit because button type is buttononly, which doesn't submit
'help' => 'Log out as superuser', $tpl->setElementAttribute('sudo', 'onclick','widget.getInstanceManager().submit(widget)');
'align' => 'right',
));
} }
if (($extra_tabs = egw_vfs::getExtraInfo($path,$content))) if (($extra_tabs = egw_vfs::getExtraInfo($path,$content)))
{
if(method_exists($tpl,'get_widget_by_name'))
{
$tabs =& $tpl->get_widget_by_name('tabs=general|perms|eacl|preview|custom');
}
else // et2
{ {
// add to existing tabs in template // add to existing tabs in template
$tpl->setElementAttribute('tabs', 'add_tabs', true); $tpl->setElementAttribute('tabs', 'add_tabs', true);
$tabs =& $tpl->getElementAttribute('tabs','tabs'); $tabs =& $tpl->getElementAttribute('tabs','tabs');
$tabs = array(); $tabs = array();
}
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
{
if(method_exists($tpl,'get_widget_by_name'))
{
$tabs['name'] .= '|'.$extra_tab['name'];
$tabs['label'] .= '|'.$extra_tab['label'];
$tabs['help'] .= '|'.$extra_tab['help'];
}
else
{ {
$tabs[] = array( $tabs[] = array(
'label' => $extra_tab['label'], 'label' => $extra_tab['label'],
'template' => $extra_tab['name'] 'template' => $extra_tab['name']
); );
}
if ($extra_tab['data'] && is_array($extra_tab['data'])) if ($extra_tab['data'] && is_array($extra_tab['data']))
{ {
$content = array_merge($content, $extra_tab['data']); $content = array_merge($content, $extra_tab['data']);