Subversion Repositories computer_asset_manager_v1

Rev

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

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