From 134b41faf6d17e4c8d9e1eb6b501be2614323b87 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 25 Jun 2008 17:01:31 +0000 Subject: [PATCH] make footnote tooltips work again; ensure ids are unique --- js/tooltip.js | 2 +- libraries/common.lib.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/tooltip.js b/js/tooltip.js index 3befa16d6..c6661f21a 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -158,7 +158,7 @@ function moveTooltip(posX, posY) */ function pmaTooltip(e) { - var theText = document.getElementById(this.getAttribute('name')).innerHTML; + var theText = document.getElementById('footnote_' + this.innerHTML).innerHTML; var plusX = 0, plusY = 0, docX = 0, docY = 0; var divHeight = myTooltipContainer.clientHeight; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index e54e61020..ac5384404 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -440,13 +440,18 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice') if (! isset($GLOBALS['footnotes'][$key])) { $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, + '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) { @@ -454,7 +459,7 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice') } // footnotemarker used in js/tooltip.js - return '' . $nr . ''; + return '' . $nr . ''; } /**