diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index c65a6cafb14..c38dbe9e162 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1307,6 +1307,7 @@ abstract class lesson_add_page_form_base extends moodleform { * and then calls custom_definition(); */ public final function definition() { + global $CFG; $mform = $this->_form; $editoroptions = $this->_customdata['editoroptions']; @@ -1334,8 +1335,12 @@ abstract class lesson_add_page_form_base extends moodleform { $mform->setType('qtype', PARAM_INT); $mform->addElement('text', 'title', get_string('pagetitle', 'lesson'), array('size'=>70)); - $mform->setType('title', PARAM_TEXT); $mform->addRule('title', get_string('required'), 'required', null, 'client'); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('title', PARAM_TEXT); + } else { + $mform->setType('title', PARAM_CLEANHTML); + } $this->editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$this->_customdata['maxbytes']); $mform->addElement('editor', 'contents_editor', get_string('pagecontents', 'lesson'), null, $this->editoroptions); diff --git a/mod/lesson/pagetypes/branchtable.php b/mod/lesson/pagetypes/branchtable.php index dec96a9bd09..98380698944 100644 --- a/mod/lesson/pagetypes/branchtable.php +++ b/mod/lesson/pagetypes/branchtable.php @@ -315,7 +315,7 @@ class lesson_add_page_form_branchtable extends lesson_add_page_form_base { protected $standard = false; public function custom_definition() { - global $PAGE; + global $PAGE, $CFG; $mform = $this->_form; $lesson = $this->_customdata['lesson']; @@ -338,8 +338,12 @@ class lesson_add_page_form_branchtable extends lesson_add_page_form_base { $mform->setType('qtype', PARAM_INT); $mform->addElement('text', 'title', get_string("pagetitle", "lesson"), array('size'=>70)); - $mform->setType('title', PARAM_TEXT); $mform->addRule('title', null, 'required', null, 'server'); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('title', PARAM_TEXT); + } else { + $mform->setType('title', PARAM_CLEANHTML); + } $this->editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$PAGE->course->maxbytes); $mform->addElement('editor', 'contents_editor', get_string("pagecontents", "lesson"), null, $this->editoroptions); diff --git a/mod/lesson/pagetypes/cluster.php b/mod/lesson/pagetypes/cluster.php index 31c01b3ae59..c093c07f912 100644 --- a/mod/lesson/pagetypes/cluster.php +++ b/mod/lesson/pagetypes/cluster.php @@ -96,7 +96,7 @@ class lesson_add_page_form_cluster extends lesson_add_page_form_base { protected $standard = false; public function custom_definition() { - global $PAGE; + global $PAGE, $CFG; $mform = $this->_form; $lesson = $this->_customdata['lesson']; @@ -109,7 +109,11 @@ class lesson_add_page_form_cluster extends lesson_add_page_form_base { $mform->setType('qtype', PARAM_TEXT); $mform->addElement('text', 'title', get_string("pagetitle", "lesson"), array('size'=>70)); - $mform->setType('title', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('title', PARAM_TEXT); + } else { + $mform->setType('title', PARAM_CLEANHTML); + } $this->editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$PAGE->course->maxbytes); $mform->addElement('editor', 'contents_editor', get_string("pagecontents", "lesson"), null, $this->editoroptions); diff --git a/mod/lesson/pagetypes/endofbranch.php b/mod/lesson/pagetypes/endofbranch.php index 97a64835331..568f58a1421 100644 --- a/mod/lesson/pagetypes/endofbranch.php +++ b/mod/lesson/pagetypes/endofbranch.php @@ -124,7 +124,7 @@ class lesson_add_page_form_endofbranch extends lesson_add_page_form_base { protected $standard = false; public function custom_definition() { - global $PAGE; + global $PAGE, $CFG; $mform = $this->_form; $lesson = $this->_customdata['lesson']; @@ -137,7 +137,11 @@ class lesson_add_page_form_endofbranch extends lesson_add_page_form_base { $mform->setType('qtype', PARAM_TEXT); $mform->addElement('text', 'title', get_string("pagetitle", "lesson"), array('size'=>70)); - $mform->setType('title', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('title', PARAM_TEXT); + } else { + $mform->setType('title', PARAM_CLEANHTML); + } $this->editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$PAGE->course->maxbytes); $mform->addElement('editor', 'contents_editor', get_string("pagecontents", "lesson"), null, $this->editoroptions); diff --git a/mod/lesson/pagetypes/endofcluster.php b/mod/lesson/pagetypes/endofcluster.php index 8a0aaade21d..207297a835c 100644 --- a/mod/lesson/pagetypes/endofcluster.php +++ b/mod/lesson/pagetypes/endofcluster.php @@ -104,7 +104,7 @@ class lesson_add_page_form_endofcluster extends lesson_add_page_form_base { protected $standard = false; public function custom_definition() { - global $PAGE; + global $PAGE, $CFG; $mform = $this->_form; $lesson = $this->_customdata['lesson']; @@ -117,7 +117,11 @@ class lesson_add_page_form_endofcluster extends lesson_add_page_form_base { $mform->setType('qtype', PARAM_TEXT); $mform->addElement('text', 'title', get_string("pagetitle", "lesson"), array('size'=>70)); - $mform->setType('title', PARAM_TEXT); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('title', PARAM_TEXT); + } else { + $mform->setType('title', PARAM_CLEANHTML); + } $this->editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$PAGE->course->maxbytes); $mform->addElement('editor', 'contents_editor', get_string("pagecontents", "lesson"), null, $this->editoroptions);