forked from extern/egroupware
Handle logout onClick handler for superuser button in filemanager file dialog
This commit is contained in:
parent
3f2eddc0c7
commit
3021b6a3c9
@ -1179,12 +1179,18 @@ class filemanager_ui
|
||||
}
|
||||
if (egw_vfs::$is_root)
|
||||
{
|
||||
$tpl->setElementAttribute('sudo', 'label', 'Logout');
|
||||
$tpl->setElementAttribute('sudo', 'help','Log out as superuser');
|
||||
$tpl->setElementAttribute('sudouser', 'label', 'Logout');
|
||||
$tpl->setElementAttribute('sudouser', 'help','Log out as superuser');
|
||||
// Need a more complex submit because button type is buttononly, which doesn't submit
|
||||
$tpl->setElementAttribute('sudo', 'onclick','widget.getInstanceManager().submit(widget)');
|
||||
$tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"login")');
|
||||
|
||||
}
|
||||
elseif ($button == 'sudo')
|
||||
{
|
||||
$tpl->setElementAttribute('sudouser', 'label', 'Superuser');
|
||||
$tpl->setElementAttribute('sudouser', 'help','Enter setup user and password to get root rights');
|
||||
$tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"logout")');
|
||||
}
|
||||
if (($extra_tabs = egw_vfs::getExtraInfo($path,$content)))
|
||||
{
|
||||
// add to existing tabs in template
|
||||
|
@ -773,5 +773,32 @@ app.classes.filemanager = AppJS.extend(
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set Sudo button's label and change its onclick handler according to its action
|
||||
*
|
||||
* @param {widget object} _widget sudo buttononly
|
||||
* @param {string} _action string of action type {login|logout}
|
||||
*/
|
||||
set_sudoButton: function (_widget, _action)
|
||||
{
|
||||
var widget = _widget || this.et2.getWidgetById('sudouser');
|
||||
if (widget)
|
||||
{
|
||||
switch (_action)
|
||||
{
|
||||
case 'login':
|
||||
widget.set_label('Logout');
|
||||
this.et2._inst.submit(widget);
|
||||
break;
|
||||
|
||||
default:
|
||||
widget.set_label('Superuser');
|
||||
widget.onclick = function(){
|
||||
jQuery('.superuser').css('display','inline');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user