Commit 4597470e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixed bug computing maxlenght. Added formelement.modeSql to fictures,

FillStoreForm.php: fixed typo.
AbstractBuildForm.php: fixed broken if statement.
TestFormEditor.sql: extend formElement.modeSql.
parent a126f2b6
......@@ -662,7 +662,7 @@ abstract class AbstractBuildForm {
// date/datetime
if ($maxLength !== false) {
if (is_numeric($formElement['maxLength'] && $formElement['maxLength'] != '0')) {
if (is_numeric($formElement['maxLength']) && $formElement['maxLength'] != 0) {
if ($formElement['maxLength'] > $maxLength) {
$formElement['maxLength'] = $maxLength;
}
......
......@@ -88,7 +88,7 @@ class FillStoreForm {
// Retrieve SIP vars, e.g. for HIDDEN elements.
$sipValues = $this->store->getStore(STORE_SIP);
// Copy SIP Values; not necessarily defines as FormElements.
// Copy SIP Values; not necessarily defined as a FormElement.
foreach ($sipValues as $key => $value) {
switch ($key) {
case SIP_SIP:
......
......@@ -64,6 +64,7 @@ CREATE TABLE IF NOT EXISTS `FormElement` (
`label` VARCHAR(255) NOT NULL DEFAULT '',
`mode` ENUM('show', 'readonly', 'required', 'lock', 'disabled') NOT NULL DEFAULT 'show',
`modeSql` TEXT NOT NULL,
`class` ENUM('native', 'action', 'container') NOT NULL DEFAULT 'native',
`type` ENUM('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'gridJQW', 'hidden', 'text', 'time',
'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill',
......@@ -126,42 +127,42 @@ INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, r
'Form', 'always', 'always', 'bootstrap', '', 'maxVisiblePill=3');
# FormEditor: FormElements
INSERT INTO FormElement (formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer)
INSERT INTO FormElement (formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, modeSql)
VALUES
(1, 'basic', 'Basic', 'show', 'pill', 'container', 10, 0, 0, '', '', '', '', '', '', 0),
(1, 'permission', 'Permission', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0),
(1, 'various', 'Various', 'show', 'pill', 'container', 30, 0, 0, '', '', '', '', '', '', 0),
(1, 'formelement', 'Formelement', 'show', 'pill', 'container', 40, 0, 0, '', '', '', '', '', '', 0),
(1, 'id', 'id', 'readonly', 'text', 'native', 100, 10, 11, '', '', '', '', '', '', 1),
(1, 'name', 'Name', 'show', 'text', 'native', 120, 40, 255, '', '', '', '', '', 'autofocus=on', 1),
(1, 'title', 'Title', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 1),
(1, 'noteInternal', 'Note', 'show', 'text', 'native', 140, '40,3', 0, '', '', '', '', '', '', 1),
(1, 'tableName', 'Table', 'required', 'select', 'native', 150, 0, 0, '', '', '', '{{!SHOW tables}}', '', 'emptyItemAtStart', 1),
(1, 'permitNew', 'Permit New', 'show', 'radio', 'native', 160, 0, 0, '', '', '', '', '', '', 2),
(1, 'permitEdit', 'Permit Edit', 'show', 'radio', 'native', 170, 0, 0, '', '', '', '', '', '', 2),
(1, 'permitUrlParameter', 'Permit Url Parameter', 'show', 'text', 'native', 180, 40, 255, '', '', '', '', '', '', 2),
(1, 'render', 'Render', 'show', 'radio', 'native', 190, 0, 0, '', '', '', '', '', '', 2),
(1, 'multi', 'Multi', 'show', 'fieldset', 'native', 210, 0, 0, '', '', '', '', '', '', 3),
(1, 'multiMode', 'Multi Mode', 'show', 'radio', 'native', 220, 0, 0, '', '', '', '', '', '', 3),
(1, 'multiSql', 'Multi SQL', 'show', 'text', 'native', 230, '40,3', 0, '', '', '', '', '', '', 3),
(1, 'multiDetailForm', 'Multi Detail Form', 'show', 'text', 'native', 240, 40, 255, '', '', '', '', '', '', 3),
(1, 'multiDetailFormParameter', 'Multi Detail Form Parameter', 'show', 'text', 'native', 250, 40, 255, '', '', '', '', '', '', 3),
(1, 'forwardMode', 'Forward', 'show', 'radio', 'native', 260, 0, 0, '', '', '', '', '', '', 3),
(1, 'forwardPage', 'Forward Page', 'show', 'text', 'native', 270, 40, 255, '', '', '', '', '', '', 3),
(1, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'native', 280, 40, 250, '', '', '', '', '', '', 3),
(1, 'bsInputColumns', 'BS Input Columns', 'show', 'text', 'native', 290, 40, 250, '', '', '', '', '', '', 3),
(1, 'bsNoteColumns', 'BS Note Columns', 'show', 'text', 'native', 300, 40, 250, '', '', '', '', '', '', 3),
(1, 'deleted', 'Deleted', 'show', 'checkbox', 'native', 400, 0, 0, '', '', '', '', '', '', 3),
(1, 'modified', 'Modified', 'readonly', 'text', 'native', 410, 40, 20, '', '', '', '', '', '', 3),
(1, 'created', 'Created', 'readonly', 'text', 'native', 420, 40, 20, '', '', '', '', '', '', 3),
(1, 'basic', 'Basic', 'show', 'pill', 'container', 10, 0, 0, '', '', '', '', '', '', 0, ''),
(1, 'permission', 'Permission', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, ''),
(1, 'various', 'Various', 'show', 'pill', 'container', 30, 0, 0, '', '', '', '', '', '', 0, ''),
(1, 'formelement', 'Formelement', 'show', 'pill', 'container', 40, 0, 0, '', '', '', '', '', '', 0, ''),
(1, 'id', 'id', 'readonly', 'text', 'native', 100, 10, 11, '', '', '', '', '', '', 1, ''),
(1, 'name', 'Name', 'show', 'text', 'native', 120, 40, 255, '', '', '', '', '', 'autofocus=on', 1, ''),
(1, 'title', 'Title', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 1, ''),
(1, 'noteInternal', 'Note', 'show', 'text', 'native', 140, '40,3', 0, '', '', '', '', '', '', 1, ''),
(1, 'tableName', 'Table', 'required', 'select', 'native', 150, 0, 0, '', '', '', '{{!SHOW tables}}', '', 'emptyItemAtStart', 1, ''),
(1, 'permitNew', 'Permit New', 'show', 'radio', 'native', 160, 0, 0, '', '', '', '', '', '', 2, ''),
(1, 'permitEdit', 'Permit Edit', 'show', 'radio', 'native', 170, 0, 0, '', '', '', '', '', '', 2, ''),
(1, 'permitUrlParameter', 'Permit Url Parameter', 'show', 'text', 'native', 180, 40, 255, '', '', '', '', '', '', 2, ''),
(1, 'render', 'Render', 'show', 'radio', 'native', 190, 0, 0, '', '', '', '', '', '', 2, ''),
(1, 'multi', 'Multi', 'show', 'fieldset', 'native', 210, 0, 0, '', '', '', '', '', '', 3, ''),
(1, 'multiMode', 'Multi Mode', 'show', 'radio', 'native', 220, 0, 0, '', '', '', '', '', '', 3, ''),
(1, 'multiSql', 'Multi SQL', 'show', 'text', 'native', 230, '40,3', 0, '', '', '', '', '', '', 3, ''),
(1, 'multiDetailForm', 'Multi Detail Form', 'show', 'text', 'native', 240, 40, 255, '', '', '', '', '', '', 3, ''),
(1, 'multiDetailFormParameter', 'Multi Detail Form Parameter', 'show', 'text', 'native', 250, 40, 255, '', '', '', '', '', '', 3, ''),
(1, 'forwardMode', 'Forward', 'show', 'radio', 'native', 260, 0, 0, '', '', '', '', '', '', 3, ''),
(1, 'forwardPage', 'Forward Page', 'show', 'text', 'native', 270, 40, 255, '', '', '', '', '', '', 3, ''),
(1, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'native', 280, 40, 250, '', '', '', '', '', '', 3, ''),
(1, 'bsInputColumns', 'BS Input Columns', 'show', 'text', 'native', 290, 40, 250, '', '', '', '', '', '', 3, ''),
(1, 'bsNoteColumns', 'BS Note Columns', 'show', 'text', 'native', 300, 40, 250, '', '', '', '', '', '', 3, ''),
(1, 'deleted', 'Deleted', 'show', 'checkbox', 'native', 400, 0, 0, '', '', '', '', '', '', 3, ''),
(1, 'modified', 'Modified', 'readonly', 'text', 'native', 410, 40, 20, '', '', '', '', '', '', 3, ''),
(1, 'created', 'Created', 'readonly', 'text', 'native', 420, 40, 20, '', '', '', '', '', '', 3, ''),
(1, '', 'FormElements', 'show', 'subrecord', 'native', 500, 0, 0, '', '', '',
'{{!SELECT * FROM FormElement WHERE formId={{id:R0}}}}',
'', 'form=formElement\npage=form.php', 4);
'', 'form=formElement\npage=form.php', 4, '');
#
......@@ -172,45 +173,45 @@ INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, r
'FormElement', 'always', 'always', 'bootstrap', '', 'maxVisiblePill=3');
# FormEditor: FormElements
INSERT INTO FormElement (id, formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, debug)
INSERT INTO FormElement (id, formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, debug, modeSql)
VALUES
(100, 2, 'basic', 'Basic', 'show', 'pill', 'container', 10, 0, 0, '', '', '', '', '', '', 0, 'no'),
(101, 2, 'check_order', 'Check & Order', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no'),
(102, 2, 'layout', 'Layout', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no'),
(103, 2, 'value', 'Value', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no'),
(104, 2, 'info', 'Info', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no'),
(100, 2, 'basic', 'Basic', 'show', 'pill', 'container', 10, 0, 0, '', '', '', '', '', '', 0, 'no', ''),
(101, 2, 'check_order', 'Check & Order', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no', ''),
(102, 2, 'layout', 'Layout', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no', ''),
(103, 2, 'value', 'Value', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no', ''),
(104, 2, 'info', 'Info', 'show', 'pill', 'container', 20, 0, 0, '', '', '', '', '', '', 0, 'no', ''),
(110, 2, 'id', 'id', 'readonly', 'text', 'native', 100, 10, 11, '', '', '', '', '', '', 100, 'no'),
(111, 2, 'formId', 'formId', 'readonly', 'text', 'native', 120, 40, 255, '', '', '', '', '', '', 100, 'no'),
(110, 2, 'id', 'id', 'readonly', 'text', 'native', 100, 10, 11, '', '', '', '', '', '', 100, 'no', ''),
(111, 2, 'formId', 'formId', 'readonly', 'text', 'native', 120, 40, 255, '', '', '', '', '', '', 100, 'no', ''),
(112, 2, 'feIdContainer', 'Container', 'show', 'select', 'native', 150, 0, 0, '', '', '',
'{{!SELECT fe.id, CONCAT(fe.class, " / ", fe.label) FROM FormElement As fe WHERE fe.formId={{id}} AND fe.class="container" ORDER BY fe.ord }}',
'', 'emptyItemAtStart', 100, 'no'),
(113, 2, 'enabled', 'Enabled', 'show', 'checkbox', 'native', 120, 0, 0, '', '', '', '', '', '', 100, 'no'),
(114, 2, 'name', 'Name', 'show', 'text', 'native', 120, 40, 255, '', '', '', '', '', '', 100, 'no'),
(115, 2, 'label', 'Label', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 100, 'no'),
(116, 2, 'mode', 'Mode', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no'),
(117, 2, 'class', 'Class', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no'),
(118, 2, 'type', 'Type', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no'),
(119, 2, 'checkType', 'Check Type', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 101, 'no'),
(120, 2, 'checkPattern', 'Check Pattern', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no'),
(121, 2, 'onChange', 'JS onChange', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no'),
(122, 2, 'ord', 'Order', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no'),
(123, 2, 'tabindex', 'tabindex', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no'),
(124, 2, 'size', 'Size', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(125, 2, 'maxlenght', 'Maxlength', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(126, 2, 'note', 'note', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(127, 2, 'tooltip', 'Tooltip', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(128, 2, 'placeholder', 'Placeholder', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(129, 2, 'value', 'value', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no'),
(130, 2, 'sql1', 'sql1', 'show', 'text', 'native', 130, '40,4', 255, '', '', '', '', '', '', 103, 'no'),
(131, 2, 'parameter', 'Parameter', 'show', 'text', 'native', 130, '40,4', 255, '', '', '', '', '', '', 103, 'no'),
(132, 2, 'clientJs', 'ClientJS', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 103, 'no'),
(133, 2, 'feGroup', 'feGroup', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 104, 'no'),
(134, 2, 'debug', 'Debug', 'show', 'checkbox', 'native', 130, 0, 0, '', '', '', '', '', '', 104, 'no'),
(135, 2, 'deleted', 'Deleted', 'show', 'checkbox', 'native', 400, 0, 0, '', '', '', '', '', '', 104, 'no'),
(136, 2, 'modified', 'Modified', 'readonly', 'text', 'native', 410, 40, 20, '', '', '', '', '', '', 104, 'no'),
(137, 2, 'created', 'Created', 'readonly', 'text', 'native', 420, 40, 20, '', '', '', '', '', '', 104, 'no');
'', 'emptyItemAtStart', 100, 'no', ''),
(113, 2, 'enabled', 'Enabled', 'show', 'checkbox', 'native', 120, 0, 0, '', '', '', '', '', '', 100, 'no', ''),
(114, 2, 'name', 'Name', 'show', 'text', 'native', 120, 40, 255, '', '', '', '', '', '', 100, 'no', ''),
(115, 2, 'label', 'Label', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 100, 'no', ''),
(116, 2, 'mode', 'Mode', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no', ''),
(117, 2, 'class', 'Class', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no', ''),
(118, 2, 'type', 'Type', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 100, 'no', ''),
(119, 2, 'checkType', 'Check Type', 'show', 'select', 'native', 120, 0, 255, '', '', '', '', '', '', 101, 'no', ''),
(120, 2, 'checkPattern', 'Check Pattern', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no', ''),
(121, 2, 'onChange', 'JS onChange', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no', ''),
(122, 2, 'ord', 'Order', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no', ''),
(123, 2, 'tabindex', 'tabindex', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 101, 'no', ''),
(124, 2, 'size', 'Size', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(125, 2, 'maxlenght', 'Maxlength', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(126, 2, 'note', 'note', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(127, 2, 'tooltip', 'Tooltip', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(128, 2, 'placeholder', 'Placeholder', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(129, 2, 'value', 'value', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 102, 'no', ''),
(130, 2, 'sql1', 'sql1', 'show', 'text', 'native', 130, '40,4', 255, '', '', '', '', '', '', 103, 'no', ''),
(131, 2, 'parameter', 'Parameter', 'show', 'text', 'native', 130, '40,4', 255, '', '', '', '', '', '', 103, 'no', ''),
(132, 2, 'clientJs', 'ClientJS', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 103, 'no', ''),
(133, 2, 'feGroup', 'feGroup', 'show', 'text', 'native', 130, 40, 255, '', '', '', '', '', '', 104, 'no', ''),
(134, 2, 'debug', 'Debug', 'show', 'checkbox', 'native', 130, 0, 0, '', '', '', '', '', '', 104, 'no', ''),
(135, 2, 'deleted', 'Deleted', 'show', 'checkbox', 'native', 400, 0, 0, '', '', '', '', '', '', 104, 'no', ''),
(136, 2, 'modified', 'Modified', 'readonly', 'text', 'native', 410, 40, 20, '', '', '', '', '', '', 104, 'no', ''),
(137, 2, 'created', 'Created', 'readonly', 'text', 'native', 420, 40, 20, '', '', '', '', '', '', 104, 'no', '');
# FormEditor: Small
......@@ -221,8 +222,8 @@ INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, r
'Person', 'always', 'always', 'bootstrap', '', '');
# FormEditor: FormElements
INSERT INTO FormElement (id, formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, debug)
INSERT INTO FormElement (id, formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, debug, modeSql)
VALUES
(200, 3, 'name', 'Name', 'show', 'text', 'native', 10, 50, 255, '', '', '', '', '', '', 0, 'no'),
(201, 3, 'firstName', 'Firstname', 'show', 'text', 'native', 10, 50, 255, '', '', '', '', '', '', 0, 'no');
(200, 3, 'name', 'Name', 'show', 'text', 'native', 10, 50, 255, '', '', '', '', '', '', 0, 'no', ''),
(201, 3, 'firstName', 'Firstname', 'show', 'text', 'native', 10, 50, 255, '', '', '', '', '', '', 0, 'no', '');
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