Merge commit '788fb45a1d6c70d52e8b627023bf01de34a22a4d'

This commit is contained in:
Marc Delisle 2011-07-21 09:18:44 -04:00
commit 33627e9533
3 changed files with 50 additions and 22 deletions

View File

@ -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 = $('<div id="insert_table_dialog"></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()

View File

@ -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 },

View File

@ -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 '<sup class="footnotemarker">' . $nr . '</sup>' .
'<img class="footnotemarker" id="footnote_' . $nr . '_' . $instance . '" src="' .
'<img class="footnotemarker footnote_' . $nr . '" src="' .
$GLOBALS['pmaThemeImage'] . 'b_help.png" alt="" />';
}