Lesson Answer Alignment

Lesson Answer Alignment

by Asana Draper -
အကြောင်းပြန်မှု အရေအတွက်: 10

Hope this is the correct forum to post this.

I am having difficulties aligning the answers for Multiple Choice questions in Internet Explorer.  I was finally able to left align the text, but the entire box is 100%.  I would like Internet Explorer to display answers like Firefox does.

I assume this is something in the layout.css that should be added/changed but I can't figure out what!

Here's an illustration of what I am wanting...

answers.gif

Any suggestions would be much appreciated!

ပျှမ်းမျှအဆင့်သတ်မှတ်ချက်များ: -
Asana Draper ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by ben reynolds -
If I remember rightly, this is because FF (inheriting its tendancy from Netscape) builds tables from right to left, but IE builds from left to right.

I'm not knowledgeable about .css, but wherever the table is designed is where you want to look.
Asana Draper ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Kristy Hutapea -
Hey there,

try editing the view.php file in mod/lesson/view.php

approx line 615ish (or look for where theres the case for multiple choice questions).

set a width to the table column that holds the radio button.

Hope that works for you!

case LESSON_MULTICHOICE :

 $i = 0;

 shuffle($answers);

 foreach ($answers as $answer) {

 echo '<tr><td valign="top" width="10px">';

 if ($page->qoption) {

 $checked = '';

 if (isset($USER->modattempts[$lesson->id])) {

 $answerids = explode(",", $attempt->useranswer);

 if (in_array($answer->id, $answerids)) {

 $checked = ' checked="checked"';

  } else {

 $checked = '';

 }

 }


Kristy Hutapea ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Asana Draper -
Thank you so much - this worked! However, I didn't put in pixels, just added this (Line 665 in my view.php page):

case LESSON_MULTICHOICE :
$i = 0;
shuffle($answers);

foreach ($answers as $answer) {
echo '<tr><td valign="top" width="20">';
if ($page->qoption) {
$checked = '';
if (isset($USER->modattempts[$lesson->id])) {
$answerids = explode(",", $attempt->useranswer);
if (in_array($answer->id, $answerids)) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
}

Now I would like table width to be resized according to the length of the answers instead of the full browser/window size. These all look so great in Firefox....Internet Explorer is another story - such a pain!
Asana Draper ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Joseph Rézeau -
Core developers ၏ ရုပ်ပုံ Particularly helpful Moodlers ၏ ရုပ်ပုံ Plugin developers ၏ ရုပ်ပုံ Testers ၏ ရုပ်ပုံ Translators ၏ ရုပ်ပုံ

Hi Asana,

Which version of Moodle are you using? and which theme? I do not see what you report. For me, the display problem is exactly the same in FireFox (3) and MSIE (8), that is to say there is too much horizontal space wasted to the right of the radio buttons. See attached, using standard theme in moodle 1.9.

Joseph

Attachment image00.jpg
Joseph Rézeau ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Asana Draper -
I am still having this problem. We are using Moodle 1.9 and the theme is a customized theme using the formal white and then standard theme defaults. I have tried inputing the alignment properties in what I think is the correct <td> in the view.php page where LESSON_MULTICHOICE table is, but nothing changes???

I am stumped and can't believe there aren't more people with this problem!
Asana Draper ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Joseph Rézeau -
Core developers ၏ ရုပ်ပုံ Particularly helpful Moodlers ၏ ရုပ်ပုံ Plugin developers ၏ ရုပ်ပုံ Testers ၏ ရုပ်ပုံ Translators ၏ ရုပ်ပုံ

Hello Asana,

Here is an all-CSS solution, which I have tested with the formal white theme, a theme commonly used in moodle 1.9. You can add the following rules at the end of one of your current theme's CSS files. I have not tested this extensively with all question types, so please test before using on a moodle production site and report here if any problems occur.

#mod-lesson-view #answerform .box.generalbox.generalboxcontent.boxaligncenter {float:left;}
#mod-lesson-view #answerform .lessonbutton {clear:both;}

If you want to retain the matching question type display centered, add this 3rd line:

#mod-lesson-view #answerform .box.generalbox.generalboxcontent.boxaligncenter select {float:none;}

Joseph

Attachment image00.jpg
Joseph Rézeau ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Joseph Rézeau -
Core developers ၏ ရုပ်ပုံ Particularly helpful Moodlers ၏ ရုပ်ပုံ Plugin developers ၏ ရုပ်ပုံ Testers ၏ ရုပ်ပုံ Translators ၏ ရုပ်ပုံ
Hello Asana,
Did my solution help?
Joseph
Joseph Rézeau ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Joseph Rézeau -
Core developers ၏ ရုပ်ပုံ Particularly helpful Moodlers ၏ ရုပ်ပုံ Plugin developers ၏ ရုပ်ပုံ Testers ၏ ရုပ်ပုံ Translators ၏ ရုပ်ပုံ
Joseph Rézeau ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Gudmundur Sigurfreyr -
Thanks a lot. This solution solved my problem with this issue. I tested it with FF 3.6.10 and IE 8.
Joseph Rézeau ထံသို့ အကြောင်းပြန်ရာတွင်

Re: Lesson Answer Alignment

by Katie Fraser -

Hi Joseph,

I am using Firefox and IE, Moodle 1.911...

Trying to make the fix you outline above but not sure which CSS style page to open in my theme folder. (FYI:  I'm using the "Anomaly" theme). Could you tell me from screen shot below what page I need to open in order to apply your fix? Thank you-

Katie