MDL-18910 normalised module intro and introformat
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
fwrite ($bf,full_tag("ID",4,false,$wiki->id));
|
||||
fwrite ($bf,full_tag("MODTYPE",4,false,"wiki"));
|
||||
fwrite ($bf,full_tag("NAME",4,false,$wiki->name));
|
||||
fwrite ($bf,full_tag("SUMMARY",4,false,$wiki->summary));
|
||||
fwrite ($bf,full_tag("SUMMARY",4,false,$wiki->intro));
|
||||
fwrite ($bf,full_tag("PAGENAME",4,false,$wiki->pagename));
|
||||
fwrite ($bf,full_tag("WTYPE",4,false,$wiki->wtype));
|
||||
fwrite ($bf,full_tag("EWIKIPRINTTITLE",4,false,$wiki->ewikiprinttitle));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/wiki/db" VERSION="20060925" COMMENT="XMLDB file for Moodle mod/wiki"
|
||||
<XMLDB PATH="mod/wiki/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/wiki"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -8,9 +8,10 @@
|
||||
<FIELDS>
|
||||
<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="summary"/>
|
||||
<FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="pagename"/>
|
||||
<FIELD NAME="pagename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="wtype"/>
|
||||
<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="introformat"/>
|
||||
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="intro text field format" PREVIOUS="intro" NEXT="pagename"/>
|
||||
<FIELD NAME="pagename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="wtype"/>
|
||||
<FIELD NAME="wtype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="group" SEQUENCE="false" ENUM="true" ENUMVALUES="'teacher', 'group', 'student'" PREVIOUS="pagename" NEXT="ewikiprinttitle"/>
|
||||
<FIELD NAME="ewikiprinttitle" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="wtype" NEXT="htmlmode"/>
|
||||
<FIELD NAME="htmlmode" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ewikiprinttitle" NEXT="ewikiacceptbinary"/>
|
||||
@@ -24,7 +25,7 @@
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="initialcontent"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
|
||||
@@ -94,4 +95,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
@@ -28,6 +28,32 @@ function xmldb_wiki_upgrade($oldversion) {
|
||||
|
||||
//===== 1.9.0 upgrade line ======//
|
||||
|
||||
if ($result && $oldversion < 2009042000) {
|
||||
|
||||
/// Rename field summary on table wiki to intro
|
||||
$table = new xmldb_table('wiki');
|
||||
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
|
||||
|
||||
/// Launch rename field summary
|
||||
$dbman->rename_field($table, $field, 'intro');
|
||||
|
||||
/// wiki savepoint reached
|
||||
upgrade_mod_savepoint($result, 2009042000, 'wiki');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2009042001) {
|
||||
|
||||
/// Define field introformat to be added to wiki
|
||||
$table = new xmldb_table('wiki');
|
||||
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
|
||||
|
||||
/// Launch add field introformat
|
||||
$dbman->add_field($table, $field);
|
||||
|
||||
/// wiki savepoint reached
|
||||
upgrade_mod_savepoint($result, 2009042001, 'wiki');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -68,7 +68,8 @@
|
||||
}
|
||||
|
||||
$timmod = '<span class="smallinfo">'.userdate($wiki->timemodified).'</span>';
|
||||
$summary = '<div class="smallinfo">'.format_text($wiki->summary).'</div>';
|
||||
$options = (object)array('noclean'=>true);
|
||||
$summary = '<div class="smallinfo">'.format_text($wiki->intro, $wiki->introformat, $options).'</div>';
|
||||
|
||||
$site = get_site();
|
||||
switch ($wiki->wtype) {
|
||||
|
||||
@@ -21,10 +21,10 @@ class mod_wiki_mod_form extends moodleform_mod {
|
||||
$mform->setType('name', PARAM_NOTAGS);
|
||||
$mform->addRule('name', null, 'required', null, 'client');
|
||||
|
||||
$mform->addElement('htmleditor', 'summary', get_string('summary'));
|
||||
$mform->setType('summary', PARAM_RAW);
|
||||
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
|
||||
$mform->addRule('summary', get_string('required'), 'required', null, 'client');
|
||||
$mform->addElement('htmleditor', 'intro', get_string('summary'));
|
||||
$mform->setType('intro', PARAM_RAW);
|
||||
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
|
||||
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
|
||||
|
||||
if (!$wikihasentries){
|
||||
asort($WIKI_TYPES);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
//Now, build the wiki record structure
|
||||
$wiki->course = $restore->course_id;
|
||||
$wiki->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
|
||||
$wiki->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
|
||||
$wiki->intro = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
|
||||
$wiki->pagename = backup_todb($info['MOD']['#']['PAGENAME']['0']['#']);
|
||||
$wiki->wtype = backup_todb($info['MOD']['#']['WTYPE']['0']['#']);
|
||||
$wiki->ewikiprinttitle = backup_todb($info['MOD']['#']['EWIKIPRINTTITLE']['0']['#']);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2007101509; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2007101509; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2009042001; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2009041700; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->cron = 3600; // Period for cron to check this module (secs)
|
||||
|
||||
?>
|
||||
|
||||
+4
-3
@@ -345,9 +345,10 @@
|
||||
<div id="wiki-view" class="mwiki">
|
||||
';
|
||||
|
||||
if($wiki_entry && $ewiki_title==$wiki_entry->pagename && !empty($wiki->summary)) {
|
||||
if (trim(strip_tags($wiki->summary))) {
|
||||
print_box(format_text($wiki->summary, FORMAT_MOODLE), 'generalbox', 'intro');
|
||||
if($wiki_entry && $ewiki_title==$wiki_entry->pagename && !empty($wiki->intro)) {
|
||||
if (trim(strip_tags($wiki->intro))) {
|
||||
$options = (object)array('noclean'=>true);
|
||||
print_box(format_text($wiki->intro, $wiki->introformat, $options), 'generalbox', 'intro');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user