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

Fixed rendering of ' checkbox'. formelement.parameter['orientation'] removed...

Fixed rendering of ' checkbox'. formelement.parameter['orientation'] removed (replace by formelement.maxLength)
UserManual/index.rst: Doc updated for checkbox/maxlength.
AbstractBuildForm.php, Constants.php: class 'checkbox' and 'checkbox-inline' always rendered. Insert <br> where necessary.
parent 1f978fd0
...@@ -594,9 +594,9 @@ Class: Native ...@@ -594,9 +594,9 @@ Class: Native
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|tabindex | - | - | - | - | - | - | - | - | - | - | - | - | - | - | |tabindex | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|size | - 1 | | | | | - | | - | - 1| - 2 | | - 1 | - | - ? | |size | - | | | | | - | | - | - | - 2 | | - 1 | - | - ? |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|maxLength | | | | | | - | | - | | | | | | | |maxLength | 1 | | | | | - | | - | - 1 | | | | | |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
|note | - | - | - | | | - | - | - | - | - | - | - | - | - | |note | - | - | - | | | - | - | - | - | - | - | - | - | - |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
...@@ -624,7 +624,7 @@ Class: Native ...@@ -624,7 +624,7 @@ Class: Native
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| autofocus | - | - | - | | | - | | - | - | - | | - | - | - | | autofocus | - | - | - | | | - | | - | - | - | | - | - | - |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checkBoxMode | - | - | | | | | | | | | | | | | | checkBoxMode | - | - | | | | | | | | | | | | |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
| checked | - | | | | | - | | | - | | | | | | | checked | - | | | | | - | | | - | | | | | |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+ +------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+----------+---------+--------+
...@@ -681,13 +681,17 @@ Checkboxes can be rendered in mode: ...@@ -681,13 +681,17 @@ Checkboxes can be rendered in mode:
* *parameter* * *parameter*
* *checkBoxMode*: multi * *checkBoxMode*: multi
* *orientation*: vertical | horizontal (default), optional - the checkboxes are rendered horizontal or vertical.
* *itemList* - E.g.: * *itemList* - E.g.:
* ``itemList=red,blue,orange`` * ``itemList=red,blue,orange``
* ``itemList=1:red,2:blue,3:orange`` * ``itemList=1:red,2:blue,3:orange``
* ``itemList={{!SELECT id, value FROM someTable}}`` * ``itemList={{!SELECT id, value FROM someTable}}``
* FormElement '''Maxlength''' - vertical or horizontal alignment:
* Value: '', 0, 1 - The radios will be aligned vertical.
* Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.
Type: date Type: date
^^^^^^^^^^ ^^^^^^^^^^
...@@ -738,11 +742,10 @@ Type: radio ...@@ -738,11 +742,10 @@ Type: radio
* c) Definition of the *enum* or *set* field (only labels, no ids are possible). * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
* FormElement '''Maxlength''' - Vertical or Horizontal alignment: * FormElement '''Maxlength''' - *vertical* or *horizontal* alignment:
* '', 0, 1: Vertical.
* >1: every n'th elements a `<br>`.
* Value: '', 0, 1 - The radios will be aligned vertical.
* Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.
* FormElement.'''parameter''': * FormElement.'''parameter''':
......
...@@ -1056,6 +1056,9 @@ abstract class AbstractBuildForm { ...@@ -1056,6 +1056,9 @@ abstract class AbstractBuildForm {
* @return string * @return string
*/ */
public function buildCheckboxMulti(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue) { public function buildCheckboxMulti(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue) {
$orientation = '';
$br = '';
// Defines which of the checkboxes will be checked. // Defines which of the checkboxes will be checked.
$values = explode(',', $value); $values = explode(',', $value);
...@@ -1064,7 +1067,14 @@ abstract class AbstractBuildForm { ...@@ -1064,7 +1067,14 @@ abstract class AbstractBuildForm {
$html = $this->buildNativeHidden($htmlFormElementId, ''); $html = $this->buildNativeHidden($htmlFormElementId, '');
$orientation = (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] === 'vertical') ? '' : 'checkbox-inline'; if ($formElement['maxLength'] > 1) {
$orientation = 'checkbox-inline';
$checkboxClass = 'checkbox-inline';
} else {
$checkboxClass = 'checkbox';
}
// $orientation = (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] === 'vertical') ? '' : 'checkbox-inline';
$flagFirst = true; $flagFirst = true;
for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) { for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
...@@ -1085,19 +1095,30 @@ abstract class AbstractBuildForm { ...@@ -1085,19 +1095,30 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('checked', 'checked'); $attribute .= Support::doAttribute('checked', 'checked');
} }
$htmlCheckbox = '<input ' . $attribute . '>'; // '&nbsp;' - This is necessary to correctly align an empty input.
$htmlCheckbox .= $itemValue[$ii]; $value = ($itemValue[$ii] === '') ? '&nbsp;' : $itemValue[$ii];
$htmlCheckbox = Support::wrapTag("<label class='$orientation'>", $htmlCheckbox, true); $htmlElement = '<input ' . $attribute . '>' . $value;
if (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] === 'vertical')
$htmlCheckbox = Support::wrapTag("<div class='checkbox'>", $htmlCheckbox, true);
$html .= $htmlCheckbox; $htmlElement = Support::wrapTag("<label class='$orientation'>", $htmlElement, true);
} $htmlElement = Support::wrapTag("<div class='$checkboxClass'>", $htmlElement, true);
if ($formElement['maxLength'] > 1) {
if ($jj == $formElement['maxLength']) {
$jj = 0;
$br = '<br>';
} else {
$br = '';
}
}
if (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] !== 'vertical') $html .= $htmlElement . $br;
$html = Support::wrapTag("<div class='checkbox'>", $html, true); }
// if (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] !== 'vertical')
// $html = Support::wrapTag("<div class='checkbox'>", $html, true);
//
return $html; return $html;
} }
...@@ -1167,7 +1188,10 @@ abstract class AbstractBuildForm { ...@@ -1167,7 +1188,10 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('checked', 'checked'); $attribute .= Support::doAttribute('checked', 'checked');
} }
$element = '<input ' . $attribute . '>' . $itemValue[$ii]; // '&nbsp;' - This is necessary to correctly align an empty input.
$value = ($itemValue[$ii] === '') ? '&nbsp;' : $itemValue[$ii];
$htmlElement = '<input ' . $attribute . '>' . $value;
// $element = Support::wrapTag('<label>',$element); // $element = Support::wrapTag('<label>',$element);
...@@ -1185,9 +1209,9 @@ abstract class AbstractBuildForm { ...@@ -1185,9 +1209,9 @@ abstract class AbstractBuildForm {
} }
} }
$element = Support::wrapTag("<div class='$radioClass'>", $element) . $br; $htmlElement = Support::wrapTag("<div class='$radioClass'>", $htmlElement) . $br;
$html .= $element; $html .= $htmlElement;
} }
$json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]); $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
......
...@@ -345,7 +345,7 @@ const SYMBOL_DELETE = 'delete'; ...@@ -345,7 +345,7 @@ const SYMBOL_DELETE = 'delete';
//CHECKBOX //CHECKBOX
const CHECKBOX_VALUE_CHECKED = 'checked'; const CHECKBOX_VALUE_CHECKED = 'checked';
const CHECKBOX_VALUE_UNCHECKED = 'unchecked'; const CHECKBOX_VALUE_UNCHECKED = 'unchecked';
const CHECKBOX_ORIENTATION = 'orientation'; //const CHECKBOX_ORIENTATION = 'orientation';
// Subrecord // Subrecord
const SUBRECORD_COLUMN_WIDTH = 20; const SUBRECORD_COLUMN_WIDTH = 20;
......
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