Blame | Last modification | View Log | Download | RSS feed
<?php
$common_cgi = '';
switch ($_SERVER['SERVER_NAME']) {
case 'zoe.dailydata.net' : mysql_connect("localhost", "dailydata", "sachemic") or die(mysql_error());
mysql_select_db("camp") or die(mysql_error());
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/home/www/common-cgi' );
break;
default : mysql_connect("localhost", "test", "test") or die(mysql_error());
mysql_select_db("camp") or die(mysql_error());
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/home/www/common-cgi' );
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/includes' );
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/includes/library' );
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/home/rodolico/Desktop/wip/common-cgi' );
break;
}
define(VERSION,'0.2');
define(BUILD_DATE,'20081104');
session_start(); // use sessions throughout
global $DATABASE_DEFINITION;
$DATABASE_DEFINITION = array(
'client' => array(
'table name' => 'client',
'key field' => 'client_id',
'display columns' => array('client_id','name'),
'display query' => 'select client_id,name from article',
'field info' => array(
'client_id' => array('keyfield' => 1 , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
'name' => array('type' => 'string' , 'width' => 64),
'notes' => array('type' => 'text', 'width'=> 80 ),
'internal_notes' => array('type' => 'text', 'width'=> 80 ),
'added_date' => array('type' => 'date'),
'removed_date' => array('type' => 'date')
)
),
'site' => array(
'table name' => 'site',
'key field' => 'site_id',
'display columns' => array('site_id','name'),
'display query' => 'select site_id,name from site',
'field info' => array(
'site_id' => array('keyfield' => 1 , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
'client_id' => array( 'type' => 'lookup', // this is the field type, and must be ints
'table' => 'client', // remote table name
'keyfield' => 'client_id', // keyfield in remote table, ie category.category_id
'display_field' => 'name' // this is the column displayed to the user
),
'name' => array('type' => 'string' , 'width' => 64),
'notes' => array('type' => 'text', 'width'=> 80 ),
'added_date' => array('type' => 'date'),
'removed_date' => array('type' => 'date')
)
),
'device' => array(
'table name' => 'device',
'key field' => 'device_id',
'display columns' => array('name'),
'display query' => 'select device_id,name from device',
'field info' => array(
'device_id' => array('keyfield' => 1 , 'required' => true , 'readonly' => true , 'type' => 'int' , 'width' => 10),
'name' => array('required' => true , 'default' => '' , 'type' => 'string' , 'width' => 255),
'part_of' => array( 'type' => 'lookup', // this is the field type, and must be ints
'table' => 'device', // remote table name
'keyfield' => 'device_id', // keyfield in remote table, ie category.category_id
'display_field' => 'name', // this is the column displayed to the user
'null_ok' => true
),
'device_type_id' => array( 'type' => 'lookup', // this is the field type, and must be ints
'table' => 'device_type', // remote table name
'keyfield' => 'device_type_id', // keyfield in remote table, ie category.category_id
'display_field' => 'name' // this is the column displayed to the user
),
'site_id' => array( 'type' => 'lookup', // this is the field type, and must be ints
'query' => "select site_id,concat(client.name, ' - ', site.name) from site join client on site.client_id = client.client_id order by client.name,site.name",
'table' => 'site', // remote table name
'keyfield' => 'site_id', // keyfield in remote table, ie category.category_id
'display_field' => 'name' // this is the column displayed to the user
),
'notes' => array('type' => 'text', 'width'=> 80 ),
'name' => array('required' => true , 'default' => '' , 'type' => 'string' , 'width' => 64),
'added_date' => array('type' => 'date'),
'removed_date' => array('type' => 'date')
),
'children' => array(
array( 'table' => 'device', 'update_field' => 'site_id','keyfield'=>'part_of' )
)
)
);
include_once('functions.php');
?>
Generated by GNU Enscript 1.6.5.90.