Feature request: #1512 Import doesn't do anything with no file name provided.
https://sourceforge.net/p/phpmyadmin/feature-requests/1512/ Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>
This commit is contained in:
parent
69e2d84b51
commit
2943a514b9
51
js/import.js
51
js/import.js
@ -57,6 +57,57 @@ AJAX.registerTeardown('import.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('import.js', function () {
|
||||
// import_file_form validation.
|
||||
$('#import_file_form').live('submit', function (event) {
|
||||
var radioLocalImport = $("#radio_local_import_file");
|
||||
var radioImport = $("#radio_import_file");
|
||||
var fileMsg = '<div class="error"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error" /> ' + PMA_messages.strImportDialogMessage + '</div>';
|
||||
|
||||
if (radioLocalImport.length !== 0) {
|
||||
// remote upload.
|
||||
// TODO Remove this section when all browsers support HTML5 "required" property
|
||||
if (! radioLocalImport.is(":checked") && ! radioImport.is(":checked")) {
|
||||
radioImport.focus();
|
||||
var msg = '<div class="error"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error" /> ';
|
||||
msg += PMA_messages.strRadioUnchecked;
|
||||
msg += '</div>';
|
||||
PMA_ajaxShowMessage(msg, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radioImport.is(":checked") && $("#input_import_file").val() === '') {
|
||||
$("#input_import_file").focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radioLocalImport.is(":checked")) {
|
||||
if ($("#select_local_import_file").length === 0) {
|
||||
PMA_ajaxShowMessage('<div class="error"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error" /> ' + PMA_messages.strNoImportFile + ' </div>', false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("#select_local_import_file").val() === '') {
|
||||
$("#select_local_import_file").focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// local upload.
|
||||
if ($("#input_import_file").val() === '') {
|
||||
$("#input_import_file").focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// show progress bar.
|
||||
$("#upload_form_status").css("display", "inline");
|
||||
$("#upload_form_status_info").css("display", "inline");
|
||||
return;
|
||||
});
|
||||
|
||||
// Initially display the options for the selected plugin
|
||||
changePluginOpts();
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ $js_messages['strConfirmDeleteQBESearch'] = __('Do you really want to delete the
|
||||
|
||||
/* For indexes */
|
||||
$js_messages['strFormEmpty'] = __('Missing value in the form!');
|
||||
$js_messages['strRadioUnchecked'] = __('Select at least one of the options!');
|
||||
$js_messages['strEnterValidNumber'] = __('Please enter a valid number!');
|
||||
$js_messages['strEnterValidLength'] = __('Please enter a valid length!');
|
||||
$js_messages['strAddIndex'] = __('Add Index');
|
||||
@ -201,6 +202,7 @@ $js_messages['strFailedBuildingGrid'] = __('Failed building chart grid with impo
|
||||
$js_messages['strImport'] = __('Import');
|
||||
$js_messages['strImportDialogTitle'] = __('Import monitor configuration');
|
||||
$js_messages['strImportDialogMessage'] = __('Please select the file you want to import.');
|
||||
$js_messages['strNoImportFile'] = __('No files available on server for import!');
|
||||
|
||||
$js_messages['strAnalyzeQuery'] = __('Analyse Query');
|
||||
|
||||
|
||||
@ -58,9 +58,6 @@ function PMA_getHtmlForImportJS($upload_id)
|
||||
$html .= ' $("#buttonGo").bind("click", function() {';
|
||||
// hide form
|
||||
$html .= ' $("#upload_form_form").css("display", "none");';
|
||||
// show progress bar
|
||||
$html .= ' $("#upload_form_status").css("display", "inline");';
|
||||
$html .= ' $("#upload_form_status_info").css("display", "inline");';
|
||||
|
||||
if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") {
|
||||
|
||||
@ -230,7 +227,7 @@ function PMA_getHtmlForImportOptionsFile($max_upload_size, $import_list)
|
||||
$html .= ' <ul>';
|
||||
$html .= ' <li>';
|
||||
$html .= ' <input type="radio" name="file_location" '
|
||||
. 'id="radio_import_file" />';
|
||||
. 'id="radio_import_file" required="required" />';
|
||||
$html .= PMA_Util::getBrowseUploadFileBlock($max_upload_size);
|
||||
$html .= ' </li>';
|
||||
$html .= ' <li>';
|
||||
@ -402,7 +399,7 @@ function PMA_getHtmlForImport(
|
||||
|
||||
$html .= PMA_getHtmlForImportJS($upload_id);
|
||||
|
||||
$html .= ' <form action="import.php" method="post" '
|
||||
$html .= ' <form id="import_file_form" action="import.php" method="post" '
|
||||
. 'enctype="multipart/form-data"';
|
||||
$html .= ' name="import"';
|
||||
if ($_SESSION[$SESSION_KEY]["handler"] != "UploadNoplugin") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user