Commit f1786d0b authored by Carsten  Rose's avatar Carsten Rose
Browse files

#2337 / Checkbox: checked/unchecked parameters genügen nicht

AbstractBuildForm.php: added 'elseif()' to accept missing set/enum/sql1 definition for checkbox is 'checked' is given.
parent a52192a4
......@@ -906,7 +906,7 @@ abstract class AbstractBuildForm {
}
// Check for input type 'textarea'.
$colsRows = explode(',', $formElement['size'], 2);
$colsRows = explode(',', $formElement[FE_SIZE], 2);
$flagTextarea = (count($colsRows) === 2);
// $formElement = HelperFormElement::prepareExtraButton($formElement, !$flagTextarea, $extraButton);
......@@ -927,7 +927,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeList($formElement, ['autocomplete', 'autofocus', 'placeholder']);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= $this->getInputCheckPattern($formElement[FE_CHECK_TYPE], $formElement[FE_CHECK_PATTERN]);
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE], false);
......@@ -1050,7 +1050,7 @@ abstract class AbstractBuildForm {
private function adjustMaxLength(array &$formElement) {
// MIN( $formElement['maxLength'], tabledefinition)
$maxLength = $this->getColumnSize($formElement['name']);
$maxLength = $this->getColumnSize($formElement[FE_NAME]);
switch ($formElement[FE_TYPE]) {
case 'date':
......@@ -1145,7 +1145,7 @@ abstract class AbstractBuildForm {
* Builds a HTML attribute list, based on $attributeList.
*
* E.g.: attributeList: [ 'type', 'autofocus' ]
* generates: 'type="$formElement[FE_TYPE]" autofocus="$formElement['autofocus']" '
* generates: 'type="$formElement[FE_TYPE]" autofocus="$formElement[FE_AUTOFOCUS]" '
*
* @param array $formElement
* @param array $attributeList
......@@ -1290,7 +1290,7 @@ abstract class AbstractBuildForm {
if ($formElement['checkBoxMode'] === 'multi') {
} else {
// Fill meaningfull defaults to parameter: checked|unchecked (CHECKBOX_VALUE_CHECKED|CHECKBOX_VALUE_UNCHECKED)
// Fill meaningful defaults to parameter: checked|unchecked (CHECKBOX_VALUE_CHECKED|CHECKBOX_VALUE_UNCHECKED)
$this->prepareCheckboxCheckedUncheckedValue($itemKey, $formElement);
}
......@@ -1324,36 +1324,36 @@ abstract class AbstractBuildForm {
* If there are no &$itemKey, copy &$itemValue to &$itemKey.
*
* @param array $formElement
* @param $itemKey
* @param $itemValue
* @param array $itemKey
* @param array $itemValue
* @throws CodeException
* @throws \qfq\UserFormException
*/
public function getKeyValueListFromSqlEnumSpec(array $formElement, &$itemKey, &$itemValue) {
public function getKeyValueListFromSqlEnumSpec(array $formElement, array &$itemKey, array &$itemValue) {
$fieldType = '';
$itemKey = array();
$itemValue = array();
// Call getItemsForEnumOrSet() only if there a corresponding column really exist.
if (false !== $this->store->getVar($formElement['name'], STORE_TABLE_COLUMN_TYPES)) {
$itemValue = $this->getItemsForEnumOrSet($formElement['name'], $fieldType);
if (false !== $this->store->getVar($formElement[FE_NAME], STORE_TABLE_COLUMN_TYPES)) {
$itemValue = $this->getItemsForEnumOrSet($formElement[FE_NAME], $fieldType);
}
if (is_array($formElement['sql1'])) {
if (count($formElement['sql1']) > 0) {
$keys = array_keys($formElement['sql1'][0]);
$itemKey = array_column($formElement['sql1'], 'id');
if (is_array($formElement[FE_SQL1])) {
if (count($formElement[FE_SQL1]) > 0) {
$keys = array_keys($formElement[FE_SQL1][0]);
$itemKey = array_column($formElement[FE_SQL1], 'id');
// If there is no column 'id' and at least two columns in total
if (count($itemKey) === 0 && count($keys) >= 2) {
$itemKey = array_column($formElement['sql1'], $keys[0]);
$itemKey = array_column($formElement[FE_SQL1], $keys[0]);
}
$itemValue = array_column($formElement['sql1'], 'label');
$itemValue = array_column($formElement[FE_SQL1], 'label');
// If there is no column 'label' (e.g.: SHOW tables)
if (count($itemValue) === 0) {
$idx = count($keys) == 1 ? 0 : 1;
$itemValue = array_column($formElement['sql1'], $keys[$idx]);
$itemValue = array_column($formElement[FE_SQL1], $keys[$idx]);
}
}
} elseif (isset($formElement['itemList']) && strlen($formElement['itemList']) > 0) {
......@@ -1361,7 +1361,9 @@ abstract class AbstractBuildForm {
$itemValue = array_values($arr);
$itemKey = array_keys($arr);
} elseif ($fieldType === 'enum' || $fieldType === 'set') {
// already done at the beginning with '$this->getItemsForEnumOrSet($formElement['name'], $fieldType);'
// already done at the beginning with '$this->getItemsForEnumOrSet($formElement[FE_NAME], $fieldType);'
} elseif (isset($formElement[FE_CHECKBOX_CHECKED]) && $formElement[FE_TYPE] == FE_TYPE_CHECKBOX) {
// Nothing to do here.
} else {
throw new UserFormException("Missing definition (- nothing found in 'sql1', 'parameter:itemList', 'enum-' or 'set-definition'", ERROR_MISSING_ITEM_LIST);
}
......@@ -1385,7 +1387,6 @@ abstract class AbstractBuildForm {
$itemValue[] = '';
$itemKey[] = '';
}
}
/**
......@@ -1441,27 +1442,27 @@ abstract class AbstractBuildForm {
*/
private function prepareCheckboxCheckedUncheckedValue(array $itemKey, array &$formElement) {
if (!isset($formElement[CHECKBOX_VALUE_CHECKED])) {
if (!isset($formElement[FE_CHECKBOX_CHECKED])) {
if (isset($itemKey[0])) {
// First element in $itemKey list
$formElement[CHECKBOX_VALUE_CHECKED] = $itemKey[0];
$formElement[FE_CHECKBOX_CHECKED] = $itemKey[0];
} else {
// Take column default value
$formElement[CHECKBOX_VALUE_CHECKED] = $this->store->getVar($formElement['name'], STORE_TABLE_DEFAULT);
$formElement[FE_CHECKBOX_CHECKED] = $this->store->getVar($formElement[FE_NAME], STORE_TABLE_DEFAULT);
}
}
// unchecked
if (!isset($formElement[CHECKBOX_VALUE_UNCHECKED])) {
if (!isset($formElement[FE_CHECKBOX_UNCHECKED])) {
if (isset($itemKey[1])) {
$formElement[CHECKBOX_VALUE_UNCHECKED] = ($itemKey[0] === $formElement['checked']) ? $itemKey[1] : $itemKey[0];
$formElement[FE_CHECKBOX_UNCHECKED] = ($itemKey[0] === $formElement[FE_CHECKBOX_CHECKED]) ? $itemKey[1] : $itemKey[0];
} else {
$formElement[CHECKBOX_VALUE_UNCHECKED] = '';
$formElement[FE_CHECKBOX_UNCHECKED] = '';
}
}
if ($formElement[CHECKBOX_VALUE_CHECKED] === $formElement[CHECKBOX_VALUE_UNCHECKED]) {
throw new UserFormException('FormElement: type=checkbox - checked and unchecked can\'t be the same: ' . $formElement[CHECKBOX_VALUE_CHECKED], ERROR_CHECKBOX_EQUAL);
if ($formElement[FE_CHECKBOX_CHECKED] === $formElement[FE_CHECKBOX_UNCHECKED]) {
throw new UserFormException('FormElement: type=checkbox - checked and unchecked can\'t be the same: ' . $formElement[FE_CHECKBOX_CHECKED], ERROR_CHECKBOX_EQUAL);
}
}
......@@ -1515,13 +1516,13 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('value', $formElement['checked'], false);
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('autocomplete', 'off');
$classActive = '';
if ($formElement['checked'] === $value) {
if ($formElement[FE_CHECKBOX_CHECKED] === $value) {
$attribute .= Support::doAttribute('checked', 'checked');
$valueJson = true;
$classActive = ' active';
......@@ -1530,7 +1531,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$htmlHidden = $this->buildNativeHidden($htmlFormElementName, $formElement['unchecked']);
$htmlHidden = $this->buildNativeHidden($htmlFormElementName, $formElement[FE_CHECKBOX_UNCHECKED]);
$this->store->setVar($htmlFormElementName, $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false);
$html = '';
......@@ -1572,11 +1573,11 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('value', $formElement['checked'], false);
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
if ($formElement['checked'] === $value) {
if ($formElement[FE_CHECKBOX_CHECKED] === $value) {
$attribute .= Support::doAttribute('checked', 'checked');
$valueJson = true;
}
......@@ -1584,7 +1585,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$htmlHidden = $this->buildNativeHidden($htmlFormElementName, $formElement['unchecked']);
$htmlHidden = $this->buildNativeHidden($htmlFormElementName, $formElement[FE_CHECKBOX_UNCHECKED]);
$this->store->setVar($htmlFormElementName, $htmlHidden, STORE_ADDITIONAL_FORM_ELEMENTS, false);
$html = '';
......@@ -1678,8 +1679,8 @@ abstract class AbstractBuildForm {
$html = '';
$attribute = $attributeBase;
if (isset($formElement['autofocus'])) {
$attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
if (isset($formElement[FE_AUTOFOCUS])) {
$attribute .= Support::doAttribute('autofocus', $formElement[FE_AUTOFOCUS]);
}
for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
......@@ -1763,8 +1764,8 @@ abstract class AbstractBuildForm {
// Do this only the first round.
if ($flagFirst) {
$flagFirst = false;
if (isset($formElement['autofocus']))
$attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
if (isset($formElement[FE_AUTOFOCUS]))
$attribute .= Support::doAttribute('autofocus', $formElement[FE_AUTOFOCUS]);
}
$attribute .= Support::doAttribute('value', $itemKey[$ii]);
......@@ -1910,8 +1911,8 @@ abstract class AbstractBuildForm {
$attributeBase .= Support::doAttribute('autocomplete', 'off');
$attribute = $attributeBase;
if (isset($formElement['autofocus'])) {
$attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
if (isset($formElement[FE_AUTOFOCUS])) {
$attribute .= Support::doAttribute('autofocus', $formElement[FE_AUTOFOCUS]);
}
$htmlHidden = $this->buildNativeHidden($htmlFormElementName, $value);
......@@ -1922,7 +1923,7 @@ abstract class AbstractBuildForm {
$classActive = '';
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
if ($itemKey[$ii] === $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -1994,8 +1995,8 @@ abstract class AbstractBuildForm {
$br = '';
$attribute = $attributeBase;
if (isset($formElement['autofocus'])) {
$attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
if (isset($formElement[FE_AUTOFOCUS])) {
$attribute .= Support::doAttribute('autofocus', $formElement[FE_AUTOFOCUS]);
}
......@@ -2005,7 +2006,7 @@ abstract class AbstractBuildForm {
$jj++;
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
if ($itemKey[$ii] === $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -2067,13 +2068,13 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('class', 'form-control');
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
if (isset($formElement['size']) && $formElement['size'] > 1) {
$attribute .= Support::doAttribute('size', $formElement['size']);
if (isset($formElement[FE_SIZE]) && $formElement[FE_SIZE] > 1) {
$attribute .= Support::doAttribute('size', $formElement[FE_SIZE]);
$attribute .= Support::doAttribute('multiple', 'multiple');
}
......@@ -2145,18 +2146,18 @@ abstract class AbstractBuildForm {
$linkNew = Support::wrapTag('<th>', $this->createFormLink($formElement, 0, $primaryRecord, $this->symbol[SYMBOL_NEW], 'New'));
// Decode settings in subrecordOption
$flagNew = Support::findInSet(SUBRECORD_NEW, $formElement['subrecordOption']);
$flagEdit = Support::findInSet(SUBRECORD_EDIT, $formElement['subrecordOption']);
if ($flagDelete = Support::findInSet(SUBRECORD_DELETE, $formElement['subrecordOption'])) {
$flagNew = Support::findInSet(SUBRECORD_NEW, $formElement[FE_SUBRECORD_OPTION]);
$flagEdit = Support::findInSet(SUBRECORD_EDIT, $formElement[FE_SUBRECORD_OPTION]);
if ($flagDelete = Support::findInSet(SUBRECORD_DELETE, $formElement[FE_SUBRECORD_OPTION])) {
$targetTableName = $this->getFormTable($formElement[SUBRECORD_PARAMETER_FORM]);
}
}
$columns = $linkNew;
if (isset($formElement['sql1'][0])) {
if (isset($formElement[FE_SQL1][0])) {
// construct column attributes
$control = $this->getSubrecordColumnControl(array_keys($formElement['sql1'][0]));
$control = $this->getSubrecordColumnControl(array_keys($formElement[FE_SQL1][0]));
// Subrecord: Column titles
$columns .= '<th>' . implode('</th><th>', $control['title']) . '</th>';
......@@ -2169,7 +2170,7 @@ abstract class AbstractBuildForm {
// Table head
$html = Support::wrapTag('<tr>', $columns);
foreach ($formElement['sql1'] as $row) {
foreach ($formElement[FE_SQL1] as $row) {
$rowHtml = '';
if ($flagEdit) {
......@@ -2236,27 +2237,27 @@ abstract class AbstractBuildForm {
return false;
}
if (!is_array($formElement['sql1'])) {
if (!is_array($formElement[FE_SQL1])) {
throw new UserFormException('Missing \'sql1\' Query', ERROR_MISSING_SQL1);
}
// No records?
if (count($formElement['sql1']) == 0) {
if (count($formElement[FE_SQL1]) == 0) {
$rcText = '';
return true;
}
// Check if $nameColumnId column exist.
if (!isset($formElement['sql1'][0][$nameColumnId])) {
if (!isset($formElement[FE_SQL1][0][$nameColumnId])) {
// no: try fallback.
$nameColumnId = '_id';
if (!isset($formElement['sql1'][0][$nameColumnId])) {
if (!isset($formElement[FE_SQL1][0][$nameColumnId])) {
throw new UserFormException('Missing column \'id\' or \'_id\' in subrecord query', ERROR_SUBRECORD_MISSING_COLUMN_ID);
}
}
if (!isset($formElement['sql1'][0][$nameColumnId])) {
if (!isset($formElement[FE_SQL1][0][$nameColumnId])) {
throw new UserFormException('Missing column \'id\' (or "_id") in \'sql1\' Query', ERROR_DB_MISSING_COLUMN_ID);
}
......@@ -2548,8 +2549,8 @@ abstract class AbstractBuildForm {
$arr = array();
$arr['fake_uniq_never_use_this'] = uniqid(); // make sure we get a new SIP. This is needed for multiple forms (same user) with r=0
$arr[CLIENT_SIP_FOR_FORM] = $this->store->getVar(SIP_SIP, STORE_SIP);
$arr[CLIENT_FE_NAME] = $formElement['name'];
$arr[CLIENT_FORM] = $this->formSpec['name'];
$arr[CLIENT_FE_NAME] = $formElement[FE_NAME];
$arr[CLIENT_FORM] = $this->formSpec[F_NAME];
$arr[CLIENT_RECORD_ID] = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
$arr[CLIENT_PAGE_ID] = 'fake';
$arr[EXISTING_PATH_FILE_NAME] = $value;
......@@ -2564,7 +2565,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('name', $htmlFormElementName);
// $attribute .= Support::doAttribute('class', 'form-control');
$attribute .= Support::doAttribute('type', 'file');
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute(FE_FILE_CAPTURE, $formElement[FE_FILE_CAPTURE], true);
$attribute .= $this->getAttributeList($formElement, [FE_AUTOFOCUS, FE_FILE_MIME_TYPE_ACCEPT]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
......@@ -2668,7 +2669,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('value', htmlentities($value), false);
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
if ($formElement['placeholder'] == '') {
if ($formElement[FE_PLACEHOLDER] == '') {
$timePattern = ($formElement[FE_SHOW_SECONDS] == 1) ? 'hh:mm:ss' : 'hh:mm';
switch ($formElement[FE_TYPE]) {
case 'date':
......@@ -2683,12 +2684,12 @@ abstract class AbstractBuildForm {
default:
throw new UserFormException("Unexpected Formelement type: '" . $formElement[FE_TYPE] . "'", ERROR_FORMELEMENT_TYPE);
}
$formElement['placeholder'] = $placeholder;
$formElement[FE_PLACEHOLDER] = $placeholder;
}
$attribute .= $this->getAttributeList($formElement, ['autocomplete', 'autofocus', 'placeholder']);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('title', $formElement['tooltip']);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= $this->getInputCheckPattern($formElement[FE_CHECK_TYPE], $formElement[FE_CHECK_PATTERN]);
if (is_array($arrMinMax)) {
......@@ -2725,7 +2726,7 @@ abstract class AbstractBuildForm {
public function buildDateJQW(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
$arrMinMax = null;
// if ($formElement['placeholder'] == '') {
// if ($formElement[FE_PLACEHOLDER] == '') {
// $timePattern = ($formElement[FE_SHOW_SECONDS] == 1) ? 'hh:mm:ss' : 'hh:mm';
// switch ($formElement[FE_TYPE]) {
// case 'date':
......@@ -2740,7 +2741,7 @@ abstract class AbstractBuildForm {
// default:
// throw new UserFormException("Unexpected Formelement type: '" . $formElement[FE_TYPE] . "'", ERROR_FORMELEMENT_TYPE);
// }
// $formElement['placeholder'] = $placeholder;
// $formElement[FE_PLACEHOLDER] = $placeholder;
// }
// switch ($formElement['checkType']) {
......@@ -2773,11 +2774,11 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('data-control-name', "$htmlFormElementName");
$attribute .= Support::doAttribute('data-format-string', "dd.MM.yyyy HH:mm");
$attribute .= Support::doAttribute('data-show-time-button', "true");
// $attribute .= Support::doAttribute('data-placeholder', $formElement['placeholder']);
// $attribute .= Support::doAttribute('data-placeholder', $formElement[FE_PLACEHOLDER]);
$attribute .= Support::doAttribute('data-value', htmlentities($value), false);
// $attribute .= Support::doAttribute('data-autofocus', $formElement['autofocus']);
// $attribute .= Support::doAttribute('data-autofocus', $formElement[FE_AUTOFOCUS]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('data-title', $formElement['tooltip']);
$attribute .= Support::doAttribute('data-title', $formElement[FE_TOOLTIP]);
// if (is_array($arrMinMax)) {
// $attribute .= Support::doAttribute('data-min', $arrMinMax[0]);
......@@ -2818,10 +2819,10 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('class', 'qfq-tinymce');
$attribute .= Support::doAttribute('data-control-name', "$htmlFormElementName");
$attribute .= Support::doAttribute('data-placeholder', $formElement['placeholder']);
// $attribute .= Support::doAttribute('data-autofocus', $formElement['autofocus']);
$attribute .= Support::doAttribute('data-placeholder', $formElement[FE_PLACEHOLDER]);
// $attribute .= Support::doAttribute('data-autofocus', $formElement[FE_AUTOFOCUS]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('data-title', $formElement['tooltip']);
$attribute .= Support::doAttribute('data-title', $formElement[FE_TOOLTIP]);
$formElement = $this->setEditorConfig($formElement, $htmlFormElementName);
// $formElement['editor-plugins']='autoresize code'
......@@ -2869,12 +2870,12 @@ abstract class AbstractBuildForm {
}
// autofocus
if (isset($formElement['autofocus']) && $formElement['autofocus'] == 'yes') {
if (isset($formElement[FE_AUTOFOCUS]) && $formElement[FE_AUTOFOCUS] == 'yes') {
$formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementName;
}
// Check for min_height, max_height
$minMax = explode(',', $formElement['size'], 2);
$minMax = explode(',', $formElement[FE_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];
}
......@@ -3007,7 +3008,7 @@ abstract class AbstractBuildForm {
// child FE's
$this->feSpecNative = $this->db->getNativeFormElements(SQL_FORM_ELEMENT_SPECIFIC_CONTAINER,
['yes', $this->formSpec["id"], 'native,container', $formElement['id']], $this->formSpec);
['yes', $this->formSpec["id"], 'native,container', $formElement[FE_ID]], $this->formSpec);
$html .= $this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP), FORM_ELEMENTS_NATIVE_SUBRECORD, 0, $json);
......
......@@ -573,10 +573,6 @@ const SYMBOL_EDIT = 'edit';
const SYMBOL_DELETE = 'delete';
//CHECKBOX
const CHECKBOX_VALUE_CHECKED = 'checked';
const CHECKBOX_VALUE_UNCHECKED = 'unchecked';
//const CHECKBOX_ORIENTATION = 'orientation';
const ALIGN_HORIZONTAL = 'horizontal';
const ALIGN_VERTICAL = 'vertical';
......@@ -696,6 +692,11 @@ const FE_PARAMETER = 'parameter';
const FE_ENCODE = 'encode';
const FE_CHECK_TYPE = 'checkType';
const FE_CHECK_PATTERN = 'checkPattern';
const FE_TOOLTIP = 'tooltip';
const FE_SIZE = 'size';
const FE_SUBRECORD_OPTION = 'subrecordOption';
const FE_SQL1 = 'sql1';
const FE_PLACEHOLDER = 'placeholder';
// FormElement columns: via parameter field
const FE_DATE_FORMAT = 'dateFormat'; // value: FORMAT_DATE_INTERNATIONAL | FORMAT_DATE_GERMAN
......@@ -771,6 +772,9 @@ const FE_INPUT_EXTRA_BUTTON_LOCK = 'extraButtonLock';
const FE_INPUT_EXTRA_BUTTON_PASSWORD = 'extraButtonPassword';
const FE_INPUT_EXTRA_BUTTON_INFO = 'extraButtonInfo';
const FE_TMP_EXTRA_BUTTON_HTML = '_extraButtonHtml'; // will be filled on the fly during building extrabutton
const FE_CHECKBOX_CHECKED = 'checked';
const FE_CHECKBOX_UNCHECKED = 'unchecked';
const RETYPE_FE_NAME_EXTENSION = 'RETYPE';
......@@ -798,7 +802,6 @@ const FE_TYPE_EXTRA = 'extra';
const FE_TYPE_SUBRECORD = 'subrecord';
const FE_TYPE_NOTE = 'note';
const FE_TYPE_SENDMAIL = 'sendMail';
const FE_TYPE_BEFORE_LOAD = 'beforeLoad';
const FE_TYPE_BEFORE_SAVE = 'beforeSave';
......
......@@ -366,6 +366,8 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$build = new \qfq\BuildFormPlain($form, array(), [$formElement]);
$formElement['name'] = 'noteInternal';
$keys = array();
$values = array();
$build->getKeyValueListFromSqlEnumSpec($formElement, $keys, $values);
}
......
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