From: rwijaya Date: Wed, 21 Oct 2009 06:25:21 +0000 (+0000) Subject: course/view MDL-20123 section 0 visibility and highlight X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ddc660600a16ef7165f8e9314d67879e13f6351b;p=moodle.git course/view MDL-20123 section 0 visibility and highlight --- diff --git a/course/format/topics/format.php b/course/format/topics/format.php index 6a8771d862..09f59b900b 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -96,7 +96,7 @@ // Note, 'right side' is BEFORE content. echo '
  • '; echo '
     
    '; - echo '
     
    '; + echo '
     
    '; echo '
    '; echo '
    '; @@ -197,14 +197,14 @@ } else { echo ''.''.$strmarkthistopic.'
    '; } - + if ($thissection->visible) { // Show the hide/show eye echo ''. - ''.$strtopichide.'
    '; + ''.$strtopichide.'
    '; } else { echo ''. ''.$strtopicshow.'
    '; - } + } if ($section > 1) { // Add a arrow to move section up echo ''. ''.$strmoveup.'
    '; @@ -236,7 +236,7 @@ echo '
    '; print_section($course, $thissection, $mods, $modnamesused); - + echo '
    '; if ($PAGE->user_is_editing()) { print_section_add_menus($course, $section, $modnames); } diff --git a/course/view.php b/course/view.php index d1e1e2e0aa..562f78a239 100644 --- a/course/view.php +++ b/course/view.php @@ -157,11 +157,11 @@ // Course-based switches if (ajaxenabled($CFG->ajaxtestedbrowsers)) { // Browser, user and site-based switches - $PAGE->requires->yui_lib('dragdrop'); - $PAGE->requires->yui_lib('connection'); - $PAGE->requires->yui_lib('selector'); - $PAGE->requires->js('lib/ajax/block_classes.js'); - $PAGE->requires->js('lib/ajax/section_classes.js'); + $PAGE->requires->yui_lib('dragdrop')->asap(); + $PAGE->requires->yui_lib('connection')->asap(); + $PAGE->requires->yui_lib('selector')->asap(); + $PAGE->requires->js('lib/ajax/block_classes.js')->asap(); + $PAGE->requires->js('lib/ajax/section_classes.js')->asap(); // Okay, global variable alert. VERY UGLY. We need to create // this object here before the _print_block() @@ -177,14 +177,14 @@ $completion = new completion_info($course); if ($completion->is_enabled() && ajaxenabled()) { - $PAGE->requires->yui_lib('connection'); - $PAGE->requires->js('course/completion.js'); + $PAGE->requires->yui_lib('connection')->asap(); + $PAGE->requires->js('course/completion.js')->asap(); $PAGE->requires->js_function_call('completion_init')->on_dom_ready(); $PAGE->requires->data_for_js('completion_strsaved', get_string('saved', 'completion')); $PAGE->requires->data_for_js('completion_strtitley', get_string('completion-title-manual-y', 'completion')); $PAGE->requires->data_for_js('completion_strtitlen', get_string('completion-title-manual-n', 'completion')); $PAGE->requires->data_for_js('completion_stralty', get_string('completion-alt-manual-y', 'completion')); - $PAGE->requires->data_for_js('completion_straltn', get_string('completion-alt-manual-n', 'completion')); + $PAGE->requires->data_for_js('completion_straltn', get_string('completion-alt-manual-n', 'completion')); } // The "Editing On" button will be appearing only in the "main" course screen @@ -242,13 +242,14 @@ // Content wrapper end. echo "
    \n\n"; - // Use AJAX? + // Use AJAX? if ($useajax && has_capability('moodle/course:manageactivities', $context)) { // At the bottom because we want to process sections and activities // after the relevant html has been generated. We're forced to do this - // because of the way in which lib/ajax/ajaxcourse.js is written. - $PAGE->requires->js('lib/ajax/ajaxcourse.js'); - + // because of the way in which lib/ajax/ajaxcourse.js is written. + + echo '\n"; $COURSE->javascriptportal->print_javascript($course->id); } diff --git a/lib/ajax/ajaxcourse.js b/lib/ajax/ajaxcourse.js index ee21a42092..23ee24d523 100644 --- a/lib/ajax/ajaxcourse.js +++ b/lib/ajax/ajaxcourse.js @@ -59,7 +59,9 @@ function main_class() { this.leftcolumn = null; this.rightcolumn = null; this.adminBlock = null; + this.tempBlock = null; this.icons = []; + this.courseformat = null; this.marker = null; //things to process onload @@ -132,7 +134,7 @@ main_class.prototype.process_document = function() { } this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0]; - YAHOO.log("admin - "+this.adminBlock.className); + this.tempBlock = YAHOO.util.Dom.getElementsByClassName('tempblockhandler')[0]; } @@ -291,5 +293,8 @@ function php_portal_class() { //strings this.strings = []; + //icons + this.icons = []; + YAHOO.log("Instantiated php_portal_class", "info"); } diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index ea05acfc33..99cb455878 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -1379,7 +1379,7 @@ class jsportal { * Prints the JavaScript code needed to set up AJAX for the course. */ function print_javascript($courseid, $return=false) { - global $CFG, $USER, $OUTPUT; + global $CFG, $USER, $OUTPUT, $COURSE; $blocksoutput = $output = ''; for ($i=0; $iblocks); $i++) { @@ -1394,6 +1394,7 @@ class jsportal { $output .= "