Subversion Repositories computer_asset_manager_v1

Rev

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