formEditor.sql 43.5 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',
22
23
24
25
26
  `showButton`               SET ('new', 'delete', 'close', 'save')                                              NOT NULL DEFAULT 'new,delete,close,save',
  `multiMode`                ENUM ('none', 'horizontal', 'vertical')                                             NOT NULL DEFAULT 'none',
  `multiSql`                 TEXT                                                                                NOT NULL,
  `multiDetailForm`          VARCHAR(255)                                                                        NOT NULL DEFAULT '',
  `multiDetailFormParameter` VARCHAR(255)                                                                        NOT NULL DEFAULT '',
27

28
29
30
  `forwardMode`              ENUM ('client', 'no', 'url', 'url-skip-history', 'url-sip',
                                   'url-sip-skip-history')                                                       NOT NULL DEFAULT 'client',
  `forwardPage`              VARCHAR(255)                                                                        NOT NULL DEFAULT '',
31

32
33
34
35
  `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 '',
36
37
38
39
40
41

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

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

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

57

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

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

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

70
71
72
  `mode`               ENUM ('show', 'required', 'readonly', 'hidden') NOT NULL DEFAULT 'show',
  `modeSql`            TEXT                                            NOT NULL,
  `class`              ENUM ('native', 'action', 'container')          NOT NULL DEFAULT 'native',
73
  `type`               ENUM ('checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text',
74
75
76
77
78
79
80
                             '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
81
  `checkType`          ENUM ('auto', 'alnumx', 'digit', 'numerical', 'email', 'pattern', 'allbut',
82
83
                             'all')                                    NOT NULL DEFAULT 'auto',
  `checkPattern`       VARCHAR(255)                                    NOT NULL DEFAULT '',
84

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

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

90
  `size`               VARCHAR(255)                                    NOT NULL DEFAULT '',
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  `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
114
    ON UPDATE CURRENT_TIMESTAMP,
115
  `created`            DATETIME                                                                   NOT NULL DEFAULT '0000-00-00 00:00:00',
116
117
118

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

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

129

Carsten  Rose's avatar
Carsten Rose committed
130
131
CREATE TABLE IF NOT EXISTS `Dirty`
(
132
133
134
135
136
137
138
139
140
141
142
  `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
143
    ON UPDATE CURRENT_TIMESTAMP,
144
  `created`              DATETIME                               NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
145
146
147
148
149
150
151
152
153
  PRIMARY KEY (`id`),
  KEY `sip` (`sip`),
  KEY `tableName` (`tableName`),
  KEY `recordId` (`recordId`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

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

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

#
167
# FormEditor: Form
Carsten  Rose's avatar
Carsten Rose committed
168
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter)
169
170
171
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}}');
172

173
# FormEditor: FormElements for 'form'
174
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
175
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder)
176
177
178
179
180
181
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, '', '', '');
182
183
184

# 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
185
186
                         sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder, encode, dynamicUpdate,
                         checkPattern)
187
VALUES
188
  # Make the form a 'delete form' for records Form/FormElement.
189
  (1, '', 'Delete FE', 'show', 'beforeDelete', 'all', 'action', 10, 0, 0, '', '', '', '',
Carsten  Rose's avatar
Carsten Rose committed
190
191
   'sqlAfter={{DELETE FROM FormElement WHERE formId={{id:R}} }}',
   0, '', '', '', 'none', 'no', ''),
192

193
194
195
196
197
  # 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', ''),

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

  # 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
232
   '', '', 'specialchar', 'no', ''),
233
234
235
  (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
236
237
238
239
240
241
242
243
244
  (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', ''),
245
246
247
248
249


  # 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
250
   'specialchar', 'no', ''),
251
252
253
254
255
256
257
258
259
260
261
  (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
262
   'specialchar', 'no', ''),
263
264
  (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
265
   'specialchar', 'no', ''),
266
267

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

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

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

298
299
300

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

309
# FormEditor: FormElements for 'formElement'
310
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
311
                         sql1, parameter, feIdContainer, subrecordOption, modeSql)
312
313
314
315
316
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, '', '');
317

318
INSERT INTO FormElement (formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value,
319
320
                         sql1, parameter, feIdContainer, subrecordOption, dynamicUpdate, bsLabelColumns, bsInputColumns,
                         bsNoteColumns, modeSql, placeholder, encode)
321
VALUES (2, 'feIdContainer', 'Container', 'show', 'select', 'all', 'native', 120, 0, 0,
322
323
        '<a href="{{documentation:Y}}#class-container">Info</a>', '',
        '{{feIdContainer:R:::{{SELECT fe.feIdContainer FROM FormElement AS fe WHERE fe.formId={{formId:S}} AND fe.feIdContainer!=0 ORDER BY fe.modified DESC LIMIT 1}}}}',
324
        '{{!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 }}',
325
326
        'emptyItemAtStart',
        100, '', 'no', '', '', '',
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
447
448
449
        '{{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');
450

451
452
453
454
455
456
457
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`)

458
459
460
461
462
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');
463

464
465
466
# ----------------------------------------
# MailLog

467
#DROP TABLE IF EXISTS `MailLog`;
Carsten  Rose's avatar
Carsten Rose committed
468
469
470
471
472
473
474
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',
475
  `receiver` TEXT          NOT NULL,
476
477
  `cc`       TEXT          NOT NULL,
  `bcc`      TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
478
479
  `sender`   VARCHAR(255)  NOT NULL DEFAULT '',
  `subject`  VARCHAR(255)  NOT NULL DEFAULT '',
480
  `body`     TEXT          NOT NULL,
Carsten  Rose's avatar
Carsten Rose committed
481
482
483
484
485
  `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',
486
487
488
489
490
491
492

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

Carsten  Rose's avatar
Carsten Rose committed
493
494
CREATE TABLE IF NOT EXISTS `FormSubmitLog`
(
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
  `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;

515

Carsten  Rose's avatar
Carsten Rose committed
516
517
518
519
520
521
522
523
524
525
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
526
527
528
529
530
531
532
533

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

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

# FormElements: CopyForm
INSERT INTO FormElement (formId, name, label, type, class, ord, sql1, parameter)
541
542
543
544
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, '',
545
        'sqlValidate={{!SELECT f.id FROM Form AS f WHERE f.name LIKE "{{myNewFormName:FE:alnumx}}" LIMIT 1}}\nexpectRecords = 0\nmessageFail = There is already a form "{{myNewFormName:FE}}"\nsqlAfter={{DELETE FROM Clipboard WHERE cookie="{{cookieQfq:C0:alnumx}}" }}'),
546
547
548
549
550
551
552
       (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
553

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

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

586
# FormElements: AutoCron
Carsten  Rose's avatar
Carsten Rose committed
587
588
INSERT INTO FormElement (formId, name, label, mode, modeSql, type, encode, checkType, ord, parameter, size, note,
                         dynamicUpdate, bsLabelColumns, bsInputColumns, bsNoteColumns)
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
624
625
626
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
627
628
629
630

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