mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-14 10:28:31 +02:00
Fix CKEditor Browse Server button to open vfsSelect
This commit is contained in:
@ -522,6 +522,14 @@ class Vfs extends File
|
||||
$sel_options = array_merge($sel_options, array(
|
||||
'app' => self::get_apps()
|
||||
));
|
||||
|
||||
if ($content['method'] === 'ckeditor')
|
||||
{
|
||||
$download_baseUrl = \EGroupware\Api\Vfs::download_url($content['path']);
|
||||
if ($download_baseUrl[0] == '/') $download_baseUrl = \EGroupware\Api\Egw::link($download_baseUrl);
|
||||
$content['download_baseUrl'] = $download_baseUrl;
|
||||
}
|
||||
|
||||
Api\Cache::setSession('filemanger', 'select_path', $content['path']);
|
||||
// Response
|
||||
$response->data(array(
|
||||
|
@ -60,6 +60,15 @@ class CkEditorConfig
|
||||
'px' => 'px: display pixels',
|
||||
);
|
||||
|
||||
/**
|
||||
* Functions that can be called via menuaction
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $public_functions = array(
|
||||
'vfsSelectHelper' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* Get available CKEditor Skins
|
||||
*
|
||||
@ -249,8 +258,10 @@ class CkEditorConfig
|
||||
*/
|
||||
private static function get_filebrowserBrowseUrl($start_path = '')
|
||||
{
|
||||
return $GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=filemanager.filemanager_select.select&mode=open&method=ckeditor_return'
|
||||
.($start_path != '' ? '&path='.$start_path : '');
|
||||
return \EGroupware\Api\Egw::link('/index.php',array(
|
||||
'menuaction' => 'api.EGroupware\\Api\\Html\\CkEditorConfig.vfsSelectHelper',
|
||||
'path' => $start_path
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -508,4 +519,21 @@ class CkEditorConfig
|
||||
// tell framework CK Editor needs eval and inline javascript :(
|
||||
ContentSecurityPolicy::add('script-src', $attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* It helps to get CKEditor Browse server button to open VfsSelect widget
|
||||
* in client side.
|
||||
* @todo Once the ckeditor allows to overrride the Browse Server button handler
|
||||
* we should remove this function and handle everything in htmlarea widget in
|
||||
* client side.
|
||||
*/
|
||||
public function vfsSelectHelper()
|
||||
{
|
||||
$tmp = new \EGroupware\Api\Etemplate('api.vfsSelectUI');
|
||||
$response = \EGroupware\Api\Json\Response::get();
|
||||
$response->call('window.opener.et2_htmlarea.buildVfsSelectForCKEditor',
|
||||
array('funcNum' => $_GET['CKEditorFuncNum']));
|
||||
$response->call('window.close');
|
||||
$tmp->exec('',array());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user