Deprecate CKEDITOR and remove it from source

This commit is contained in:
Hadi Nategh 2019-01-25 12:41:13 +01:00
parent 72c21bffcf
commit c5c09c4f9f
38 changed files with 66 additions and 1169 deletions

View File

@ -173,7 +173,6 @@ module.exports = function (grunt) {
"api/js/etemplate/et2_widget_html.js",
"api/js/etemplate/et2_core_editableWidget.js",
"api/js/etemplate/et2_widget_htmlarea.js",
"api/js/etemplate/et2_widget_ckeditor.js",
"api/js/etemplate/et2_widget_tabs.js",
"api/js/etemplate/et2_widget_timestamper.js",
"api/js/etemplate/et2_widget_toolbar.js",

View File

@ -180,9 +180,6 @@ class admin_mail
*/
public function add(array $content=array(), $msg='', $msg_type='success')
{
// otherwise we cant switch to ckeditor in edit
Api\Html\CkEditorConfig::set_csp_script_src_attrs();
$tpl = new Etemplate('admin.mailwizard');
if (empty($content['account_id']))
{

View File

@ -1,349 +0,0 @@
/**
* EGroupware eTemplate2 - JS widget for HTML editing
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage api
* @link http://www.egroupware.org
* @author Nathan Gray
* @copyright Nathan Gray 2012
* @version $Id$
*/
/*egw:uses
jsapi.jsapi; // Needed for egw_seperateJavaScript
/vendor/bower-asset/jquery/dist/jquery.js;
et2_core_baseWidget;
*/
/**
* @augments et2_inputWidget
*/
var et2_ckeditor = (function(){ "use strict"; return et2_inputWidget.extend([et2_IResizeable],
{
modes: ['ascii','simple','extended','advanced'],
attributes: {
'mode': {
'name': 'Mode',
'description': 'One of {ascii|simple|extended|advanced}',
'default': 'simple',
'type': 'string'
},
'height': {
'name': 'Height',
'default': et2_no_init,
'type': 'string'
},
'width': {
'name': 'Width',
'default': et2_no_init,
'type': 'string'
},
'expand_toolbar': {
'name': 'Expand Toolbar',
'default': true,
'type':'boolean',
'description': 'Have the toolbar expanded (visible)'
},
'base_href': { // seems not to be used anymore
'name': 'Image base path',
'default': et2_no_init,
'type': 'string',
'description': 'activates the browser for images at the path (relative to the docroot)'
},
'config': {
// internal default configuration
'name': 'Internal configuration',
'type':'any',
'default': et2_no_init,
'description': 'Internal configuration - managed by preferences & framework, passed in here',
'translate': 'no_lang'
},
value: {
name: "Value",
description: "The value of the widget",
type: "html", // "string" would remove html tags by running html_entity_decode
default: et2_no_init
},
imageUpload: {
name: "imageUpload",
description: "Url to upload images dragged in or id of link_to widget to it's vfs upload. Can also be just a name for which content array contains a path to upload the picture.",
type: "string",
default: null
}
},
legacyOptions: ['mode','height','width','expand_toolbar','base_href'],
/**
* Constructor
*
* @param _parent
* @param _attrs
* @memberOf et2_ckeditor
*/
init: function(_parent, _attrs) {
// _super.apply is responsible for the actual setting of the params (some magic)
this._super.apply(this, arguments);
// CK instance
this.ckeditor = null;
// Allow no child widgets
this.supportedWidgetClasses = [];
this.htmlNode = jQuery(document.createElement("textarea"))
.css('height', this.options.height)
.addClass('et2_textbox_ro');
this.setDOMNode(this.htmlNode[0]);
},
transformAttributes: function(_attrs) {
// Check mode, some apps jammed everything in there
if(_attrs['mode'] && jQuery.inArray(_attrs['mode'], this.modes) < 0)
{
this.egw().debug("warn", "'%s' is an invalid mode for et2_ckeditor '%s'. Valid options:", _attrs['mode'],_attrs['id'], this.modes);
var list = _attrs['mode'].split(',');
for(var i = 0; i < list.length && i < this.legacyOptions.length; i++)
{
_attrs[this.legacyOptions[i]] = list[i];
}
}
this._super.apply(this, arguments);
},
doLoadingFinished: function() {
this._super.apply(this, arguments);
if(this.mode == 'ascii' || this.ckeditor != null) return;
var self = this;
if (!this.options.imageUpload)
{
delete self.options.config.imageUploadUrl;
}
else if (this.options.imageUpload[0] !== '/' && this.options.imageUpload.substr(0, 4) != 'http')
{
self.options.config.imageUploadUrl = egw.ajaxUrl("EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_htmlarea_upload")+
'&request_id='+self.getInstanceManager().etemplate_exec_id+'&widget_id='+this.options.imageUpload;
self.options.config.imageUploadUrl = self.options.config.imageUploadUrl.substr(egw.webserverUrl.length+1);
}
else
{
self.options.config.imageUploadUrl = this.options.imageUpload.substr(egw.webserverUrl.length+1);
}
try
{
this.ckeditor = CKEDITOR.replace(this.dom_id,jQuery.extend({},this.options.config,this.options));
this.ckeditor.setData(self.value);
delete self.value;
}
catch (e)
{
if(CKEDITOR.instances[this.dom_id])
{
CKEDITOR.instances[this.dom_id].destroy();
}
if(this.htmlNode.ckeditor)
{
this.ckeditor = CKEDITOR.replace(this.dom_id,this.options.config);
this.ckeditor.setData(self.value);
delete self.value;
}
}
if(this.ckeditor && this.options.config.preference_style)
{
var editor = this.ckeditor;
this.ckeditor.on('instanceReady', function(e) {
// Add in user font preferences
if (self.options.config.preference_style && !e.editor.getData())
{
e.editor.document.getBody().setHtml(self.options.config.preference_style);
delete self.options.config.preference_style;
}
});
// Drag & drop of images inline won't work, because of database
// field sizes. For some reason FF ignored just changing the cursor
// when dragging, so we replace dropped images with error icon.
var replaceImgText = function(html) {
var ret = html.replace( /<img[^>]*src="(data:.*;base64,.*?)"[^>]*>/gi, function( img, src ){
return '';
});
return ret;
};
var chkImg = function(e) {
// don't execute code if the editor is readOnly
if (editor.readOnly)
return;
// allow data-URL, returning false to stop regular upload
if (!self.options.imageUpload)
{
// Remove the image from the text
setTimeout( function() {
editor.document.$.body.innerHTML = replaceImgText(editor.document.$.body.innerHTML);
},200);
}
// Supported file types for dropping on CKEditor imageUpload plugin
var supportedTypesByCKEditor = /image\/(jpeg|png|gif)/;
// Try to pass the image into the first et2_file that will accept it
if(e.data.$.dataTransfer && !CKEDITOR.fileTools.isTypeSupported(e.data.$.dataTransfer.files[0],supportedTypesByCKEditor))
{
self.getRoot().iterateOver(function(widget) {
if(widget.options.drop_target)
{
widget.set_value(e.data.$.dataTransfer.files,e.data.$);
return;
}
},e.data.$,et2_file);
}
};
editor.on( 'contentDom', function() {
editor.document.on('drop', chkImg);
});
}
},
destroy: function() {
try
{
//this.htmlNode.ckeditorGet().destroy(true);
if (this.ckeditor) this.ckeditor.destroy(true);
this.ckeditor = null;
}
catch (e)
{
this.egw().debug("warn","Removing CKEDITOR: " + e.message, this,e);
// Finish it
delete CKEDITOR.instances[this.dom_id];
}
this.htmlNode.remove();
this.htmlNode = null;
this._super.apply(this, arguments);
},
set_value: function(_value) {
this._oldValue = _value;
try {
//this.htmlNode.ckeditorGet().setData(_value);
var ckeditor = CKEDITOR.instances[this.dom_id];
if (ckeditor)
{
ckeditor.setData(_value);
}
else
{
this.htmlNode.val(_value);
this.value = _value;
}
} catch (e) {
// CK editor not ready - callback will do it
this.value = _value;
}
},
getValue: function() {
try
{
//return this.htmlNode.ckeditorGet().getData();
var ckeditor = CKEDITOR.instances[this.dom_id];
return ckeditor ? ckeditor.getData() : this.htmlNode.val();
}
catch (e)
{
// CK Error
this.egw().debug("error",e);
return null;
}
},
/**
* Resize htmlNode tag according to window size
* @param {type} _height excess height which comes from window resize
*/
resize: function (_height)
{
if (_height && this.options.resize_ratio !== '0')
{
// apply the ratio
_height = (this.options.resize_ratio != '')? _height * this.options.resize_ratio: _height;
if (_height != 0)
{
if (this.ckeditor) // CKEDITOR HTML
{
var h = 0;
if (typeof this.ckeditor.container !='undefined' && this.ckeditor.container.$.clientHeight > 0)
{
h = (this.ckeditor.container.$.clientHeight + _height) > 0 ?
this.ckeditor.container.$.clientHeight + _height: this.ckeditor.config.height;
}
else if (this.ckeditor.ui.space('contents'))
{
h = parseInt(this.ckeditor.ui.space('contents').getStyle('height')) + _height;
}
else // fallback height size
{
h = this.ckeditor.config.height + _height;
}
this.ckeditor.resize('',h);
}
else // No CKEDITOR
{
this.htmlNode.height(this.htmlNode.height() + _height);
}
}
}
}
});}).call(this);
et2_register_widget(et2_ckeditor, ["ckeditor"]);
jQuery.extend(et2_ckeditor,
{
/**
* Build VfsSelect widget for CKEditor Browse Server button
* @param {array} _data
*/
buildVfsSelectForCKEditor: function(_data)
{
if (!_data) return;
// 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',
mode: 'open',
name: '',
button_caption:"Link",
button_label:"Link",
dialog_title: "Link file",
method: "download"
}, et2);
jQuery(vfsSelect.getDOMNode()).on('change', function (){
CKEDITOR.tools.callFunction(_data.funcNum, vfsSelect.get_value());
});
// start the file selector dialog
vfsSelect.click();
}
});

View File

@ -125,7 +125,7 @@ var et2_timestamper = (function(){ "use strict"; return et2_button.extend([],
pos = input.selectionStart;
};
// If CKEDitor, update it
// If tinymce, update it
if(tinymce)
{
tinymce.insertContent(text);

View File

@ -1310,8 +1310,7 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
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.
// Keep the dialog always at the top
this.dialog.div.parent().css({"z-index": 100000});
app.vfsSelectUI.vfsSelectWidget = this;
this.dialog.div.on('load', function(e) {

View File

@ -36,7 +36,6 @@
et2_widget_favorites;
et2_widget_html;
et2_widget_htmlarea;
et2_widget_ckeditor;
et2_widget_tabs;
et2_widget_taglist;
et2_widget_timestamper;
@ -646,8 +645,6 @@ etemplate2.prototype.autocomplete_fixer = function ()
if (form)
{
// Stop submit propagation in order to not fire other possible submit events
// for instance, CKEditor has its own submit event handler which we do not want to
// fire that on submit
form.onsubmit = function(e){e.stopPropagation();};
// Firefox give a security warning when transmitting to "about:blank" from a https site

View File

@ -184,7 +184,6 @@ blue moono theme common cs téma modrý měsíc
blurtext common cs rozmazaný text
bold common cs Tučné
bolivia common cs BOLÍVIE
bootstrap theme for ckeditor common cs výchozí téma pro fckeditor
border common cs Okraj
border-line-thickness for the table-tag common cs Tloušťka okraje pro tag tabulky
bosnia and herzegovina common cs BOSNA A HERCEGOVINA
@ -637,7 +636,6 @@ html common cs HTML
html link to the current record common cs HTML odkaz na současný záznam
hungary common cs MAĎARSKO
iceland common cs ISLAND
icy-orange theme for ckeditor common cs téma ledový pomeranč pro fckeditor
id common cs ID
iespell not detected. click ok to go to download page. common cs ieSpell nebyl nalezen. Klikněte na OK pro přesun na stránku ke stažení.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common cs pokud je položka zakázaná, je zobrazena prázdná buňka tabulky pro (dočasné) odstranění položky/buňky
@ -918,7 +916,6 @@ numbers common cs čísla
october common cs říjen
of common cs z
off common cs vypnout
office-2013 theme for ckeditor common cs téma Office 2013 pro fckeditor
ok common cs OK
old value common cs Stará hodnota
oman common cs OMÁN

View File

@ -187,7 +187,6 @@ blue moono theme common de Bau Mono Theme
blurtext common de blurText
bold common de Fett
bolivia common de BOLIVIEN
bootstrap theme for ckeditor common de Bootstrap Theme für den Ckeditor
border common de Rand
border-line-thickness for the table-tag common de Randbreite (border) für die Tabelle
bosnia and herzegovina common de BOSNIEN UND HERZEGOVINA
@ -647,7 +646,6 @@ html common de HTML
html link to the current record common de HTML-Link zum aktuellen Eintrag.
hungary common de UNGARN
iceland common de ISLAND
icy-orange theme for ckeditor common de icy-orange Theme für den Ckeditor
id common de ID
iespell not detected. click ok to go to download page. common de ieSpell nicht gefunden. OK klicken um zur Download Seite zu gehen.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common de wenn das Feld deaktiviert ist, wird eine leere Tabellenzelle angezeigt, zum (zeitweisen) Entfernen eines Feldes
@ -933,7 +931,6 @@ numbers common de Nummern
october common de Oktober
of common de von
off common de Keine
office-2013 theme for ckeditor common de Office 2013 Theme für den Ckeditor
ok common de OK
old value common de Alter Wert
oman common de OMAN

View File

@ -192,7 +192,6 @@ blue moono theme common en blue moono theme
blurtext common en blurText
bold common en Bold
bolivia common en BOLIVIA
bootstrap theme for ckeditor common en bootstrap theme for ckeditor
border common en Border
border-line-thickness for the table-tag common en Border line thickness for the table tag
bosnia and herzegovina common en BOSNIA AND HERZEGOVINA
@ -657,7 +656,6 @@ html common en HTML
html link to the current record common en HTML link to the current record
hungary common en HUNGARY
iceland common en ICELAND
icy-orange theme for ckeditor common en icy-orange theme for ckeditor
id common en ID
iespell not detected. click ok to go to download page. common en ieSpell not detected. Click OK to go to download page.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common en If field is disabled an empty table cell is displayed
@ -946,7 +944,6 @@ numlist common en Numlist
october common en October
of common en of
off common en off
office-2013 theme for ckeditor common en office-2013 theme for ckeditor
ok common en OK
old value common en Old Value
oman common en OMAN

View File

@ -187,7 +187,6 @@ blue moono theme common es-es tema moono azul
blurtext common es-es Texto poco claro
bold common es-es Negrita
bolivia common es-es BOLIVIA
bootstrap theme for ckeditor common es-es tema bootstrap para ckeditor
border common es-es Borde
border-line-thickness for the table-tag common es-es Grosor de la línea del borde de la etiqueta de la tabla
bosnia and herzegovina common es-es BOSNIA AND HERZEGOVINA
@ -645,7 +644,6 @@ html common es-es Html
html link to the current record common es-es Enlace HTML al registro actual
hungary common es-es HUNGRÍA
iceland common es-es ISLANDIA
icy-orange theme for ckeditor common es-es tema icy-orange para ckeditor
id common es-es Id
iespell not detected. click ok to go to download page. common es-es No se detectó ieSpell. Pulse Aceptar para ir a la página de descargas.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common es-es Si el campo está desactivado, se muestra la celda de la tabla vacía, para borrar temporalmente un campo o celda.
@ -929,7 +927,6 @@ numbers common es-es números
october common es-es Octubre
of common es-es de
off common es-es apagado
office-2013 theme for ckeditor common es-es tema office-2013 para ckeditor
ok common es-es Aceptar
old value common es-es Valor anterior
oman common es-es OMAN

View File

@ -183,7 +183,6 @@ blue moono theme common fr thème blue moono
blurtext common fr texteFlou
bold common fr Gras
bolivia common fr BOLIVIE
bootstrap theme for ckeditor common fr Thème Bootstrap pour le CKEditor
border common fr Bord
border-line-thickness for the table-tag common fr Epaisseur de la ligne de bord pour le tag de la table eTemplate
bosnia and herzegovina common fr BOSNIE HERZEGOVINE
@ -630,7 +629,6 @@ html common fr Html
html link to the current record common fr Lien HTML vers l'enregistrement courant
hungary common fr HONGRIE
iceland common fr ISLANDE
icy-orange theme for ckeditor common fr thème icy-orange pour ckeditor
id common fr id
iespell not detected. click ok to go to download page. common fr ieSpell non détecté. Cliquez sur Ok pour aller à la page de téléchargement.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common fr Si le champ est désactivé, une cellule de table vide est affiché pour suppression (temporaire) d'un champ/cellule
@ -906,7 +904,6 @@ numbers common fr nombres
october common fr Octobre
of common fr de
off common fr désactivé
office-2013 theme for ckeditor common fr thème office-2013 pour ckeditor
ok common fr OK
old value common fr Ancienne valeur
oman common fr OMAN

View File

@ -185,7 +185,6 @@ blue moono theme common it Tema Blue Moono
blurtext common it blurText
bold common it Grassetto
bolivia common it BOLIVIA
bootstrap theme for ckeditor common it Tema Bootstrap per l'editor ckeditor
border common it Bordo
border-line-thickness for the table-tag common it Spessore linea bordo per table-tag
bosnia and herzegovina common it BOSNIA E HERZEGOVINA
@ -639,7 +638,6 @@ html common it Html
html link to the current record common it Collegamento HTML al record attuale
hungary common it UNGHERIA
iceland common it ISLANDA
icy-orange theme for ckeditor common it Tema Icy Orange per l'editor ckeditor
id common it ID
iespell not detected. click ok to go to download page. common it ieSpell non trovato. Clicca OK per andare alla pagina di download.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common it if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell
@ -922,7 +920,6 @@ numbers common it numeri
october common it Ottobre
of common it di
off common it Spento
office-2013 theme for ckeditor common it Tema office 2013 per l'editor ckeditor
ok common it OK
old value common it Vecchio Valore
oman common it OMAN

View File

@ -190,7 +190,6 @@ blurtext common ja blurText
bold common ja 太字
Bolivia, Plurinational State of common ja ボリビア
Bonaire, Sint Eustatius and Saba common ja ボネール、シント・ユースタティウスおよびサバ
bootstrap theme for ckeditor common ja bootstrap theme for ckeditor
border common ja ボーダー
border-line-thickness for the table-tag common ja テーブル・タグのボーダー線の太さ
bosnia and herzegovina common ja ボスニア・ヘルツェゴビナ
@ -654,7 +653,6 @@ html common ja HTML
html link to the current record common ja このレコードへのHTMLリンク
hungary common ja ハンガリー
iceland common ja アイスランド
icy-orange theme for ckeditor common ja icy-orange theme for ckeditor
id common ja ID
iespell not detected. click ok to go to download page. common ja ieSpell not detected. Click OK to go to download page.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common ja If field is disabled an empty table cell is displayed
@ -940,7 +938,6 @@ numbers common ja numbers
october common ja 10月
of common ja of
off common ja オフ
office-2013 theme for ckeditor common ja office-2013 theme for ckeditor
ok common ja OK
old value common ja 古い値
oman common ja オマーン

View File

@ -182,7 +182,6 @@ blocked, too many attempts common sk Zablokované, príliš veľa pokusov
blue moono theme common sk modrá moono téma
bold common sk Tučné
bolivia common sk BOLÍVIA
bootstrap theme for ckeditor common sk bootstrap téma pre ckeditor
border common sk Hranica
border-line-thickness for the table-tag common sk Hrúbka okrajovej čiary pre tag tabuľky
bosnia and herzegovina common sk BOSNA A HERCEGOVINA
@ -628,7 +627,6 @@ html common sk HTML
html link to the current record common sk HTML odkaz na aktuálny záznam
hungary common sk MAĎARSKO
iceland common sk ISLAND
icy-orange theme for ckeditor common sk icy-orange téma pre ckeditor
id common sk Id
iespell not detected. click ok to go to download page. common sk ieSpell sa nenašiel. Kliknutím na OK sa presuniete na stránku, odkiaľ ho môžete stiahnuť.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common sk Ak je položka vypnutá, zobrazuje sa prázdna bunka tabuľky
@ -901,7 +899,6 @@ numbers common sk čísla
october common sk Október
of common sk z
off common sk Vypnúť
office-2013 theme for ckeditor common sk office-2013 téma pre ckeditor
ok common sk OK
old value common sk Stará hodnota
oman common sk OMÁN

View File

@ -184,7 +184,6 @@ blue moono theme common sl modra mono tema
blurtext common sl Zamaži tekst
bold common sl Krepko
bolivia common sl BOLIVIJA
bootstrap theme for ckeditor common sl zagonska tema za ckeditor
border common sl Rob
border-line-thickness for the table-tag common sl Debelina robov
bosnia and herzegovina common sl BOSNA IN HERCEGOVINA
@ -639,7 +638,6 @@ html common sl HTML
html link to the current record common sl Povezava HTML s trenutnim zapisom
hungary common sl MADŽARSKA
iceland common sl ISLANDIJA
icy-orange theme for ckeditor common sl ledena-oranžna tema za ckeditor
id common sl Šifra
iespell not detected. click ok to go to download page. common sl ieSpell ni bil zaznan. Kliknite V redu za obisk spletne strani za prenos.
if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell common sl Če je polje izključeno, je prikazana prazna celica v tabeli, za začasno odstranitev polja/celice
@ -922,7 +920,6 @@ numbers common sl številke
october common sl Oktober
of common sl od
off common sl off
office-2013 theme for ckeditor common sl office-2013 tema za ckeditor
ok common sl V redu
old value common sl Stara vrednost
oman common sl OMAN

View File

@ -1,89 +0,0 @@
<?php
/**
* EGroupware - eTemplate serverside ckeditor widget
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage etemplate
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-16 by RalfBecker@outdoor-training.de
* @version $Id$
*/
namespace EGroupware\Api\Etemplate\Widget;
use EGroupware\Api\Etemplate;
use EGroupware\Api;
/**
* eTemplate ckeditor widget
*/
class CkEditor extends Etemplate\Widget
{
protected $legacy_options = 'mode,height,width,expand_toolbar,base_href';
public $attrs = array(
'height' => '400px',
);
/**
* Fill config options
*
* @param string $cname
*/
public function beforeSendToClient($cname)
{
$form_name = self::form_name($cname, $this->id);
Api\Framework::includeJS('/vendor/egroupware/ckeditor/ckeditor.js');
Api\Framework::includeJS('/vendor/egroupware/ckeditor/ckeditor.config.js');
Api\Framework::includeJS('/vendor/egroupware/ckeditor/ckeditor.adapters/jquery.js');
$config = Api\Html\CkEditorConfig::get_ckeditor_config_array($this->attrs['mode'], $this->attrs['height'],
$this->attrs['expand_toolbar'],$this->attrs['base_href']
);
// User preferences
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
$font_size = Api\Html\CkEditorConfig::font_size_from_prefs();
$font_span = '<span style="width: 100%; display: inline; '.
($font?'font-family:'.$font.'; ':'').($font_size?'font-size:'.$font_size.'; ':'').
'">&#8203;</span>';
if (empty($font) && empty($font_size)) $font_span = '';
if($font_span)
{
$config['preference_style'] = $font_span;
}
self::$request->modifications[$form_name]['config'] = $config;
}
/**
* Validate input
*
* Input is run throught HTMLpurifier, to make sure users can NOT enter javascript or other nasty stuff (XSS!).
*
* @param string $cname current namespace
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
* @param array $content
* @param array &$validated=array() validated content
* @return boolean true if no validation error, false otherwise
*/
public function validate($cname, array $expand, array $content, &$validated=array())
{
$form_name = self::form_name($cname, $this->id, $expand);
if (!$this->is_readonly($cname, $form_name))
{
$value = self::get_array($content, $form_name);
// only purify for html, mode "ascii" is NO html and content get lost!
if ($this->attrs['mode'] != 'ascii')
{
$value = Api\Html\HtmLawed::purify($value, $this->attrs['validation_rules']);
}
$valid =& self::get_array($validated, $form_name, true);
if (true) $valid = $value;
}
}
}
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\CkEditor', 'ckeditor');

View File

@ -21,6 +21,54 @@ use EGroupware\Api;
*/
class HtmlArea extends Etemplate\Widget
{
/**
* font families
* @var type array
*/
public static $font_options = array(
'arial, helvetica, sans-serif' => 'Arial',
'Comic Sans MS, cursive' => 'Comic Sans MS',
'Courier New, Courier, monospace' => 'Courier New',
'Georgia, serif' => 'Georgia',
'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
'times new roman, times, serif' => 'Times New Roman',
'Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet MS',
'Verdana, Geneva, sans-serif' => 'Verdana'
);
/**
* font size options
* @var type array
*/
public static $font_size_options = array(
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
14 => '14',
16 => '16',
18 => '18',
20 => '20',
22 => '22',
24 => '24',
26 => '26',
28 => '28',
36 => '36',
48 => '48',
72 => '72',
);
/**
* font unit options
* @var type array
*/
public static $font_unit_options = array(
'pt' => 'pt: points (1/72 inch)',
'px' => 'px: display pixels',
);
/**
* Validate input
*

View File

@ -140,7 +140,7 @@ class Vfs extends File
}
/**
* Upload via dragging images into ckeditor/htmlarea(tinymce)
* Upload via dragging images into htmlarea(tinymce)
*/
public static function ajax_htmlarea_upload()
{
@ -485,7 +485,7 @@ class Vfs extends File
++$n;
}
}
foreach($favorites as $favorite)
{
$path = $favorite['state']['path'];

View File

@ -145,9 +145,8 @@ class Bundle
$mod = filemtime(EGW_SERVER_ROOT.$path);
if ($mod > $max_modified) $max_modified = $mod;
// ckeditor of TinyMCE must be included before bundled files, as they depend on it!
if (strpos($path,'/ckeditor/ckeditor.js') !== false ||
strpos($path, '/tinymce/tinymce.min.js') !== false)
// TinyMCE must be included before bundled files, as it depends on it!
if (strpos($path, '/tinymce/tinymce.min.js') !== false)
{
$to_include_first[] = $path . '?' . $mod;
}
@ -234,9 +233,6 @@ class Bundle
$inc_mgr->include_js_file('/api/js/egw_action/egw_menu_dhtmlx.js');
// include choosen in api, as old eTemplate uses it and fail if it pulls in half of et2
$inc_mgr->include_js_file('/api/js/jquery/chosen/chosen.jquery.js');
// include CKEditor in api, as old eTemplate uses it too
//$inc_mgr->include_js_file('/vendor/egroupware/ckeditor/ckeditor.js');
//$inc_mgr->include_js_file('/vendor/egroupware/ckeditor/config.js');
$bundles['api'] = $inc_mgr->get_included_files();
self::urls($bundles['api'], $max_mod['api']);

View File

@ -22,7 +22,7 @@ class ContentSecurityPolicy
/**
* Additional attributes or urls for CSP beside always added "self"
*
* - "script-src 'self' 'unsafe-eval'" allows only self and eval (eg. ckeditor), but forbids inline scripts, onchange, etc
* - "script-src 'self' 'unsafe-eval'" allows only self and eval, but forbids inline scripts, onchange, etc
* - "connect-src 'self'" allows ajax requests only to self
* - "style-src 'self' 'unsafe-inline'" allows only self and inline style, which we need
* - "frame-src 'self' manual.egroupware.org" allows frame and iframe content only for self or manual.egroupware.org

View File

@ -404,9 +404,6 @@ class Html
{
// this one is for testing how it will turn out, if you do not have the device or agent ready at your fingertips
// if (stripos($_SERVER[HTTP_USER_AGENT],'mozilla') !== false) return false;
// CKeditor will doublecheck availability for us, but its fallback does not look nice, and you will get
// no conversion of html content to plain text, so we provide a check for known USER_AGENTS to fail the test
return true;
}
@ -538,7 +535,7 @@ tinymce.init({
_editor.setContent(value);
},
plugins: [
"print fullpage searchreplace autolink directionality "+
"print searchreplace autolink directionality "+
"visualblocks visualchars image link media template "+
"codesample table charmap hr pagebreak nonbreaking anchor toc "+
"insertdatetime advlist lists textcolor wordcount imagetools "+

View File

@ -1,537 +0,0 @@
<?php
/**
* EGroupware - Class which generates JSON encoded configuration for the ckeditor
*
* @link http://www.egroupware.org
* @author RalfBecker-AT-outdoor-training.de
* @author Andreas Stoeckel <as-AT-stylite.de>
* @package api
* @subpackage html
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
namespace EGroupware\Api\Html;
use EGroupware\Api\Header\ContentSecurityPolicy;
/**
* CK-Editor configuration
*/
class CkEditorConfig
{
private static $lang = null;
private static $country = null;
private static $enterMode = null;
private static $skin = null;
// Defaults, defined in /vendor/egroupware/ckeditor/plugins/font/plugin.js
public static $font_options = array(
'arial, helvetica, sans-serif' => 'Arial',
'Comic Sans MS, cursive' => 'Comic Sans MS',
'Courier New, Courier, monospace' => 'Courier New',
'Georgia, serif' => 'Georgia',
'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
'times new roman, times, serif' => 'Times New Roman',
'Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet MS',
'Verdana, Geneva, sans-serif' => 'Verdana'
);
public static $font_size_options = array(
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
14 => '14',
16 => '16',
18 => '18',
20 => '20',
22 => '22',
24 => '24',
26 => '26',
28 => '28',
36 => '36',
48 => '48',
72 => '72',
);
public static $font_unit_options = array(
'pt' => 'pt: points (1/72 inch)',
'px' => 'px: display pixels',
);
/**
* Functions that can be called via menuaction
*
* @var array
*/
var $public_functions = array(
'vfsSelectHelper' => true,
);
/**
* Get available CKEditor Skins
*
* Only return skins existing in filesystem, as we disable / remove them if not compatible with supported browsers.
*
* @return array skin => label pairs alphabetical sorted with default moono first
*/
public static function getAvailableCKEditorSkins()
{
$labels = array(
'kama' => lang('kama theme'),
'moono' => lang('moono theme (default)'),
);
$skins = array();
foreach(scandir(EGW_SERVER_ROOT.'/vendor/egroupware/ckeditor/skins') as $skin)
{
if ($skin[0] == '.') continue;
if (isset($labels[$skin]))
{
$skins[$skin] = $labels[$skin];
}
else
{
$skins[$skin] = str_replace('_', '-', $skin).' '.lang('Theme');
}
}
uasort($skins, 'strcasecmp');
// flat skin is reserved for mobile template, although we are not
// supporting it on desktop (becuase FF has problem with action icons)
if (!\EGroupware\Api\Header\UserAgent::mobile()) unset($skins['flat']);
// return our default "moono" first
return isset($skins['moono']) ? array('moono' => $skins['moono'])+$skins : $skins;
}
/**
* Get font size from preferences
*
* @param array $prefs =null default $GLOBALS['egw_info']['user']['preferences']
* @param string &$size =null on return just size, without unit
* @param string &$unit =null on return just unit
* @return string font-size including unit
*/
public static function font_size_from_prefs(array $prefs=null, &$size=null, &$unit=null)
{
if (is_null($prefs)) $prefs = $GLOBALS['egw_info']['user']['preferences'];
$size = $prefs['common']['rte_font_size'];
$unit = $prefs['common']['rte_font_unit'];
if (substr($size, -2) == 'px')
{
$unit = 'px';
$size = (string)(int)$size;
}
return $size.($size?$unit:'');
}
/**
* Read language and country settings for the ckeditor and store them in static
* variables
*/
private static function read_lang_country()
{
//use the lang and country information to construct a possible lang info for CKEditor UI and scayt_slang
self::$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
self::$country = $GLOBALS['egw_info']['user']['preferences']['common']['country'];
if (!(strpos(self::$lang, '-')===false))
list(self::$lang, self::$country) = explode('-', self::$lang);
}
/**
* Returns the current user language
*/
private static function get_lang()
{
if (self::$lang == null || self::$country == null)
self::read_lang_country();
return self::$lang;
}
/**
* Returns the current user country
*/
private static function get_country()
{
if (self::$lang == null || self::$country == null)
self::read_lang_country();
return strtoupper(self::$country);
}
/**
* Returns the ckeditor basepath
*/
private static function get_base_path()
{
//Get the ckeditor base url
return $GLOBALS['egw_info']['server']['webserver_url'].'/vendor/egroupware/ckeditor/';
}
/**
* Returns the ckeditor enter mode which defaults to "BR"
*/
private static function get_enter_mode()
{
if (self::$enterMode == null)
{
//Get the input name
$enterMode = 2;
if (isset($GLOBALS['egw_info']['user']['preferences']['common']['rte_enter_mode']))
{
switch ($GLOBALS['egw_info']['user']['preferences']['common']['rte_enter_mode'])
{
case 'p':
$enterMode = 1;
break;
case 'br':
$enterMode = 2;
break;
case 'div':
$enterMode = 3;
break;
}
}
self::$enterMode = $enterMode;
}
return self::$enterMode;
}
/**
* Returns the skin the ckeditor should use
*/
private static function get_skin()
{
if (self::$skin == null)
{
//Get the skin name
$skin = $GLOBALS['egw_info']['user']['preferences']['common']['rte_skin'];
//error_log(__METHOD__.__LINE__.' UserAgent:'.EGroupware\Api\Header\UserAgent::type());
//Convert old fckeditor skin names to new ones
switch ($skin)
{
case 'kama':
$skin = "kama";
//if (EGroupware\Api\Header\UserAgent::type()=='firefox' || EGroupware\Api\Header\UserAgent::type()=='msie') $skin='moonocolor';
break;
// no longer supported by egw
case 'flat':
case 'silver':
case 'moono-dark':
case 'icy_orange':
case 'bootstrapck':
case 'Moono_blue':
case 'office2013':
case 'office2003':
case 'moonocolor':
case 'moono':
case 'default':
default:
$skin = "moono";
}
//Check whether the skin actually exists, if not, switch to a default
if (!file_exists(EGW_SERVER_ROOT.'/vendor/egroupware/ckeditor/skins/'.$skin))
{
$skin = "moono"; //this is the basic skin for ckeditor
}
// Skin used for mobile template
self::$skin = \EGroupware\Api\Header\UserAgent::mobile()?'flat':$skin;
}
return self::$skin;
}
/**
* Returns the URL of the filebrowser
*
* @param string $start_path start path for file browser
*/
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', '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 : '');
}
return \EGroupware\Api\Egw::link('/index.php',array(
'menuaction' => 'api.EGroupware\\Api\\Html\\CkEditorConfig.vfsSelectHelper',
'path' => $start_path
));
}
/**
* Adds all "easy to write" options to the configuration
*
* @param array& $config array were config get's added to
* @param int|string $height integer height in pixel or string with css unit
* @param boolean|string $expanded_toolbar show toolbar expanded, boolean value, string "false", or string casted to boolean
* @param string $start_path start path for file browser
*/
private static function add_default_options(&$config, $height, $expanded_toolbar, $start_path)
{
//Convert the pixel height to an integer value
$config['resize_enabled'] = false;
$config['height'] = is_numeric($height) ? (int)$height : $height;
//disable encoding as entities needs to set the config value to false, as the default is true with the current ckeditor version
$config['entities'] = false;
$config['entities_latin'] = false;
$config['editingBlock'] = true;
$config['disableNativeSpellChecker'] = true;
// we set allowedContent to true as the 4.1 contentFiltering system allows only activated features as content
$config['allowedContent'] = true;
$config['removePlugins'] = 'elementspath';
$config['toolbarCanCollapse'] = true;
$config['toolbarStartupExpanded'] = is_bool($expanded_toolbar) ? $expanded_toolbar :
($expanded_toolbar === 'false' ? false : (boolean)$expanded_toolbar);
$config['filebrowserBrowseUrl'] = self::get_filebrowserBrowseUrl($start_path);
$config['filebrowserWindowHeight'] = 640;
$config['filebrowserWindowWidth'] = 580;
$config['language'] = self::get_lang();
$config['enterMode'] = self::get_enter_mode();
$config['skin'] = self::get_skin();
$config['fontSize_sizes'] = '';
$unit = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit'];
if (empty($unit)) $unit = 'px';
foreach(self::$font_size_options as $k => $v)
{
$config['fontSize_sizes'] .= $v.$unit.'/'.$k.$unit.';';
}
}
/**
* Adds the spellchecker configuration to the options and writes the name of
* the spellchecker toolbar button to the "spellchecker_button" parameter
*/
private static function add_spellchecker_options(&$config, &$spellchecker_button, &$scayt_button)
{
//error_log(__METHOD__.__LINE__.' Spellcheck:'.$GLOBALS['egw_info']['server']['enabled_spellcheck']);
// currently we only support browser native spellchecker, and always disable Scayt
$config['disableNativeSpellChecker'] = false;
$config['scayt_autoStartup'] = false;
$spellchecker_button = $scayt_button = null;
/*
if (isset($GLOBALS['egw_info']['server']['enabled_spellcheck']) && $GLOBALS['egw_info']['server']['enabled_spellcheck'])
{
// enable browsers native spellchecker as default, if e.g.: aspell fails
// to use browsers native spellchecker, you have to hold CMD/CTRL button on rightclick to
// access the browsers spell correction options
if ($GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesNoSCAYT') $config['disableNativeSpellChecker'] = false;
if (!empty($GLOBALS['egw_info']['server']['aspell_path']) &&
is_executable($GLOBALS['egw_info']['server']['aspell_path']) &&
($GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesUseWebSpellCheck' &&
$GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesBrowserBased')
)
{
$spellchecker_button = 'SpellCheck';
self::append_extraPlugins_config_array($config, array("aspell"));
}
if ($GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesNoSCAYT' &&
$GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesBrowserBased'
)
{
$scayt_button='Scayt';
$config['scayt_autoStartup'] = true;
$config['scayt_sLang'] = self::get_lang().'_'.self::get_country();
$config['disableNativeSpellChecker'] = true; // only one spell as you type
}
}
else
{
$config['scayt_autoStartup'] = false;
}
*/
}
/**
* Writes the toolbar configuration to the options which depends on the chosen
* mode and the spellchecker_button written by the add_spellchecker_options button
*/
private static function add_toolbar_options(&$config, $mode, $spellchecker_button, $scayt_button=false)
{
$config['toolbar'] = array();
switch ($mode)
{
case 'advanced':
$config['toolbar'][] = array('name' => 'document', 'items' => array('Source','DocProps','-','Preview','-','Templates'));
$config['toolbar'][] = array('name' => 'clipboard', 'items' => array('Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'));
if ($spellchecker_button||$scayt_button)
{
$configArray = array();
if ($spellchecker_button) $configArray[] = $spellchecker_button;
if ($scayt_button) $configArray[] = $scayt_button;
$config['toolbar'][] = array('name' => 'tools', 'items' => $configArray);
}
$config['toolbar'][] = array('name' => 'edit', 'items' => array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'));
$config['toolbar'][] = '/';
$config['toolbar'][] = array('name' => 'basicstyles', 'items' => array('Bold','Italic','Underline','Strike','-','Subscript','Superscript'));
$config['toolbar'][] = array('name' => 'justify', 'items' => array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'));
$config['toolbar'][] = array('name' => 'paragraph', 'items' => array('BulletedList','NumberedList','-','Outdent','Indent'));
$config['toolbar'][] = array('name' => 'links', 'items' => array('Link','Unlink','Anchor'));
$config['toolbar'][] = array('name' => 'insert', 'items' => array('Maximize','Image','Table','HorizontalRule','SpecialChar'/*,'Smiley'*/));
$config['toolbar'][] = '/';
$config['toolbar'][] = array('name' => 'styles', 'items' => array('Style','Format','Font','FontSize'));
$config['toolbar'][] = array('name' => 'colors', 'items' => array('TextColor','BGColor'));
$config['toolbar'][] = array('name' => 'tools', 'items' => array('ShowBlocks','-','About'));
break;
case 'extended': default:
$config['toolbar'][] = array('name' => 'clipboard', 'items' => array('Bold','Italic','Underline'));
$config['toolbar'][] = array('name' => 'justify', 'items' => array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'));
$config['toolbar'][] = array('name' => 'paragraph', 'items' => array('BulletedList','NumberedList'/*,'Smiley'*/,'Outdent','Indent','Undo','Redo'));
$config['toolbar'][] = array('name' => 'clipboard', 'items' => array('Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'));
if ($mode == 'extended')
{
$config['toolbar'][] = array('name' => 'insert', 'items' => array('Image','Link','Unlink','Anchor'));
if ($spellchecker_button||$scayt_button)
{
$configArray = array('Maximize');
if ($spellchecker_button) $configArray[] = $spellchecker_button;
if ($scayt_button) $configArray[] = $scayt_button;
$config['toolbar'][] = array('name' => 'tools', 'items' => $configArray);
}
else
$config['toolbar'][] = array('name' => 'insert', 'items' => array('Maximize'));//, 'Image', 'Table');
$config['toolbar'][count($config['toolbar']) - 1][] = array('name' => 'insert', 'items' => array('Image', 'Table'));
}
else
{
if ($spellchecker_button||$scayt_button)
{
$configArray = array('Maximize');
if ($spellchecker_button) $configArray[] = $spellchecker_button;
if ($scayt_button) $configArray[] = $scayt_button;
$config['toolbar'][] = array('name' => 'tools', 'items' => $configArray);
}
else
$config['toolbar'][] = array('name' => 'tools', 'items' => array('Maximize'));
}
$config['toolbar'][] = '/';
$config['toolbar'][] = array('name' => 'edit', 'items' => array('Find','Replace','-','SelectAll','RemoveFormat'));
if ($mode == 'simple-withimage') $config['toolbar'][] = array('name' => 'links', 'items' => array('Image','Link','Unlink'));
$config['toolbar'][] = array('name' => 'styles', 'items' => array('Format','Font','FontSize'));
$config['toolbar'][] = array('name' => 'colors', 'items' => array('TextColor','BGColor'));
$config['toolbar'][] = array('name' => 'tools', 'items' => array('ShowBlocks','-','About'));
}
}
/**
* @see get_ckeditor_config
*/
public static function get_ckeditor_config_array($mode = '', $height = 400, $expanded_toolbar = true, $start_path = '')
{
// set for CK-Editor necessary CSP script-src attributes
self::set_csp_script_src_attrs();
// If not explicitly set, use preference for toolbar mode
if(!$mode || trim($mode) == '') $mode = $GLOBALS['egw_info']['user']['preferences']['common']['rte_features'];
$config = array();
$spellchecker_button = null;
self::add_default_options($config, $height, $expanded_toolbar, $start_path);
$scayt_button = null;
self::add_spellchecker_options($config, $spellchecker_button, $scayt_button);
self::add_toolbar_options($config, $mode, $spellchecker_button, $scayt_button);
//error_log(__METHOD__."('$mode', $height, ".array2string($expanded_toolbar).") returning ".array2string($config));
// Add extra plugins
self::append_extraPlugins_config_array($config, array('uploadimage','uploadwidget','widget','notification','notificationaggregator','lineutils'));
return $config;
}
/**
* Adds extra
* @param array $config
* @param array $plugins plugins name which needs to be appended into extraPlugins
*/
public static function append_extraPlugins_config_array (&$config, $plugins)
{
if (is_array($plugins))
{
foreach ($plugins as &$plugin)
{
if (!empty($config['extraPlugins']) && $config['extraPlugins'] !== '')
{
$config['extraPlugins'] .= ',' . $plugin;
}
else
{
$config['extraPlugins'] = $plugin;
}
}
}
}
/**
* Returns a json encoded string containing the configuration for the ckeditor.
* @param string $mode specifies the count of toolbar buttons available to the user. Possible
* values are 'simple', 'extended' and 'advanced'. All other values will default to 'simple'
* @param integer $height contains the height of the ckeditor in pixels
* @param boolean $expanded_toolbar specifies whether the ckeditor should start with an expanded toolbar or not
* @param string $start_path specifies
*/
public static function get_ckeditor_config($mode = '', $height = 400, $expanded_toolbar = true, $start_path = '')
{
return json_encode(self::get_ckeditor_config_array($mode, $height, $expanded_toolbar, $start_path));
}
/**
* URL webspellchecker uses for scripts and style-sheets
*/
const WEBSPELLCHECK_HOST = 'svc.webspellchecker.net';
/**
* Set for CK-Editor necessary CSP script-src attributes
*
* Get's called automatic from get_ckeditor_config(_array)
*/
public static function set_csp_script_src_attrs()
{
// tell framework CK Editor needs eval and inline javascript :(
ContentSecurityPolicy::add('script-src', 'unsafe-inline');
}
/**
* 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 ckeditor 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_ckeditor.buildVfsSelectForCKEditor',
array('funcNum' => $_GET['CKEditorFuncNum']));
$response->call('window.close');
$tmp->exec('',array());
}
}

View File

@ -36,7 +36,6 @@
"npm-asset/as-jqplot" : "1.0.*",
"npm-asset/gridster":"0.5.*",
"adldap2/adldap2": "=4.0.4",
"egroupware/ckeditor": "^4",
"egroupware/magicsuggest": "^2.1"
},
"require-dev": {

34
composer.lock generated
View File

@ -321,40 +321,6 @@
"homepage": "http://jquery.com",
"time": "2018-03-04 13:23:48"
},
{
"name": "egroupware/ckeditor",
"version": "v4.9.2",
"source": {
"type": "git",
"url": "https://github.com/EGroupware/ckeditor.git",
"reference": "cd542e5b23f750f074a13228e1c8c783021ebd77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/EGroupware/ckeditor/zipball/cd542e5b23f750f074a13228e1c8c783021ebd77",
"reference": "cd542e5b23f750f074a13228e1c8c783021ebd77",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+",
"LGPL-2.1+",
"MPL-1.1+"
],
"authors": [
{
"name": "CKSource",
"homepage": "http://cksource.com"
}
],
"description": "Compiled version of CKEditor customized for EGroupware project.",
"homepage": "https://github.com/EGroupware/ckeditor",
"time": "2018-05-08 13:42:32"
},
{
"name": "egroupware/magicsuggest",
"version": "2.1.5",

View File

@ -77,14 +77,6 @@ class filemanager_select
if (!is_array($content))
{
$content = array();
// recover from a failed upload in CkEditor, eg. > max_uploadsize
if ($_GET['failed_upload'] && $_GET['msg'])
{
$content['msg'] = $_GET['msg'];
$_GET['mode'] = 'open';
$_GET['method'] = 'ckeditor_return';
$_GET['CKEditorFuncNum'] = Api\Cache::getSession('filemanager','ckeditorfuncnum');
}
$content['mode'] = $_GET['mode'];
if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir')))
{
@ -97,18 +89,6 @@ class filemanager_select
}
$content['name'] = (string)$_GET['name'];
$content['method'] = $_GET['method'];
if ($content['method'] == 'ckeditor_return')
{
if (isset($_GET['CKEditorFuncNum']) && is_numeric($_GET['CKEditorFuncNum']))
{
Api\Cache::setSession('filemanager','ckeditorfuncnum',
$content['ckeditorfuncnum'] = $_GET['CKEditorFuncNum']);
}
else
{
throw new Api\Exception\WrongParameter("chkeditor_return has been specified as a method but some parameters are missing or invalid.");
}
}
$content['id'] = $_GET['id'];
$content['label'] = isset($_GET['label']) ? $_GET['label'] : lang('Open');
if (($content['options-mime'] = isset($_GET['mime'])))
@ -193,31 +173,16 @@ class filemanager_select
break;
}
if ($content['method'] && $content['method'] != 'ckeditor_return')
if ($content['method'] == 'download_url' && !is_array($files))
{
if ($content['method'] == 'download_url' && !is_array($files))
{
$files = Vfs::download_url($files);
if ($files[0] == '/') $files = Egw::link($files);
}
else
{
$js = ExecMethod2($content['method'],$content['id'],$files);
}
}
else if ($content['method'] == 'ckeditor_return')
else
{
$download_url = Vfs::download_url(Vfs::concat($content['path'],$content['name']));
if ($download_url[0] == '/') $download_url = Egw::link($download_url);
$response = Api\Json\Response::get();
$response->apply('window.opener.CKEDITOR.tools.callFunction', array(
$content['ckeditorfuncnum'],
str_replace("'", "\\'", $download_url)
));
Framework::window_close();
exit();
$js = ExecMethod2($content['method'],$content['id'],$files);
}
if(Api\Json\Response::isJSONResponse())
{
$response = Api\Json\Response::get();
@ -345,18 +310,6 @@ class filemanager_select
'options-mime' => $sel_options['mime'],
'old_path' => $content['path'],
);
if (isset($content['ckeditorfuncnum']))
{
$preserve['ckeditorfuncnum'] = $content['ckeditorfuncnum'];
$preserve['ckeditor'] = $content['ckeditor'];
}
// tell framework we need inline javascript for ckeditor_return
if ($content['method'] == 'ckeditor_return')
{
Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline');
}
$tpl->exec('filemanager.filemanager_select.select',$content,$sel_options,$readonlys,$preserve,2);
}

View File

@ -111,9 +111,7 @@ class infolog_hooks
$file = Array(
'Site configuration' => Egw::link('/index.php',array(
'menuaction' => 'infolog.infolog_ui.admin',
// As long as CKEditor needs CSP exceptions, this needs to
// load in an iframe
'ajax' => 'false',
'ajax' => 'true',
)),
'Global Categories' => Egw::link('/index.php',array(
'menuaction' => 'admin.admin_categories.index',

View File

@ -7590,8 +7590,6 @@ form[id^="wiki-"] .dialogHeadbar {
/**************************************/
/*************** SLIDESWITCH **********/
/***************************************/
/*************** CKEDITOR **************/
/***************************************/
}
body .egw_fw_mobile_popup_container {
background: transparent;
@ -8897,20 +8895,6 @@ form[id^="wiki-"] .dialogHeadbar {
width: 100% !important;
height: 100% !important;
}
body .cke_inner .cke_toolbox .cke_toolbox_main {
height: 30px;
white-space: nowrap;
display: inline-block;
overflow-y: hidden;
width: 100%;
}
body .cke_inner .cke_toolbox .cke_toolbox_main .cke_toolbar {
display: inline-block;
float: none;
}
body .cke_inner .cke_toolbox .cke_toolbox_collapser {
height: auto;
}
body .entry_id {
position: absolute;
right: 10px;

View File

@ -1562,28 +1562,6 @@
}
input {width: 100% !important;height:100% !important;}
}
/*************** CKEDITOR **************/
/***************************************/
.cke_inner {
.cke_toolbox {
.cke_toolbox_main {
height: 30px;
white-space: nowrap;
display: inline-block;
overflow-y: hidden;
width: 100%;
.cke_toolbar {
display: inline-block;
float: none;
}
}
.cke_toolbox_collapser {
height: auto;
}
}
}
.entry_id {
position: absolute;
right: 10px;

View File

@ -108,12 +108,12 @@ class preferences_hooks
{
if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
{
Api\Html\CkEditorConfig::font_size_from_prefs($prefs->{$type}, $prefs->{$type}['common']['rte_font_size'],
Api\Etemplate\Widget\HtmlArea::font_size_from_prefs($prefs->{$type}, $prefs->{$type}['common']['rte_font_size'],
$prefs->{$type}['common']['rte_font_unit']);
$prefs->save_repository(false, $type);
}
}
Api\Html\CkEditorConfig::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
Api\Etemplate\Widget\HtmlArea::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'],
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit']);
}
@ -376,7 +376,7 @@ class preferences_hooks
'type' => 'select',
'label' => 'Default font',
'name' => 'rte_font',
'values' => Api\Html\CkEditorConfig::$font_options,
'values' => Api\Etemplate\Widget\HtmlArea::$font_options,
'help' => 'Automatically start with this font',
'xmlrpc' => True,
'admin' => false,
@ -386,7 +386,7 @@ class preferences_hooks
'type' => 'select',
'label' => 'Font size unit',
'name' => 'rte_font_unit',
'values' => array_map('lang', Api\Html\CkEditorConfig::$font_unit_options),
'values' => array_map('lang', Api\Etemplate\Widget\HtmlArea::$font_unit_options),
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.',
'default'=> 'pt',
'xmlrpc' => True,
@ -397,7 +397,7 @@ class preferences_hooks
'type' => 'select',
'label' => 'Default font size',
'name' => 'rte_font_size',
'values' => Api\Html\CkEditorConfig::$font_size_options,
'values' => Api\Etemplate\Widget\HtmlArea::$font_size_options,
'help' => 'Automatically start with this font size',
'xmlrpc' => True,
'admin' => false,

View File

@ -13,7 +13,6 @@ audio effect preferences cs Zvukové efekty
audio effect enables|disables sound effects used in the theme preferences cs Povolí, nebo zakáže použití zvukových efektů použitých v tématu.
automatically start with this font preferences cs Automaticky začínat s tímto typem písma
automatically start with this font size preferences cs Automaticky začínat s touto velikostí písma
bootstrap theme for ckeditor preferences cs Výchozí téma pro FCK Editor
br preferences cs br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences cs Mění uživatelské heslo po zadání starého a nového hesla. Vrací TRUE je-li vše v pořádku, FALSE při chybě.
change password preferences cs Změna hesla

View File

@ -13,7 +13,6 @@ audio effect preferences de Audio Effect
audio effect enables|disables sound effects used in the theme preferences de Audio Effekte (Sound) für das Thema aktivieren|deaktivieren.
automatically start with this font preferences de Startet automatisch mit dieser Schrift
automatically start with this font size preferences de Startet automatisch mit dieser Schriftgröße
bootstrap theme for ckeditor preferences de Bootstrap Schema für den CKEditor
br preferences de br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences de Ändern Sie Ihr Passwort, indem Sie Ihr altes und neues Passwort angeben. Es wird TRUE zurückgegeben für eine erfolgreiche Änderung und FALSE wenn es nicht erfolgreich war.
change password preferences de Passwort ändern

View File

@ -13,7 +13,6 @@ audio effect preferences en Audio effect
audio effect enables|disables sound effects used in the theme preferences en Audio effect enables|disables sound effects used in the theme
automatically start with this font preferences en Automatically start with this font
automatically start with this font size preferences en Automatically start with this font size
bootstrap theme for ckeditor preferences en Bootstrap Theme for CKEditor
br preferences en br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences en Change a user password by passing the old and new passwords. Returns TRUE on success, FALSE on failure.
change password preferences en Change password

View File

@ -13,7 +13,6 @@ audio effect preferences es-es Efecto de audio
audio effect enables|disables sound effects used in the theme preferences es-es El efecto de audio habilita|deshabilita los efectos de sonido usados en el tema
automatically start with this font preferences es-es Comenzar automáticamente con esta tipografía
automatically start with this font size preferences es-es Comenzar automáticamente con este tamaño de tipografía
bootstrap theme for ckeditor preferences es-es Tema Bootstrap para CKEditor
br preferences es-es br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences es-es Cambia la contraseña de un usuario pasando la contraseña anterior y la nueva. Si es correcto, devuelve TRUE, y si no, FALSE.
change password preferences es-es Cambiar contraseña

View File

@ -13,7 +13,6 @@ audio effect preferences fr Effet audio
audio effect enables|disables sound effects used in the theme preferences fr Effets Audio : active|désactive les effets sonores utilisés dans le thème
automatically start with this font preferences fr Démarrer automatiquement avec cette police
automatically start with this font size preferences fr Démarrer automatiquement avec cette taille de police
bootstrap theme for ckeditor preferences fr Thème Bootstrap pour le CKEditor
br preferences fr br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences fr Change un mot de passe en fournissant l'ancien et le nouveau mot de passe. Retourne TRUE en cas de réussite, FALSE en cas d'échec.
change password preferences fr Changer votre mot de passe

View File

@ -13,7 +13,6 @@ audio effect preferences it Avviso sonoro
audio effect enables|disables sound effects used in the theme preferences it L'impostazione dell'effetto sonoro abilita/disabilita i suoni usati nel tema
automatically start with this font preferences it Comincia automaticamente con questo font
automatically start with this font size preferences it Comincia automaticamente con questa dimensione font
bootstrap theme for ckeditor preferences it Tema Bootstrap per l'editor ckeditor
br preferences it br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences it Modifica la password di un utente passando la vecchia e nuova password. Restituisce TRUE se ha successo, FALSE se fallisce.
change password preferences it Cambia password

View File

@ -13,7 +13,6 @@ audio effect preferences ja オーディオ効果
audio effect enables|disables sound effects used in the theme preferences ja テーマで使うオーディオ効果を有効化/無効化します。
automatically start with this font preferences ja このフォントで開始
automatically start with this font size preferences ja このフォント・サイズで開始
bootstrap theme for ckeditor preferences ja Bootstrap Theme for CKEditor
br preferences ja br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences ja 新旧パスワードを設定してパスワードを変更しますTRUE=成功, FALSE=失敗)。
change password preferences ja パスワード変更

View File

@ -13,7 +13,6 @@ audio effect preferences sl Zvočni učinek
audio effect enables|disables sound effects used in the theme preferences sl Zvočni učinek omogoča | onemogoči zvočne učinke, ki se uporabljajo v predlogi
automatically start with this font preferences sl Samodejno zaženite s to pisavo
automatically start with this font size preferences sl Samodejno začnite s to velikostjo pisave
bootstrap theme for ckeditor preferences sl Predloga Bootstrap za CKEditor
br preferences sl br
change a user password by passing the old and new passwords. returns true on success, false on failure. preferences sl Spremeni geslo uporabniku tako, da podate staro in novo geslo. Če se operacija uspešno izvede, vrne TRUE, drugače pa FALSE.
change password preferences sl Spremeni geslo

View File

@ -45,10 +45,6 @@ $exclude = array(
'api/js/jsapi/egw.js',
// TinyMCE is loaded separate before the bundle
'api/js/tinymce/tinymce.min.js',
// ckeditor is loaded on demand only
'vendor/egroupware/ckeditor/ckeditor.js',
'vendor/egroupware/ckeditor/ckeditor.config.js',
'vendor/egroupware/ckeditor/ckeditor.adapters/jquery.js',
);
foreach(Bundle::all() as $name => $files)