printTrail('column'); $misc->printTitle($lang['stralter'], 'pg.column.alter'); $misc->printMsg($msg); echo ""; echo "
\n"; echo "\n"; break; case 2: // Check inputs if (trim($_REQUEST['field']) == '') { $_REQUEST['stage'] = 1; doAlter($lang['strcolneedsname']); return; } if (!isset($_REQUEST['length'])) $_REQUEST['length'] = ''; $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']) { $_REQUEST['column'] = $_REQUEST['field']; $_reload_browser = true; } doDefault($lang['strcolumnaltered']); } else { $_REQUEST['stage'] = 1; doAlter($lang['strcolumnalteredbad']); return; } break; default: echo "{$lang['strinvalidparam']}
\n"; } } /** * Show default list of columns in the table */ function doDefault($msg = '', $isTable = true) { global $data, $conf, $misc, $tableName; global $lang; function attPre(&$rowdata) { global $data; $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']); } if (empty($_REQUEST['column'])) $msg.= "", $misc->printVal($attrs->fields['comment']), "
\n"; $column = array( 'column' => array( 'title' => $lang['strcolumn'], 'field' => field('attname'), ), 'type' => array( 'title' => $lang['strtype'], 'field' => field('+type'), ) ); if ($isTable) { $column['notnull'] = array( 'title' => $lang['strnotnull'], 'field' => field('attnotnull'), 'type' => 'bool', 'params'=> array('true' => 'NOT NULL', 'false' => '') ); $column['default'] = array( 'title' => $lang['strdefault'], 'field' => field('adsrc'), ); } $actions=array(); $misc->printTable($attrs, $column, $actions, 'colproperties-colproperties', null, 'attPre'); echo "