CREATE TABLE sys_component (
  id int(5) NOT NULL auto_increment,
  name varchar(50) default NULL,
  shortname varchar(30) default NULL,
  varname varchar(30) default NULL,
  descp text,
  version varchar(5) NOT NULL default '',
  menulink varchar(80) NOT NULL default '',
  menuseq int(2) NOT NULL default '0',
  display varchar(10) default NULL,
  serialkey text,
  PRIMARY KEY  (id)
) TYPE=MyISAM;


CREATE TABLE sys_sequence (
  seq_id int(10) NOT NULL auto_increment,
  type varchar(30) default NULL,
  module int(5) default NULL,
  seq int(5) default NULL,
  PRIMARY KEY  (seq_id)
) TYPE=MyISAM;


CREATE TABLE sys_modcolumn (
  col_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  field_id int(10) default NULL,
  label text,
  valign varchar(20) default NULL,
  align varchar(20) default NULL,
  width varchar(5) default NULL,
  sort varchar(5) default NULL,
  seq int(10) default NULL,
  PRIMARY KEY  (col_id)
) TYPE=MyISAM;


CREATE TABLE sys_modfield (
  field_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  field_type varchar(30) default NULL,
  label text NOT NULL,
  valign varchar(20) NOT NULL default '',
  align varchar(20) NOT NULL default '',
  name varchar(50) default NULL,
  value text,
  value_php varchar(5) default NULL,  
  width varchar(5) default NULL,
  height varchar(5) default NULL,
  rows int(10) default NULL,
  location varchar(10) default NULL,
  validate varchar(30) default NULL,
  multiple varchar(5) default NULL,
  size int(10) default NULL,
  seq int(10) default NULL,
  toolbar varchar(20) default NULL,
  op_data int(10) default NULL,
  op_datalabel int(10) default NULL,
  op_datavalue int(10) default NULL,
  tmp_field_id int(10) default NULL,
  PRIMARY KEY  (field_id)
) TYPE=MyISAM;


CREATE TABLE sys_modfieldtmp (
  field_id int(10) default NULL,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  value text,
  value_php varchar(5) default NULL,    
  op_data int(10) default NULL,
  op_datalabel int(10) default NULL,
  op_datavalue int(10) default NULL
) TYPE=MyISAM;


CREATE TABLE sys_modobject (
  object_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  mode varchar(30) default NULL,
  name varchar(50) default NULL,
  data varchar(50) default NULL,
  type varchar(30) default NULL,
  menu int(5) default NULL,
  seq int(5) default NULL,
  listno int(5) default NULL,
  record_sql text,
  record_order text,
  record_sort varchar(5) default NULL,
  record_code text,
  record_action text,
  record_colno int(5) default NULL,
  record_listno int(5) default NULL,
  record_nav varchar(5) default NULL,
  record_search varchar(5) default NULL,
  form_success text,
  form_notsuccess text,
  form_action text,
  form_submit text,
  form_back text,
  tmp_object_id int(10) default NULL,
  PRIMARY KEY  (object_id)
) TYPE=MyISAM;


CREATE TABLE sys_modoption (
  option_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) NOT NULL default '0',
  field_id int(10) default NULL,
  op_label text,
  op_value text,
  op_default varchar(5) default NULL,  
  PRIMARY KEY  (option_id)
) TYPE=MyISAM;


CREATE TABLE sys_modoptiontmp (
  option_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) NOT NULL default '0',
  field_id int(10) default NULL,
  op_label text,
  op_value text,
  op_default varchar(5) default NULL,  
  PRIMARY KEY  (option_id)
) TYPE=MyISAM;


CREATE TABLE sys_modrecord (
  fld_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  field_id int(10) default NULL,
  PRIMARY KEY  (fld_id)
) TYPE=MyISAM;


CREATE TABLE sys_module (
  mod_id int(10) NOT NULL auto_increment,
  mod_name varchar(100) default NULL,
  mod_icon varchar(50) default NULL,
  mod_descp text,
  mod_doc text,
  mod_version varchar(30) default NULL,  
  PRIMARY KEY  (mod_id)
) TYPE=MyISAM;



CREATE TABLE sys_modvar (
  var_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  variable text,
  var_name text,
  var_exist text,
  var_notexist text,
  PRIMARY KEY  (var_id)
) TYPE=MyISAM;


CREATE TABLE sys_modwhere (
  where_id int(10) NOT NULL auto_increment,
  mod_id int(10) default NULL,
  object_id int(10) default NULL,
  field_id int(10) default NULL,
  sql_equation varchar(10) default NULL,
  sql_value text,
  sql_andor varchar(5) default NULL,
  PRIMARY KEY  (where_id)
) TYPE=MyISAM;


CREATE TABLE sys_thirdparam (
  app_id int(10) default NULL,
  app_user text,
  app_param text,
  app_value text
) TYPE=MyISAM;


CREATE TABLE sys_thirdparty (
  app_id int(10) NOT NULL auto_increment,
  name varchar(100) default NULL,
  url text,
  icon varchar(50) default NULL,
  targetwin varchar(10) default NULL,
  PRIMARY KEY  (app_id)
) TYPE=MyISAM;


CREATE TABLE sys_thirdtemp (
  temp_id int(10) default NULL,
  app_user text,
  app_param text,
  app_value text
) TYPE=MyISAM;

CREATE TABLE sys_variable (
  attribute varchar(50) default NULL,
  value text
) TYPE=MyISAM;

INSERT INTO sys_variable VALUES ('sys_skin', 'default');
INSERT INTO sys_component VALUES ('', 'Modules Builder', 'modbuild', 'modbuild', NULL, '4.0', '', 0, NULL, '');
INSERT INTO sys_variable VALUES ('modbuild_css', 'body{font-family: arial; color: #4C4C4C; font-size: 12; }\r\ntd{ font-family: arial; color: #4C4C4C; font-size: 12; }	\r\ninput{ font-family: arial; color: #4C4C4C; font-size: 12; }	\r\nselect{ font-family: arial; color: #4C4C4C; font-size: 12; }\r\ntextarea{ font-family: arial; color: #4C4C4C; font-size: 12; }	\r\n\r\na:link {text-decoration:none; color: #0000FF;}\r\na:active {text-decoration:none; color: #0000FF;}\r\na:visited {text-decoration:none; color: #00000FF;}\r\na:hover {text-decoration:underline; color: #0000FF;}');
