formEditor.sql 43 KB
Newer Older
1
2
3
4
# Before MariaDB 10.2.1, 'text' column could not have a 'default' value.
# To not be forced to specify each text column on INSERT() statements, switch off strict checking:
SET sql_mode = "NO_ENGINE_SUBSTITUTION";

Carsten  Rose's avatar
Carsten Rose committed
5
6
7
8
9
CREATE TABLE IF NOT EXISTS `Form`
(
  `id`                       INT(11)                                                     NOT NULL AUTO_INCREMENT,
  `name`                     VARCHAR(255)                                                NOT NULL DEFAULT '',
  `title`                    VARCHAR(511)                                                NOT NULL DEFAULT '',
10
11
12
13
14
15
16
17
18
19
20
21
  `noteInternal`          TEXT                                                       NOT NULL,
  `tableName`             VARCHAR(255)                                               NOT NULL DEFAULT '',
  `primaryKey`            VARCHAR(255)                                               NOT NULL DEFAULT '',

  `permitNew`             ENUM ('sip', 'logged_in', 'logged_out', 'always', 'never') NOT NULL DEFAULT 'sip',
  `permitEdit`            ENUM ('sip', 'logged_in', 'logged_out', 'always', 'never') NOT NULL DEFAULT 'sip',
  `restMethod`            SET ('get', 'post', 'put', 'delete')                       NOT NULL DEFAULT '',
  `escapeTypeDefault`     VARCHAR(32)                                                NOT NULL DEFAULT 'c',
  `render`                ENUM ('bootstrap', 'table', 'plain')                       NOT NULL DEFAULT 'bootstrap',
  `requiredParameterNew`  VARCHAR(255)                                               NOT NULL DEFAULT '',
  `requiredParameterEdit` VARCHAR(255)                                               NOT NULL DEFAULT '',
  `dirtyMode`             ENUM ('exclusive', 'advisory', 'none')                     NOT NULL DEFAULT 'exclusive',
Carsten  Rose's avatar
Carsten Rose committed
22
23
  `showButton`               SET ('new', 'delete', 'close', 'save')                      NOT NULL DEFAULT 'new,delete,close,save',
  `multiMode`                ENUM ('none', 'horizontal', 'vertical')                     NOT NULL DEFAULT 'none',
24
  `multiSql`                 TEXT                                                        NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
25
26
  `multiDetailForm`          VARCHAR(255)                                                NOT NULL DEFAULT '',
  `multiDetailFormParameter` VARCHAR(255)                                                NOT NULL DEFAULT '',
27

Carsten  Rose's avatar
Carsten Rose committed
28
29
  `forwardMode`              ENUM ('client', 'no', 'url', 'url-skip-history', 'url-sip') NOT NULL DEFAULT 'client',
  `forwardPage`              VARCHAR(255)                                                NOT NULL DEFAULT '',
30

31
  `labelAlign`               ENUM ('default', 'left', 'center', 'right')                 NOT NULL DEFAULT 'default',
Carsten  Rose's avatar
Carsten Rose committed
32
33
34
  `bsLabelColumns`           VARCHAR(255)                                                NOT NULL DEFAULT '',
  `bsInputColumns`           VARCHAR(255)                                                NOT NULL DEFAULT '',
  `bsNoteColumns`            VARCHAR(255)                                                NOT NULL DEFAULT '',
35
36
37
38
39
40

  `parameter`                TEXT                                                        NOT NULL,
  `parameterLanguageA`       TEXT                                                        NOT NULL,
  `parameterLanguageB`       TEXT                                                        NOT NULL,
  `parameterLanguageC`       TEXT                                                        NOT NULL,
  `parameterLanguageD`       TEXT                                                        NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
41
  `recordLockTimeoutSeconds` INT(11)                                                     NOT NULL DEFAULT 900,
42

Carsten  Rose's avatar
Carsten Rose committed
43
44
45
46
  `deleted`                  ENUM ('yes', 'no')                                          NOT NULL DEFAULT 'no',
  `modified`                 TIMESTAMP                                                   NOT NULL DEFAULT CURRENT_TIMESTAMP
    ON UPDATE CURRENT_TIMESTAMP,
  `created`                  DATETIME                                                    NOT NULL DEFAULT '0000-00-00 00:00:00',
47

48
49
50
51
52
53
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `name_deleted` (`name`, `deleted`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
54
  AUTO_INCREMENT = 1000;
55

56

Carsten  Rose's avatar
Carsten Rose committed
57
58
CREATE TABLE IF NOT EXISTS `FormElement`
(
59
60
61
62
  `id`                 INT(11)                                                                    NOT NULL AUTO_INCREMENT,
  `formId`             INT(11)                                                                    NOT NULL,
  `feIdContainer`      INT(11)                                                                    NOT NULL DEFAULT '0',
  `dynamicUpdate`      ENUM ('yes', 'no')                                                         NOT NULL DEFAULT 'no',
63

64
  `enabled`            ENUM ('yes', 'no')                                                         NOT NULL DEFAULT 'yes',
65

66
  `name`               VARCHAR(255)                                                               NOT NULL DEFAULT '',
67
  `label`              VARCHAR(511)                                    NOT NULL DEFAULT '',
68

69
70
71
  `mode`               ENUM ('show', 'required', 'readonly', 'hidden') NOT NULL DEFAULT 'show',
  `modeSql`            TEXT                                            NOT NULL,
  `class`              ENUM ('native', 'action', 'container')          NOT NULL DEFAULT 'native',
72
  `type`               ENUM ('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text',
73
74
75
76
77
78
79
                             'editor', 'annotate', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload',
                             'annotate', 'imageCut', 'fieldset', 'pill', 'templateGroup',
                             'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad',
                             'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendMail',
                             'paste')                                  NOT NULL DEFAULT 'text',
  `subrecordOption`    SET ('edit', 'delete', 'new')                   NOT NULL DEFAULT '',
  `encode`             ENUM ('none', 'specialchar')                    NOT NULL DEFAULT 'specialchar',
Carsten  Rose's avatar
Carsten Rose committed
80
  `checkType`          ENUM ('auto', 'alnumx', 'digit', 'numerical', 'email', 'pattern', 'allbut',
81
82
                             'all')                                    NOT NULL DEFAULT 'auto',
  `checkPattern`       VARCHAR(255)                                    NOT NULL DEFAULT '',
83

84
  `onChange`           VARCHAR(255)                                    NOT NULL DEFAULT '',
85

86
87
  `ord`                INT(11)                                         NOT NULL DEFAULT '0',
  `tabindex`           INT(11)                                         NOT NULL DEFAULT '0',
88

89
  `size`               VARCHAR(255)                                    NOT NULL DEFAULT '',
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  `maxLength`          VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `labelAlign`         ENUM ('default', 'left', 'center', 'right')                                NOT NULL DEFAULT 'default',
  `bsLabelColumns`     VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `bsInputColumns`     VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `bsNoteColumns`      VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `rowLabelInputNote`  SET ('row', 'label', '/label', 'input', '/input', 'note', '/note', '/row') NOT NULL DEFAULT 'row,label,/label,input,/input,note,/note,/row',
  `note`               TEXT                                                                       NOT NULL,
  `adminNote`          TEXT                                                                       NOT NULL,
  `tooltip`            VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `placeholder`        VARCHAR(2048)                                                              NOT NULL DEFAULT '',

  `value`              TEXT                                                                       NOT NULL,
  `sql1`               TEXT                                                                       NOT NULL,
  `parameter`          TEXT                                                                       NOT NULL,
  `parameterLanguageA` TEXT                                                                       NOT NULL,
  `parameterLanguageB` TEXT                                                                       NOT NULL,
  `parameterLanguageC` TEXT                                                                       NOT NULL,
  `parameterLanguageD` TEXT                                                                       NOT NULL,
  `clientJs`           TEXT                                                                       NOT NULL,

  `feGroup`            VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `deleted`            ENUM ('yes', 'no')                                                         NOT NULL DEFAULT 'no',
  `modified`           TIMESTAMP                                                                  NOT NULL DEFAULT CURRENT_TIMESTAMP
Carsten  Rose's avatar
Carsten Rose committed
113
    ON UPDATE CURRENT_TIMESTAMP,
114
  `created`            DATETIME                                                                   NOT NULL DEFAULT '0000-00-00 00:00:00',
115
116
117

  PRIMARY KEY (`id`),
  KEY `formId` (`formId`),
118
119
120
121
122
  KEY `formId_class_enabled_deleted` (`formId`, `class`, `enabled`, `deleted`),
  KEY `feIdContainer` (`feIdContainer`),
  KEY `ord` (`ord`),
  KEY `feGroup` (`feGroup`)

123
124
125
126
127
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

128

Carsten  Rose's avatar
Carsten Rose committed
129
130
CREATE TABLE IF NOT EXISTS `Dirty`
(
131
132
133
134
135
136
137
138
139
140
141
  `id`                   INT(11)                                NOT NULL AUTO_INCREMENT,
  `sip`                  VARCHAR(255)                           NOT NULL,
  `tableName`            VARCHAR(255)                           NOT NULL,
  `recordId`             INT(11)                                NOT NULL,
  `expire`               DATETIME                               NOT NULL,
  `recordHashMd5`        CHAR(32)                               NOT NULL,
  `feUser`               VARCHAR(255)                           NOT NULL,
  `qfqUserSessionCookie` VARCHAR(255)                           NOT NULL,
  `dirtyMode`            ENUM ('exclusive', 'advisory', 'none') NOT NULL DEFAULT 'exclusive',
  `remoteAddress`        VARCHAR(45)                            NOT NULL,
  `modified`             TIMESTAMP                              NOT NULL DEFAULT CURRENT_TIMESTAMP
Carsten  Rose's avatar
Carsten Rose committed
142
    ON UPDATE CURRENT_TIMESTAMP,
143
  `created`              DATETIME                               NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
144
145
146
147
148
149
150
151
152
  PRIMARY KEY (`id`),
  KEY `sip` (`sip`),
  KEY `tableName` (`tableName`),
  KEY `recordId` (`recordId`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

153
# Delete previous FormElements (if exist) of system forms
Carsten  Rose's avatar
Carsten Rose committed
154
155
156
157
158
DELETE FormElement
FROM FormElement,
     Form
WHERE FIND_IN_SET(Form.name, 'form,formElement,copyForm,cron') > 0
  AND Form.id = FormElement.formId;
159
160

# Delete previous Forms (if exist)
Carsten  Rose's avatar
Carsten Rose committed
161
162
DELETE
FROM Form
Carsten  Rose's avatar
Carsten Rose committed
163
WHERE FIND_IN_SET(Form.name, 'form,formElement,copyForm,cron') > 0;
164
165

#
166
# FormEditor: Form
Carsten  Rose's avatar
Carsten Rose committed
167
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter)
168
169
170
VALUES (1, 'form', 'Form Editor: {{SELECT id, " / ", name FROM Form WHERE id = {{r:S0}}}} (DB: {{dbNameQfq:Y}})',
        'FormElement Editor',
        'Form', 'sip', 'sip', 'bootstrap', '', 'maxVisiblePill=5\nclass=container-fluid\ndbIndex={{indexQfq:Y}}');
171

172
# FormEditor: FormElements for 'form'
173
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
174
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder)
175
176
177
178
179
180
VALUES (1, 1, 'basic', 'Basic', 'show', 'pill', 'all', 'container', 100, 0, '', '', '', '', '', 0, '', '', ''),
       (2, 1, 'formelement', 'Formelement', 'show', 'pill', 'all', 'container', 200, 0, '', '', '', '', '', 0, '', '',
        ''),
       (3, 1, 'layout', 'Layout', 'show', 'pill', 'all', 'container', 300, 0, '', '', '', '', '', 0, '', '', ''),
       (4, 1, 'access', 'Access', 'show', 'pill', 'all', 'container', 400, 0, '', '', '', '', '', 0, '', '', ''),
       (5, 1, 'multi', 'Multi', 'hidden', 'pill', 'all', 'container', 500, 0, '', '', '', '', '', 0, '', '', '');
181
182
183

# FormEditor: FormElements for 'form'
INSERT INTO FormElement (formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value,
Carsten  Rose's avatar
Carsten Rose committed
184
185
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder, encode, dynamicUpdate,
                         checkPattern)
186
VALUES
187
  # Make the form a 'delete form' for records Form/FormElement.
188
  (1, '', 'Delete FE', 'show', 'beforeDelete', 'all', 'action', 10, 0, 0, '', '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
189
190
   'sqlAfter={{DELETE FROM FormElement WHERE formId={{id:R}} }}',
   0, '', '', '', 'none', 'no', ''),
191

192
193
194
195
196
  # Check for double form name
  (1, '', 'Check for double form name', 'show', 'beforeSave', 'all', 'action', 20, 0, 0, '', '', '', '',
   'sqlValidate={{!SELECT f.id FROM Form AS f WHERE  f.name!="" AND f.name="{{name:F:alnumx}}" AND f.id!={{id:R0}}  }}\nexpectRecords=0\nmessageFail=There is already another form with the name "{{name:F:alnumx}}".',
   0, '', '', '', 'none', 'no', ''),

197
198
  # Basic
  (1, 'name', 'Name', 'required', 'text', 'pattern', 'native', 110, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
199
200
   '<a href="{{documentation:Y}}#form-name">Info</a>', '', '', '', 'autofocus',
   1, '', '', '', 'specialchar', 'no', '[a-zA-Z0-9._+-]+'),
201
  (1, 'title', 'Title', 'show', 'text', 'all', 'native', 120, 0, 0, '<a href="{{documentation:Y}}#form-title">Info</a>',
Carsten  Rose's avatar
Carsten Rose committed
202
   '', '', '', '', 1, '', '', '', 'none', 'no', ''),
203
  (1, 'noteInternal', 'Note', 'show', 'text', 'all', 'native', 130, '40,3', 0,
Carsten  Rose's avatar
Carsten Rose committed
204
   '<a href="{{documentation:Y}}#form-note">Info</a>', '', '', '', '', 1, '', '', '', 'specialchar', 'no', ''),
205
  (1, 'tableName', 'Table', 'required', 'select', 'all', 'native', 140, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
206
207
   '<a href="{{documentation:Y}}#form-tablename">Info</a>', '', '', '{{[{{indexData:Y}}]!SHOW tables}}',
   'emptyItemAtStart', 1, '', '', '', 'specialchar', 'no', ''),
208
  (1, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 150, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
209
210
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
211
  (1, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 160, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
212
213
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
214
  (1, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 170, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
215
216
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
217
  (1, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 180, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
218
219
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
220
221
222
223
224
225
226
227
228
229
230

  # FormElement
  (1, '', 'FormElements', 'show', 'subrecord', 'all', 'native', 210, 0, 0, '', '', '',
   '{{!SELECT fe.ord AS _ord, IF( fe.enabled="yes", IF( fe.enabled="yes" AND fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "danger", IF( fe.class="container", "text-info",  IF( fe.class="action", "text-success", ""))), "text-muted") AS _rowClass, IF( fe.enabled="yes", IF(fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "Please choose a container for this formelement", fe.class), "Disabled") AS _rowTitle, fe.id AS _id, CONCAT(''<span id="qfq-dnd-ord-id-'', fe.id,''">'', fe.ord, ''</span><br><small class="text-muted">'',fe.id, ''</small>'') AS ''Ord|nostrip'', CONCAT( IFNULL( CONCAT( feC.name, " (", fe.feIdContainer, ")"),"")) AS Container, fe.name AS "Name|50", fe.label AS Label, fe.mode AS Mode, fe.class AS Class,	fe.type AS Type, IF(fe.dynamicUpdate="yes", \'<span class="glyphicon glyphicon-random"></span>\',"") AS "Dyn|nostrip" FROM FormElement AS fe LEFT JOIN FormElement AS feC ON feC.id=fe.feIdContainer AND feC.formId=fe.formId LEFT JOIN FormElement AS feCX ON feCX.class="container" AND feCX.enabled="yes" AND feCX.type="pill" AND feCX.formId=fe.formId WHERE fe.formId={{id:R0}} GROUP BY fe.id ORDER BY fe.ord, fe.id}}',
   'form=formElement\ndetail=id:formId', 2,
   'new,edit,delete', '', '', 'none', 'no',
   ''),

  # Layout
  (1, 'showButton', 'Show button', 'show', 'checkbox', 'all', 'native', 220, 0, 5,
   '<a href="{{documentation:Y}}#showbutton">Info</a>', '', '', '', 'checkBoxMode = multi\norientation=vertical', 3, '',
Carsten  Rose's avatar
Carsten Rose committed
231
   '', '', 'specialchar', 'no', ''),
232
233
234
  (1, 'labelAlign', 'Label Align', 'show', 'radio', 'alnumx', 'native', 225, 0, 5,
   '<a href="{{documentation:Y}}#definition">Info</a>', '', '', '', 'buttonClass', 3, '',
   '', '', 'specialchar', 'no', ''),
Carsten  Rose's avatar
Carsten Rose committed
235
236
237
238
239
240
241
242
243
  (1, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 230, '40,8', 0,
   '<a href="{{documentation:Y}}#form-parameter">Info</a>', '', '', '', '', 3, '', '', '', 'none', 'no', ''),
  (1, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'all', 'native', 240, 0, 0,
   '<a href="{{documentation:Y}}#form-layout">Info</a>', '', '', '', '', 3, '', '', '{{bsLabelColumns:Y}}',
   'specialchar', 'no', ''),
  (1, 'bsInputColumns', 'BS Input Columns', 'show', 'text', 'all', 'native', 250, 0, 0, '', '', '', '', '', 3, '', '',
   '{{bsInputColumns:Y}}', 'specialchar', 'no', ''),
  (1, 'bsNoteColumns', 'BS Note Columns', 'show', 'text', 'all', 'native', 260, 0, 0, '', '', '', '', '', 3, '', '',
   '{{bsNoteColumns:Y}}', 'specialchar', 'no', ''),
244
245
246
247
248


  # Access
  (1, 'forwardMode', 'Forward', 'show', 'radio', 'all', 'native', 310, 0, 0,
   '<a href="{{documentation:Y}}#form-forward">Info</a>', '', '', '', 'buttonClass=btn-default', 4, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
249
   'specialchar', 'no', ''),
250
251
252
253
254
255
256
257
258
259
260
  (1, 'forwardPage', 'Forward URL / Page', 'show', 'text', 'all', 'native', 320, 0, 0,
   '<a href="{{documentation:Y}}#form-forward">Info</a>', '', '', '', '', 4, '',
   '', '', 'none', 'no', ''),
  (1, 'requiredParameterNew', 'Required Parameter NEW', 'show', 'text', 'all', 'native', 330, 0, 0,
   '<a href="{{documentation:Y}}#required-parameter-new-edit">Info</a>', '', '', '', '', 4, '', '', '', 'specialchar',
   'no', ''),
  (1, 'requiredParameterEdit', 'Required Parameter EDIT', 'show', 'text', 'all', 'native', 340, 0, 0,
   '<a href="{{documentation:Y}}#required-parameter-new-edit">Info</a>', '', '', '', '', 4, '', '', '', 'specialchar',
   'no', ''),
  (1, 'permitNew', 'Permit New', 'show', 'radio', 'all', 'native', 350, 0, 10,
   '<a href="{{documentation:Y}}#form-permitnewedit">Info</a>', '', '', '', 'buttonClass=btn-default', 4, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
261
   'specialchar', 'no', ''),
262
263
  (1, 'permitEdit', 'Permit Edit', 'show', 'radio', 'all', 'native', 360, 0, 10,
   '<a href="{{documentation:Y}}#form-permitnewedit">Info</a>', '', '', '', 'buttonClass=btn-default', 4, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
264
   'specialchar', 'no', ''),
265
266

  (1, 'prestMethod', 'Permit REST', 'show', 'checkbox', 'all', 'native', 370, 0, 10,
267
268
   '<a href="{{documentation:Y}}#rest">Info</a>', '', '', '',
   'buttonClass=btn-default\nitemList=get,post:insert,put:update,delete', 4, '', '', '',
269
270
271
   'specialchar', 'no', ''),

  (1, 'escapeTypeDefault', 'Escape type default', 'show', 'radio', 'all', 'native', 380, 0, 10,
272
273
274
   '<a href="{{documentation:Y}}#variable-escape">Info</a>', '', '', '',
   'itemList=c:config,s:single,d:double,l:ldap search,L:ldap value,m:mysql realEscapeString,-:none\nbuttonClass=btn-default',
   4, '', '', '', 'specialchar', 'no', ''),
275
  (1, 'dirtyMode', 'Record Locking', 'show', 'radio', 'all', 'native', 390, 0, 10,
276
277
   '<a href="{{documentation:Y}}#locking-record">Info</a>', '', '', '',
   'buttonClass=btn-default', 4, '', '', '', 'specialchar', 'no', ''),
278
  (1, 'recordLockTimeoutSeconds', 'Lock timeout (seconds)', 'show', 'text', 'all', 'native', 400, 0, 0,
279
280
281
   '<a href="{{documentation:Y}}#locking-record">Info</a>', '',
   '{{SELECT IF("{{recordLockTimeoutSeconds:R0}}"=0,"{{recordLockTimeoutSeconds:Y0}}","{{recordLockTimeoutSeconds:R0}}")}}',
   '', '', 4, '', '', '', 'specialchar', 'no', ''),
282
  (1, 'primaryKey', 'Primary Key', 'show', 'text', 'all', 'native', 410, 0, 0,
283
   '<a href="{{documentation:Y}}#form-primary-key">Info</a>', '', '', '', '', 4, '', '', 'id', 'specialchar', 'no', ''),
284

285
286
  # Multi
  (1, 'multi', 'Multi', 'show', 'fieldset', 'all', 'native', 510, 0, 0, '', '', '', '', '', 5, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
287
   'specialchar', 'no', ''),
288
  (1, 'multiMode', 'Multi Mode', 'show', 'radio', 'all', 'native', 520, 0, 0, '', '', '', '', '', 5, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
289
   'specialchar', 'no', ''),
290
  (1, 'multiSql', 'Multi SQL', 'show', 'text', 'all', 'native', 530, '40,3', 0, '', '', '', '', '', 5, '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
291
   'none', 'no', ''),
292
  (1, 'multiDetailForm', 'Multi Detail Form', 'show', 'text', 'all', 'native', 540, 0, 0, '', '', '', '', '', 5,
Carsten  Rose's avatar
Carsten Rose committed
293
   '', '', '', 'specialchar', 'no', ''),
294
295
  (1, 'multiDetailFormParameter', 'Multi Detail Form Parameter', 'show', 'text', 'all', 'native', 550, 0, 0, '', '',
   '', '', '', 5, '', '', '', 'none', 'no', '');
296

297
298
299

#
# FormEditor: FormElement
Carsten  Rose's avatar
Carsten Rose committed
300
301
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter,
                  requiredParameterNew)
302
303
304
305
306
VALUES (2, 'formElement',
        'Form Element Editor. Form : {{SELECT f.id, " / ",  f.name  FROM Form AS f WHERE f.id = {{formId:S0}}  }} (DB: {{dbNameQfq:Y}})',
        'Please secure the form',
        'FormElement', 'sip', 'sip', 'bootstrap', '',
        'maxVisiblePill=5\nclassBody=qfq-color-blue-1\ndbIndex={{indexQfq:Y}}', 'formId');
307

308
# FormEditor: FormElements for 'formElement'
309
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
310
                         sql1, parameter, feIdContainer, subrecordOption, modeSql)
311
312
313
314
315
VALUES (100, 2, 'basic', 'Basic', 'show', 'pill', 'all', 'container', 10, 0, '', '', '', '', '', 0, '', ''),
       (101, 2, 'check_order', 'Check & Order', 'show', 'pill', 'all', 'container', 290, 0, '', '', '', '', '', 0, '',
        ''),
       (102, 2, 'layout', 'Layout', 'show', 'pill', 'all', 'container', 390, 0, '', '', '', '', '', 0, '', ''),
       (103, 2, 'value', 'Value', 'show', 'pill', 'all', 'container', 490, 0, '', '', '', '', '', 0, '', '');
316

317
INSERT INTO FormElement (formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value,
318
319
                         sql1, parameter, feIdContainer, subrecordOption, dynamicUpdate, bsLabelColumns, bsInputColumns,
                         bsNoteColumns, modeSql, placeholder, encode)
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, 0, 0,
        '<a href="{{documentation:Y}}#class-container">Info</a>', '', '',
        '{{!SELECT fe.id, CONCAT(fe.type, " / ", fe.name, " (", COUNT(feSub.id), ")" ) FROM FormElement As fe LEFT JOIN FormElement As feSub ON feSub.feIdContainer=fe.id WHERE fe.formId={{formId:SR0}} AND fe.class="container" GROUP BY fe.id ORDER BY fe.type, fe.ord, fe.name }}',
        'emptyItemAtStart', 100, '', 'no', '', '', '',
        '{{SELECT IF(COUNT(fe.id)>0, "show", "hidden") FROM Form AS f LEFT JOIN FormElement AS fe ON f.id=fe.formId AND fe.class="container" WHERE f.id={{formId:S0}} GROUP BY f.id}}',
        '', 'specialchar'),
       (2, 'enabled', 'Enabled', 'show', 'checkbox', 'all', 'native', 130, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Info</a>', '', '', '', '', 100, '', 'no', '', '', '', '', '',
        'specialchar'),
       (2, 'dynamicUpdate', 'Dynamic Update', 'show', 'checkbox', 'all', 'native', 135, 0, 0,
        '<a href="{{documentation:Y}}#dynamic-update">Info</a>',
        '', '', '', '', 100, '', 'no', '', '', '', '', '', 'specialchar'),
       (2, 'name', 'Name', 'show', 'text', 'all', 'native', 140, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Info</a>',
        '', '', '',
        'typeAheadSql = [{{indexData:Y}}]SELECT COLUMN_NAME FROM information_schema.columns WHERE table_schema = "{{DB_1_NAME:Y}}" AND table_name = "{{SELECT f.tableName FROM Form AS f WHERE f.id={{formId:S0}}}}" AND COLUMN_NAME LIKE ? ORDER BY COLUMN_NAME\ntypeAheadMinLength = 1\ntypeAheadLimit = 100\ntypeAheadPedantic = 0\n',
        100, '<a href="{{documentation:Y}}#class-native">Info</a>', 'no', '', '', '', '', '', 'specialchar'),
       (2, 'label', 'Label', 'show', 'text', 'all', 'native', 150, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Info</a>',
        '', '', '', '', 100, '', 'no', '', '', '', '', '', 'none'),
       (2, 'mode', 'Mode', 'show', 'radio', 'all', 'native', 160, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Info</a>',
        '', '', '', 'buttonClass=btn-default', 100, '', 'no', '', '', '', '', '', 'specialchar'),
       (2, 'modeSql', 'Mode sql', 'show', 'text', 'all', 'native', 170, '70,2', 0,
        '<a href="{{documentation:Y}}#dynamic-update">Info</a>', '', '', '', '', 100, '', 'no', '', '', '', '', '',
        'none'),
       (2, 'class', 'Class', 'show', 'select', 'all', 'native', 180, 0, 0,
        '<a href="{{documentation:Y}}#class-container">Info</a>', '', '{{class:FSRD0:alnumx}}', '', '', 100, '', 'yes',
        '', '',
        '', '', '', 'none'),

       (2, 'type', 'Type', 'show', 'select', 'all', 'native', 190, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Native</a>, <a href="{{documentation:Y}}#class-action">Action</a>, <a href="{{documentation:Y}}#class-container">Container</a>',
        '', '', '',
        'itemList={{SELECT IF( "{{class:FRD0:alnumx}}"="native","checkbox,date,time,datetime,dateJQW,datetimeJQW,extra,gridJQW,text,editor,annotate,imageCut,note,password,radio,select,subrecord,upload", IF("{{class:FRD0:alnumx}}"="action","beforeLoad,beforeSave,beforeInsert,beforeUpdate,beforeDelete,afterLoad,afterSave,afterInsert,afterUpdate,afterDelete,sendMail,paste", "fieldset,pill,templateGroup")  ) }}',
        100, '', 'yes', '', '', '', '', '', 'specialchar'),
       (2, 'subrecordOption', 'Subrecord Option', 'show', 'checkbox', 'all', 'native', 200, 0, 0,
        '<a href="{{documentation:Y}}#subrecord-option">Info</a>', '', '', '',
        '', 100, '', 'yes', '', '', '',
        '{{ SELECT IF("{{type:FRE:alnumx}}"="subrecord" AND "{{class:FRE:alnumx}}"="native", "show", "hidden") }}', '',
        'specialchar'),
       (2, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
        '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
        '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none'),
       (2, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
        '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
        '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none'),
       (2, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
        '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
        '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none'),
       (2, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
        '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
        '{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none'),

       (2, 'encode', 'Encode', 'show', 'radio', 'all', 'native', 300, 0, 0,
        '<a href="{{documentation:Y}}#field-encode">Info</a>', '', '', '', 'buttonClass=btn-default', 101, '', 'no', '',
        '',
        '', '', '', 'specialchar'),
       (2, 'checkType', 'Check Type', 'show', 'radio', 'all', 'native', 310, 0, 0,
        '<a href="{{documentation:Y}}#field-checktype">Info</a>', '', '', '', 'buttonClass=btn-default', 101, '', 'yes',
        '',
        '', '', '', '', 'specialchar'),
       (2, 'checkPattern', 'Check Pattern', 'show', 'text', 'all', 'native', 320, 0, 0,
        '<a href="{{documentation:Y}}#field-checkpattern">Info</a>, <a href="https://regex101.com/">Regex101</a>', '',
        '', '',
        '', 101, '', 'yes', '', '', '',
        '{{ SELECT IF("{{checkType:FRE:alnumx}}"="pattern" OR "{{checkType:FRE:allbut}}" LIKE "min%", "show", "hidden") }}',
        '', 'none'),
       #(2, 'onChange', 'JS onChange', 'show', 'text', 'all', 'native', 330, 0, 0, '', '', '', '', '', 101, '', 'no', '', '', '', '', '', 'none'),
       (2, 'ord', 'Order', 'show', 'text', 'all', 'native', 340, 0, 0,
        '<a href="{{documentation:Y}}#field-ord">Info</a>', '',
        '{{SELECT IF({{ord:R0}}=0,  MAX(IFNULL(fe.ord,0))+10,{{ord:R0}})  FROM (SELECT 1) AS a LEFT JOIN FormElement AS fe ON fe.formId={{formId:S0}} GROUP BY fe.formId}}',
        '', '', 101, '', 'no', '', '', '', '', '', 'specialchar'),
       (2, 'tabindex', 'tabindex', 'show', 'text', 'all', 'native', 350, 0, 0,
        '<a href="{{documentation:Y}}#field-tabindex">Info</a>', '', '', '', '', 101, '', 'no', '', '', '', '', '',
        'specialchar'),
       (2, 'adminNote', 'Internal Note', 'show', 'text', 'all', 'native', 360, '60,4', 0, '', '', '', '', '', 101, '',
        'no',
        '', '',
        '', '', '', 'specialchar'),

       (2, 'labelAlign', 'Label Align', 'show', 'radio', 'all', 'native', 400, 0, 0,
        '<a href="{{documentation:Y}}#class-native">Info</a>', '', '', '', 'buttonClass=btn-default', 102, '', 'no', '',
        '',
        '', '', '', 'specialchar'),
       (2, 'size', 'Size', 'show', 'text', 'all', 'native', 405, 0, 0,
        '<a href="{{documentation:Y}}#field-size">Info</a>', '',
        '', '', '', 102, '', 'no', '', '', '', '', '', 'specialchar'),
       (2, 'bsLabelColumns', 'BS Label Columns', 'show', 'text', 'all', 'native', 410, 0, 0,
        '<a href="{{documentation:Y}}#field-bslabelcolumns">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '',
        '{{SELECT IF(f.bsLabelColumns != '''', f.bsLabelColumns, ''{{bsLabelColumns:Y}}'') FROM Form AS f WHERE f.id = {{formId}} }}',
        'specialchar'),
       (2, 'bsInputColumns', 'BS Input Columns', 'show', 'text', 'all', 'native', 420, 0, 0, '', '', '', '', '', 102,
        '', 'no',
        '', '', '', '',
        '{{SELECT IF(f.bsInputColumns != '''', f.bsInputColumns, ''{{bsInputColumns:Y}}'') FROM Form AS f WHERE f.id = {{formId}} }}',
        'specialchar'),
       (2, 'bsNoteColumns', 'BS Note Columns', 'show', 'text', 'all', 'native', 430, 0, 0, '', '', '', '', '', 102, '',
        'no',
        '', '', '', '',
        '{{SELECT IF(f.bsNoteColumns != '''', f.bsNoteColumns, ''{{bsNoteColumns:Y}}'') FROM Form AS f WHERE f.id = {{formId}} }}',
        'specialchar'),
       (2, 'rowLabelInputNote', 'Label / Input / Note', 'show', 'checkbox', 'alnumx', 'native', 440, 0, 10,
        '<a href="{{documentation:Y}}#field-rowlabelinputnote">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '',
        '',
        'specialchar'),
       (2, 'maxLength', 'Maxlength', 'show', 'text', 'all', 'native', 450, 0, 0,
        '<a href="{{documentation:Y}}#field-maxlength">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '', '',
        'specialchar'),
       (2, 'note', 'Note', 'show', 'text', 'all', 'native', 460, '40,5', 0,
        '<a href="{{documentation:Y}}#field-note">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '', '', 'none'),
       (2, 'tooltip', 'Tooltip', 'show', 'text', 'all', 'native', 470, 0, 0,
        '<a href="{{documentation:Y}}#field-tooltip">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '', '',
        'none'),
       (2, 'placeholder', 'Placeholder', 'show', 'text', 'all', 'native', 480, 0, 0,
        '<a href="{{documentation:Y}}#field-placeholder">Info</a>', '', '', '', '', 102, '', 'no', '', '', '', '', '',
        'none'),

       (2, 'value', 'value', 'show', 'text', 'all', 'native', 500, '40,2', 0,
        '<a href="{{documentation:Y}}#field-value">Info</a>', '', '', '', '', 103, '', 'no', '', '', '', '', '',
        'none'),
       (2, 'sql1', 'sql1', 'show', 'text', 'all', 'native', 510, '40,5', 0,
        '<a href="{{documentation:Y}}#sql1">Info</a><br><br>MariaDB: <a href="https://mariadb.com/kb/en/mariadb/select/">Select</a>, <a href="https://mariadb.com/kb/en/mariadb/functions-and-operators/">Functions</a>',
        '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'),
       (2, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 520, '40,8', 0,
        '<a href="{{documentation:Y}}#fe-parameter-attributes">Info</a>',
        '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none');
447

448
449
450
451
452
453
454
INSERT INTO `FormElement` (`id`, `formId`, `feIdContainer`, `dynamicUpdate`, `enabled`, `name`, `label`, `mode`,
                           `modeSql`, `class`, `type`, `subrecordOption`, `encode`, `checkType`, `checkPattern`,
                           `onChange`, `ord`, `tabindex`, `size`, `maxLength`, `bsLabelColumns`, `bsInputColumns`,
                           `bsNoteColumns`, `rowLabelInputNote`, `note`, `adminNote`, `tooltip`, `placeholder`, `value`,
                           `sql1`, `parameter`, `parameterLanguageA`, `parameterLanguageB`, `parameterLanguageC`,
                           `parameterLanguageD`, `clientJs`, `feGroup`, `deleted`)

455
456
457
458
459
VALUES (NULL, '2', '0', 'no', 'yes', 'Check Name Conflict', '', 'show', '', 'action', 'beforeSave', '', 'specialchar',
        'auto',
        '', '', '650', '0', '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '',
        'sqlValidate={{!SELECT fe.id FROM FormElement AS fe WHERE "{{class:F:alnumx}}"=fe.class AND fe.formId={{formId:RF}} AND fe.name!="" AND fe.name="{{name:F:alnumx}}" AND fe.id!={{id:R0}} }}\r\n\r\nexpectRecords=0\r\n\r\nmessageFail=There is already another {{class:F:alnumx}} form element whith name "{{name:F:alnumx}}".',
        '', '', '', '', '', '', 'no');
460

461
462
463
# ----------------------------------------
# MailLog

464
#DROP TABLE IF EXISTS `MailLog`;
Carsten  Rose's avatar
Carsten Rose committed
465
466
467
468
469
470
471
CREATE TABLE IF NOT EXISTS `MailLog`
(
  `id`       INT(11)       NOT NULL AUTO_INCREMENT,
  `grId`     INT(11)       NOT NULL DEFAULT '0',
  `xId`      INT(11)       NOT NULL DEFAULT '0',
  `xId2`     INT(11)       NOT NULL DEFAULT '0',
  `xId3`     INT(11)       NOT NULL DEFAULT '0',
472
  `receiver` TEXT          NOT NULL,
473
474
  `cc`       TEXT          NOT NULL,
  `bcc`      TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
475
476
  `sender`   VARCHAR(255)  NOT NULL DEFAULT '',
  `subject`  VARCHAR(255)  NOT NULL DEFAULT '',
477
  `body`     TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
478
479
480
481
482
  `header`   VARCHAR(255)  NOT NULL DEFAULT '',
  `attach`   VARCHAR(1024) NOT NULL DEFAULT '',
  `src`      VARCHAR(255)  NOT NULL DEFAULT '',
  `modified` TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created`  DATETIME      NOT NULL DEFAULT '0000-00-00 00:00:00',
483
484
485
486
487
488
489

  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

Carsten  Rose's avatar
Carsten Rose committed
490
491
CREATE TABLE IF NOT EXISTS `FormSubmitLog`
(
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
  `id`        INT(11)     NOT NULL AUTO_INCREMENT,
  `formData`  TEXT        NOT NULL,
  `sipData`   TEXT        NOT NULL,
  `clientIp`  VARCHAR(64) NOT NULL,
  `feUser`    VARCHAR(64) NOT NULL,
  `userAgent` TEXT        NOT NULL,
  `formId`    INT(11)     NOT NULL,
  `recordId`  INT(11)     NOT NULL,
  `pageId`    INT         NOT NULL,
  `sessionId` VARCHAR(32) NOT NULL,
  `created`   TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,

  PRIMARY KEY (`id`),
  INDEX (`feUser`),
  INDEX (`formId`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

512

Carsten  Rose's avatar
Carsten Rose committed
513
514
515
516
517
518
519
520
521
522
CREATE TABLE IF NOT EXISTS `Clipboard`
(
  `id`          INT(11)      NOT NULL AUTO_INCREMENT,
  `cookie`      VARCHAR(255) NOT NULL DEFAULT '',
  `formIdPaste` INT(11)      NOT NULL DEFAULT '0',
  `idSrc`       INT(11)      NOT NULL DEFAULT '0',
  `xId`         INT(11)      NOT NULL DEFAULT '0',
  `modified`    TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP
    ON UPDATE CURRENT_TIMESTAMP,
  `created`     DATETIME     NOT NULL DEFAULT '0000-00-00 00:00:00',
Carsten  Rose's avatar
Carsten Rose committed
523
524
525
526
527
528
529
530

  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

# Form: CopyForm
531
INSERT INTO Form (id, name, title, tableName, showButton, forwardMode, forwardPage, parameter)
532
533
534
VALUES (3, 'copyForm', 'Copy a form', 'Clipboard', 'close,save', 'url-sip',
        '?id={{pageId:T}}&form=form&r={{formId:P0}}',
        'submitButtonText = Copy Form');
Carsten  Rose's avatar
Carsten Rose committed
535
536
537

# FormElements: CopyForm
INSERT INTO FormElement (formId, name, label, type, class, ord, sql1, parameter)
538
539
540
541
542
543
544
545
546
547
548
549
VALUES (3, 'idSrc', 'Source Form', 'select', 'native', 10,
        '{{!SELECT f.id, CONCAT(f.name, " / ", f.title) FROM Form AS f ORDER BY f.name}}', ''),
       (3, 'myNewFormName', 'New Form Name', 'text', 'native', 20, '', ''),
       (3, 'clearClipboard', '', 'beforeSave', 'action', 100, '',
        'sqlValidate={{!SELECT f.id FROM Form AS f WHERE f.name LIKE "{{myName:FE:alnumx}}" LIMIT 1}}\nexpectRecords = 0\nmessageFail = There is already a form with this name\nsqlAfter={{DELETE FROM Clipboard WHERE cookie="{{cookieQfq:C0:alnumx}}" }}'),
       (3, 'updateClipboardRecord', '', 'afterSave', 'action', 110, '',
        'sqlAfter={{UPDATE Clipboard AS c, Form AS f SET c.cookie="{{cookieQfq:C0:alnumx}}", c.formIdPaste=f.id /* PasteForm */  WHERE c.id={{id:R}} AND f.name="{{form:SE}}" }}'),
       (3, 'formId', '', 'paste', 'action', 200, '{{!SELECT {{id:P}} AS id, "{{myNewFormName:FE:allbut}}" AS name}}',
        'recordDestinationTable=Form'),
       (3, 'formElementId', '', 'paste', 'action', 210,
        '{{!SELECT fe.id AS id, {{formId:P}} AS formId FROM FormElement AS fe WHERE fe.formId={{id:P}} ORDER BY fe.ord}}',
        'recordDestinationTable=FormElement\ntranslateIdColumn=feIdContainer');
Carsten  Rose's avatar
Carsten Rose committed
550

551
# AutoCRON
Carsten  Rose's avatar
Carsten Rose committed
552
553
554
CREATE TABLE IF NOT EXISTS `Cron`
(
  `id`            INT(11)                      NOT NULL AUTO_INCREMENT,
555
  `grId`          INT(11)                      NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
556
557
  `type`          ENUM ('mail', 'website')     NOT NULL DEFAULT 'website',
  `lastRun`       DATETIME                     NOT NULL DEFAULT '0000-00-00 00:00:00',
558
  `lastStatus`    TEXT                         NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
559
  `nextRun`       DATETIME                     NOT NULL DEFAULT '0000-00-00 00:00:00',
560
  `frequency`     VARCHAR(32)                  NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
561
562
  `inProgress`    DATETIME                     NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status`        ENUM ('enable', 'disable')   NOT NULL DEFAULT 'enable',
563
564
565
566
  `sql1`          TEXT                         NOT NULL,
  `content`       TEXT                         NOT NULL,
  `comment`       TEXT                         NOT NULL,
  `outputFile`    VARCHAR(255)                 NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
567
  `outputMode`    ENUM ('overwrite', 'append') NOT NULL DEFAULT 'append',
568
  `outputPattern` VARCHAR(255)                 NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
569
570
571
  `modified`      TIMESTAMP                    NOT NULL DEFAULT CURRENT_TIMESTAMP
    ON UPDATE CURRENT_TIMESTAMP,
  `created`       DATETIME                     NOT NULL DEFAULT '0000-00-00 00:00:00',
572
573
574
575
576
577
  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  AUTO_INCREMENT = 0
  DEFAULT CHARSET = utf8;

578
579
# Form: AutoCron
INSERT INTO Form (id, name, title, tableName, parameter, dirtyMode)
580
581
VALUES (4, 'cron', 'autoCron', 'Cron', 'dbIndex={{indexQfq:Y}}',
        'none');
582

583
# FormElements: AutoCron
Carsten  Rose's avatar
Carsten Rose committed
584
585
INSERT INTO FormElement (formId, name, label, mode, modeSql, type, encode, checkType, ord, parameter, size, note,
                         dynamicUpdate, bsLabelColumns, bsInputColumns, bsNoteColumns)
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
VALUES (4, 'status', 'Enabled', 'show', '', 'checkbox', 'specialchar', 'alnumx', 10, '', '', '', 'no', '', '', ''),
       (4, 'type', 'Type', 'show', '', 'radio', 'specialchar', 'alnumx', 20, 'buttonClass=btn-default', '', '', 'yes',
        '', '',
        ''),
       (4, 'nextRun', 'Next run', 'show', '', 'text', 'specialchar', 'alnumx', 30,
        'extraButtonInfo = Cronjob will be started if specified timestamp is over. If timestamp=0: Job will never be started<br>Every time the jobs runs, this timestamp will be increased automatically by "frequency".',
        '', '', 'no', '', '', ''),
       (4, 'frequency', 'Frequency', 'show', '', 'text', 'specialchar', 'alnumx', 40,
        'extraButtonInfo = Repeat AutoCron-job with the specified interval. If empty: no repeating.<br>E.g.: "1 DAY", "15 MINUTE'', "6 MONTH" - used directly in SQL-Function "DATE_ADD(&lt;nextrun&gt;, INTERVAL &lt;frequency&gt;)"',
        '', '', 'no', '', '', ''),
       (4, 'comment', 'Comment', 'show', '', 'text', 'specialchar', 'allbut', 50, '', '', '', 'no', '', '', ''),
       (4, 'sql1', 'Mail', 'show', '{{SELECT IF("{{type:FR:alnumx}}"="mail","show","hidden") }}', 'text', 'none', 'all',
        60,
        'extraButtonInfo = Query: &#123;&#123;!SELECT ... as sendMailTo...&#125;&#125;<br><b>sendMailTo / sendMailCc / sendMailBcc</b>: Separate multiple by comma.<br><b>sendMailFrom</b><br><b>sendMailSubject</b><br><b>sendMailReplyTo</b>: Optional<br><b>sendMailFlagAutoSubmit</b>: Optional. on|off. Default on - if "on", suppresses OoO answers from receivers.<br><b>sendMailGrId</b>: Optional<br><b>sendMailXId</b>: Optional',
        '60,4', '', 'yes', '', '', ''),
       (4, 'content', '{{SELECT IF("{{type:FR:alnumx}}"="mail","Mail body","URL") }}', 'show', '', 'text', 'none',
        'all', 70,
        '', '40,4',
        'Website: URL absolute like "http://..." or relative like "?id=pagealias..."<br>Mail: Static Body or &#123;{SELECT ...&#125;}',
        'yes', '', '', ''),

       (4, 'outputFile', 'Log output to file', 'show', '{{SELECT IF("{{type:FR:alnumx}}"="mail","hidden","show") }}',
        'text',
        'none', 'all', 80, '', '', 'CWD: Site installation directory', 'yes', '', '', ''),
       (4, 'outputMode', 'Mode output', 'show', '{{SELECT IF("{{type:FR:alnumx}}"="mail","hidden","show") }}', 'radio',
        'specialchar', 'alnumx', 90, 'buttonClass=btn-default', '', '', 'yes', '', '', ''),
       (4, 'outputPattern', 'Pattern to look for on output', 'show',
        '{{SELECT IF("{{type:FR:alnumx}}"="mail","hidden","show") }}', 'text', 'none', 'all', 100, '', '',
        'If pattern isn\'t found, return an error.<br>Check <a href="https://secure.php.net/manual/en/pcre.pattern.php">pcre</a> / <a href="https://regexp101.com">regexp101.com</a> ',
        'yes', '', '', ''),

       (4, 'lastRun', 'Last run', 'readonly', '', 'text', 'specialchar', 'alnumx', 120, '', '', '', 'no', '', '', ''),
       (4, 'lastStatus', 'Laststatus', 'readonly', '', 'text', 'specialchar', 'alnumx', 130, '', '50,6', '', 'no', '3',
        '9',
        '0'),
       (4, 'inProgress', 'In progress since', 'show', '', 'text', 'specialchar', 'alnumx', 140,
        'extraButtonInfo = Start time of a running job. When job is finished, this will be set back to 0. A new job will only be started, if this is 0. A progress duration >10mins will be treated as an error.',
        '', '', 'no', '', '', '');
Carsten  Rose's avatar
Carsten Rose committed
624
625
626
627

CREATE TABLE IF NOT EXISTS `Split`
(
  `id`           INT(11)      NOT NULL AUTO_INCREMENT,
628
629
630
  `tableName`    VARCHAR(255) NOT NULL,
  `xId`          INT(11)      NOT NULL,
  `pathFileName` VARCHAR(255) NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
631
632
633
  `modified`     TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP
    ON UPDATE CURRENT_TIMESTAMP,
  `created`      DATETIME     NOT NULL DEFAULT '0000-00-00 00:00:00',
634
635
636
637
638
  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  AUTO_INCREMENT = 0
  DEFAULT CHARSET = utf8;
639