Tooltip problem - Encoded html content

Tooltip problem - Encoded html content

by Cristian Cordeiro -
Number of replies: 2
Hello everyone,

I am running some tests on gradebook/workshop and I found something that seems to be a bug on gradebook, although I tried to find any existent known bug regarding this problem and I couldn't find anything, so I wanted to know if there is somebody on the case or if there is anyway that I can help.

Luckily I can demonstrate the problem on the Moodle Test Site, that makes it easier.
If you go to http://test.moodle.net/workshop/grade/report/grader/index.php?id=2 and mouse over one of the activities cell, it is gonna display some html code in the cell, but as text, not as html... sad I'm attaching an image so you can see what it looks like...

Have somebody noticed that too? So far it only happens when you go to the 'grader report'.

Thanks!

Cristian @ Athabasca University


Attachment Screenshot-Grades_View_-_Mozilla_Firefox.jpg
In reply to Cristian Cordeiro

Re: Tooltip problem - Encoded html content

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Cristian,

Thanks for reporting this problem. I had a quick look in the Moodle Tracker and came across MDL-19900 which looks approximately the same problem. You may wish to watch / comment / vote for the issue to be fixed (you'll need to create a tracker account and be logged in to do so).
In reply to Helen Foster

Re: Tooltip problem - Encoded html content

by Cristian Cordeiro -
Thanks Helen!

Well, just before we have a decent fix on that bug, as I am still testing it and it will take a while until we move on to moodle 2.0, so I've made a little bit of a hack that get rid of that problem for the time being.

It is far from being the best solution, but it got rid of the displaying problem, it is all right for a TEMPORARY solution, but perhaps I would spend a little bit longer on it for a more elegant solution if I had that time. So this is what I've done:

File:
/var/www/moodle/grade/report/grader/lib.php
Row 850
From --> $itemcell->title = html_entity_decode(s($gradetitle));
To --> $itemcell->title = s($gradetitle);

File:
/var/www/moodle/grade/report/grader/grader.js
Row 84:
Add this command --> tempNode.style.display = 'none'; to row 84.

It is gonna look like this:

if (makeTooltip) {

tempNode = document.createElement("div");
tempNode.className = "tooltipDiv";
tempNode.innerHTML = elTarget.title;
tempNode.style.display = 'none'; //that's the added row
elTarget.appendChild(tempNode);
elTarget.title = null;
}


I hope it helps! smile

Cristian @ Athabasca University

Attachment hacked.jpg