Use the router for the central columns page
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
71a5c660df
commit
c57e8540fc
@ -26,6 +26,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/home.php';
|
||||
});
|
||||
$routes->addGroup('/database', function (RouteCollector $routes) {
|
||||
$routes->addRoute(['GET', 'POST'], '/central_columns', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/database/central_columns.php';
|
||||
});
|
||||
$routes->addRoute(['GET', 'POST'], '/operations', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/database/operations.php';
|
||||
});
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* AJAX scripts for db_central_columns.php
|
||||
* AJAX scripts for /database/central_columns
|
||||
*
|
||||
* Actions ajaxified here:
|
||||
* Inline Edit and save of a result row
|
||||
@ -68,7 +68,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db'));
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('db_central_columns.php', editColumnData, AJAX.responseHandler);
|
||||
$.post('index.php?route=/database/central_columns', editColumnData, AJAX.responseHandler);
|
||||
});
|
||||
$('#multi_edit_central_columns').submit(function (event) {
|
||||
event.preventDefault();
|
||||
@ -77,7 +77,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db'));
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('db_central_columns.php', multiColumnEditData, AJAX.responseHandler);
|
||||
$.post('index.php?route=/database/central_columns', multiColumnEditData, AJAX.responseHandler);
|
||||
});
|
||||
$('#add_new').find('td').each(function () {
|
||||
if ($(this).attr('name') !== 'undefined') {
|
||||
@ -153,7 +153,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
var datastring = $('#f_' + rownum + ' :input').serialize();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'db_central_columns.php',
|
||||
url: 'index.php?route=/database/central_columns',
|
||||
data: datastring + CommonParams.get('arg_separator') + 'ajax_request=true',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
@ -194,7 +194,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('#table-select').on('change', function () {
|
||||
var selectValue = $(this).val();
|
||||
var defaultColumnSelect = $('#column-select').find('option:first');
|
||||
var href = 'db_central_columns.php';
|
||||
var href = 'index.php?route=/database/central_columns';
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'server' : CommonParams.get('server'),
|
||||
|
||||
@ -3525,7 +3525,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
});
|
||||
|
||||
$(document).on('click', 'a.central_columns_dialog', function () {
|
||||
var href = 'db_central_columns.php';
|
||||
var href = 'index.php?route=/database/central_columns';
|
||||
var db = CommonParams.get('db');
|
||||
var table = CommonParams.get('table');
|
||||
var maxRows = $(this).data('maxrows');
|
||||
|
||||
@ -547,7 +547,8 @@ class Menu
|
||||
) {
|
||||
$tabs['central_columns']['text'] = __('Central columns');
|
||||
$tabs['central_columns']['icon'] = 'centralColumns';
|
||||
$tabs['central_columns']['link'] = 'db_central_columns.php';
|
||||
$tabs['central_columns']['link'] = Url::getFromRoute('/database/central_columns');
|
||||
$tabs['central_columns']['active'] = isset($_REQUEST['route']) && $_REQUEST['route'] === '/database/central_columns';
|
||||
}
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<span>{{ (total_rows > 0) ? '+' : '-' }}</span>{% trans 'Add new column' %}
|
||||
</a>
|
||||
<form id="add_new" class="new_central_col{{ (total_rows != 0) ? ' hide' : ''}}"
|
||||
method="post" action="db_central_columns.php">
|
||||
method="post" action="{{ url('/database/central_columns') }}">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<input type="hidden" name="add_new_column" value="add_new_column">
|
||||
<div class="responsivetable">
|
||||
@ -150,7 +150,7 @@
|
||||
<td class="navigation_separator"></td>
|
||||
{% if pos - max_rows >= 0 %}
|
||||
<td>
|
||||
<form action="db_central_columns.php" method="post">
|
||||
<form action="{{ url('/database/central_columns') }}" method="post">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<input type="hidden" name="pos" value="{{ pos - max_rows }}">
|
||||
<input type="hidden" name="total_rows" value="{{ total_rows }}">
|
||||
@ -160,7 +160,7 @@
|
||||
{% endif %}
|
||||
{% if tn_nbTotalPage > 1 %}
|
||||
<td>
|
||||
<form action="db_central_columns.php" method="post">
|
||||
<form action="{{ url('/database/central_columns') }}" method="post">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<input type="hidden" name="total_rows" value="{{ total_rows }}">
|
||||
{{ tn_page_selector | raw }}
|
||||
@ -169,7 +169,7 @@
|
||||
{% endif %}
|
||||
{% if pos + max_rows < total_rows %}
|
||||
<td>
|
||||
<form action="db_central_columns.php" method="post">
|
||||
<form action="{{ url('/database/central_columns') }}" method="post">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<input type="hidden" name="pos" value="{{ pos + max_rows }}">
|
||||
<input type="hidden" name="total_rows" value="{{ total_rows }}">
|
||||
@ -192,7 +192,7 @@
|
||||
<td class="navigation_separator largescreenonly"></td>
|
||||
<td class="central_columns_navigation">
|
||||
{{ get_icon('centralColumns_add', 'Add column' | trans)|raw }}
|
||||
<form id="add_column" action="db_central_columns.php" method="post">
|
||||
<form id="add_column" action="{{ url('/database/central_columns') }}" method="post">
|
||||
{{ get_hidden_inputs(db) | raw }}
|
||||
<input type="hidden" name="add_column" value="add">
|
||||
<input type="hidden" name="pos" value="{{ pos }}">
|
||||
@ -216,7 +216,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
{% if total_rows > 0 %}
|
||||
<form method="post" id="del_form" action="db_central_columns.php">
|
||||
<form method="post" id="del_form" action="{{ url('/database/central_columns') }}">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<input id="del_col_name" type="hidden" name="col_name" value="">
|
||||
<input type="hidden" name="pos" value="{{ pos }}">
|
||||
|
||||
@ -661,7 +661,11 @@ class CentralColumnsTest extends TestCase
|
||||
$text_dir
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
'<form action="db_central_columns.php" method="post">',
|
||||
'<form action="index.php?route=/database/central_columns',
|
||||
$result
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
'" method="post">',
|
||||
$result
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user