* Mail/Admin: Fix upload picture into mail signature from editor image browser does not work.

This commit is contained in:
Hadi Nategh 2017-12-06 16:25:31 +01:00
parent 500674bf3a
commit 594bd63181
3 changed files with 32 additions and 3 deletions

View File

@ -318,7 +318,20 @@ jQuery.extend(et2_htmlarea,
buildVfsSelectForCKEditor: function(_data)
{
if (!_data) return;
var et2 = app[egw(window).app_name()].et2;
// Don't rely only on app_name to fetch et2 object as app_name may not
// always represent current app of the window, e.g.: mail admin account.
// Try to fetch et2 from its template name.
var etemplate = jQuery('form').data('etemplate');
var et2 = {};
if (etemplate && etemplate.name && !app[egw(window).app_name()])
{
et2 = etemplate2.getByTemplate(etemplate.name)[0]['widgetContainer'];
}
else
{
et2 = app[egw(window).app_name()].et2;
}
var vfsSelect = et2_createWidget('vfs-select', {
id:'upload',

View File

@ -1064,10 +1064,25 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
resizable: false
}, et2_dialog._create_parent('api'));
this.dialog.template.uniqueId = 'api.vfsSelectUI';
// Don't rely only on app_name to fetch et2 object as app_name may not
// always represent current app of the window, e.g.: mail admin account.
// Try to fetch et2 from its template name.
var etemplate = jQuery('form').data('etemplate');
var et2 = {};
if (etemplate && etemplate.name && !app[egw(window).app_name()])
{
et2 = etemplate2.getByTemplate(etemplate.name)[0]
}
else
{
et2 = etemplate2.getByApplication(egw(window).app_name())[0];
}
// we need an etemplate_exec_id for better handling serverside parts of
// widgets and since we can not have a etemplate_exec_id specifically
// for dialog template our best shot is to inherit its parent etemplate_exec_id.
this.dialog.template.etemplate_exec_id = etemplate2.getByApplication(egw(window).app_name())[0].etemplate_exec_id;
this.dialog.template.etemplate_exec_id = et2.etemplate_exec_id;
app.vfsSelectUI.et2 = this.dialog.template.widgetContainer;
// Keep the dialog always at the top, seems CKEDITOR dialogs have very
// high z-index set.

View File

@ -259,8 +259,9 @@ class CkEditorConfig
private static function get_filebrowserBrowseUrl($start_path = '')
{
// Still need to treat old etemplate app to use filemanager_select.
// *Admin: admin app also still have some old etmplate apps like login_message.
// @TODO: this should be removed when we don't have any old etemplate app anymore.
if (in_array($GLOBALS['app'], array('phpbrain', 'sitemgr')))
if (in_array($GLOBALS['app'], array('phpbrain', 'sitemgr', 'admin')))
{
return $GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=filemanager.filemanager_select.select&mode=open&method=ckeditor_return'
.($start_path != '' ? '&path='.$start_path : '');