Subversion Repositories computer_asset_manager_v1

Rev

Rev 100 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

<?php

/*
 * changed 'default'=>'null' to 'default'=>null
 */
define ( MAX_INPUT_FIELD_DISPLAY, 40 ); // this is the maximum input field size
define ( IMAGE_DIRECTORY, '/pictures/' );  // relative URL where pictures are stored
define ( EDIT_IMAGE_HEIGHT, 100 );         // height for thumbnail of pictuers
define ( MAX_UPLOAD_FILE_SIZE, 1024*1024*10 ); // 10 meg
define (DEFAULT_TEXTAREA_HEIGHT, 5 );
define ( DEFAULT_TABLE, 'client');
define ( CHILD_KEY_INSERT_TAG, 'new'); 
define ( CHILD_KEY_DELIMITER, '-' ); 
define ( CHILD_KEY_TAG, 'child_table' );

global $DATABASE_DEFINITION;
 
$DATABASE_DEFINITION = array(
   /* Basically a configuration file equivilent to a windows INI  */
   '_system' => array( 
      'table name' => '_system',
      'key field' => '_system_id ',
      'display name' => 'System Control',
      'display columns' => array('_system_id','group_name','key_name','theValue'),
      'display query' => 'select _system_id,group_name,theValue,key_name,added_date from _system',
      'field info' => array(
         /* date record was closed */
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         '_system_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
         /* used to group keys together */
         'group_name' => array('required' => true , 'type' => 'string' , 'width' => 64),
         /* the actual value of this entry */
         'theValue' => array('type' => 'text'),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime'),
         /* key into this value */
         'key_name' => array('required' => true , 'type' => 'string' , 'width' => 64)
      )
   ),
   /* information on a particular client */
   'client' => array( 
      'table name' => 'client',
      'key field' => 'client_id',
      'display name' => 'Clients',
      'display columns' => array('name','added_date'),
      'display query' => 'select client.client_id,name,added_date from client',
      'field info' => array(
         /* date record was deleted/supserceded */
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         /* These are internal notes visible only to us */
         'internal_notes' => array('type' => 'text'),
         /* world visible notes on the client */
         'notes' => array('type' => 'text'),
         /* the visible displayed name */
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
         'client_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime')
      )
   ),
   /* information on a site which is tied to a client */
   'site' => array( 
      'table name' => 'site',
      'key field' => 'site_id',
      'display name' => 'Sites',
      'display columns' => array('Client', 'Site'),
      'display query' => 'select site.site_id,client.name Client,site.name Site from site join client using (client_id) order by client.name',
      'field info' => array(
         /* date record was deleted/supserceded */
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         /* Just a place to record some notes */
         'notes' => array('type' => 'text'),
         /* the visible displayed name */
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
         'client_id' => array('type' => 'lookup', 'table' => 'client', 'keyfield' => 'client_id', 'display_field' => 'name'),
         'site_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime')
      )
   ),
   /* information on an individual device computer router print */
   'device' => array( 
      'table name' => 'device',
      'display name' => 'Devices',
      'key field' => 'device_id',
      'display columns' => array('Type','Device','Parent'),
      'display query' => 'select device.device_id,device.name Device, device_type.name Type, parent.name Parent 
                          from device left outer join device parent on device.part_of = parent.device_id 
                               join device_type on device.device_type_id = device_type.device_type_id
                          order by device_type.show_as_system desc, device_type.name, device.name',
      'field info' => array(
         'part_of' => array('type' => 'lookup', 'table' => 'device', 'keyfield' => 'device_id', 'display_field' => 'name', 'null_ok' => true ),
         /* date record was deleted/supserceded */
         'removed_date' => array('type' => 'date', 'required' => false, 'default'=>null ),
         'device_type_id' => array('type' => 'lookup', 'table' => 'device_type', 'keyfield' => 'device_type_id', 'display_field' => 'name'),
         /* the visible displayed name */
         'name' => array('required' => true , 'type' => 'string' , 'width' => 255),
         'site_id' => array('type' => 'lookup', 'table' => 'site', 'keyfield' => 'site_id', 'display_field' => 'name'),
         'device_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
         /* Just a place to record some notes */
         'notes' => array('type' => 'text'),
         /* Just a place to record some notes */
         'restrictions' => array('type' => 'text'),
         /* serial number */
         'serial' => array( 'type' => 'string', 'width' => 64 ),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime')
      )
   ),
   /* links devices and their attributes together */
   'device_attrib' => array( 
      'table name' => 'device_attrib',
      'key field' => 'device_attrib_id',
      'display name' => 'Attributes for Devices',
      'display columns' => array('Device','Attribute','Value'),
      'display query' => 'select device_attrib.device_attrib_id,device.name Device,attrib.name Attribute,device_attrib.value Value 
                          from device_attrib join device using (device_id) 
                               join device_type using (device_type_id) 
                               join attrib using (attrib_id) 
                          order by device_type.show_as_system desc, device.name,attrib.name',
      'field info' => array(
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         /* The actual value of this attribute. */
         'value' => array('type' => 'text'),
         'device_id' => array('type' => 'lookup', 'table' => 'device', 'keyfield' => 'device_id', 'display_field' => 'name'),
         'device_attrib_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime'),
         'attrib_id' => array('type' => 'lookup', 'table' => 'attrib', 'keyfield' => 'attrib_id', 'display_field' => 'name')
      )
   ),
   /* simply a list of device types ie computer printer whatever */
   'device_type' => array( 
      'table name' => 'device_type',
      'key field' => 'device_type_id',
      'display name' => 'Device Types',
      'display columns' => array('System','Name'),
      'display query' => 'select removed_date,device_type_id,name Name,added_date,show_as_system System from device_type',
      'field info' => array(
         /* date record was deleted/supserceded */
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         'device_type_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
         /* the visible displayed name */
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime'),
         'show_as_system' => array('default' => 'Y' , 'type' => 'bool' , 'width' => 1)
      )
   ),
   /* table for logging into the the maintenance system */
   'login' => array( 
      'table name' => 'login',
      'key field' => 'login_id',
      'display name' => 'Login',
      'display columns' => array('email','Restrictions','Added'),
      'display query' => 'select removed_date Removed,where_clause Restrictions,email,added_date Added,login_id from login',
      'field info' => array(
         /* date record was closed */
         'removed_date' => array('type' => 'datetime', 'required' => false, 'default'=>null ),
         /* the encrypted password of the user */
         'pass' => array('type' => 'string' , 'width' => 32),
         /* clause that limits what a user can see */
         'where_clause' => array('type' => 'text'),
         /* email address used as login id */
         'email' => array('required' => true , 'type' => 'string' , 'width' => 64),
         /* date record was added */
         'added_date' => array('required' => true , 'type' => 'datetime'),
         'login_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10)
      )
   ),
   /* We keep the entire menu structure here so modules can modify it */
   'menu' => array( 
      'table name' => 'menu',
      'key field' => 'menu_id',
      'display name' => 'System Menu',
      'display columns' => array('parent_id','caption','menu_id','url'),
      'display query' => 'select parent_id,caption,menu_id,url from menu',
      'field info' => array(
         'parent_id' => array('type' => 'lookup', 'table' => 'menu', 'keyfield' => 'menu_id', 'display_field' => 'name'),
         /* The actual caption displayed */
         'caption' => array('required' => true , 'type' => 'string' , 'width' => 20),
         'menu_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
         /* the url of the page/script to call or null if this contains sub-options */
         'url' => array('type' => 'string' , 'width' => 120)
      )
   ),
   /* holds definition for report */
   'report' => array( 
      'table name' => 'report',
      'key field' => 'report_id',
      'display name' => 'Reports',
      'display columns' => array( 'name','screen_report'),
      'display query' => 'select screen_report,query,name,report_id,parameters from report',
      'field info' => array(
         /* Each screen can be assigned a bit and this will show up on a screen */
         'screen_report' => array('type' => 'int'),
         /* Query to be executed */
         'query' => array('required' => true , 'type' => 'text'),
         /* Display Name of Report */
         'name' => array('required' => true , 'type' => 'string' , 'width' => 64),
         'report_id' => array('keyfield' => true , 'required' => true , 'readonly' => true , 'type' => 'int'),
         /* All parameters used in above */
         'parameters' => array('type' => 'text')
      )
   )
);
?>