Merge branch 'MDL-35568_dndupload_hidden' of git://github.com/davosmith/moodle

This commit is contained in:
Sam Hemelryk 2013-01-14 13:51:48 +13:00
commit f5c51a6d64
2 changed files with 15 additions and 2 deletions

View File

@ -729,6 +729,9 @@ M.course_dndupload = {
resel.icon.src = result.icon;
resel.a.href = result.link;
resel.namespan.innerHTML = result.name;
if (!parseInt(result.visible, 10)) {
resel.a.className = 'dimmed';
}
if (result.groupingname) {
resel.groupingspan.innerHTML = '(' + result.groupingname + ')';
@ -916,6 +919,9 @@ M.course_dndupload = {
resel.icon.src = result.icon;
resel.a.href = result.link;
resel.namespan.innerHTML = result.name;
if (!parseInt(result.visible, 10)) {
resel.a.className = 'dimmed';
}
if (result.groupingname) {
resel.groupingspan.innerHTML = '(' + result.groupingname + ')';

View File

@ -620,6 +620,9 @@ class dndupload_ajax_processor {
throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
}
// Note the section visibility
$visible = get_fast_modinfo($this->course)->get_section_info($this->section)->visible;
$DB->set_field('course_modules', 'instance', $instanceid, array('id' => $this->cm->id));
// Rebuild the course cache after update action
rebuild_course_cache($this->course->id, true);
@ -627,7 +630,10 @@ class dndupload_ajax_processor {
$sectionid = course_add_cm_to_section($this->course, $this->cm->id, $this->section);
set_coursemodule_visible($this->cm->id, true);
set_coursemodule_visible($this->cm->id, $visible);
if (!$visible) {
$DB->set_field('course_modules', 'visibleold', 1, array('id' => $this->cm->id));
}
// retrieve the final info about this module.
$info = get_fast_modinfo($this->course);
@ -636,7 +642,7 @@ class dndupload_ajax_processor {
delete_course_module($this->cm->id);
throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
}
$mod = $info->cms[$this->cm->id];
$mod = $info->get_cm($this->cm->id);
$mod->groupmodelink = $this->cm->groupmodelink;
$mod->groupmode = $this->cm->groupmode;
@ -675,6 +681,7 @@ class dndupload_ajax_processor {
$resp->elementid = 'module-'.$mod->id;
$resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
$resp->onclick = $mod->get_on_click();
$resp->visible = $mod->visible;
// if using groupings, then display grouping name
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {