diff --git a/lib/ajax/ajaxcourse.js b/lib/ajax/ajaxcourse.js index 79b5ba1227f..3c17de75e54 100644 --- a/lib/ajax/ajaxcourse.js +++ b/lib/ajax/ajaxcourse.js @@ -63,6 +63,7 @@ function main_class() { this.icons = []; this.marker = null; this.courseformat = null; + this.numsections = null; //things to process onload onloadobj.add('main.process_document();'); @@ -116,26 +117,29 @@ main_class.prototype.process_document = function() { this.leftcolumn = new column_class('left-column', "blocks", null, 'l'); this.rightcolumn = new column_class('right-column', "blocks", null, 'r'); - //process sections - var ct = 0; + //process sections + var maxct = this.portal.numsections; this.courseformat = this.portal.courseformat; - while (document.getElementById('section-'+ct) != null) { - this.sections[ct] = new section_class('section-'+ct, "sections", null, ct!=0?true:false); - this.sections[ct].addToGroup('resources'); - if (ct > 0) { - var sectiontitle = YAHOO.util.Selector.query('#section-'+ct+' h3.weekdates')[0]; - if (undefined !== sectiontitle) { // Only save date for weekly format - this.sectiondates[ct] = sectiontitle.innerHTML; + + for (var ct=0; ct <= maxct; ct++) { + if(document.getElementById('section-'+ct) != null) { + this.sections[ct] = new section_class('section-'+ct, "sections", null, ct!=0?true:false); + this.sections[ct].addToGroup('resources'); + if (ct > 0) { + var sectiontitle = YAHOO.util.Selector.query('#section-'+ct+' h3.weekdates')[0]; + if (undefined !== sectiontitle) { // Only save date for weekly format + this.sectiondates[ct] = sectiontitle.innerHTML; + } } - } - ct++; + } } if (this.debug) { YAHOO.log("Processed "+ct+" sections"); } - this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0]; + this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0]; this.tempBlock = YAHOO.util.Dom.getElementsByClassName('tempblockhandler')[0]; + YAHOO.log("admin - "+this.adminBlock.className); } diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index 185d91f6bab..4fcb0e5899e 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -137,7 +137,7 @@ class jsportal { if ($hidden) { $hidden_binary = 1; } - $this->blocks[count($this->blocks)] = array($this->currentblocksection, $id, $hidden_binary); + $this->blocks[count($this->blocks)] = array($this->currentblocksection, $id, $hidden_binary); } @@ -156,15 +156,16 @@ class jsportal { if ($i != (count($this->blocks) - 1)) { $blocksoutput .= ','; } - } + } $output .= "