From 259990d2c654aad551afd1aae09aee69b074f159 Mon Sep 17 00:00:00 2001 From: mark-nielsen Date: Sat, 9 Sep 2006 21:39:11 +0000 Subject: [PATCH] Lesson buttons should now work with javascript disabled Also improved the layout of action/continue.html --- mod/lesson/action/continue.html | 191 +++++++++++++++++++------------- mod/lesson/locallib.php | 34 ++++++ mod/lesson/styles.php | 13 +++ mod/lesson/view.php | 34 +++--- 4 files changed, 176 insertions(+), 96 deletions(-) diff --git a/mod/lesson/action/continue.html b/mod/lesson/action/continue.html index e1743b3a2e..83cdb2655f 100644 --- a/mod/lesson/action/continue.html +++ b/mod/lesson/action/continue.html @@ -7,12 +7,15 @@ **/ ?> + + + + displayleft) { - if($firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) { -?> -
- +// Displaying left menu + if($firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) { ?> + -
@@ -25,84 +28,118 @@ if ($lesson->displayleft) {
- + displayleft) ?> + + + +displayleft) { // Skip navigation anchor ?> + + + + -timed and !has_capability('mod/lesson:manage', $context)) { - // code for the clock - print_simple_box_start("right", "150px", "#ffffff", 0); -?> - - - - - - - -
- '); - window.onload = function () { show_clock(); } - -
- -



-timed) { - -// This calculates and prints the ongoing score message -if ($lesson->ongoing) { - lesson_print_ongoing_score($lesson); -} +ongoing) { + lesson_print_ongoing_score($lesson); + } ?> - - - - -
- -
- - - - -modattempts[$lesson->id])) { ?> -



-

- -
-

-

- -

- -

-review && !$correctanswer && !$noanswer && !$isessayquestion) { ?> -

-

- -
-

-

- -
-

- -

-

- -
-

+ + + + + +
+ +modattempts[$lesson->id])) { // User is modifying attempts - save button and some instructions ?> + + + + + + +

+ +

+

+ +

+

+ +

+

+ +

+ +
+ + +review && !$correctanswer && !$noanswer && !$isessayquestion) { // Review button back ?> + +
+ + + + +

+ +

+ +
+ + + +
+ + + + +review && !$correctanswer && !$noanswer && !$isessayquestion) { // Review button continue ?> + +

+ +

+ + + +

+ +

+ -
-displayleft) { ?> -
- \ No newline at end of file + + + + +timed and !has_capability('mod/lesson:manage', $context)) { // Display for timed lessons and for students only ?> + + + + + + + + + +
+ +
+ +timed) { ?> + + + + \ No newline at end of file diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index ec589c4ad1..3828595454 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -335,6 +335,40 @@ function lesson_print_messages() { return true; } +/** + * Prints a lesson link that submits a form. + * + * If Javascript is disabled, then a regular submit button is printed + * + * @return mixed boolean/html + **/ +function lesson_print_submit_link($name, $form, $align = 'center', $class='standardbutton', $title = '', $id = '', $return = false) { + if (!empty($id)) { + $id = " id=\"$id\""; + } + if (empty($title)) { + $title = $name; + } + + $output = "
\n"; + $output .= " + \n"; + $output .= "
\n"; + + if ($return) { + return $output; + } else { + echo $output; + return true; + } +} + /** * Given some question info and some data about the the answers * this function parses, organises and saves the question diff --git a/mod/lesson/styles.php b/mod/lesson/styles.php index 54c5718fe2..e1606583ab 100644 --- a/mod/lesson/styles.php +++ b/mod/lesson/styles.php @@ -6,6 +6,19 @@ text-align: left; } +/*** + *** Style for view.php + ***/ + +#mod-lesson-view .password-form { + text-align: center; + margin-top: 20px; +} + +#mod-lesson-view .password-form .submitbutton { + display: inline; +} + /*** *** Style for essay.php ***/ diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 02267043e4..e89a532596 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -141,6 +141,7 @@ } if (!$correctpass) { + echo "
\n"; print_simple_box_start('center'); echo '
' . "\n"; echo '' . "\n"; @@ -148,14 +149,14 @@ if (optional_param('userpassword', 0, PARAM_CLEAN)) { notify(get_string('loginfail', 'lesson')); } - echo "
\n". - get_string('passwordprotectedlesson', 'lesson', format_string($lesson->name))."

\n". - get_string('enterpassword', 'lesson')."

\n"; - - echo ''. get_string('cancel', 'lesson') .' '. - ' '. get_string('continue', 'lesson') .''. - "
\n"; + + echo get_string('passwordprotectedlesson', 'lesson', format_string($lesson->name))."

\n". + get_string('enterpassword', 'lesson')."

\n". + ''. get_string('cancel', 'lesson') .' '; + + lesson_print_submit_link(get_string('continue', 'lesson'), 'password', 'center', 'standardbutton submitbutton'); print_simple_box_end(); + echo "
\n"; exit(); } } @@ -719,8 +720,7 @@ ": \n"; echo ''; print_simple_box_end(); - echo "
". - get_string("pleaseenteryouranswerinthebox", "lesson")."

\n"; + lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform'); break; case LESSON_TRUEFALSE : shuffle($answers); @@ -743,8 +743,7 @@ } echo ''; print_simple_box_end(); - echo "
". - get_string("pleasecheckoneanswer", "lesson")."
\n"; + lesson_print_submit_link(get_string('pleasecheckoneanswer', 'lesson'), 'answerform'); break; case LESSON_MULTICHOICE : $i = 0; @@ -784,12 +783,11 @@ echo ''; print_simple_box_end(); if ($page->qoption) { - echo "
". - get_string("pleasecheckoneormoreanswers", "lesson")."
\n"; + $linkname = get_string('pleasecheckoneormoreanswers', 'lesson'); } else { - echo "
". - get_string("pleasecheckoneanswer", "lesson")."
\n"; + $linkname = get_string('pleasecheckoneanswer', 'lesson'); } + lesson_print_submit_link($linkname, 'answerform'); break; case LESSON_MATCHING : @@ -835,8 +833,7 @@ } echo ''; print_simple_box_end(); - echo "
". - get_string("pleasematchtheabovepairs", "lesson")."
\n"; + lesson_print_submit_link(get_string('pleasematchtheabovepairs', 'lesson'), 'answerform'); break; case LESSON_BRANCHTABLE : $options = new stdClass; @@ -910,8 +907,7 @@ '\n"; echo ''; print_simple_box_end(); - echo '
'. - get_string("pleaseenteryouranswerinthebox", "lesson")."
\n"; + lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform'); break; } echo "\n"; -- 2.39.5