Added a new format field for comments

This commit is contained in:
moodler 2005-04-17 17:51:25 +00:00
parent 70b2c772b3
commit 52436fe1cc
9 changed files with 38 additions and 17 deletions

View file

@ -96,6 +96,7 @@
fwrite ($bf,full_tag("DATA2",6,false,$ass_sub->data2));
fwrite ($bf,full_tag("GRADE",6,false,$ass_sub->grade));
fwrite ($bf,full_tag("COMMENT",6,false,$ass_sub->comment));
fwrite ($bf,full_tag("FORMAT",6,false,$ass_sub->format));
fwrite ($bf,full_tag("TEACHER",6,false,$ass_sub->teacher));
fwrite ($bf,full_tag("TIMEMARKED",6,false,$ass_sub->timemarked));
fwrite ($bf,full_tag("MAILED",6,false,$ass_sub->mailed));

View file

@ -146,6 +146,10 @@ function assignment_upgrade($oldversion) {
table_column('assignment', '', 'var1', 'integer', '10', '', 0, 'null', 'emailteachers');
}
if ($oldversion < 2005041700) { // Allow comments to have a formatting
table_column('assignment_submissions', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'comment');
}
/// These lines ALWAYS need to be here at the end of this file. Don't mess with them. :-)
include_once("$CFG->dirroot/mod/assignment/lib.php");

View file

@ -7,7 +7,7 @@ CREATE TABLE `prefix_assignment` (
`course` int(10) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL,
`format` tinyint(2) unsigned NOT NULL default '0',
`format` tinyint(4) unsigned NOT NULL default '0',
`assignmenttype` varchar(50) NOT NULL default '',
`resubmit` tinyint(2) unsigned NOT NULL default '0',
`emailteachers` tinyint(2) unsigned NOT NULL default '0',
@ -41,6 +41,7 @@ CREATE TABLE `prefix_assignment_submissions` (
`data2` text NOT NULL,
`grade` int(11) NOT NULL default '0',
`comment` text NOT NULL,
`format` tinyint(4) unsigned NOT NULL default '0',
`teacher` int(10) unsigned NOT NULL default '0',
`timemarked` int(10) unsigned NOT NULL default '0',
`mailed` tinyint(1) unsigned NOT NULL default '0',

View file

@ -144,6 +144,9 @@ function assignment_upgrade($oldversion) {
table_column('assignment', '', 'var1', 'integer', '10', '', 0, 'null', 'emailteachers');
}
if ($oldversion < 2005041700) { // Allow comments to have a formatting
table_column('assignment_submissions', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'comment');
}
/// These lines ALWAYS need to be here at the end of this file. Don't mess with them. :-)

View file

@ -42,6 +42,7 @@ CREATE TABLE prefix_assignment_submissions (
data2 text NOT NULL default '',
grade integer NOT NULL default '0',
comment text NOT NULL default '',
format integer NOT NULL default '0',
teacher integer NOT NULL default '0',
timemarked integer NOT NULL default '0',
mailed integer NOT NULL default '0'

View file

@ -189,6 +189,7 @@ class assignment_base {
echo '<div class="grade">';
echo get_string("grade").': '.$this->display_grade($submission->grade);
echo '</div>';
echo '<div class="clearer"></div>';
}
echo '<div class="comment">';
@ -403,10 +404,10 @@ class assignment_base {
$subtype = 'assignmentold';
}
print_header($this->assignment->name.' '.fullname($user, true));
print_header(get_string('feedback', 'assignment').':'.fullname($user, true).':'.$this->assignment->name);
echo '<table cellspacing="0" class="submission '.$subtype.'" >';
echo '<table cellspacing="0" class="feedback '.$subtype.'" >';
echo '<tr>';
echo '<td width="35" valign="top" class="picture user">';
@ -443,15 +444,20 @@ class assignment_base {
if (!$submission->grade and !$submission->timemarked) {
$submission->grade = -1; /// Hack to stop zero being selected on the menu below (so it shows 'no grade')
}
echo get_string('feedback', 'assignment').':';
if ($submission->timemarked) {
echo '<div class="from">';
echo '<div class="fullname">'.fullname($teacher, true).'</div>';
echo '<div class="time">'.userdate($submission->timemarked).'</div>';
echo '</div>';
}
echo '<div class="grade">'.get_string('grade').':';
choose_from_menu(make_grades_menu($this->assignment->grade), 'grade',
$submission->grade, get_string('nograde'));
echo '</div>';
echo '<div class="clearer"></div>';
if ($submission->timemarked) {
echo '&nbsp;&nbsp;'.userdate($submission->timemarked);
}
echo '<br />';
print_textarea($this->usehtmleditor, 10, 60, 0, 0, 'comment', $submission->comment, $this->course->id);
print_textarea($this->usehtmleditor, 15, 58, 0, 0, 'comment', $submission->comment, $this->course->id);
echo '<div class="buttons" align="center">';
echo '<input type="submit" name="submit" value="'.get_string('savechanges').'" />';
@ -641,7 +647,7 @@ class assignment_base {
$buttontext = ($auser->status == 1) ? $strupdate : $strgrade;
$button = button_to_popup_window ('/mod/assignment/submissions.php?id='.$this->cm->id.'&amp;userid='.$auser->id.'&amp;mode=single',
'grade'.$auser->id, $buttontext, 450, 600, $buttontext, 'none', true, 'button'.$auser->id);
'grade'.$auser->id, $buttontext, 450, 700, $buttontext, 'none', true, 'button'.$auser->id);
$status = '<div id="up'.$auser->id.'" class="s'.$auser->status.'">'.$button.'</div>';

View file

@ -131,6 +131,7 @@
$submission->data2 = backup_todb($sub_info['#']['DATA2']['0']['#']);
$submission->grade = backup_todb($sub_info['#']['GRADE']['0']['#']);
$submission->comment = backup_todb($sub_info['#']['COMMENT']['0']['#']);
$submission->format = backup_todb($sub_info['#']['FORMAT']['0']['#']);
$submission->teacher = backup_todb($sub_info['#']['TEACHER']['0']['#']);
$submission->timemarked = backup_todb($sub_info['#']['TIMEMARKED']['0']['#']);
$submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);

View file

@ -1,6 +1,6 @@
#mod-assignment-submissions .submission .content,
#mod-assignment-submissions .submission .topic,
#mod-assignment-submissions .submission .picture
#mod-assignment-submissions .feedback .content,
#mod-assignment-submissions .feedback .topic,
#mod-assignment-submissions .feedback .picture
{
padding: 10px;
border-width:1px;
@ -8,17 +8,21 @@
border-color:#DDDDDD;
}
.mod-assignment .topic .files {
.mod-assignment .feedback .files {
float: right;
background-color: #EFEFEF;
padding:5px;
}
.mod-assignment .topic .from {
.mod-assignment .feedback .grade {
float: right;
}
.mod-assignment .feedback .from {
float: left;
}
.mod-assignment .topic .time {
.mod-assignment .feedback .time {
font-size: 0.8em;
}
@ -49,7 +53,7 @@
padding-right: 5px;
}
#mod-assignment-submissions .grade {
#mod-assignment-submissions .submissions .grade {
text-align: right;
font-weight:bold;
}

View file

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041600;
$module->version = 2005041700;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;