Teacher can now use the richtext editor to edit the assignment text

This commit is contained in:
moodler 2002-10-16 05:31:56 +00:00
parent 7ce20f09cb
commit b425749fc3
5 changed files with 44 additions and 5 deletions

View file

@ -79,6 +79,10 @@ function assignment_upgrade($oldversion) {
} }
} }
if ($oldversion < 2002101600) {
execute_sql(" ALTER TABLE `assignment` ADD `format` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `description` ");
}
return true; return true;
} }

View file

@ -7,6 +7,7 @@ CREATE TABLE `assignment` (
`course` int(10) unsigned NOT NULL default '0', `course` int(10) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '',
`description` text NOT NULL, `description` text NOT NULL,
`format` tinyint(2) unsigned NOT NULL default '0',
`type` int(10) unsigned NOT NULL default '1', `type` int(10) unsigned NOT NULL default '1',
`maxbytes` int(10) unsigned NOT NULL default '100000', `maxbytes` int(10) unsigned NOT NULL default '100000',
`timedue` int(10) unsigned NOT NULL default '0', `timedue` int(10) unsigned NOT NULL default '0',

View file

@ -1,15 +1,41 @@
<form name="form" method="post" action="<?=$ME ?>"> <?
if ($usehtmleditor = can_use_richtext_editor()) {
$defaultformat = FORMAT_HTML;
$onsubmit = "onsubmit=\"copyrichtext(document.form.description);\"";
} else {
$defaultformat = FORMAT_MOODLE;
$onsubmit = "";
}
?>
<form name="form" method="post" <?=$onsubmit ?> action="<?=$ME ?>">
<table cellpadding=5> <table cellpadding=5>
<tr valign=top> <tr valign=top>
<td align=right><P><B><? print_string("assignmentname", "assignment") ?>:</B></P></TD> <td align=right><P><B><? print_string("assignmentname", "assignment") ?>:</B></P></TD>
<td> <td>
<input type="text" name="name" size=30 value="<? p($form->name) ?>"> <input type="text" name="name" size=60 value="<? p($form->name) ?>">
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td align=right><P><B><? print_string("description", "assignment") ?>:</B></P></TD> <td align=right><P><B><? print_string("description", "assignment") ?>:</B></P></TD>
<td> <td>
<textarea name="description" rows=15 cols=30 wrap="virtual"><? p($form->description) ?></textarea> <?
print_textarea($usehtmleditor, 20, 60, 595, 400, "description", $form->description);
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"));
} else {
helpbutton("text", get_string("helptext"));
}
echo "<P>";
print_string("formattexttype");
echo ":&nbsp;";
if (!$form->format) {
$form->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $form->format, "");
echo "</P>";
?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
@ -57,6 +83,7 @@
?></td> ?></td>
</tr> </tr>
</table> </table>
<BR>
<CENTER> <CENTER>
<input type="hidden" name=course value="<? p($form->course) ?>"> <input type="hidden" name=course value="<? p($form->course) ?>">
<input type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>"> <input type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>">
@ -69,3 +96,10 @@
<input type="submit" name=cancel value="<? print_string("cancel") ?>"> <input type="submit" name=cancel value="<? print_string("cancel") ?>">
</CENTER> </CENTER>
</FORM> </FORM>
<?
if ($usehtmleditor) {
print_richedit_javascript("form", "description", "no");
}
?>

View file

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

View file

@ -66,7 +66,7 @@
echo "<B>".get_string("maximumgrade")."</B>: $assignment->grade<BR>"; echo "<B>".get_string("maximumgrade")."</B>: $assignment->grade<BR>";
print_simple_box_end(); print_simple_box_end();
echo "<BR>"; echo "<BR>";
echo text_to_html($assignment->description); echo format_text($assignment->description, $assignment->format);
print_simple_box_end(); print_simple_box_end();
echo "<BR>"; echo "<BR>";