Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-04-05 22:57:46 +02:00
commit 4f1992585b
3 changed files with 65 additions and 16 deletions

View File

@ -715,8 +715,8 @@ $.extend($.timepicker._defaults, $.timepicker.regional['']);
<?php
/* Form validation */
echo "function extendingValidatorMessages() {";
echo "$.extend($.validator.messages, {";
echo "function extendingValidatorMessages() {\n";
echo "$.extend($.validator.messages, {\n";
/* Default validation functions */
PMA_printJsValueForFormValidation('required', __('This field is required'));
PMA_printJsValueForFormValidation('remote', __('Please fix this field'));
@ -738,6 +738,6 @@ PMA_printJsValueForFormValidation('min', __('Please enter a value greater than o
PMA_printJsValueForFormValidation('validationFunctionForDateTime', __('Please enter a valid date or time'), true);
PMA_printJsValueForFormValidation('validationFunctionForHex', __('Please enter a valid HEX input'), true);
PMA_printJsValueForFormValidation('validationFunctionForFuns', __('Error'), true, false);
echo "});";
echo "}";
echo "\n});";
echo "\n} /* if ($.validator) */";
?>

View File

@ -182,7 +182,12 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|| target.value === 'AES_ENCRYPT'
|| target.value === 'MD5') {
$('#' + target.id).rules("add", {
validationFunctionForFuns : $this_input
validationFunctionForFuns: {
param: $this_input,
depends: function() {
return checkForCheckbox(multi_edit);
}
}
});
}
@ -207,36 +212,80 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
// validate for date time
if (theType == "datetime" || theType == "time" || theType == "date" || theType == "timestamp") {
$this_input.rules("add", {
validationFunctionForDateTime : theType
validationFunctionForDateTime: {
param: theType,
depends: function() {
return checkForCheckbox(multi_edit);
}
}
});
}
//validation for integer type
if ($this_input.data('type') === 'INT') {
var min = $this_input.attr('min');
var max = $this_input.attr('max');
var mini = parseInt($this_input.attr('min'));
var maxi = parseInt($this_input.attr('max'));
$this_input.rules("add", {
maxlength : max,
minlength : min
number: {
param : true,
depends: function() {
return checkForCheckbox(multi_edit);
}
},
min: {
param: mini,
depends: function() {
if (isNaN($this_input.val())) return false;
else return checkForCheckbox(multi_edit);
}
},
max: {
param: maxi,
depends: function() {
if (isNaN($this_input.val())) return false;
else return checkForCheckbox(multi_edit);
}
}
});
//validation for CHAR types
} else if ($this_input.data('type') === 'CHAR') {
var maxlen = $this_input.data('maxlength');
if (maxlen <=4) {
maxlen=charExceptionHandling
maxlen=charExceptionHandling;
}
$this_input.rules("add", {
maxlength : maxlen
maxlength: {
param: maxlen,
depends: function() {
return checkForCheckbox(multi_edit);
}
}
});
// validate binary & blob types
} else if ($this_input.data('type') === 'HEX') {
$this_input.rules("add", {
validationFunctionForHex : true
validationFunctionForHex: {
param: true,
depends: function() {
return checkForCheckbox(multi_edit);
}
}
});
}
if (removeOnclick === 1) $this_input.removeAttr('onchange');
}
}
/* End of fields validation*/
/* End of fields validation*/
/**
* To check whether insert section is ignored or not
*/
function checkForCheckbox(multi_edit)
{
if($("#insert_ignore_"+multi_edit).length) {
return $("#insert_ignore_"+multi_edit).is(":unchecked");
}
return true;
}
/**
* Applies the selected function to all rows to be inserted.

View File

@ -145,7 +145,7 @@ function PMA_printJsValue($key, $value)
*/
function PMA_getJsValueForFormValidation($key, $value, $addOn, $comma)
{
$result = $key . ' : ';
$result = $key . ': ';
if ($addOn) {
$result .= '$.validator.format(';
}
@ -154,7 +154,7 @@ function PMA_getJsValueForFormValidation($key, $value, $addOn, $comma)
$result .= ')';
}
if ($comma) {
$result .= ',';
$result .= ', ';
}
return $result;
}