Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-01-31 14:22:42 +01:00
commit 9d48593b23
6 changed files with 94 additions and 19 deletions

View File

@ -26,6 +26,7 @@ phpMyAdmin - ChangeLog
- bug #4253 "New" text in navigation frame acts like a database
- bug #4262 Cannot define a column with fractional seconds
- bug #4265 Missing datepicker icon for DATETIME(length)
- bug #4257 Hide fractional seconds when applicable
4.1.6.0 (2014-01-26)
- bug #4232 User not found after creating the user

View File

@ -858,8 +858,25 @@ function insertValueQuery()
function addDateTimePicker() {
if ($.timepicker !== undefined) {
$('input.datefield, input.datetimefield').each(function () {
PMA_addDatepicker($(this));
});
no_decimals = $(this).parent().data('decimals');
var showMillisec = false;
var showMicrosec = false;
var timeFormat = 'HH:mm:ss';
// check for decimal places of seconds
if (($(this).parent().data('decimals') > 0) && ($(this).parent().data('type').indexOf('time') != -1)){
showMillisec = true;
timeFormat = 'HH:mm:ss.lc';
if ($(this).parent().data('decimals') > 3) {
showMicrosec = true;
}
}
PMA_addDatepicker($(this), {
showMillisec: showMillisec,
showMicrosec: showMicrosec,
timeFormat: timeFormat,
});
})
}
}

View File

@ -2125,4 +2125,4 @@
*/
$.timepicker.version = "1.3.1";
})(jQuery);
})(jQuery);

View File

@ -628,6 +628,15 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var new_html = data.isNeedToRecheck
? data.truncatableFieldValue
: $this_field.data('value');
//remove decimal places if column type not supported
if (($this_field.data('decimals') == 0) && ( $this_field.data('type').indexOf('time') != -1)){
new_html = new_html.substring(0, new_html.indexOf('.'));
}
//remove addtional decimal places
if (($this_field.data('decimals') > 0) && ( $this_field.data('type').indexOf('time') != -1)){
new_html = new_html.substring(0, new_html.length - (6 - $this_field.data('decimals')));
}
if ($this_field.is('.truncated')) {
if (new_html.length > g.maxTruncatedLen) {
new_html = new_html.substring(0, g.maxTruncatedLen) + '...';
@ -973,7 +982,24 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($td.is('.datefield')) {
showTimeOption = false;
}
var showMillisec = false;
var showMicrosec = false;
var timeFormat = 'HH:mm:ss';
// check for decimal places of seconds
if (($td.data('decimals') > 0) && ($td.data('type').indexOf('time') != -1)){
showMillisec = true;
timeFormat = 'HH:mm:ss.lc';
if ($td.data('decimals') > 3) {
showMicrosec = true;
}
}
PMA_addDatepicker($editArea, {
showMillisec: showMillisec,
showMicrosec: showMicrosec,
timeFormat: timeFormat,
altField: $input_field,
showTimepicker: showTimeOption,
onSelect: function (dateText, inst) {
@ -1000,15 +1026,34 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
parseInt(current_datetime_value.substring(5, 7)) - 1,
parseInt(current_datetime_value.substring(8, 10))
);
if (current_datetime_value.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}$/)) {
var hour = current_datetime_value.substring(11, 13);
var min = current_datetime_value.substring(14, 16);
var sec = current_datetime_value.substring(17, 19);
var milli = current_datetime_value.substring(20, 23);
var micro = current_datetime_value.substring(23);
var no_decimals = $td.data('decimals');
var hour = current_datetime_value.substring(11, 13);
var min = current_datetime_value.substring(14, 16);
var sec = current_datetime_value.substring(17, 19);
if (current_datetime_value.match("^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{"+ no_decimals +"}$")) {
if (no_decimals > 3){
var milli = current_datetime_value.substring(20, 23);
var micro = current_datetime_value.substring(23);
for (var i = 0; i < 6-no_decimals ; i++) {
micro += "0";
}
}
if (no_decimals <= 3){
var milli = current_datetime_value.substring(20);
for (var i = 0; i < 3-no_decimals ; i++) {
milli += "0";
}
var micro = "000";
}
date.setHours(hour, min, sec, milli);
date.setMicroseconds(micro);
}
if (current_datetime_value.match("^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}")) {
console.log("G");
date.setHours(hour, min, sec);
}
$editArea.datetimepicker('setDate', date);
}
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');

View File

@ -3997,9 +3997,10 @@ class PMA_DisplayResults
);
$formatted = true;
}
} elseif ((substr($meta->type, 0, 9) == self::TIMESTAMP_FIELD)
|| ($meta->type == self::DATETIME_FIELD)
|| ($meta->type == self::TIME_FIELD)
} elseif (((substr($meta->type, 0, 9) == self::TIMESTAMP_FIELD)
|| ($meta->type == self::DATETIME_FIELD)
|| ($meta->type == self::TIME_FIELD)
|| ($meta->type == self::TIME_FIELD)) && (strpos ($column,"." ) === TRUE)
) {
$column = PMA_Util::addMicroseconds($column);
}
@ -5576,7 +5577,7 @@ class PMA_DisplayResults
$relational_display = $_SESSION['tmpval']['relational_display'];
$printview = $this->__get('printview');
$result = '<td class="'
$result = '<td data-decimals="'.$meta->decimals.'" data-type="'.$meta->type.'" class="'
. $this->_addClass(
$class, $condition_field, $meta, $nowrap,
$is_field_truncated, $transformation_plugin, $default_function
@ -6088,3 +6089,4 @@ class PMA_DisplayResults
}
?>
da

View File

@ -1168,6 +1168,7 @@ function PMA_getHTMLinput($column, $column_name_appendix, $special_chars,
$input_type = 'text';
// do not use the 'date' or 'time' types here; they have no effect on some
// browsers and create side effects (see bug #4218)
$the_class = 'textfield';
// verify True_Type which does not contain the parentheses and length
if ($column['True_Type'] === 'date') {
@ -1657,9 +1658,10 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
$special_chars = PMA_Util::printableBitValue(
$current_row[$column['Field']], $extracted_columnspec['spec_in_brackets']
);
} elseif (substr($column['True_Type'], 0, 9) == 'timestamp'
} elseif ((substr($column['True_Type'], 0, 9) == 'timestamp'
|| $column['True_Type'] == 'datetime'
|| $column['True_Type'] == 'time'
|| $column['True_Type'] == 'time')
&& (strpos ($current_row[$column['Field']],"." ) === TRUE)
) {
$current_row[$column['Field']] = PMA_Util::addMicroseconds(
$current_row[$column['Field']]
@ -1741,7 +1743,7 @@ function PMA_getSpecialCharsAndBackupFieldForInsertingMode(
$column, $real_null_value
) {
if (! isset($column['Default'])) {
$column['Default'] = '';
$column['Default'] = '';
$real_null_value = true;
$data = '';
} else {
@ -2803,12 +2805,20 @@ function PMA_getHtmlForInsertEditFormColumn($table_columns, $i, $column,
$tabindex, $tabindex_for_null, $idindex, $vkey, $foreigners,
$foreignData
);
// The value column (depends on type)
// ----------------
// See bug #1667887 for the reason why we don't use the maxlength
// HTML attribute
$html_output .= ' <td>' . "\n";
// HTML attribute
//add data attributes "no of decimals" and "data type"
$no_decimals=0;
$type = current(explode("(", $column['pma_type']));
if(preg_match('/\(([^()]+)\)/', $column['pma_type'], $match)){
$match[0] = trim($match[0], '()');
$no_decimals=$match[0];
}
$html_output .= '<td' . ' data-type="' . $type . '"' . ' data-decimals="' . $no_decimals . '">' . "\n";
// Will be used by js/tbl_change.js to set the default value
// for the "Continue insertion" feature
$html_output .= '<span class="default_value hide">'