***************************************************************************/
include "prepend.inc.php";
$Server = getData("Server", "integer");
$defaultget = getData("PHP_SELF") . "?Server={$Server}&";
$mode = getData("mode");
$submode = getData("submode");
if (!$mode) {
    $mode = "main";
}
$Sortorder = getData("Sortorder");
$Sortfield = getData("Sortfield");
$menu = new MenuBar();
$menu->registerMenu("main", "Main", $defaultget . "mode=main&" . SID);
$menu->selectMenu($mode);
$menu->renderHTML();
$html = $menu->getHTML();
unset($menu);
$html .= "<h1> Database  " . $DB->Name($Server) . " - User " . $DB->User($Server) . "</h1>";
// different views
switch ($mode) {
    case "main":
        switch ($submode) {
            case "execute":
                $statement = trim(getData("statement"));
                $html .= "<form action=\"database_detail.php\" method=\"post\" enctype=\"application/x-www-form-urlencoded\">" . "<input type=\"hidden\" name=\"Server\" value=\"{$Server}\">" . "<input type=\"hidden\" name=\"mode\" value=\"main\">" . "<input type=\"hidden\" name=\"submode\" value=\"execute\">" . "<textarea name=\"statement\" cols=\"80\" rows=\"5\" wrap=\"VIRTUAL\" style=\"width: 400px\">" . $statement . "</textarea><br>" . "<input type=\"Submit\" name=\"BUTTON\" value=\"Execute\">";
                $html .= "</form></td></tr></table>";
                $tbl = new DataTable($Server);
                $tbl->setSql($statement);
                $tbl->setSorting(1);
                $tbl->setSort($Sortfield, $Sortorder);
                $tbl->loadData();
/*
$html.="<a href=\"".$defaultget."mode=main&submode=analyze&".SID."\">".
"<img border=0 src=\"images/analyze.gif\" alt=\"Analyze Table $Tablename\" width=32 height=32><br>Analyze</a>";
$html.="</td><td align=center>";
*/
$menu = new MenuBar();
$menu->registerMenu("main", "Main", $defaultget . "mode=main&" . SID);
$menu->registerMenu("column", "Column Data", $defaultget . "mode=column&" . SID);
$menu->registerMenu("indizes", "Indizes", $defaultget . "mode=indizes&" . SID);
$menu->registerMenu("info", "Table Info", $defaultget . "mode=info&" . SID);
$menu->registerMenu("content", "Table Content", $defaultget . "mode=content&" . SID);
$menu->registerMenu("constraints", "Constraints", $defaultget . "mode=constraints&" . SID);
$menu->registerMenu("triggers", "Triggers", $defaultget . "mode=triggers&" . SID);
$menu->selectMenu($mode);
$menu->renderHTML();
$html .= $menu->getHTML();
unset($menu);
$html .= "<h1> Database  " . $DB->Name($Server) . " - Table  " . $Tablename . "</h1>";
// different views
switch ($mode) {
    case "column":
        switch ($submode) {
            default:
                // COLUMN DEFAULT
                if (isset($Tablename)) {
                    $tbl = new Table($Server);
                    $tbl->setOwner($User);
                    $tbl->setName($Tablename);
                    $tbl->getData();
                    // table comment
                    if ($tbl->comments) {