Commit 0e1a1978 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Integrated: tinyMCE

Documentation/AdministratorManual/Index.rst: Documentation for TinyMCE integration
AbstractBuildForm.php: Rename 'EditorJQW' to 'Editor' , Integrate 'TinyMCE' as Editor.
formEditor.sql: adjust FormElement.type from 'EditorJQW' to 'Editor'
README.md: update to include latest JS libs
parent 5451626c
......@@ -35,19 +35,22 @@ Bootstrap: include by TypoScript
```script
page.includeCSS {
file1 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css
file2 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css
file3 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css
file4 = typo3conf/ext/qfq/Resources/Public/Css/jqx.darkblue.css
file5 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css
file1 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css
file2 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css
file3 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css
file4 = typo3conf/ext/qfq/Resources/Public/Css/jqx.bootstrap.css
file5 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css
}
page.includeJS {
file1 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.min.js
file2 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js
file3 = typo3conf/ext/qfq/Resources/Public/JavaScript/jqx-all.js
file4 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq-min.js
file1 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.min.js
file2 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js
file3 = typo3conf/ext/qfq/Resources/Public/JavaScript/validator.min.js
file4 = typo3conf/ext/qfq/Resources/Public/JavaScript/jqx-all.js
file4 = typo3conf/ext/qfq/Resources/Public/JavaScript/tinymce.min.js
file5 = typo3conf/ext/qfq/Resources/Public/JavaScript/EventEmitter.min.js
file6 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.min.js
}
```
......
......@@ -41,7 +41,7 @@ Setup
file1 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css
file2 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css
file3 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css
file4 = typo3conf/ext/qfq/Resources/Public/Css/jqx.darkblue.css
file4 = typo3conf/ext/qfq/Resources/Public/Css/jqx.bootstrap.css
file5 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css
}
......@@ -51,8 +51,9 @@ Setup
file2 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js
file3 = typo3conf/ext/qfq/Resources/Public/JavaScript/validator.min.js
file4 = typo3conf/ext/qfq/Resources/Public/JavaScript/jqx-all.js
file4 = typo3conf/ext/qfq/Resources/Public/JavaScript/tinymce.min.js
file5 = typo3conf/ext/qfq/Resources/Public/JavaScript/EventEmitter.min.js
file6 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.debug.js
file6 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.min.js
}
FormEditor
......
......@@ -89,7 +89,7 @@ abstract class AbstractBuildForm {
'gridJQW' => 'GridJQW',
FE_TYPE_EXTRA => 'Extra',
'text' => 'Input',
'editorJQW' => 'EditorJQW',
'editor' => 'Editor',
'time' => 'DateTime',
'note' => 'Note',
'password' => 'Input',
......@@ -111,7 +111,7 @@ abstract class AbstractBuildForm {
'gridJQW' => 'Native',
FE_TYPE_EXTRA => 'Native',
'text' => 'Native',
'editorJQW' => 'Native',
'editor' => 'Native',
'time' => 'Native',
'note' => 'Native',
'password' => 'Native',
......@@ -1988,19 +1988,23 @@ abstract class AbstractBuildForm {
* @return string
* @throws \qfq\UserFormException
*/
public function buildEditorJQW(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
public function buildEditor(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
$this->adjustMaxLength($formElement);
$attribute = Support::doAttribute('name', $htmlFormElementId);
// $attribute .= Support::doAttribute('id', $htmlFormElementId);
$attribute .= Support::doAttribute('class', 'jqw-editor');
// $attribute = Support::doAttribute('name', 'rte');
$attribute .= Support::doAttribute('id', $htmlFormElementId);
$attribute .= Support::doAttribute('class', 'qfq-tinymce');
$attribute .= Support::doAttribute('data-control-name', "$htmlFormElementId");
$attribute .= Support::doAttribute('data-placeholder', $formElement['placeholder']);
// $attribute .= Support::doAttribute('data-value', htmlentities($value), false);
// $attribute .= Support::doAttribute('data-autofocus', $formElement['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement['dynamicUpdate'] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('data-title', $formElement['tooltip']);
$attribute .= Support::doAttribute('data-config', $this->getPrefixedElementsAsJSON(FE_EDITOR_PREFIX, $formElement));
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
......@@ -2011,6 +2015,39 @@ abstract class AbstractBuildForm {
return $element . $this->getHelpBlock();
}
/**
* Searches for '$prefix*' elements in $formElement. Collect all found elements, strip $prefix (=$keyName) and
* returns keys/values JSON encoded.
* Only 'alpha' chars are allowed as keyName.
* Empty $settings are ok.
*
* @param string $prefix
* @param array $formElement
* @return string
* @throws \qfq\UserFormException
*/
private function getPrefixedElementsAsJSON($prefix, array $formElement) {
$settings = array();
// E.g.: $key = editor-plugins
foreach ($formElement as $key => $value) {
if (substr($key, 0, strlen($prefix)) == $prefix) {
$keyName = substr($key, strlen($prefix));
if ($keyName == '' || !ctype_alpha($keyName)) {
throw new UserFormException("Empty '" . $prefix . "*' keyname or invalid characters: '" . $keyName . "'", ERROR_INVALID_EDITOR_PROPERTY_NAME);
}
if ($value != '') {
$settings[$keyName] = $value;
}
}
}
return json_encode($settings);
}
/**
* Build Grid JQW element.
*
......
......@@ -147,6 +147,7 @@ const ERROR_REPORT_FAILED_ACTION = 1062;
const ERROR_MISSING_MESSAGE_FAIL = 1063;
const ERROR_MISSING_TABLE_NAME = 1064;
const ERROR_RECORD_NOT_FOUND = 1065;
const ERROR_INVALID_EDITOR_PROPERTY_NAME = 1066;
// Subrecord
const ERROR_SUBRECORD_MISSING_COLUMN_ID = 1066;
......@@ -459,6 +460,7 @@ const FE_SLAVE_ID = 'slaveId'; // Action; Value or Query to compute id of slave
const FE_SQL_UPDATE = 'sqlUpdate'; // Action: Update Statement for slave record
const FE_SQL_INSERT = 'sqlInsert'; // Action: Insert Statement to create slave record.
const FE_SQL_DELETE = 'sqlDelete'; // Action: Delete Statement to delete unused slave record.
const FE_EDITOR_PREFIX = 'editor-'; // TinyMCE configuration settings.
// FormElement Types
const FE_TYPE_EXTRA = 'extra';
......
......@@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS `FormElement` (
`modeSql` TEXT NOT NULL,
`class` ENUM('native', 'action', 'container') NOT NULL DEFAULT 'native',
`type` ENUM('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text',
'editorJQW', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill',
'editor', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill',
'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad',
'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendmail') NOT NULL DEFAULT 'text',
`subrecordOption` SET('edit', 'delete', 'new') NOT NULL DEFAULT '',
......@@ -208,7 +208,7 @@ VALUES
(2, 'modeSql', 'Mode sql', 'show', 'text', 'all', 'native', 170, '70,2', 255, '', '', '', '', '', '', 100, '', 'no', '', '', '', ''),
(2, 'class', 'Class', 'show', 'select', 'all', 'native', 180, 0, 255, '', '', '{{class:FSRD0:alnumx}}', '', '', '', 100, '', 'yes', '', '', '', ''),
(2, 'type', 'Type', 'show', 'select', 'all', 'native', 190, 0, 255, '', '', '', '', '',
'itemList={{SELECT IF( "{{class:FRD0:alnumx}}"="native","checkbox,date,time,datetime,dateJQW,datetimeJQW,extra,gridJQW,text,editorJQW,note,password,radio,select,subrecord,upload", IF("{{class:FRD0:alnumx}}"="action","beforeLoad,beforeSave,beforeInsert,beforeUpdate,beforeDelete,afterLoad,afterSave,afterInsert,afterUpdate,afterDelete,sendmail", "fieldset,pill") ) }}',
'itemList={{SELECT IF( "{{class:FRD0:alnumx}}"="native","checkbox,date,time,datetime,dateJQW,datetimeJQW,extra,gridJQW,text,editor,note,password,radio,select,subrecord,upload", IF("{{class:FRD0:alnumx}}"="action","beforeLoad,beforeSave,beforeInsert,beforeUpdate,beforeDelete,afterLoad,afterSave,afterInsert,afterUpdate,afterDelete,sendmail", "fieldset,pill") ) }}',
100, '', 'yes', '', '', '', ''),
(2, 'subrecordOption', 'Subrecord Option', 'show', 'checkbox', 'all', 'native', 200, 0, 0, '', '', '', '', '', '', 100, '', 'no', '', '', '',
''),
......
......@@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `FormElement` (
`mode` ENUM('show', 'readonly', 'required', 'lock', 'disabled') NOT NULL DEFAULT 'show',
`modeSql` TEXT NOT NULL,
`class` ENUM('native', 'action', 'container') NOT NULL DEFAULT 'native',
`type` ENUM('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editorJQW', 'time',
`type` ENUM('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'time',
'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill',
'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad',
'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment