moved fsck to filemanager_admin and get cancel button working with CSP

This commit is contained in:
Ralf Becker 2014-06-13 09:22:45 +00:00
parent e25799927d
commit 2a959eb0d2
2 changed files with 26 additions and 34 deletions

View File

@ -22,6 +22,7 @@ class filemanager_admin extends filemanager_ui
*/
public $public_functions = array(
'index' => true,
'fsck' => true,
);
/**
@ -194,4 +195,28 @@ class filemanager_admin extends filemanager_ui
$GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning');
$tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys);
}
/**
* Run fsck on sqlfs
*/
function fsck()
{
if ($_POST['cancel'])
{
egw_framework::redirect_link('/admin/index.php', null, 'admin');
}
$check_only = !isset($_POST['fix']);
if (!($msgs = sqlfs_utils::fsck($check_only)))
{
$msgs = lang('Filesystem check reported no problems.');
}
$content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n";
$content .= html::form('<p>'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):'').
html::submit_button('cancel', lang('Cancel')).'</p>',
'','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck'));
$GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true);
}
}

View File

@ -14,15 +14,6 @@
*/
class filemanager_hooks
{
/**
* Functions callable via menuaction
*
* @var unknown_type
*/
var $public_functions = array(
'fsck' => true,
);
static $appname = 'filemanager';
static $foldercount = 1;
@ -116,7 +107,7 @@ class filemanager_hooks
$file = Array(
'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname='.self::$appname),
'Custom fields' => egw::link('/index.php','menuaction=admin.customfields.edit&appname='.self::$appname),
'Check virtual filesystem' => egw::link('/index.php','menuaction=filemanager.filemanager_hooks.fsck'),
'Check virtual filesystem' => egw::link('/index.php','menuaction=filemanager.filemanager_admin.fsck'),
'VFS mounts and versioning' => egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.index'),
);
if ($location == 'admin')
@ -265,30 +256,6 @@ class filemanager_hooks
return $settings;
}
/**
* Run fsck on sqlfs
*/
function fsck()
{
if (!isset($GLOBALS['egw_info']['user']['apps']['admin']))
{
throw new egw_exception_no_permission_admin();
}
$check_only = !isset($_POST['fix']);
if (!($msgs = sqlfs_utils::fsck($check_only)))
{
$msgs = lang('Filesystem check reported no problems.');
}
$content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n";
$content .= html::form('<p>'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):'').
html::submit_button('cancel', lang('Cancel'), "window.location.href='".egw::link('/admin/index.php')."'; return false;").'</p>',
'','/index.php',array('menuaction'=>'filemanager.filemanager_hooks.fsck'));
$GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true);
}
/**
* Register filemanager as handler for directories
*