MDL-31852 mod_lesson: Allow html tag in lesson's pages
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user