Commit 84c59be9 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #7783. ReadOnly mode is now supported for grafic/text.

parent 58770409
Pipeline #1675 passed with stage
in 2 minutes and 24 seconds
......@@ -3268,11 +3268,11 @@ Type: annotate
Annotate image or text. Typically the image or text has been uploaded during a previous step. The annotation will be
saved in *FormElement.name* column of the current record. The uploaded file itself will not be modified. The annotations
can be shown in edit or readonly mode and modified again.
can be shown in edit (and might be modified) or in readonly mode.
Two modes are available:
image
grafic
A simple grafic editor to paint on top of the image (best by a tablet with pen or grafic tablet). The uploaded image
is shown in the background. All drawings are saved as a JSON fabric.js data string. Supported file types:
**png, svg**. PDF files can be easily divided into per page SVG files during upload - see `split-pdf-upload`_
......@@ -3287,11 +3287,11 @@ text
Drawing with fabric.js might produce a lot data. Take care the column type/size is big enough (>=64kB).
Image
"""""
Grafic
""""""
An image, specified by `FormElement.parameter`: imageSource={{pathFileName}}, will be displayed in the background. On
form load, both, the image and an optional already given JSON fabric.js data string, will be displayed. The image is SIP
An image, specified by ``FormElement.parameter.imageSource={{pathFileName}}``, will be displayed in the background. On
form load, both, the image and an optional already given grafical annotations, will be displayed. The image is SIP
protected and will be loaded on demand.
**Form.parameter**
......@@ -3301,9 +3301,9 @@ protected and will be loaded on demand.
+===================+=======================+==================================================================================+
| annotateType | grafic | *grafic|text*. Default is *grafic*. Select mode. |
+-------------------+-----------------------+----------------------------------------------------------------------------------+
| imageSource | {{pathFileName2}} | Background image. E.g. `fileadmin/images/scan.png` |
| imageSource | <path filename> | Background image. E.g. `fileadmin/images/scan.png` |
+-------------------+-----------------------+----------------------------------------------------------------------------------+
| defaultPenColor | <rgb hex value> | Pen default color, after loading the fabric element. Default is '0000FF' (blue). |
| defaultPenColor | <rgb hex value> | Pen default color, after loading the fabric element. Default is '0000FF' (blue). |
+-------------------+----------------------------------------------------------------------------------------------------------+
.. note::
......@@ -3321,7 +3321,7 @@ Code
+====================+=======================+==================================================================================+
| annotateType | text | *grafic|text*. Default is *grafic*. Select mode. |
+--------------------+-----------------------+----------------------------------------------------------------------------------+
| textSource | <fileadmin/code.m> | Text file to annotate. |
| textSource | <path filename> | Text file to annotate. |
+--------------------+-----------------------+----------------------------------------------------------------------------------+
| annotateUserName | <john doe> | Will be shown at annotation line. |
+--------------------+-----------------------+----------------------------------------------------------------------------------+
......
......@@ -3192,7 +3192,7 @@ abstract class AbstractBuildForm {
Support::setIfNotSet($formElement, FE_ANNOTATE_USER_NAME);
Support::setIfNotSet($formElement, FE_ANNOTATE_USER_AVATAR);
$dataHighlight=HelperFile::getFileTypeHighlight($formElement[FE_HIGHLIGHT]??'',$formElement[FE_TEXT_SOURCE] );
$dataHighlight = HelperFile::getFileTypeHighlight($formElement[FE_HIGHLIGHT] ?? '', $formElement[FE_TEXT_SOURCE]);
// <div class="codeCorrection" data-uid='{"uid": 1, "name": "Reginald Commenter", "avatar": "http://www"}' data-file="../javascript/src/CodeCorrection.js" data-target="codeCorrection-output1">
......@@ -3209,11 +3209,12 @@ abstract class AbstractBuildForm {
$attributeDiv .= Support::doAttribute('data-file', $this->fileToSipUrl($formElement[FE_TEXT_SOURCE]));
$attributeDiv .= Support::doAttribute('data-target', $formElement[FE_HTML_ID]);
$attributeDiv .= Support::doAttribute('data-highlight', $dataHighlight);
$attributeDiv .= Support::doAttribute('data-view-only', 'true');
$attributeDiv .= $this->getAttributeFeMode($formElement[FE_MODE]);
$htmlAnnotate = Support::wrapTag('<div ' . $attributeDiv . ' data-uid=\''. $jsonDataUid . '\' >', '', false);
if ($formElement[FE_MODE] == FE_MODE_READONLY) {
$attributeDiv .= Support::doAttribute('data-view-only', 'true');
}
$htmlAnnotate = Support::wrapTag('<div ' . $attributeDiv . ' data-uid=\'' . $jsonDataUid . '\' >', '', false);
// $htmlAnnotate = Support::wrapTag('<div ' . $attributeDiv .'>', '', false);
$attributeInput = Support::doAttribute('id', $formElement[FE_HTML_ID]);
......@@ -3274,6 +3275,9 @@ abstract class AbstractBuildForm {
$attributeFabric .= Support::doAttribute('data-emojis', 'typo3conf/ext/qfq/Resources/Public/Json/qfq.emoji.json');
$attributeFabric .= Support::doAttribute('data-fabric-color', HelperFormElement::penColorToHex($formElement));
$attributeFabric .= $this->getAttributeFeMode($formElement[FE_MODE]);
if ($formElement[FE_MODE] == FE_MODE_READONLY) {
$attributeFabric .= Support::doAttribute('data-view-only', 'true');
}
$htmlFabric = Support::wrapTag('<div ' . $attributeFabric . ' >', '', false);
$attributeInput = Support::doAttribute('id', $formElement[FE_HTML_ID]);
......@@ -3304,8 +3308,7 @@ abstract class AbstractBuildForm {
* @throws CodeException
* @throws UserFormException
*/
public
function buildImageCut(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildImageCut(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$htmlImage = '';
if ($mode == FORM_LOAD && !empty($formElement[FE_IMAGE_SOURCE])) {
......@@ -3343,6 +3346,7 @@ abstract class AbstractBuildForm {
}
$attributeFabric .= Support::doAttribute('data-image-output', $htmlFabricImageId);
$attributeFabric .= $this->getAttributeFeMode($formElement[FE_MODE]);
$htmlFabric = Support::wrapTag('<div ' . $attributeFabric . ' >', '', false);
// <input id="fabric-output" name="fabric-data" type="hidden">
......@@ -3375,8 +3379,7 @@ abstract class AbstractBuildForm {
* @throws CodeException
* @throws UserFormException
*/
private
function fileToSipUrl($pathFileName) {
private function fileToSipUrl($pathFileName) {
$param[DOWNLOAD_MODE] = DOWNLOAD_MODE_FILE;
$param[SIP_DOWNLOAD_PARAMETER] = base64_encode(TOKEN_FILE . PARAM_TOKEN_DELIMITER . $pathFileName);
......@@ -3402,8 +3405,7 @@ abstract class AbstractBuildForm {
* @throws UserFormException
* @throws UserReportException
*/
public
function buildDateTime(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildDateTime(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
$placeholder = '';
......@@ -3525,8 +3527,7 @@ abstract class AbstractBuildForm {
* @throws CodeException
* @throws UserFormException
*/
public
function buildDateJQW(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildDateJQW(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$arrMinMax = null;
// if ($formElement[FE_PLACEHOLDER] == '') {
......@@ -3611,8 +3612,7 @@ abstract class AbstractBuildForm {
* @throws UserFormException
* @throws UserReportException
*/
public
function buildEditor(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildEditor(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
//TODO plugin autoresize nutzen um Editorgroesse anzugeben
......@@ -3655,8 +3655,7 @@ abstract class AbstractBuildForm {
*
* @return array
*/
private
function setEditorConfig(array $formElement, $htmlFormElementName) {
private function setEditorConfig(array $formElement, $htmlFormElementName) {
$flagMaxHeight = false;
// plugins
......@@ -3711,8 +3710,7 @@ abstract class AbstractBuildForm {
* @return string
* @throws \qfq\UserFormException
*/
private
function getPrefixedElementsAsJSON($prefix, array $formElement) {
private function getPrefixedElementsAsJSON($prefix, array $formElement) {
$settings = array();
// E.g.: $key = editor-plugins
......@@ -3749,8 +3747,7 @@ abstract class AbstractBuildForm {
*
* @throws UserFormException
*/
public
function buildGridJQW(array $formElement, $htmlFormElementName, $value, $fake, $mode = FORM_LOAD) {
public function buildGridJQW(array $formElement, $htmlFormElementName, $value, $fake, $mode = FORM_LOAD) {
// TODO: implement
throw new UserFormException("Not implemented yet: buildGridJQW()", ERROR_NOT_IMPLEMENTED);
}
......@@ -3768,8 +3765,7 @@ abstract class AbstractBuildForm {
* @throws CodeException
* @throws UserFormException
*/
public
function buildNote(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildNote(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement);
......@@ -3789,8 +3785,7 @@ abstract class AbstractBuildForm {
*
* @return mixed
*/
public
function buildPill(array $formElement, $htmlFormElementName, $value, array &$json) {
public function buildPill(array $formElement, $htmlFormElementName, $value, array &$json) {
return $value;
}
......@@ -3813,8 +3808,7 @@ abstract class AbstractBuildForm {
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public
function buildFieldset(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildFieldset(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
// save parent processed FE's
......@@ -3859,8 +3853,7 @@ abstract class AbstractBuildForm {
*
* @return array
*/
private
function fillFeSpecNativeCheckboxWithTgMax(array $formElementArr, $tgMaxCopies) {
private function fillFeSpecNativeCheckboxWithTgMax(array $formElementArr, $tgMaxCopies) {
foreach ($formElementArr as $key => $formElement) {
if ($formElement[FE_TYPE] == FE_TYPE_CHECKBOX) {
......@@ -3891,8 +3884,7 @@ abstract class AbstractBuildForm {
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public
function buildTemplateGroup(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
public function buildTemplateGroup(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$attribute = '';
$html = '';
......@@ -4015,8 +4007,7 @@ EOT;
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private
function templateGroupCollectFilledElements($max, $htmlDelete, array &$json) {
private function templateGroupCollectFilledElements($max, $htmlDelete, array &$json) {
$record = $this->store->getStore(STORE_RECORD); // current values
if ($record === false || count($record) === 0) {
......@@ -4102,8 +4093,7 @@ EOT;
* @throws UserFormException
* @throws UserReportException
*/
private
function templateGroupDoValue() {
private function templateGroupDoValue() {
// Fire 'value' statement
$tgMax = 0;
......
Supports Markdown
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