]> git.mjollnir.org Git - moodle.git/commitdiff
Merging in fixes for MDL-8414 and MDL-9250 from MOODLE_18_STABLE
authormark-nielsen <mark-nielsen>
Sun, 8 Apr 2007 21:02:16 +0000 (21:02 +0000)
committermark-nielsen <mark-nielsen>
Sun, 8 Apr 2007 21:02:16 +0000 (21:02 +0000)
mod/lesson/action/editpage.php
mod/lesson/locallib.php
mod/lesson/styles.php
mod/lesson/view.php

index 8188f43645eb45a3f0191bd699c52cd6d08ba976..dbf47605934ab50cef071d8d72007b2322b22f34 100644 (file)
             } else {
                 echo "<input name=\"layout\" type=\"checkbox\" value=\"1\" />";
             }
-            echo get_string("arrangebuttonshorizontally", "lesson")."<center>\n";
+            echo get_string("arrangebuttonshorizontally", "lesson")."\n";
             echo "<br />";
             if ($page->display) {
-                echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
+                echo "<input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
             } else {
-                echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\" />";
+                echo "<input name=\"display\" type=\"checkbox\" value=\"1\" />";
             }                
-            echo get_string("displayinleftmenu", "lesson")."<center>\n";
-            echo "</td></tr>\n";
+            echo get_string("displayinleftmenu", "lesson")."\n";
+            echo "</center></td></tr>\n";
             echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";
             break;
         case LESSON_CLUSTER :
             echo "<tr><td>";
         break;             
     }
-    // xhtml bug here 
+
     echo "</td></tr>\n";
     // get the answers in a set order, the id order
 
index 8162eb0780e1377a5daffe9252f78540feb00bde..4a0211bff90ff1ff499030051ccfc48e9aea1da9 100644 (file)
@@ -1258,7 +1258,7 @@ function lesson_unseen_question_jump($lesson, $user, $pageid) {
  * @param int $userid User id.
  * @return int Will return the page id of a branch table or end of lesson
  **/
-function lesson_unseen_branch_jump($lesson, $userid) {
+function lesson_unseen_branch_jump($lessonid, $userid) {
     if (!$retakes = count_records("lesson_grades", "lessonid", $lessonid, "userid", $userid)) {
         $retakes = 0;
     }
index 9d19bb3cb78d2896af645f3a9d71c22d753a4523..a195aa7e5d0d36dbc2f66af54c886b428b7982a1 100644 (file)
   border-left: 2px solid #4a4a4a;
 }
 
-
-/***
- ***  Use these to override lessonbutton class
- ***  Or just comment out all of lessonbutton class definitions and start from scratch below
- ***/
-
-/* for previous branch buttons only */
-.mod-lesson .previousbutton {
-}
-
-/* for next branch buttons only */
-.mod-lesson .nextbutton {
-}
-
-/* All other branch buttons */
-.mod-lesson .standardbutton {
-}
-
-/* Next classes are for branch table buttons when displayed horizontally */
-.mod-lesson .prevhorizontal,
-.mod-lesson .prevhorizontal div,
-.mod-lesson .nexthorizontal,
-.mod-lesson .nexthorizontal div,
-.mod-lesson .standardhorizontal,
-.mod-lesson .standardhorizontal div {
+/* Branch table buttons when displayed horizontally */
+.mod-lesson .branchbuttoncontainer.horizontal div,
+.mod-lesson .branchbuttoncontainer.horizontal form {
     display: inline;
 }
 
-/* Next classes are for branch table buttons when displayed vertically */
-.mod-lesson .prevvertical .lessonbutton,
-.mod-lesson .nextvertical .lessonbutton,
-.mod-lesson .standardvertical .lessonbutton {
+/* Branch table buttons when displayed vertically */
+.mod-lesson .branchbuttoncontainer.vertical .lessonbutton {
     padding: 5px;
 }
 
-/*  branchbuttoncontainer wraps around branch table buttons */
-.mod-lesson .branchbuttoncontainer {
-    text-align: center;
-    padding: 13px 3px 3px 3px;
-}
-
-.mod-lesson .branchbuttoncontainer form {
-    display: inline;
-}
-
 /***
  *** Lesson Progress Bar
  ***    Default styles for this are very basic right now.
index 51cdcd1f23a42bfe8425019176badfdfc1818cb7..d7723112b64812c5710a0533c34c29cba8a4a93e 100644 (file)
         
         // get the answers in a set order, the id order
         if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {
-            echo "<form id=\"answerform\" method =\"post\" action=\"lesson.php\" autocomplete=\"off\">";
-            echo '<fieldset class="invisiblefieldset">';
-            echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />";
-            echo "<input type=\"hidden\" name=\"action\" value=\"continue\" />";
-            echo "<input type=\"hidden\" name=\"pageid\" value=\"$pageid\" />";
-            echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
-            if (!$lesson->slideshow) {
-                if ($page->qtype != LESSON_BRANCHTABLE) {
-                    print_simple_box_start("center");
-                }                    
+            if ($page->qtype != LESSON_BRANCHTABLE) {  // To fix XHTML problem (BT have their own forms)
+                echo "<form id=\"answerform\" method =\"post\" action=\"lesson.php\" autocomplete=\"off\">";
+                echo '<fieldset class="invisiblefieldset">';
+                echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />";
+                echo "<input type=\"hidden\" name=\"action\" value=\"continue\" />";
+                echo "<input type=\"hidden\" name=\"pageid\" value=\"$pageid\" />";
+                echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
+                print_simple_box_start("center");
                 echo '<table width="100%">';
             }
             // default format text options
                 case LESSON_BRANCHTABLE :                  
                     $options = new stdClass;
                     $options->para = false;
-                    $buttons = array('next' => array(), 'prev' => array(), 'other' => array());
-                /// seperate out next and previous jumps from the other jumps 
+                    $buttons = array();
                     $i = 0;
                     foreach ($answers as $answer) {
-                        if ($answer->jumpto == LESSON_NEXTPAGE) {
-                            $type  = 'next';
-                            $class = 'nextbutton';
-                        } else if ($answer->jumpto == LESSON_PREVIOUSPAGE) {
-                            $type  = 'prev';
-                            $class = 'prevbutton';
-                        } else {
-                            $type  = 'other';
-                            $class = 'standardbutton';
-                        }
                         // Each button must have its own form inorder for it to work with JavaScript turned off
                         $button  = "<form id=\"answerform$i\" method=\"post\" action=\"$CFG->wwwroot/mod/lesson/lesson.php\">\n".
                                    '<div>'.
                                    "<input type=\"hidden\" name=\"pageid\" value=\"$pageid\" />\n".
                                    "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n".
                                    "<input type=\"hidden\" name=\"jumpto\" value=\"$answer->jumpto\" />\n".
-                                   lesson_print_submit_link(strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)), "answerform$i", '', $class, '', '', true).
+                                   lesson_print_submit_link(strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)), "answerform$i", '', '', '', '', true).
                                    '</div>'.
                                    '</form>';
                         
-                        $buttons[$type][] = $button;
+                        $buttons[] = $button;
                         $i++;
                     }
                     
                         $orientation = 'vertical';
                     }
                     
-                    $fullbuttonhtml = "\n<div class=\"branchbuttoncontainer\">\n    " .
-                                      "<div class=\"prev$orientation\">".implode("\n", $buttons['prev']).'</div>'.
-                                      "<div class=\"next$orientation\">".implode("\n", $buttons['other']).'</div>'.
-                                      "<div class=\"standard$orientation\">".implode("\n", $buttons['next']).'</div>'.
+                    $fullbuttonhtml = "\n<div class=\"branchbuttoncontainer $orientation\">\n" .
+                                      implode("\n", $buttons).
                                       "\n</div>\n";
                 
                     if ($lesson->slideshow) {
                         echo '</div><!--end slideshow div-->';
                         echo $fullbuttonhtml;
                     } else {
-                        echo '<tr><td></td></tr></table>'; // ends the answers table
-                        // When buttons are horizontal and inside the table, the button then line wraps when clicked in FF.
-                        //  Seems like the border-collapse might be the problem?  Easiest fix is to move the buttons outside
-                        //  of the table.
-                        print_simple_box_start('center');
                         echo $fullbuttonhtml;
-                        print_simple_box_end();
                     }
                     
                     break;
                     print_simple_box_end();
                 break;
             }
-            echo '</fieldset>';
-            echo "</form>\n"; 
+            if ($page->qtype != LESSON_BRANCHTABLE) {  // To fix XHTML problem (BT have their own forms)
+                echo '</fieldset>';
+                echo "</form>\n"; 
+            }
         } else {
             // a page without answers - find the next (logical) page
-            echo "<form id=\"pageform\" method =\"post\" action=\"$CFG->wwwroot/mod/lesson/view.php\">\n";
+            echo "<form id=\"pageform\" method=\"post\" action=\"$CFG->wwwroot/mod/lesson/view.php\">\n";
             echo '<div>';
             echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
             if ($lesson->nextpagedefault) {