Permalink
Browse files

Merge branch 'wip-mdl-36131-m23' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_23_STABLE
  • Loading branch information...
2 parents b969736 + 8648334 commit efd2f83e4a6eb3f056717df9735fd85b708fdefb Sam Hemelryk committed Oct 29, 2012
Showing with 28 additions and 11 deletions.
  1. +8 −4 course/lib.php
  2. +20 −7 course/yui/toolboxes/toolboxes.js
View
@@ -1548,8 +1548,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$linkclasses = '';
$textclasses = '';
if ($accessiblebutdim) {
- $linkclasses .= ' dimmed';
- $textclasses .= ' dimmed_text';
+ $linkclasses .= ' dimmed conditionalhidden';
+ $textclasses .= ' dimmed_text conditionalhidden';
$accesstext = '<span class="accesshide">'.
get_string('hiddenfromstudents').': </span>';
} else {
@@ -1731,11 +1731,15 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// see the activity itself, or for staff)
if (!$mod->uservisible) {
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
- } else if ($canviewhidden && !empty($CFG->enableavailability) && $mod->visible) {
+ } else if ($canviewhidden && !empty($CFG->enableavailability)) {
+ $visibilityclass = '';
+ if (!$mod->visible) {
+ $visibilityclass = 'accesshide';
+ }
$ci = new condition_info($mod);
$fullinfo = $ci->get_full_information();
if($fullinfo) {
- echo '<div class="availabilityinfo">'.get_string($mod->showavailability
+ echo '<div class="availabilityinfo '.$visibilityclass.'">'.get_string($mod->showavailability
? 'userrestriction_visible'
: 'userrestriction_hidden','condition',
$fullinfo).'</div>';
@@ -33,7 +33,11 @@ YUI.add('moodle-course-toolboxes', function(Y) {
SECTIONIDPREFIX : 'section-',
SECTIONLI : 'li.section',
SHOW : 'a.editing_show',
- SHOWHIDE : 'a.editing_showhide'
+ SHOWHIDE : 'a.editing_showhide',
+ CONDITIONALHIDDEN : 'conditionalhidden',
+ AVAILABILITYINFODIV : 'div.availabilityinfo',
+ SHOWCLASS : 'editing_show',
+ ACCESSHIDECLASS : 'accesshide'
};
/**
@@ -68,18 +72,14 @@ YUI.add('moodle-course-toolboxes', function(Y) {
var status = '';
var value;
- if (dimarea.hasClass(toggle_class)) {
+ if (button.hasClass(CSS.SHOWCLASS)) {
status = 'hide';
value = 1;
} else {
status = 'show';
value = 0;
}
-
- // Change the UI
- dimarea.toggleClass(toggle_class);
- // We need to toggle dimming on the description too
- element.all(CSS.CONTENTAFTERLINK).toggleClass(CSS.DIMMEDTEXT);
+ // Update button info.
var newstring = M.util.get_string(status, 'moodle');
hideicon.setAttrs({
'alt' : newstring,
@@ -88,6 +88,19 @@ YUI.add('moodle-course-toolboxes', function(Y) {
button.set('title', newstring);
button.set('className', 'editing_'+status);
+ // If activity is conditionally hidden, then don't toggle.
+ if (!dimarea.hasClass(CSS.CONDITIONALHIDDEN)) {
+ // Change the UI.
+ dimarea.toggleClass(toggle_class);
+ // We need to toggle dimming on the description too.
+ element.all(CSS.CONTENTAFTERLINK).toggleClass(CSS.DIMMEDTEXT);
+ }
+ // Toggle availablity info for conditional activities.
+ var availabilityinfo = element.one(CSS.AVAILABILITYINFODIV);
+
+ if (availabilityinfo) {
+ availabilityinfo.toggleClass(CSS.ACCESSHIDECLASS);
+ }
return value;
},
/**

0 comments on commit efd2f83

Please sign in to comment.