MDL-7574 Applying the patch as is, with a bit extra code formatting for the JS section (indents etc.)
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
define('BLOCK_R_MIN_WIDTH', 100);
|
||||
define('BLOCK_R_MAX_WIDTH', 210);
|
||||
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
|
||||
BLOCK_L_MAX_WIDTH);
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
if ($week != -1) {
|
||||
@@ -88,7 +88,7 @@
|
||||
echo '<tr id="section-0" class="section main">';
|
||||
echo '<td class="left side"> </td>';
|
||||
echo '<td class="content">';
|
||||
|
||||
|
||||
echo '<div class="summary">';
|
||||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
@@ -99,7 +99,7 @@
|
||||
'class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
print_section($course, $thissection, $mods, $modnamesused);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
@@ -173,17 +173,7 @@
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side"> </td>';
|
||||
|
||||
|
||||
if (ajaxenabled() && $editing) {
|
||||
// Temporarily hide the dates for the weeks. We do it this way
|
||||
// for now. Eventually, we'll have to modify the javascript code
|
||||
// to handle re-calculation of dates when sections are moved
|
||||
// around. For now, just hide all the dates to avoid confusion.
|
||||
$weekperiod = '';
|
||||
} else {
|
||||
$weekperiod = $weekday.' '.$endweekday;
|
||||
}
|
||||
|
||||
$weekperiod = $weekday.' '.$endweekday;
|
||||
|
||||
echo '<td class="content">';
|
||||
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
|
||||
@@ -267,4 +257,4 @@
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+67
-40
@@ -78,7 +78,7 @@ section_class.prototype.init_section = function(id, group, config, isDraggable)
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.init_buttons = function() {
|
||||
section_class.prototype.init_buttons = function() {
|
||||
var commandContainer = this.getEl().childNodes[2];
|
||||
|
||||
//clear all but show only button
|
||||
@@ -88,11 +88,11 @@ section_class.prototype.init_buttons = function() {
|
||||
commandContainer.removeChild(commandContainer.childNodes[i])
|
||||
}
|
||||
|
||||
if (!this.isWeekFormat) {
|
||||
if (!this.isWeekFormat) {
|
||||
var highlightbutton = main.mk_button('div', '/i/marker.gif');
|
||||
YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
|
||||
commandContainer.appendChild(highlightbutton);
|
||||
this.highlightButton = highlightbutton;
|
||||
commandContainer.appendChild(highlightbutton);
|
||||
this.highlightButton = highlightbutton;
|
||||
}
|
||||
var viewbutton = main.mk_button('div', '/i/hide.gif');
|
||||
YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
|
||||
@@ -127,7 +127,7 @@ section_class.prototype.process_section = function() {
|
||||
this.numberDisplay = document.createElement('div');
|
||||
this.numberDisplay.innerHTML = this.getEl().childNodes[0].innerHTML;
|
||||
this.getEl().childNodes[0].innerHTML = '';
|
||||
this.getEl().childNodes[0].appendChild(this.numberDisplay);
|
||||
this.getEl().childNodes[0].appendChild(this.numberDisplay);
|
||||
|
||||
this.sectionId = this.id.replace(/section-/i, ''); // Okay, we will have to change this if we
|
||||
// ever change the id attributes format
|
||||
@@ -191,7 +191,7 @@ section_class.prototype.endDrag = function() {
|
||||
|
||||
//add back to resources group
|
||||
this.addToGroup('resources');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.move_to_section = function(target) {
|
||||
@@ -211,12 +211,12 @@ section_class.prototype.move_to_section = function(target) {
|
||||
var loopCondition = 'i<sectionCount';
|
||||
var loopStart = 1;
|
||||
var loopInc = 'i++';
|
||||
var loopmodifier = 'i - 1';
|
||||
var loopmodifier = 'i - 1';
|
||||
} else {
|
||||
var loopCondition = 'i > 0';
|
||||
var loopStart = sectionCount - 1;
|
||||
var loopInc = 'i--';
|
||||
var loopmodifier = 'i + 1';
|
||||
var loopStart = sectionCount - 1;
|
||||
var loopInc = 'i--';
|
||||
var loopmodifier = 'i + 1';
|
||||
}
|
||||
|
||||
//move on backend
|
||||
@@ -239,18 +239,20 @@ section_class.prototype.move_to_section = function(target) {
|
||||
if (this.debug) {
|
||||
YAHOO.log("Found target "+main.sections[i].getEl().id);
|
||||
}
|
||||
main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);
|
||||
main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
|
||||
found = false;
|
||||
break;
|
||||
} else if (found) {
|
||||
//encounter with nodes inbetween
|
||||
main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);
|
||||
main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.swap_with_section = function(sectionIn) {
|
||||
section_class.prototype.swap_with_section = function(sectionIn) {
|
||||
var tmpStore = null;
|
||||
|
||||
thisIndex = main.get_section_index(this);
|
||||
@@ -282,14 +284,14 @@ section_class.prototype.swap_with_section = function(sectionIn) {
|
||||
|
||||
|
||||
section_class.prototype.toggle_hide = function(e,target,superficial) {
|
||||
if (this.hidden) {
|
||||
if (this.hidden) {
|
||||
YAHOO.util.Dom.removeClass(this.getEl(), 'hidden');
|
||||
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
|
||||
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
|
||||
this.hidden = false;
|
||||
|
||||
if (!superficial) {
|
||||
main.connect('POST', 'class=section&field=visible', null, 'value=1&id='+this.sectionId);
|
||||
for (var x=0; x<this.resources.length; x++) {
|
||||
for (var x=0; x<this.resources.length; x++) {
|
||||
this.resources[x].toggle_hide(null, null, true, this.resources[x].hiddenStored);
|
||||
this.resources[x].hiddenStored = null;
|
||||
}
|
||||
@@ -297,13 +299,13 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
|
||||
|
||||
} else {
|
||||
YAHOO.util.Dom.addClass(this.getEl(), 'hidden');
|
||||
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
|
||||
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
|
||||
this.hidden = true;
|
||||
|
||||
if (!superficial) {
|
||||
main.connect('POST', 'class=section&field=visible', null, 'value=0&id='+this.sectionId);
|
||||
for (var x=0; x<this.resources.length; x++) {
|
||||
this.resources[x].hiddenStored = this.resources[x].hidden;
|
||||
this.resources[x].hiddenStored = this.resources[x].hidden;
|
||||
this.resources[x].toggle_hide(null, null, true, true);
|
||||
}
|
||||
}
|
||||
@@ -312,14 +314,14 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
|
||||
|
||||
|
||||
section_class.prototype.toggle_highlight = function() {
|
||||
if (this.highlighted) {
|
||||
if (this.highlighted) {
|
||||
YAHOO.util.Dom.removeClass(this.getEl(), 'current');
|
||||
this.highlighted = false;
|
||||
} else {
|
||||
YAHOO.util.Dom.addClass(this.getEl(), 'current');
|
||||
this.highlighted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.mk_marker = function() {
|
||||
@@ -335,16 +337,16 @@ section_class.prototype.mk_marker = function() {
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.changeId = function(newId) {
|
||||
this.sectionId = newId;
|
||||
section_class.prototype.changeId = function(newId) {
|
||||
this.sectionId = newId;
|
||||
this.numberDisplay.firstChild.data = newId;
|
||||
|
||||
//main.connectQueue_add('POST','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))
|
||||
//main.connectQueue_add('POST','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))
|
||||
|
||||
if (main.marker == this) {
|
||||
main.update_marker(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.get_resource_index = function(el) {
|
||||
@@ -376,7 +378,7 @@ section_class.prototype.remove_resource = function(el) {
|
||||
var found = false;
|
||||
for (var i=0; i<resourceCount; i++) {
|
||||
if (found) {
|
||||
this.resources[i - 1] = this.resources[i];
|
||||
this.resources[i - 1] = this.resources[i];
|
||||
if (i == resourceCount - 1) {
|
||||
this.resources = this.resources.slice(0, -1);
|
||||
resourceCount--;
|
||||
@@ -421,8 +423,8 @@ section_class.prototype.insert_resource = function(el, targetel) {
|
||||
|
||||
//if inserting into a hidden resource hide
|
||||
if (this.hidden) {
|
||||
el.hiddenStored = el.hidden;
|
||||
el.toggle_hide(null, null, true, true);
|
||||
el.hiddenStored = el.hidden;
|
||||
el.toggle_hide(null, null, true, true);
|
||||
} else {
|
||||
if (el.hiddenStored != null) {
|
||||
el.toggle_hide(null, null, true, el.hiddenStored);
|
||||
@@ -439,18 +441,18 @@ section_class.prototype.insert_resource = function(el, targetel) {
|
||||
this.resources[i] = nextStore;
|
||||
nextStore = tempStore;
|
||||
|
||||
if (nextStore != null)
|
||||
nextStore.update_index(i+1);
|
||||
if (nextStore != null)
|
||||
nextStore.update_index(i+1);
|
||||
|
||||
} else if (this.resources[i] == targetel) {
|
||||
found = true;
|
||||
nextStore = this.resources[i];
|
||||
this.resources[i] = el;
|
||||
this.resources[i] = el;
|
||||
resourcecount++;
|
||||
|
||||
this.resources[i].update_index(i, this.ident);
|
||||
nextStore.update_index(i + 1);
|
||||
}
|
||||
nextStore.update_index(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update on frontend
|
||||
@@ -460,9 +462,9 @@ section_class.prototype.insert_resource = function(el, targetel) {
|
||||
} else {
|
||||
this.resources_ul.appendChild(el.getEl());
|
||||
//this.resources_ul.appendChild(document.createTextNode(' '));
|
||||
}
|
||||
el.parentObj = this;
|
||||
}
|
||||
}
|
||||
el.parentObj = this;
|
||||
}
|
||||
|
||||
|
||||
section_class.prototype.write_sequence_list = function(toReturn) {
|
||||
@@ -496,9 +498,9 @@ resource_class.prototype.debug = true;
|
||||
|
||||
|
||||
resource_class.prototype.init_resource = function(id, group, config, parentObj) {
|
||||
if (!id) {
|
||||
if (!id) {
|
||||
YAHOO.log("Init resource, NO ID FOUND!", 'error');
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Some constants.
|
||||
@@ -506,9 +508,9 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
|
||||
this.SEPARATEGROUPS = 1;
|
||||
this.VISIBLEGROUPS = 2;
|
||||
|
||||
this.is = 'resource';
|
||||
this.is = 'resource';
|
||||
this.init(id, group, config);
|
||||
this.createFrame();
|
||||
this.createFrame();
|
||||
this.isTarget = true;
|
||||
|
||||
this.id = this.getEl().id.replace(/module-/i, '');
|
||||
@@ -660,7 +662,7 @@ resource_class.prototype.init_buttons = function() {
|
||||
commandContainer.appendChild(button);
|
||||
this.groupButton = button;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resource_class.prototype.indent_left = function() {
|
||||
@@ -730,12 +732,12 @@ resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
|
||||
if (this.debug) {
|
||||
YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
|
||||
}
|
||||
this.hidden = !force;
|
||||
this.hidden = !force;
|
||||
}
|
||||
if (this.hidden) {
|
||||
YAHOO.util.Dom.removeClass(this.linkContainer, 'dimmed');
|
||||
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
|
||||
this.hidden = false;
|
||||
this.hidden = false;
|
||||
|
||||
if (!superficial) {
|
||||
main.connect('POST', 'class=resource&field=visible', null, 'value=1&id='+this.id);
|
||||
@@ -860,3 +862,28 @@ resource_class.prototype.onDragDrop = function(e, ids) {
|
||||
resource_class.prototype.endDrag = function() {
|
||||
// Eliminates default action
|
||||
}
|
||||
|
||||
section_class.prototype.swap_dates = function(el){
|
||||
var i=0;
|
||||
while(this.getEl().getElementsByTagName("div")[i]) {
|
||||
if (this.getEl().getElementsByTagName("div")[i].className == "weekdates") {
|
||||
var tempdate = this.getEl().getElementsByTagName("div")[i].innerHTML;
|
||||
var permi = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
var j=0;
|
||||
while(el.getEl().getElementsByTagName("div")[j]) {
|
||||
if (el.getEl().getElementsByTagName("div")[j].className == "weekdates") {
|
||||
var permj = j;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
if(tempdate) {
|
||||
this.getEl().getElementsByTagName("div")[permi].innerHTML = el.getEl().getElementsByTagName("div")[permj].innerHTML;
|
||||
el.getEl().getElementsByTagName("div")[permj].innerHTML = tempdate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user