From cb2c196306dfaf6a92196fe683d85beb993c8dad Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Wed, 28 Jul 2010 13:23:51 +0000 Subject: [PATCH] MDL-23542 adding support for cols and rows in textarea editor, fixing lesson to use smaller text areas --- lib/form/editor.php | 5 ++++- mod/lesson/locallib.php | 4 ++-- mod/lesson/pagetypes/matching.php | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/form/editor.php b/lib/form/editor.php index 35469afdca2..7ffa2dd0360 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -201,7 +201,10 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { /// print text area - TODO: add on-the-fly switching, size configuration, etc. $editor->use_editor($id, $this->_options, $fpoptions); - $str .= '
'; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 9cea1ee12e1..0133c95c334 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -784,7 +784,7 @@ abstract class lesson_add_page_form_base extends moodleform { if ($label === NULL) { $label = get_string('answer', 'lesson'); } - $this->_form->addElement('editor', 'answer_editor['.$count.']', $label, null, array('noclean'=>true)); + $this->_form->addElement('editor', 'answer_editor['.$count.']', $label, array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true)); $this->_form->setDefault('answer_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE)); if ($required) { $this->_form->addRule('answer_editor['.$count.']', get_string('required'), 'required', null, 'client'); @@ -802,7 +802,7 @@ abstract class lesson_add_page_form_base extends moodleform { if ($label === NULL) { $label = get_string('response', 'lesson'); } - $this->_form->addElement('editor', 'response_editor['.$count.']', $label, null, array('noclean'=>true)); + $this->_form->addElement('editor', 'response_editor['.$count.']', $label, array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true)); $this->_form->setDefault('response_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE)); if ($required) { $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client'); diff --git a/mod/lesson/pagetypes/matching.php b/mod/lesson/pagetypes/matching.php index a624bd9b516..60623b5040b 100644 --- a/mod/lesson/pagetypes/matching.php +++ b/mod/lesson/pagetypes/matching.php @@ -434,12 +434,12 @@ class lesson_add_page_form_matching extends lesson_add_page_form_base { public function custom_definition() { $this->_form->addElement('header', 'correctresponse', get_string('correctresponse', 'lesson')); - $this->_form->addElement('editor', 'answer_editor[0]', get_string('correctresponse', 'lesson'), null, array('noclean'=>true)); + $this->_form->addElement('editor', 'answer_editor[0]', get_string('correctresponse', 'lesson'), array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true)); $this->add_jumpto(0, get_string('correctanswerjump','lesson')); $this->add_score(0, get_string("correctanswerscore", "lesson")); $this->_form->addElement('header', 'wrongresponse', get_string('wrongresponse', 'lesson')); - $this->_form->addElement('editor', 'answer_editor[1]', get_string('wrongresponse', 'lesson'), null, array('noclean'=>true)); + $this->_form->addElement('editor', 'answer_editor[1]', get_string('wrongresponse', 'lesson'), array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true)); $this->add_jumpto(1, get_string('wronganswerjump','lesson')); $this->add_score(1, get_string("wronganswerscore", "lesson"));