diff --git a/extension/Classes/Core/Constants.php b/extension/Classes/Core/Constants.php index 4cca2e4e0f202e16dada8dc8f084c9ba3f104337..fb8c4c2105d6fa40a38ded6b333a24766330405e 100644 --- a/extension/Classes/Core/Constants.php +++ b/extension/Classes/Core/Constants.php @@ -1004,6 +1004,9 @@ const SQL_LOG_MODE_MODIFY = 'modify'; const SQL_LOG_MODE_NONE = 'none'; const SQL_LOG_MODE_ERROR = 'error'; +// SQL aliases (SQL_*) +const SQL_ALIAS_COUNT = 'cnt'; + const MODE_LDAP_PREFETCH = 'ldapPrefetch'; const MODE_LDAP_SINGLE = 'ldapSingle'; const MODE_LDAP_MULTI = 'ldapMulti'; @@ -1104,6 +1107,7 @@ const CLASS_CHARACTER_COUNT = 'qfq-character-count'; const DATA_CHARACTER_COUNT_ID = 'data-character-count-id'; const CLASS_FORM_ELEMENT_EDIT = 'qfq-form-element-edit'; +const CLASS_FORM_TITLE = 'qfq-form-title'; const CLASS_FORM_ELEMENT_AUTO_GROW = 'qfq-auto-grow'; const ATTRIBUTE_DATA_MAX_HEIGHT = 'data-max-height'; @@ -1259,6 +1263,7 @@ const F_FE_DATA_PATTERN_ERROR_DEFAULT = 'Pattern mismatch'; // Attention: the de const F_FE_DATA_REQUIRED_ERROR_DEFAULT = 'Required'; // Attention: the default is also defined in ext_conf_template.txt const F_FE_DATA_MATCH_ERROR_DEFAULT = 'Fields do not match'; // Attention: the default is also defined in ext_conf_template.txt +const FE_LABEL_2 = 'label2'; const F_FE_LABEL_ALIGN = SYSTEM_LABEL_ALIGN; const F_FE_LABEL_ALIGN_DEFAULT = 'default'; const F_FE_REQUIRED_POSITION = 'requiredPosition'; @@ -1777,11 +1782,32 @@ const FE_DATA_MATCH = 'data-match'; const FE_SUBRECORD_EMPTY = SYSTEM_SUBRECORD_EMPTY; +// Form element attributes (FE_*) +const FE_DUMMY_ROW = 'dummy-row'; const MODE_ENCODE = 'encode'; const MODE_ENCODE_ALL = 'encodeAll'; const MODE_DECODE = 'decode'; const MODE_NONE = 'none'; +// HTML attributes (HTML_ATTR_*) +const HTML_ATTR_CREATED = 'created'; +const HTML_ATTR_DATALIST = 'datalist'; +const HTML_ATTR_LIST = 'list'; +const HTML_ATTR_SELECTED = 'selected'; +const HTML_ATTR_DATA_FILE = 'data-file'; +const HTML_ATTR_HREF = 'href'; +const HTML_ATTR_MODIFIED = 'modified'; +const HTML_ATTR_NOCLICK = 'noclick'; +const HTML_ATTR_DISABLED = 'disabled'; +const HTML_ATTR_TEXT = 'text'; +const HTML_ATTR_TITLE = 'title'; +const HTML_ATTR_TYPE = 'type'; +const HTML_ATTR_VALUE = 'value'; +const HTML_ATTR_CHECKED = 'checked'; +const HTML_ATTR_STYLE = 'style'; +const HTML_ATTR_REQUIRED = 'required'; +const HTML_ATTR_NAME = 'name'; + const HTML_DELIMITER_NAME = '-'; const HTML_DELIMITER_ID = HTML_DELIMITER_NAME; @@ -2698,6 +2724,13 @@ const DATA_TABLESORTER_VIEW = 'data-tablesorter-view'; const DATA_TABLESORTER_SIP = 'data-tablesorter-sip'; const DATA_TABLESORTER_BASE_URL = 'data-tablesorter-base-url'; +// Data attributes (DATA_*) +const DATA_BASE_URL = 'data-base-url'; +const DATA_CLASS_ON_CHANGE = 'data-class-on-change'; +const DATA_HISTORY_TITLE = 'data-history-title'; +const DATA_TABLESORTER_VIEW_JSON = 'data-tablesorter-view-json'; +const DATA_CHAT_CONFIG = 'data-chat-config'; + // Setting const SETTING_TYPE_TABLESORTER = 'tablesorter'; const SETTING_TABLE_NAME = 'Setting'; @@ -2812,11 +2845,25 @@ const QFQ_CREATE_TABLE = 'qfqCreateTable'; const RENDER_MODE_HTML = 'html'; const RENDER_MODE_JSON = "JSON"; -const RENDER_MODE_PLAIN = 'plain'; - const ICON_RENDERER_TAG = 'tag'; const ICON_RENDERER_FAMILY = 'family'; +const ICON_RENDERER_DEFAULT_FAMILY = 'default_family_name'; const ICON_RENDERER_NAME = 'name'; const ICON_RENDERER_DEFAULT_TAG = 'i'; -const ICON_RENDERER_DEFAULT_FAMILY = 'glyphicon'; \ No newline at end of file + +// Button-specific constants (BTN_*) +const BTN_CLASS = 'class'; +const BTN_DISABLED = 'disabled'; +const BTN_HISTORY_TITLE = 'historyTitle'; +const BTN_HTML_ID = 'buttonHtmlId'; +const BTN_ICON = 'icon'; +const BTN_ID = 'id'; +const BTN_ONCHANGE_CLASS = 'onChangeClass'; +const BTN_ONCLICK = 'onClick'; +const BTN_SIP = 'sip'; +const BTN_TABLESORTER_VIEW = 'tablesorterView'; +const BTN_TEXT = "text"; +const BTN_TOOLTIP = 'tooltip'; +const BTN_TYPE_BUTTON = 'button'; +const BTN_URL = 'url'; \ No newline at end of file diff --git a/extension/Classes/Core/Form/FormElement/AbstractFormElement.php b/extension/Classes/Core/Form/FormElement/AbstractFormElement.php index d0f1d8593466074c6dcc26bf609b93f6a05f5758..5612cd0cb148e0fdc79a441f6f1d2fb7685d7e59 100644 --- a/extension/Classes/Core/Form/FormElement/AbstractFormElement.php +++ b/extension/Classes/Core/Form/FormElement/AbstractFormElement.php @@ -139,7 +139,7 @@ abstract class AbstractFormElement { $this->htmlAttributes[HTML_ATTR_ID] = HelperFormElement::buildFormElementId($form == null ? "" : $form->getHtmlId(), $this->attributes[FE_ID], $form != null ? $form->recordId : 0, $htmlIdAppendix); $this->attributes[FE_HTML_ID] = $this->htmlAttributes[HTML_ATTR_ID]; - $this->htmlAttributes['name'] = HelperFormElement::buildFormElementName($this->attributes, $form != null ? $form->recordId : 0); + $this->htmlAttributes[HTML_ATTR_NAME] = HelperFormElement::buildFormElementName($this->attributes, $form != null ? $form->recordId : 0); $this->handleFeMode(); $this->handleLanguage(); @@ -424,9 +424,9 @@ abstract class AbstractFormElement { } $queryStringArray = [ - 'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM), - 'form' => FORM_NAME_FORM_ELEMENT, - 'r' => $this->attributes[FE_ID], + F_ID => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM), + FORM_NAME_FORM => FORM_NAME_FORM_ELEMENT, + CLIENT_RECORD_ID => $this->attributes[FE_ID], PARAM_DB_INDEX_DATA => $this->databaseManager->indexQfq ]; diff --git a/extension/Classes/Core/Form/FormElement/AnnotateFormElement.php b/extension/Classes/Core/Form/FormElement/AnnotateFormElement.php index 6af97073bd7136aab7bd86b44e82b595c7c9d391..279c22abf6fc3777447a09e2793b43be056f63b0 100644 --- a/extension/Classes/Core/Form/FormElement/AnnotateFormElement.php +++ b/extension/Classes/Core/Form/FormElement/AnnotateFormElement.php @@ -34,8 +34,8 @@ class AnnotateFormElement extends AbstractFormElement { if (!isset($this->attributes[FE_ANNOTATE_TYPE])) $this->attributes[FE_ANNOTATE_TYPE] = FE_ANNOTATE_TYPE_GRAPHIC; // Prepare HTML attributes for hidden input element - $this->htmlAttributes['type'] = 'hidden'; - $this->htmlAttributes['value'] = htmlentities($this->value); + $this->htmlAttributes[HTML_ATTR_TYPE] = 'hidden'; + $this->htmlAttributes[HTML_ATTR_VALUE] = htmlentities($this->value); $this->htmlAttributes[ATTRIBUTE_DATA_REFERENCE] = $this->attributes[FE_DATA_REFERENCE]; if ($this->attributes[FE_ANNOTATE_TYPE] == FE_ANNOTATE_TYPE_GRAPHIC) { @@ -69,7 +69,7 @@ class AnnotateFormElement extends AbstractFormElement { } // Prepare HTML attributes for Fabric element - $this->fabricHtmlAttributes["class"] = ANNOTATE_GRAPHIC_CSS_CLASS; + $this->fabricHtmlAttributes[HTML_ATTR_CLASS] = ANNOTATE_GRAPHIC_CSS_CLASS; $this->fabricHtmlAttributes["data-background-image"] = $this->fileToSipUrl($this->attributes[FE_IMAGE_SOURCE]); $this->fabricHtmlAttributes["data-control-name"] = $this->attributes[FE_HTML_ID]; $this->fabricHtmlAttributes["data-buttons"] = Path::urlExt('Resources/Public/Json/fabric.buttons.json'); @@ -109,8 +109,8 @@ class AnnotateFormElement extends AbstractFormElement { , 'avatar' => $this->attributes[FE_ANNOTATE_USER_AVATAR]], JSON_UNESCAPED_SLASHES); // Prepare HTML attributes for fabric-div - $this->fabricHtmlAttributes['class'] = ANNOTATE_TEXT_CSS_CLASS; - $this->fabricHtmlAttributes['data-file'] = $this->fileToSipUrl($this->attributes[FE_TEXT_SOURCE]); + $this->fabricHtmlAttributes[HTML_ATTR_CLASS] = ANNOTATE_TEXT_CSS_CLASS; + $this->fabricHtmlAttributes[HTML_ATTR_DATA_FILE] = $this->fileToSipUrl($this->attributes[FE_TEXT_SOURCE]); $this->fabricHtmlAttributes['data-target'] = $this->attributes[FE_HTML_ID]; $this->fabricHtmlAttributes['data-highlight'] = $dataHighlight; $this->fabricHtmlAttributes['data-uid'] = str_replace('"', """, $jsonDataUid); diff --git a/extension/Classes/Core/Renderer/BaseRenderer.php b/extension/Classes/Core/Renderer/BaseRenderer.php index 00fdb483159446136695a90b0eb0d5f4724281e0..41e06b417f4a52b4bf8195c7b050145dbe3ddd52 100644 --- a/extension/Classes/Core/Renderer/BaseRenderer.php +++ b/extension/Classes/Core/Renderer/BaseRenderer.php @@ -320,10 +320,10 @@ class BaseRenderer { $addRowButtonHtml = ''; if ($addRow) { $buttonSpec = array(); - $buttonSpec['buttonHtmlId'] = MULTIFORM_ADD_ROW_BTN . '-' . $form->getHtmlId(); - $buttonSpec['tooltip'] = 'Add new row'; - $buttonSpec['icon'] = GLYPH_ICON_NEW; - $buttonSpec['class'] = $form->specFinal[F_SAVE_BUTTON_CLASS] . ' addRowButton'; + $buttonSpec[BTN_HTML_ID] = MULTIFORM_ADD_ROW_BTN . '-' . $form->getHtmlId(); + $buttonSpec[BTN_TOOLTIP] = 'Add new row'; + $buttonSpec[BTN_ICON] = GLYPH_ICON_NEW; + $buttonSpec[BTN_CLASS] = $form->specFinal[F_SAVE_BUTTON_CLASS] . ' addRowButton'; $addRowButtonHtml = $this->buttonRenderer->render($buttonSpec); } @@ -350,7 +350,7 @@ class BaseRenderer { $feClone->htmlAttributes[HTML_ATTR_NAME] = explode('-', $feClone->htmlAttributes[HTML_ATTR_NAME])[0] . '-0-0'; $dummyRow[$i] = $feClone; } - $form->formElements['dummy-row'] = $dummyRow; + $form->formElements[FE_DUMMY_ROW] = $dummyRow; $dummyMultiSqlResult = $form->specFinal[F_MULTI_SQL_RESULT][0]; foreach ($dummyMultiSqlResult as $key => $value) { @@ -408,8 +408,8 @@ class BaseRenderer { // If form title has changed, add new title to JSON if ($form->specFinal[F_TITLE] != $evaluatedTitle[F_TITLE]) { $element = array( - 'form-element' => 'qfq-form-title', - 'value' => $evaluatedTitle[F_TITLE] + API_FORM_UPDATE_FORM_ELEMENT => CLASS_FORM_TITLE, + FE_VALUE => $evaluatedTitle[F_TITLE] ); $json[] = $element; } diff --git a/extension/Classes/Core/Renderer/Bootstrap3Renderer.php b/extension/Classes/Core/Renderer/Bootstrap3Renderer.php index 9e459d9c242e4b2a45c9d02f96b6f1e861dfdea1..b819b25ff41b94b8ed8c0d384764fed94273e188 100644 --- a/extension/Classes/Core/Renderer/Bootstrap3Renderer.php +++ b/extension/Classes/Core/Renderer/Bootstrap3Renderer.php @@ -390,8 +390,8 @@ class Bootstrap3Renderer extends BaseRenderer { $toolTip .= PHP_EOL . 'Create new record'; } else { $toolTip .= PHP_EOL . 'Record id: ' . $form->recordId; - $toolTip .= PHP_EOL . 'Created: ' . $this->store->getVar('created', STORE_RECORD . STORE_EMPTY);; - $toolTip .= PHP_EOL . 'Modified: ' . $this->store->getVar('modified', STORE_RECORD . STORE_EMPTY);; + $toolTip .= PHP_EOL . 'Created: ' . $this->store->getVar(HTML_ATTR_CREATED, STORE_RECORD . STORE_EMPTY);; + $toolTip .= PHP_EOL . 'Modified: ' . $this->store->getVar(HTML_ATTR_MODIFIED, STORE_RECORD . STORE_EMPTY);; } } // In debugMode every button link should show the information behind the SIP. @@ -400,12 +400,12 @@ class Bootstrap3Renderer extends BaseRenderer { } $buttonSpec = array(); - $buttonSpec['buttonHtmlId'] = 'save-button-' . $form->formTagAttributes[F_ID]; - $buttonSpec['tooltip'] = $toolTip; - $buttonSpec['text'] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_TEXT] : $form->specFinal[F_SAVE_BUTTON_TEXT]; - $buttonSpec['icon'] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_GLYPH_ICON] : $form->specFinal[F_SAVE_BUTTON_GLYPH_ICON]; - $buttonSpec['class'] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_CLASS] : $form->specFinal[F_SAVE_BUTTON_CLASS]; - $buttonSpec['onChangeClass'] = $form->specFinal[F_BUTTON_ON_CHANGE_CLASS]; + $buttonSpec[BTN_HTML_ID] = 'save-button-' . $form->formTagAttributes[F_ID]; + $buttonSpec[BTN_TOOLTIP] = $toolTip; + $buttonSpec[BTN_TEXT] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_TEXT] : $form->specFinal[F_SAVE_BUTTON_TEXT]; + $buttonSpec[BTN_ICON] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_GLYPH_ICON] : $form->specFinal[F_SAVE_BUTTON_GLYPH_ICON]; + $buttonSpec[BTN_CLASS] = ($submitButtonCheck) ? $form->specFinal[F_SUBMIT_BUTTON_CLASS] : $form->specFinal[F_SAVE_BUTTON_CLASS]; + $buttonSpec[BTN_ONCHANGE_CLASS] = $form->specFinal[F_BUTTON_ON_CHANGE_CLASS]; return $this->buttonRenderer->render($buttonSpec); } @@ -426,11 +426,11 @@ class Bootstrap3Renderer extends BaseRenderer { // Check for deprecated customized close button } else { $buttonSpec = array(); - $buttonSpec['buttonHtmlId'] = 'close-button-' . $form->formTagAttributes[F_ID]; - $buttonSpec['text'] = $form->specFinal[F_CLOSE_BUTTON_TEXT]; - $buttonSpec['tooltip'] = $form->specFinal[F_CLOSE_BUTTON_TOOLTIP]; - $buttonSpec['icon'] = $form->specFinal[F_CLOSE_BUTTON_GLYPH_ICON]; - $buttonSpec['class'] = $form->specFinal[F_CLOSE_BUTTON_CLASS]; + $buttonSpec[BTN_HTML_ID] = 'close-button-' . $form->formTagAttributes[F_ID]; + $buttonSpec[BTN_TEXT] = $form->specFinal[F_CLOSE_BUTTON_TEXT]; + $buttonSpec[BTN_TOOLTIP] = $form->specFinal[F_CLOSE_BUTTON_TOOLTIP]; + $buttonSpec[BTN_ICON] = $form->specFinal[F_CLOSE_BUTTON_GLYPH_ICON]; + $buttonSpec[BTN_CLASS] = $form->specFinal[F_CLOSE_BUTTON_CLASS]; return $this->buttonRenderer->render($buttonSpec); } } @@ -456,16 +456,17 @@ class Bootstrap3Renderer extends BaseRenderer { if ($form->showDebugInfoFlag && $form->recordId > 0) { $toolTip .= PHP_EOL . "form = '" . $form->specFinal[F_FINAL_DELETE_FORM] . "'" . PHP_EOL . "r = '" . $form->recordId . "'"; } - + $disabled = ($form->recordId > 0) ? '' : 'BTN_DISABLED'; $buttonSpec = array(); - $buttonSpec['buttonHtmlId'] = 'delete-button-' . $form->formTagAttributes[F_ID]; - $buttonSpec['text'] = $form->specFinal[F_DELETE_BUTTON_TEXT]; - $buttonSpec['tooltip'] = $toolTip; - $buttonSpec['icon'] = $form->specFinal[F_DELETE_BUTTON_GLYPH_ICON]; - $buttonSpec['class'] = $form->specFinal[F_DELETE_BUTTON_CLASS]; - if (!($form->recordId > 0)) { - $buttonSpec['disabled'] = 'disabled'; + $buttonSpec[BTN_HTML_ID] = 'delete-button-' . $form->formTagAttributes[F_ID]; + $buttonSpec[BTN_TEXT] = $form->specFinal[F_DELETE_BUTTON_TEXT]; + $buttonSpec[BTN_TOOLTIP] = $toolTip; + $buttonSpec[BTN_ICON] = $form->specFinal[F_DELETE_BUTTON_GLYPH_ICON]; + $buttonSpec[BTN_CLASS] = $form->specFinal[F_DELETE_BUTTON_CLASS]; + $buttonSpec[BTN_DISABLED] = $disabled; + if ($form->recordId = 0) { + $buttonSpec[BTN_DISABLED] = BTN_DISABLED; } return $this->buttonRenderer->render($buttonSpec); @@ -491,12 +492,12 @@ class Bootstrap3Renderer extends BaseRenderer { $url = $form->getNewUrl($toolTip); $buttonSpec = array(); - $buttonSpec['url'] = $url; - $buttonSpec['buttonHtmlId'] = 'form-new-button'; - $buttonSpec['text'] = $form->specFinal[F_NEW_BUTTON_TEXT]; - $buttonSpec['tooltip'] = $toolTip; - $buttonSpec['icon'] = $form->specFinal[F_NEW_BUTTON_GLYPH_ICON]; - $buttonSpec['class'] = $form->specFinal[F_NEW_BUTTON_CLASS]; + $buttonSpec[BTN_URL] = $url; + $buttonSpec[BTN_HTML_ID] = 'form-new-button'; + $buttonSpec[BTN_TEXT] = $form->specFinal[F_NEW_BUTTON_TEXT]; + $buttonSpec[BTN_TOOLTIP] = $toolTip; + $buttonSpec[BTN_ICON] = $form->specFinal[F_NEW_BUTTON_GLYPH_ICON]; + $buttonSpec[BTN_CLASS] = $form->specFinal[F_NEW_BUTTON_CLASS]; return $this->buttonRenderer->render($buttonSpec); } @@ -511,11 +512,11 @@ class Bootstrap3Renderer extends BaseRenderer { */ private function renderEditFormButton(Form $form): string { $buttonSpec = array(); - $buttonSpec['url'] = $form->getFormEditorUrl(); - $buttonSpec['buttonHtmlId'] = 'form-edit-button'; - $buttonSpec['tooltip'] = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'"); - $buttonSpec['icon'] = GLYPH_ICON_TOOL; - $buttonSpec['class'] = 'btn btn-default navbar-btn'; + $buttonSpec[BTN_URL] = $form->getFormEditorUrl(); + $buttonSpec[BTN_HTML_ID] = 'form-edit-button'; + $buttonSpec[BTN_TOOLTIP] = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'"); + $buttonSpec[BTN_ICON] = GLYPH_ICON_TOOL; + $buttonSpec[BTN_CLASS] = 'btn btn-default navbar-btn'; return $this->buttonRenderer->render($buttonSpec); } @@ -533,7 +534,7 @@ class Bootstrap3Renderer extends BaseRenderer { // START EXISTING CODE $formName = false; - $buttonSpec['url'] = ''; + $buttonSpec[BTN_URL] = ''; $requiredNew = ''; switch ($form->specFinal[F_NAME]) { @@ -553,32 +554,32 @@ class Bootstrap3Renderer extends BaseRenderer { } if ($formName === false) { - $buttonSpec['tooltip'] = "Form not 'form' or 'formElement'"; - $buttonSpec['disabled'] = 'true'; + $buttonSpec[BTN_TOOLTIP] = "Form not 'form' or 'formElement'"; + $buttonSpec[BTN_DISABLED] = 'true'; } else { if ($requiredNew === '') { $requiredNew = $this->store->getVar(F_REQUIRED_PARAMETER_NEW, STORE_RECORD . STORE_EMPTY); } if (trim($requiredNew) !== '') { - $buttonSpec['tooltip'] = "Form has 'required new' parameters and therefore cannot be previewed."; - $buttonSpec['disabled'] = 'true'; + $buttonSpec[BTN_TOOLTIP] = "Form has 'required new' parameters and therefore cannot be previewed."; + $buttonSpec[BTN_DISABLED] = 'true'; } else { $queryStringArray = [ - 'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM), - 'form' => $formName, - 'r' => 0, + F_ID => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM), + FORM_NAME_FORM => $formName, + CLIENT_RECORD_ID => 0, ]; $queryString = Support::arrayToQueryString($queryStringArray); $sip = $this->store->getSipInstance(); - $buttonSpec['url'] = $sip->queryStringToSip($queryString); + $buttonSpec[BTN_URL] = $sip->queryStringToSip($queryString); - $buttonSpec['tooltip'] = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'"); + $buttonSpec[BTN_TOOLTIP] = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'"); } } - $buttonSpec['buttonHtmlId'] = 'form-view-' . $form->specFinal[F_ID]; - $buttonSpec['icon'] = GLYPH_ICON_VIEW; - $buttonSpec['class'] = "btn btn-default navbar-btn"; + $buttonSpec[BTN_HTML_ID] = 'form-view-' . $form->specFinal[F_ID]; + $buttonSpec[BTN_ICON] = GLYPH_ICON_VIEW; + $buttonSpec[BTN_CLASS] = "btn btn-default navbar-btn"; return $this->buttonRenderer->render($buttonSpec); } @@ -624,13 +625,13 @@ class Bootstrap3Renderer extends BaseRenderer { ]; $queryString = Support::arrayToQueryString($queryStringArray); $sip = $this->store->getSipInstance(); - $buttonSpec['url'] = $sip->queryStringToSip($queryString); - $buttonSpec['icon'] = GLYPH_ICON_DUPLICATE; - $buttonSpec['tooltip'] = "Duplicate form" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'"); - $buttonSpec['class'] = 'btn btn-default navbar-btn'; - $buttonSpec['htmlButtonId'] = 'form-view-' . $form->specFinal[F_ID]; + $buttonSpec[BTN_URL] = $sip->queryStringToSip($queryString); + $buttonSpec[BTN_ICON] = GLYPH_ICON_DUPLICATE; + $buttonSpec[BTN_TOOLTIP] = "Duplicate form" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'"); + $buttonSpec[BTN_CLASS] = 'btn btn-default navbar-btn'; + $buttonSpec[BTN_HTML_ID] = 'form-view-' . $form->specFinal[F_ID]; - if ($formId == 0) $buttonSpec['disabled'] = true; + if ($formId == 0) $buttonSpec[BTN_DISABLED] = true; return $this->buttonRenderer->render($buttonSpec); } @@ -788,7 +789,7 @@ class Bootstrap3Renderer extends BaseRenderer { // Count the number of notes related to the form and record, accessible by the user or publicly ('all') $sqlResult = $this->databaseManager->dbArray[$this->databaseManager->indexData]->sql($sql, ROW_EXPECT_0_1); - $noteTotal = $sqlResult['cnt'] ?? 0; + $noteTotal = $sqlResult[SQL_ALIAS_COUNT] ?? 0; $disabled = ($xId == '0' || $formName == NOTE_ITEM_NAME) ? ATTRIBUTE_DISABLED : ''; // Query to find notes that are not marked as done @@ -796,7 +797,7 @@ class Bootstrap3Renderer extends BaseRenderer { $sqlResult = $this->databaseManager->dbArray[$this->databaseManager->indexData]->sql("SELECT COUNT(*) AS cnt FROM $noteItemTable AS nf WHERE nf.formId = $formId AND nf.xId = $recordId AND nf.isDone = 'no' AND nf.hasToolbar = 'yes' GROUP BY formId", ROW_EXPECT_0_1); - $noteTotalOpen = $sqlResult['cnt'] ?? 0; + $noteTotalOpen = $sqlResult[SQL_ALIAS_COUNT] ?? 0; // Tooltip note button $tooltip = 'Notes'; @@ -842,7 +843,7 @@ class Bootstrap3Renderer extends BaseRenderer { // If there's an icon, prepend it to the element content if ($icon !== '') { - $iconSpan = "<span " . Support::doAttribute('class', "glyphicon $icon") . "></span>"; + $iconSpan = "<span " . Support::doAttribute(BTN_CLASS, "glyphicon $icon") . "></span>"; $text = "$iconSpan $text"; } // If there's a badge, append it to the element content @@ -850,15 +851,15 @@ class Bootstrap3Renderer extends BaseRenderer { $text = "$text $badge"; } - $buttonSpec['buttonHtmlId'] = $buttonHtmlId; - $buttonSpec['class'] = $class; - $buttonSpec['tooltip'] = $tooltip; - $buttonSpec['text'] = $text; + $buttonSpec[BTN_HTML_ID] = $buttonHtmlId; + $buttonSpec[BTN_CLASS] = $class; + $buttonSpec[BTN_TOOLTIP] = $tooltip; + $buttonSpec[BTN_TEXT] = $text; if ($disabled === ATTRIBUTE_DISABLED) { - $buttonSpec['disabled'] = $disabled; + $buttonSpec[BTN_DISABLED] = $disabled; } else { - $buttonSpec['onClick'] = $onClickJs; + $buttonSpec[BTN_ONCLICK] = $onClickJs; } return $this->buttonRenderer->render($buttonSpec); diff --git a/extension/Classes/Core/Renderer/Element/Bootstrap3/Bootstrap3ButtonRenderer.php b/extension/Classes/Core/Renderer/Element/Bootstrap3/Bootstrap3ButtonRenderer.php index 009c3b417a7c1b64f095b2c2fb45e1abe75eb99e..a217e46542a83e7721e72e1b2db7cb984df2462e 100644 --- a/extension/Classes/Core/Renderer/Element/Bootstrap3/Bootstrap3ButtonRenderer.php +++ b/extension/Classes/Core/Renderer/Element/Bootstrap3/Bootstrap3ButtonRenderer.php @@ -12,9 +12,9 @@ class Bootstrap3ButtonRenderer extends ButtonRenderer { * * @param array $elementSpec ['url'] -> link opened onclick of the button * ['buttonHtmlId'] -> HTML id of the button element - * ['text'] -> HTML id of the button element + * [BTN_TEXT] -> HTML id of the button element * ['tooltip'] -> HTML id of the button element - * ['icon'] -> name of the icon, e.g. "glyphicon-pencil" + * [BTN_ICON] -> name of the icon, e.g. "glyphicon-pencil" * ['disabled'] -> button disabled if this is set (no specific value needed) * ['class'] -> css class of the button * ['onChangeClass'] -> css class that is assigned to the button when form input changes @@ -37,31 +37,31 @@ class Bootstrap3ButtonRenderer extends ButtonRenderer { */ public static function renderStatic(array $elementSpec, string $renderMode = RENDER_MODE_HTML): string { $innerHTML = ""; - if (!isset($elementSpec['text'])) $elementSpec['text'] = ""; - if (!isset($elementSpec['icon']) || $elementSpec['icon'] === "") { - $innerHTML = $elementSpec['text']; + if (!isset($elementSpec[BTN_TEXT])) $elementSpec[BTN_TEXT] = ""; + if (!isset($elementSpec[BTN_ICON]) || $elementSpec[BTN_ICON] === "") { + $innerHTML = $elementSpec[BTN_TEXT]; } else { - $innerHTML = "<span " . Support::doAttribute('class', "glyphicon " . $elementSpec['icon']) . "></span> " . $elementSpec['text']; + $innerHTML = "<span " . Support::doAttribute(BTN_CLASS, GLYPH_ICON . $elementSpec[BTN_ICON]) . "></span> " . $elementSpec[BTN_TEXT]; } $attribute = ""; - if (isset($elementSpec['url'])) $attribute .= Support::doAttribute('href', $elementSpec['url']); - if (isset($elementSpec['buttonHtmlId'])) $attribute .= Support::doAttribute('id', $elementSpec['buttonHtmlId']); - if (isset($elementSpec['class'])) $attribute .= Support::doAttribute('class', $elementSpec['class']); - if (isset($elementSpec['tooltip'])) $attribute .= Support::doAttribute('title', $elementSpec['tooltip']); - if (isset($elementSpec['onChangeClass'])) $attribute .= Support::doAttribute('data-class-on-change', $elementSpec['onChangeClass']); - if (isset($elementSpec['onClick'])) $attribute .= Support::doAttribute('onClick', $elementSpec['onClick']); - if (isset($elementSpec['sip'])) $attribute .= Support::doAttribute('data-sip', $elementSpec['sip']); - if (isset($elementSpec['baseUrl'])) $attribute .= Support::doAttribute('data-base-url', $elementSpec['baseUrl']); - if (isset($elementSpec['tablesorterView'])) $attribute .= Support::doAttribute('data-tablesorter-view-json', $elementSpec['tablesorterView']); - if (isset($elementSpec['historyTitle'])) $attribute .= Support::doAttribute('data-history-title', $elementSpec['historyTitle']); - if (isset($elementSpec['disabled'])) $attribute .= " disabled "; + if (isset($elementSpec[BTN_URL])) $attribute .= Support::doAttribute(HTML_ATTR_HREF, $elementSpec[BTN_URL]); + if (isset($elementSpec[BTN_HTML_ID])) $attribute .= Support::doAttribute(BTN_ID, $elementSpec[BTN_HTML_ID]); + if (isset($elementSpec[BTN_CLASS])) $attribute .= Support::doAttribute(BTN_CLASS, $elementSpec[BTN_CLASS]); + if (isset($elementSpec[BTN_TOOLTIP])) $attribute .= Support::doAttribute(BTN_CLASS, $elementSpec[BTN_TOOLTIP]); + if (isset($elementSpec[BTN_ONCHANGE_CLASS])) $attribute .= Support::doAttribute(DATA_CLASS_ON_CHANGE, $elementSpec[BTN_ONCHANGE_CLASS]); + if (isset($elementSpec[BTN_ONCLICK])) $attribute .= Support::doAttribute(BTN_ONCLICK, $elementSpec[BTN_ONCLICK]); + if (isset($elementSpec[BTN_SIP])) $attribute .= Support::doAttribute(DATA_SIP, $elementSpec[BTN_SIP]); + if (isset($elementSpec[SYSTEM_BASE_URL])) $attribute .= Support::doAttribute(DATA_BASE_URL, $elementSpec[SYSTEM_BASE_URL]); + if (isset($elementSpec[BTN_TABLESORTER_VIEW])) $attribute .= Support::doAttribute(DATA_TABLESORTER_VIEW_JSON, $elementSpec[BTN_TABLESORTER_VIEW]); + if (isset($elementSpec[BTN_HISTORY_TITLE])) $attribute .= Support::doAttribute(DATA_HISTORY_TITLE, $elementSpec[BTN_HISTORY_TITLE]); + if (isset($elementSpec[BTN_DISABLED])) $attribute .= " disabled "; // disabled links do not show tooltips -> use a span $wrapTag = 'button'; - if (isset($elementSpec['disabled']) && $elementSpec['disabled'] != '') $wrapTag = 'span'; - if (isset($elementSpec['url'])) $wrapTag = 'a'; - if ($wrapTag == 'button') $attribute .= Support::doAttribute('type', 'button'); + if (isset($elementSpec[BTN_DISABLED]) && $elementSpec[BTN_DISABLED] != '') $wrapTag = 'span'; + if (isset($elementSpec[BTN_URL])) $wrapTag = 'a'; + if ($wrapTag == 'button') $attribute .= Support::doAttribute(HTML_ATTR_TYPE, BTN_TYPE_BUTTON); return Support::wrapTag("<$wrapTag $attribute>", $innerHTML); } diff --git a/extension/Classes/Core/Renderer/FormElement/Base/ChatRenderer.php b/extension/Classes/Core/Renderer/FormElement/Base/ChatRenderer.php index fc3b4523c9732d0145f15238eb5c1e265d78e0c9..c3538d277ed912d07504d1855eb2be923d81c847 100644 --- a/extension/Classes/Core/Renderer/FormElement/Base/ChatRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Base/ChatRenderer.php @@ -21,7 +21,7 @@ class ChatRenderer extends NativeRenderer { } $chatFieldsetEnd = '</fieldset>'; - $fe->windowHtmlAttributes['data-chat-config'] = htmlentities($fe->windowHtmlAttributes['data-chat-config']); + $fe->windowHtmlAttributes[DATA_CHAT_CONFIG] = htmlentities($fe->windowHtmlAttributes[DATA_CHAT_CONFIG]); $chatHead = '<div class="qfq-chat-window" ' . Support::arrayToXMLAttributes($fe->windowHtmlAttributes) . '><span class="fas fa-search chat-search-activate qfq-skip-dirty"></span><div class="chat-search"><input type="text" class="chat-search-input qfq-skip-dirty" placeholder="Search..."><button class="chat-search-btn qfq-skip-dirty">Search</button><span class="chat-search-info"></span></div><div class="chat-messages">'; $chatTail = '</div></div>'; diff --git a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3CheckboxRenderer.php b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3CheckboxRenderer.php index 4670e38a08c232efa350c00d752975b2c77e9b63..5743e2118865b4537fda8871d125d5fa9bfe739d 100644 --- a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3CheckboxRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3CheckboxRenderer.php @@ -20,7 +20,7 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement */ public function renderInput(AbstractFormElement $fe, string $renderMode = RENDER_MODE_HTML): string { - switch ($fe->attributes['checkBoxMode']) { + switch ($fe->attributes[FE_CHECKBOX_MODE]) { case 'single': $html = $this->renderSingle($fe, $renderMode); break; @@ -28,7 +28,7 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement $html = $this->renderMulti($fe, $renderMode); break; default: - throw new \UserFormException('checkBoxMode: \'' . $fe->attributes['checkBoxMode'] . '\' is unknown.', ERROR_CHECKBOXMODE_UNKNOWN); + throw new \UserFormException('checkBoxMode: \'' . $fe->attributes[FE_CHECKBOX_MODE] . '\' is unknown.', ERROR_CHECKBOXMODE_UNKNOWN); } $fe->attributes = HelperFormElement::prepareExtraButton($fe->attributes, false); @@ -49,12 +49,12 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement private function renderSingle(AbstractFormElement $fe, string $renderMode = RENDER_MODE_HTML): string { $fe->htmlAttributes[HTML_ATTR_ID] = $fe->attributes[FE_HTML_ID] . '-0'; - $fe->htmlAttributes['value'] = $fe->attributes[FE_CHECKBOX_CHECKED]; + $fe->htmlAttributes[HTML_ATTR_VALUE] = $fe->attributes[FE_CHECKBOX_CHECKED]; if ($fe->attributes[FE_DYNAMIC_UPDATE] === 'yes') $fe->htmlAttributes[FE_DATA_LOAD] = FE_DATA_LOAD; $fe->htmlAttributes[ATTRIBUTE_DATA_REFERENCE] = $fe->attributes[FE_DATA_REFERENCE]; if ($fe->attributes[FE_CHECKBOX_CHECKED] === $fe->value) { - $fe->htmlAttributes['checked'] = 'checked'; + $fe->htmlAttributes[HTML_ATTR_CHECKED] = 'checked'; } if (isset($fe->attributes[FE_AUTOFOCUS])) $fe->htmlAttributes[FE_AUTOFOCUS] = $fe->attributes[FE_AUTOFOCUS]; @@ -88,13 +88,13 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement */ public function renderSinglePlain(AbstractFormElement $fe, string $renderMode): string { - $htmlHidden = HelperFormElement::buildNativeHidden($fe->htmlAttributes['name'], $fe->attributes[FE_CHECKBOX_UNCHECKED]); - Store::getInstance()->setVar($fe->htmlAttributes['name'], $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false); + $htmlHidden = HelperFormElement::buildNativeHidden($fe->htmlAttributes[HTML_ATTR_NAME], $fe->attributes[FE_CHECKBOX_UNCHECKED]); + Store::getInstance()->setVar($fe->htmlAttributes[HTML_ATTR_NAME], $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false); $html = '<input ' . Support::arrayToXMLAttributes($fe->htmlAttributes) . '>'; $html .= '<span class="checkmark" aria="hidden"></span>'; - if (isset($fe->attributes['label2'])) { + if (isset($fe->attributes[FE_LABEL_2])) { $html .= Support::wrapTag("<span style='font-weight: 400;'>", $fe->attributes['label2']); } @@ -104,15 +104,13 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement } $fe->attributes[FE_TMP_CLASS_OPTION] = $fe->attributes[FE_BUTTON_CLASS]; - $labelAttribute = Support::doAttribute('title', $fe->attributes[FE_TOOLTIP]); - $labelAttribute .= Support::doAttribute('class', $fe->attributes[FE_BUTTON_CLASS]); - $labelAttribute .= Support::doAttribute('id', HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); - + $labelAttribute = Support::doAttribute(HTML_ATTR_TITLE, $fe->attributes[FE_TOOLTIP]); + $labelAttribute .= Support::doAttribute(HTML_ATTR_CLASS, $fe->attributes[FE_BUTTON_CLASS]); + $labelAttribute .= Support::doAttribute(HTML_ATTR_ID, HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); $html = Support::wrapTag("<label $labelAttribute>", $html, true); return $html; } - /** * Build a Checkbox based on two values with Bootstrap Button class. * @@ -148,20 +146,20 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement $fe->attributes[FE_BUTTON_CLASS] .= ' active'; } - $htmlHidden = HelperFormElement::buildNativeHidden($fe->htmlAttributes['name'], $fe->attributes[FE_CHECKBOX_UNCHECKED]); - Store::getInstance()->setVar($fe->htmlAttributes['name'], $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false); + $htmlHidden = HelperFormElement::buildNativeHidden($fe->htmlAttributes[HTML_ATTR_NAME], $fe->attributes[FE_CHECKBOX_UNCHECKED]); + Store::getInstance()->setVar($fe->htmlAttributes[HTML_ATTR_NAME], $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false); $html = ''; $htmlElement = '<input ' . Support::arrayToXMLAttributes($fe->htmlAttributes) . '>'; - if (isset($fe->attributes['label2'])) { - $htmlElement .= $fe->attributes['label2']; + if (isset($fe->attributes[FE_LABEL_2])) { + $htmlElement .= $fe->attributes[FE_LABEL_2]; } else { - $htmlElement .= $fe->attributes['checked']; + $htmlElement .= $fe->attributes[FE_CHECKBOX_CHECKED]; } - $labelAttribute = Support::doAttribute('title', $fe->attributes[FE_TOOLTIP]); - $labelAttribute .= Support::doAttribute('class', $fe->attributes[FE_BUTTON_CLASS]); - $labelAttribute .= Support::doAttribute('id', HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); + $labelAttribute = Support::doAttribute(HTML_ATTR_TITLE, $fe->attributes[FE_TOOLTIP]); + $labelAttribute .= Support::doAttribute(HTML_ATTR_CLASS, $fe->attributes[FE_BUTTON_CLASS]); + $labelAttribute .= Support::doAttribute(HTML_ATTR_ID, HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); $html .= Support::wrapTag("<label $labelAttribute>", $htmlElement, true); $html = Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $html); @@ -235,12 +233,12 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement unset ($fe->attributes[FE_AUTOFOCUS]); } - $attribute .= Support::doAttribute('value', $fe->itemKeys[$ii], false); + $attribute .= Support::doAttribute(HTML_ATTR_VALUE, $fe->itemKeys[$ii], false); // Check if the given key is found in field. $values = explode(',', $fe->value); // Defines which of the checkboxes will be checked. if (false !== array_search($fe->itemKeys[$ii], $values)) { - $attribute .= Support::doAttribute('checked', 'checked'); + $attribute .= Support::doAttribute(HTML_ATTR_CHECKED, HTML_ATTR_CHECKED); $classActive = ' active'; } @@ -318,7 +316,7 @@ class Bootstrap3CheckboxRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement unset ($fe->attributes[FE_AUTOFOCUS]); } - $attribute['value'] = $fe->itemKeys[$ii]; + $attribute[HTML_ATTR_VALUE] = $fe->itemKeys[$ii]; // Check if the given key is found in field. $values = explode(',', $fe->value); // Defines which of the checkboxes will be checked. diff --git a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3PillRenderer.php b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3PillRenderer.php index f3fbe0d6cb9c9659f45f574164cd36b081fa7a34..4b199e74cb2d4692d6832bd014a5f3d2e804cbf2 100644 --- a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3PillRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3PillRenderer.php @@ -57,11 +57,11 @@ class Bootstrap3PillRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElement\Bas $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = ''; break; case FE_MODE_READONLY: - $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'disabled'; - $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'noclick'; + $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = HTML_ATTR_DISABLED; + $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = HTML_ATTR_NOCLICK; break; case FE_MODE_HIDDEN: - $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'hidden'; + $jsonArray[$htmlName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = HTML_ATTR_HIDDEN; break; default: throw new \UserFormException("Unknown Mode: " . $fe->attributes[FE_MODE], ERROR_UNKNOWN_MODE); diff --git a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3RadioButtonRenderer.php b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3RadioButtonRenderer.php index c37cadd72226dee62adff35122308bb72c72d4b8..5d20d6d7eb1afcafac4764f2a5a53dd99edd8dd2 100644 --- a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3RadioButtonRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3RadioButtonRenderer.php @@ -42,7 +42,7 @@ class Bootstrap3RadioButtonRenderer extends RadioButtonRenderer { */ private function renderRadioPlain(AbstractFormElement $fe, string $renderMode): string { $html = ''; - $attributeBaseLabel = Support::doAttribute('style', 'min-width: ' . $fe->attributes[F_FE_MIN_WIDTH] . 'px; font-weight: 400;'); + $attributeBaseLabel = Support::doAttribute(ATTRIBUTE_STYLE, 'min-width: ' . $fe->attributes[F_FE_MIN_WIDTH] . 'px; font-weight: 400;'); $orientation = ($fe->attributes[FE_MAX_LENGTH] > 1) ? ALIGN_HORIZONTAL : ALIGN_VERTICAL; $radioClass = ($orientation === ALIGN_HORIZONTAL) ? 'radio-inline' : 'radio'; @@ -59,7 +59,7 @@ class Bootstrap3RadioButtonRenderer extends RadioButtonRenderer { $jj++; $optionHtmlAttributes = $fe->htmlAttributes; $optionHtmlAttributes[HTML_ATTR_ID] = HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], $ii); - $optionHtmlAttributes['value'] = $fe->itemKeys[$ii]; + $optionHtmlAttributes[HTML_ATTR_VALUE] = $fe->itemKeys[$ii]; $optionHtmlAttributes[ATTRIBUTE_DATA_REFERENCE] = $fe->attributes[FE_DATA_REFERENCE] . '-' . $ii; if ($fe->itemKeys[$ii] == $fe->value) { @@ -82,8 +82,8 @@ class Bootstrap3RadioButtonRenderer extends RadioButtonRenderer { } } - $wrapAttribute = Support::doAttribute('title', $fe->attributes[FE_TOOLTIP]); - $wrapAttribute .= Support::doAttribute('class', $radioClass); + $wrapAttribute = Support::doAttribute(HTML_ATTR_TITLE, $fe->attributes[FE_TOOLTIP]); + $wrapAttribute .= Support::doAttribute(HTML_ATTR_CLASS, $radioClass); $radioLabelId = HelperFormElement::getCheckboxRadioOptionId($fe->attributes[FE_HTML_ID], $ii, HTML_ID_EXTENSION_LABEL); $htmlElement = Support::wrapTag("<label $wrapAttribute $attributeBaseLabel id='$radioLabelId'>", $htmlElement) . $br; @@ -110,7 +110,7 @@ class Bootstrap3RadioButtonRenderer extends RadioButtonRenderer { $optionHtmlAttributes = $fe->htmlAttributes; $optionHtmlAttributes[HTML_ATTR_ID] = $fe->attributes[FE_HTML_ID] . '-' . $ii; - $optionHtmlAttributes['value'] = $fe->itemKeys[$ii]; + $optionHtmlAttributes[HTML_ATTR_VALUE] = $fe->itemKeys[$ii]; $optionHtmlAttributes[ATTRIBUTE_DATA_REFERENCE] = $fe->attributes[FE_DATA_REFERENCE] . '-' . $ii; if ($fe->itemKeys[$ii] == $fe->value) { @@ -131,8 +131,8 @@ class Bootstrap3RadioButtonRenderer extends RadioButtonRenderer { $htmlElement = '<input ' . Support::arrayToXMLAttributes($optionHtmlAttributes) . '>' . $fe->itemValues[$ii]; - $labelAttribute = Support::doAttribute('title', $fe->attributes[FE_TOOLTIP]); - $labelAttribute .= Support::doAttribute('class', 'btn ' . $fe->attributes[FE_BUTTON_CLASS] . $classReadonly . $classActive); + $labelAttribute = Support::doAttribute(HTML_ATTR_TITLE, $fe->attributes[FE_TOOLTIP]); + $labelAttribute .= Support::doAttribute(HTML_ATTR_CLASS, 'btn ' . $fe->attributes[FE_BUTTON_CLASS] . $classReadonly . $classActive); $htmlElement = Support::wrapTag("<label $labelAttribute>", $htmlElement); $html .= $htmlElement; diff --git a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SelectRenderer.php b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SelectRenderer.php index a5323fe1f7682c6cddf4b98c9ad1297536e8a113..7380f930b3d140ea4016385d2355adc28a7e994d 100644 --- a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SelectRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SelectRenderer.php @@ -98,9 +98,9 @@ class Bootstrap3SelectRenderer extends SelectRenderer { } $jsonValues[] = [ - 'value' => $fe->itemKeys[$ii], - 'text' => $fe->itemValues[$ii], - 'selected' => ($fe->itemKeys[$ii] == $fe->value && $firstSelect), + HTML_ATTR_VALUE => $fe->itemKeys[$ii], + HTML_ATTR_TEXT => $fe->itemValues[$ii], + HTML_ATTR_SELECTED => ($fe->itemKeys[$ii] == $fe->value && $firstSelect), ]; if (trim(strip_tags($fe->itemKeys[$ii])) == $fe->value && $firstSelect) { @@ -119,13 +119,13 @@ class Bootstrap3SelectRenderer extends SelectRenderer { //$json = $this->getFormElementForJson($htmlFormElementName, $jsonValues, $formElement, $wrapSetupClass); $fe->attributes = HelperFormElement::prepareExtraButton($fe->attributes, false); - if (isset($fe->attributes["datalist"])) { + if (isset($fe->attributes[HTML_ATTR_DATALIST])) { if ($fe->attributes[FE_DYNAMIC_UPDATE] === 'yes') { throw new \UserFormException("Datalist and dynamic update are not compatible", ERROR_NOT_IMPLEMENTED); } - $fe->htmlAttributes['list'] = $fe->attributes[FE_HTML_ID] . '-datalist'; + $fe->htmlAttributes[HTML_ATTR_LIST] = $fe->attributes[FE_HTML_ID] . '-datalist'; $html = '<input ' . Support::arrayToXMLAttributes($fe->htmlAttributes) . '><datalist ' - . Support::doAttribute('id', $fe->htmlAttributes['list']) . '>' . $option . '</datalist>'; + . Support::doAttribute(HTML_ATTR_ID, $fe->htmlAttributes[HTML_ATTR_LIST]) . '>' . $option . '</datalist>'; } else { // selectBS if ($selectBS) { diff --git a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SubrecordRenderer.php b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SubrecordRenderer.php index 1194347b0ae0c791c3dae1fe17419235ecf13d17..37bfbf43d94f62521e89d0f20c0e6ad38f7d2405 100644 --- a/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SubrecordRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/Bootstrap3/Bootstrap3SubrecordRenderer.php @@ -282,10 +282,10 @@ class Bootstrap3SubrecordRenderer extends \IMATHUZH\Qfq\Core\Renderer\FormElemen } elseif (isset($row[SUBRECORD_COLUMN_ROW_TITLE])) { // backward compatibility $rowTooltip = $row[SUBRECORD_COLUMN_ROW_TITLE]; } - $rowAttribute = Support::doAttribute('class', $rowClass); - $rowAttribute .= Support::doAttribute('title', $rowTooltip); + $rowAttribute = Support::doAttribute(HTML_ATTR_CLASS, $rowClass); + $rowAttribute .= Support::doAttribute(HTML_ATTR_TITLE, $rowTooltip); if ($fe->attributes[SUBRECORD_HAS_DRAG_AND_DROP]) { - $rowAttribute .= Support::doAttribute('id', $fe->attributes[FE_HTML_ID] . '-' . $row[$fe->attributes[SUBRECORD_NAME_COLUMN_ID]]); + $rowAttribute .= Support::doAttribute(HTML_ATTR_ID, $fe->attributes[FE_HTML_ID] . '-' . $row[$fe->attributes[SUBRECORD_NAME_COLUMN_ID]]); $rowAttribute .= Support::doAttribute('data-dnd-id', $row[$fe->attributes[SUBRECORD_NAME_COLUMN_ID]]); } $htmlBody .= Support::wrapTag("<tr $rowAttribute>", $rowHtml, true); diff --git a/extension/Classes/Core/Renderer/FormElement/FormElementRenderer.php b/extension/Classes/Core/Renderer/FormElement/FormElementRenderer.php index 73bdaf6b9fb81cc65e575735997842b8b57623e7..b771d660f459674b748b99c4e4e2d9b89859707f 100644 --- a/extension/Classes/Core/Renderer/FormElement/FormElementRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/FormElementRenderer.php @@ -33,7 +33,7 @@ abstract class FormElementRenderer { */ protected function renderFormEditorUrl(AbstractFormElement $fe): string { if (!$fe->form->showDebugInfoFlag) return ''; - $titleAttr = Support::doAttribute('title', $fe->formEditorTooltip); + $titleAttr = Support::doAttribute(HTML_ATTR_TITLE, $fe->formEditorTooltip); $icon = Support::wrapTag('<span class="' . GLYPH_ICON . ' ' . GLYPH_ICON_EDIT . '">', ''); return Support::wrapTag("<a class='hidden " . CLASS_FORM_ELEMENT_EDIT . "' href='" . $fe->formEditorUrl . "' $titleAttr>", $icon); } diff --git a/extension/Classes/Core/Renderer/FormElement/NativeRenderer.php b/extension/Classes/Core/Renderer/FormElement/NativeRenderer.php index 531f18e0cac7c085e6ff90bd14e8cf6281d0b29e..c75e92d69eb62f859c9e90b02efb786b0bb03e9c 100644 --- a/extension/Classes/Core/Renderer/FormElement/NativeRenderer.php +++ b/extension/Classes/Core/Renderer/FormElement/NativeRenderer.php @@ -139,15 +139,15 @@ abstract class NativeRenderer extends FormElementRenderer { } if ($wrapArray[0] != '') { - $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'id', $htmlId); - $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'class', $class); // might be problematic, if there is already a 'class' defined. + $wrapArray[0] = Support::insertAttribute($wrapArray[0], HTML_ATTR_ID, $htmlId); + $wrapArray[0] = Support::insertAttribute($wrapArray[0], HTML_ATTR_CLASS, $class); // might be problematic, if there is already a 'class' defined. if ($wrapName == FE_WRAP_LABEL) { - $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'style', 'text-align: ' . $formElement[F_FE_LABEL_ALIGN] . ';'); // might be problematic, if there is already a 'class' defined. + $wrapArray[0] = Support::insertAttribute($wrapArray[0], HTML_ATTR_STYLE, 'text-align: ' . $formElement[F_FE_LABEL_ALIGN] . ';'); // might be problematic, if there is already a 'class' defined. } // Insert 'required="required"' for checkboxes and radios if ($wrapName == FE_WRAP_INPUT && $formElement[FE_MODE] == FE_MODE_REQUIRED && ($formElement[FE_TYPE] == FE_TYPE_CHECKBOX || $formElement[FE_TYPE] == FE_TYPE_RADIO)) { - $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'required', 'required'); // might be problematic, if there is already a 'class' defined. + $wrapArray[0] = Support::insertAttribute($wrapArray[0], HTML_ATTR_REQUIRED, HTML_ATTR_REQUIRED); // might be problematic, if there is already a 'class' defined. } }