Commit 8a328ce6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Manual.rst: fixed typo

parent 3e5f7825
Pipeline #1434 passed with stage
in 1 minute and 59 seconds
......@@ -3125,6 +3125,92 @@ abstract class AbstractBuildForm {
return $htmlTextDelete . $htmlInputFile . $hiddenSipUpload . $formElement[FE_TMP_EXTRA_BUTTON_HTML] . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
/**
* @param array $formElement
* @param $htmlFormElementName
* @param $value
* @param array $json
* @param string $mode
* @return string
* @throws CodeException
* @throws UserFormException
*/
public function buildAnnotate(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
switch ($formElement[FE_ANNOTATE_TYPE] ?? FE_ANNOTATE_TYPE_GRAPHIC) {
case FE_ANNOTATE_TYPE_GRAPHIC:
$html = $this->buildAnnotateGraphic($formElement, $htmlFormElementName, $value, $json, $mode);
break;
case FE_ANNOTATE_TYPE_CODE:
$html = $this->buildAnnotateCode($formElement, $htmlFormElementName, $value, $json, $mode);
break;
default:
throw new UserFormException("Unkown " . FE_ANNOTATE_TYPE . "type: '" . $formElement[FE_ANNOTATE_TYPE] . "'", ERROR_UNKNOWN_MODE);
}
return $html;
}
/**
* @param array $formElement
* @param $htmlFormElementName
* @param $value
* @param array $json
* @param string $mode
* @return string
* @throws CodeException
* @throws UserFormException
*/
private function buildAnnotateCode(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
//TODO: implement code annotation if there i s no file, but text, save in a specific column
if ($mode == FORM_LOAD && !empty($formElement[FE_IMAGE_SOURCE])) {
if (!is_readable($formElement[FE_IMAGE_SOURCE])) {
throw new UserFormException("Error reading file: " . $formElement[FE_IMAGE_SOURCE], ERROR_IO_READ_FILE);
}
}
if (!empty($value) && json_decode($value) === null) {
throw new UserFormException("Annotate data: JSON structure not valid", ERROR_BROKEN_JSON_STRUCTURE);
}
// <div class="codeCorrection" data-uid='{"uid": 1, "name": "Reginald Commenter", "avatar": "http://www"}' data-file="../javascript/src/CodeCorrection.js" data-target="codeCorrection-output1">
// </div>
// <input id="codeCorrection-output1" name="correction-data" type="hidden"
// value=
$jsonDataUid = json_encode([FE_ANNOTATE_USER_UID => $formElement[FE_ANNOTATE_USER_UID], FE_ANNOTATE_USER_NAME => $formElement[FE_ANNOTATE_USER_NAME], FE_ANNOTATE_USER_AVATAR => $formElement[FE_ANNOTATE_USER_AVATAR]]);
$attributeFabric = Support::doAttribute('class', ANNOTATE_TEXT_CSS_CLASS);
$attributeFabric .= Support::doAttribute('data-uid', $jsonDataUid);
$attributeFabric .= Support::doAttribute('data-file', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE]));
$attributeFabric .= Support::doAttribute('data-background-image', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE]));
$attributeFabric .= Support::doAttribute('data-control-name', $formElement[FE_HTML_ID]);
$attributeFabric .= Support::doAttribute('data-buttons', 'typo3conf/ext/qfq/Resources/Public/Json/fabric.buttons.json');
$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]);
$htmlFabric = Support::wrapTag('<div ' . $attributeFabric . ' >', '', false);
$attributeInput = Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attributeInput .= Support::doAttribute('name', $htmlFormElementName);
$attributeInput .= Support::doAttribute('type', 'hidden');
$attributeInput .= Support::doAttribute('value', htmlentities($value), false);
$attributeInput .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$htmlInput = Support::wrapTag('<input ' . $attributeInput . ' >', '', false);
$html = $htmlFabric . $htmlInput . $this->getHelpBlock();
// $json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement);
return $html;
}
/**
* Build a Fabric Annotate Element
*
......@@ -3138,7 +3224,7 @@ abstract class AbstractBuildForm {
* @throws CodeException
* @throws UserFormException
*/
public function buildAnnotate(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
private function buildAnnotateGraphic(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
if ($mode == FORM_LOAD && !empty($formElement[FE_IMAGE_SOURCE])) {
if (!is_readable($formElement[FE_IMAGE_SOURCE])) {
......@@ -3157,7 +3243,7 @@ abstract class AbstractBuildForm {
// $attributeFabric = Support::doAttribute('id', 'fabric');
$attributeFabric = Support::doAttribute('class', FABRIC_CSS_CLASS);
$attributeFabric = Support::doAttribute('class', ANNOTATE_GRAPHIC_CSS_CLASS);
$attributeFabric .= Support::doAttribute('data-background-image', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE]));
$attributeFabric .= Support::doAttribute('data-control-name', $formElement[FE_HTML_ID]);
$attributeFabric .= Support::doAttribute('data-buttons', 'typo3conf/ext/qfq/Resources/Public/Json/fabric.buttons.json');
......@@ -3222,7 +3308,7 @@ abstract class AbstractBuildForm {
// data-image-resize-width="1200"
// data-image-output="target-png">
// </div>
$attributeFabric = Support::doAttribute('class', FABRIC_CSS_CLASS);
$attributeFabric = Support::doAttribute('class', ANNOTATE_GRAPHIC_CSS_CLASS);
$attributeFabric .= Support::doAttribute('data-buttons', 'typo3conf/ext/qfq/Resources/Public/Json/fabric.editor.buttons.json');
$attributeFabric .= Support::doAttribute('data-edit-image', 'true');
$attributeFabric .= Support::doAttribute('data-background-image', $imageFileName);
......
......@@ -1070,9 +1070,17 @@ const FE_IMPORT_NAMED_SHEETS_ONLY = 'importNamedSheetsOnly';
const FE_IMPORT_READ_DATA_ONLY = 'importSetReadDataOnly';
const FE_IMPORT_LIST_SHEET_NAMES = 'importListSheetNames';
// Annotate
const FE_TEXT_SOURCE = 'textSource';
const FE_IMAGE_SOURCE = 'imageSource'; // Image source for a fabric element
const FE_DEFAULT_PEN_COLOR = 'defaultPenColor'; // Default pen color for a fabric element
const FE_ANNOTATE_TYPE = 'annotateType'; // Annotate type: graphic|code
const FE_ANNOTATE_TYPE_GRAPHIC = 'graphic';
const FE_ANNOTATE_TYPE_CODE = 'code';
const FE_ANNOTATE_USER_NAME = 'annotateUserName';
const FE_ANNOTATE_USER_UID = 'annotateUserUid';
const FE_ANNOTATE_USER_AVATAR = 'annotateUserAvatar';
const FE_SQL_VALIDATE = 'sqlValidate'; // Action: Query to validate form load
const FE_EXPECT_RECORDS = 'expectRecords'; // Action: expected number of rows of FE_SQL_VALIDATE
const FE_MESSAGE_FAIL = 'messageFail'; // Action: Message to display, if FE_SQL_VALIDATE fails.
......@@ -1655,7 +1663,8 @@ const AUTOCRON_UNIT = 'unit';
const AUTOCRON_COUNT = 'count';
// Annotate
const FABRIC_CSS_CLASS = 'fabric';
const ANNOTATE_GRAPHIC_CSS_CLASS = 'annotate-graphic'; // Ex 'fabric'
const ANNOTATE_TEXT_CSS_CLASS = 'annotate-text'; // Ex 'codeCorrection
// DataImport
const IMPORT_MODE_APPEND = 'append';
......
......@@ -136,8 +136,7 @@ $UPDATE_ARRAY = array(
"ALTER TABLE `Form` ADD `labelAlign` ENUM('default','left','center','right') NOT NULL DEFAULT 'default' AFTER `forwardPage`;",
"ALTER TABLE `FormElement` ADD `labelAlign` ENUM('default','left','center','right') NOT NULL DEFAULT 'default' AFTER `maxLength`;",
],
);
......
......@@ -69,7 +69,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',
'editor', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload',
'editor', 'annotate', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload',
'annotate', 'imageCut', 'fieldset', 'pill', 'templateGroup',
'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad',
'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendMail',
......
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