Merge pull request #1119 from Tithugues/help4319
Add message to warn the user if a form has too many fields.
This commit is contained in:
commit
5c0b5413ca
@ -291,6 +291,7 @@ var AJAX = {
|
||||
"<div id='page_content'>" + data.message + "</div>"
|
||||
);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
checkNumberOfFields();
|
||||
}
|
||||
|
||||
if (data._selflink) {
|
||||
|
||||
@ -11,6 +11,8 @@ $(function () {
|
||||
event.preventDefault();
|
||||
PMA_querywindow.focus();
|
||||
});
|
||||
|
||||
checkNumberOfFields();
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -4112,3 +4112,23 @@ function PMA_formatDateTime(date, seconds) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check than forms have less fields than max allowed by PHP.
|
||||
*/
|
||||
function checkNumberOfFields() {
|
||||
if (typeof maxInputVars === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
$('form').each(function() {
|
||||
var nbInputs = $(this).find(':input').length;
|
||||
if (nbInputs > maxInputVars) {
|
||||
var warning = $.sprintf(PMA_messages.strTooManyInputs, maxInputVars);
|
||||
PMA_ajaxShowMessage(warning);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -402,6 +402,12 @@ $js_messages['strIgnore'] = __("Ignore");
|
||||
$js_messages['strTimeOutError'] = __(
|
||||
"Your export is incomplete, due to a low execution time limit at the PHP level!"
|
||||
);
|
||||
|
||||
$js_messages['strTooManyInputs'] = __(
|
||||
"Warning: a form on this page has more than %d fields and could not be "
|
||||
. "processed."
|
||||
);
|
||||
|
||||
echo "var PMA_messages = new Array();\n";
|
||||
foreach ($js_messages as $name => $js_message) {
|
||||
PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);
|
||||
@ -419,6 +425,9 @@ echo "var pmaversion = '" . PMA_VERSION . "';\n";
|
||||
|
||||
echo "var mysql_doc_template = '" . PMA_Util::getMySQLDocuURL('%s') . "';\n";
|
||||
|
||||
//Max input vars allowed by PHP.
|
||||
echo 'var maxInputVars = ' . ini_get('max_input_vars') . ';';
|
||||
|
||||
echo "if ($.datepicker) {\n";
|
||||
/* l10n: Display text for calendar close link */
|
||||
PMA_printJsValue("$.datepicker.regional['']['closeText']", __('Done'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user