From c76cd2ede13ac6a60ddf30344752ed05613309fd Mon Sep 17 00:00:00 2001 From: Joseph Rezeau Date: Fri, 18 Feb 2011 10:43:25 +0100 Subject: [PATCH 1/2] MDL-26113 Lesson: temporary fix of page content alignment That rendering method should not use cell style attribute at all. Instead, the alignment should be controlled by CSS. However, this will require more massive changes in the Lesson code to be done by the module maintainer. As a temporary fix, left alignment is set as it usually matches the layout that students see. --- mod/lesson/renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/lesson/renderer.php b/mod/lesson/renderer.php index 82ad996f008..696b8b98a0b 100644 --- a/mod/lesson/renderer.php +++ b/mod/lesson/renderer.php @@ -283,7 +283,7 @@ class mod_lesson_renderer extends plugin_renderer_base { $cell = new html_table_cell(); $cell->colspan = 2; - $cell->style = 'text-align:center'; + $cell->style = 'text-align:left'; $cell->text = $page->contents; $pagetable->data[] = new html_table_row(array($cell)); From ffdf7f8a24cab276433de88d2328b8821bd1714d Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Fri, 18 Feb 2011 11:43:24 +0100 Subject: [PATCH 2/2] MDL-25899 Lesson: fixed page content rendering Form element 'header' used to be used for rendering the page contents. This led to layout problems in non-gecko browsers. This patch fixes the issue by using raw 'html' element to render the page contents. --- mod/lesson/pagetypes/essay.php | 6 ++++-- mod/lesson/pagetypes/matching.php | 6 ++++-- mod/lesson/pagetypes/multichoice.php | 9 +++++++-- mod/lesson/pagetypes/numerical.php | 6 ++++-- mod/lesson/pagetypes/shortanswer.php | 4 +++- mod/lesson/pagetypes/truefalse.php | 6 ++++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/mod/lesson/pagetypes/essay.php b/mod/lesson/pagetypes/essay.php index 2ae796f072f..2f7d4f9b485 100644 --- a/mod/lesson/pagetypes/essay.php +++ b/mod/lesson/pagetypes/essay.php @@ -252,7 +252,9 @@ class lesson_display_answer_form_essay extends moodleform { $mform = $this->_form; $contents = $this->_customdata['contents']; - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; @@ -270,4 +272,4 @@ class lesson_display_answer_form_essay extends moodleform { $this->add_action_buttons(null, get_string("pleaseenteryouranswerinthebox", "lesson")); } -} \ No newline at end of file +} diff --git a/mod/lesson/pagetypes/matching.php b/mod/lesson/pagetypes/matching.php index 43335c0267e..3e40c63f92a 100644 --- a/mod/lesson/pagetypes/matching.php +++ b/mod/lesson/pagetypes/matching.php @@ -483,7 +483,9 @@ class lesson_display_answer_form_matching extends moodleform { $lessonid = $this->_customdata['lessonid']; $contents = $this->_customdata['contents']; - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; @@ -514,4 +516,4 @@ class lesson_display_answer_form_matching extends moodleform { $this->add_action_buttons(null, get_string("pleasematchtheabovepairs", "lesson")); } -} \ No newline at end of file +} diff --git a/mod/lesson/pagetypes/multichoice.php b/mod/lesson/pagetypes/multichoice.php index a9d912fb0d4..f29268fe679 100644 --- a/mod/lesson/pagetypes/multichoice.php +++ b/mod/lesson/pagetypes/multichoice.php @@ -485,7 +485,10 @@ class lesson_display_answer_form_multichoice_singleanswer extends moodleform { $attempt = new stdClass(); $attempt->answerid = null; } - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; @@ -524,7 +527,9 @@ class lesson_display_answer_form_multichoice_multianswer extends moodleform { $lessonid = $this->_customdata['lessonid']; $contents = $this->_customdata['contents']; - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; diff --git a/mod/lesson/pagetypes/numerical.php b/mod/lesson/pagetypes/numerical.php index 56b1784678d..18fb54fa2c5 100644 --- a/mod/lesson/pagetypes/numerical.php +++ b/mod/lesson/pagetypes/numerical.php @@ -264,7 +264,9 @@ class lesson_display_answer_form_numerical extends moodleform { $mform = $this->_form; $contents = $this->_customdata['contents']; - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; @@ -282,4 +284,4 @@ class lesson_display_answer_form_numerical extends moodleform { $this->add_action_buttons(null, get_string("pleaseenteryouranswerinthebox", "lesson")); } -} \ No newline at end of file +} diff --git a/mod/lesson/pagetypes/shortanswer.php b/mod/lesson/pagetypes/shortanswer.php index 62e0a8ef6f7..821d6147fd1 100644 --- a/mod/lesson/pagetypes/shortanswer.php +++ b/mod/lesson/pagetypes/shortanswer.php @@ -331,7 +331,9 @@ class lesson_display_answer_form_shortanswer extends moodleform { $mform = $this->_form; $contents = $this->_customdata['contents']; - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass; $options->para = false; diff --git a/mod/lesson/pagetypes/truefalse.php b/mod/lesson/pagetypes/truefalse.php index 5bdbe2224fe..61a1a7e343d 100644 --- a/mod/lesson/pagetypes/truefalse.php +++ b/mod/lesson/pagetypes/truefalse.php @@ -299,7 +299,9 @@ class lesson_display_answer_form_truefalse extends moodleform { $attempt->answerid = null; } - $mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents')); + $mform->addElement('header', 'pageheader'); + + $mform->addElement('html', $OUTPUT->container($contents, 'contents')); $options = new stdClass(); $options->para = false; @@ -326,4 +328,4 @@ class lesson_display_answer_form_truefalse extends moodleform { $this->add_action_buttons(null, get_string("pleasecheckoneanswer", "lesson")); } -} \ No newline at end of file +}