Refactored menuPrepare and menuResize into a jQuery plugin
Also integrated this plugin with both the main menu and the resizable menu on the table structure page
This commit is contained in:
parent
bf2b615246
commit
2e1bc1bd8d
@ -615,8 +615,7 @@ AJAX.cache = {
|
||||
// Remove duplicate wrapper
|
||||
// TODO: don't send it in the response
|
||||
.children().first().remove();
|
||||
menuPrepare($('#topmenu'));
|
||||
menuResize($('#topmenu'));
|
||||
$('#topmenu').menuResizer(PMA_mainMenuResizerCallback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
137
js/functions.js
137
js/functions.js
@ -2813,138 +2813,17 @@ AJAX.registerOnload('functions.js', function() {
|
||||
PMA_showHints();
|
||||
});
|
||||
|
||||
/**
|
||||
* This function handles the resizing of the content frame
|
||||
* and adjusts the top menu according to the new size of the frame
|
||||
*
|
||||
* @param object $container jquery object, menu container object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function menuResize($container)
|
||||
{
|
||||
if ($container.length == 0) {
|
||||
return;
|
||||
}
|
||||
var wmax = $container.innerWidth();
|
||||
wmax -= $('#pma_navigation').width();
|
||||
wmax -= $('#pma_navigation_resizer').width();
|
||||
wmax -= 5 ; // 5 px margin for jumping menu in Chrome
|
||||
var $submenu = $container.find('.submenu');
|
||||
var submenu_w = $submenu.outerWidth(true);
|
||||
var $submenu_ul = $submenu.find('ul');
|
||||
var $li = $container.find('> li');
|
||||
var $li2 = $submenu_ul.find('li');
|
||||
var more_shown = $li2.length > 0;
|
||||
|
||||
// Calculate the total width used by all the shown tabs
|
||||
var total_len = more_shown ? submenu_w : 0;
|
||||
var l = $li.length - 1;
|
||||
for (var i = 0; i < l; i++) {
|
||||
total_len += $($li[i]).outerWidth(true);
|
||||
}
|
||||
|
||||
// Now hide menu elements that don't fit into the menubar
|
||||
var hidden = false; // Whether we have hidden any tabs
|
||||
while (total_len >= wmax && --l >= 0) { // Process the tabs backwards
|
||||
hidden = true;
|
||||
var el = $($li[l]);
|
||||
var el_width = el.outerWidth(true);
|
||||
el.data('width', el_width);
|
||||
if (! more_shown) {
|
||||
total_len -= el_width;
|
||||
el.prependTo($submenu_ul);
|
||||
total_len += submenu_w;
|
||||
more_shown = true;
|
||||
} else {
|
||||
total_len -= el_width;
|
||||
el.prependTo($submenu_ul);
|
||||
}
|
||||
}
|
||||
|
||||
// If we didn't hide any tabs, then there might be some space to show some
|
||||
if (! hidden) {
|
||||
// Show menu elements that do fit into the menubar
|
||||
for (var i = 0, l = $li2.length; i < l; i++) {
|
||||
total_len += $($li2[i]).data('width');
|
||||
// item fits or (it is the last item
|
||||
// and it would fit if More got removed)
|
||||
if (total_len < wmax
|
||||
|| (i == $li2.length - 1 && total_len - submenu_w < wmax)
|
||||
) {
|
||||
$($li2[i]).insertBefore($submenu);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show/hide the "More" tab as needed
|
||||
if ($submenu_ul.find('li').length > 0) {
|
||||
$submenu.addClass('shown');
|
||||
} else {
|
||||
$submenu.removeClass('shown');
|
||||
}
|
||||
|
||||
if ($container.find('> li').length == 1) {
|
||||
// If there is only the "More" tab left, then we need
|
||||
// to align the submenu to the left edge of the tab
|
||||
$submenu_ul.removeClass().addClass('only');
|
||||
} else {
|
||||
// Otherwise we align the submenu to the right edge of the tab
|
||||
$submenu_ul.removeClass().addClass('notonly');
|
||||
}
|
||||
|
||||
if ($submenu.find('.tabactive').length) {
|
||||
$submenu.addClass('active').find('> a').removeClass('tab').addClass('tabactive');
|
||||
} else {
|
||||
$submenu.removeClass('active').find('> a').addClass('tab').removeClass('tabactive');
|
||||
}
|
||||
function PMA_mainMenuResizerCallback() {
|
||||
// 5 px margin for jumping menu in Chrome
|
||||
return $('body').width() - 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a horizontal menu for adapting to the screen width
|
||||
*
|
||||
* @param object $container jquery object, menu container object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function menuPrepare($container)
|
||||
{
|
||||
if ($container.length == 0) {
|
||||
return;
|
||||
}
|
||||
// create submenu container
|
||||
var link = $('<a />', {href: '#', 'class': 'tab'})
|
||||
.text(PMA_messages['strMore'])
|
||||
.bind('click', false); // same as event.preventDefault()
|
||||
var img = $container.find('li img');
|
||||
if (img.length) {
|
||||
$(PMA_getImage('b_more.png').toString()).prependTo(link);
|
||||
}
|
||||
var $submenu = $('<li />', {'class': 'submenu'})
|
||||
.append(link)
|
||||
.append($('<ul />'))
|
||||
.mouseenter(function() {
|
||||
if ($(this).find('ul .tabactive').length == 0) {
|
||||
$(this).addClass('submenuhover').find('> a').addClass('tabactive');
|
||||
}
|
||||
})
|
||||
.mouseleave(function() {
|
||||
if ($(this).find('ul .tabactive').length == 0) {
|
||||
$(this).removeClass('submenuhover').find('> a').removeClass('tabactive');
|
||||
}
|
||||
});
|
||||
$container.append($submenu);
|
||||
}
|
||||
|
||||
// This must be fired only once after the inital page load
|
||||
$(function() {
|
||||
menuPrepare($('#topmenu'));
|
||||
// populate submenu and register resize event
|
||||
menuResize($('#topmenu'));
|
||||
// Initialise the menu resize plugin
|
||||
$('#topmenu').menuResizer(PMA_mainMenuResizerCallback);
|
||||
// register resize event
|
||||
$(window).resize(function (){
|
||||
menuResize($('#topmenu'));
|
||||
$('#topmenu').menuResizer('resize');
|
||||
});
|
||||
});
|
||||
|
||||
@ -3651,7 +3530,7 @@ AJAX.registerOnload('functions.js', function() {
|
||||
'padding-top',
|
||||
$('#floating_menubar').outerHeight(true)
|
||||
);
|
||||
menuResize($('#topmenu'));
|
||||
$('#topmenu').menuResizer('resize');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
168
js/jquery/jquery.menuResizer-1.0.js
Normal file
168
js/jquery/jquery.menuResizer-1.0.js
Normal file
@ -0,0 +1,168 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Handles the resizing of a menu according to the available screen width
|
||||
*
|
||||
* Uses themes/original/css/resizable-menu.css.php
|
||||
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
(function ($) {
|
||||
function MenuResizer($container, widthCalculator) {
|
||||
var self = this;
|
||||
self.$container = $container;
|
||||
self.widthCalculator = widthCalculator;
|
||||
// create submenu container
|
||||
var link = $('<a />', {href: '#', 'class': 'tab nowrap'})
|
||||
.text(PMA_messages['strMore'])
|
||||
.bind('click', false); // same as event.preventDefault()
|
||||
var img = $container.find('li img');
|
||||
if (img.length) {
|
||||
$(PMA_getImage('b_more.png').toString()).prependTo(link);
|
||||
}
|
||||
var $submenu = $('<li />', {'class': 'submenu'})
|
||||
.append(link)
|
||||
.append($('<ul />'))
|
||||
.mouseenter(function() {
|
||||
if ($(this).find('ul .tabactive').length == 0) {
|
||||
$(this)
|
||||
.addClass('submenuhover')
|
||||
.find('> a')
|
||||
.addClass('tabactive');
|
||||
}
|
||||
})
|
||||
.mouseleave(function() {
|
||||
if ($(this).find('ul .tabactive').length == 0) {
|
||||
$(this)
|
||||
.removeClass('submenuhover')
|
||||
.find('> a')
|
||||
.removeClass('tabactive');
|
||||
}
|
||||
});
|
||||
$container.append($submenu);
|
||||
setTimeout(function () {
|
||||
self.resize();
|
||||
}, 4);
|
||||
}
|
||||
MenuResizer.prototype.resize = function () {
|
||||
var wmax = this.widthCalculator.call(this.$container);
|
||||
var $submenu = this.$container.find('.submenu:last');
|
||||
var submenu_w = $submenu.outerWidth(true);
|
||||
var $submenu_ul = $submenu.find('ul');
|
||||
var $li = this.$container.find('> li');
|
||||
var $li2 = $submenu_ul.find('li');
|
||||
var more_shown = $li2.length > 0;
|
||||
// Calculate the total width used by all the shown tabs
|
||||
var total_len = more_shown ? submenu_w : 0;
|
||||
var l = $li.length - 1;
|
||||
for (var i = 0; i < l; i++) {
|
||||
total_len += $($li[i]).outerWidth(true);
|
||||
}
|
||||
// Now hide menu elements that don't fit into the menubar
|
||||
var hidden = false; // Whether we have hidden any tabs
|
||||
while (total_len >= wmax && --l >= 0) { // Process the tabs backwards
|
||||
hidden = true;
|
||||
var el = $($li[l]);
|
||||
var el_width = el.outerWidth(true);
|
||||
el.data('width', el_width);
|
||||
if (! more_shown) {
|
||||
total_len -= el_width;
|
||||
el.prependTo($submenu_ul);
|
||||
total_len += submenu_w;
|
||||
more_shown = true;
|
||||
} else {
|
||||
total_len -= el_width;
|
||||
el.prependTo($submenu_ul);
|
||||
}
|
||||
}
|
||||
// If we didn't hide any tabs, then there might be some space to show some
|
||||
if (! hidden) {
|
||||
// Show menu elements that do fit into the menubar
|
||||
for (var i = 0, l = $li2.length; i < l; i++) {
|
||||
total_len += $($li2[i]).data('width');
|
||||
// item fits or (it is the last item
|
||||
// and it would fit if More got removed)
|
||||
if (total_len < wmax
|
||||
|| (i == $li2.length - 1 && total_len - submenu_w < wmax)
|
||||
) {
|
||||
$($li2[i]).insertBefore($submenu);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Show/hide the "More" tab as needed
|
||||
if ($submenu_ul.find('li').length > 0) {
|
||||
$submenu.addClass('shown');
|
||||
} else {
|
||||
$submenu.removeClass('shown');
|
||||
}
|
||||
if (this.$container.find('> li').length == 1) {
|
||||
// If there is only the "More" tab left, then we need
|
||||
// to align the submenu to the left edge of the tab
|
||||
$submenu_ul.removeClass().addClass('only');
|
||||
} else {
|
||||
// Otherwise we align the submenu to the right edge of the tab
|
||||
$submenu_ul.removeClass().addClass('notonly');
|
||||
}
|
||||
if ($submenu.find('.tabactive').length) {
|
||||
$submenu
|
||||
.addClass('active')
|
||||
.find('> a')
|
||||
.removeClass('tab')
|
||||
.addClass('tabactive');
|
||||
} else {
|
||||
$submenu
|
||||
.removeClass('active')
|
||||
.find('> a')
|
||||
.addClass('tab')
|
||||
.removeClass('tabactive');
|
||||
}
|
||||
};
|
||||
MenuResizer.prototype.destroy = function () {
|
||||
var $submenu = this.$container.find('li.submenu').removeData();
|
||||
$submenu.find('li').appendTo(this.$container);
|
||||
$submenu.remove();
|
||||
};
|
||||
|
||||
/** Public API */
|
||||
var methods = {
|
||||
init: function(widthCalculator) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
if (! $this.data('menuResizer')) {
|
||||
$this.data(
|
||||
'menuResizer',
|
||||
new MenuResizer($this, widthCalculator)
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
resize: function () {
|
||||
return this.each(function () {
|
||||
var self = $(this).data('menuResizer');
|
||||
if (self) {
|
||||
self.resize();
|
||||
}
|
||||
});
|
||||
},
|
||||
destroy: function () {
|
||||
return this.each(function () {
|
||||
var self = $(this).data('menuResizer');
|
||||
if (self) {
|
||||
self.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** Extend jQuery */
|
||||
$.fn.menuResizer = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].call(this);
|
||||
} else if (typeof method === 'function') {
|
||||
return methods.init.apply(this, [method]);
|
||||
} else {
|
||||
$.error('Method ' + method + ' does not exist on jQuery.menuResizer');
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
@ -528,6 +528,9 @@ var ResizeHandler = function () {
|
||||
this.left,
|
||||
(pos - $('#pma_navigation_scrollbar').width()) + 'px'
|
||||
);
|
||||
setTimeout(function (){
|
||||
$(window).trigger('resize');
|
||||
}, 4);
|
||||
};
|
||||
/**
|
||||
* Returns the horizontal position of the mouse,
|
||||
@ -598,7 +601,7 @@ var ResizeHandler = function () {
|
||||
event.data.resize_handler.active = false;
|
||||
$('body').css('cursor', '');
|
||||
$.cookie('pma_navi_width', event.data.resize_handler.getPos(event));
|
||||
menuResize($('#topmenu'));
|
||||
$('#topmenu').menuResizer('resize');
|
||||
}
|
||||
};
|
||||
/**
|
||||
@ -638,7 +641,7 @@ var ResizeHandler = function () {
|
||||
// If we have a cookie, set the width of the panel to its value
|
||||
var pos = Math.abs(parseInt($.cookie('pma_navi_width'), 10));
|
||||
this.setWidth(pos);
|
||||
menuResize($('#topmenu'));
|
||||
$('#topmenu').menuResizer('resize');
|
||||
}
|
||||
// Register the events for the resizer and the collapser
|
||||
$('#pma_navigation_resizer')
|
||||
|
||||
@ -252,6 +252,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
|
||||
buttons: button_options_error
|
||||
}); // end dialog options
|
||||
} else {
|
||||
$('#fieldsForm ul.table-structure-actions').menuResizer('destroy');
|
||||
// sort the fields table
|
||||
var $fields_table = $("table#tablestructure tbody");
|
||||
// remove all existing rows and remember them
|
||||
@ -277,6 +278,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
|
||||
}
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$this.dialog('close');
|
||||
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -337,12 +339,44 @@ function reloadFieldForm(message) {
|
||||
$("#addColumns").replaceWith($temp_div.find("#addColumns"));
|
||||
$('#move_columns_dialog ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
|
||||
$("#moveColumns").removeClass("move-active");
|
||||
/* Call the function to display the more options in table */
|
||||
$table_clone = false;
|
||||
$("div.replace_in_more").hide(); // fix "more" dropdown
|
||||
moreOptsMenuResize();
|
||||
/* reinitialise the more options in table */
|
||||
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
|
||||
setTimeout(function() {
|
||||
PMA_ajaxShowMessage(message);
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
function PMA_tbl_structure_menu_resizer_callback() {
|
||||
var pagewidth = $('body').width();
|
||||
var $page = $('#page_content');
|
||||
pagewidth -= $page.outerWidth(true) - $page.outerWidth();
|
||||
var columnsWidth = 0;
|
||||
var $columns = $('#tablestructure').find('tr:eq(1)').find('td,th');
|
||||
$columns.not(':last').each(function (){
|
||||
columnsWidth += $(this).outerWidth(true)
|
||||
})
|
||||
var totalCellSpacing = $('#tablestructure').width();
|
||||
$columns.each(function (){
|
||||
totalCellSpacing -= $(this).outerWidth(true);
|
||||
});
|
||||
return pagewidth - columnsWidth - totalCellSpacing - 15; // 15px extra margin
|
||||
};
|
||||
|
||||
/** Handler for "More" dropdown in structure table rows */
|
||||
AJAX.registerOnload('tbl_structure.js', function() {
|
||||
if ($('#fieldsForm').hasClass('HideStructureActions')) {
|
||||
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
|
||||
}
|
||||
});
|
||||
AJAX.registerTeardown('tbl_structure.js', function() {
|
||||
$('#fieldsForm ul.table-structure-actions').menuResizer('destroy');
|
||||
});
|
||||
$(function () {
|
||||
$(window).resize($.throttle(function () {
|
||||
var $list = $('#fieldsForm ul.table-structure-actions');
|
||||
if ($list.length) {
|
||||
$list.menuResizer('resize');
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
@ -154,6 +154,7 @@ class PMA_Header
|
||||
$this->_scripts->addFile('jquery/timepicker.js');
|
||||
$this->_scripts->addFile('jquery/jquery.ba-hashchange-1.3.js');
|
||||
$this->_scripts->addFile('jquery/jquery.debounce-1.0.5.js');
|
||||
$this->_scripts->addFile('jquery/jquery.menuResizer-1.0.js');
|
||||
|
||||
$this->_scripts->addFile('jquery/jquery.qtip-1.0.0-rc3.js');
|
||||
if ($GLOBALS['cfg']['CodemirrorEnable']) {
|
||||
|
||||
@ -107,7 +107,7 @@ class PMA_Menu
|
||||
} else {
|
||||
$tabs = $this->_getServerTabs();
|
||||
}
|
||||
return PMA_Util::getHtmlTabs($tabs, $url_params);
|
||||
return PMA_Util::getHtmlTabs($tabs, $url_params, 'topmenu', true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -76,7 +76,8 @@ class PMA_Theme
|
||||
'pmd',
|
||||
'rte',
|
||||
'codemirror',
|
||||
'jqplot'
|
||||
'jqplot',
|
||||
'resizable-menu'
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@ -1830,14 +1830,20 @@ class PMA_Util
|
||||
* @param array $tabs one element per tab
|
||||
* @param string $url_params additional URL parameters
|
||||
* @param string $menu_id HTML id attribute for the menu container
|
||||
* @param bool $resizable whether to add a "resizable" class
|
||||
*
|
||||
* @return string html-code for tab-navigation
|
||||
*/
|
||||
public static function getHtmlTabs($tabs, $url_params, $menu_id = 'topmenu')
|
||||
public static function getHtmlTabs($tabs, $url_params, $menu_id, $resizable = false)
|
||||
{
|
||||
$class = '';
|
||||
if ($resizable) {
|
||||
$class = ' class="resizable-menu"';
|
||||
}
|
||||
|
||||
$tab_navigation = '<div id="' . htmlentities($menu_id)
|
||||
. 'container" class="menucontainer">'
|
||||
.'<ul id="' . htmlentities($menu_id) . '">';
|
||||
.'<ul id="' . htmlentities($menu_id) . '" ' . $class . '>';
|
||||
|
||||
foreach ($tabs as $tab) {
|
||||
$tab_navigation .= self::getHtmlTab($tab, $url_params);
|
||||
|
||||
@ -1831,17 +1831,16 @@ function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine,
|
||||
$class, $hasField, $hasLinkClass, $url_query, $primary, $syntax,
|
||||
$message, $action, $titles, $row, $isPrimary
|
||||
) {
|
||||
$html_output = '<td class="'. $class .'">';
|
||||
$html_output = '<li class="'. $class .'">';
|
||||
|
||||
if ($type == 'text'
|
||||
|| $type == 'blob'
|
||||
|| 'ARCHIVE' == $tbl_storage_engine
|
||||
|| $hasField
|
||||
) {
|
||||
$html_output .= $titles['No' . $action] . "\n";
|
||||
$html_output .= $titles['No' . $action];
|
||||
$action_enabled = false;
|
||||
} else {
|
||||
$html_output .= "\n";
|
||||
$html_output .= '<a '
|
||||
. ($hasLinkClass ? 'class="add_primary_key_anchor" ' : '')
|
||||
. 'href="sql.php?' . $url_query . '&sql_query='
|
||||
@ -1860,8 +1859,7 @@ function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine,
|
||||
. $titles[$action] . '</a>';
|
||||
$action_enabled = true;
|
||||
}
|
||||
$html_output .= "\n";
|
||||
$html_output .= '</td>';
|
||||
$html_output .= '</li>';
|
||||
|
||||
return array($html_output, $action_enabled);
|
||||
}
|
||||
@ -1881,7 +1879,7 @@ function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine,
|
||||
function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
|
||||
$row, $titles
|
||||
) {
|
||||
$html_output = '<td class="fulltext replaced_by_more center nowrap">';
|
||||
$html_output = '<li class="fulltext nowrap">';
|
||||
if (! empty($tbl_storage_engine)
|
||||
&& ($tbl_storage_engine == 'MYISAM'
|
||||
|| $tbl_storage_engine == 'ARIA'
|
||||
@ -1889,7 +1887,6 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
|
||||
|| ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604))
|
||||
&& (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))
|
||||
) {
|
||||
$html_output .= "\n";
|
||||
$html_output .= '<a href="sql.php?' . $url_query . '&sql_query='
|
||||
. urlencode(
|
||||
'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table'])
|
||||
@ -1906,14 +1903,11 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
|
||||
. '">';
|
||||
$html_output .= $titles['IdxFulltext'] . '</a>';
|
||||
$fulltext_enabled = true;
|
||||
$html_output .= '</td>';
|
||||
} else {
|
||||
$html_output .= "\n";
|
||||
$html_output .= $titles['NoIdxFulltext'] . "\n";
|
||||
$html_output .= $titles['NoIdxFulltext'];
|
||||
$fulltext_enabled = false;
|
||||
$html_output .= '</td>';
|
||||
}
|
||||
|
||||
$html_output .= '</li>';
|
||||
return array($html_output, $fulltext_enabled);
|
||||
}
|
||||
|
||||
@ -1928,7 +1922,7 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
|
||||
*/
|
||||
function PMA_getHtmlForDistinctValueAction($url_query, $row, $titles)
|
||||
{
|
||||
$html_output = '<td class="browse replaced_by_more center">';
|
||||
$html_output = '<li class="browse nowrap">';
|
||||
$html_output .= '<a href="sql.php?' . $url_query . '&sql_query='
|
||||
. urlencode(
|
||||
'SELECT COUNT(*) AS ' . PMA_Util::backquote(__('Rows'))
|
||||
@ -1940,7 +1934,7 @@ function PMA_getHtmlForDistinctValueAction($url_query, $row, $titles)
|
||||
. '">'
|
||||
. $titles['DistinctValues']
|
||||
. '</a>';
|
||||
$html_output .= '</td>';
|
||||
$html_output .= '</li>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
@ -1965,11 +1959,11 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
$primary, $field_name, $url_query, $titles, $row, $rownum, $hidden_titles,
|
||||
$columns_with_unique_index
|
||||
) {
|
||||
$html_output = '';
|
||||
$html_output = '<td><ul class="table-structure-actions resizable-menu">';
|
||||
list($primary, $primary_enabled)
|
||||
= PMA_getHtmlForActionRowInStructureTable(
|
||||
$type, $tbl_storage_engine,
|
||||
'primary replaced_by_more center',
|
||||
'primary nowrap',
|
||||
($primary && $primary->hasColumn($field_name)),
|
||||
true, $url_query, $primary,
|
||||
'ADD PRIMARY KEY',
|
||||
@ -1980,7 +1974,7 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
list($unique, $unique_enabled)
|
||||
= PMA_getHtmlForActionRowInStructureTable(
|
||||
$type, $tbl_storage_engine,
|
||||
'unique replaced_by_more center',
|
||||
'unique nowrap',
|
||||
isset($columns_with_unique_index[$field_name]),
|
||||
false, $url_query, $primary, 'ADD UNIQUE',
|
||||
__('An index has been added on %s'),
|
||||
@ -1990,7 +1984,7 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
list($index, $index_enabled)
|
||||
= PMA_getHtmlForActionRowInStructureTable(
|
||||
$type, $tbl_storage_engine,
|
||||
'index replaced_by_more center', false, false, $url_query,
|
||||
'index nowrap', false, false, $url_query,
|
||||
$primary, 'ADD INDEX', __('An index has been added on %s'),
|
||||
'Index', $titles, $row, false
|
||||
);
|
||||
@ -2003,7 +1997,7 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
list($spatial, $spatial_enabled)
|
||||
= PMA_getHtmlForActionRowInStructureTable(
|
||||
$type, $tbl_storage_engine,
|
||||
'spatial replaced_by_more center',
|
||||
'spatial nowrap',
|
||||
(! in_array($type, $spatial_types)
|
||||
|| 'MYISAM' != $tbl_storage_engine
|
||||
),
|
||||
@ -2020,7 +2014,7 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
$html_output .= $fulltext;
|
||||
}
|
||||
$html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles);
|
||||
|
||||
$html_output .= '</ul></td>';
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ if ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full') {
|
||||
echo '<div id="querywindowcontainer">';
|
||||
|
||||
if ($tabs) {
|
||||
echo PMA_Util::getHtmlTabs($tabs, array());
|
||||
echo PMA_Util::getHtmlTabs($tabs, array(), 'topmenu');
|
||||
unset($tabs);
|
||||
}
|
||||
|
||||
|
||||
@ -159,9 +159,16 @@ $hidden_titles = PMA_getHiddenTitlesArray();
|
||||
/* TABLE INFORMATION */
|
||||
// table header
|
||||
|
||||
|
||||
$HideStructureActions .= '';
|
||||
if ($GLOBALS['cfg']['PropertiesIconic'] !== true
|
||||
&& $GLOBALS['cfg']['HideStructureActions'] === true
|
||||
) {
|
||||
$HideStructureActions .= ' HideStructureActions';
|
||||
}
|
||||
|
||||
$html_form = '<form method="post" action="tbl_structure.php" name="fieldsForm" '
|
||||
. 'id="fieldsForm" '
|
||||
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '') . '>';
|
||||
. 'id="fieldsForm" class="ajax' . $HideStructureActions . '">';
|
||||
|
||||
$response->addHTML($html_form);
|
||||
$response->addHTML(PMA_generate_common_hidden_inputs($db, $table));
|
||||
|
||||
@ -143,7 +143,7 @@ $tabs['import']['link'] = 'server_import.php';
|
||||
$tabs['import']['text'] = 'active';
|
||||
$tabs['import']['class'] = 'active';
|
||||
|
||||
echo PMA_Util::getHtmlTabs($tabs, array());
|
||||
echo PMA_Util::getHtmlTabs($tabs, array(), 'topmenu');
|
||||
unset($tabs);
|
||||
|
||||
if (@file_exists($pmaThemeImage . 'logo_right.png')) {
|
||||
|
||||
@ -283,8 +283,7 @@ table tr.marked {
|
||||
/* hovered items */
|
||||
.odd:hover,
|
||||
.even:hover,
|
||||
.hover,
|
||||
.structure_actions_dropdown {
|
||||
.hover {
|
||||
background: <?php echo $GLOBALS['cfg']['BrowsePointerBackground']; ?>;
|
||||
color: <?php echo $GLOBALS['cfg']['BrowsePointerColor']; ?>;
|
||||
}
|
||||
@ -716,45 +715,6 @@ ul#topmenu a, ul#topmenu span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
ul#topmenu ul a {
|
||||
margin: 0;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
ul#topmenu .submenu {
|
||||
position: relative;
|
||||
display: none;
|
||||
}
|
||||
ul#topmenu .shown {
|
||||
display: block;
|
||||
}
|
||||
|
||||
ul#topmenu ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
display: none;
|
||||
border: 1px #666 solid;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
ul#topmenu ul.only {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
ul#topmenu ul.notonly {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
ul#topmenu li:hover ul, ul#topmenu .submenuhover ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
ul#topmenu ul li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ul#topmenu2 a {
|
||||
display: block;
|
||||
margin: 0.1em;
|
||||
@ -1738,20 +1698,18 @@ input#input_import_file {
|
||||
/**
|
||||
* Table structure styles
|
||||
*/
|
||||
.structure_actions_dropdown {
|
||||
position: absolute;
|
||||
padding: 3px;
|
||||
display: none;
|
||||
z-index: 100;
|
||||
#fieldsForm ul.table-structure-actions {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.structure_actions_dropdown a {
|
||||
display: block;
|
||||
#fieldsForm ul.table-structure-actions li {
|
||||
float: <?php echo $left; ?>;
|
||||
margin-<?php echo $right; ?>: 0.5em; /* same as padding of "table td" */
|
||||
}
|
||||
|
||||
td.more_opts {
|
||||
display: none;
|
||||
white-space: nowrap;
|
||||
#fieldsForm ul.table-structure-actions .submenu li {
|
||||
padding: 0.3em;
|
||||
margin: 0.1em;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -488,8 +488,7 @@ table tr.marked {
|
||||
/* hovered items */
|
||||
.odd:hover,
|
||||
.even:hover,
|
||||
.hover,
|
||||
.structure_actions_dropdown {
|
||||
.hover {
|
||||
<?php echo $_SESSION['PMA_Theme']->getCssGradient('ced6df', 'b6c6d7'); ?>
|
||||
color: <?php echo $GLOBALS['cfg']['BrowsePointerColor']; ?>;
|
||||
}
|
||||
@ -941,61 +940,6 @@ ul#topmenu2 li {
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
ul#topmenu a,
|
||||
ul#topmenu span {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
ul#topmenu ul a {
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
|
||||
ul#topmenu .submenu {
|
||||
display: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
ul#topmenu .shown {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
ul#topmenu ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
display: none;
|
||||
border: 1px #ddd solid;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
ul#topmenu ul.only {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
ul#topmenu ul.notonly {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
ul#topmenu li:hover {
|
||||
<?php echo $_SESSION['PMA_Theme']->getCssGradient('ffffff', 'e5e5e5'); ?>
|
||||
}
|
||||
|
||||
ul#topmenu li:hover ul,
|
||||
ul#topmenu .submenuhover ul {
|
||||
display: block;
|
||||
font-weight: 3em;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
ul#topmenu ul li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ul#topmenu2 a {
|
||||
display: block;
|
||||
margin: 7px 6px 7px 0;
|
||||
@ -1033,6 +977,10 @@ ul#topmenu ul {
|
||||
box-shadow: 2px 2px 3px #666;
|
||||
}
|
||||
|
||||
ul#topmenu ul.only {
|
||||
<?php echo $left; ?>: 0;
|
||||
}
|
||||
|
||||
ul#topmenu > li {
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #ccc;
|
||||
@ -2162,27 +2110,23 @@ input#input_import_file {
|
||||
/**
|
||||
* Table structure styles
|
||||
*/
|
||||
.structure_actions_dropdown {
|
||||
position: absolute;
|
||||
padding: 3px;
|
||||
display: none;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
line-height: 24px;
|
||||
border: 1px solid #aaa;
|
||||
-moz-box-shadow: 0 3px 3px #ddd;
|
||||
#fieldsForm ul.table-structure-actions {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.structure_actions_dropdown span {
|
||||
display: block;
|
||||
#fieldsForm ul.table-structure-actions li {
|
||||
float: <?php echo $left; ?>;
|
||||
margin-<?php echo $right; ?>: 0.3em; /* same as padding of "table td" */
|
||||
}
|
||||
.structure_actions_dropdown span:hover {
|
||||
background: #ddd;
|
||||
#fieldsForm ul.table-structure-actions .submenu li {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
td.more_opts {
|
||||
white-space: nowrap;
|
||||
#fieldsForm ul.table-structure-actions .submenu li span {
|
||||
padding: 0.3em;
|
||||
margin: 0.1em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexes
|
||||
*/
|
||||
|
||||
57
themes/pmahomme/css/resizable-menu.css.php
Normal file
57
themes/pmahomme/css/resizable-menu.css.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Styles for the resizable menus
|
||||
*
|
||||
* used by js/jquery/jquery.menuResizer-1.0.js
|
||||
*
|
||||
* @package PhpMyAdmin-theme
|
||||
* @subpackage PMAHomme
|
||||
*/
|
||||
|
||||
// unplanned execution path
|
||||
if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
ul.resizable-menu a,
|
||||
ul.resizable-menu span {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
ul.resizable-menu .submenu {
|
||||
display: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
ul.resizable-menu .shown {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
ul.resizable-menu ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
display: none;
|
||||
border: 1px #ddd solid;
|
||||
z-index: 2;
|
||||
<?php echo $right; ?>: 0;
|
||||
}
|
||||
|
||||
ul.resizable-menu li:hover {
|
||||
<?php echo $_SESSION['PMA_Theme']->getCssGradient('ffffff', 'e5e5e5'); ?>
|
||||
}
|
||||
|
||||
ul.resizable-menu li:hover ul,
|
||||
ul.resizable-menu .submenuhover ul {
|
||||
display: block;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
ul.resizable-menu ul li {
|
||||
width: 100%;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user