Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

This commit is contained in:
Pootle server 2011-08-08 15:52:03 +02:00
commit 8efc22fc6a
5 changed files with 105 additions and 82 deletions

View File

@ -180,7 +180,6 @@ function markDbTable(db, table)
*/
function setAll( new_lang, new_collation_connection, new_server, new_db, new_table, new_token )
{
//alert('setAll( ' + new_lang + ', ' + new_collation_connection + ', ' + new_server + ', ' + new_db + ', ' + new_table + ', ' + new_token + ' )');
if (new_server != server || new_lang != lang
|| new_collation_connection != collation_connection) {
// something important has changed
@ -240,7 +239,6 @@ function focus_querywindow(sql_query)
if ( !querywindow || querywindow.closed || !querywindow.location) {
// we need first to open the window and cannot pass the query with it
// as we dont know if the query exceeds max url length
/* url = 'querywindow.php?' + common_query + '&db=' + db + '&table=' + table + '&sql_query=SELECT * FROM'; */
query_to_load = sql_query;
open_querywindow();
insertQuery(0);

View File

@ -4,7 +4,7 @@
var g = {
// constant
minColWidth: 15,
// variables, assigned with default value, changed later
actionSpan: 5,
colOrder: new Array(), // array of column order
@ -21,7 +21,7 @@
showColVisibHint: false,
showAllColText: '', // string, text for "show all" button under column visibility list
visibleHeadersCount: 0, // number of visible data headers
// functions
dragStartRsz: function(e, obj) { // start column resize
var n = $(this.cRsz).find('div').index(obj);
@ -35,7 +35,7 @@
$('body').css('cursor', 'col-resize');
$('body').noSelect();
},
dragStartMove: function(e, obj) { // start column move
// prepare the cCpy and cPointer from the dragged column
$(this.cCpy).text($(obj).text());
@ -49,10 +49,10 @@
$(this.cPointer).css({
top: objPos.top
});
// get the column index, zero-based
var n = this.getHeaderIdx(obj);
this.colMov = {
x0: e.pageX,
y0: e.pageY,
@ -66,7 +66,7 @@
$('body').css('cursor', 'move');
$('body').noSelect();
},
dragMove: function(e) {
if (this.colRsz) {
var dx = e.pageX - this.colRsz.x0;
@ -79,7 +79,7 @@
$(this.cCpy)
.css('left', this.colMov.objLeft + dx)
.show();
// pointer animation
var hoveredCol = this.getHoveredCol(e);
if (hoveredCol) {
@ -103,7 +103,7 @@
}
}
},
dragEnd: function(e) {
if (this.colRsz) {
var dx = e.pageX - this.colRsz.x0;
@ -114,7 +114,7 @@
var n = this.colRsz.n;
// do the resizing
this.resize(n, nw);
$('body').css('cursor', 'default');
this.reposRsz();
this.reposDrop();
@ -134,7 +134,7 @@
}
this.refreshRestoreButton();
}
// animate new column position
$(this.cCpy).stop(true, true)
.animate({
@ -149,7 +149,7 @@
$('body').css('cursor', 'default');
$('body').noSelect(false);
},
/**
* Resize column n to new width "nw"
*/
@ -160,7 +160,7 @@
.css('width', nw);
});
},
/**
* Reposition column resize bars.
*/
@ -175,7 +175,7 @@
}
$(this.cRsz).css('height', $(this.t).height());
},
/**
* Shift column from index oldn to newn.
*/
@ -195,7 +195,7 @@
});
// reposition the column resize bars
this.reposRsz();
// adjust the column visibility list
if (newn < oldn) {
$(g.cList).find('.lDiv div:eq(' + newn + ')')
@ -213,7 +213,7 @@
this.colVisib.splice(oldn, 1);
this.colVisib.splice(newn, 0, tmp);
},
/**
* Find currently hovered table column's header (excluding actions column).
* @return the hovered column's th object or undefined if no hovered column found.
@ -230,14 +230,14 @@
});
return hoveredCol;
},
/**
* Get a zero-based index from a <th class="draggable"> tag in a table.
*/
getHeaderIdx: function(obj) {
return $(obj).parents('tr').find('th.draggable').index(obj);
},
/**
* Reposition the table back to normal order.
*/
@ -259,7 +259,7 @@
}
this.refreshRestoreButton();
},
/**
* Send column preferences (column order and visibility) to the server.
*/
@ -276,7 +276,7 @@
table_create_time: this.tableCreateTime
});
},
/**
* Refresh restore button state.
* Make restore button disabled if the table is similar with initial state.
@ -299,7 +299,7 @@
$('.restore_column').show();
}
},
/**
* Update current hint using the boolean values (showReorderHint, showSortHint, etc.).
* It will hide the hint if all the boolean values is false.
@ -324,16 +324,16 @@
text += text.length > 0 ? '<br />' : '';
text += this.colVisibHint;
}
// hide the hint if no text
this.qtip.disable(!text && e.type == 'mouseenter');
this.qtip.updateContent(text, false);
} else {
this.qtip.disable(true);
}
},
/**
* Toggle column's visibility.
* After calling this function and it returns true, afterToggleCol() must be called.
@ -367,7 +367,7 @@
}
return true;
},
/**
* This must be called after calling toggleCol() and the return value is true.
*
@ -379,12 +379,12 @@
this.reposRsz();
this.reposDrop();
this.sendColPrefs();
// check visible first row headers count
this.visibleHeadersCount = $(this.t).find('tr:first th.draggable:visible').length;
this.refreshRestoreButton();
},
/**
* Show columns' visibility list.
*/
@ -404,7 +404,7 @@
$(obj).addClass('coldrop-hover');
}
},
/**
* Hide columns' visibility list.
*/
@ -412,7 +412,7 @@
$(this.cList).hide();
$(g.cDrop).find('.coldrop-hover').removeClass('coldrop-hover');
},
/**
* Reposition the column visibility drop-down arrow.
*/
@ -427,7 +427,7 @@
});
}
},
/**
* Show all hidden columns.
*/
@ -440,61 +440,61 @@
this.afterToggleCol();
}
}
// wrap all data cells, except actions cell, with span
$(t).find('th, td:not(:has(span))')
.wrapInner('<span />');
g.gDiv = document.createElement('div'); // create global div
g.cRsz = document.createElement('div'); // column resizer
g.cCpy = document.createElement('div'); // column copy, to store copy of dragged column header
g.cPointer = document.createElement('div'); // column pointer, used when reordering column
g.cDrop = document.createElement('div'); // column drop-down arrows
g.cList = document.createElement('div'); // column visibility list
// adjust g.cCpy
g.cCpy.className = 'cCpy';
$(g.cCpy).hide();
// adjust g.cPoint
g.cPointer.className = 'cPointer';
$(g.cPointer).css('visibility', 'hidden');
// adjust g.cDrop
g.cDrop.className = 'cDrop';
// adjust g.cList
g.cList.className = 'cList';
$(g.cList).hide();
// chain table and grid together
t.grid = g;
g.t = t;
// get first row data columns
var $firstRowCols = $(t).find('tr:first th.draggable');
// initialize g.visibleHeadersCount
g.visibleHeadersCount = $firstRowCols.filter(':visible').length;
// assign first column (actions) span
if (! $(t).find('tr:first th:first').hasClass('draggable')) { // action header exist
g.actionSpan = $(t).find('tr:first th:first').prop('colspan');
} else {
g.actionSpan = 0;
}
// assign table create time
// #table_create_time will only available if we are in "Browse" tab
g.tableCreateTime = $('#table_create_time').val();
// assign column reorder & column sort hint
g.reorderHint = $('#col_order_hint').val();
g.sortHint = $('#sort_hint').val();
g.markHint = $('#col_mark_hint').val();
g.colVisibHint = $('#col_visib_hint').val();
g.showAllColText = $('#show_all_col_text').val();
g.reorderHint = PMA_messages['strColOrderHint'];
g.sortHint = PMA_messages['strSortHint'];
g.markHint = PMA_messages['strMarkHint'];
g.colVisibHint = PMA_messages['strVisibHint'];
g.showAllColText = PMA_messages['strShowAll'];
// initialize column order
$col_order = $('#col_order');
if ($col_order.length > 0) {
@ -508,7 +508,7 @@
g.colOrder.push(i);
}
}
// initialize column visibility
$col_visib = $('#col_visib');
if ($col_visib.length > 0) {
@ -522,7 +522,7 @@
g.colVisib.push(1);
}
}
if ($firstRowCols.length > 1) {
// create column drop-down arrow(s)
$(t).find('th:not(.draggable)').each(function() {
@ -542,7 +542,7 @@
});
$(g.cDrop).append(cd);
});
// add column visibility control
g.cList.innerHTML = '<div class="lDiv"></div>';
var $listDiv = $(g.cList).find('div');
@ -576,7 +576,7 @@
});
}
}
// create column borders
$firstRowCols.each(function() {
$this = $(this);
@ -588,15 +588,15 @@
$(g.cRsz).append(cb);
});
g.reposRsz();
// bind event to update currently hovered qtip API
$(t).find('th').mouseenter(function(e) {
g.qtip = $(this).qtip('api');
});
// create qtip for each <th> with draggable class
PMA_createqTip($(t).find('th.draggable'));
// register events
if (g.reorderHint) { // make sure columns is reorderable
$(t).find('th.draggable')
@ -621,7 +621,7 @@
}
if ($firstRowCols.length > 1) {
var $colVisibTh = $(t).find('th:not(.draggable)');
PMA_createqTip($colVisibTh);
$colVisibTh.mouseenter(function(e) {
g.showColVisibHint = true;
@ -663,10 +663,10 @@
$(t).find('td, th.draggable').mouseenter(function() {
g.hideColList();
});
// add table class
$(t).addClass('pma_table');
// link all divs
$(t).before(g.gDiv);
$(g.gDiv).append(t);
@ -686,13 +686,13 @@
return false;
});
};
// document ready checking
var docready = false;
$(document).ready(function() {
docready = true;
});
// Additional jQuery functions
/**
* Make resizable, reorderable grid.
@ -732,6 +732,6 @@
}
});
}
})(jQuery);

View File

@ -268,6 +268,13 @@ $js_messages['strNewerVersion'] = __('A newer version of phpMyAdmin is available
$js_messages['strLatestAvailable'] = __(', latest stable version:');
$js_messages['strUpToDate'] = __('up to date');
/* Browsing grid */
$js_messages['strColOrderHint'] = __('Drag to reorder');
$js_messages['strSortHint'] = __('Click to sort');
$js_messages['strMarkHint'] = __('Click to mark/unmark');
$js_messages['strVisibHint'] = __('Click the drop-down arrow<br />to toggle column\'s visibility');
$js_messages['strShowAll'] = __('Show all');
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);

View File

@ -253,7 +253,10 @@ function PMA_unQuote($quoted_string, $quote = null)
&& substr($quoted_string, -1, 1) === $quote) {
$unquoted_string = substr($quoted_string, 1, -1);
// replace escaped quotes
$unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string);
$unquoted_string = str_replace(
$quote . $quote,
$quote,
$unquoted_string);
return $unquoted_string;
}
}
@ -290,9 +293,13 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '')
if (! is_array($parsed_sql)) {
// We don't so just return the input directly
// This is intended to be used for when the SQL Parser is turned off
$formatted_sql = '<pre>' . "\n"
. (($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '') ? $unparsed_sql : $parsed_sql) . "\n"
. '</pre>';
$formatted_sql = '<pre>' . "\n";
if ($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '') {
$formatted_sql .= $unparsed_sql;
} else {
$formatted_sql .= $parsed_sql;
}
$formatted_sql .= '</pre>';
return $formatted_sql;
}
@ -301,7 +308,9 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '')
switch ($cfg['SQP']['fmtType']) {
case 'none':
if ($unparsed_sql != '') {
$formatted_sql = '<span class="inner_sql"><pre>' . "\n" . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n" . '</pre></span>';
$formatted_sql = '<span class="inner_sql"><pre>' . "\n"
. PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n"
. '</pre></span>';
} else {
$formatted_sql = PMA_SQP_formatNone($parsed_sql);
}
@ -399,14 +408,15 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju
break;
}
$open_link = '<a href="' . PMA_linkURL($url) . '" target="mysql_doc">';
if ($just_open) {
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc">';
return $open_link;
} elseif ($big_icon) {
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon ic_b_sqlhelp" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
return $open_link . '<img class="icon ic_b_sqlhelp" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
} elseif ($GLOBALS['cfg']['ReplaceHelpImg']) {
return '<a href="' . PMA_linkURL($url) . '" target="mysql_doc"><img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
return $open_link . '<img class="icon ic_b_help_s" src="themes/dot.gif" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
} else {
return '[<a href="' . PMA_linkURL($url) . '" target="mysql_doc">' . __('Documentation') . '</a>]';
return '[' . $open_link . __('Documentation') . '</a>]';
}
} // end of the 'PMA_showMySQLDocu()' function
@ -1287,8 +1297,22 @@ function PMA_profilingCheckbox($sql_query)
*/
function PMA_formatByteDown($value, $limes = 6, $comma = 0)
{
/* l10n: shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa+ */
$byteUnits = array(__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB'), __('EiB'));
$byteUnits = array(
/* l10n: shortcuts for Byte */
__('B'),
/* l10n: shortcuts for Kilobyte */
__('KiB'),
/* l10n: shortcuts for Megabyte */
__('MiB'),
/* l10n: shortcuts for Gigabyte */
__('GiB'),
/* l10n: shortcuts for Terabyte */
__('TiB'),
/* l10n: shortcuts for Petabyte */
__('PiB'),
/* l10n: shortcuts for Exabyte */
__('EiB')
);
$dh = PMA_pow(10, $comma);
$li = PMA_pow(10, $limes);
@ -1702,7 +1726,7 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
if (stristr($message, '<img') && (!$strip_img || $GLOBALS['cfg']['PropertiesIconic'] === true) && strip_tags($message)==$message) {
$displayed_message = '<span>' . htmlspecialchars(preg_replace('/^.*\salt="([^"]*)".*$/si', '\1', $message)) . '</span>';
}
// Suhosin: Check that each query parameter is not above maximum
$in_suhosin_limits = true;
if ($url_length <= $GLOBALS['cfg']['LinkLengthLimit']) {
@ -1732,12 +1756,12 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
if (empty($tag_params['class'])) {
$tag_params['class'] = 'link';
}
if (! isset($query_parts)) {
$query_parts = PMA_splitURLQuery($url);
}
$url_parts = parse_url($url);
if ($new_form) {
$ret = '<form action="' . $url_parts['path'] . '" class="link"'
. ' method="post"' . $target . ' style="display: inline;">';

View File

@ -419,12 +419,6 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
}
}
// generate hints
echo '<input id="col_order_hint" type="hidden" value="' . __('Drag to reorder') . '" />';
echo '<input id="sort_hint" type="hidden" value="' . __('Click to sort') . '" />';
echo '<input id="col_mark_hint" type="hidden" value="' . __('Click to mark/unmark') . '" />';
echo '<input id="col_visib_hint" type="hidden" value="' . __('Click the drop-down arrow<br />to toggle column\'s visibility') . '" />';
echo '<input id="show_all_col_text" type="hidden" value="' . __('Show all') . '" />';
?>
</td>