Journal questions can now use HTML editor, plus new field 'introformat'

This commit is contained in:
moodler 2004-01-14 02:24:42 +00:00
parent ecd7e49e87
commit 34a2293e08
11 changed files with 53 additions and 9 deletions

View File

@ -38,6 +38,7 @@
fwrite ($bf,full_tag("MODTYPE",4,false,"journal"));
fwrite ($bf,full_tag("NAME",4,false,$journal->name));
fwrite ($bf,full_tag("INTRO",4,false,$journal->intro));
fwrite ($bf,full_tag("INTROFORMAT",4,false,$journal->introformat));
fwrite ($bf,full_tag("DAYS",4,false,$journal->days));
fwrite ($bf,full_tag("ASSESSED",4,false,$journal->assessed));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$journal->timemodified));

View File

@ -43,6 +43,10 @@ function journal_upgrade($oldversion) {
}
}
if ($oldversion < 2004011400) {
table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
}
return $result;
}

View File

@ -19,6 +19,7 @@ CREATE TABLE prefix_journal (
course int(10) unsigned NOT NULL default '0',
name varchar(255) default NULL,
intro text,
introformat tinyint(2) NOT NULL default '0',
days smallint(5) unsigned NOT NULL default '7',
assessed int(10) NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',

View File

@ -26,5 +26,9 @@ function journal_upgrade($oldversion) {
}
}
if ($oldversion < 2004011400) {
table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
}
return $result;
}

View File

@ -19,6 +19,7 @@ CREATE TABLE prefix_journal (
course integer NOT NULL default '0',
name varchar(255) default NULL,
intro text,
introformat integer NOT NULL default '0',
days integer NOT NULL default '7',
assessed integer NOT NULL default '0',
timemodified integer NOT NULL default '0'

View File

@ -83,7 +83,7 @@
echo "<center>\n";
print_simple_box( format_text($journal->intro) , "center");
print_simple_box( format_text($journal->intro, $journal->introformat) , "center");
echo "<br />";

View File

@ -57,7 +57,7 @@ function journal_user_complete_index($course, $user, $journal, $journalopen, $he
}
print_simple_box_start("left", "90%");
echo format_text($journal->intro);
echo format_text($journal->intro, $journal->introformat);
print_simple_box_end();
echo "<br clear=all />";
echo "<br />";

View File

@ -1,4 +1,10 @@
<?php
if ($usehtmleditor = can_use_richtext_editor()) {
$defaultformat = FORMAT_HTML;
} else {
$defaultformat = FORMAT_MOODLE;
}
if (!isset($form->name)) {
$form->name = "";
}
@ -25,24 +31,42 @@
<input type="text" name="name" size=30 value="<?php p($form->name) ?>">
</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php print_string("journalquestion", "journal") ?>:</b></p>
<font SIZE="1">
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "intro");
}
?>
<br />
</font>
</TD>
</td>
<td>
<textarea name="intro" rows=15 cols=30 wrap="virtual"><?php p($form->intro) ?></textarea>
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "intro", $form->intro);
echo "<p align=right>";
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ":&nbsp;";
if (!$form->introformat) {
$form->introformat = $defaultformat;
}
choose_from_menu(format_text_menu(), "introformat", $form->introformat, "");
echo "</p>";
?>
</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php print_string("grade") ?>:</b></p></td>
<td>
@ -83,3 +107,11 @@
<input type="submit" name=cancel value="<?php print_string("cancel") ?>">
</form>
</center>
<?php
if ($usehtmleditor) {
print_richedit_javascript("form", "intro", "yes");
}
?>

View File

@ -42,6 +42,7 @@
$journal->course = $restore->course_id;
$journal->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$journal->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$journal->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
$journal->days = backup_todb($info['MOD']['#']['DAYS']['0']['#']);
$journal->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
$journal->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2003081705;
$module->version = 2004011400;
$module->cron = 60;
?>

View File

@ -45,7 +45,7 @@
echo "<center>\n";
print_simple_box( text_to_html($journal->intro) , "center");
print_simple_box( text_to_html($journal->intro, $journal->introformat) , "center");
echo "<br \>";