Don't ask for confirmation of query that will not be executed (bug #783667).

This commit is contained in:
Michal Čihař
2003-08-12 11:23:19 +00:00
parent a876b6ccf0
commit 4bdd5152ba
2 changed files with 24 additions and 16 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2003-08-12 Michal Cihar <nijel@users.sourceforge.net>
* libraries/export/csv.php3: Don't trim resulting line (bug #782483).
* libraries/functions.js: Don't ask for confirmation of query that will
not be executed (bug #783667).
2003-08-11 Michal Cihar <nijel@users.sourceforge.net>
* libraries/export/csv.php3, libraries/export/latex.php3,

View File

@@ -137,24 +137,30 @@ function checkSqlQuery(theForm)
// js1.2+ -> validation with regular expressions
else {
var space_re = new RegExp('\\s+');
isEmpty = (sqlQuery.value.replace(space_re, '') == '') ? 1 : 0;
if (typeof(theForm.elements['sql_file']) != 'undefined' &&
theForm.elements['sql_file'].value.replace(space_re, '') != '') {
return true;
}
if (typeof(theForm.elements['sql_localfile']) != 'undefined' &&
theForm.elements['sql_localfile'].value.replace(space_re, '') != '') {
return true;
}
if (isEmpty && typeof(theForm.elements['id_bookmark']) != 'undefined' &&
(theForm.elements['id_bookmark'].value != null || theForm.elements['id_bookmark'].value != '') &&
theForm.elements['id_bookmark'].selectedIndex != 0
) {
return true;
}
// Checks for "DROP/DELETE/ALTER" statements
if (!isEmpty && !confirmQuery(theForm, sqlQuery)) {
return false;
}
if (isEmpty && typeof(theForm.elements['sql_file']) != 'undefined') {
isEmpty = (theForm.elements['sql_file'].value.replace(space_re, '') == '') ? 1 : 0;
}
if (isEmpty && typeof(theForm.elements['sql_localfile']) != 'undefined') {
isEmpty = (theForm.elements['sql_localfile'].value.replace(space_re, '') == '') ? 1 : 0;
}
if (isEmpty && typeof(theForm.elements['id_bookmark']) != 'undefined') {
isEmpty = (theForm.elements['id_bookmark'].value == null || theForm.elements['id_bookmark'].value == '');
isEmpty = (theForm.elements['id_bookmark'].selectedIndex == 0);
}
if (isEmpty) {
theForm.reset();
if (sqlQuery.value.replace(space_re, '') != '') {
if (confirmQuery(theForm, sqlQuery)) {
return true;
} else {
return false;
}
}
theForm.reset();
isEmpty = 1;
}
if (isEmpty) {