From b1fec412e31bb485f845549927fccc2c333b4395 Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Tue, 18 Sep 2012 12:52:32 +0800 Subject: [PATCH] MDL-34777 grading: add label to select and input tag Conflicts: mod/assign/lang/en/assign.php mod/assign/locallib.php --- grade/edit/tree/lib.php | 19 ++++++++++++------- .../form/guide/lang/en/gradingform_guide.php | 1 + grade/grading/form/guide/renderer.php | 7 +++++-- .../grader/lang/en/gradereport_grader.php | 2 ++ grade/report/grader/lib.php | 5 ++++- grade/report/grader/module.js | 15 ++++++++++++--- lang/en/grades.php | 4 ++++ mod/assign/lang/en/assign.php | 1 + mod/assign/locallib.php | 4 ++-- 9 files changed, 43 insertions(+), 15 deletions(-) diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php index 2bc2dc7504212..a7f605542268d 100644 --- a/grade/edit/tree/lib.php +++ b/grade/edit/tree/lib.php @@ -373,7 +373,8 @@ static function get_weight_input($item, $type) { if ((($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoef') && $type == 'weight') || ($aggcoef == 'aggregationcoefextraweight' && $type == 'extra')) { - return ''.get_string('extracreditvalue', 'grades', $item->itemname).''. + ''; } elseif ($aggcoef == 'aggregationcoefextrasum' && $type == 'extra') { $checked = ($item->aggregationcoef > 0) ? 'checked="checked"' : ''; @@ -811,7 +812,8 @@ public function get_item_cell($item, $params) { } elseif ($item->is_external_item()) { $grademax = format_float($item->grademax, $item->get_decimals()); } else { - $grademax = ''; + $grademax = ''; + $grademax .= ''; } $itemcell = clone($this->itemcell); @@ -964,7 +966,8 @@ public function get_header_cell() { } public function get_category_cell($category, $levelclass, $params) { - $droplow = ''; + $droplow = ''; + $droplow .= ''; if ($this->forced) { $droplow = $category->droplow; @@ -997,7 +1000,8 @@ public function get_header_cell() { } public function get_category_cell($category, $levelclass, $params) { - $keephigh = ''; + $keephigh = ''; + $keephigh .= ''; if ($this->forced) { $keephigh = $category->keephigh; @@ -1044,8 +1048,8 @@ public function get_item_cell($item, $params) { $itemcell->text = ' '; return $itemcell; } - - $multfactor = ''; + $multfactor = ''; + $multfactor .= ''; $itemcell->text = $multfactor; return $itemcell; @@ -1087,7 +1091,8 @@ public function get_item_cell($item, $params) { return $itemcell; } - $plusfactor = ''; + $plusfactor = ''; + $plusfactor .= ''; $itemcell->text = $plusfactor; return $itemcell; diff --git a/grade/grading/form/guide/lang/en/gradingform_guide.php b/grade/grading/form/guide/lang/en/gradingform_guide.php index 11c236ccfaced..6bbfb40a79e66 100644 --- a/grade/grading/form/guide/lang/en/gradingform_guide.php +++ b/grade/grading/form/guide/lang/en/gradingform_guide.php @@ -43,6 +43,7 @@ $string['criterionempty'] = 'Click to edit criterion'; $string['criterionmovedown'] = 'Move down'; $string['criterionmoveup'] = 'Move up'; +$string['criterionname'] = 'Criterion name'; $string['definemarkingguide'] = 'Define marking guide'; $string['description'] = 'Description'; $string['descriptionmarkers'] = 'Description for Markers'; diff --git a/grade/grading/form/guide/renderer.php b/grade/grading/form/guide/renderer.php index 74a996a175dd3..360e1b9e5020c 100644 --- a/grade/grading/form/guide/renderer.php +++ b/grade/grading/form/guide/renderer.php @@ -93,7 +93,8 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder'])); $shortname = html_writer::empty_tag('input', array('type'=> 'text', - 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]', 'value' => htmlspecialchars($criterion['shortname']))); + 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]', 'value' => htmlspecialchars($criterion['shortname']), + 'id ' => '{NAME}[criteria][{CRITERION-id}][shortname]')); $shortname = html_writer::tag('div', $shortname, array('class'=>'criterionname')); $description = html_writer::tag('textarea', htmlspecialchars($criterion['description']), array('name' => '{NAME}[criteria][{CRITERION-id}][description]', 'cols' => '65', 'rows' => '5')); @@ -105,7 +106,8 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr $maxscore = html_writer::empty_tag('input', array('type'=> 'text', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'size' => '3', - 'value' => htmlspecialchars($criterion['maxscore']))); + 'value' => htmlspecialchars($criterion['maxscore']), + 'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); $maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore')); } else { if ($mode == gradingform_guide_controller::DISPLAY_EDIT_FROZEN) { @@ -194,6 +196,7 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr array('for'=>'{NAME}[criteria][{CRITERION-id}][score]', 'class' => $scoreclass)); $score .= html_writer::empty_tag('input', array('type'=> 'text', 'name' => '{NAME}[criteria][{CRITERION-id}][score]', 'class' => $scoreclass, + 'id' => '{NAME}[criteria][{CRITERION-id}][score]', 'size' => '3', 'value' => htmlspecialchars($currentscore))); $score .= '/'.$maxscore; diff --git a/grade/report/grader/lang/en/gradereport_grader.php b/grade/report/grader/lang/en/gradereport_grader.php index d59dfdd17210e..ce3aa730bd9dc 100644 --- a/grade/report/grader/lang/en/gradereport_grader.php +++ b/grade/report/grader/lang/en/gradereport_grader.php @@ -32,3 +32,5 @@ $string['grader:view'] = 'View the grader report'; $string['pluginname'] = 'Grader report'; $string['preferences'] = 'Grader report preferences'; +$string['useractivitygrade'] = '{$a} grade'; +$string['useractivityfeedback'] = '{$a} feedback'; diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 3f6681e5454c0..99d4d9d038b20 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -1035,6 +1035,8 @@ public function get_right_rows() { } else if ($item->gradetype != GRADE_TYPE_TEXT) { // Value type if ($this->get_pref('quickgrading') and $grade->is_editable()) { $value = format_float($gradeval, $decimalpoints); + $gradelabel = fullname($user) . ' ' . $item->itemname; + $itemcell->text .= ''; $itemcell->text .= ''; @@ -1046,7 +1048,8 @@ public function get_right_rows() { // If quickfeedback is on, print an input element if ($this->get_pref('showquickfeedback') and $grade->is_editable()) { - + $feedbacklabel = fullname($user) . ' ' . $item->itemname; + $itemcell->text .= ''; $itemcell->text .= ''; } diff --git a/grade/report/grader/module.js b/grade/report/grader/module.js index 800f5541c03b1..638d083226ec5 100644 --- a/grade/report/grader/module.js +++ b/grade/report/grader/module.js @@ -124,6 +124,7 @@ M.gradereport_grader.classes.report = function(Y, id, cfg, items, users, feedbac this.items = items; this.users = users; this.feedback = feedback; + this.feedbacklabel = ''; this.table = Y.one('#user-grades'); this.grades = grades; @@ -353,8 +354,8 @@ M.gradereport_grader.classes.ajax.prototype.make_editable = function(e) { node = node.ancestor('td'); } this.report.Y.detach('click', this.make_editable, node); - - if (this.current) { +//alert(this.report.toSource()); + if (this.current) { // Current is already set! this.process_editable_field(node); return; @@ -662,7 +663,7 @@ M.gradereport_grader.classes.ajax.prototype.submission_outcome = function(tid, o // otherwise we will prompt the user to choose to use their value or the new value! if (!this.current.has_changed() || confirm(M.str.gradereport_grader.ajaxfieldchanged)) { this.current.set_grade(finalgrade); - this.current.grade.set('value', finalgrade); + this.current.grade.set('value', finalgrade);alert(this.current.node.toSource()); } } } @@ -943,11 +944,16 @@ M.gradereport_grader.classes.textfield = function(report, node) { this.gradespan = node.one('.gradevalue'); this.inputdiv = this.report.Y.Node.create('
'); this.editfeedback = this.report.ajax.showquickfeedback; + this.gradelabel = this.report.Y.Node.create(''); this.grade = this.report.Y.Node.create(''); this.gradetype = 'value'; + this.inputdiv.append(this.gradelabel); this.inputdiv.append(this.grade); if (this.report.ajax.showquickfeedback) { + this.feedbacklabel = this.report.Y.Node.create(''); this.feedback = this.report.Y.Node.create(''); + + this.inputdiv.append(this.feedbacklabel); this.inputdiv.append(this.feedback); } }; @@ -958,6 +964,7 @@ M.gradereport_grader.classes.textfield.prototype.keyevents = []; M.gradereport_grader.classes.textfield.prototype.editable = false; M.gradereport_grader.classes.textfield.prototype.gradetype = null; M.gradereport_grader.classes.textfield.prototype.grade = null; +M.gradereport_grader.classes.textfield.prototype.gradelabel = null; M.gradereport_grader.classes.textfield.prototype.report = null; M.gradereport_grader.classes.textfield.prototype.node = null; M.gradereport_grader.classes.textfield.prototype.gradespam = null; @@ -975,7 +982,9 @@ M.gradereport_grader.classes.textfield.prototype.replace = function() { if (this.editfeedback) { this.set_feedback(this.get_feedback()); } + //this.node.on('.test').innerHTML('test'); this.node.replaceChild(this.inputdiv, this.gradespan); + //alert(this.inputdiv.toSource()); this.grade.focus(); this.editable = true; return this; diff --git a/lang/en/grades.php b/lang/en/grades.php index 2c0b74f0a838a..6d173d6c9b670 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -150,6 +150,7 @@ $string['dropdown'] = 'Dropdown menu'; $string['droplow'] = 'Drop the lowest'; $string['droplow_help'] = 'This setting enables a specified number of the lowest grades to be excluded from the aggregation.'; +$string['droplowestvalue'] = 'Set the drop lowest grade value'; $string['dropped'] = 'Dropped'; $string['dropxlowest'] = 'Drop X lowest'; $string['dropxlowestwarning'] = 'Note: If you use drop x lowest the grading assumes that all items in the category have the same point value. If point values differ results will be unpredictable'; @@ -194,6 +195,7 @@ $string['exportonlyactive'] = 'Require active enrolment'; $string['exportonlyactive_help'] = 'Only include students in the export whose enrolment has not been suspended'; $string['exportto'] = 'Export to'; +$string['extracreditvalue'] = 'Extra credit value for {$a}'; $string['extracreditwarning'] = 'Note: Setting all items for a category to extra credit will effectively remove them from the grade calculation. Since there will be no point total'; $string['feedback'] = 'Feedback'; $string['feedback_help'] = 'This box enables any comments about the grade to be added.'; @@ -407,6 +409,7 @@ $string['moveselectedto'] = 'Move selected items to'; $string['movingelement'] = 'Moving {$a}'; $string['multfactor'] = 'Multiplicator'; +$string['multfactorvalue'] = 'Multiplicator value for {$a}'; $string['multfactor_help'] = 'The multiplicator is the factor by which all grades for this grade item will be multiplied, with a maximum value of the maximum grade. For example, if the multiplicator is 2 and the maximum grade is 100, then all grades less than 50 are multiplied by 2, and all grades 50 and above are changed to 100.'; $string['mypreferences'] = 'My preferences'; $string['myreportpreferences'] = 'My report preferences'; @@ -484,6 +487,7 @@ $string['percentshort'] = '%'; $string['plusfactor'] = 'Offset'; $string['plusfactor_help'] = 'The offset is a number that is added to every grade for this grade item, after the multiplicator is applied.'; +$string['plusfactorvalue'] = 'Offset value for {$a}'; $string['points'] = 'points'; $string['pointsascending'] = 'Sort by points ascending'; $string['pointsdescending'] = 'Sort by points descending'; diff --git a/mod/assign/lang/en/assign.php b/mod/assign/lang/en/assign.php index bc4cf8134aa6b..5c53951abab33 100644 --- a/mod/assign/lang/en/assign.php +++ b/mod/assign/lang/en/assign.php @@ -299,6 +299,7 @@ $string['upgradenotimplemented'] = 'Upgrade not implemented in plugin ({$a->type} {$a->subtype})'; $string['userextensiondate'] = 'Extension granted until: {$a}'; $string['userswhoneedtosubmit'] = 'Users who need to submit: {$a}'; +$string['usergrade'] = 'User grade'; $string['viewfeedback'] = 'View feedback'; $string['viewfeedbackforuser'] = 'View feedback for user: {$a}'; $string['viewfullgradingpage'] = 'Open the full grading page to provide feedback'; diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 05a73fa1464e4..3cf8966a6e612 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -695,7 +695,6 @@ public function update_instance($formdata) { $update->teamsubmissiongroupingid = $formdata->teamsubmissiongroupingid; $update->blindmarking = $formdata->blindmarking; - $result = $DB->update_record('assign', $update); $this->instance = $DB->get_record('assign', array('id'=>$update->id), '*', MUST_EXIST); @@ -962,7 +961,8 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) { } else { $displaygrade = format_float($grade); } - $o = ''; + $o = ''; + $o .= ''; $o .= ' / ' . format_float($this->get_instance()->grade,2); $o .= ''; return $o;