Add more fields for editing, adjust select backend
[misc/kostenrechnung] / masks / sys_mask.php
1 <?php
2
3 function discover_masks()
4 {
5   $info = array();
6
7   if (($d = opendir($_SESSION['sys']['basedir'].'masks')) === false)
8     return $info;
9
10   while (($file = readdir($d)) !== false)
11     if (substr($file,-4) == '.php') {
12       $fname = substr($file,0,-4);
13       $info[] = array('id' => $fname, 'text' => $fname);
14     }
15   closedir($d);
16
17   return $info;
18 }
19
20 $mask = array(
21               'table' => 'sys_mask',
22               'title' => 'Liste der Menüpunkte',
23               'join' => array('sys_menu ON sys_mask.menu = sys_menu.id'),
24               'list' => array(
25                               'id' => array(
26                                             'name' => 'ID',
27                                             'visible' => false,
28                                             'sql' => 'sys_mask.id',
29                                             ),
30                               'mask' => array(
31                                             'name' => 'Dateiname',
32                                             'width' => 100,
33                                             ),
34                               'title' => array(
35                                             'name' => 'Beschreibung',
36                                             'width' => 150,
37                                             ),
38                               'menutitle' => array(
39                                             'name' => 'Menüpunkt',
40                                             'width' => 120,
41                                             ),
42                               'menu' => array(
43                                             'name' => 'Menü',
44                                             'sql' => 'sys_menu.name',
45                                             'width' => 100,
46                                             ),
47                               'edit' => array(
48                                             'name' => 'Edit',
49                                             'width' => 20,
50                                             'specs' => "ClassName: 'aligncenter'",
51                                             ),
52                               'priority' => array(
53                                             'name' => 'Priorität',
54                                             'width' => 30,
55                                             'type' => 'number',
56                                             'specs' => "ClassName: 'alignright'",
57                                             'sql' => 'sys_mask.priority',
58                                             ),
59                               'sys_user' => array(
60                                             'name' => 'Edit',
61                                             'width' => 50,
62                                             'visible' => false,
63                                             'sql' => 'sys_mask.sys_user',
64                                             ),
65                               'sys_edit' => array(
66                                             'name' => 'Datum',
67                                             'width' => 80,
68                                             'type' => 'date',
69                                             'visible' => false,
70                                             'sql' => 'sys_mask.sys_edit',
71                                             ),
72                               ),
73               'rows' => 20,
74               'edit' => array(
75                               'mask' => array(
76                                             'name' => 'Dateiname',
77                                             'type' => 'select',
78                                             'options' => discover_masks(),
79                                             'size' => 30,
80                                             ),
81                               'title' => array(
82                                             'name' => 'Beschreibung',
83                                             'type' => 'text',
84                                             'size' => 40,
85                                             ),
86                               'menutitle' => array(
87                                             'name' => 'Menüpunkt',
88                                             'type' => 'text',
89                                             'size' => 40,
90                                             ),
91                               'menu' => array(
92                                             'name' => 'Menü',
93                                             'type' => 'select',
94                                             'options' => 'SELECT id,name AS text FROM sys_menu ORDER BY name',
95                                             'size' => 10,
96                                             ),
97                               'edit' => array(
98                                             'name' => 'Edit',
99                                             'type' => 'boolean',
100                                             'size' => 10,
101                                             ),
102                               'priority' => array(
103                                             'name' => 'Priorität',
104                                             'type' => 'number',
105                                             'size' => 10,
106                                             ),
107                               ),
108               );
109
110 ?>