course/view MDL-10142 AJAX move functionality for section content

This commit is contained in:
Rossiani Wijaya
2009-10-30 09:28:11 +00:00
parent 65db12fec4
commit 69f471111c
2 changed files with 20 additions and 15 deletions
+16 -12
View File
@@ -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);
}
+4 -3
View File
@@ -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 .= "<script type=\"text/javascript\">\n";
$output .= " main.portal.id = ".$courseid.";\n";
$output .= " main.portal.blocks = new Array(".$blocksoutput.");\n";
$output .= " main.portal.blocks = new Array(".$blocksoutput.");\n";
$output .= " main.portal.strings['courseformat']='".$COURSE->format."';\n";
$output .= " main.portal.strings['wwwroot']='".$CFG->wwwroot."';\n";
$output .= " main.portal.strings['pixpath']='".$CFG->pixpath."';\n";
$output .= " main.portal.strings['marker']='".get_string('markthistopic', '', '_var_')."';\n";
$output .= " main.portal.strings['marked']='".get_string('markedthistopic', '', '_var_')."';\n";
$output .= " main.portal.numsections = ".$COURSE->numsections.";\n";
$output .= " main.portal.strings['hide']='".get_string('hide')."';\n";
$output .= " main.portal.strings['hidesection']='".get_string('hidesection', '', '_var_')."';\n";
$output .= " main.portal.strings['show']='".get_string('show')."';\n";