formEditor.sql 41.7 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
  `noteInternal`             TEXT                                                        NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
11
12
13
14
15
16
17
18
19
20
21
22
  `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',
  `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',
  `showButton`               SET ('new', 'delete', 'close', 'save')                      NOT NULL DEFAULT 'new,delete,close,save',
  `multiMode`                ENUM ('none', 'horizontal', 'vertical')                     NOT NULL DEFAULT 'none',
23
  `multiSql`                 TEXT                                                        NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
24
25
  `multiDetailForm`          VARCHAR(255)                                                NOT NULL DEFAULT '',
  `multiDetailFormParameter` VARCHAR(255)                                                NOT NULL DEFAULT '',
26

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

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

  `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
40
  `recordLockTimeoutSeconds` INT(11)                                                     NOT NULL DEFAULT 900,
41

Carsten  Rose's avatar
Carsten Rose committed
42
43
44
45
  `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',
46

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

55

Carsten  Rose's avatar
Carsten Rose committed
56
57
CREATE TABLE IF NOT EXISTS `FormElement`
(
58
59
60
61
  `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',
62

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

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

68
69
70
  `mode`               ENUM ('show', 'required', 'readonly', 'hidden')                            NOT NULL DEFAULT 'show',
  `modeSql`            TEXT                                                                       NOT NULL,
  `class`              ENUM ('native', 'action', 'container')                                     NOT NULL DEFAULT 'native',
71
  `type`               ENUM ('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text',
Carsten  Rose's avatar
Carsten Rose committed
72
73
74
75
                             'editor', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload',
                             'annotate', 'imageCut', 'fieldset', 'pill', 'templateGroup',
                             'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad',
                             'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendMail',
76
77
78
                             '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
79
  `checkType`          ENUM ('auto', 'alnumx', 'digit', 'numerical', 'email', 'pattern', 'allbut',
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
                             'all')                                                               NOT NULL DEFAULT 'auto',
  `checkPattern`       VARCHAR(255)                                                               NOT NULL DEFAULT '',

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

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

  `size`               VARCHAR(255)                                                               NOT NULL DEFAULT '',
  `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
112
    ON UPDATE CURRENT_TIMESTAMP,
113
  `created`            DATETIME                                                                   NOT NULL DEFAULT '0000-00-00 00:00:00',
114
115
116

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

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

127

Carsten  Rose's avatar
Carsten Rose committed
128
129
CREATE TABLE IF NOT EXISTS `Dirty`
(
130
131
132
133
134
135
136
137
138
139
140
  `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
141
    ON UPDATE CURRENT_TIMESTAMP,
142
  `created`              DATETIME                               NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
143
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;


Carsten  Rose's avatar
Carsten Rose committed
153
154
CREATE TABLE IF NOT EXISTS `Period`
(
155
156
157
  `id`       INT(11)      NOT NULL AUTO_INCREMENT,
  `start`    DATETIME     NOT NULL,
  `name`     VARCHAR(255) NOT NULL,
158
  `modified` TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP
Carsten  Rose's avatar
Carsten Rose committed
159
    ON UPDATE CURRENT_TIMESTAMP,
160
161
162
163
164
165
166
167
  `created`  DATETIME     NOT NULL,
  PRIMARY KEY (`id`),
  KEY `start` (`start`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

168
# Delete previous FormElements (if exist) of system forms
Carsten  Rose's avatar
Carsten Rose committed
169
170
171
172
173
DELETE FormElement
FROM FormElement,
     Form
WHERE FIND_IN_SET(Form.name, 'form,formElement,copyForm,cron') > 0
  AND Form.id = FormElement.formId;
174
175

# Delete previous Forms (if exist)
Carsten  Rose's avatar
Carsten Rose committed
176
177
DELETE
FROM Form
Carsten  Rose's avatar
Carsten Rose committed
178
WHERE FIND_IN_SET(Form.name, 'form,formElement,copyForm,cron') > 0;
179
180

#
181
# FormEditor: Form
Carsten  Rose's avatar
Carsten Rose committed
182
183
184
185
186
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter)
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}}');
187

188
# FormEditor: FormElements for 'form'
189
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
190
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder)
191
VALUES
Carsten  Rose's avatar
Carsten Rose committed
192
(1, 1, 'basic', 'Basic', 'show', 'pill', 'all', 'container', 100, 0, '', '', '', '', '', 0, '', '', ''),
193
194
195
196
(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, '', '', '');
197
198
199

# 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
200
201
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder, encode, dynamicUpdate,
                         checkPattern)
202
VALUES
203
  # Make the form a 'delete form' for records Form/FormElement.
204
  (1, 'Delete FE', '', 'show', 'beforeDelete', 'all', 'action', 10, 0, 0, '', '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
205
206
   'sqlAfter={{DELETE FROM FormElement WHERE formId={{id:R}} }}',
   0, '', '', '', 'none', 'no', ''),
207
208
209

  # Basic
  (1, 'name', 'Name', 'required', 'text', 'pattern', 'native', 110, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
210
211
   '<a href="{{documentation:Y}}#form-name">Info</a>', '', '', '', 'autofocus',
   1, '', '', '', 'specialchar', 'no', '[a-zA-Z0-9._+-]+'),
212
  (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
213
   '', '', '', '', 1, '', '', '', 'none', 'no', ''),
214
  (1, 'noteInternal', 'Note', 'show', 'text', 'all', 'native', 130, '40,3', 0,
Carsten  Rose's avatar
Carsten Rose committed
215
   '<a href="{{documentation:Y}}#form-note">Info</a>', '', '', '', '', 1, '', '', '', 'specialchar', 'no', ''),
216
  (1, 'tableName', 'Table', 'required', 'select', 'all', 'native', 140, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
217
218
   '<a href="{{documentation:Y}}#form-tablename">Info</a>', '', '', '{{[{{indexData:Y}}]!SHOW tables}}',
   'emptyItemAtStart', 1, '', '', '', 'specialchar', 'no', ''),
219
  (1, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 150, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
220
221
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
222
  (1, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 160, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
223
224
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
225
  (1, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 170, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
226
227
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
228
  (1, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 180, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
229
230
   '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 1, '',
   '{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none', 'no', ''),
231
232
233
234
235
236
237
238
239
240
241

  # 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
242
   '', '', 'specialchar', 'no', ''),
243
244
245
  (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
246
247
248
249
250
251
252
253
254
  (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', ''),
255
256
257
258
259


  # 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
260
   'specialchar', 'no', ''),
261
262
263
264
265
266
267
268
269
270
271
  (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
272
   'specialchar', 'no', ''),
273
274
  (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
275
   'specialchar', 'no', ''),
276
277
278
279
280
281
282
283
284
285
286
287
288
  (1, 'escapeTypeDefault', 'Escape type default', 'show', 'radio', 'all', 'native', 370, 0, 10,
   '<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', ''),
  (1, 'dirtyMode', 'Record Locking', 'show', 'radio', 'all', 'native', 380, 0, 10,
   '<a href="{{documentation:Y}}#locking-record">Info</a>', '', '', '',
   'buttonClass=btn-default', 4, '', '', '', 'specialchar', 'no', ''),
  (1, 'recordLockTimeoutSeconds', 'Lock timeout (seconds)', 'show', 'text', 'all', 'native', 390, 0, 0,
   '<a href="{{documentation:Y}}#locking-record">Info</a>', '',
   '{{SELECT IF("{{recordLockTimeoutSeconds:R0}}"=0,"{{recordLockTimeoutSeconds:Y0}}","{{recordLockTimeoutSeconds:R0}}")}}',
   '', '', 4, '', '', '', 'specialchar', 'no', ''),
  (1, 'primaryKey', 'Primary Key', 'show', 'text', 'all', 'native', 400, 0, 0,
   '<a href="{{documentation:Y}}#form-primary-key">Info</a>', '', '', '', '', 4, '', '', 'id', 'specialchar', 'no', ''),
289

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

302
303
304

#
# FormEditor: FormElement
Carsten  Rose's avatar
Carsten Rose committed
305
306
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter,
                  requiredParameterNew)
307
VALUES
Carsten  Rose's avatar
Carsten Rose committed
308
309
310
311
312
(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');
313

314
# FormEditor: FormElements for 'formElement'
315
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
316
                         sql1, parameter, feIdContainer, subrecordOption, modeSql)
317
VALUES
Carsten  Rose's avatar
Carsten Rose committed
318
319
320
321
(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, '', ''),
322
(103, 2, 'value', 'Value', 'show', 'pill', 'all', 'container', 490, 0, '', '', '', '', '', 0, '', '');
323

324
INSERT INTO FormElement (formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value,
325
326
                         sql1, parameter, feIdContainer, subrecordOption, dynamicUpdate, bsLabelColumns, bsInputColumns,
                         bsNoteColumns, modeSql, placeholder, encode)
327
VALUES
328
(2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
 '<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'),
353

354
(2, 'type', 'Type', 'show', 'select', 'all', 'native', 190, 0, 0,
Carsten  Rose's avatar
Carsten Rose committed
355
356
357
358
359
360
361
362
363
 '<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'),
364
(2, 'parameterLanguageA', 'Language: {{formLanguageALabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
365
366
 '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
 '{{SELECT IF("{{formLanguageAId:YE}}"="","hidden","show" ) }}', '', 'none'),
367
(2, 'parameterLanguageB', 'Language: {{formLanguageBLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
368
369
 '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
 '{{SELECT IF("{{formLanguageBId:YE}}"="","hidden","show" ) }}', '', 'none'),
370
(2, 'parameterLanguageC', 'Language: {{formLanguageCLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
371
372
 '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
 '{{SELECT IF("{{formLanguageCId:YE}}"="","hidden","show" ) }}', '', 'none'),
373
(2, 'parameterLanguageD', 'Language: {{formLanguageDLabel:YE}}', 'show', 'text', 'all', 'native', 210, '60,2', 0,
Carsten  Rose's avatar
Carsten Rose committed
374
375
 '<a href="{{documentation:Y}}#multi-language-form">Info</a>', '', '', '', '', 100, '', 'no', '', '', '',
 '{{SELECT IF("{{formLanguageDId:YE}}"="","hidden","show" ) }}', '', 'none'),
376

Carsten  Rose's avatar
Carsten Rose committed
377
378
379
380
381
382
383
384
385
386
387
(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'),
388
#(2, 'onChange', 'JS onChange', 'show', 'text', 'all', 'native', 330, 0, 0, '', '', '', '', '', 101, '', 'no', '', '', '', '', '', 'none'),
Carsten  Rose's avatar
Carsten Rose committed
389
390
391
392
393
394
(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'),
395
396
397
398
399
400
401
(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>', '',
Carsten  Rose's avatar
Carsten Rose committed
402
 '', '', '', 102, '', 'no', '', '', '', '', '', 'specialchar'),
403
404
405
406
407
408
409
410
411
412
413
414
(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'),
Carsten  Rose's avatar
Carsten Rose committed
415
416
417
418
419
420
421
422
423
424
425
426
(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'),
427

Carsten  Rose's avatar
Carsten Rose committed
428
429
(2, 'value', 'value', 'show', 'text', 'all', 'native', 500, '40,2', 0,
 '<a href="{{documentation:Y}}#field-value">Info</a>', '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none'),
430
(2, 'sql1', 'sql1', 'show', 'text', 'all', 'native', 510, '40,5', 0,
Carsten  Rose's avatar
Carsten Rose committed
431
432
433
434
 '<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>',
435
 '', '', '', '', 103, '', 'no', '', '', '', '', '', 'none');
436

437
438
439
440
441
442
443
444
445
446
447
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`)

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:F}} 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}}".',
448
 '', '', '', '', '', '', 'no');
449

450
451
452
# ----------------------------------------
# MailLog

453
#DROP TABLE IF EXISTS `MailLog`;
Carsten  Rose's avatar
Carsten Rose committed
454
455
456
457
458
459
460
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',
461
  `receiver` TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
462
463
  `sender`   VARCHAR(255)  NOT NULL DEFAULT '',
  `subject`  VARCHAR(255)  NOT NULL DEFAULT '',
464
  `body`     TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
465
466
467
468
469
  `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',
470
471
472
473
474
475
476

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

Carsten  Rose's avatar
Carsten Rose committed
477
478
CREATE TABLE IF NOT EXISTS `FormSubmitLog`
(
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
  `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;

499

Carsten  Rose's avatar
Carsten Rose committed
500
501
502
503
504
505
506
507
508
509
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
510
511
512
513
514
515
516
517

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

# Form: CopyForm
518
INSERT INTO Form (id, name, title, tableName, showButton, forwardMode, forwardPage, parameter)
519
VALUES
Carsten  Rose's avatar
Carsten Rose committed
520
521
(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
522
523
524
525

# FormElements: CopyForm
INSERT INTO FormElement (formId, name, label, type, class, ord, sql1, parameter)
VALUES
Carsten  Rose's avatar
Carsten Rose committed
526
527
528
529
530
531
532
533
534
535
536
537
(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
538

539
# Default record for table Period
Carsten  Rose's avatar
Carsten Rose committed
540
541
INSERT INTO Period (start, name, created)
VALUES (NOW(), 'dummy', NOW());
542
543

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

570
571
# Form: AutoCron
INSERT INTO Form (id, name, title, tableName, parameter, dirtyMode)
572
VALUES
Carsten  Rose's avatar
Carsten Rose committed
573
574
(4, 'cron', 'autoCron', 'Cron', 'dbIndex={{indexQfq:Y}}',
 'none');
575

576
# FormElements: AutoCron
Carsten  Rose's avatar
Carsten Rose committed
577
578
INSERT INTO FormElement (formId, name, label, mode, modeSql, type, encode, checkType, ord, parameter, size, note,
                         dynamicUpdate, bsLabelColumns, bsInputColumns, bsNoteColumns)
579
VALUES
Carsten  Rose's avatar
Carsten Rose committed
580
581
582
583
584
585
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
(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', '', '', '');

CREATE TABLE IF NOT EXISTS `Split`
(
  `id`           INT(11)      NOT NULL AUTO_INCREMENT,
617
618
619
  `tableName`    VARCHAR(255) NOT NULL,
  `xId`          INT(11)      NOT NULL,
  `pathFileName` VARCHAR(255) NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
620
621
622
  `modified`     TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP
    ON UPDATE CURRENT_TIMESTAMP,
  `created`      DATETIME     NOT NULL DEFAULT '0000-00-00 00:00:00',
623
624
625
626
627
  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  AUTO_INCREMENT = 0
  DEFAULT CHARSET = utf8;