]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18963 Applied Matt's patch. Merged from MOODLE_19_STABLE
authornicolasconnault <nicolasconnault>
Wed, 29 Apr 2009 09:26:37 +0000 (09:26 +0000)
committernicolasconnault <nicolasconnault>
Wed, 29 Apr 2009 09:26:37 +0000 (09:26 +0000)
grade/report/grader/index.php

index 019239b59eff9e4a9e5753cf13b5d6f014a36a81..87c0a88fa10fb3bf1363cbfa8c008e637b007da8 100644 (file)
@@ -255,8 +255,20 @@ YAHOO.graderreport.mouseoverHandler = function (e) {
     if (elTarget.className.search('grade cell') > -1) {
 
         // each time we go over a new cell, we need to put it's tooltip into a div to stop it from
-        // popping up on top of the panel. Still looking for a way to set the header differently
-        if (elTarget.childNodes.length == 1) {
+        // popping up on top of the panel.
+
+        // don't do anything if we have already made the tooltip div
+        var makeTooltip = true
+        for (var k=0; k < elTarget.childNodes.length; k++) {
+            if (typeof(elTarget.childNodes[k].className) != 'undefined') {
+                if (elTarget.childNodes[k].className.search('tooltipDiv') > -1) {
+                    makeTooltip =  false;
+                }
+            }
+        }
+
+        // if need to, make the tooltip div and append it to the cell
+        if (makeTooltip) {
 
             tempNode = document.createElement("div");
             tempNode.className = "tooltipDiv";
@@ -265,8 +277,17 @@ YAHOO.graderreport.mouseoverHandler = function (e) {
             elTarget.title = null;
         }
 
-        tooltipNode = elTarget.childNodes[1];
-
+        // Get the tooltip div
+        elChildren = elTarget.childNodes;
+        for (var m=0; m < elChildren.length; m++) {
+            if (typeof(elChildren[m].className) != 'undefined') {
+                if (elChildren[m].className.search('tooltipDiv') > -1) {
+                    tooltipNode = elChildren[m];
+                    break;
+                }
+            }
+        }
+        //build and show the tooltip
         YAHOO.graderreport.panelEl.setBody(tooltipNode.innerHTML);
         YAHOO.graderreport.panelEl.render(elTarget);
         YAHOO.graderreport.panelEl.show()
@@ -277,8 +298,8 @@ YAHOO.graderreport.mouseoverHandler = function (e) {
 YAHOO.graderreport.mouseoutHandler = function (e) {
 
     var classVar = '';
+    var searchString = '';
     var newTargetClass = '';
-    var elTarget = YAHOO.util.Event.getTarget(e);
     var newTarget = YAHOO.util.Event.getRelatedTarget(e);
 
     // deals with an error if the mouseout event is over the lower scrollbar
@@ -291,17 +312,17 @@ YAHOO.graderreport.mouseoutHandler = function (e) {
 
     // if we are over any part of the panel, do not hide
     // do this by walking up the DOM till we reach table level, looking for panel tag
-    while ((typeof(newTarget.id)) == 'undefined' || (newTarget.id != 'user-grades')) {
+    while ((typeof(newTarget.id) == 'undefined') || (newTarget.id != 'user-grades')) {
 
         try {
             newTargetClass = newTarget.className;
         } catch (err) {
-            // we've gone over the scrollbar
+            // we've gone over the scrollbar again
             YAHOO.graderreport.panelEl.hide()
             return false;
         }
-
-        if (newTargetClass.search('yui-panel') > -1) {
+        searchString = /yui-panel|grade cell/;
+        if (newTargetClass.search(searchString) > -1) {
             // we're in the panel so don't hide it
             return false;
         }