Merge branch 'wip-mdl-36131' of git://github.com/rajeshtaneja/moodle

This commit is contained in:
Sam Hemelryk 2012-10-30 12:24:31 +13:00
commit 558aecf818
2 changed files with 28 additions and 11 deletions

View File

@ -1474,8 +1474,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 {
@ -1657,11 +1657,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>';

View File

@ -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;
},
/**