Marius Burkard
2016-04-20 4569cae57f127afd093794310ccd290d2d9fdf36
commit | author | age
b74ef5 1 <?php
T 2
3 /*
4     Form Definition
5
6     Tabledefinition
7
8     Datatypes:
9     - INTEGER (Forces the input to Int)
10     - DOUBLE
11     - CURRENCY (Formats the values to currency notation)
12     - VARCHAR (no format check, maxlength: 255)
13     - TEXT (no format check)
14     - DATE (Dateformat, automatic conversion to timestamps)
15
16     Formtype:
17     - TEXT (Textfield)
18     - TEXTAREA (Textarea)
19     - PASSWORD (Password textfield, input is not shown when edited)
20     - SELECT (Select option field)
21     - RADIO
22     - CHECKBOX
23     - CHECKBOXARRAY
24     - FILE
25
26     VALUE:
27     - Wert oder Array
28
29     Hint:
30     The ID field of the database table is not part of the datafield definition.
31     The ID field must be always auto incement (int or bigint).
b1a6a5 32
4c28d9 33     Search:
F 34     - searchable = 1 or searchable = 2 include the field in the search
35     - searchable = 1: this field will be the title of the search result
36     - searchable = 2: this field will be included in the description of the search result
b74ef5 37
T 38
39 */
40
b1a6a5 41 $form["title"]    = "Openvz Template";
MC 42 $form["description"]  = "";
43 $form["name"]    = "openvz_template";
44 $form["action"]   = "openvz_template_edit.php";
45 $form["db_table"]  = "openvz_template";
46 $form["db_table_idx"] = "template_id";
47 $form["db_history"]  = "yes";
48 $form["tab_default"] = "main";
49 $form["list_default"] = "openvz_template_list.php";
50 $form["auth"]   = 'yes'; // yes / no
b74ef5 51
T 52 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
53 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
54 $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
55 $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
56 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
57
58 $form["tabs"]['main'] = array (
b1a6a5 59     'title'  => "Template",
MC 60     'width'  => 100,
61     'template'  => "templates/openvz_template_edit.htm",
62     'fields'  => array (
63         //#################################
64         // Begin Datatable fields
65         //#################################
b74ef5 66         'template_name' => array (
b1a6a5 67             'datatype' => 'VARCHAR',
MC 68             'formtype' => 'TEXT',
69             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
70                     'errmsg'=> 'template_name_error_empty'),
71             ),
72             'default' => '',
73             'value'  => '',
74             'width'  => '30',
75             'maxlength' => '255',
4c28d9 76             'searchable' => 1
b74ef5 77         ),
T 78         'diskspace' => array (
b1a6a5 79             'datatype' => 'INTEGER',
MC 80             'formtype' => 'TEXT',
81             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
82                     'errmsg'=> 'diskspace_error_empty'),
83             ),
84             'default' => '',
85             'value'  => '',
86             'width'  => '30',
87             'maxlength' => '255'
b74ef5 88         ),
T 89         'ram' => array (
b1a6a5 90             'datatype' => 'INTEGER',
MC 91             'formtype' => 'TEXT',
92             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
93                     'errmsg'=> 'ram_error_empty'),
94             ),
95             'default' => '',
96             'value'  => '',
97             'width'  => '30',
98             'maxlength' => '255'
b74ef5 99         ),
T 100         'ram_burst' => array (
b1a6a5 101             'datatype' => 'INTEGER',
MC 102             'formtype' => 'TEXT',
103             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
104                     'errmsg'=> 'ram_burst_error_empty'),
105             ),
106             'default' => '',
107             'value'  => '',
108             'width'  => '30',
109             'maxlength' => '255'
b74ef5 110         ),
T 111         'cpu_units' => array (
b1a6a5 112             'datatype' => 'INTEGER',
MC 113             'formtype' => 'TEXT',
114             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
115                     'errmsg'=> 'cpu_units_error_empty'),
116             ),
117             'default' => '1000',
118             'value'  => '',
119             'width'  => '30',
120             'maxlength' => '255'
b74ef5 121         ),
T 122         'cpu_num' => array (
b1a6a5 123             'datatype' => 'INTEGER',
MC 124             'formtype' => 'TEXT',
125             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
126                     'errmsg'=> 'cpu_num_error_empty'),
127             ),
128             'default' => '4',
129             'value'  => '',
130             'width'  => '30',
131             'maxlength' => '255'
b74ef5 132         ),
T 133         'cpu_limit' => array (
b1a6a5 134             'datatype' => 'INTEGER',
MC 135             'formtype' => 'TEXT',
136             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
137                     'errmsg'=> 'cpu_limit_error_empty'),
138             ),
139             'default' => '400',
140             'value'  => '',
141             'width'  => '30',
142             'maxlength' => '255'
b74ef5 143         ),
T 144         'io_priority' => array (
b1a6a5 145             'datatype' => 'INTEGER',
MC 146             'formtype' => 'TEXT',
147             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
148                     'errmsg'=> 'io_priority_error_empty'),
149             ),
150             'default' => '4',
151             'value'  => '',
152             'width'  => '30',
153             'maxlength' => '255'
b74ef5 154         ),
T 155         'hostname' => array (
b1a6a5 156             'datatype' => 'VARCHAR',
MC 157             'formtype' => 'TEXT',
158             'default' => '',
159             'value'  => '',
160             'width'  => '30',
161             'maxlength' => '255'
b74ef5 162         ),
T 163         'create_dns' => array (
b1a6a5 164             'datatype' => 'VARCHAR',
MC 165             'formtype' => 'CHECKBOX',
166             'default' => 'y',
167             'value'  => array(0 => 'n', 1 => 'y')
b74ef5 168         ),
T 169         'nameserver' => array (
b1a6a5 170             'datatype' => 'VARCHAR',
MC 171             'formtype' => 'TEXT',
172             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
173                     'errmsg'=> 'template_nameserver_error_empty'),
174             ),
175             'default' => '8.8.8.8 8.8.4.4',
176             'value'  => '',
177             'width'  => '30',
178             'maxlength' => '255',
4c28d9 179             'searchable' => 2
b74ef5 180         ),
T 181         'active' => array (
b1a6a5 182             'datatype' => 'VARCHAR',
MC 183             'formtype' => 'CHECKBOX',
184             'default' => 'y',
185             'value'  => array(0 => 'n', 1 => 'y')
b74ef5 186         ),
T 187         'description' => array (
b1a6a5 188             'datatype' => 'TEXT',
MC 189             'formtype' => 'TEXTAREA',
190             'default' => '',
191             'value'  => '',
192             'separator' => '',
193             'width'  => '',
194             'maxlength' => '',
195             'rows'  => '10',
196             'cols'  => '30'
b74ef5 197         ),
b1a6a5 198         //#################################
MC 199         // ENDE Datatable fields
200         //#################################
b74ef5 201     )
T 202 );
203
204 $form["tabs"]['advanced'] = array (
b1a6a5 205     'title'  => "Advanced",
MC 206     'width'  => 100,
207     'template'  => "templates/openvz_template_advanced_edit.htm",
208     'fields'  => array (
209         //#################################
210         // Begin Datatable fields
211         //#################################
b74ef5 212         'numproc' => array (
b1a6a5 213             'datatype' => 'VARCHAR',
MC 214             'formtype' => 'TEXT',
215             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
216                     'errmsg'=> 'numproc_error_empty'),
217             ),
218             'default' => '',
219             'value'  => '',
220             'width'  => '30',
221             'maxlength' => '255'
b74ef5 222         ),
T 223         'numtcpsock' => array (
b1a6a5 224             'datatype' => 'VARCHAR',
MC 225             'formtype' => 'TEXT',
226             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
227                     'errmsg'=> 'numtcpsock_error_empty'),
228             ),
229             'default' => '',
230             'value'  => '',
231             'width'  => '30',
232             'maxlength' => '255'
b74ef5 233         ),
T 234         'numothersock' => array (
b1a6a5 235             'datatype' => 'VARCHAR',
MC 236             'formtype' => 'TEXT',
237             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
238                     'errmsg'=> 'numothersock_error_empty'),
239             ),
240             'default' => '',
241             'value'  => '',
242             'width'  => '30',
243             'maxlength' => '255'
b74ef5 244         ),
T 245         'vmguarpages' => array (
b1a6a5 246             'datatype' => 'VARCHAR',
MC 247             'formtype' => 'TEXT',
248             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
249                     'errmsg'=> 'vmguarpages_error_empty'),
250             ),
251             'default' => '',
252             'value'  => '',
253             'width'  => '30',
254             'maxlength' => '255'
b74ef5 255         ),
T 256         'kmemsize' => array (
b1a6a5 257             'datatype' => 'VARCHAR',
MC 258             'formtype' => 'TEXT',
259             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
260                     'errmsg'=> 'kmemsize_error_empty'),
261             ),
262             'default' => '',
263             'value'  => '',
264             'width'  => '30',
265             'maxlength' => '255'
b74ef5 266         ),
T 267         'tcpsndbuf' => array (
b1a6a5 268             'datatype' => 'VARCHAR',
MC 269             'formtype' => 'TEXT',
270             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
271                     'errmsg'=> 'tcpsndbuf_error_empty'),
272             ),
273             'default' => '',
274             'value'  => '',
275             'width'  => '30',
276             'maxlength' => '255'
b74ef5 277         ),
T 278         'tcprcvbuf' => array (
b1a6a5 279             'datatype' => 'VARCHAR',
MC 280             'formtype' => 'TEXT',
281             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
282                     'errmsg'=> 'tcprcvbuf_error_empty'),
283             ),
284             'default' => '',
285             'value'  => '',
286             'width'  => '30',
287             'maxlength' => '255'
b74ef5 288         ),
T 289         'othersockbuf' => array (
b1a6a5 290             'datatype' => 'VARCHAR',
MC 291             'formtype' => 'TEXT',
292             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
293                     'errmsg'=> 'othersockbuf_error_empty'),
294             ),
295             'default' => '',
296             'value'  => '',
297             'width'  => '30',
298             'maxlength' => '255'
b74ef5 299         ),
T 300         'dgramrcvbuf' => array (
b1a6a5 301             'datatype' => 'VARCHAR',
MC 302             'formtype' => 'TEXT',
303             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
304                     'errmsg'=> 'dgramrcvbuf_error_empty'),
305             ),
306             'default' => '',
307             'value'  => '',
308             'width'  => '30',
309             'maxlength' => '255'
b74ef5 310         ),
T 311         'oomguarpages' => array (
b1a6a5 312             'datatype' => 'VARCHAR',
MC 313             'formtype' => 'TEXT',
314             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
315                     'errmsg'=> 'oomguarpages_error_empty'),
316             ),
317             'default' => '',
318             'value'  => '',
319             'width'  => '30',
320             'maxlength' => '255'
b74ef5 321         ),
T 322         'privvmpages' => array (
b1a6a5 323             'datatype' => 'VARCHAR',
MC 324             'formtype' => 'TEXT',
325             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
326                     'errmsg'=> 'privvmpages_error_empty'),
327             ),
328             'default' => '',
329             'value'  => '',
330             'width'  => '30',
331             'maxlength' => '255'
b74ef5 332         ),
T 333         'lockedpages' => array (
b1a6a5 334             'datatype' => 'VARCHAR',
MC 335             'formtype' => 'TEXT',
336             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
337                     'errmsg'=> 'lockedpages_error_empty'),
338             ),
339             'default' => '',
340             'value'  => '',
341             'width'  => '30',
342             'maxlength' => '255'
b74ef5 343         ),
T 344         'shmpages' => array (
b1a6a5 345             'datatype' => 'VARCHAR',
MC 346             'formtype' => 'TEXT',
347             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
348                     'errmsg'=> 'shmpages_error_empty'),
349             ),
350             'default' => '',
351             'value'  => '',
352             'width'  => '30',
353             'maxlength' => '255'
b74ef5 354         ),
T 355         'physpages' => array (
b1a6a5 356             'datatype' => 'VARCHAR',
MC 357             'formtype' => 'TEXT',
358             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
359                     'errmsg'=> 'physpages_error_empty'),
360             ),
361             'default' => '',
362             'value'  => '',
363             'width'  => '30',
364             'maxlength' => '255'
b74ef5 365         ),
T 366         'numfile' => array (
b1a6a5 367             'datatype' => 'VARCHAR',
MC 368             'formtype' => 'TEXT',
369             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
370                     'errmsg'=> 'numfile_error_empty'),
371             ),
372             'default' => '',
373             'value'  => '',
374             'width'  => '30',
375             'maxlength' => '255'
b74ef5 376         ),
T 377         'avnumproc' => array (
b1a6a5 378             'datatype' => 'VARCHAR',
MC 379             'formtype' => 'TEXT',
380             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
381                     'errmsg'=> 'avnumproc_error_empty'),
382             ),
383             'default' => '',
384             'value'  => '',
385             'width'  => '30',
386             'maxlength' => '255'
b74ef5 387         ),
T 388         'numflock' => array (
b1a6a5 389             'datatype' => 'VARCHAR',
MC 390             'formtype' => 'TEXT',
391             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
392                     'errmsg'=> 'numflock_error_empty'),
393             ),
394             'default' => '',
395             'value'  => '',
396             'width'  => '30',
397             'maxlength' => '255'
b74ef5 398         ),
T 399         'numpty' => array (
b1a6a5 400             'datatype' => 'VARCHAR',
MC 401             'formtype' => 'TEXT',
402             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
403                     'errmsg'=> 'numpty_error_empty'),
404             ),
405             'default' => '',
406             'value'  => '',
407             'width'  => '30',
408             'maxlength' => '255'
b74ef5 409         ),
T 410         'numsiginfo' => array (
b1a6a5 411             'datatype' => 'VARCHAR',
MC 412             'formtype' => 'TEXT',
413             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
414                     'errmsg'=> 'numsiginfo_error_empty'),
415             ),
416             'default' => '',
417             'value'  => '',
418             'width'  => '30',
419             'maxlength' => '255'
b74ef5 420         ),
T 421         'dcachesize' => array (
b1a6a5 422             'datatype' => 'VARCHAR',
MC 423             'formtype' => 'TEXT',
424             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
425                     'errmsg'=> 'dcachesize_error_empty'),
426             ),
427             'default' => '',
428             'value'  => '',
429             'width'  => '30',
430             'maxlength' => '255'
b74ef5 431         ),
T 432         'numiptent' => array (
b1a6a5 433             'datatype' => 'VARCHAR',
MC 434             'formtype' => 'TEXT',
435             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
436                     'errmsg'=> 'numiptent_error_empty'),
437             ),
438             'default' => '',
439             'value'  => '',
440             'width'  => '30',
441             'maxlength' => '255'
b74ef5 442         ),
T 443         'swappages' => array (
b1a6a5 444             'datatype' => 'VARCHAR',
MC 445             'formtype' => 'TEXT',
446             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
447                     'errmsg'=> 'swappages_error_empty'),
448             ),
449             'default' => '',
450             'value'  => '',
451             'width'  => '30',
452             'maxlength' => '255'
b74ef5 453         ),
T 454         'capability' => array (
b1a6a5 455             'datatype' => 'VARCHAR',
MC 456             'formtype' => 'TEXT',
457             'default' => '',
458             'value'  => '',
459             'width'  => '30',
460             'maxlength' => '255'
b74ef5 461         ),
503bbb 462         'features' => array (
FS 463             'datatype' => 'VARCHAR',
464             'formtype' => 'TEXT',
465             'default' => '',
466             'value'  => '',
467             'width'  => '30',
468             'maxlength' => '255'
469         ),
a3609a 470         'iptables' => array (
FS 471             'datatype' => 'VARCHAR',
472             'formtype' => 'TEXT',
473             'default' => '',
474             'value'  => '',
475             'width'  => '30',
476             'maxlength' => '255'
477         ),
ca0698 478         'custom' => array (
FS 479             'datatype' => 'TEXT',
480             'formtype' => 'TEXTAREA',
481             'default' => '',
482             'value'  => '',
483             'separator' => '',
484             'width'  => '',
485             'maxlength' => '',
486             'rows'  => '10',
487             'cols'  => '30',
488             'validators'    => array (  0 => array ('type'  => 'CUSTOM',
489                 'class' => 'validate_openvz',
490                 'function' => 'check_custom',
491                 'errmsg'=> 'custom_error'),
492             ),
493         ),
b1a6a5 494         //#################################
MC 495         // ENDE Datatable fields
496         //#################################
b74ef5 497     )
T 498 );
499
500
b1a6a5 501 ?>