mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-10 00:37:54 +02:00
Fix CKEditor Browse Server button to open vfsSelect
This commit is contained in:
@ -312,3 +312,31 @@ var et2_htmlarea = (function(){ "use strict"; return et2_inputWidget.extend([et2
|
||||
});}).call(this);
|
||||
et2_register_widget(et2_htmlarea, ["htmlarea"]);
|
||||
|
||||
jQuery.extend(et2_htmlarea,
|
||||
{
|
||||
/**
|
||||
* Build VfsSelect widget for CKEditor Browse Server button
|
||||
* @param {array} _data
|
||||
*/
|
||||
buildVfsSelectForCKEditor: function(_data)
|
||||
{
|
||||
if (!_data) return;
|
||||
var et2 = app[egw(window).app_name()].et2;
|
||||
|
||||
var vfsSelect = et2_createWidget('vfs-select', {
|
||||
id:'upload',
|
||||
mode: 'open',
|
||||
name: '',
|
||||
button_caption:"Link",
|
||||
button_label:"Link",
|
||||
dialog_title: "Link file",
|
||||
method: "ckeditor"
|
||||
}, et2);
|
||||
jQuery(vfsSelect.getDOMNode()).on('change', function (){
|
||||
CKEDITOR.tools.callFunction(_data.funcNum, vfsSelect.get_value());
|
||||
});
|
||||
|
||||
// start the file selector dialog
|
||||
vfsSelect.click();
|
||||
}
|
||||
});
|
@ -870,7 +870,9 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
type: "string",
|
||||
description: "Server side callback to process selected value(s) in \n\
|
||||
app.class.method or class::method format. The first parameter will \n\
|
||||
be Method ID, the second the file list."
|
||||
be Method ID, the second the file list. 'ckeditor' is reserved and it \n\
|
||||
means it should use download_baseUrl instead of path in value (no method\n\
|
||||
will be actually executed)."
|
||||
},
|
||||
"method_id": {
|
||||
name: "Method ID",
|
||||
@ -965,7 +967,8 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
label: this.options.button_label,
|
||||
path: this.options.path || null,
|
||||
mime: this.options.mime || null,
|
||||
name: this.options.name
|
||||
name: this.options.name,
|
||||
method: this.options.method
|
||||
};
|
||||
var callback = _callback || this._buildDialog;
|
||||
egw(window).json(
|
||||
@ -1024,11 +1027,12 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
files = _value.path;
|
||||
break;
|
||||
default:
|
||||
if (self.options.method === 'ckeditor') _value.path = _data.content.download_baseUrl;
|
||||
files = _value.path+'/'+_value.name;
|
||||
break;
|
||||
}
|
||||
self.value = files;
|
||||
if (self.options.method)
|
||||
if (self.options.method && self.options.method !== 'ckeditor')
|
||||
{
|
||||
egw(window).json(
|
||||
self.options.method,
|
||||
@ -1060,6 +1064,9 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
// 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;
|
||||
app.vfsSelectUI.et2 = this.dialog.template.widgetContainer;
|
||||
// Keep the dialog always at the top, seems CKEDITOR dialogs have very
|
||||
// high z-index set.
|
||||
this.dialog.div.parent().css({"z-index": 100000});
|
||||
app.vfsSelectUI.vfsSelectWidget = this;
|
||||
this.dialog.div.on('load', function(e) {
|
||||
app.vfsSelectUI.et2_ready(app.vfsSelectUI.et2, 'api.vfsSelectUI');
|
||||
|
Reference in New Issue
Block a user