XHTML fixes. SQL quoting fixes. Unify functions to alter a column. Add browse action...
authorsoranzo <soranzo>
Sat, 5 May 2007 02:20:24 +0000 (02:20 +0000)
committersoranzo <soranzo>
Sat, 5 May 2007 02:20:24 +0000 (02:20 +0000)
colproperties.php
tblproperties.php

index 383730fc76504f78f18da2ea9f94ce22f04ea5ee..06b5d12125df2db474513f548dd290e324283cc5 100644 (file)
 
                switch ($_REQUEST['stage']) {
                        case 1:
-                               global $lang;
-
                                $misc->printTrail('column');
-                               $misc->printTitle($lang['straltercolumn'], 'pg.column.alter'); 
+                               $misc->printTitle($lang['stralter'], 'pg.column.alter'); 
                                $misc->printMsg($msg);
 
+                               echo "<script src=\"tables.js\" type=\"text/javascript\"></script>";
                                echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
 
                                // Output table header
                                echo "<table>\n";
-                               echo "<tr><th class=\"data required\">{$lang['strname']}</th>";
+                               echo "<tr><th class=\"data required\">{$lang['strname']}</th>\n";
                                if ($data->hasAlterColumnType()) {
-                                       echo "<th class=\"data required\" colspan=\"2\">{$lang['strtype']}</th>";
-                                       echo "<th class=\"data\">{$lang['strlength']}</th>";
+                                       echo "<th class=\"data required\" colspan=\"2\">{$lang['strtype']}</th>\n";
+                                       echo "<th class=\"data\">{$lang['strlength']}</th>\n";
                                }
                                else {
-                                       echo "<th class=\"data required\">{$lang['strtype']}</th>";                                     
+                                       echo "<th class=\"data required\">{$lang['strtype']}</th>\n";
                                }
-                               echo "<th class=\"data\">{$lang['strnotnull']}</th><th class=\"data\">{$lang['strdefault']}</th><th class=\"data\">{$lang['strcomment']}</th></tr>";
+                               echo "<th class=\"data\">{$lang['strnotnull']}</th>\n<th class=\"data\">{$lang['strdefault']}</th>\n<th class=\"data\">{$lang['strcomment']}</th></tr>\n";
 
                                $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']);
                                $column->fields['attnotnull'] = $data->phpBool($column->fields['attnotnull']);
                                }                               
 
                                // Column name
-                               echo "<tr><td><input name=\"field\" size=\"32\" value=\"",
-                                       htmlspecialchars($_REQUEST['field']), "\" /></td>";
+                               echo "<tr><td><input name=\"field\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"",
+                                       htmlspecialchars($_REQUEST['field']), "\" /></td>\n";
                                        
                                // Column type
                                if ($data->hasAlterColumnType()) {
                                        // Fetch all available types
                                        $types = $data->getTypes(true, false, true);
+                                       $types_for_js = array();
                                        
-                                       echo "<td><select name=\"type\">\n";                            
+                                       echo "<td><select name=\"type\" id=\"type\" onchange=\"checkLengths(document.getElementById('type').value,'');\">\n";                           
                                        // Output any "magic" types.  This came in with Alter Column Type so we don't need to check that
                                        foreach ($data->extraTypes as $v) {
-                                               echo "<option value=\"", htmlspecialchars($v), "\"",
+                                               $types_for_js[] = strtolower($v);
+                                               echo "\t<option value=\"", htmlspecialchars($v), "\"",
                                                ($v == $_REQUEST['type']) ? ' selected="selected"' : '', ">",
                                                        $misc->printVal($v), "</option>\n";
                                        }
                                        while (!$types->EOF) {
                                                $typname = $types->fields['typname'];
-                                               echo "<option value=\"", htmlspecialchars($typname), "\"", ($typname == $_REQUEST['type']) ? ' selected="selected"' : '', ">",
+                                               $types_for_js[] = $typname;
+                                               echo "\t<option value=\"", htmlspecialchars($typname), "\"", ($typname == $_REQUEST['type']) ? ' selected="selected"' : '', ">",
                                                        $misc->printVal($typname), "</option>\n";
                                                $types->moveNext();
                                        }
-                                       echo "</select></td>";
+                                       echo "</select></td>\n";
                                        
                                        // Output array type selector
                                        echo "<td><select name=\"array\">\n";
-                                       echo "<option value=\"\"", ($_REQUEST['array'] == '') ? ' selected="selected"' : '', "></option>\n";
-                                       echo "<option value=\"[]\"", ($_REQUEST['array'] == '[]') ? ' selected="selected"' : '', ">[ ]</option>\n";
+                                       echo "\t<option value=\"\"", ($_REQUEST['array'] == '') ? ' selected="selected"' : '', "></option>\n";
+                                       echo "\t<option value=\"[]\"", ($_REQUEST['array'] == '[]') ? ' selected="selected"' : '', ">[ ]</option>\n";
                                        echo "</select></td>\n";
+                                       $predefined_size_types = array_intersect($data->predefined_size_types, $types_for_js);
+                                       $escaped_predef_types = array(); // the JS escaped array elements
+                                       foreach($predefined_size_types as $value) {
+                                               $escaped_predef_types[] = "'{$value}'";
+                                       }
        
-                                       echo "<td><input name=\"length\" size=\"8\" value=\"",
-                                               htmlspecialchars($_REQUEST['length']), "\" /></td>";
+                                       echo "<td><input name=\"length\" id=\"lengths\" size=\"8\" value=\"",
+                                               htmlspecialchars($_REQUEST['length']), "\" /></td>\n";
                                } else {
                                        // Otherwise draw the read-only type name
-                                       echo "<td>", $misc->printVal($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "</td>";
+                                       echo "<td>", $misc->printVal($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "</td>\n";
                                }
                                
                                echo "<td><input type=\"checkbox\" name=\"notnull\"", (isset($_REQUEST['notnull'])) ? ' checked="checked"' : '', " /></td>\n";
                                echo "<td><input name=\"default\" size=\"20\" value=\"", 
-                                       htmlspecialchars($_REQUEST['default']), "\" /></td>";
-                               echo "<td><input name=\"comment\" size=\"20\" value=\"", 
-                                       htmlspecialchars($_REQUEST['comment']), "\" /></td>";
-                               
+                                       htmlspecialchars($_REQUEST['default']), "\" /></td>\n";
+                               echo "<td><input name=\"comment\" size=\"40\" value=\"", 
+                                       htmlspecialchars($_REQUEST['comment']), "\" /></td></tr>\n";
                                echo "</table>\n";
                                echo "<p><input type=\"hidden\" name=\"action\" value=\"properties\" />\n";
                                echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n";
                                echo "<input type=\"submit\" value=\"{$lang['stralter']}\" />\n";
                                echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
                                echo "</form>\n";
-                                                               
+                               echo "<script type=\"text/javascript\">predefined_lengths = new Array(". implode(",",$escaped_predef_types) .");checkLengths(document.getElementById('type').value,'');</script>\n";            
                                break;
                        case 2:
-                               global $data, $lang;
-
                                // Check inputs
                                if (trim($_REQUEST['field']) == '') {
                                        $_REQUEST['stage'] = 1;
                                                             $_REQUEST['comment']);
                                if ($status == 0) {
                                        if ($_REQUEST['column'] != $_REQUEST['field']) {
-                                               $_REQUEST['column']=$_REQUEST['field'];
+                                               $_REQUEST['column'] = $_REQUEST['field'];
                                                $_reload_browser = true;
                                        }
                                        doDefault($lang['strcolumnaltered']);
                                $return_url = urlencode("colproperties.php?{$misc->href}&amp;table=$tableName&amp;column={$_REQUEST['column']}");
 
                                /* Browse link */
-                               echo "\t<li><a href=\"display.php?{$misc->href}&amp;table=", urlencode($tableName), "&amp;subject=column&amp;column=",
+                               echo "\t<li><a href=\"display.php?{$misc->href}&amp;subject=column&amp;column=",
                                        urlencode($_REQUEST['column']), "&amp;return_url={$return_url}&amp;return_desc=", urlencode($lang['strback']), "&amp;query=", 
-                                       urlencode("SELECT {$_REQUEST['column']}, count(*) AS \"count\" FROM $tableName GROUP BY {$_REQUEST['column']} ORDER BY {$_REQUEST['column']}") , "\">{$lang['strbrowse']}</a></li>\n";
+                                       urlencode("SELECT \"{$_REQUEST['column']}\", count(*) AS \"count\" FROM \"$tableName\" GROUP BY \"{$_REQUEST['column']}\" ORDER BY \"{$_REQUEST['column']}\"") , "\">{$lang['strbrowse']}</a></li>\n";
 
                                /* Edit link */
                                echo "\t<li><a href=\"{$PHP_SELF}?action=properties&amp;{$misc->href}&amp;table=", urlencode($_REQUEST['table']),
                        } else {
                                $return_url = urlencode("colproperties.php?{$misc->href}&amp;view=$tableName&amp;column={$_REQUEST['column']}");
                                /* Browse link */
-                               echo "\t<li><a href=\"display.php?{$misc->href}&amp;view=", urlencode($tableName), "&amp;subject=column&amp;column=",
+                               echo "\t<li><a href=\"display.php?{$misc->href}&amp;subject=column&amp;column=",
                                        urlencode($_REQUEST['column']), "&amp;return_url={$return_url}&amp;return_desc=", urlencode($lang['strback']), "&amp;query=",
-                                       urlencode("SELECT {$_REQUEST['column']}, count(*) AS \"count\" FROM $tableName GROUP BY {$_REQUEST['column']} ORDER BY {$_REQUEST['column']}") , "\">{$lang['strbrowse']}</a></li>\n";
+                                       urlencode("SELECT \"{$_REQUEST['column']}\", count(*) AS \"count\" FROM \"$tableName\" GROUP BY \"{$_REQUEST['column']}\" ORDER BY \"{$_REQUEST['column']}\"") , "\">{$lang['strbrowse']}</a></li>\n";
                        }
 
                        echo "</ul>\n";
index 5bb48feb8fe08988fed094313735f1cd8b997a27..2588f0149e88168821d4fe10a01d6b5053fdc5c1 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tblproperties.php,v 1.78 2007/05/03 17:01:03 ioguix Exp $
+        * $Id: tblproperties.php,v 1.79 2007/05/05 02:20:24 soranzo Exp $
         */
 
        // Include application functions
 
                switch ($_REQUEST['stage']) {
                        case 1:
-                               global $lang;
-
                                // Set variable defaults
                                if (!isset($_POST['field'])) $_POST['field'] = '';
                                if (!isset($_POST['type'])) $_POST['type'] = '';
                                $misc->printTrail('table');
                                $misc->printTitle($lang['straddcolumn'], 'pg.column.add');
                                $misc->printMsg($msg);
+
                                echo "<script src=\"tables.js\" type=\"text/javascript\"></script>";
                                echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
 
                                // Output table header
                                echo "<table>\n";
-                               echo "<tr><th class=\"data required\">{$lang['strcolumn']}</th><th colspan=\"2\" class=\"data required\">{$lang['strtype']}</th>";
-                               echo "<th class=\"data\">{$lang['strlength']}</th>";
-                               if ($data->hasAlterColumnType()) echo "<th class=\"data\">{$lang['strnotnull']}</th><th class=\"data\">{$lang['strdefault']}</th>";
-                               echo "<th class=\"data\">{$lang['strcomment']}</th></tr>";
+                               echo "<tr><th class=\"data required\">{$lang['strname']}</th>\n<th colspan=\"2\" class=\"data required\">{$lang['strtype']}</th>\n";
+                               echo "<th class=\"data\">{$lang['strlength']}</th>\n";
+                               if ($data->hasAlterColumnType())
+                                       echo "<th class=\"data\">{$lang['strnotnull']}</th>\n<th class=\"data\">{$lang['strdefault']}</th>\n";
+                               echo "<th class=\"data\">{$lang['strcomment']}</th></tr>\n";
 
                                echo "<tr><td><input name=\"field\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"",
-                                       htmlspecialchars($_POST['field']), "\" /></td>";
+                                       htmlspecialchars($_POST['field']), "\" /></td>\n";
                                echo "<td><select name=\"type\" id=\"type\" onchange=\"checkLengths(document.getElementById('type').value,'');\">\n";                           
                                // Output any "magic" types.  This came in with the alter column type so we'll check that
                                if ($data->hasAlterColumnType()) {
                                        foreach ($data->extraTypes as $v) {
-                                               $types_for_js[strtolower($v)] = 1;
-                                               echo "<option value=\"", htmlspecialchars($v), "\"",
+                                               $types_for_js[] = strtolower($v);
+                                               echo "\t<option value=\"", htmlspecialchars($v), "\"",
                                                ($v == $_POST['type']) ? ' selected="selected"' : '', ">",
                                                        $misc->printVal($v), "</option>\n";
                                        }
                                }
                                while (!$types->EOF) {
                                        $typname = $types->fields['typname'];
-                                       $types_for_js[$typname] = 1;
-                                       echo "<option value=\"", htmlspecialchars($typname), "\"", ($typname == $_POST['type']) ? ' selected="selected"' : '', ">",
+                                       $types_for_js[] = $typname;
+                                       echo "\t<option value=\"", htmlspecialchars($typname), "\"", ($typname == $_POST['type']) ? ' selected="selected"' : '', ">",
                                                $misc->printVal($typname), "</option>\n";
                                        $types->moveNext();
                                }
-                               echo "</select></td>";
+                               echo "</select></td>\n";
                                
                                // Output array type selector
                                echo "<td><select name=\"array\">\n";
-                               echo "<option value=\"\"", ($_POST['array'] == '') ? ' selected="selected"' : '', "></option>\n";
-                               echo "<option value=\"[]\"", ($_POST['array'] == '[]') ? ' selected="selected"' : '', ">[ ]</option>\n";
-                               echo "</select>";
-                               $predefined_size_types = array_intersect($data->predefined_size_types,array_keys($types_for_js));
+                               echo "\t<option value=\"\"", ($_POST['array'] == '') ? ' selected="selected"' : '', "></option>\n";
+                               echo "\t<option value=\"[]\"", ($_POST['array'] == '[]') ? ' selected="selected"' : '', ">[ ]</option>\n";
+                               echo "</select></td>\n";
+                               $predefined_size_types = array_intersect($data->predefined_size_types, $types_for_js);
                                $escaped_predef_types = array(); // the JS escaped array elements
                                foreach($predefined_size_types as $value) {
                                        $escaped_predef_types[] = "'{$value}'";
                                }
-                               echo "\t</td>\n";
 
                                echo "<td><input name=\"length\" id=\"lengths\" size=\"8\" value=\"",
-                                       htmlspecialchars($_POST['length']), "\" /></td>";
+                                       htmlspecialchars($_POST['length']), "\" /></td>\n";
                                // Support for adding column with not null and default
                                if ($data->hasAlterColumnType()) {                                      
                                        echo "<td><input type=\"checkbox\" name=\"notnull\"", 
                                                (isset($_REQUEST['notnull'])) ? ' checked="checked"' : '', " /></td>\n";
                                        echo "<td><input name=\"default\" size=\"20\" value=\"",
-                                               htmlspecialchars($_POST['default']), "\" /></td>";
-                               }
-                               else {
-                                       echo "<input type=\"hidden\" name=\"default\" value=\"\" />\n"; 
+                                               htmlspecialchars($_POST['default']), "\" /></td>\n";
                                }
                                echo "<td><input name=\"comment\" size=\"40\" value=\"",
-                                       htmlspecialchars($_POST['comment']), "\" /></td></tr>";
+                                       htmlspecialchars($_POST['comment']), "\" /></td></tr>\n";
                                echo "</table>\n";
-                               echo "<input type=\"hidden\" name=\"action\" value=\"add_column\" />\n";
+                               echo "<p><input type=\"hidden\" name=\"action\" value=\"add_column\" />\n";
                                echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n";
                                echo $misc->form;
                                echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\">\n";
-                               echo "<p><input type=\"submit\" value=\"{$lang['stradd']}\" />\n";
+                               if (!$data->hasAlterColumnType()) {
+                                       echo "<input type=\"hidden\" name=\"default\" value=\"\" />\n"; 
+                               }
+                               echo "<input type=\"submit\" value=\"{$lang['stradd']}\" />\n";
                                echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
                                echo "</form>\n";
                                echo "<script type=\"text/javascript\">predefined_lengths = new Array(". implode(",",$escaped_predef_types) .");checkLengths(document.getElementById('type').value,'');</script>\n";
                                break;
                        case 2:
-                               global $data, $lang;
-
                                // Check inputs
                                if (trim($_POST['field']) == '') {
                                        $_REQUEST['stage'] = 1;
                }
        }
 
-       /**
-        * Displays a screen where they can alter a column
-        */
-       function doProperties($msg = '') {
-               global $data, $misc, $_reload_browser;
-               global $PHP_SELF, $lang;
-
-               if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1;
-
-               switch ($_REQUEST['stage']) {
-                       case 1:
-                               global $lang;
-
-                               $misc->printTrail('column');
-                               $misc->printTitle($lang['straltercolumn'], 'pg.column.alter'); 
-                               $misc->printMsg($msg);
-                               echo "<script src=\"tables.js\" type=\"text/javascript\"></script>";
-
-                               echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
-
-                               // Output table header
-                               echo "<table>\n";
-                               echo "<tr><th class=\"data required\">{$lang['strname']}</th>";
-                               if ($data->hasAlterColumnType()) {
-                                       echo "<th class=\"data required\" colspan=\"2\">{$lang['strtype']}</th>";
-                                       echo "<th class=\"data\">{$lang['strlength']}</th>";
-                               }
-                               else {
-                                       echo "<th class=\"data required\">{$lang['strtype']}</th>";                                     
-                               }
-                               echo "<th class=\"data\">{$lang['strnotnull']}</th><th class=\"data\">{$lang['strdefault']}</th><th class=\"data\">{$lang['strcomment']}</th></tr>";
-
-                               $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']);
-                               $column->fields['attnotnull'] = $data->phpBool($column->fields['attnotnull']);
-
-                               // Upon first drawing the screen, load the existing column information
-                               // from the database.
-                               if (!isset($_REQUEST['default'])) {
-                                       $_REQUEST['field'] = $column->fields['attname'];
-                                       $_REQUEST['type'] = $column->fields['base_type'];
-                                       // Check to see if its' an array type...
-                                       // XXX: HACKY
-                                       if (substr($column->fields['base_type'], strlen($column->fields['base_type']) - 2) == '[]') {
-                                               $_REQUEST['type'] = substr($column->fields['base_type'], 0, strlen($column->fields['base_type']) - 2);
-                                               $_REQUEST['array'] = '[]';
-                                       }
-                                       else {
-                                               $_REQUEST['type'] = $column->fields['base_type'];
-                                               $_REQUEST['array'] = '';
-                                       }
-                                       // To figure out the length, look in the brackets :(
-                                       // XXX: HACKY
-                                       if ($column->fields['type'] != $column->fields['base_type'] && ereg('\\(([0-9, ]*)\\)', $column->fields['type'], $bits)) {
-                                               $_REQUEST['length'] = $bits[1];
-                                       }
-                                       else
-                                               $_REQUEST['length'] = '';
-                                       $_REQUEST['default'] = $_REQUEST['olddefault'] = $column->fields['adsrc'];
-                                       if ($column->fields['attnotnull']) $_REQUEST['notnull'] = 'YES';
-                                       $_REQUEST['comment'] = $column->fields['comment'];
-                               }                               
-
-                               // Column name
-                               echo "<tr><td><input name=\"field\" size=\"32\" value=\"",
-                                       htmlspecialchars($_REQUEST['field']), "\" /></td>";
-                                       
-                               // Column type
-                               if ($data->hasAlterColumnType()) {
-                                       // Fetch all available types
-                                       $types = $data->getTypes(true, false, true);
-                                       $types_for_js = array();
-                                       
-                                       echo "<td><select name=\"type\" id=\"type\" onchange=\"checkLengths(document.getElementById('type').value,'');\">\n";
-                                       // Output any "magic" types.  This came in with Alter Column Type so we don't need to check that
-                                       foreach ($data->extraTypes as $v) {
-                                               $types_for_js[strtolower($v)] = 1;
-                                               echo "<option value=\"", htmlspecialchars($v), "\"",
-                                               ($v == $_REQUEST['type']) ? ' selected="selected"' : '', ">",
-                                                       $misc->printVal($v), "</option>\n";
-                                       }
-                                       while (!$types->EOF) {
-                                               $typname = $types->fields['typname'];
-                                               $types_for_js[$typname] = 1;
-                                               echo "<option value=\"", htmlspecialchars($typname), "\"", ($typname == $_REQUEST['type']) ? ' selected="selected"' : '', ">",
-                                                       $misc->printVal($typname), "</option>\n";
-                                               $types->moveNext();
-                                       }
-                                       echo "</select></td>";
-                                       
-                                       // Output array type selector
-                                       echo "<td><select name=\"array\">\n";
-                                       echo "<option value=\"\"", ($_REQUEST['array'] == '') ? ' selected="selected"' : '', "></option>\n";
-                                       echo "<option value=\"[]\"", ($_REQUEST['array'] == '[]') ? ' selected="selected"' : '', ">[ ]</option>\n";
-                                       echo "</select>";
-                                       $predefined_size_types = array_intersect($data->predefined_size_types,array_keys($types_for_js));
-                                       $escaped_predef_types = array(); // the JS escaped array elements
-                                       foreach($predefined_size_types as $value) {
-                                               $escaped_predef_types[] = "'{$value}'";
-                                       }
-                                       echo "\t</td>\n";
-
-                                       echo "<td><input name=\"length\" id=\"lengths\" size=\"8\" value=\"",   
-                                               htmlspecialchars($_REQUEST['length']), "\" /></td>";
-                               } else {
-                                       // Otherwise draw the read-only type name
-                                       echo "<td>", $misc->printVal($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "</td>";
-                               }
-                               
-                               echo "<td><input type=\"checkbox\" name=\"notnull\"", (isset($_REQUEST['notnull'])) ? ' checked="checked"' : '', " /></td>\n";
-                               echo "<td><input name=\"default\" size=\"20\" value=\"", 
-                                       htmlspecialchars($_REQUEST['default']), "\" /></td>";
-                               echo "<td><input name=\"comment\" size=\"20\" value=\"", 
-                                       htmlspecialchars($_REQUEST['comment']), "\" /></td>";
-                               
-                               echo "</table>\n";
-                               echo "<p><input type=\"hidden\" name=\"action\" value=\"properties\" />\n";
-                               echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n";
-                               echo $misc->form;
-                               echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
-                               echo "<input type=\"hidden\" name=\"column\" value=\"", htmlspecialchars($_REQUEST['column']), "\" />\n";
-                               echo "<input type=\"hidden\" name=\"olddefault\" value=\"", htmlspecialchars($_REQUEST['olddefault']), "\" />\n";
-                               if ($column->fields['attnotnull']) echo "<input type=\"hidden\" name=\"oldnotnull\" value=\"on\" />\n";
-                               echo "<input type=\"hidden\" name=\"oldtype\" value=\"", htmlspecialchars($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "\" />\n";
-                               // Add hidden variables to suppress error notices if we don't support altering column type
-                               if (!$data->hasAlterColumnType()) {
-                                       echo "<input type=\"hidden\" name=\"type\" value=\"", htmlspecialchars($_REQUEST['type']), "\" />\n";                           
-                                       echo "<input type=\"hidden\" name=\"length\" value=\"", htmlspecialchars($_REQUEST['length']), "\" />\n";                               
-                                       echo "<input type=\"hidden\" name=\"array\" value=\"", htmlspecialchars($_REQUEST['array']), "\" />\n";                         
-                               }
-                               echo "<input type=\"submit\" value=\"{$lang['stralter']}\" />\n";
-                               echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
-                               echo "</form>\n";
-                               echo "<script type=\"text/javascript\">predefined_lengths = new Array(". implode(",",$escaped_predef_types) .");checkLengths(document.getElementById('type').value,'');</script>\n";
-                                                               
-                               break;
-                       case 2:
-                               global $data, $lang;
-
-                               // Check inputs
-                               if (trim($_REQUEST['field']) == '') {
-                                       $_REQUEST['stage'] = 1;
-                                       doProperties($lang['strcolneedsname']);
-                                       return;
-                               }
-
-                               $status = $data->alterColumn($_REQUEST['table'], $_REQUEST['column'], $_REQUEST['field'], 
-                                                            isset($_REQUEST['notnull']), isset($_REQUEST['oldnotnull']), 
-                                                            $_REQUEST['default'], $_REQUEST['olddefault'],
-                                                            $_REQUEST['type'], $_REQUEST['length'], $_REQUEST['array'], $_REQUEST['oldtype'],
-                                                            $_REQUEST['comment']);
-                               if ($status == 0) {
-                                       if ($_REQUEST['column'] != $_REQUEST['field']) {
-                                               $_reload_browser = true;
-                                               $_REQUEST['column'] = $_REQUEST['field'];
-                                       }
-                                       doDefault($lang['strcolumnaltered']);
-                               }
-                               else {
-                                       $_REQUEST['stage'] = 1;
-                                       doProperties($lang['strcolumnalteredbad']);
-                                       return;
-                               }
-                               break;
-                       default:
-                               echo "<p>{$lang['strinvalidparam']}</p>\n";
-               }
-       }
-
        /**
         * Show confirmation of drop column and perform actual drop
         */
                                                                        'table'         => $_REQUEST['table'],
                                                                        'column'        => field('attname'),
                                                                        'query'         => replace(
-                                                                                                               'SELECT "%column%", count(*) AS "count" FROM %table% GROUP BY "%column%" ORDER BY "%column%"', 
+                                                                                                               'SELECT "%column%", count(*) AS "count" FROM "%table%" GROUP BY "%column%" ORDER BY "%column%"', 
                                                                                                                array (
                                                                                                                        '%column%' => field('attname'),
                                                                                                                        '%table%' => $_REQUEST['table']
                global $data, $conf, $misc;
                global $PHP_SELF, $lang;
 
-               function attPre(&$rowdata) {
+               function attPre(&$rowdata, $actions) {
                        global $data;
                        $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
+                       $actions['browse']['url'] .= "query=" . urlencode("SELECT \"{$rowdata->fields['attname']}\", count(*) AS \"count\" FROM \"{$_REQUEST['table']}\" GROUP BY \"{$rowdata->fields['attname']}\" ORDER BY \"{$rowdata->fields['attname']}\"") . '&amp;';
+                       return $actions;
                }
                
                $misc->printTrail('table');
                        ),
                );
                
+               $return_url = urlencode("tblproperties.php?{$misc->href}&amp;table={$_REQUEST['table']}");
+
                $actions = array(
+                       'browse' => array(
+                               'title' => $lang['strbrowse'],
+                               'url' => "display.php?{$misc->href}&amp;subject=column&amp;return_url={$return_url}&amp;return_desc=" . urlencode($lang['strback']) . '&amp;',
+                               'vars' => array('column' => 'attname'),
+                       ),
                        'alter' => array(
                                'title' => $lang['stralter'],
-                               'url'   => "{$PHP_SELF}?action=properties&amp;{$misc->href}&amp;table=".urlencode($_REQUEST['table'])."&amp;",
+                               'url'   => "colproperties.php?action=properties&amp;{$misc->href}&amp;table=".urlencode($_REQUEST['table'])."&amp;",
                                'vars'  => array('column' => 'attname'),
                        ),
                        'drop' => array(
                $misc->printTable($attrs, $columns, $actions, null, 'attPre');
                
                echo "<ul>\n";
-               $return_url = urlencode("tblproperties.php?{$misc->href}&amp;table={$_REQUEST['table']}");
                echo "\t<li><a href=\"display.php?{$misc->href}&amp;table=", urlencode($_REQUEST['table']), "&amp;subject=table&amp;return_url={$return_url}&amp;return_desc=",
                        urlencode($lang['strback']), "\">{$lang['strbrowse']}</a></li>\n";
                echo "\t<li><a href=\"tables.php?action=confselectrows&amp;{$misc->href}&amp;table=", urlencode($_REQUEST['table']),"\">{$lang['strselect']}</a></li>\n";