How to change defaults in lesson questions?

How to change defaults in lesson questions?

by brian avery -
Number of replies: 16

In 2.0, when you add a question page, each of the question and answer boxes have the option of html or moodle format. The default is moodle format.

In this format you have no access to the 'remove glossary autolink' button. I need to remove the glossary autolink for every answer in every question. At present that entails me selecting html format for each question and then saving the question, then opening each question again and then removing the autolink.

Is there a way to change the default display for the question boxes to html format? It would halve the time it takes to edit a question - handy when you're trying to build a flashcard lesson...

Thanks for any tips.

Average of ratings: -
In reply to brian avery

Re: How to change defaults in lesson questions?

by brian avery -

Related to the original post:

Having manually changed the editor in question box from moodle format to html, I chose the 'prevent autolinking' option for all my answer text. Having done that for a batch of questions I previewed the lesson.

Changing from moodle to html format and then using prevent autolink has changed the question output. See the two attached images:

1:  Using moodle format without prevent autolink:

moodle format

2:  Using html format with prevent autolink

2

 

I've viewed the lesson as a student (fresh log-in), purged caches and so on. It alters nothing.

I created a new question (image 1) to see where the changes occurred.
Creating and saving the image using moodle format gave the output in image 1.
Changing to html format and then saving the question did not change the output.
After I applied the prevent autolinking option the output changed the output to that seem in image 2.
I actually repeated the above process twice, creating new questions each time (hence slight difference in the questions shown) but the outcome was the same.

How can I get around this? The formatting looks silly if I prevent autolinking, but if I permit autolinking the definitions for each answer choice are diaplyed for students.

Either way, it's far from ideal!

(Using the latest 2.0.1 release, I should have added.)

Any suggestions would be appreciated.

Brian

In reply to brian avery

Re: Disabling filters in 2.0 lessons

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Brian,

As mentioned in another discussion, in Moodle 2.0 you can switch off particular filters at activity level. Thus, you can disable glossary autolinking for your lesson via Settings > Lesson administration > Filters.

Average of ratings: Useful (1)
In reply to Helen Foster

Re: Disabling filters in 2.0 lessons

by brian avery -

Thanks Helen,

I didn't spot that.  However, I go back to my previous comment - why disable glossaries inside lessons, the place where they're most needed?

All I want to do is stop autolink messing up question formatting. 
I want - need - glossary autolinking in lesson!

Interesting though, that you can disable autolinking at an activity level. I'm going to switch it off for quizzes, that's for sure!

Brian

In reply to brian avery

Re: Disabling filters in 2.0 lessons

by brian avery -

As a further example, if you only prevent autolink for one answer of several, you get what you see in the attached image:

honey

In reply to brian avery

Re: Disabling filters in 2.0 lessons

by Guido Hornig -
Picture of Plugin developers

I have the same problem. (moodle 2.5.3)

And I can't see any relation with Auto-Link on or off.

After switching to HTML-editor , the <p> </p> Tag is added.

with

SELECT *
FROM `mdl_lesson_answers`
WHERE `answerformat` =1

you can find all the answers that use HTML.

 

In reply to brian avery

Re: Disabling filters in 2.0 lessons

by Chris Collman -
Picture of Documentation writers

Hi Brian,

We use questions in a lesson to slow down speed clickers (in an attempt to turn them into learners).  Having a glossary working would still be educational but not as effective as throwing them back 20 pages to review the material smile

Chris

In reply to Chris Collman

Re: Disabling filters in 2.0 lessons

by brian avery -

Hi,

Well being able to disable it for individual quizzes is handy - especially for the flashcard-type lesson. I've looked and realised that I've disabled it in about one in five lessons - where the glossary would be counter-productive or I have other aims.

And yes, I've been playing with jumps too. Quite handy little tools.

However, I still wonder about the formatting question that I started out with.

Brian

In reply to Helen Foster

Re: Disabling filters in 2.0 lessons

by brian avery -

Helen,

Happy new year, first.

I misread your post - didn't realise you meant for individual lessons as opposed to all lessons. Have used that option now.

However, I had to delete and rebuild the original lesson. Why? Well, having used the 'prevent autolink' option and seen the change in formatting I followed your advice and turned off autolink for the lesson. Then I went to remove the 'prevent autolink' options for each and every question. However, having done that, and despite clearing moodle and browser caches, the output format (the visible formatting) didn't change one iota. It refused to revert to its original (better formatted) state. Really odd.

However, regardless of the fact that there is a work-around, this must be some sort of bug so I've added tracker MDL-25842

In reply to brian avery

Markup messup

by Mark Penny -

The persistent formatting issue is probably due to code (markup) lingering in the database. You might take a peek at _lesson_answers. If you see any markup in any answer or response field, edit it out.

My guess is that any format but Moodle auto-format will produce markup which will interfere with questions.

In reply to brian avery

Re: How to change defaults in lesson questions?

by Mark Penny -

Your formatting issue may be caused by paragraphing code in the response field.

In reply to brian avery

2.0 Change Default from Moodle auto format to HTML in a question

by Chris Collman -
Picture of Documentation writers

Hi Brian,

In demo.moodle.net the content area default appears to be HTML and the feedback/response and answer areas appear to be Moodle auto format.  Clueless how to change the default Moodle auto to HTML.  Could be in the code (ugh, technical term used by ignorant).

I am changing the subject and hope that the after the Holiday crowd will have an answer.  How to change the editor default in the feedback/response/answer area.

I dug around Moodle.org and demo.moodle with some searches. Found a post over in the HTML editor forum ( cira Nov 2010) where someone had Moodle auto format and it switched to HTML format and they wanted to switch it back in their forumssmile   

Changing the editor in profile did not seem to help in demo.moodle.  Plus the default was HTML and the alternative was plain text.  There were 4 editoring formats, which also included markdown and plain text.   Moodle ignored my profile change where the default was set to plain text.

Let us see if anyone has a better clue.  Shoot me a message and I will move this to the HTML forum.

 

Chris

In reply to Chris Collman

Re: 2.0 Change Default from Moodle auto format to HTML in a question

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

yes - I would like to know the answer to this toosmile

In reply to Chris Collman

Re: 2.0 Change Default from Moodle auto format to HTML in a question

by brian avery -

Wonderful idea! I'm glad you didn't find an easy answer though - I was thinking it was just me being stupid and looking in the wrong places, but now I just know there isn't an easy answer!

Brian

In reply to Chris Collman

Re: 2.0 Change Default from Moodle auto format to HTML in a question

by Tyler Bogdan -

I realize this is a long-dead post but my googling lead me here and the answer was not here and I had to figure it out myself!

If you want to change the default Answer and Response format in moodle to HTML instead of having to change it to HTML, save, then re-edit then this is the solution I came up with.  I couldn't find an easy way to do this, (I'm running moodle 2.7) the only way I found to do it was to modify the code.

I only did this for question pages, I am not sure if it can be done for other pages as well.  Find the functions called "add_answer" and "add_response" in the /mod/lesson/locallib.php file.  Change the these lines:

From add_answer:

$this->_form->setDefault('answer_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE));

to

$this->_form->setDefault('answer_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_HTML));


From add_response:

$this->_form->setDefault('response_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE));

to

$this->_form->setDefault('response_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_HTML));


I hope this helps someone besides me!

In reply to Tyler Bogdan

Re: 2.0 Change Default from Moodle auto format to HTML in a question

by Jean-Michel Védrine -

Hello Tyler,

Just a note that this is corrected in Moodle 2.8.x (fixed at the same time I added a filepicker to answers and responses editors)

Average of ratings: Useful (1)
In reply to brian avery

Re: How to change defaults in lesson questions?

by Isabelle Langeveld -

Thank you so much for explaining on the side how to get the HTML-editor working in answers and responses! Didn't understand the documentation. How could I have known it was a question of saving the page after changing Modle auto format in all the boxes to HTML format???

Nevertheless, it would be great if HTML would be the default for all te boxes where one can edit in the Lesson, just like the Quiz.