Skip to content

Commit 66f0c28

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents 4e529ae + 8eeec07 commit 66f0c28

6 files changed

Lines changed: 61 additions & 62 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ phpMyAdmin - ChangeLog
7373
- issue #17446 Fix missing option for STORED virtual column on MySQL and PERSISTENT is not supported on MySQL
7474
- issue #17446 Lower the check for virtual columns to MySQL>=5.7.6 nothing is supported on 5.7.5
7575
- issue Fix column names option for CSV Export
76+
- issue #17177 Fix preview SQL when reordering columns doesn't work on move columns
77+
- issue #15887 Fixed DROP TABLE errors ignored on multi table select for DROP
7678

7779
5.2.0 (2022-05-10)
7880
- issue #16521 Upgrade Bootstrap to version 5

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"nikic/fast-route": "^1.3",
6262
"phpmyadmin/motranslator": "^5.0",
6363
"phpmyadmin/shapefile": "^3.0.1",
64-
"phpmyadmin/sql-parser": "dev-master#448c92efdf81a91c17720283457838de2f717324",
64+
"phpmyadmin/sql-parser": "dev-master#a70dec025bbcf9bddfc42117a29226b94694cf30",
6565
"phpmyadmin/twig-i18n-extension": "^4.0",
6666
"psr/http-factory": "^1.0",
6767
"psr/http-message": "^1.0",

js/src/keyhandler.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ const onKeyDownArrowsHandler = function (event) {
7171
return;
7272
}
7373

74-
// eslint-disable-next-line compat/compat
75-
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
76-
7774
var id = 'field_' + y + '_' + x;
7875

7976
var nO = document.getElementById(id);
@@ -87,39 +84,8 @@ const onKeyDownArrowsHandler = function (event) {
8784
return;
8885
}
8986

90-
// for firefox select tag
91-
var lvalue = o.selectedIndex;
92-
var nOvalue = nO.selectedIndex;
93-
9487
nO.focus();
9588

96-
if (isFirefox) {
97-
var ffcheck = 0;
98-
var ffversion;
99-
for (ffversion = 3; ffversion < 25; ffversion++) {
100-
var isFirefoxV24 = navigator.userAgent.toLowerCase().indexOf('firefox/' + ffversion) > -1;
101-
if (isFirefoxV24) {
102-
ffcheck = 1;
103-
break;
104-
}
105-
}
106-
if (ffcheck === 1) {
107-
if (e.which === 38 || e.which === 37) {
108-
nOvalue++;
109-
} else if (e.which === 40 || e.which === 39) {
110-
nOvalue--;
111-
}
112-
nO.selectedIndex = nOvalue;
113-
} else {
114-
if (e.which === 38 || e.which === 37) {
115-
lvalue++;
116-
} else if (e.which === 40 || e.which === 39) {
117-
lvalue--;
118-
}
119-
o.selectedIndex = lvalue;
120-
}
121-
}
122-
12389
if (nO.tagName !== 'SELECT') {
12490
nO.select();
12591
}

js/src/table/structure.js

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ function reloadFieldForm () {
3030
$('#fieldsForm').replaceWith($tempDiv.find('#fieldsForm'));
3131
$('#addColumns').replaceWith($tempDiv.find('#addColumns'));
3232
$('#move_columns_dialog').find('ul').replaceWith($tempDiv.find('#move_columns_dialog ul'));
33-
$('#moveColumns').removeClass('move-active');
3433
});
3534
$('#page_content').show();
3635
}
@@ -285,10 +284,6 @@ AJAX.registerOnload('table/structure.js', function () {
285284
$(document).on('click', '#move_columns_anchor', function (e) {
286285
e.preventDefault();
287286

288-
if ($(this).hasClass('move-active')) {
289-
return;
290-
}
291-
292287
var buttonOptionsError = {};
293288
buttonOptionsError[window.Messages.strOK] = function () {
294289
$(this).dialog('close').remove();
@@ -323,10 +318,40 @@ AJAX.registerOnload('table/structure.js', function () {
323318
var $form = $('#move_columns_dialog').find('form');
324319
$form.data('serialized-unmoved', $form.serialize());
325320

321+
const designerModalPreviewModal = document.getElementById('designerModalPreviewModal');
322+
designerModalPreviewModal.addEventListener('shown.bs.modal', () => {
323+
const modalBody = designerModalPreviewModal.querySelector('.modal-body');
324+
const $form = $('#move_column_form');
325+
const formUrl = $form.attr('action');
326+
const sep = CommonParams.get('arg_separator');
327+
const formData = $form.serialize() +
328+
sep + 'preview_sql=1' +
329+
sep + 'ajax_request=1';
330+
$.post({
331+
url: formUrl,
332+
data: formData,
333+
success: response => {
334+
if (! response.success) {
335+
modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + window.Messages.strErrorProcessingRequest + '</div>';
336+
return;
337+
}
338+
339+
modalBody.innerHTML = response.sql_data;
340+
Functions.highlightSql($('#designerModalPreviewModal'));
341+
},
342+
error: () => {
343+
modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + window.Messages.strErrorProcessingRequest + '</div>';
344+
}
345+
});
346+
});
347+
designerModalPreviewModal.addEventListener('hidden.bs.modal', () => {
348+
designerModalPreviewModal.querySelector('.modal-body').innerHTML = '<div class="spinner-border" role="status">' +
349+
'<span class="visually-hidden">' + window.Messages.strLoading + '</span></div>';
350+
});
351+
326352
$('#moveColumnsModal').modal('show');
353+
$('#designerModalGoButton').off('click');// Unregister previous modals
327354
$('#designerModalGoButton').on('click', function () {
328-
// Off event necessary, else the function fires multiple times
329-
$('#designerModalGoButton').off('click');
330355
event.preventDefault();
331356
var $msgbox = Functions.ajaxShowMessage();
332357
var $this = $('#moveColumnsModal');
@@ -372,21 +397,6 @@ AJAX.registerOnload('table/structure.js', function () {
372397
}
373398
});
374399
});
375-
376-
$('#designerModalPreviewButton').on('click', function () {
377-
// Function for Previewing SQL
378-
$('#moveColumnsModal').modal('hide');
379-
var $form = $('#move_column_form');
380-
Functions.previewSql($form);
381-
});
382-
383-
$('#previewSQLCloseButton').on('click', function () {
384-
$('#moveColumnsModal').modal('show');
385-
});
386-
387-
$('#designerModalCloseButton').on('click', function () {
388-
$('#move_columns_anchor').removeClass('move-active');
389-
});
390400
});
391401

392402
/**

libraries/classes/Controllers/Database/Structure/DropTableController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,15 @@ public function __invoke(ServerRequest $request): void
9898
}
9999
}
100100

101+
$GLOBALS['message'] = Message::success();
102+
101103
$this->dbi->selectDb($GLOBALS['db']);
102104
$result = $this->dbi->tryQuery($GLOBALS['sql_query']);
103105

106+
if (! $result) {
107+
$GLOBALS['message'] = Message::error($this->dbi->getError());
108+
}
109+
104110
if ($result && ! empty($sqlQueryViews)) {
105111
$GLOBALS['sql_query'] .= ' ' . $sqlQueryViews . ';';
106112
$result = $this->dbi->tryQuery($sqlQueryViews);
@@ -113,8 +119,6 @@ public function __invoke(ServerRequest $request): void
113119

114120
ForeignKey::handleDisableCheckCleanup($defaultFkCheckValue);
115121

116-
$GLOBALS['message'] = Message::success();
117-
118122
unset($_POST['mult_btn']);
119123

120124
($this->structureController)($request);

templates/table/structure/display_structure.twig

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,31 @@
340340
</div>
341341
</div>
342342
<div class="modal-footer">
343-
<button type="button" class="btn btn-secondary" id="designerModalGoButton">{% trans 'Go' %}</button>
344-
<button type="button" class="btn btn-secondary" id="designerModalPreviewButton">{% trans 'Preview SQL' %}</button>
343+
<button type="button" class="btn btn-primary" id="designerModalGoButton">{% trans 'Go' %}</button>
344+
<button type="button" class="btn btn-secondary" id="designerModalPreviewButton" data-bs-target="#designerModalPreviewModal" data-bs-toggle="modal">{% trans 'Preview SQL' %}</button>
345345
<button type="button" class="btn btn-secondary" id="designerModalCloseButton" data-bs-dismiss="modal">{% trans 'Close' %}</button>
346346
</div>
347347
</div>
348348
</div>
349349
</div>
350-
350+
<div class="modal fade" id="designerModalPreviewModal" aria-hidden="true" aria-labelledby="designerModalPreviewModalLabel" tabindex="-1">
351+
<div class="modal-dialog">
352+
<div class="modal-content">
353+
<div class="modal-header">
354+
<h5 class="modal-title" id="designerModalPreviewModalLabel">{% trans 'Preview SQL' %}</h5>
355+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans 'Close' %}"></button>
356+
</div>
357+
<div class="modal-body">
358+
<div class="spinner-border" role="status">
359+
<span class="visually-hidden">{% trans 'Loading…' %}</span>
360+
</div>
361+
</div>
362+
<div class="modal-footer">
363+
<button class="btn btn-primary" data-bs-target="#moveColumnsModal" data-bs-toggle="modal">{% trans 'Go back' %}</button>
364+
</div>
365+
</div>
366+
</div>
367+
</div>
351368
<div class="modal fade" id="moveColumnsErrorModal" tabindex="-1" aria-labelledby="moveColumnsErrorModalLabel" aria-hidden="true">
352369
<div class="modal-dialog">
353370
<div class="modal-content">

0 commit comments

Comments
 (0)