Subversion Repositories computer_asset_manager_v1

Rev

Rev 49 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php
100 rodolico 2
 
3
/*
4
 * changed 'default'=>'null' to 'default'=>null
5
 */
1 rodolico 6
define ( MAX_INPUT_FIELD_DISPLAY, 40 ); // this is the maximum input field size
7
define ( IMAGE_DIRECTORY, '/pictures/' );  // relative URL where pictures are stored
8
define ( EDIT_IMAGE_HEIGHT, 100 );         // height for thumbnail of pictuers
9
define ( MAX_UPLOAD_FILE_SIZE, 1024*1024*10 ); // 10 meg
10
define (DEFAULT_TEXTAREA_HEIGHT, 5 );
11
define ( DEFAULT_TABLE, 'client');
12
global $DATABASE_DEFINITION;
13
 
14
$DATABASE_DEFINITION = array(
15
   /* Basically a configuration file equivilent to a windows INI  */
16
   '_system' => array( 
17
      'table name' => '_system',
18
      'key field' => '_system_id ',
19
      'display name' => 'System Control',
20
      'display columns' => array('_system_id','group_name','key_name','theValue'),
21
      'display query' => 'select _system_id,group_name,theValue,key_name,added_date from _system',
22
      'field info' => array(
23
         /* date record was closed */
100 rodolico 24
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 25
         '_system_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
26
         /* used to group keys together */
27
         'group_name' => array('required' => true , 'type' => 'string' , 'width' => 64),
28
         /* the actual value of this entry */
29
         'theValue' => array('type' => 'text'),
30
         /* date record was added */
31
         'added_date' => array('required' => true , 'type' => 'datetime'),
32
         /* key into this value */
33
         'key_name' => array('required' => true , 'type' => 'string' , 'width' => 64)
34
      )
35
   ),
36
   /* These are attributes that can be applied to a device */
37
   'attrib' => array( 
38
      'table name' => 'attrib',
39
      'key field' => 'attrib_id',
40
      'display name' => 'Device Attributes',
41
      'display columns' => array('name'),
42
      'display query' => 'select attrib.attrib_id,name from attrib',
43
      'field info' => array(
44
         /* date record was deleted/supserceded */
100 rodolico 45
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 46
         /* the visible displayed name */
47
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
48
         /* date record was added */
49
         'added_date' => array('required' => true , 'type' => 'datetime'),
50
         'attrib_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10)
51
      )
52
   ),
53
   /* information on a particular client */
54
   'client' => array( 
55
      'table name' => 'client',
56
      'key field' => 'client_id',
57
      'display name' => 'Clients',
58
      'display columns' => array('name','added_date'),
59
      'display query' => 'select client.client_id,name,added_date from client',
60
      'field info' => array(
61
         /* date record was deleted/supserceded */
100 rodolico 62
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 63
         /* These are internal notes visible only to us */
64
         'internal_notes' => array('type' => 'text'),
65
         /* world visible notes on the client */
66
         'notes' => array('type' => 'text'),
67
         /* the visible displayed name */
68
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
69
         'client_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
70
         /* date record was added */
71
         'added_date' => array('required' => true , 'type' => 'datetime')
72
      )
73
   ),
74
   /* information on a site which is tied to a client */
75
   'site' => array( 
76
      'table name' => 'site',
77
      'key field' => 'site_id',
78
      'display name' => 'Sites',
79
      'display columns' => array('Client', 'Site'),
80
      'display query' => 'select site.site_id,client.name Client,site.name Site from site join client using (client_id) order by client.name',
81
      'field info' => array(
82
         /* date record was deleted/supserceded */
100 rodolico 83
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 84
         /* Just a place to record some notes */
85
         'notes' => array('type' => 'text'),
86
         /* the visible displayed name */
87
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
88
         'client_id' => array('type' => 'lookup', 'table' => 'client', 'keyfield' => 'client_id', 'display_field' => 'name'),
89
         'site_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
90
         /* date record was added */
91
         'added_date' => array('required' => true , 'type' => 'datetime')
92
      )
93
   ),
94
   /* information on an individual device computer router print */
95
   'device' => array( 
96
      'table name' => 'device',
97
      'display name' => 'Devices',
98
      'key field' => 'device_id',
99
      'display columns' => array('Type','Device','Parent'),
100
      'display query' => 'select device.device_id,device.name Device, device_type.name Type, parent.name Parent 
101
                          from device left outer join device parent on device.part_of = parent.device_id 
102
                               join device_type on device.device_type_id = device_type.device_type_id
103
                          order by device_type.show_as_system desc, device_type.name, device.name',
104
      'field info' => array(
105
         'part_of' => array('type' => 'lookup', 'table' => 'device', 'keyfield' => 'device_id', 'display_field' => 'name', 'null_ok' => true ),
106
         /* date record was deleted/supserceded */
100 rodolico 107
         'removed_date' => array('type' => 'date', 'required' => false, 'default'=>null ),
1 rodolico 108
         'device_type_id' => array('type' => 'lookup', 'table' => 'device_type', 'keyfield' => 'device_type_id', 'display_field' => 'name'),
109
         /* the visible displayed name */
110
         'name' => array('required' => true , 'type' => 'string' , 'width' => 255),
111
         'site_id' => array('type' => 'lookup', 'table' => 'site', 'keyfield' => 'site_id', 'display_field' => 'name'),
112
         'device_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
113
         /* Just a place to record some notes */
114
         'notes' => array('type' => 'text'),
37 rodolico 115
         /* Just a place to record some notes */
116
         'restrictions' => array('type' => 'text'),
49 rodolico 117
         /* serial number */
118
         'serial' => array( 'type' => 'string', 'width' => 64 ),
1 rodolico 119
         /* date record was added */
120
         'added_date' => array('required' => true , 'type' => 'datetime')
121
      )
122
   ),
123
   /* links devices and their attributes together */
124
   'device_attrib' => array( 
125
      'table name' => 'device_attrib',
126
      'key field' => 'device_attrib_id',
127
      'display name' => 'Attributes for Devices',
128
      'display columns' => array('Device','Attribute','Value'),
129
      'display query' => 'select device_attrib.device_attrib_id,device.name Device,attrib.name Attribute,device_attrib.value Value 
130
                          from device_attrib join device using (device_id) 
131
                               join device_type using (device_type_id) 
132
                               join attrib using (attrib_id) 
133
                          order by device_type.show_as_system desc, device.name,attrib.name',
134
      'field info' => array(
100 rodolico 135
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 136
         /* The actual value of this attribute. */
137
         'value' => array('type' => 'text'),
138
         'device_id' => array('type' => 'lookup', 'table' => 'device', 'keyfield' => 'device_id', 'display_field' => 'name'),
139
         'device_attrib_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
140
         /* date record was added */
141
         'added_date' => array('required' => true , 'type' => 'datetime'),
142
         'attrib_id' => array('type' => 'lookup', 'table' => 'attrib', 'keyfield' => 'attrib_id', 'display_field' => 'name')
143
      )
144
   ),
145
   /* simply a list of device types ie computer printer whatever */
146
   'device_type' => array( 
147
      'table name' => 'device_type',
148
      'key field' => 'device_type_id',
149
      'display name' => 'Device Types',
150
      'display columns' => array('System','Name'),
151
      'display query' => 'select removed_date,device_type_id,name Name,added_date,show_as_system System from device_type',
152
      'field info' => array(
153
         /* date record was deleted/supserceded */
100 rodolico 154
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 155
         'device_type_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
156
         /* the visible displayed name */
157
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
158
         /* date record was added */
159
         'added_date' => array('required' => true , 'type' => 'datetime'),
160
         'show_as_system' => array('default' => 'Y' , 'type' => 'bool' , 'width' => 1)
161
      )
162
   ),
163
   /* table for logging into the the maintenance system */
164
   'login' => array( 
165
      'table name' => 'login',
166
      'key field' => 'login_id',
167
      'display name' => 'Login',
168
      'display columns' => array('email','Restrictions','Added'),
169
      'display query' => 'select removed_date Removed,where_clause Restrictions,email,added_date Added,login_id from login',
170
      'field info' => array(
171
         /* date record was closed */
100 rodolico 172
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
1 rodolico 173
         /* the encrypted password of the user */
174
         'pass' => array('type' => 'string' , 'width' => 32),
175
         /* clause that limits what a user can see */
176
         'where_clause' => array('type' => 'text'),
177
         /* email address used as login id */
178
         'email' => array('required' => true , 'type' => 'string' , 'width' => 64),
179
         /* date record was added */
180
         'added_date' => array('required' => true , 'type' => 'datetime'),
181
         'login_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10)
182
      )
183
   ),
184
   /* We keep the entire menu structure here so modules can modify it */
185
   'menu' => array( 
186
      'table name' => 'menu',
187
      'key field' => 'menu_id',
188
      'display name' => 'System Menu',
189
      'display columns' => array('parent_id','caption','menu_id','url'),
190
      'display query' => 'select parent_id,caption,menu_id,url from menu',
191
      'field info' => array(
192
         'parent_id' => array('type' => 'lookup', 'table' => 'menu', 'keyfield' => 'menu_id', 'display_field' => 'name'),
193
         /* The actual caption displayed */
194
         'caption' => array('required' => true , 'type' => 'string' , 'width' => 20),
195
         'menu_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
196
         /* the url of the page/script to call or null if this contains sub-options */
197
         'url' => array('type' => 'string' , 'width' => 120)
198
      )
199
   ),
200
   /* holds definition for report */
201
   'report' => array( 
202
      'table name' => 'report',
203
      'key field' => 'report_id',
204
      'display name' => 'Reports',
205
      'display columns' => array( 'name','screen_report'),
206
      'display query' => 'select screen_report,query,name,report_id,parameters from report',
207
      'field info' => array(
208
         /* Each screen can be assigned a bit and this will show up on a screen */
209
         'screen_report' => array('type' => 'int'),
210
         /* Query to be executed */
211
         'query' => array('required' => true , 'type' => 'text'),
212
         /* Display Name of Report */
213
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
214
         'report_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
215
         /* All parameters used in above */
216
         'parameters' => array('type' => 'text')
217
      )
218
   )
219
);
220
?>