diff --git a/js/tbl_structure.js b/js/tbl_structure.js index c2273a8169..ff3b5981c0 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -28,7 +28,6 @@ AJAX.registerTeardown('tbl_structure.js', function() { $("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").die('click'); $('#index_frm input[type=submit]').die('click'); $("#move_columns_anchor").die('click'); - $("#addColumns.ajax input[type=submit]").die('click'); }); AJAX.registerOnload('tbl_structure.js', function() { @@ -347,142 +346,3 @@ function reloadFieldForm(message) { }, 500); }); } - -/** - * Hides certain table structure actions, replacing them - * with the word "More". They are displayed in a dropdown - * menu when the user hovers over the word "More." - */ -function moreOptsMenuResize() { - var $table = $("#tablestructure"); - - // don't use More menu if we're only showing icons and no text - if ($table.length == 0 || $table.hasClass("PropertiesIconic")) { - return; - } - - // reset table to defaults - if ($table_clone === false) { - $table_clone = $table.clone(); - } - else { - $table.replaceWith($table_clone); - $table = $table_clone; - $table_clone = $table.clone(); - } - - $table.find("td.more_opts").hide(); - - var getCurWidth = function() { - var cur_width = 0; - $table.find("tr").eq(1) - .find("td.edit, td.drop, .replaced_by_more:visible, .more_opts:visible") - .each(function () { - cur_width += $(this).outerWidth(); - }); - return cur_width; - }; - - // get window width - var window_width = $(window).width() - - $('#pma_navigation').width() - - $('#pma_navigation_resizer').width(); - - // find out maximum action links width - var max_width = window_width; - $table.find("tr").eq(0).children().each(function () { - if ($(this).index() < 9) { - max_width -= $(this).outerWidth() + 1; - } - }); - - // current action links width - var cur_width = getCurWidth(); - - // remove some links if current width is wider than maximum allowed - if (cur_width > max_width && $table.find("td.more_opts").length != 0) { - while (cur_width > max_width - && $(".replaced_by_more:visible").length > 0) { - - // hide last visible element - var css_class = $table.find("tr").eq(1) - .find(".replaced_by_more:visible").last().prop("className").split(" "); - $table.find("." + css_class.join(".")).hide(); - // show corresponding more-menu entry - $table.find(".replace_in_more.action_" + css_class[0]).show(); - $table.find("td.more_opts").show(); - // recalculate width - cur_width = getCurWidth(); - } - } - - if ($(".replaced_by_more:hidden").length == 0) { - $table.find("td.more_opts").hide(); - } - - // wait for topmenu resize handler - setTimeout(function () { - // Position the dropdown - $(".structure_actions_dropdown").each(function() { - // Optimize DOM querying - var $this_dropdown = $(this); - // The top offset must be set for IE even if it didn't change - var cell_right_edge_offset = $this_dropdown.parent().position().left + $this_dropdown.parent().innerWidth(); - var left_offset = cell_right_edge_offset - $this_dropdown.innerWidth(); - var top_offset = $this_dropdown.parent().position().top + $this_dropdown.parent().innerHeight(); - $this_dropdown.css({ top: top_offset, left: left_offset }); - }); - }, 100); - - // A hack for IE6 to prevent the after_field select element from being displayed on top of the dropdown by - // positioning an iframe directly on top of it - var $after_field = $("select[name='after_field']"); - // This dropdown is only present for a table, not for a view - if ($after_field.length) { - $("iframe[class='IE_hack']") - .width($after_field.width()) - .height($after_field.height()) - .offset({ - top: $after_field.offset().top, - left: $after_field.offset().left - }); - } - - // When "more" is hovered over, show the hidden actions - $table.find("td.more_opts") - .unbind("mouseenter") - .bind("mouseenter", function() { - if($.browser.msie && $.browser.version == "6.0") { - $("iframe[class='IE_hack']") - .show() - .width($after_field.width()+4) - .height($after_field.height()+4) - .offset({ - top: $after_field.offset().top, - left: $after_field.offset().left - }); - } - $(".structure_actions_dropdown").hide(); // Hide all the other ones that may be open - $(this).children(".structure_actions_dropdown").show(); - // Need to do this again for IE otherwise the offset is wrong - if($.browser.msie) { - var left_offset_IE = $(this).offset().left + $(this).innerWidth() - $(this).children(".structure_actions_dropdown").innerWidth(); - var top_offset_IE = $(this).offset().top + $(this).innerHeight(); - $(this).children(".structure_actions_dropdown").offset({ - top: top_offset_IE, - left: left_offset_IE }); - } - }) - .unbind("mouseleave") - .bind("mouseleave", function() { - $(this).children(".structure_actions_dropdown").hide(); - if($.browser.msie && $.browser.version == "6.0") { - $("iframe[class='IE_hack']").hide(); - } - }); -} -AJAX.registerOnload('tbl_structure.js', function () { - $(window).resize(moreOptsMenuResize); // FIXME: shouldn't register that can't be unbound easily - $("div.replace_in_more").hide(); - moreOptsMenuResize(); -}); diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index a87322bf46..f0a6b85052 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -1806,135 +1806,6 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation, return $html_output; } -/** - * Get HTML divs for Structure Action drop down - * - * @param string $class link class - * @param boolean $isActionEnabled whether action is enabled or not - * @param string $url_query url query - * @param array $row current row - * @param array $hidden_titles hidden titles if action enabled - * @param array $hidden_titles_no hidden titles if action not enabled - * @param boolean $primary primary or not - * @param string $syntax syntax for add action - * @param string $message message to be shown - * @param boolean $isPrimary is primary action - * - * @return string $html_output - */ -function PMA_getHtmlDivsForStructureActionsDropdown($class, $isActionEnabled, - $url_query, $row, $hidden_titles, $hidden_titles_no, $primary, $syntax, - $message, $isPrimary -) { - $html_output = '