Use the router for normalization.php
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
74ac30fa55
commit
4111f215c6
@ -116,6 +116,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
|
||||
$routes->addRoute(['GET', 'POST'], '/navigation', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/navigation.php';
|
||||
});
|
||||
$routes->addRoute(['GET', 'POST'], '/normalization', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/normalization.php';
|
||||
});
|
||||
$routes->addGroup('/server', function (RouteCollector $routes) {
|
||||
$routes->addRoute(['GET', 'POST'], '/binlog', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/server/binlog.php';
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
/* global centralColumnList:writable */ // js/functions.js
|
||||
|
||||
/**
|
||||
* AJAX scripts for normalization.php
|
||||
* AJAX scripts for normalization
|
||||
*
|
||||
*/
|
||||
|
||||
@ -20,7 +20,7 @@ var dataParsed = null;
|
||||
|
||||
function appendHtmlColumnsList () {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -42,7 +42,7 @@ function goTo3NFStep1 (newTables) {
|
||||
tables = [CommonParams.get('table')];
|
||||
}
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -78,7 +78,7 @@ function goTo3NFStep1 (newTables) {
|
||||
|
||||
function goTo2NFStep1 () {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -128,7 +128,7 @@ function goToFinish1NF () {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function goToStep4 () {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -151,7 +151,7 @@ function goToStep4 () {
|
||||
|
||||
function goToStep3 () {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -175,7 +175,7 @@ function goToStep3 () {
|
||||
|
||||
function goToStep2 (extra) {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -223,7 +223,7 @@ function goTo2NFFinish (pd) {
|
||||
'createNewTables2NF':1 };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
url: 'index.php?route=/normalization',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
@ -268,7 +268,7 @@ function goTo3NFFinish (newTables) {
|
||||
'createNewTables3NF':1 };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
url: 'index.php?route=/normalization',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
@ -319,7 +319,7 @@ function goTo2NFStep2 (pd, primaryKey) {
|
||||
'getNewTables2NF':1 };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
url: 'index.php?route=/normalization',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
@ -368,7 +368,7 @@ function goTo3NFStep2 (pd, tablesTds) {
|
||||
'getNewTables3NF':1 };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
url: 'index.php?route=/normalization',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
@ -464,7 +464,7 @@ function moveRepeatingGroup (repeatingCols) {
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
url: 'index.php?route=/normalization',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
@ -510,7 +510,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
}
|
||||
var numField = $('#numField').val();
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -583,7 +583,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
|
||||
$('#extra').on('click', '#addNewPrimary', function () {
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
@ -729,7 +729,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
$('#newCols').insertAfter('#mainContent h4');
|
||||
$('#newCols').html('<div class="center">' + Messages.strLoading + '<br>' + Messages.strWaitForPd + '</div>');
|
||||
$.post(
|
||||
'normalization.php',
|
||||
'index.php?route=/normalization',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
|
||||
@ -904,8 +904,8 @@ class Normalization
|
||||
*/
|
||||
public function getHtmlForNormalizeTable()
|
||||
{
|
||||
$htmlOutput = '<form method="post" action="normalization.php" '
|
||||
. 'name="normalize" '
|
||||
$htmlOutput = '<form method="post" action="' . Url::getFromRoute('/normalization')
|
||||
. '" name="normalize" '
|
||||
. 'id="normalizeTable" '
|
||||
. '>'
|
||||
. Url::getHiddenInputs($GLOBALS['db'], $GLOBALS['table'])
|
||||
|
||||
@ -13,14 +13,12 @@ use PhpMyAdmin\Normalization;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
if (! defined('ROOT_PATH')) {
|
||||
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $containerBuilder, $db, $table;
|
||||
|
||||
require_once ROOT_PATH . 'libraries/common.inc.php';
|
||||
|
||||
/** @var Response $response */
|
||||
$response = $containerBuilder->get(Response::class);
|
||||
|
||||
@ -403,7 +403,7 @@
|
||||
<a href="#" id="move_columns_anchor">
|
||||
{{ get_icon('b_move', 'Move columns'|trans, true) }}
|
||||
</a>
|
||||
<a href="normalization.php{{ url_query|raw }}">
|
||||
<a href="{{ url('/normalization', url_params) }}">
|
||||
{{ get_icon('normalize', 'Normalize'|trans, true) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
@ -16,6 +16,7 @@ use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Types;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionClass;
|
||||
@ -536,8 +537,8 @@ class NormalizationTest extends TestCase
|
||||
{
|
||||
$result = $this->normalization->getHtmlForNormalizeTable();
|
||||
$this->assertStringContainsString(
|
||||
'<form method="post" action="normalization.php"'
|
||||
. ' name="normalize" id="normalizeTable"',
|
||||
'<form method="post" action="' . Url::getFromRoute('/normalization')
|
||||
. '" name="normalize" id="normalizeTable"',
|
||||
$result
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user