<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="type"/>
<FIELD NAME="type" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="general" SEQUENCE="false" ENUM="true" ENUMVALUES="'single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'" PREVIOUS="course" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="intro"/>
- <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="assessed"/>
- <FIELD NAME="assessed" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="assesstimestart"/>
+ <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
+ <FIELD NAME="introformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="text format of intro field" PREVIOUS="intro" NEXT="assessed"/>
+ <FIELD NAME="assessed" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="assesstimestart"/>
<FIELD NAME="assesstimestart" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="assessed" NEXT="assesstimefinish"/>
<FIELD NAME="assesstimefinish" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="assesstimestart" NEXT="scale"/>
<FIELD NAME="scale" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="assesstimefinish" NEXT="maxbytes"/>
upgrade_mod_savepoint($result, 2009042002, 'forum');
}
+ if ($result && $oldversion < 2009042003) {
+
+ /// Define field introformat to be added to forum
+ $table = new xmldb_table('forum');
+ $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+ /// Launch add field introformat
+ $dbman->add_field($table, $field);
+
+ /// forum savepoint reached
+ upgrade_mod_savepoint($result, 2009042003, 'forum');
+ }
return $result;
}
}
}
- $forum->intro = shorten_text(trim(format_text($forum->intro, FORMAT_HTML, $introoptions)), $CFG->forum_shortpost);
+ $forum->intro = shorten_text(trim(format_text($forum->intro, $forum->introformat, $introoptions)), $CFG->forum_shortpost);
$forumname = format_string($forum->name, true);;
if ($cm->visible) {
}
$introoptions->para=false;
- $forum->intro = shorten_text(trim(format_text($forum->intro, FORMAT_HTML, $introoptions)), $CFG->forum_shortpost);
+ $forum->intro = shorten_text(trim(format_text($forum->intro, $forum->introformat, $introoptions)), $CFG->forum_shortpost);
if ($cm->sectionnum != $currentsection) {
$printsection = $cm->sectionnum;
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
- $mform->addElement('format', 'format', get_string('format'));
+ $mform->addElement('format', 'introformat', get_string('format'));
$options = array();
$options[0] = get_string('no');
} else {
$forum->intro = trim($forum->intro);
if (!empty($forum->intro)) {
- print_box(format_text($forum->intro), 'generalbox', 'intro');
+ $options = (object)array('noclean'=>true);
+ print_box(format_text($forum->intro, $forum->introformat, $options), 'generalbox', 'intro');
}
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009042002;
+$module->version = 2009042003;
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 60;
if (!empty($forum->intro)) {
$options = new stdclass;
$options->para = false;
- print_box(format_text($forum->intro, FORMAT_MOODLE, $options), 'generalbox', 'intro');
+ $options->noclean = true;
+ print_box(format_text($forum->intro, $forum->introformat, $options), 'generalbox', 'intro');
}
echo '<p class="mdl-align">';
if (forum_user_can_post_discussion($forum, null, -1, $cm)) {
if (!empty($forum->intro)) {
$options = new stdclass;
$options->para = false;
- print_box(format_text($forum->intro, FORMAT_MOODLE, $options), 'generalbox', 'intro');
+ $options->noclean = true;
+ print_box(format_text($forum->intro, $forum->introformat, $options), 'generalbox', 'intro');
}
echo '<br />';
if (!empty($showall)) {
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="intro"/>
- <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="allowduplicatedentries"/>
- <FIELD NAME="allowduplicatedentries" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="displayformat"/>
+ <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
+ <FIELD NAME="introformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="allowduplicatedentries"/>
+ <FIELD NAME="allowduplicatedentries" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="displayformat"/>
<FIELD NAME="displayformat" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="dictionary" SEQUENCE="false" ENUM="false" PREVIOUS="allowduplicatedentries" NEXT="mainglossary"/>
<FIELD NAME="mainglossary" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="displayformat" NEXT="showspecial"/>
<FIELD NAME="showspecial" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="mainglossary" NEXT="showalphabet"/>
upgrade_mod_savepoint($result, 2009042005, 'glossary');
}
+ if ($result && $oldversion < 2009042006) {
+
+ /// Define field introformat to be added to glossary
+ $table = new xmldb_table('glossary');
+ $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+ /// Conditionally launch add field introformat
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ /// glossary savepoint reached
+ upgrade_mod_savepoint($result, 2009042006, 'glossary');
+ }
+
return $result;
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009042005;
+$module->version = 2009042006;
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
if ( $glossary->intro && $showcommonelements ) {
$options = new stdclass;
$options->para = false;
- print_box(format_text($glossary->intro, FORMAT_MOODLE, $options), 'generalbox', 'intro');
+ $options->noclean = true;
+ print_box(format_text($glossary->intro, $glossary->introformat, $options), 'generalbox', 'intro');
}
/// Search box