diff --git a/doc/NewVersion.md b/doc/NewVersion.md index 5529c1b4459c96cbff674ce5d0b2cbea2b7f4c38..12207fd70cc4823df5d12a473d84239b19ecef6f 100644 --- a/doc/NewVersion.md +++ b/doc/NewVersion.md @@ -10,7 +10,7 @@ Neue Versionsnummer 2) Im Projectverzeichnis: make t3sphinx (nicht sicher ob das noetig ist) -3) Neuen Tag vergeben: git tag v0.4 +3) Neuen Tag vergeben: git tag v0.5 4) Alle Files, inkl. Tags, in GIT einchecken. diff --git a/extension/Documentation/Settings.yml b/extension/Documentation/Settings.yml index 442b1b9d8eb5b31fae8c61300529f639b7c63ae9..8d6f6a839a8430c75424a81867d659546936779c 100644 --- a/extension/Documentation/Settings.yml +++ b/extension/Documentation/Settings.yml @@ -6,8 +6,8 @@ conf.py: copyright: 2016 project: QFQ Extension - version: 0.4 - release: 0.4.0 + version: 0.5 + release: 0.5.0 latex_documents: - - Index - qfq.tex diff --git a/extension/Documentation/UsersManual/Index.rst b/extension/Documentation/UsersManual/Index.rst index 6fb162d8bb0d973a5408e5590e98700482fb8ead..32d6b4a8da4895a74e7298b3d5d30d1af66e9607 100644 --- a/extension/Documentation/UsersManual/Index.rst +++ b/extension/Documentation/UsersManual/Index.rst @@ -609,8 +609,8 @@ Class: Native |class | enum('native', 'action', | Details below. | | | 'container') | | +---------------+-----------------------------+---------------------------------------------------------------------------------------------------+ -|type | enum('checkbox', 'date', 'time', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'note', 'password', | -| | 'radio', 'select', 'subrecord', 'textarea', 'timeJQW', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave', | +|type | enum('checkbox', 'date', 'time', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'note', | +| | 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave', | | | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', | | | 'sendmail') | +---------------+-----------------------------+---------------------------------------------------------------------------------------------------+ @@ -666,85 +666,83 @@ Class: Native +---------------+-----------------------------+---------------------------------------------------------------------------------------------------+ -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| Attribute | checkbox | dateJQW | datetimeJQW | gridJQW | extra | input | note | password | radio | select | subrecord | textarea | timeJQW | upload | -+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+==========+=========+========+ -|id |Internal id | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|formId |Form | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|containerId |Assign the Formelement to user defined fieldSet or pill | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|enabled |Formelement is active or not | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|name |Name of a column of the primary table. Formelements with a corresponding table will be saved automatically. | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|label |Label shown to the user. | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|mode |show, readonly, required, lock, disable. | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|class |native | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|type | checkbox | dateJQW | datetimeJQW | gridJQW | extra | input | note | password | radio | select | subrecord | textarea | timeJQW | upload | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|checkType | | - | - | | | - | | - | | | | - | - | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|checkPattern | | - | - | | | - | | - | | | | - | - | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|onChange | - | - | - | | | - | | - | - | - | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|ord | - | - | - | - | - | - | - | - | - | - | - | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|tabindex | - | - | - | - | - | - | - | - | - | - | - | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|size | - | | | | | - | | - | - | - 2 | | - 1 | - | - ? | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|maxLength | 1 | | | | | - | | - | - 1 | | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|note | - | - | - | | | - | - | - | - | - | - | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|tooltip | - | - | - | | | - | | - | - | - | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|placeholder | | - | - | | | - | | | | | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|clientJs | | - | - | - | | - | | - | - | - | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|value | - | - | - | - | - | - | - | - | - | - | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|sql1 |? | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|sql2 |? | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -|Additional attributes in Field 'parameter'. Typically in key=value format. | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| type | checkbox | dateJQW | datetimeJQW | gridJQW | extra | input | note | password | radio | select | subrecord | textarea | timeJQW | upload | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| accept |? | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| alt |? | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| autocomplete | | - | - | | | - | | | | | | - | - | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| autofocus | - | - | - | | | - | | - | - | - | | - | - | - | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| checkBoxMode | - | - | | | | | | | | | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| checked | - | | | | | - | | | - | | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| unchecked | - | | | | | - | | | - | | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| label2 | - | | | | | | | | - | | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| itemList | - | | | | | | | | - | - | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| emptyItemAtStart | | | | | | | | | | - | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| emptyItemAtEnd | | | | | | | | | | - | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| emptyHide | | | | | | | | | | - | | | | | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ -| accept | | | | | | | | | | | | | | - 3 | -+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| Attribute | checkbox | dateJQW | datetimeJQW | gridJQW | extra | text | note | password | radio | select | subrecord | timeJQW | upload | editor | ++==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+=========+========+========+ +|id |Internal id | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|formId |Form | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|containerId |Assign the Formelement to user defined fieldSet or pill | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|enabled |Formelement is active or not | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|name |Name of a column of the primary table. Formelements with a corresponding table will be saved automatically. | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|label |Label shown to the user. | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|mode |show, readonly, required, lock, disable. | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|class |native | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|type | checkbox | dateJQW | datetimeJQW | gridJQW | extra | text | note | password | radio | select | subrecord | timeJQW | upload | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|checkType | | - | - | | | - | | - | | | | - | | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|checkPattern | | - | - | | | - | | - | | | | - | | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|onChange | - | - | - | | | - | | - | - | - | | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|ord | - | - | - | - | - | - | - | - | - | - | - | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|tabindex | - | - | - | - | - | - | - | - | - | - | - | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|size | - | | | | | - | | - | - | - 2 | | - | - ? | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|maxLength | 1 | | | | | - | | - | - 1 | | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|note | - | - | - | | | - | - | - | - | - | - | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|tooltip | - | - | - | | | - | | - | - | - | | - | - | ? | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|placeholder | | - | - | | | - | | | | | | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|clientJs | | - | - | - | | - | | - | - | - | | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|value | - | - | - | - | - | - | - | - | - | - | | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|sql1 |? | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +|Additional attributes in Field 'parameter'. Typically in key=value format. | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| type | checkbox | dateJQW | datetimeJQW | gridJQW | extra | text | note | password | radio | select | subrecord | timeJQW | upload | editor | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| accept |? | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| alt |? | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| autocomplete | | - | - | | | - | | | | | | - | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| autofocus | - | - | - | | | - | | - | - | - | | - | - | - | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| checkBoxMode | - | - | | | | | | | | | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| checked | - | | | | | - | | | - | | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| unchecked | - | | | | | - | | | - | | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| label2 | - | | | | | | | | - | | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| itemList | - | | | | | | | | - | - | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| emptyItemAtStart | | | | | | | | | | - | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| emptyItemAtEnd | | | | | | | | | | - | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| emptyHide | | | | | | | | | | - | | | | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ +| accept | | | | | | | | | | | | | - 3 | | ++------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+ * 1: A line break created every <size> elements. Easy way to make checkboxes or radio vertical instead of horizontal. * 2: Any number >1 makes the 'select' input 'multiple' ready. @@ -798,27 +796,27 @@ Checkboxes can be rendered in mode: Type: date ^^^^^^^^^^ - * Range datetime: '1000-01-01' to '9999-12-31' or '0000-00-00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html) - * Optional: - * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy +* Range datetime: '1000-01-01' to '9999-12-31' or '0000-00-00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html) +* Optional: + * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy Type: datetime ^^^^^^^^^^^^^^ - * Range datetime: '1000-01-01 00:00:00' to '9999-12-31 23:59:59' or '0000-00-00 00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html) - * Optional: - * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy - * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'. - * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '0000-00-00 00:00:00' is displayed. +* Range datetime: '1000-01-01 00:00:00' to '9999-12-31 23:59:59' or '0000-00-00 00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html) +* Optional: + * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy + * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'. + * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '0000-00-00 00:00:00' is displayed. Type: extra ^^^^^^^^^^^ - * Element is not shown in the browser. - * The element can be used to define / precalculate values for a column, which do not already exist as a native FormElement. - * The element is build /computed on form load. +* Element is not shown in the browser. +* The element can be used to define / precalculate values for a column, which do not already exist as a native FormElement. +* The element is build /computed on form load. -Type: input -^^^^^^^^^^^ +Type: text +^^^^^^^^^^ * General input for text and number. * size: @@ -826,6 +824,32 @@ Type: input * <number>: width of input element in characters. Lineheight = 1. * <cols>,<rows>: input element = textarea, width=<cols>, height=<rows> +Type: editor +^^^^^^^^^^^^ + +* TinyMCE (https://www.tinymce.com, community edition) is used as the QFQ Rich Text Editor. +* The content will be saved as HTML inside the database. +* All configuration and plugins will be configured via the 'parameter' field. Just prepend the word 'editor-' in front + of each TinyMCE keyword. Check possible options under https://www.tinymce.com/docs/configure/, + https://www.tinymce.com/docs/plugins/, https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols +* Bars: + + * Top: *menubar* - by default hidden. + * Top: *toolbar* - by default visible. + * Bottom: *statusbar* - by default hidden, exception: *min_height* and *max_height* are given via size parameter. + + +* The default setting is:: + + editor-plugins=code link searchreplace table textcolor textpattern visualchars + editor-toolbar=code searchreplace undo redo | styleselect link table | fontselect fontsizeselect | bullist numlist outdent indent | forecolor backcolor bold italic editor-menubar=false + editor-statusbar=false + +* size: + + * <min_height>,<max_height>: in pixels, including top and bottom bars. E.g.: 300,600 + + Type: note ^^^^^^^^^^ diff --git a/extension/Documentation/_make/conf.py b/extension/Documentation/_make/conf.py index da0af04f0b0c2354ee5f743c38363f9c81db1229..bfd2f683279a68ab8a4635f3ca1974c40991e472 100644 --- a/extension/Documentation/_make/conf.py +++ b/extension/Documentation/_make/conf.py @@ -57,9 +57,9 @@ copyright = u'2016, Carsten Rose' # built documents. # # The short X.Y version. -version = '0.4' +version = '0.5' # The full version, including alpha/beta/rc tags. -release = '0.4.0' +release = '0.5.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/extension/ext_emconf.php b/extension/ext_emconf.php index 256d011a483c29d1d43863183986afb21b416836..8ae832fa2ccac1b97d2dabcec0cbdf9ecfb09a31 100644 --- a/extension/ext_emconf.php +++ b/extension/ext_emconf.php @@ -10,5 +10,5 @@ $EM_CONF[$_EXTKEY] = array( 'dependencies' => 'fluid,extbase', 'clearcacheonload' => true, 'state' => 'alpha', - 'version' => '0.4' + 'version' => '0.5' ); \ No newline at end of file diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php index d8834c18661ac06b235b243d3cc40e33cbc04136..a909769ef85372efbc12bc94955b9f9ac1d81c26 100644 --- a/extension/qfq/qfq/AbstractBuildForm.php +++ b/extension/qfq/qfq/AbstractBuildForm.php @@ -1980,6 +1980,9 @@ abstract class AbstractBuildForm { } /** + * Build a HTML 'textarea' element which becomes a TinyMCE Editor. + * List of possible plugins: https://www.tinymce.com/docs/plugins/ + * * @param array $formElement * @param $htmlFormElementId * @param $value @@ -1990,20 +1993,25 @@ abstract class AbstractBuildForm { */ public function buildEditor(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) { + //TODO plugin autoresize nutzen um Editorgroesse anzugeben + $this->adjustMaxLength($formElement); $attribute = Support::doAttribute('name', $htmlFormElementId); -// $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)); + + $formElement = $this->setEditorConfig($formElement, $htmlFormElementId); + // $formElement['editor-plugins']='autoresize code' + // $formElement['editor-contextmenu']='link image | cell row column' + $json = $this->getPrefixedElementsAsJSON(FE_EDITOR_PREFIX, $formElement); + $attribute .= Support::doAttribute('data-config', $json, true, ESCAPE_WITH_HTML_QUOTE); $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]); @@ -2015,6 +2023,54 @@ abstract class AbstractBuildForm { return $element . $this->getHelpBlock(); } + /** + * @param array $formElement + * @param $htmlFormElementId + * @return array + */ + private function setEditorConfig(array $formElement, $htmlFormElementId) { + $flagMaxHeight = false; + + // plugins + if (!isset($formElement[FE_EDITOR_PREFIX . 'plugins'])) { + $formElement[FE_EDITOR_PREFIX . 'plugins'] = 'code link searchreplace table textcolor textpattern visualchars'; + } + + // toolbar: https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols + if (!isset($formElement[FE_EDITOR_PREFIX . 'toolbar'])) { + $formElement[FE_EDITOR_PREFIX . 'toolbar'] = 'code searchreplace undo redo | ' . + 'styleselect link table | fontselect fontsizeselect | ' . + 'bullist numlist outdent indent | forecolor backcolor bold italic'; + } + + // menubar + if (!isset($formElement[FE_EDITOR_PREFIX . 'menubar'])) { + $formElement[FE_EDITOR_PREFIX . 'menubar'] = 'false'; + } + + // autofocus + if (isset($formElement['autofocus']) && $formElement['autofocus'] == 'yes') { + $formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementId; + } + + // Check for min_height, max_height + $minMax = explode(',', $formElement['size'], 2); + if (isset($minMax[0]) && ctype_digit($minMax[0]) && !isset($formElement[FE_EDITOR_PREFIX . 'min_height'])) { + $formElement[FE_EDITOR_PREFIX . 'min_height'] = $minMax[0]; + } + if (isset($minMax[1]) && ctype_digit($minMax[1]) && !isset($formElement[FE_EDITOR_PREFIX . 'max_height'])) { + $formElement[FE_EDITOR_PREFIX . 'max_height'] = $minMax[1]; + $flagMaxHeight = true; + } + + // statusbar: disable if not user defined and if no max_height is given. + if (!$flagMaxHeight && !isset($formElement[FE_EDITOR_PREFIX . 'statusbar'])) { + $formElement[FE_EDITOR_PREFIX . 'statusbar'] = 'false'; + } + + return $formElement; + } + /** * Searches for '$prefix*' elements in $formElement. Collect all found elements, strip $prefix (=$keyName) and * returns keys/values JSON encoded. @@ -2035,11 +2091,15 @@ abstract class AbstractBuildForm { $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 ($keyName == '') { + throw new UserFormException("Empty '" . $prefix . "*' keyname: '" . $keyName . "'", ERROR_INVALID_EDITOR_PROPERTY_NAME); } - if ($value != '') { + // $value might be boolean false, which should be used! Do not compare with ''. + if (isset($value)) { + // real boolean are important for TinyMCE config 'statusbar', 'menubar', ... + if ($value === 'false') $value = false; + if ($value === 'true') $value = true; $settings[$keyName] = $value; } } diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 97f9f9071a2aa231aba87830d0e5958d8a9e462a..1e3fb96cd55cd94d238097d1854330370f35424b 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -149,6 +149,8 @@ const ERROR_MISSING_TABLE_NAME = 1064; const ERROR_MISSING_TABLE = 1065; const ERROR_RECORD_NOT_FOUND = 1066; const ERROR_INVALID_EDITOR_PROPERTY_NAME = 1067; +const ERROR_UNKNOWN_ESCAPE_MODE = 1068; + // Subrecord const ERROR_SUBRECORD_MISSING_COLUMN_ID = 1100; @@ -481,6 +483,8 @@ const ACTION_KEYWORD_SLAVE_ID = 'slaveId'; // SUPPORT const PARAM_T3_ALL = 't3 all'; const PARAM_T3_NO_ID = "t3 no id"; +const ESCAPE_WITH_BACKSLASH = 'backslash'; +const ESCAPE_WITH_HTML_QUOTE = 'htmlquote'; // AbstractBuildForm const FLAG_ALL = 'flagAll'; diff --git a/extension/qfq/qfq/helper/Support.php b/extension/qfq/qfq/helper/Support.php index 407b3910ca82b16d352626d73b49b82c6903592a..e37cc6bbed0fa5b3ce494d85005c9b1120845565 100644 --- a/extension/qfq/qfq/helper/Support.php +++ b/extension/qfq/qfq/helper/Support.php @@ -92,7 +92,7 @@ class Support { * @param bool $flagOmitEmpty * @return string */ - public static function doAttribute($type, $value, $flagOmitEmpty = true) { + public static function doAttribute($type, $value, $flagOmitEmpty = true, $modeEscape = ESCAPE_WITH_BACKSLASH) { if ($flagOmitEmpty && $value === "") { return ''; } @@ -114,23 +114,39 @@ class Support { break; } - $value = self::escapeDoubleTick(trim($value)); + $value = self::escapeDoubleTick(trim($value), $modeEscape); + return $type . '="' . $value . '" '; + } /** * Escapes Double Ticks ("), which are not already escaped. + * modeEscape: ESCAPE_WITH_BACKSLASH | ESCAPE_WITH_HTML_QUOTE + * + * TinyMCE: Encoding JS Attributes (keys & values) for TinyMCE needs to be encapsulated in '"' instead of '\"'. * * @param $str + * @param string $modeEscape * @return string + * @throws CodeException */ - public static function escapeDoubleTick($str) { + public static function escapeDoubleTick($str, $modeEscape = ESCAPE_WITH_BACKSLASH) { $newStr = ''; for ($ii = 0; $ii < strlen($str); $ii++) { if ($str[$ii] === '"') { if ($ii === 0 || $str[$ii - 1] != '\\') { - $newStr .= '\\'; + switch ($modeEscape) { + case ESCAPE_WITH_BACKSLASH: + $newStr .= '\\'; + break; + case ESCAPE_WITH_HTML_QUOTE: + $newStr .= '"'; + continue 2; + default: + throw new CodeException('Unknown modeEscape=' . $modeEscape, ERROR_UNKNOWN_ESCAPE_MODE); + } } } $newStr .= $str[$ii]; diff --git a/extension/qfq/qfq/report/Report.php b/extension/qfq/qfq/report/Report.php index b8e5ad08cf493468925a9cff28bb80edef1338cf..48891401fc601ac852470091bb75a57908a1c4d6 100644 --- a/extension/qfq/qfq/report/Report.php +++ b/extension/qfq/qfq/report/Report.php @@ -112,6 +112,8 @@ class Report { $this->sip = new Sip($phpUnit); if ($phpUnit) { $this->sip->sipUniqId('badcaffee1234'); + //TODO Webserver Umgebung besser faken + $_SERVER['REQUEST_URI'] = 'localhost'; } $this->link = new Link($this->sip, $phpUnit); diff --git a/extension/qfq/tests/phpunit/DeleteTest.php b/extension/qfq/tests/phpunit/DeleteTest.php index 2e1cff860c15203c5a6aa96f4b91389358a77c22..89b6b0d5dc3f793b74e1ad6203276ddb2b95b488 100644 --- a/extension/qfq/tests/phpunit/DeleteTest.php +++ b/extension/qfq/tests/phpunit/DeleteTest.php @@ -90,7 +90,7 @@ class DeleteTest extends \AbstractDatabaseTest { $this->assertEquals(false, $rc); - $expect = ['content' => "Record 100 not found in table 'Person'.", 'errorCode' => 1065]; + $expect = ['content' => "Record 100 not found in table 'Person'.", 'errorCode' => 1066]; $this->assertEquals($expect, $msg); } diff --git a/extension/qfq/tests/phpunit/StoreTest.php b/extension/qfq/tests/phpunit/StoreTest.php index fa58bb752406c146a4e2bf72643fb5ed35a20dac..279283535ba216f928bbb1d3796e0939c5a60800 100644 --- a/extension/qfq/tests/phpunit/StoreTest.php +++ b/extension/qfq/tests/phpunit/StoreTest.php @@ -66,6 +66,9 @@ class StoreTest extends \PHPUnit_Framework_TestCase { public function testSetVarStoreSystem() { + // set new Sessionname + $this->store->setVar(SYSTEM_SQL_LOG_MODE, "all", STORE_SYSTEM); + // Sessionname: default value $this->assertEquals('all', $this->store->getVar(SYSTEM_SQL_LOG_MODE, STORE_SYSTEM), "System: SQL_LOG"); diff --git a/mockup/richtexteditor.html b/mockup/richtexteditor.html index 8acb8ee744e4b6a5dbfe38b0f1479fb25a3c9e3b..1c08c978b33a19580cfa96ee4bec97a324994bee 100644 --- a/mockup/richtexteditor.html +++ b/mockup/richtexteditor.html @@ -68,16 +68,29 @@ <div class="form-group"> <div class="col-md-2"> - <label for="text:2" class="control-label">Rich Text Editor (plugins, autofocus)</label> + <label for="text:2" class="control-label">Rich Text Editor (plugins, autofocus, no statusbar)</label> </div> <div class="col-md-6"> <textarea id="text:2" class="qfq-tinymce" name="rte" - data-config="{ "plugins": "advlist autolink link image lists charmap print preview", "auto_focus": "text:2"}">Input + data-config="{ "plugins": "advlist autolink link image lists charmap print preview", "auto_focus": "text:2", "statusbar": false }">Input </textarea> </div> </div> + <div class="form-group"> + <div class="col-md-2"> + <label for="text:3" class="control-label">Rich Text Editor (min_height, max_height)</label> + </div> + + <div class="col-md-6"> + <textarea id="text:3" class="qfq-tinymce" name="rte" + data-config="{ "min_height": "200", "max_height": "400" }">Input + </textarea> + </div> + + </div> + <button type="submit">Do</button> </form>