]> git.mjollnir.org Git - moodle.git/commitdiff
course/view MDL-20123 section 0 visibility and highlight
authorrwijaya <rwijaya>
Wed, 21 Oct 2009 06:25:21 +0000 (06:25 +0000)
committerrwijaya <rwijaya>
Wed, 21 Oct 2009 06:25:21 +0000 (06:25 +0000)
course/format/topics/format.php
course/view.php
lib/ajax/ajaxcourse.js
lib/ajax/ajaxlib.php
lib/ajax/section_classes.js
theme/standard/styles_layout.css

index 6a8771d862cce04ff0fdd2bf30c7842d04603ed5..09f59b900b0d890130b06174030946aa0e96875c 100644 (file)
@@ -96,7 +96,7 @@
         // Note, 'right side' is BEFORE content.
         echo '<li id="section-0" class="section main" >';
        echo '<div class="left side">&nbsp;</div>';
-        echo '<div class="right side" >&nbsp;</div>';        
+        echo '<div class="right side" >&nbsp;</div>';
         echo '<div class="content">';
         echo '<div class="summary">';
 
                } else {
                     echo '<a href="view.php?id='.$course->id.'&amp;marker='.$section.'&amp;sesskey='.sesskey().'#section-'.$section.'" title="'.$strmarkthistopic.'">'.'<img src="'.$OUTPUT->old_icon_url('i/marker') . '" alt="'.$strmarkthistopic.'" /></a><br />';
                }
-
+                
                 if ($thissection->visible) {        // Show the hide/show eye
                     echo '<a href="view.php?id='.$course->id.'&amp;hide='.$section.'&amp;sesskey='.sesskey().'#section-'.$section.'" title="'.$strtopichide.'">'.
-                         '<img src="'.$OUTPUT->old_icon_url('i/hide') . '" class="icon hide" alt="'.$strtopichide.'" /></a><br />';
+                         '<img src="'.$OUTPUT->old_icon_url('i/hide') . '" class="icon hide" alt="'.$strtopichide.'" /></a><br />';                                        
                 } else {
                     echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.sesskey().'#section-'.$section.'" title="'.$strtopicshow.'">'.
                          '<img src="'.$OUTPUT->old_icon_url('i/show') . '" class="icon hide" alt="'.$strtopicshow.'" /></a><br />';
-                }
+                }                   
                 if ($section > 1) {                       // Add a arrow to move section up
                     echo '<a href="view.php?id='.$course->id.'&amp;random='.rand(1,10000).'&amp;section='.$section.'&amp;move=-1&amp;sesskey='.sesskey().'#section-'.($section-1).'" title="'.$strmoveup.'">'.
                          '<img src="'.$OUTPUT->old_icon_url('t/up') . '" class="icon up" alt="'.$strmoveup.'" /></a><br />';
                 echo '</div>';
 
                 print_section($course, $thissection, $mods, $modnamesused);
-
+                echo '<br />';
                 if ($PAGE->user_is_editing()) {
                     print_section_add_menus($course, $section, $modnames);
                 }
index d1e1e2e0aac275fa9b6b5673ad49ee91e2022fb7..562f78a239f77b5743647e8abfc19b87ed553eb4 100644 (file)
                                                              // 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 <blockname>_print_block()
 
     $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
     // Content wrapper end.
     echo "</div>\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 '<script type="text/javascript" ';
+        echo "src=\"{$CFG->wwwroot}/lib/ajax/ajaxcourse.js\"></script>\n";
         $COURSE->javascriptportal->print_javascript($course->id);
     }
 
index ee21a420927f87f626510a14b5fc55d57eec9cf4..23ee24d5232e0eb02d04bb42589307a5e0aae3e6 100644 (file)
@@ -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");
 }
index ea05acfc332e9c9c61ea70952960f00e19006863..99cb45587888e3582c7d165ecd61eae6e54a8653 100644 (file)
@@ -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; $i<count($this->blocks); $i++) {
@@ -1394,6 +1394,7 @@ class jsportal {
         $output .= "<script type=\"text/javascript\">\n";
         $output .= "    main.portal.id = ".$courseid.";\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['marker']='".get_string('markthistopic', '', '_var_')."';\n";
         $output .= "    main.portal.strings['marked']='".get_string('markedthistopic', '', '_var_')."';\n";
index a2bfb6a991d56b3554f2f3eb5bd6c7194dfe24a0..8d61e47c1e3f5a3e5cc25d4147e2ef2bd260ec6a 100755 (executable)
@@ -88,17 +88,19 @@ section_class.prototype.init_buttons = function() {
         commandContainer.removeChild(commandContainer.childNodes[i])
     }
 
-    if (!this.isWeekFormat) {
+    if (main.getString('courseformat', this.sectionId) != "weeks" && this.sectionId > 0) {
         var highlightbutton = main.mk_button('div', main.portal.icons['marker'], main.getString('marker', this.sectionId));
         YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
         commandContainer.appendChild(highlightbutton);
         this.highlightButton = highlightbutton;
+    }    
+    if (this.sectionId > 0 ) {
+        var viewbutton = main.mk_button('div', main.portal.icons['hide'], main.getString('hidesection', this.sectionId),
+                [['title', main.portal.strings['hide'] ]]);
+        YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
+        commandContainer.appendChild(viewbutton);
+        this.viewButton = viewbutton;
     }
-    var viewbutton = main.mk_button('div', main.portal.icons['hide'], main.getString('hidesection', this.sectionId),
-            [['title', main.portal.strings['hide'] ]]);
-    YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
-    commandContainer.appendChild(viewbutton);
-    this.viewButton = viewbutton;
 }
 
 
@@ -172,7 +174,7 @@ section_class.prototype.startDrag = function(x, y) {
 }
 
 
-section_class.prototype.onDragDrop = function(e, id) {
+section_class.prototype.onDragDrop = function(e, id) { 
     // get the drag and drop object that was targeted
     var target = YAHOO.util.DDM.getDDById(id);
 
@@ -228,7 +230,7 @@ section_class.prototype.move_to_section = function(target) {
     //move on front end
     for (var i=loopStart; eval(loopCondition); eval(loopInc)) {
 
-        if ((main.sections[i] == this) && !found) {
+        if ((main.sections[i] == this) && !found) { 
             //encounter with original node
             if (this.debug) {
                 YAHOO.log("Found Original "+main.sections[i].getEl().id);
@@ -242,7 +244,7 @@ section_class.prototype.move_to_section = function(target) {
                 YAHOO.log("Found target "+main.sections[i].getEl().id);
             }
             main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
-            main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);
+            main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);            
             found = false;
             break;
         } else if (found) {
index de99b7e194fcd90306f3281911fe752d86bf99f2..be60f6c56c5a4c7aaff5432d98c6d3b7ac095214 100644 (file)
@@ -684,7 +684,7 @@ fieldset.fdate_selector label {
 }
 /* Prevent border-collapse:collapse from bleeding through in IE6, IE7 */
 #date_selector_calendar_panel.yui-overlay-hidden table {
-  *display:none;
+  display:none;
 }
 #date_selector_calendar_panel th.calhead {
   padding-right: 2em;
@@ -2428,10 +2428,11 @@ border-width:0px;
   margin-bottom: 0.5em;
   border-style:solid;
   border-width:1px;
+  clear: both;
 }
 .weeks .content,
 .topics .content {
-  padding: 5px;
+  padding: 5px 5px 15px 5px;
   margin: 0 1.7em 0 1.7em;
 }
 .weeks .right,