Skip to content

Commit

Permalink
MDL-23264 page title and content now required + fixed wrong cleaning …
Browse files Browse the repository at this point in the history
…- noclean must be used with PARAM_RAW
  • Loading branch information
skodak committed Jul 25, 2010
1 parent 10b8fef commit 3fa2f03
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mod/lesson/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,22 +710,25 @@ public final function definition() {

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'));
}
}

Expand Down

0 comments on commit 3fa2f03

Please sign in to comment.