mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 23:42:11 +02:00
MDL-18910 normalised module intro and introformat
This commit is contained in:
parent
83afecc04b
commit
6507d1a97e
@ -10,8 +10,9 @@
|
||||
<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"/>
|
||||
|
@ -220,6 +220,18 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
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;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$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) {
|
||||
@ -316,7 +316,7 @@
|
||||
}
|
||||
|
||||
$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;
|
||||
|
@ -32,7 +32,7 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
$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');
|
||||
|
@ -804,7 +804,8 @@
|
||||
} 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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2009042002;
|
||||
$module->version = 2009042003;
|
||||
$module->requires = 2009041700; // Requires this Moodle version
|
||||
$module->cron = 60;
|
||||
|
||||
|
@ -234,7 +234,8 @@
|
||||
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)) {
|
||||
@ -262,7 +263,8 @@
|
||||
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)) {
|
||||
|
@ -9,8 +9,9 @@
|
||||
<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"/>
|
||||
|
@ -190,6 +190,21 @@ function xmldb_glossary_upgrade($oldversion) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// 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)
|
||||
|
||||
|
@ -325,7 +325,8 @@
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user