<!-- FORM -->
<p><img src="<?php echo $site_url; ?>/assets/modules/dbedit/images/db.gif" align="absmiddle" alt="dBedit" title="" width='32' height='32' />&nbsp; Here you can add a new configuration to manage a database table. The database table must already exists and be accessible by ModX. </p>
<br />
<form name="mutate" id="form_mutate" method="POST" action="index.php?a=112&dba=<?php echo $dba==107?'109':'110'; ?>&id=<?php echo $module_id; ?>">
<input type="hidden" name="json_data" id="json_data" value="" />
<input type="hidden" name="db" id="prop_dbid" value="" />
<?php //* debug */ print __LINE__.': <pre>'.print_r($dbConfig,true) .'</pre><br />'; ?>
<table border='0' cellspacing='0' cellpadding='3'>
<tr><td colspan="2"><div class='split'></div></td></tr>
<tr>
<td scope="row">Table Name</td>
<td><div id="wait-for-me"><span>Select a the table to expose it's properties below.</span></div>
<?php
if( $dba==107 ){
//new table
	$names = listTables();
	if($names){
	$tags = '<select name="fld_tableName" id="prop_tablename" onchange="ajaxLoadConfig(this)">
	<option value=""></option>';
	foreach($names as $table)
		$tags .= '<option value="'.$table.'">'.$table.'</option>';

	$tags .= '</select>';
	}
}else  $tags = '<input type="text" name="fld_tableName" id="prop_tablename" size="30" onchange="ajaxLoadConfig(this)" value="" />';
?>
<?php echo $tags; ?>

<input type="button" name="btRefresh" value="refresh" accesskey="r" onclick="ajaxLoadConfig($('prop_tablename'))" /> <span  class='comment'>(refresh will reset all property fields)</span></td>
<td></td>
</tr>
function dropTable()
{
    global $mysqlHandle, $dbname, $tablename, $PHP_SELF, $queryStr, $errMsg;
    $queryStr = "DROP TABLE {$tablename}";
    mysql_select_db($dbname, $mysqlHandle);
    mysql_query($queryStr, $mysqlHandle);
    $errMsg = mysql_error();
    listTables();
}