Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tyron Madlener 2011-08-08 16:58:35 +03:00
commit d257c39339
5 changed files with 70 additions and 71 deletions

View File

@ -3148,10 +3148,8 @@ $(document).ready(function() {
/**
* Theme changer.
*/
$('.take_theme').live('click', function(e) {
alert(e.target.nodeName);
var evt = $(e);
var what = evt.target.id;
$('.take_theme').click(function(e) {
var what = this.name;
if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
window.opener.document.forms['setTheme'].submit();

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

@ -282,6 +282,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

@ -324,7 +324,7 @@ class PMA_Theme
.' (' . htmlspecialchars($this->getVersion()) . ')</h2>';
echo '<p>';
echo '<a target="_top" class="take_theme" '
.'id="' . htmlspecialchars($this->getId()) . '" '
.'name="' . htmlspecialchars($this->getId()) . '" '
. 'href="index.php'.PMA_generate_common_url(array(
'set_theme' => $this->getId()
)) . '">';

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>