quiz manual grading: MDL-5517 manual grading pop-up is too small. HTML editor does not fit. Merged from MOODLE_19_STABLE.
Also MDL-17585 Improve layout of manual grading forms to make them look more like formslib forms. The standard trick of stealing the HTML and class names that formslib works, so the standard style rules apply to your form.
This commit is contained in:
@@ -14,7 +14,7 @@ $string['gradeungraded'] = 'Grade all $a ungraded attempts';
|
||||
$string['gradenextungraded'] = 'Grade next $a ungraded attempts';
|
||||
$string['gradinguser'] = 'Attempts for $a';
|
||||
$string['gradingall'] = 'All $a attempts on this question.';
|
||||
$string['gradingattempt'] = 'Attempt number $a->attempt for $a->fullname.';
|
||||
$string['gradingattempt'] = 'Attempt number $a->attempt for $a->fullname';
|
||||
$string['gradingnextungraded'] = 'Next $a ungraded attempts';
|
||||
$string['gradingnotallowed'] = 'You do not have permission to manually grade responses in this quiz';
|
||||
$string['gradingungraded'] = '$a ungraded attempts';
|
||||
|
||||
+28
-16
@@ -1729,26 +1729,38 @@ function get_question_image($question) {
|
||||
return $img;
|
||||
}
|
||||
|
||||
function question_print_comment_fields($question, $state, $prefix, $cmoptions) {
|
||||
function question_print_comment_fields($question, $state, $prefix, $cmoptions, $caption = '') {
|
||||
$idprefix = preg_replace('/[^-_a-zA-Z0-9]/', '', $prefix);
|
||||
$grade = question_format_grade($cmoptions, $state->last_graded->grade);
|
||||
$maxgrade = question_format_grade($cmoptions, $question->maxgrade);
|
||||
$fieldsize = strlen($maxgrade) - 1;
|
||||
echo '<table class="que comment">' . "\n";
|
||||
echo '<tr valign="top">' . "\n";
|
||||
echo '<th><label for="' . $idprefix . '_comment_box">' .
|
||||
get_string('comment', 'quiz') . "</label></th>\n";
|
||||
echo '<td>';
|
||||
print_textarea(can_use_html_editor(), 15, 60, 630, 300, $prefix . '[comment]',
|
||||
$state->manualcomment, 0, false, $idprefix . '_comment_box');
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo '<tr valign="top">' . "\n";
|
||||
echo '<th><label for="' . $idprefix . '_grade_field">' . get_string('grade', 'quiz') . "</label></th>\n";
|
||||
echo '<td><input type="text" name="' . $prefix . '[grade]" size="' . $fieldsize .
|
||||
'" id="' . $idprefix . '_grade_field" value="' . $grade . '" />/' . $maxgrade . "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
if (empty($caption)) {
|
||||
$caption = format_string($question->name);
|
||||
}
|
||||
?>
|
||||
<fieldset class="que comment clearfix">
|
||||
<legend class="ftoggler"><?php echo $caption; ?></legend>
|
||||
<div class="fcontainer clearfix">
|
||||
<div class="fitem">
|
||||
<div class="fitemtitle">
|
||||
<label for="<?php echo $idprefix; ?>_comment_box"><?php print_string('comment', 'quiz'); ?></label>
|
||||
</div>
|
||||
<div class="felement fhtmleditor">
|
||||
<?php print_textarea(can_use_html_editor(), 15, 60, 630, 300, $prefix . '[comment]',
|
||||
$state->manualcomment, 0, false, $idprefix . '_comment_box'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<div class="fitemtitle">
|
||||
<label for="<?php echo $idprefix; ?>_grade_field"><?php print_string('grade', 'quiz'); ?></label>
|
||||
</div>
|
||||
<div class="felement ftext">
|
||||
<input type="text" name="<?php echo $prefix; ?>[grade]" size="<?php echo $fieldsize; ?>" id="<?php echo $idprefix; ?>_grade_field" value="<?php echo $grade; ?>" /> / <?php echo $maxgrade; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
-1
@@ -740,10 +740,19 @@ class quiz_attempt extends quiz {
|
||||
}
|
||||
|
||||
public function question_print_comment_fields($questionid, $prefix) {
|
||||
global $DB;
|
||||
|
||||
$this->ensure_question_loaded($questionid);
|
||||
$this->ensure_state_loaded($questionid);
|
||||
|
||||
/// Work out a nice title.
|
||||
$student = $DB->get_record('user', array('id' => $this->get_userid()));
|
||||
$a = new object();
|
||||
$a->fullname = fullname($student, true);
|
||||
$a->attempt = $this->get_attempt_number();
|
||||
|
||||
question_print_comment_fields($this->questions[$questionid],
|
||||
$this->states[$questionid], $prefix, $this->quiz);
|
||||
$this->states[$questionid], $prefix, $this->quiz, get_string('gradingattempt', 'quiz_grading', $a));
|
||||
}
|
||||
|
||||
// Private methods =====================================================================
|
||||
|
||||
+25
-11
@@ -10,8 +10,8 @@
|
||||
require_once('../../config.php');
|
||||
require_once('locallib.php');
|
||||
|
||||
$attemptid =required_param('attempt', PARAM_INT); // attempt id
|
||||
$questionid =required_param('question', PARAM_INT); // question id
|
||||
$attemptid = required_param('attempt', PARAM_INT); // attempt id
|
||||
$questionid = required_param('question', PARAM_INT); // question id
|
||||
|
||||
$attemptobj = new quiz_attempt($attemptid);
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
/// If success, notify and print a close button.
|
||||
if (!is_string($error)) {
|
||||
notify(get_string('changessaved'), 'notifysuccess');
|
||||
close_window_button('closewindow', false, true);
|
||||
print_footer();
|
||||
exit;
|
||||
close_window(2, true);
|
||||
}
|
||||
|
||||
/// Otherwise, display the error and fall throug to re-display the form.
|
||||
@@ -56,14 +54,30 @@
|
||||
}
|
||||
|
||||
/// Print the comment form.
|
||||
echo '<form method="post" action="' . $CFG->wwwroot . '/mod/quiz/comment.php">';
|
||||
echo '<form method="post" class="mform" id="manualgradingform" action="' . $CFG->wwwroot . '/mod/quiz/comment.php">';
|
||||
$attemptobj->question_print_comment_fields($questionid, 'response');
|
||||
echo '<input type="hidden" name="attempt" value="' . $attemptobj->get_uniqueid() . '" />';
|
||||
echo '<input type="hidden" name="question" value="' . $questionid . '" />';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo '<input type="submit" name="submit" value="' . get_string('save', 'quiz') . '" />';
|
||||
?>
|
||||
<div>
|
||||
<input type="hidden" name="attempt" value="<?php echo $attemptobj->get_uniqueid(); ?>" />
|
||||
<input type="hidden" name="question" value="<?php echo $questionid; ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
</div>
|
||||
<fieldset class="hidden">
|
||||
<div>
|
||||
<div class="fitem">
|
||||
<div class="fitemtitle">
|
||||
<div class="fgrouplabel"><label> </label></div>
|
||||
</div>
|
||||
<fieldset class="felement fgroup">
|
||||
<input id="id_submitbutton" type="submit" name="submit" value="<?php print_string('save', 'quiz'); ?>"/>
|
||||
<input id="id_cancel" type="button" value="<?php print_string('cancel'); ?>" onclick="close_window"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
echo '</form>';
|
||||
|
||||
/// End of the page.
|
||||
print_footer();
|
||||
print_footer('empty');
|
||||
?>
|
||||
|
||||
@@ -371,7 +371,7 @@ class quiz_grading_report extends quiz_default_report {
|
||||
|
||||
// Display the form with one part for each selected attempt
|
||||
|
||||
echo '<form method="post" action="report.php">'.
|
||||
echo '<form method="post" action="report.php" class="mform" id="manualgradingform">'.
|
||||
'<input type="hidden" name="mode" value="grading" />'.
|
||||
'<input type="hidden" name="q" value="'.$quiz->id.'" />'.
|
||||
'<input type="hidden" name="sesskey" value="'.sesskey().'" />'.
|
||||
@@ -390,10 +390,10 @@ class quiz_grading_report extends quiz_default_report {
|
||||
$options->readonly = 1;
|
||||
|
||||
if (question_state_is_graded($state)) {
|
||||
$gradedclass = ' class="highlightgraded" ';
|
||||
$gradedclass = 'main highlightgraded';
|
||||
$gradedstring = ' ' . get_string('graded','quiz_grading');
|
||||
} else {
|
||||
$gradedclass = '';
|
||||
$gradedclass = 'main';
|
||||
$gradedstring = '';
|
||||
}
|
||||
$a = new object();
|
||||
@@ -402,8 +402,7 @@ class quiz_grading_report extends quiz_default_report {
|
||||
|
||||
// print the user name, attempt count, the question, and some more hidden fields
|
||||
echo '<div class="boxaligncenter" width="80%" style="clear:left;padding:15px;">';
|
||||
echo "<span$gradedclass>" . get_string('gradingattempt', 'quiz_grading', $a);
|
||||
echo $gradedstring . '</span>';
|
||||
print_heading(get_string('gradingattempt', 'quiz_grading', $a) . $gradedstring, '', 3, $gradedclass);
|
||||
|
||||
// Print the question, without showing any previous comment.
|
||||
$copy = $state->manualcomment;
|
||||
@@ -413,8 +412,8 @@ class quiz_grading_report extends quiz_default_report {
|
||||
|
||||
// The print the comment and grade fields, putting back the previous comment.
|
||||
$state->manualcomment = $copy;
|
||||
question_print_comment_fields($question, $state,
|
||||
'manualgrades[' . $attempt->uniqueid . ']', $quiz);
|
||||
question_print_comment_fields($question, $state, 'manualgrades[' . $attempt->uniqueid . ']',
|
||||
$quiz, get_string('manualgrading', 'quiz'));
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ class default_questiontype {
|
||||
$strcomment = get_string('commentorgrade', 'quiz');
|
||||
$commentlink = link_to_popup_window($options->questioncommentlink .
|
||||
'?attempt=' . $state->attempt . '&question=' . $actualquestionid,
|
||||
'commentquestion', $strcomment, 450, 650, $strcomment, 'none', true);
|
||||
'commentquestion', $strcomment, 480, 750, $strcomment, 'none', true);
|
||||
$commentlink = '<div class="commentlink">'. $commentlink .'</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -2978,7 +2978,16 @@ body.notes .notesgroup {
|
||||
margin-top: 10px;
|
||||
border-bottom: 1px solid #555;
|
||||
}
|
||||
|
||||
#mod-quiz-comment #manualgradingform,
|
||||
#mod-quiz-report #manualgradingform {
|
||||
width: 100%;
|
||||
}
|
||||
#mod-quiz-report #manualgradingform .que {
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
.mform .que.comment .fitemtitle {
|
||||
width: 20%;
|
||||
}
|
||||
/***
|
||||
*** Completion progress report
|
||||
***/
|
||||
|
||||
Reference in New Issue
Block a user