Use the router for the table create page

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-08-15 22:37:51 -03:00
parent 920e91d84c
commit a862694bc8
9 changed files with 21 additions and 19 deletions

View File

@ -145,6 +145,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/chart', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/chart.php';
});
$routes->addRoute(['GET', 'POST'], '/create', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/create.php';
});
$routes->addRoute(['GET', 'POST'], '/find_replace', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/find_replace.php';
});

View File

@ -1275,7 +1275,7 @@ DesignerMove.newRelation = function () {
// -------------------------- create tables -------------------------------------
DesignerMove.startTableNew = function () {
CommonParams.set('table', '');
CommonActions.refreshMain('tbl_create.php');
CommonActions.refreshMain('index.php?route=/table/create');
};
DesignerMove.startTabUpd = function (table) {

View File

@ -36,7 +36,6 @@ class Core
'pdf_schema.php',
'server_export.php',
'server_import.php',
'tbl_create.php',
'tbl_import.php',
'tbl_indexes.php',
'tbl_export.php',

View File

@ -10,7 +10,7 @@ declare(strict_types=1);
namespace PhpMyAdmin;
/**
* Set of functions for tbl_create.php and /table/addfield
* Set of functions for /table/create and /table/addfield
*
* @package PhpMyAdmin
*/

View File

@ -50,10 +50,12 @@ class NodeTableContainer extends NodeDatabaseChildContainer
$new->isNew = true;
$new->icon = Util::getImage('b_table_add', $newLabel);
$new->links = [
'text' => 'tbl_create.php?server=' . $GLOBALS['server']
. '&amp;db=%2$s',
'icon' => 'tbl_create.php?server=' . $GLOBALS['server']
. '&amp;db=%2$s',
'text' => Url::getFromRoute('/table/create', [
'server' => $GLOBALS['server'],
]) . '&amp;db=%2$s',
'icon' => Url::getFromRoute('/table/create', [
'server' => $GLOBALS['server'],
]) . '&amp;db=%2$s',
];
$new->classes = 'new_table italics';
$this->addChild($new);

View File

@ -16,14 +16,12 @@ use PhpMyAdmin\Transformations;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
if (! defined('PHPMYADMIN')) {
exit;
}
global $containerBuilder;
require_once ROOT_PATH . 'libraries/common.inc.php';
/** @var Response $response */
$response = $containerBuilder->get(Response::class);
@ -84,7 +82,7 @@ $createAddField = new CreateAddField($dbi);
// check number of fields to be created
$num_fields = $createAddField->getNumberOfFieldsFromRequest();
$action = 'tbl_create.php';
$action = Url::getFromRoute('/table/create');
/**
* The form used to define the structure of the table has been submitted

View File

@ -2,7 +2,7 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Display form for changing/adding table fields/columns.
* Included by /table/addfield and tbl_create.php
* Included by /table/addfield and /table/create
*
* @package PhpMyAdmin
*/
@ -69,7 +69,7 @@ $form_params = [
'db' => $db,
];
if ($action == 'tbl_create.php') {
if ($action == Url::getFromRoute('/table/create')) {
$form_params['reload'] = 1;
} else {
if ($action == Url::getFromRoute('/table/addfield')) {
@ -102,7 +102,7 @@ if (isset($selected) && is_array($selected)) {
}
}
$is_backup = ($action != 'tbl_create.php' && $action != Url::getFromRoute('/table/addfield'));
$is_backup = ($action != Url::getFromRoute('/table/create') && $action != Url::getFromRoute('/table/addfield'));
$cfgRelation = $relation->getRelationsParam();

View File

@ -1,5 +1,5 @@
<form method="post" action="{{ action }}" class="
{{- action == 'tbl_create.php' ? 'create_table' : 'append_fields' -}}
{{- action == url('/table/create') ? 'create_table' : 'append_fields' -}}
_form ajax lock-page">
{{ get_hidden_inputs(form_params) }}
{# happens when an index has been set on a column #}
@ -16,7 +16,7 @@
<input type="hidden" name="spatial_indexes" value="
{{- spatial_indexes is not empty ? spatial_indexes : '[]' }}">
{% if action == 'tbl_create.php' %}
{% if action == url('/table/create') %}
<div id="table_name_col_no_outer">
<table id="table_name_col_no" class="tdblock">
<tr class="vmiddle floatleft">
@ -64,7 +64,7 @@
'charsets': charsets
} only %}
{% endif %}
{% if action == 'tbl_create.php' %}
{% if action == url('/table/create') %}
<div class="responsivetable">
<table>
<tr class="vtop">

View File

@ -1,4 +1,4 @@
<form id="create_table_form_minimal" method="post" action="tbl_create.php" class="lock-page">
<form id="create_table_form_minimal" method="post" action="{{ url('/table/create') }}" class="lock-page">
<fieldset>
<legend>
{% if show_icons('ActionLinksMode') -%}