mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-36131 AJAX: Conditional activities will behave same as in non-ajax mode
This commit is contained in:
parent
b1c5155cbc
commit
8648334966
2 changed files with 28 additions and 11 deletions
|
@ -1548,8 +1548,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||||
$linkclasses = '';
|
$linkclasses = '';
|
||||||
$textclasses = '';
|
$textclasses = '';
|
||||||
if ($accessiblebutdim) {
|
if ($accessiblebutdim) {
|
||||||
$linkclasses .= ' dimmed';
|
$linkclasses .= ' dimmed conditionalhidden';
|
||||||
$textclasses .= ' dimmed_text';
|
$textclasses .= ' dimmed_text conditionalhidden';
|
||||||
$accesstext = '<span class="accesshide">'.
|
$accesstext = '<span class="accesshide">'.
|
||||||
get_string('hiddenfromstudents').': </span>';
|
get_string('hiddenfromstudents').': </span>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1731,11 +1731,15 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||||
// see the activity itself, or for staff)
|
// see the activity itself, or for staff)
|
||||||
if (!$mod->uservisible) {
|
if (!$mod->uservisible) {
|
||||||
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
|
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);
|
$ci = new condition_info($mod);
|
||||||
$fullinfo = $ci->get_full_information();
|
$fullinfo = $ci->get_full_information();
|
||||||
if($fullinfo) {
|
if($fullinfo) {
|
||||||
echo '<div class="availabilityinfo">'.get_string($mod->showavailability
|
echo '<div class="availabilityinfo '.$visibilityclass.'">'.get_string($mod->showavailability
|
||||||
? 'userrestriction_visible'
|
? 'userrestriction_visible'
|
||||||
: 'userrestriction_hidden','condition',
|
: 'userrestriction_hidden','condition',
|
||||||
$fullinfo).'</div>';
|
$fullinfo).'</div>';
|
||||||
|
|
27
course/yui/toolboxes/toolboxes.js
vendored
27
course/yui/toolboxes/toolboxes.js
vendored
|
@ -33,7 +33,11 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||||
SECTIONIDPREFIX : 'section-',
|
SECTIONIDPREFIX : 'section-',
|
||||||
SECTIONLI : 'li.section',
|
SECTIONLI : 'li.section',
|
||||||
SHOW : 'a.editing_show',
|
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 status = '';
|
||||||
var value;
|
var value;
|
||||||
if (dimarea.hasClass(toggle_class)) {
|
if (button.hasClass(CSS.SHOWCLASS)) {
|
||||||
status = 'hide';
|
status = 'hide';
|
||||||
value = 1;
|
value = 1;
|
||||||
} else {
|
} else {
|
||||||
status = 'show';
|
status = 'show';
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
|
// Update button info.
|
||||||
// Change the UI
|
|
||||||
dimarea.toggleClass(toggle_class);
|
|
||||||
// We need to toggle dimming on the description too
|
|
||||||
element.all(CSS.CONTENTAFTERLINK).toggleClass(CSS.DIMMEDTEXT);
|
|
||||||
var newstring = M.util.get_string(status, 'moodle');
|
var newstring = M.util.get_string(status, 'moodle');
|
||||||
hideicon.setAttrs({
|
hideicon.setAttrs({
|
||||||
'alt' : newstring,
|
'alt' : newstring,
|
||||||
|
@ -88,6 +88,19 @@ YUI.add('moodle-course-toolboxes', function(Y) {
|
||||||
button.set('title', newstring);
|
button.set('title', newstring);
|
||||||
button.set('className', 'editing_'+status);
|
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;
|
return value;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue