fwrite ($bf,full_tag("ID",8,false,$comment->id));
fwrite ($bf,full_tag("USERID",8,false,$comment->userid));
- fwrite ($bf,full_tag("COMMENT",8,false,$comment->comment));
+ fwrite ($bf,full_tag("ENTRYCOMMENT",8,false,$comment->entrycomment));
fwrite ($bf,full_tag("FORMAT",8,false,$comment->format));
fwrite ($bf,full_tag("TIMEMODIFIED",8,false,$comment->timemodified));
trusttext_after_edit($form->text, $context);
$newentry->entryid = $entry->id;
- $newentry->comment = $form->text;
+ $newentry->entrycomment = $form->text;
$newentry->format = $form->format;
$newentry->timemodified = time();
$defaultformat = FORMAT_MOODLE;
}
if (isset($comment) ) {
- $form->text = $comment->comment;
+ $form->text = $comment->entrycomment;
$form->format = $comment->format;
} else {
$form->text = '';
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="entryid"/>
<FIELD NAME="entryid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
- <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entryid" NEXT="comment"/>
- <FIELD NAME="comment" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="format"/>
- <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="comment" NEXT="timemodified"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entryid" NEXT="entrycomment"/>
+ <FIELD NAME="entrycomment" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="format"/>
+ <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="entrycomment" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="format"/>
</FIELDS>
<KEYS>
</SENTENCES>
</STATEMENT>
</STATEMENTS>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
</TABLE>
<TABLE name="glossary_comments">
<FIELDS>
- <FIELD name="comment" method="PLAIN_SQL_UPDATE" type="text" length="0">
+ <FIELD name="entrycomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
<SQL_DETECT_USER>
SELECT gco.userid
FROM {$CFG->prefix}glossary_comments gco
}
}
- return true;
+ if ($oldversion < 2006090400) {
+ table_column('glossary_comments', 'comment', 'entrycomment', 'text', '', '', '');
+ }
+
+ return true;
}
?>
id int(10) unsigned NOT NULL auto_increment,
entryid int(10) unsigned NOT NULL default '0',
userid int(10) unsigned NOT NULL default '0',
- comment text NOT NULL default '',
+ entrycomment text NOT NULL default '',
format tinyint(2) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
}
}
+ if ($oldversion < 2006090400) {
+ table_column('glossary_comments', 'comment', 'entrycomment', 'text', '', '', '');
+ }
- return true;
+ return true;
}
?>
id SERIAL,
entryid int4 NOT NULL default '0',
userid int4 NOT NULL default '0',
- comment text NOT NULL,
+ entrycomment text NOT NULL,
format int2 NOT NULL default '0',
timemodified int4 NOT NULL default '0',
PRIMARY KEY (id)
$options = new object();
$options->trusttext = true;
- echo format_text($comment->comment, $comment->format, $options);
+ echo format_text($comment->entrycomment, $comment->format, $options);
echo '<div class="icons commands">';
//Now, build the GLOSSARY_COMMENTS record structure
$comment->entryid = $new_entry_id;
$comment->userid = backup_todb($com_info['#']['USERID']['0']['#']);
- $comment->comment = backup_todb($com_info['#']['COMMENT']['0']['#']);
+ if (isset($com_info['#']['COMMENT']['0']['#'])) {
+ $comment->entrycomment = backup_todb($com_info['#']['COMMENT']['0']['#']);
+ } else {
+ $comment->entrycomment = backup_todb($com_info['#']['ENTRYCOMMENT']['0']['#']);
+ }
$comment->timemodified = backup_todb($com_info['#']['TIMEMODIFIED']['0']['#']);
$comment->format = backup_todb($com_info['#']['FORMAT']['0']['#']);
$status = true;
- //Convert glossary_comments->comment
- if ($records = get_records_sql ("SELECT c.id, c.comment, c.format
+ //Convert glossary_comments->entrycomment
+ if ($records = get_records_sql ("SELECT c.id, c.entrycomment, c.format
FROM {$CFG->prefix}glossary_comments c,
{$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary g,
b.new_id = c.id")) {
foreach ($records as $record) {
//Rebuild wiki links
- $record->comment = restore_decode_wiki_content($record->comment, $restore);
+ $record->entrycomment = restore_decode_wiki_content($record->entrycomment, $restore);
//Convert to Markdown
$wtm = new WikiToMarkdown();
- $record->comment = $wtm->convert($record->comment, $restore->course_id);
+ $record->entrycomment = $wtm->convert($record->entrycomment, $restore->course_id);
$record->format = FORMAT_MARKDOWN;
$status = update_record('glossary_comments', addslashes_object($record));
//Do some output
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006082600;
+$module->version = 2006090400;
$module->requires = 2006082600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)