$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('tbl_structure.js');
$scripts->addFile('indexes.js');
/**
 * Handle column moving
 */
if (isset($_REQUEST['move_columns']) && is_array($_REQUEST['move_columns']) && $response->isAjax()) {
    PMA_moveColumns($db, $table);
    exit;
}
/**
 * A click on Change has been made for one column
 */
if (isset($_REQUEST['change_column'])) {
    PMA_displayHtmlForColumnChange($db, $table, null, 'tbl_structure.php');
    exit;
}
/**
 * Modifications have been submitted -> updates the table
 */
if (isset($_REQUEST['do_save_data'])) {
    $regenerate = PMA_updateColumns($db, $table);
    if ($regenerate) {
        // This happens when updating failed
        // @todo: do something appropriate
    } else {
        // continue to show the table's structure
        unset($_REQUEST['selected']);
    }
}
Exemple #2
0
                unset($submit_mult);
                $query_type = 'unique_fld';
                $mult_btn = __('Yes');
                break;
            case 'spatial':
                unset($submit_mult);
                $query_type = 'spatial_fld';
                $mult_btn = __('Yes');
                break;
            case 'ftext':
                unset($submit_mult);
                $query_type = 'fulltext_fld';
                $mult_btn = __('Yes');
                break;
            case 'change':
                PMA_displayHtmlForColumnChange($db, $table, $selected, $action);
                // execution stops here but PMA_Response correctly finishes
                // the rendering
                exit;
            case 'browse':
                // this should already be handled by tbl_structure.php
        }
    } else {
        // coming from browsing - do something with selected rows
        $what = 'row_delete';
        $selected = $rows_to_delete;
    }
}
// end if
$views = PMA_DBI_getVirtualTables($db);
/**
/**
 * Get List of information for Submit Mult
 *
 * @param string $submit_mult mult_submit type
 * @param string $db          dtabase name
 * @param array  $table       table name
 * @param array  $selected    the selected columns
 * @param array  $action      action type
 *
 * @return array()
 */
function PMA_getDataForSubmitMult($submit_mult, $db, $table, $selected, $action)
{
    $what = null;
    $query_type = null;
    $is_unset_submit_mult = false;
    $mult_btn = null;
    switch ($submit_mult) {
        case 'drop':
            $what = 'drop_fld';
            break;
        case 'primary':
            // Gets table primary key
            $primary = PMA_getKeyForTablePrimary($db, $table);
            if (empty($primary)) {
                // no primary key, so we can safely create new
                $is_unset_submit_mult = true;
                $query_type = 'primary_fld';
                $mult_btn = __('Yes');
            } else {
                // primary key exists, so lets as user
                $what = 'primary_fld';
            }
            break;
        case 'index':
            $is_unset_submit_mult = true;
            $query_type = 'index_fld';
            $mult_btn = __('Yes');
            break;
        case 'unique':
            $is_unset_submit_mult = true;
            $query_type = 'unique_fld';
            $mult_btn = __('Yes');
            break;
        case 'spatial':
            $is_unset_submit_mult = true;
            $query_type = 'spatial_fld';
            $mult_btn = __('Yes');
            break;
        case 'ftext':
            $is_unset_submit_mult = true;
            $query_type = 'fulltext_fld';
            $mult_btn = __('Yes');
            break;
        case 'change':
            PMA_displayHtmlForColumnChange($db, $table, $selected, $action);
            // execution stops here but PMA_Response correctly finishes
            // the rendering
            exit;
        case 'browse':
            // this should already be handled by tbl_structure.php
    }
    return array($what, $query_type, $is_unset_submit_mult, $mult_btn);
}