Merging in fixes for MDL-8414 and MDL-9250 from MOODLE_18_STABLE

This commit is contained in:
mark-nielsen 2007-04-08 21:02:16 +00:00
parent c786e13547
commit 362f2ce973
4 changed files with 30 additions and 83 deletions

View File

@ -130,15 +130,15 @@
} 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 :
@ -157,7 +157,7 @@
echo "<tr><td>";
break;
}
// xhtml bug here
echo "</td></tr>\n";
// get the answers in a set order, the id order

View 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;
}

View File

@ -178,51 +178,17 @@
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.

View File

@ -539,16 +539,14 @@
// 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
@ -687,20 +685,9 @@
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>'.
@ -709,11 +696,11 @@
"<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++;
}
@ -724,10 +711,8 @@
$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) {
@ -737,13 +722,7 @@
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;
@ -765,11 +744,13 @@
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) {