MDL-23264 page title and content now required + fixed wrong cleaning - noclean must be used with PARAM_RAW

This commit is contained in:
Petr Skoda
2010-07-25 09:11:17 +00:00
parent 10b8fefdf2
commit 3fa2f030c3
+9 -6
View File
@@ -710,22 +710,25 @@ abstract class lesson_add_page_form_base extends moodleform {
if ($this->standard === true) {
$mform->addElement('hidden', 'qtype');
$mform->setType('qtype', PARAM_TEXT);
$mform->setType('qtype', PARAM_SAFEDIR);
$mform->addElement('text', 'title', get_string("pagetitle", "lesson"), array('size'=>70));
$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');
$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);
$mform->setType('contents_editor', PARAM_CLEANHTML);
$mform->addElement('editor', 'contents_editor', get_string('pagecontents', 'lesson'), null, $this->editoroptions);
$mform->setType('contents_editor', PARAM_RAW);
$mform->addRule('contents_editor', get_string('required'), 'required', null, 'client');
}
$this->custom_definition();
if ($this->_customdata['edit'] === true) {
$mform->addElement('hidden', 'edit', 1);
$this->add_action_buttons(get_string('cancel'), get_string("savepage", "lesson"));
$this->add_action_buttons(get_string('cancel'), get_string('savepage', 'lesson'));
} else {
$this->add_action_buttons(get_string('cancel'), get_string("addaquestionpage", "lesson"));
$this->add_action_buttons(get_string('cancel'), get_string('addaquestionpage', 'lesson'));
}
}