Skip to content
Permalink
Browse files

MDL-34777 grading: add label to select and input tag

Conflicts:

	mod/assign/lang/en/assign.php
	mod/assign/locallib.php
  • Loading branch information...
Rossiani Wijaya Rajesh Taneja
Rossiani Wijaya authored and Rajesh Taneja committed Sep 18, 2012
1 parent c8ac480 commit b1fec412e31bb485f845549927fccc2c333b4395
@@ -373,7 +373,8 @@ static function get_weight_input($item, $type) {
if ((($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoef') && $type == 'weight') ||
($aggcoef == 'aggregationcoefextraweight' && $type == 'extra')) {
return '<input type="text" size="6" id="aggregationcoef_'.$item->id.'" name="aggregationcoef_'.$item->id.'"
return '<label class="accesshide" for="aggregationcoef_'.$item->id.'">'.get_string('extracreditvalue', 'grades', $item->itemname).'</label>'.
'<input type="text" size="6" id="aggregationcoef_'.$item->id.'" name="aggregationcoef_'.$item->id.'"
value="'.grade_edit_tree::format_number($item->aggregationcoef).'" />';
} 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 = '<input type="text" size="6" id="grademax'.$item->id.'" name="grademax_'.$item->id.'" value="'.format_float($item->grademax, $item->get_decimals()).'" />';
$grademax = '<label class="accesshide" for="grademax'.$item->id.'">'.get_string('grademax', 'grades').'</label>';
$grademax .= '<input type="text" size="6" id="grademax'.$item->id.'" name="grademax_'.$item->id.'" value="'.format_float($item->grademax, $item->get_decimals()).'" />';
}
$itemcell = clone($this->itemcell);
@@ -964,7 +966,8 @@ public function get_header_cell() {
}
public function get_category_cell($category, $levelclass, $params) {
$droplow = '<input type="text" size="3" id="droplow_'.$category->id.'" name="droplow_'.$category->id.'" value="'.$category->droplow.'" />';
$droplow = '<label class="accesshide" for="droplow_'.$category->id.'">'.get_string('droplowestvalue', 'grades').'</label>';
$droplow .= '<input type="text" size="3" id="droplow_'.$category->id.'" name="droplow_'.$category->id.'" value="'.$category->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 = '<input type="text" size="3" id="keephigh_'.$category->id.'" name="keephigh_'.$category->id.'" value="'.$category->keephigh.'" />';
$keephigh = '<label class="accesshide" for="keephigh_'.$category->id.'">'.get_string('keephigh', 'grades').'</label>';
$keephigh .= '<input type="text" size="3" id="keephigh_'.$category->id.'" name="keephigh_'.$category->id.'" value="'.$category->keephigh.'" />';
if ($this->forced) {
$keephigh = $category->keephigh;
@@ -1044,8 +1048,8 @@ public function get_item_cell($item, $params) {
$itemcell->text = '&nbsp;';
return $itemcell;
}
$multfactor = '<input type="text" size="4" id="multfactor'.$item->id.'" name="multfactor_'.$item->id.'" value="'.grade_edit_tree::format_number($item->multfactor).'" />';
$multfactor = '<label class="accesshide" for="multfactor'.$item->id.'">'.get_string('multfactorvalue', 'grades', $item->itemname).'</label>';
$multfactor .= '<input type="text" size="4" id="multfactor'.$item->id.'" name="multfactor_'.$item->id.'" value="'.grade_edit_tree::format_number($item->multfactor).'" />';
$itemcell->text = $multfactor;
return $itemcell;
@@ -1087,7 +1091,8 @@ public function get_item_cell($item, $params) {
return $itemcell;
}
$plusfactor = '<input type="text" size="4" id="plusfactor_'.$item->id.'" name="plusfactor_'.$item->id.'" value="'.grade_edit_tree::format_number($item->plusfactor).'" />';
$plusfactor = '<label class="accesshide" for="plusfactor_'. $item->id . '">'.get_string('plusfactorvalue', 'grades', $item->itemname).'</label>';
$plusfactor .= '<input type="text" size="4" id="plusfactor_'.$item->id.'" name="plusfactor_'.$item->id.'" value="'.grade_edit_tree::format_number($item->plusfactor).'" />';
$itemcell->text = $plusfactor;
return $itemcell;
@@ -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';
@@ -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;
@@ -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';
@@ -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 .= '<label class="accesshide" for="grade_'.$userid.'_'.$item->id.'">'.get_string('useractivitygrade', 'gradereport_grader', $gradelabel).'</label>';
$itemcell->text .= '<input size="6" tabindex="' . $tabindices[$item->id]['grade']
. '" type="text" class="text" title="'. $strgrade .'" name="grade_'
.$userid.'_' .$item->id.'" id="grade_'.$userid.'_'.$item->id.'" value="'.$value.'" />';
@@ -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 .= '<label class="accesshide" for="feedback_'.$userid.'_'.$item->id.'">'.get_string('useractivityfeedback', 'gradereport_grader', $feedbacklabel).'</label>';
$itemcell->text .= '<input class="quickfeedback" tabindex="' . $tabindices[$item->id]['feedback'].'" id="feedback_'.$userid.'_'.$item->id
. '" size="6" title="' . $strfeedback . '" type="text" name="feedback_'.$userid.'_'.$item->id.'" value="' . s($grade->feedback) . '" />';
}
@@ -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('<div></div>');
this.editfeedback = this.report.ajax.showquickfeedback;
this.gradelabel = this.report.Y.Node.create('<label class="accesshide" for=""></label>');
this.grade = this.report.Y.Node.create('<input type="text" class="text" value="" />');
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('<label class="accesshide" for=""></label>');
this.feedback = this.report.Y.Node.create('<input type="text" class="quickfeedback" value="" />');

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;
@@ -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';
@@ -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';
@@ -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 = '<input type="text" name="quickgrade_' . $userid . '" value="' . $displaygrade . '" size="6" maxlength="10" class="quickgrade"/>';
$o = '<label class="accesshide" for="quickgrade_' . $userid . '">' . get_string('usergrade', 'assign') . '</label>';
$o .= '<input type="text" id="quickgrade_' . $userid . '" name="quickgrade_' . $userid . '" value="' . $displaygrade . '" size="6" maxlength="10" class="quickgrade"/>';
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade,2);
$o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
return $o;

0 comments on commit b1fec41

Please sign in to comment.
You can’t perform that action at this time.