Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-06-22 16:39:07 +02:00
commit 6bb4145505
14 changed files with 224 additions and 204 deletions

View File

@ -331,6 +331,10 @@ function getFieldValidators(field_id, onKeyUpOnly)
*/
function displayErrors(error_list)
{
var tempIsEmpty = function (item) {
return item !== '';
};
for (var field_id in error_list) {
var errors = error_list[field_id];
var field = $('#' + field_id);
@ -343,9 +347,7 @@ function displayErrors(error_list)
}
// remove empty errors (used to clear error list)
errors = $.grep(errors, function (item) {
return item !== '';
});
errors = $.grep(errors, tempIsEmpty);
// CSS error class
if (!isFieldset) {

View File

@ -434,7 +434,6 @@ function confirmQuery(theForm1, sqlQuery1)
*/
function checkSqlQuery(theForm)
{
var sqlQuery;
// get the textarea element containing the query
var sqlQuery;
if (codemirror_editor) {
@ -3107,6 +3106,18 @@ AJAX.registerOnload('functions.js', function () {
.closest('fieldset')
.find('.slider')
.slider('value');
var tempEmptyVal = function () {
$(this).val('');
};
var tempSetFocus = function () {
if ($(this).find("option:selected").val() === '') {
return true;
}
$(this).closest("tr").find("input").focus();
};
while (rows_to_add--) {
var $newrow = $('#index_columns')
.find('tbody > tr:first')
@ -3114,16 +3125,9 @@ AJAX.registerOnload('functions.js', function () {
.appendTo(
$('#index_columns').find('tbody')
);
$newrow.find(':input').each(function () {
$(this).val('');
});
$newrow.find(':input').each(tempEmptyVal);
// focus index size input on column picked
$newrow.find('select').change(function () {
if ($(this).find("option:selected").val() === '') {
return true;
}
$(this).closest("tr").find("input").focus();
});
$newrow.find('select').change(tempSetFocus);
}
});
});

View File

@ -1607,6 +1607,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// add column visibility control
g.cList.innerHTML = '<div class="lDiv"></div>';
var $listDiv = $(g.cList).find('div');
var tempClick = function () {
if (g.toggleCol($(this).index())) {
g.afterToggleCol();
}
};
for (var i = 0; i < $firstRowCols.length; i++) {
var currHeader = $firstRowCols[i];
var listElmt = document.createElement('div');
@ -1614,11 +1621,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.prepend('<input type="checkbox" ' + (g.colVisib[i] ? 'checked="checked" ' : '') + '/>');
$listDiv.append(listElmt);
// add event on click
$(listElmt).click(function () {
if (g.toggleCol($(this).index())) {
g.afterToggleCol();
}
});
$(listElmt).click(tempClick);
}
// add "show all column" button
var showAll = document.createElement('div');

View File

@ -240,20 +240,20 @@ $(function () {
event.preventDefault();
$self = $(this);
var anchor_id = $self.attr("id");
if($self.data("favtargetn") !== null)
if($self.data("favtargetn") !== null) {
if($('a[data-favtargets="' + $self.data("favtargetn") + '"]').length > 0)
{
$('a[data-favtargets="' + $self.data("favtargetn") + '"]').trigger('click');
return;
}
}
$.ajax({
url: $self.attr('href'),
cache: false,
type: 'POST',
data: {
favorite_tables: (window.localStorage.favorite_tables
!== undefined)
favorite_tables: (window.localStorage.favorite_tables !== undefined)
? window.localStorage.favorite_tables
: ''
},
@ -268,8 +268,7 @@ $(function () {
);
// Update localStorage.
if (window.localStorage !== undefined) {
window.localStorage.favorite_tables
= data.favorite_tables;
window.localStorage.favorite_tables = data.favorite_tables;
}
} else {
PMA_ajaxShowMessage(data.message);
@ -1252,8 +1251,9 @@ function PMA_showFullName($containerELem) {
/** mouseenter */
var $this = $(this);
var thisOffset = $this.offset();
if($this.text() === '')
if($this.text() === '') {
return;
}
var $parent = $this.parent();
if( ($parent.offset().left + $parent.outerWidth())
< (thisOffset.left + $this.outerWidth()))

View File

@ -413,18 +413,27 @@ AJAX.registerOnload('server_status_monitor.js', function () {
var numColumns;
var $tr = $('#chartGrid tr:first');
var row = 0;
var tempManageCols = function () {
if (numColumns > monitorSettings.columns) {
if ($tr.next().length === 0) {
$tr.after('<tr></tr>');
}
$tr.next().prepend($(this));
}
numColumns++;
};
var tempAddCol = function () {
if ($(this).next().length !== 0) {
$(this).append($(this).next().find('td:first'));
}
};
while ($tr.length !== 0) {
numColumns = 1;
// To many cells in one row => put into next row
$tr.find('td').each(function () {
if (numColumns > monitorSettings.columns) {
if ($tr.next().length === 0) {
$tr.after('<tr></tr>');
}
$tr.next().prepend($(this));
}
numColumns++;
});
$tr.find('td').each(tempManageCols);
// To little cells in one row => for each cell to little,
// move all cells backwards by 1
@ -432,11 +441,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
var cnt = monitorSettings.columns - $tr.find('td').length;
for (var i = 0; i < cnt; i++) {
$tr.append($tr.next().find('td:first'));
$tr.nextAll().each(function () {
if ($(this).next().length !== 0) {
$(this).append($(this).next().find('td:first'));
}
});
$tr.nextAll().each(tempAddCol);
}
}
@ -1150,44 +1155,46 @@ AJAX.registerOnload('server_status_monitor.js', function () {
series.push([[0, 0]]);
}
var tempTooltipContentEditor = function (str, seriesIndex, pointIndex, plot) {
var j;
// TODO: move style to theme CSS
var tooltipHtml = '<div style="font-size:12px;background-color:#FFFFFF;' +
'opacity:0.95;filter:alpha(opacity=95);padding:5px;">';
// x value i.e. time
var timeValue = str.split(",")[0];
var seriesValue;
tooltipHtml += 'Time: ' + timeValue;
tooltipHtml += '<span style="font-weight:bold;">';
// Add y values to the tooltip per series
for (j in plot.series) {
// get y value if present
if (plot.series[j].data.length > pointIndex) {
seriesValue = plot.series[j].data[pointIndex][1];
} else {
return;
}
var seriesLabel = plot.series[j].label;
var seriesColor = plot.series[j].color;
// format y value
if (plot.series[0]._yaxis.tickOptions.formatter) {
// using formatter function
seriesValue = plot.series[0]._yaxis.tickOptions.formatter('%s', seriesValue);
} else if (plot.series[0]._yaxis.tickOptions.formatString) {
// using format string
seriesValue = $.sprintf(plot.series[0]._yaxis.tickOptions.formatString, seriesValue);
}
tooltipHtml += '<br /><span style="color:' + seriesColor + '">' +
seriesLabel + ': ' + seriesValue + '</span>';
}
tooltipHtml += '</span></div>';
return tooltipHtml;
};
// set Tooltip for each series
for (i in settings.series) {
settings.series[i].highlighter = {
show: true,
tooltipContentEditor: function (str, seriesIndex, pointIndex, plot) {
var j;
// TODO: move style to theme CSS
var tooltipHtml = '<div style="font-size:12px;background-color:#FFFFFF;' +
'opacity:0.95;filter:alpha(opacity=95);padding:5px;">';
// x value i.e. time
var timeValue = str.split(",")[0];
var seriesValue;
tooltipHtml += 'Time: ' + timeValue;
tooltipHtml += '<span style="font-weight:bold;">';
// Add y values to the tooltip per series
for (j in plot.series) {
// get y value if present
if (plot.series[j].data.length > pointIndex) {
seriesValue = plot.series[j].data[pointIndex][1];
} else {
return;
}
var seriesLabel = plot.series[j].label;
var seriesColor = plot.series[j].color;
// format y value
if (plot.series[0]._yaxis.tickOptions.formatter) {
// using formatter function
seriesValue = plot.series[0]._yaxis.tickOptions.formatter('%s', seriesValue);
} else if (plot.series[0]._yaxis.tickOptions.formatString) {
// using format string
seriesValue = $.sprintf(plot.series[0]._yaxis.tickOptions.formatString, seriesValue);
}
tooltipHtml += '<br /><span style="color:' + seriesColor + '">' +
seriesLabel + ': ' + seriesValue + '</span>';
}
tooltipHtml += '</span></div>';
return tooltipHtml;
}
tooltipContentEditor: tempTooltipContentEditor
};
}
@ -1854,6 +1861,10 @@ AJAX.registerOnload('server_status_monitor.js', function () {
$('#logTable').html($table);
var tempPushKey = function (key, value) {
cols.push(key);
};
var formatValue = function (name, value) {
if (name == 'user_host') {
return value.replace(/(\[.*?\])+/g, '');
@ -1863,9 +1874,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
for (var i = 0, l = rows.length; i < l; i++) {
if (i === 0) {
$.each(rows[0], function (key, value) {
cols.push(key);
});
$.each(rows[0], tempPushKey);
$table.append('<thead>' +
'<tr><th class="nowrap">' + cols.join('</th><th class="nowrap">') + '</th></tr>' +
'</thead>'
@ -2011,19 +2020,22 @@ AJAX.registerOnload('server_status_monitor.js', function () {
explain += ')';
}
explain += '<p></p>';
var tempExplain = function (key, value) {
value = (value === null) ? 'null' : value;
if (key == 'type' && value.toLowerCase() == 'all') {
value = '<span class="attention">' + value + '</span>';
}
if (key == 'Extra') {
value = value.replace(/(using (temporary|filesort))/gi, '<span class="attention">$1</span>');
}
explain += key + ': ' + value + '<br />';
};
for (i = 0, l = data.explain.length; i < l; i++) {
explain += '<div class="explain-' + i + '"' + (i > 0 ? 'style="display:none;"' : '') + '>';
$.each(data.explain[i], function (key, value) {
value = (value === null) ? 'null' : value;
if (key == 'type' && value.toLowerCase() == 'all') {
value = '<span class="attention">' + value + '</span>';
}
if (key == 'Extra') {
value = value.replace(/(using (temporary|filesort))/gi, '<span class="attention">$1</span>');
}
explain += key + ': ' + value + '<br />';
});
$.each(data.explain[i], tempExplain);
explain += '</div>';
}

View File

@ -362,6 +362,109 @@ AJAX.registerOnload('tbl_change.js', function () {
});
if (curr_rows < target_rows) {
var tempIncrementIndex = function () {
var $this_element = $(this);
/**
* Extract the index from the name attribute for all input/select fields and increment it
* name is of format funcs[multi_edit][10][<long random string of alphanum chars>]
*/
/**
* @var this_name String containing name of the input/select elements
*/
var this_name = $this_element.attr('name');
/** split {@link this_name} at [10], so we have the parts that can be concatenated later */
var name_parts = this_name.split(/\[\d+\]/);
/** extract the [10] from {@link name_parts} */
var old_row_index_string = this_name.match(/\[\d+\]/)[0];
/** extract 10 - had to split into two steps to accomodate double digits */
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0], 10);
/** calculate next index i.e. 11 */
new_row_index = old_row_index + 1;
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
var new_name = name_parts[0] + '[' + new_row_index + ']' + name_parts[1];
var hashed_field = name_parts[1].match(/\[(.+)\]/)[1];
$this_element.attr('name', new_name);
/** If element is select[name*='funcs'], update id */
if ($this_element.is("select[name*='funcs']")) {
var this_id = $this_element.attr("id");
var id_parts = this_id.split(/\_/);
var old_id_index = id_parts[1];
var prevSelectedValue = $("#field_" + old_id_index + "_1").val();
var new_id_index = parseInt(old_id_index) + columnCount;
var new_id = 'field_' + new_id_index + '_1';
$this_element.attr('id', new_id);
$this_element.find("option").filter(function () {
return $(this).text() === prevSelectedValue;
}).attr("selected","selected");
// If salt field is there then update its id.
var nextSaltInput = $this_element.parent().next("td").next("td").find("input[name*='salt']");
if (nextSaltInput.length !== 0) {
nextSaltInput.attr("id", "salt_" + new_id);
}
}
// handle input text fields and textareas
if ($this_element.is('.textfield') || $this_element.is('.char')) {
// do not remove the 'value' attribute for ENUM columns
if ($this_element.closest('tr').find('span.column_type').html() != 'enum') {
$this_element.val($this_element.closest('tr').find('span.default_value').html());
}
$this_element
.unbind('change')
// Remove onchange attribute that was placed
// by tbl_change.php; it refers to the wrong row index
.attr('onchange', null)
// Keep these values to be used when the element
// will change
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('change', function (e) {
var $changed_element = $(this);
verificationsAfterFieldChange(
$changed_element.data('hashed_field'),
$changed_element.data('new_row_index'),
$changed_element.closest('tr').find('span.column_type').html()
);
});
}
if ($this_element.is('.checkbox_null')) {
$this_element
// this event was bound earlier by jQuery but
// to the original row, not the cloned one, so unbind()
.unbind('click')
// Keep these values to be used when the element
// will be clicked
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('click', function (e) {
var $changed_element = $(this);
nullify(
$changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(),
$changed_element.data('hashed_field'),
'[multi_edit][' + $changed_element.data('new_row_index') + ']'
);
});
}
};
var tempReplaceAnchor = function () {
var $anchor = $(this);
var new_value = 'rownumber=' + new_row_index;
// needs improvement in case something else inside
// the href contains this pattern
var new_href = $anchor.attr('href').replace(/rownumber=\d+/, new_value);
$anchor.attr('href', new_href);
};
while (curr_rows < target_rows) {
/**
@ -379,108 +482,10 @@ AJAX.registerOnload('tbl_change.js', function () {
.clone(true, true)
.insertBefore("#actions_panel")
.find('input[name*=multi_edit],select[name*=multi_edit],textarea[name*=multi_edit]')
.each(function () {
var $this_element = $(this);
/**
* Extract the index from the name attribute for all input/select fields and increment it
* name is of format funcs[multi_edit][10][<long random string of alphanum chars>]
*/
/**
* @var this_name String containing name of the input/select elements
*/
var this_name = $this_element.attr('name');
/** split {@link this_name} at [10], so we have the parts that can be concatenated later */
var name_parts = this_name.split(/\[\d+\]/);
/** extract the [10] from {@link name_parts} */
var old_row_index_string = this_name.match(/\[\d+\]/)[0];
/** extract 10 - had to split into two steps to accomodate double digits */
var old_row_index = parseInt(old_row_index_string.match(/\d+/)[0], 10);
/** calculate next index i.e. 11 */
new_row_index = old_row_index + 1;
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
var new_name = name_parts[0] + '[' + new_row_index + ']' + name_parts[1];
var hashed_field = name_parts[1].match(/\[(.+)\]/)[1];
$this_element.attr('name', new_name);
/** If element is select[name*='funcs'], update id */
if ($this_element.is("select[name*='funcs']")) {
var this_id = $this_element.attr("id");
var id_parts = this_id.split(/\_/);
var old_id_index = id_parts[1];
var prevSelectedValue = $("#field_" + old_id_index + "_1").val();
var new_id_index = parseInt(old_id_index) + columnCount;
var new_id = 'field_' + new_id_index + '_1';
$this_element.attr('id', new_id);
$this_element.find("option").filter(function () {
return $(this).text() === prevSelectedValue;
}).attr("selected","selected");
// If salt field is there then update its id.
var nextSaltInput = $this_element.parent().next("td").next("td").find("input[name*='salt']");
if (nextSaltInput.length !== 0) {
nextSaltInput.attr("id", "salt_" + new_id);
}
}
// handle input text fields and textareas
if ($this_element.is('.textfield') || $this_element.is('.char')) {
// do not remove the 'value' attribute for ENUM columns
if ($this_element.closest('tr').find('span.column_type').html() != 'enum') {
$this_element.val($this_element.closest('tr').find('span.default_value').html());
}
$this_element
.unbind('change')
// Remove onchange attribute that was placed
// by tbl_change.php; it refers to the wrong row index
.attr('onchange', null)
// Keep these values to be used when the element
// will change
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('change', function (e) {
var $changed_element = $(this);
verificationsAfterFieldChange(
$changed_element.data('hashed_field'),
$changed_element.data('new_row_index'),
$changed_element.closest('tr').find('span.column_type').html()
);
});
}
if ($this_element.is('.checkbox_null')) {
$this_element
// this event was bound earlier by jQuery but
// to the original row, not the cloned one, so unbind()
.unbind('click')
// Keep these values to be used when the element
// will be clicked
.data('hashed_field', hashed_field)
.data('new_row_index', new_row_index)
.bind('click', function (e) {
var $changed_element = $(this);
nullify(
$changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(),
$changed_element.data('hashed_field'),
'[multi_edit][' + $changed_element.data('new_row_index') + ']'
);
});
}
}) // end each
.each(tempIncrementIndex)
.end()
.find('.foreign_values_anchor')
.each(function () {
var $anchor = $(this);
var new_value = 'rownumber=' + new_row_index;
// needs improvement in case something else inside
// the href contains this pattern
var new_href = $anchor.attr('href').replace(/rownumber=\d+/, new_value);
$anchor.attr('href', new_href);
});
.each(tempReplaceAnchor);
//Insert/Clone the ignore checkboxes
if (curr_rows == 1) {

View File

@ -116,8 +116,8 @@ function PMA_queryChart(data, columnNames, settings) {
});
var valueMap = {}, xValue, value;
var mainAxisName = columnNames[settings.mainAxis]
var valueColumnName = columnNames[settings.valueColumn]
var mainAxisName = columnNames[settings.mainAxis];
var valueColumnName = columnNames[settings.valueColumn];
for (var i = 0; i < data.length; i++) {
xValue = data[i][mainAxisName];
value = valueMap[xValue];

View File

@ -287,13 +287,14 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
var xChange = false;
var yChange = false;
var key;
var tempGetVal = function () {
return $(this).val();
};
for (key in selectedRow) {
var oldVal = selectedRow[key];
var newVal = ($('#edit_fields_null_id_' + it).prop('checked')) ? null : $('#edit_fieldID_' + it).val();
if (newVal instanceof Array) { // when the column is of type SET
newVal = $('#edit_fieldID_' + it).map(function () {
return $(this).val();
}).get().join(",");
newVal = $('#edit_fieldID_' + it).map(tempGetVal).get().join(",");
}
if (oldVal != newVal) {
selectedRow[key] = newVal;

View File

@ -187,7 +187,7 @@ class Advisor
/**
* Splits justification to text and formula.
*
* @param string $rule the rule
* @param array $rule the rule
*
* @return string[]
*/

View File

@ -630,7 +630,6 @@ class PMA_DisplayResults
) {
$table_navigation_html = '';
$showtable = $this->__get('showtable'); // To use in isset
// here, using htmlentities() would cause problems if the query
// contains accented characters

View File

@ -20,6 +20,9 @@ require_once './libraries/List_Database.class.php';
* phpMyAdmin main Controller
*
* @package PhpMyAdmin
*
* @property resource $userlink
* @property resource $controllink
*/
class PMA
{

View File

@ -315,7 +315,6 @@ function PMA_deleteColumnsFromList($field_select, $isTable=true)
$message = true;
$colNotExist = array();
$fields = array();
$cols ="";
if ($isTable) {
$cols = '';
foreach ($field_select as $table) {

View File

@ -59,14 +59,6 @@ class PMA_Drizzle extends Drizzle
*/
const BUFFER_ROW = 2;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
}
/**
* Creates a new database conection using TCP
*

View File

@ -13,8 +13,8 @@ if (! defined('PHPMYADMIN')) {
* Generate charset dropdown box
*
* @param int $type Type
* @param null $name Element name
* @param null $id Element id
* @param string $name Element name
* @param string $id Element id
* @param null|string $default Default value
* @param bool $label Label
* @param int $indent Indent