Fix tinymce upload image not working in ole etemplate apps like knowledge base app

This commit is contained in:
Hadi Nategh 2021-11-16 16:51:29 +01:00
parent dd1b868be3
commit 6f6613a450
2 changed files with 5 additions and 3 deletions

View File

@ -155,11 +155,12 @@ class Vfs extends File
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
$widget_id = $_REQUEST['widget_id']; $widget_id = $_REQUEST['widget_id'];
$file = $type == 'htmlarea' ? $_FILES['file'] : $_FILES['upload']; $file = $type == 'htmlarea' ? $_FILES['file'] : $_FILES['upload'];
if(!self::$request = Etemplate\Request::read($request_id)) // we still need to deal with old etemplate apps (eg. knowlegde base) uploading with no request_id available
if($request_id && !self::$request = Etemplate\Request::read($request_id))
{ {
$error = lang("Could not read session"); $error = lang("Could not read session");
} }
elseif (!($template = Template::instance(self::$request->template['name'], self::$request->template['template_set'], elseif (self::$request && !($template = Template::instance(self::$request->template['name'], self::$request->template['template_set'],
self::$request->template['version'], self::$request->template['load_via']))) self::$request->template['version'], self::$request->template['load_via'])))
{ {
// Can't use callback // Can't use callback

View File

@ -471,7 +471,7 @@ class Html
egw_LAB.wait(function() { egw_LAB.wait(function() {
var imageUpload = egw.ajaxUrl("EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_htmlarea_upload")+"&type=htmlarea"; var imageUpload = egw.ajaxUrl("EGroupware\\\Api\\\Etemplate\\\Widget\\\Vfs::ajax_htmlarea_upload")+"&type=htmlarea";
imageUpload = imageUpload.substr(egw.webserverUrl.length+1); imageUpload = imageUpload.substr(egw.webserverUrl.length+1);
var font_size_formats = { var font_size_formats = {
pt: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 72pt", pt: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 72pt",
@ -504,6 +504,7 @@ var language_code = {
}; };
tinymce.init({ tinymce.init({
selector: name, selector: name,
base_url: egw.webserverUrl + "/vendor/tinymce/tinymce",
menubar: parseInt('. $rte_menubar.')? true : false, menubar: parseInt('. $rte_menubar.')? true : false,
branding: false, branding: false,
resize: false, resize: false,