Skip to content
Permalink
Browse files

MDL-10201 Wrapping label text in a span instead of div, and giving it…

… a class so that it can be found by hide/show AJAX code. Backported from MOODLE_19_STABLE
  • Loading branch information...
nicolasconnault
nicolasconnault committed May 7, 2009
1 parent 7e63699 commit 8cc0d4ef9316bc29001179132b94f299933016b9
Showing with 23 additions and 6 deletions.
  1. +6 −5 course/lib.php
  2. +17 −1 lib/ajax/section_classes.js
@@ -1395,14 +1395,15 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
if ($mod->modname == "label") {
echo "<span class=\"";
if (!$mod->visible) {
echo "<span class=\"dimmed_text\">";
echo 'dimmed_text';
} else {
echo 'label';
}
echo '">';
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
if (!$mod->visible) {
echo "</span>";
}
echo "</span>";
} else { // Normal activity
//Accessibility: for files get description via icon.
@@ -524,7 +524,13 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)

this.groupmode = null; // Can be null (i.e. does not apply), 0, 1 or 2.

this.linkContainer = this.getEl().getElementsByTagName('a')[0];
// Check for label first
firstspan = this.getEl().getElementsByTagName('span')[0];
if (firstspan.className == 'label' || firstspan.className == 'dimmed_text') {
this.linkContainer = firstspan;
} else {
this.linkContainer = this.getEl().getElementsByTagName('a')[0];
}

this.commandContainer = null;
this.indentLeftButton = null;
@@ -737,6 +743,11 @@ resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
}
if (this.hidden) {
YAHOO.util.Dom.removeClass(this.linkContainer, 'dimmed');

if (YAHOO.util.Dom.hasClass(this.linkContainer, 'dimmed_text')) {
YAHOO.util.Dom.removeClass(this.linkContainer, 'dimmed_text');
YAHOO.util.Dom.addClass(this.linkContainer, 'label');
}
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
this.hidden = false;

@@ -745,6 +756,11 @@ resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
}
} else {
YAHOO.util.Dom.addClass(this.linkContainer, 'dimmed');

if (YAHOO.util.Dom.hasClass(this.linkContainer, 'label')) {
YAHOO.util.Dom.addClass(this.linkContainer, 'dimmed_text');
YAHOO.util.Dom.removeClass(this.linkContainer, 'label');
}
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
this.hidden = true;

0 comments on commit 8cc0d4e

Please sign in to comment.
You can’t perform that action at this time.