MDL-12198 Fixed ordering of sections, Merging from MOODLE_19_STABLE

This commit is contained in:
nicolasconnault
2008-10-08 12:22:04 +00:00
parent 699da6b5d5
commit ca255392e2
3 changed files with 27 additions and 16 deletions
+6 -6
View File
@@ -1465,9 +1465,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$completionicon='';
if($isediting) {
switch($completion) {
case COMPLETION_TRACKING_MANUAL :
case COMPLETION_TRACKING_MANUAL :
$completionicon='manual-enabled'; break;
case COMPLETION_TRACKING_AUTOMATIC :
case COMPLETION_TRACKING_AUTOMATIC :
$completionicon='auto-enabled'; break;
default: // wtf
}
@@ -1498,8 +1498,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$imgtitle=get_string('completion-title-'.$completionicon,'completion');
$newstate=
$completiondata->completionstate==COMPLETION_COMPLETE
? COMPLETION_INCOMPLETE
: COMPLETION_COMPLETE;
? COMPLETION_INCOMPLETE
: COMPLETION_COMPLETE;
// In manual mode the icon is a toggle form.
echo "
<form class='togglecompletion' method='post' action='togglecompletion.php'><div>";
@@ -2457,11 +2457,11 @@ function move_section_to($course, $section, $destination) {
/// Moves a whole course section up and down within the course
global $USER, $DB;
if (!$destination) {
if (!$destination && $destination != 0) {
return true;
}
if ($destination > $course->numsections or $destination < 1) {
if ($destination > $course->numsections) {
return false;
}
+20 -9
View File
@@ -72,7 +72,7 @@ main_class.prototype.process_blocks = function() {
for (var x=0; x<els.length; x++) {
els[x].parentNode.removeChild(els[x]);
}
}
}
//process the block ids passed from php
var blockcount = this.portal.blocks.length;
YAHOO.log("main.processBlocks - processing "+blockcount+" blocks", "info");
@@ -84,14 +84,14 @@ main_class.prototype.process_blocks = function() {
if (this.portal.blocks[i][0] == 'l') {
main.leftcolumn.add_block(this.blocks[i]);
} else if (this.portal.blocks[i][0] == 'r') {
main.rightcolumn.add_block(this.blocks[i]);
main.rightcolumn.add_block(this.blocks[i]);
}
//hide if called for
if (this.portal.blocks[i][2] == 1) {
this.blocks[i].toggle_hide(null, null, true);
}
}
}
}
@@ -114,14 +114,14 @@ main_class.prototype.process_document = function() {
YAHOO.log("Processed "+ct+" sections");
}
this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0];
this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0];
YAHOO.log("admin - "+this.adminBlock.className);
}
main_class.prototype.mk_safe_for_transport = function(input) {
return input.replace(/&/i, '_.amp._');
}
}
//return block by id
@@ -183,7 +183,18 @@ main_class.prototype.connect = function(method, urlStub, callback, body) {
YAHOO.log("Making "+method+" connection to /course/rest.php?courseId="+main.portal.id+"&"+urlStub);
}
if (callback == null) {
callback = {}
if (this.debug) {
callback = {
success: function(response) {
YAHOO.log("Response from the Request: " + response.statusText + ": " + response.responseText, 'info');
},
failure: function() {
YAHOO.log("Response from the Request: " + response.statusText + ": " + response.responseText, 'error');
}
};
} else {
callback = {};
}
}
return YAHOO.util.Connect.asyncRequest(method, this.portal.strings['wwwroot']+"/course/rest.php?courseId="+main.portal.id+"&"+urlStub, callback, body);
}
@@ -224,7 +235,7 @@ main_class.prototype.update_marker = function(newMarker) {
if (this.marker != null) {
this.marker.toggle_highlight();
}
this.marker = newMarker;
this.marker = newMarker;
this.marker.toggle_highlight();
this.connect('post', 'class=course&field=marker', null, 'value='+this.marker.sectionId);
@@ -254,14 +265,14 @@ function php_portal_class() {
this.id = null;
this.debug = null;
//array of id's of blocks set at end of page load by php
//array of id's of blocks set at end of page load by php
this.blocks = new Array();
this.imagePath = null;
//flag for week fomat
this.isWeek = false;
//strings
//strings
this.strings = [];
YAHOO.log("Instantiated php_portal_class", "info");
+1 -1
View File
@@ -229,7 +229,7 @@ section_class.prototype.move_to_section = function(target) {
for (var i=loopStart; eval(loopCondition); eval(loopInc)) {
if ((main.sections[i] == this) && !found) {
//enounter with original node
//encounter with original node
if (this.debug) {
YAHOO.log("Found Original "+main.sections[i].getEl().id);
}