]> git.mjollnir.org Git - moodle.git/commitdiff
Detected a display bug when looking for possible causes of
authorstronk7 <stronk7>
Mon, 19 Apr 2004 19:24:42 +0000 (19:24 +0000)
committerstronk7 <stronk7>
Mon, 19 Apr 2004 19:24:42 +0000 (19:24 +0000)
bug 1248. Widhts were only calculated in teacher mode and
they were down to 100px in student mode!!
Perhaps we could make some session caching to avoid some
calculations every time the course is displayed. Seems to
work fine now.
Anyway, if I compare the right column width
in my server (with blocks running) against moodle.org (without
blocks), it seems that the right column is narrower in my test server...

course/view.php

index b17d0a32336586c53f3b5bb16a60489cd0d14e21..07c2f78172c3b50ce64434def1ff4b0f12a78cdf 100644 (file)
             $courseformat = 0;
     }
 
+    //We *always* need to get active blocks (perhaps this should be cached
+    //in a session object and updated in when editing = true ????
+    $recblocks = get_records('blocks','visible','1');
+
     // Doing this now so we can pass the results to block_action()
     // and dodge the overhead of doing the same work twice.
 
         $allblocks = array_merge($leftblocks, $rightblocks);
 
         $missingblocks = array();
-        $recblocks = get_records('blocks','visible','1');
         if($editing && $recblocks) {
             foreach($recblocks as $recblock) {
                 // If it's not hidden or displayed right now...
             }
         }
 
-        $preferred_width_left = blocks_preferred_width($leftblocks, $recblocks);
-        $preferred_width_right = blocks_preferred_width($rightblocks, $recblocks);
 
         if (!empty($section)) {
             if (!empty($move)) {
         }
     }
 
+    //Calculate left and right width. This has to be calculated *always*. Perhaps
+    //we could cache it in a session variable and update it only when editing=true ????
+    //This caused some display problems (100 width) in student mode.
+    $preferred_width_left = blocks_preferred_width($leftblocks, $recblocks);
+    $preferred_width_right = blocks_preferred_width($rightblocks, $recblocks);
+
     require("$CFG->dirroot/course/format/$course->format/format.php");  // Include the actual course format
 
     print_footer();