diff --git a/js/db_structure.js b/js/db_structure.js index b1c2ff05a7..1f2d0e6395 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -63,9 +63,12 @@ $(document).ready(function() { currrent_insert_table = $(this); var $url = $(this).attr("href"); if ($url.substring(0, 15) == "tbl_change.php?") { - $url = $url.substring(15); + $url = $url.substring(15); } + if ($("#insert_table_dialog").length > 0) { + $("#insert_table_dialog").remove(); + } var $div = $('
'); var target = "tbl_change.php"; @@ -110,10 +113,12 @@ $(document).ready(function() { $dialog.find("#topmenucontainer").hide(); //Adding the datetime pikers for the dialog $dialog.find('.datefield, .datetimefield').each(function () { - PMA_addDatepicker($(this)); + PMA_addDatepicker($(this)); }); $(".insertRowTable").addClass("ajax"); $("#buttonYes").addClass("ajax"); + $div = $("#insert_table_dialog"); + PMA_convertFootnotesToTooltips($div); } PMA_ajaxRemoveMessage($msgbox); }) // end $.get() diff --git a/js/functions.js b/js/functions.js index 7f0c90f960..5dac084945 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2242,7 +2242,9 @@ function displayMoreTableOpts() { } } -$(document).ready(initTooltips); +$(document).ready(function(){ + PMA_convertFootnotesToTooltips(); +}); /** * Ensures indexes names are valid according to their type and, for a primary @@ -2278,27 +2280,53 @@ function checkIndexName(form_id) return true; } // end of the 'checkIndexName()' function - -/* Displays tooltips */ -function initTooltips() { +/** + * function to convert the footnotes to tooltips + * + * @param jquery-Object $div a div jquery object which crries the domain + * for searching footnootes. If we ommit this + * parameter the function searches the footnotes + * in the whole body + **/ +function PMA_convertFootnotesToTooltips($div) { // Hide the footnotes from the footer (which are displayed for // JavaScript-disabled browsers) since the tooltip is sufficient - $(".footnotes").hide(); - $(".footnotes span").each(function() { + + if ($div == undefined || ! $div instanceof jQuery || $div.length == 0) { + $div = $("#serverinfo").parent(); + } + + $footnotes = $div.find(".footnotes"); + + $footnotes.hide(); + $footnotes.find('span').each(function() { $(this).children("sup").remove(); }); // The border and padding must be removed otherwise a thin yellow box remains visible - $(".footnotes").css("border", "none"); - $(".footnotes").css("padding", "0px"); + $footnotes.css("border", "none"); + $footnotes.css("padding", "0px"); // Replace the superscripts with the help icon - $("sup[class='footnotemarker']").hide(); - $("img[class='footnotemarker']").show(); + $div.find("sup.footnotemarker").hide(); + $div.find("img.footnotemarker").show(); - $("img[class='footnotemarker']").each(function() { - var span_id = $(this).attr("id"); - span_id = span_id.split("_")[1]; - var tooltip_text = $(".footnotes span[id='footnote_" + span_id + "']").html(); + $div.find("img.footnotemarker").each(function() { + var img_class = $(this).attr("class"); + /** img contains two classes, as example "footnotemarker footnote_1_1". + * We spit it by second classs and take it for the id of span + */ + img_class = img_class.split(" "); + for (i = 0; i < img_class.length; i++) { + if (img_class[i].split("_")[0] == "footnote") { + var span_id = img_class[i].split("_")[1]; + } + } + /** + * Now we get the #id of the span with span_id variable. As an example if we + * initially get the img class as "footnotemarker footnote_2_3", now we get + * #2 as the span_id. Using that we can find footnote_2 in footnotes. + * */ + var tooltip_text = $footnotes.find("span[id='footnote_" + span_id + "']").html(); $(this).qtip({ content: tooltip_text, show: { delay: 0 }, diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 9e27e6c8a5..cb85c100f7 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -459,18 +459,13 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice') $GLOBALS['footnotes'] = array(); } $nr = count($GLOBALS['footnotes']) + 1; - // this is the first instance of this message - $instance = 1; $GLOBALS['footnotes'][$key] = array( 'note' => $message, 'type' => $type, 'nr' => $nr, - 'instance' => $instance ); } else { $nr = $GLOBALS['footnotes'][$key]['nr']; - // another instance of this message (to ensure ids are unique) - $instance = ++$GLOBALS['footnotes'][$key]['instance']; } if ($bbcode) { @@ -479,7 +474,7 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice') // footnotemarker used in js/tooltip.js return '' . $nr . '' . - ''; }