formEditor.sql 9.17 KB
Newer Older
1
2
DROP TABLE IF EXISTS `Form`;
CREATE TABLE IF NOT EXISTS `Form` (
3
4
5
6
7
  `id`                       INT(11)                                                   NOT NULL  AUTO_INCREMENT,
  `name`                     VARCHAR(255)                                              NOT NULL  DEFAULT '',
  `title`                    VARCHAR(255)                                              NOT NULL  DEFAULT '',
  `noteInternal`             TEXT                                                      NOT NULL,
  `tableName`                VARCHAR(255)                                              NOT NULL  DEFAULT '',
8

9

10
11
12
  `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',
  `permitUrlParameter`       VARCHAR(255)                                              NOT NULL  DEFAULT '',
13
  `render`                   ENUM('plain', 'table', 'bootstrap')                       NOT NULL  DEFAULT 'plain',
14
15
16
17
  `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 '',
18

19
20
  `forwardMode`              ENUM('auto', 'no', 'page')                                NOT NULL  DEFAULT 'auto',
  `forwardPage`              VARCHAR(255)                                              NOT NULL  DEFAULT '',
21

22
23
24
  `bsLabelColumns`           VARCHAR(255)                                              NOT NULL  DEFAULT '',
  `bsInputColumns`           VARCHAR(255)                                              NOT NULL  DEFAULT '',
  `bsNoteColumns`            VARCHAR(255)                                              NOT NULL  DEFAULT '',
25

26
27
  `deleted`                  ENUM('yes', 'no')                                         NOT NULL  DEFAULT 'no',
  `modified`                 TIMESTAMP                                                 NOT NULL  DEFAULT CURRENT_TIMESTAMP,
28
  `created`                  DATETIME                                                  NOT NULL  DEFAULT '0000-00-00 00:00:00',
29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `name_deleted` (`name`, `deleted`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

--
-- Triggers `Form`
--
DROP TRIGGER IF EXISTS `on_Form_update_modified`;
DELIMITER //
CREATE TRIGGER `on_Form_update_modified` BEFORE UPDATE ON `Form`
FOR EACH ROW SET NEW.modified =
current_timestamp()
//
DELIMITER ;

# ----------------------------------------
# FormElement

DROP TABLE IF EXISTS `FormElement`;
CREATE TABLE IF NOT EXISTS `FormElement` (
54
55
56
  `id`            INT(11)                                                  NOT NULL                                                                                                                                                                                                                                                                                                                                                      AUTO_INCREMENT,
  `formId`        INT(11)                                                  NOT NULL,
  `feIdContainer` INT(11)                                                  NOT NULL DEFAULT '0',
57

58
  `enabled`       ENUM('yes', 'no')                                        NOT NULL DEFAULT 'yes',
59

60
61
  `name`          VARCHAR(255)                                             NOT NULL      DEFAULT '',
  `label`         VARCHAR(255)                                             NOT NULL      DEFAULT '',
62

63
64
65
66
67
68
69
70
71
  `mode`          ENUM('show', 'readonly', 'required', 'lock', 'disabled') NOT NULL DEFAULT 'show',
  `class`         ENUM('native', 'action', 'container')                    NOT NULL DEFAULT 'native',
  `type`          ENUM('checkbox', 'dateJQW', 'datetimeJQW', 'email', 'gridJQW', 'hidden', 'input',
                       'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill',
                       'before_load', 'before_save', 'before_insert', 'before_update', 'before_delete', 'after_load',
                       'after_save', 'after_insert', 'after_update', 'after_delete', 'feGroup',
                       'sendmail')                                         NOT NULL DEFAULT 'input',
  `checkType`     ENUM('', 'min|max', 'pattern', 'number', 'email'),
  `checkPattern`  VARCHAR(255)                                             NOT NULL DEFAULT '',
72

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

75
76
  `ord`           INT(11)                                                  NOT NULL DEFAULT '0',
  `tabindex`      INT(11)                                                  NOT NULL DEFAULT '0',
77
78


79
80
81
82
83
84
  `size`          VARCHAR(255)                                             NOT NULL DEFAULT '',
  `maxLength`     VARCHAR(255)                                             NOT NULL DEFAULT '',
  `note`          TEXT                                                     NOT NULL,
  `tooltip`       VARCHAR(255)                                             NOT NULL DEFAULT '',
  `placeholder`   VARCHAR(255)                                             NOT NULL DEFAULT '',
  `clientJs`      TEXT,
85

86
87
88
89
  `value`         TEXT                                                     NOT NULL,
  `sql1`          TEXT                                                     NOT NULL,
  `sql2`          TEXT                                                     NOT NULL,
  `parameter`     TEXT                                                     NOT NULL,
90

91
92
93
94
  `feGroup`       VARCHAR(255)                                             NOT NULL DEFAULT '',
  `deleted`       ENUM('yes', 'no')                                        NOT NULL DEFAULT 'no',
  `modified`      TIMESTAMP                                                NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created`       DATETIME                                                 NOT NULL DEFAULT '0000-00-00 00:00:00',
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

  PRIMARY KEY (`id`),
  KEY `formId` (`formId`),
  KEY `formId_class_enabled_deleted` (`formId`, `class`, `enabled`, `deleted`)
)
  ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  AUTO_INCREMENT = 0;

--
-- Triggers `FormElement`
--
DROP TRIGGER IF EXISTS `on_FormEelement_update_modified`;
DELIMITER //
CREATE TRIGGER `on_FormEelement_update_modified` BEFORE UPDATE ON `FormElement`
FOR EACH ROW SET NEW.modified =
current_timestamp()
//
DELIMITER ;

115
116
117
118
119
120
121

#
# FormEditor
INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql) VALUES
  ('form', 'Form Editor: {{SELECT id, " / ", title FROM Form WHERE id = {{recordId:SZ}}}}', 'Please secure the form',
   'Form', 'always', 'always', 'table', '');

122
# FormEditor: FormElements
123
INSERT INTO FormElement (formId, name, label, mode, type, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer)
124
VALUES
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
  (1, 'id', 'id', 'readonly', 'input', 10, 10, 11, '', '', '', '', '', '', 0),
  (1, 'name', 'Name', 'show', 'input', 20, 40, 255, '', '', '', '', '', 'autofocus=on', 0),
  (1, 'title', 'Title', 'show', 'input', 30, 40, 255, '', '', '', '', '', '', 0),
  (1, 'noteInternal', 'Note', 'show', 'input', 40, '40,3', 0, '', '', '', '', '', '', 0),
  (1, 'tableName', 'Table', 'show', 'select', 50, 0, 0, '', '', '', '{{!SHOW tables}}', '', '', 0),

  (1, 'permitNew', 'Permit New', 'show', 'radio', 60, 0, 0, '', '', '', '', '', '', 0),
  (1, 'permitEdit', 'Permit Edit', 'show', 'radio', 70, 0, 0, '', '', '', '', '', '', 0),
  (1, 'permitUrlParameter', 'Permit Url Parameter', 'show', 'input', 80, 40, 255, '', '', '', '', '', '', 0),
  (1, 'render', 'Render', 'show', 'radio', 90, 0, 0, '', '', '', '', '', '', 0),

  (1, 'multi', 'Multi', 'show', 'fieldset', 100, 0, 0, '', '', '', '', '', '', 0),
  (1, 'multiMode', 'Multi Mode', 'show', 'radio', 100, 0, 0, '', '', '', '', '', '', 10),
  (1, 'multiSql', 'Multi SQL', 'show', 'input', 110, '40,3', 0, '', '', '', '', '', '', 10),
  (1, 'multiDetailForm', 'Multi Detail Form', 'show', 'input', 120, 40, 255, '', '', '', '', '', '', 10),
  (1, 'multiDetailFormParameter', 'Multi Detail Form Parameter', 'show', 'input', 130, 40, 255, '', '', '', '', '', '', 10),
  (1, 'forwardMode', 'Forward', 'show', 'radio', 140, 0, 0, '', '', '', '', '', '', 0),
  (1, 'forwardPage', 'Forward Page', 'show', 'input', 150, 40, 255, '', '', '', '', '', '', 0),
  (1, 'bsLabelColumns', 'BS Label Columns', 'show', 'input', 160, 40, 250, '', '', '', '', '', '', 0),
  (1, 'bsInputColumns', 'BS Input Columns', 'show', 'input', 160, 40, 250, '', '', '', '', '', '', 0),
  (1, 'bsNoteColumns', 'BS Note Columns', 'show', 'input', 160, 40, 250, '', '', '', '', '', '', 0),

  (1, 'deleted', 'Deleted', 'show', 'checkbox', 170, 0, 0, '', '', '', '', '', '', 0),
  (1, 'modified', 'Modified', 'readonly', 'input', 180, 40, 20, '', '', '', '', '', '', 0),
  (1, 'created', 'Created', 'readonly', 'input', 180, 40, 20, '', '', '', '', '', '', 0),
150
151

  (1, '', 'FormElements', 'show', 'subrecord', 200, 0, 0, '', '', '', '{{!SELECT * FROM FormElement WHERE formId=1}}',
152
   '', '', 0);
153
154