Skip to content

Commit a3f7a2c

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents ef401b5 + 4f67631 commit a3f7a2c

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

resources/templates/table/zoom_search/index.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
</li>
1919
</ul>
2020

21-
<form method="post" action="{{ url('/table/zoom-search') }}" name="insertForm" id="zoom_search_form" class="ajax lock-page">
21+
<form method="post" action="{{ url('/table/zoom-search', {'db': db, 'table': table}) }}" name="insertForm" id="zoom_search_form" class="ajax lock-page">
2222
{{ get_hidden_inputs(db, table) }}
2323
<input type="hidden" name="goto" value="{{ goto }}">
24-
<input type="hidden" name="back" value="{{ url('/table/zoom-search') }}">
24+
<input type="hidden" name="back" value="{{ url('/table/zoom-search', {'db': db, 'table': table}) }}">
2525

2626
<div class="card mb-3">
2727
<div class="card-header">{{ t('Do a "query by example" (wildcard: "%") for two different columns') }}</div>

resources/templates/table/zoom_search/result_form.twig

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<form method="post" action="{{ url('/table/zoom-search') }}" name="displayResultForm" id="zoom_display_form" class="ajax">
1+
<form method="post" action="{{ url('/table/zoom-search', {'db': db, 'table': table}) }}" name="displayResultForm" id="zoom_display_form" class="ajax">
22
{{ get_hidden_inputs(db, table) }}
33
<input type="hidden" name="goto" value="{{ goto }}">
4-
<input type="hidden" name="back" value="{{ url('/table/zoom-search') }}">
4+
<input type="hidden" name="back" value="{{ url('/table/zoom-search', {'db': db, 'table': table}) }}">
55

66
<div class="card">
77
<div class="card-header">{{ t('Browse/Edit the points') }}</div>
@@ -19,8 +19,8 @@
1919
{% endif %}
2020
</div>
2121

22-
<div class="modal fade" id="dataPointModal" tabindex="-1" aria-labelledby="dataPointModalLabel" aria-hidden="true">
23-
<div class="modal-dialog">
22+
<div class="modal fade" id="dataPointModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="dataPointModalLabel" aria-hidden="true">
23+
<div class="modal-dialog modal-lg modal-dialog-scrollable">
2424
<div class="modal-content">
2525
<div class="modal-header">
2626
<h5 class="modal-title" id="dataPointModalLabel">{{ t('Loading') }}</h5>
@@ -53,20 +53,23 @@
5353
{% include 'table/search/input_box.twig' with {
5454
'str': '',
5555
'column_type': column_types[column_index],
56+
'column_data_type': column_data_types[column_index],
57+
'html_attributes': '',
5658
'column_id': column_types[column_index] ? 'edit_fieldID_' : 'fieldID_',
5759
'in_zoom_search_edit': true,
5860
'foreigners': foreigners,
5961
'column_name': field_popup,
60-
'column_name_hash': column_name_hashes[field_popup],
62+
'column_name_hash': column_names_hashes[field_popup],
6163
'foreign_data': foreign_data[column_index],
6264
'table': table,
6365
'column_index': column_index,
64-
'foreign_max_limit': foreign_max_limit,
6566
'criteria_values': '',
6667
'db': db,
6768
'in_fbs': false,
68-
'foreign_dropdown': foreign_dropdown[column_index],
69-
'search_columns_in_foreigners': search_columns_in_foreigners[column_index]
69+
'foreign_dropdown': foreign_dropdown[column_index] ?? '',
70+
'search_column_in_foreigners': search_columns_in_foreigners[column_index],
71+
'is_integer': column_data_types[column_index] == 'INT',
72+
'is_float': column_data_types[column_index] == 'FLOAT',
7073
} only %}
7174
</th>
7275
</tr>

src/Controllers/Table/ZoomSearchController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use PhpMyAdmin\Utils\Gis;
2626

2727
use function __;
28+
use function array_map;
2829
use function array_search;
2930
use function array_values;
3031
use function htmlspecialchars;
@@ -414,6 +415,16 @@ private function zoomSubmitAction(string $dataLabel, string $goto): void
414415
);
415416
}
416417

418+
$integerTypes = $this->dbi->types->getIntegerTypes();
419+
$floatTypes = $this->dbi->types->getFloatTypes();
420+
$columnDataTypes = array_map(static function (string $type) use ($integerTypes, $floatTypes): string {
421+
$cleanType = (string) preg_replace('@\(.*@s', '', $type);
422+
$isInteger = in_array($cleanType, $integerTypes, true);
423+
$isFloat = in_array($cleanType, $floatTypes, true);
424+
425+
return $isInteger ? 'INT' : ($isFloat ? 'FLOAT' : strtoupper($cleanType));
426+
}, $this->columnTypes);
427+
417428
$this->response->render('table/zoom_search/result_form', [
418429
'db' => Current::$database,
419430
'table' => Current::$table,
@@ -422,6 +433,7 @@ private function zoomSubmitAction(string $dataLabel, string $goto): void
422433
'foreigners' => $this->foreigners,
423434
'column_null_flags' => $this->columnNullFlags,
424435
'column_types' => $this->columnTypes,
436+
'column_data_types' => $columnDataTypes,
425437
'goto' => $goto,
426438
'data' => $data,
427439
'data_json' => json_encode($data),

0 commit comments

Comments
 (0)