Skip to content
Browse files

MDL-35766 AJAX: Conditional activity hiding is separately handled by JS

  • Loading branch information...
1 parent f4b03cf commit b53ec9de13a9adf9ddb2faa435a66b88ffcd5e5a @rajeshtaneja rajeshtaneja committed Oct 19, 2012
Showing with 9 additions and 2 deletions.
  1. +5 −0 course/lib.php
  2. +4 −2 lib/ajax/section_classes.js
View
5 course/lib.php
@@ -1591,6 +1591,11 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
if ($accessiblebutdim) {
$linkclasses .= ' dimmed';
$textclasses .= ' dimmed_text';
+ // If mod is visible and is dimmed because of condition then handle it nicely with JS.
+ if ($mod->visible) {
+ $linkclasses .= ' conditionalhidden';
+ $textclasses .= ' conditionalhidden';
+ }
$accesstext = '<span class="accesshide">'.
get_string('hiddenfromstudents').': </span>';
} else {
View
6 lib/ajax/section_classes.js
@@ -592,8 +592,10 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
this.id = this.getEl().id.replace(/module-/i, '');
this.hidden = false;
- if (YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0], 'dimmed') ||
- YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('div')[1], 'dimmed_text')) {
+ // If dimmed and is not conditional dimmed then hidden.
+ if ((YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0], 'dimmed') ||
+ YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('div')[1], 'dimmed_text')) &&
+ !YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0], 'conditionalhidden')) {
this.hidden = true;
}
this.hiddenStored = null;

0 comments on commit b53ec9d

Please sign in to comment.
Something went wrong with that request. Please try again.