--- loncom/homework/grades.pm 2010/04/14 16:34:54 1.574.2.11 +++ loncom/homework/grades.pm 2010/01/15 17:12:18 1.589 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.574.2.11 2010/04/14 16:34:54 raeburn Exp $ +# $Id: grades.pm,v 1.589 2010/01/15 17:12:18 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -195,7 +195,8 @@ sub get_display_part { my ($partID,$symb)=@_; my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); if (defined($display) and $display ne '') { - $display.= " (<span class=\"LC_internal_info\">id $partID</span>)"; + $display.= ' (<span class="LC_internal_info">' + .&mt('Part ID: [_1]',$partID).'</span>)'; } else { $display=$partID; } @@ -206,8 +207,6 @@ sub get_display_part { #--- and parts and response type sub showResourceInfo { my ($symb,$probTitle,$checkboxes,$res_error) = @_; - my $col=3; - if ($checkboxes) { $col=4; } my $result = '<h3>'.&mt('Current Resource').': '.$probTitle.'</h3>'."\n"; my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); if (ref($res_error)) { @@ -215,32 +214,41 @@ sub showResourceInfo { return; } } - $result .='<table border="0">'; + $result.=&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row(); + if ($checkboxes) { + $result.='<th> </th>'; + } + $result.='<th>'.&mt('Problem Part').'</th>' + .'<th>'.&mt('Res. ID').'</th>' + .'<th>'.&mt('Type').'</th>' + .&Apache::loncommon::end_data_table_header_row(); my %resptype = (); my $hdgrade='no'; my %partsseen; foreach my $partID (sort(keys(%$responseType))) { - foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) { - my $handgrade=$$handgrade{$partID.'_'.$resID}; - my $responsetype = $responseType->{$partID}->{$resID}; - $hdgrade = $handgrade if ($handgrade eq 'yes'); - $result.='<tr>'; - if ($checkboxes) { - if (exists($partsseen{$partID})) { - $result.="<td> </td>"; - } else { - $result.="<td><input type='checkbox' name='vPart' value='$partID' checked='checked' /></td>"; - } - $partsseen{$partID}=1; - } - my $display_part=&get_display_part($partID,$symb); - $result.='<td><b>'.&mt('Part').': </b>'.$display_part. - ' <span class="LC_internal_info">'.$resID.'</span></td>'. - '<td><b>'.&mt('Type').': </b>'.$responsetype.'</td></tr>'; -# '<td>'.&mt('<b>Handgrade: </b>[_1]',$handgrade).'</td></tr>'; - } + foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) { + my $handgrade=$$handgrade{$partID.'_'.$resID}; + my $responsetype = $responseType->{$partID}->{$resID}; + $hdgrade = $handgrade if ($handgrade eq 'yes'); + $result.=&Apache::loncommon::start_data_table_row(); + if ($checkboxes) { + if (exists($partsseen{$partID})) { + $result.="<td> </td>"; + } else { + $result.="<td><input type='checkbox' name='vPart' value='$partID' checked='checked' /></td>"; + } + $partsseen{$partID}=1; + } + my $display_part=&get_display_part($partID,$symb); + $result.='<td>'.$display_part.'</td>' + .'<td>'.'<span class="LC_internal_info">'.$resID.'</span></td>' + .'<td>'.&mt($responsetype).'</td>' +# .'<td>'.&mt('<b>Handgrade: </b>[_1]',$handgrade).'</td>' + .&Apache::loncommon::end_data_table_row(); + } } - $result.='</table>'."\n"; + $result.=&Apache::loncommon::end_data_table(); return $result,$responseType,$hdgrade,$partlist,$handgrade; } @@ -831,11 +839,14 @@ sub verifyreceipt { } } if ($matches == 0) { - $string = $title.&mt('No match found for the above receipt number.'); + $string = $title + .'<p class="LC_warning">' + .&mt('No match found for the above receipt number.') + .'</p>'; } else { $string = &jscriptNform($symb).$title. '<p>'. - &mt('The above receipt number matches the following [numerate,_1,student].',$matches). + &mt('The above receipt number matches the following [quant,_1,student].',$matches). '</p>'. $header. $contents. @@ -982,8 +993,8 @@ LISTJAVASCRIPT # checkall buttons $gradeTable.=&check_script('gradesub', 'stuinfo'); $gradeTable.='<input type="button" '."\n". - 'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". - 'value="'.&mt('Next').' →" /> <br />'."\n"; + 'onclick="javascript:checkSelect(this.form.stuinfo);" '."\n". + 'value="'.&mt('Next').' →" /> <br />'."\n"; $gradeTable.=&check_buttons(); my ($classlist, undef, $fullname) = &getclasslist($getsec,'1',$getgroup); $gradeTable.= &Apache::loncommon::start_data_table(). @@ -1100,9 +1111,9 @@ LISTJAVASCRIPT } $gradeTable.=&Apache::loncommon::end_data_table()."\n". - '<input type="button" '. - 'onClick="javascript:checkSelect(this.form.stuinfo);" '. - 'value="'.&mt('Next').' →" /></form>'."\n"; + '<input type="button" '. + 'onclick="javascript:checkSelect(this.form.stuinfo);" '. + 'value="'.&mt('Next').' →" /></form>'."\n"; if ($ctr == 0) { my $num_students=(scalar(keys(%$fullname))); if ($num_students eq 0) { @@ -1606,8 +1617,8 @@ INNERJS pDoc = pWin.document; pDoc.write("<\\/table>"); pDoc.write("<\\/td><\\/tr><\\/table> "); - pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\"> "); - pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); + pDoc.write("<input type=\\"button\\" value=\\"Save\\" onclick=\\"javascript:checkInput()\\"> "); + pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onclick=\\"self.close()\\"><br /><br />"); pDoc.write("<\\/form>"); pDoc.write('$end_page_msg_central'); pDoc.close(); @@ -1680,8 +1691,8 @@ INNERJS var hDoc = hwdWin.document; hDoc.write("<\\/table>"); hDoc.write("<\\/td><\\/tr><\\/table> "); - hDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:updateChoice(1)\\"> "); - hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />"); + hDoc.write("<input type=\\"button\\" value=\\"Save\\" onclick=\\"javascript:updateChoice(1)\\"> "); + hDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onclick=\\"self.close()\\"><br /><br />"); hDoc.write("<\\/form>"); hDoc.write('$end_page_highlight_central'); hDoc.close(); @@ -1700,6 +1711,25 @@ sub get_increment { return $increment; } +sub gradeBox_start { + return ( + &Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .'<th>'.&mt('Part').'</th>' + .'<th>'.&mt('Points').'</th>' + .'<th> </th>' + .'<th>'.&mt('Assign Grade').'</th>' + .'<th>'.&mt('Weight').'</th>' + .'<th>'.&mt('Grade Status').'</th>' + .&Apache::loncommon::end_data_table_header_row() + ); +} + +sub gradeBox_end { + return ( + &Apache::loncommon::end_data_table() + ); +} #--- displays the grading box, used in essay type problem and grading by page/sequence sub gradeBox { my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; @@ -1719,7 +1749,7 @@ sub gradeBox { if ($last_resets{$partid}) { $aggtries = &get_num_tries($record,$last_resets{$partid},$partid); } - $result.='<table border="0"><tr>'; + $result.=&Apache::loncommon::start_data_table_row(); my $ctr = 0; my $thisweight = 0; my $increment = &get_increment(); @@ -1727,7 +1757,7 @@ sub gradeBox { my $radio.='<table border="0"><tr>'."\n"; # display radio buttons in a nice table 10 across while ($thisweight<=$wgt) { $radio.= '<td><span class="LC_nobreak"><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '. - 'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. + 'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','. $thisweight.')" value="'.$thisweight.'" '. ($score eq $thisweight ? 'checked="checked"':'').' /> '.$thisweight."</label></span></td>\n"; $radio.=(($ctr+1)%10 == 0 ? '</tr><tr>' : ''); @@ -1738,13 +1768,13 @@ sub gradeBox { my $line.='<input type="text" name="GD_BOX'.$counter.'_'.$partid.'"'. ($score ne ''? ' value = "'.$score.'"':'').' size="4" '. - 'onChange="javascript:updateRadio(this.form,\''.$counter.'_'.$partid.'\','. + 'onchange="javascript:updateRadio(this.form,\''.$counter.'_'.$partid.'\','. $wgt.')" /></td>'."\n"; $line.='<td>/'.$wgt.' '.$wgtmsg. ($$record{'resource.'.$partid.'.solved'} eq 'correct_by_student' ? ' '.$checkIcon : ''). - ' </td><td><b>'.&mt('Grade Status').':</b>'."\n"; - $line.='<select name="GD_SEL'.$counter.'_'.$partid.'" '. - 'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; + ' </td>'."\n"; + $line.='<td><select name="GD_SEL'.$counter.'_'.$partid.'" '. + 'onchange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n"; if ($$record{'resource.'.$partid.'.solved'} eq 'excused') { $line.='<option></option>'. '<option value="excused" selected="selected">'.&mt('excused').'</option>'; @@ -1754,9 +1784,11 @@ sub gradeBox { } $line.='<option value="reset status">'.&mt('reset status').'</option></select>'."\n"; + + #&mt('<td><b>Part:</b></td><td>[_1]</td><td><b>Points:</b></td><td>[_2]</td><td>or</td><td>[_3]</td>',$display_part,$radio,$line); $result .= - '<td><b>'.&mt('Part').':</b></td><td>'.$display_part.'</td><td><b>'.&mt('Points').':</b></td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'; - $result.='</tr></table>'."\n"; + '<td>'.$display_part.'</td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'; + $result.=&Apache::loncommon::end_data_table_row(); $result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n". '<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n". '<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'. @@ -1777,7 +1809,7 @@ sub handback_box { my ($symb,$uname,$udom,$counter,$partid,$record,$res_error) = @_; my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); my (@respids); - my @part_response_id = &flatten_responseType($responseType); + my @part_response_id = &flatten_responseType($responseType); foreach my $part_response_id (@part_response_id) { my ($part,$resp) = @{ $part_response_id }; if ($part eq $partid) { @@ -1837,26 +1869,23 @@ sub show_problem { $companswer=~s|name="submit"|name="would_have_been_submit"|g; } $rendered= - '<div class="LC_grade_show_problem_header">'. - &mt('View of the problem'). - '</div><div class="LC_grade_show_problem_problem">'. - $rendered. - '</div>'; + '<div class="LC_Box">' + .'<h3 class="LC_hcell">'.&mt('View of the problem').'</h3>' + .$rendered + .'</div>'; $companswer= - '<div class="LC_grade_show_problem_header">'. - &mt('Correct answer'). - '</div><div class="LC_grade_show_problem_problem">'. - $companswer. - '</div>'; + '<div class="LC_Box">' + .'<h3 class="LC_hcell">'.&mt('Correct answer').'</h3>' + .$companswer + .'</div>'; my $result; if ($mode eq 'both') { - $result=$rendered.$companswer; + $result=$rendered.$companswer; } elsif ($mode eq 'text') { - $result=$rendered; + $result=$rendered; } elsif ($mode eq 'answer') { - $result=$companswer; + $result=$companswer; } - $result='<div class="LC_grade_show_problem">'.$result.'</div>'; return $result; } @@ -2034,7 +2063,7 @@ sub submission { $request->print(<<KEYWORDS); <b>Keyword Options:</b> <a href="javascript:keywords(document.SCORE);" target="_self">List</a> -<a href="#" onMouseDown="javascript:getSel(); return false" +<a href="#" onmousedown="javascript:getSel(); return false" CLASS="page">Paste Selection to List</a> <a href="javascript:kwhighlight();" target="_self">Highlight Attribute</a><br /><br /> KEYWORDS @@ -2081,18 +2110,16 @@ KEYWORDS $request->print(($counter == 0 ? '' : '<br />')); my $result='<div class="LC_grade_submissions">'; - $result.='<div class="LC_grade_submissions_header">'; - $result.= &mt('Submissions'); + $result.='<div class="LC_Box">' + .'<h3 class="LC_hcell">'.&mt('Submissions').'</h3>'; $result.='<input type="hidden" name="name'.$counter. - '" value="'.$env{'form.fullname'}.'" />'."\n"; + '" value="'.$env{'form.fullname'}.'" />'."\n"; if ($env{'form.handgrade'} eq 'no') { - $result.='<span class="LC_grade_check_note">'. - &mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)."</span>\n"; - + $result.='<p class="LC_info">' + .&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon) + ."</p>\n"; } - - # If any part of the problem is an essay-response (handgraded), then check for collaborators my $fullname; my $col_fullnames = []; @@ -2103,9 +2130,9 @@ KEYWORDS $result.=$sub_result; } $request->print($result."\n"); - $request->print('</div>'."\n"); + # print student answer/submission - # Options are (1) Handgaded submission only + # Options are (1) Handgraded submission only # (2) Last submission, includes submission that is not handgraded # (for multi-response type part) # (3) Last submission plus the parts info @@ -2115,10 +2142,10 @@ KEYWORDS my $lastsubonly; - if ($$timestamp eq '') { - $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; - } else { - $lastsubonly = '<div class="LC_grade_submissions_body"> <b>Date Submitted:</b> '.$$timestamp."\n"; + if ($$timestamp eq '') { + $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; + } else { + $lastsubonly = '<div class="LC_grade_submissions_body"> <b>Date Submitted:</b> '.$$timestamp."\n"; my %seenparts; my @part_response_id = &flatten_responseType($responseType); @@ -2142,9 +2169,11 @@ KEYWORDS } my $responsetype = $responseType->{$partid}->{$respid}; if (!exists($record{"resource.$partid.$respid.submission"})) { - $lastsubonly.="\n".'<div class="LC_grade_submission_part"><b>Part:</b> '. - $display_part.' <span class="LC_internal_info">( ID '.$respid. - ' )</span> '. + $lastsubonly.="\n".'<div class="LC_grade_submission_part">'. + '<b>'.&mt('Part: [_1]',$display_part).'</b>'. + ' <span class="LC_internal_info">'. + '('.&mt('Part ID: [_1]',$respid).')</b>'. + '</span> '. '<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>'; next; } @@ -2180,9 +2209,11 @@ KEYWORDS ($env{'form.lastSub'} eq 'hdgrade' && $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { my $display_part=&get_display_part($partid,$symb); - $lastsubonly.='<div class="LC_grade_submission_part"><b>Part:</b> '. - $display_part.' <span class="LC_internal_info">( ID '.$respid. - ' )</span> '; + $lastsubonly.='<div class="LC_grade_submission_part">'. + '<b>'.&mt('Part: [_1]',$display_part).'</b>'. + ' <span class="LC_internal_info">'. + '('.&mt('Part ID: [_1]',$respid).')'. + '</b></span> '; my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); if (@$files) { $lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain viruses').'</span><br />'; @@ -2202,7 +2233,7 @@ KEYWORDS } } } - $lastsubonly.='</div>'."\n"; + $lastsubonly.='</div>'."\n"; # End: LC_grade_submissions_body } $request->print($lastsubonly); } elsif ($env{'form.lastSub'} eq 'datesub') { @@ -2220,7 +2251,7 @@ KEYWORDS # return if view submission with no grading option if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) { my $toGrade.='<input type="button" value="Grade Student" '. - 'onClick="javascript:checksubmit(this.form,\'Grade Student\',\'' + 'onclick="javascript:checksubmit(this.form,\'Grade Student\',\'' .$counter.'\');" target="_self" /> '."\n" if (&canmodify($usec)); $toGrade.='</div>'."\n"; if (($env{'form.command'} eq 'submission') || @@ -2264,11 +2295,11 @@ KEYWORDS my @partlist; my @gradePartRespid; my @part_response_id = &flatten_responseType($responseType); - $request->print('<div class="LC_grade_assign">'. - - '<div class="LC_grade_assign_header">'. - &mt('Assign Grades').'</div>'. - '<div class="LC_grade_assign_body">'); + $request->print( + '<div class="LC_Box">' + .'<h3 class="LC_hcell">'.&mt('Assign Grades').'</h3>' + ); + $request->print(&gradeBox_start()); # <div class="LC_grade_assign_body"> foreach my $part_response_id (@part_response_id) { my ($partid,$respid) = @{ $part_response_id }; my $part_resp = join('_',@{ $part_response_id }); @@ -2280,7 +2311,8 @@ KEYWORDS push(@gradePartRespid,$partid.'.'.$respid); $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); } - $request->print('</div></div>'); + $request->print(&gradeBox_end()); # </div> + $request->print('</div>'); $request->print('<div class="LC_grade_info_links">'); if ($perm{'vgr'}) { @@ -2317,7 +2349,7 @@ KEYWORDS if ($counter == $total) { my $endform='<table border="0"><tr><td>'."\n"; $endform.='<input type="button" value="'.&mt('Save & Next').'" '. - 'onClick="javascript:checksubmit(this.form,\'Save & Next\','. + 'onclick="javascript:checksubmit(this.form,\'Save & Next\','. $total.','.scalar(@partlist).');" target="_self" /> '."\n"; my $ntstu ='<select name="NTSTU">'. '<option>1</option><option>2</option>'. @@ -2327,9 +2359,9 @@ KEYWORDS $ntstu =~ s/<option>$nsel</<option selected="selected">$nsel</; $endform.=&mt('[_1]student(s)',$ntstu); $endform.=' <input type="button" value="'.&mt('Previous').'" '. - 'onClick="javascript:checksubmit(this.form,\'Previous\');" target="_self" /> '."\n". + 'onclick="javascript:checksubmit(this.form,\'Previous\');" target="_self" /> '."\n". '<input type="button" value="'.&mt('Next').'" '. - 'onClick="javascript:checksubmit(this.form,\'Next\');" target="_self" /> '; + 'onclick="javascript:checksubmit(this.form,\'Next\');" target="_self" /> '; $endform.=&mt('(Next and Previous (student) do not save the scores.)')."\n" ; $endform.="<input type='hidden' value='".&get_increment(). "' name='increment' />"; @@ -3318,11 +3350,11 @@ sub viewgrades { } $radio.='</tr></table>'; my $line = '<input type="text" name="TEXTVAL_'. - $partid.'" size="4" '.'onChange="javascript:writePoint(\''. + $partid.'" size="4" '.'onchange="javascript:writePoint(\''. $partid.'\','.$weight{$partid}.',\'textval\')" /> /'. $weight{$partid}.' '.&mt('(problem weight)').'</td>'."\n"; $line.= '<td><b>'.&mt('Grade Status').':</b><select name="SELVAL_'.$partid.'"'. - 'onChange="javascript:writeRadText(\''.$partid.'\','. + 'onchange="javascript:writeRadText(\''.$partid.'\','. $weight{$partid}.')"> '. '<option selected="selected"> </option>'. '<option value="excused">'.&mt('excused').'</option>'. @@ -3336,14 +3368,14 @@ sub viewgrades { $result.= &Apache::loncommon::start_data_table_row()."\n". - '<td><b>'.&mt('Part').':</b></td><td>'.$display_part.'</td><td><b>'.&mt('Points').':</b></td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'. + '<td><b>'.&mt('Part:').'</b></td><td>'.$display_part.'</td><td><b>'.&mt('Points:').'</b></td><td>'.$radio.'</td><td>'.&mt('or').'</td><td>'.$line.'</td>'. &Apache::loncommon::end_data_table_row()."\n"; $ctsparts++; } $result.=&Apache::loncommon::end_data_table()."\n". '<input type="hidden" name="totalparts" value="'.$ctsparts.'" />'; $result.='<input type="button" value="'.&mt('Revert to Default').'" '. - 'onClick="javascript:resetEntry('.$ctsparts.');" />'; + 'onclick="javascript:resetEntry('.$ctsparts.');" />'; #table listing all the students in a section/class #header of table @@ -3407,7 +3439,7 @@ sub viewgrades { $result.=&Apache::loncommon::end_data_table(); $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n"; $result.='<input type="button" value="'.&mt('Save').'" '. - 'onClick="javascript:submit();" target="_self" /></form>'."\n"; + 'onclick="javascript:submit();" target="_self" /></form>'."\n"; if (scalar(%$fullname) eq 0) { my $colspan=3+scalar(@parts); my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); @@ -3459,7 +3491,7 @@ sub viewstudentgrade { 'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n"; $result.='<input type="text" name="'. 'GD_'.$student.'_'.$part.'_awarded" '. - 'onChange="javascript:changeSelect(\''.$part.'\',\''.$student. + 'onchange="javascript:changeSelect(\''.$part.'\',\''.$student. '\')" value="'.$pts.'" size="4" /></td>'."\n"; } elsif ($type eq 'solved') { my ($status,$foo)=split(/_/,$score,2); @@ -3468,7 +3500,7 @@ sub viewstudentgrade { $part.'_solved_s" value="'.$status.'" />'."\n"; $result.=' <select name="'. 'GD_'.$student.'_'.$part.'_solved" '. - 'onChange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n"; + 'onchange="javascript:changeOneScore(\''.$part.'\',\''.$student.'\')" >'."\n"; $result.= (($status eq 'excused') ? '<option> </option><option selected="selected" value="excused">'.&mt('excused').'</option>' : '<option selected="selected"> </option><option value="excused">'.&mt('excused').'</option>')."\n"; $result.='<option value="reset status">'.&mt('reset status').'</option>'; @@ -3828,7 +3860,7 @@ $result Total number of records found in file: $distotal <hr /> Enter as many fields as you can. The system will inform you and bring you back to this page if the data selected is insufficient to run your class.<hr /> -<input type="button" value="Reverse Association" onClick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> +<input type="button" value="Reverse Association" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> <label><input type="checkbox" name="noFirstLine" $checked />$ignore</label> <input type="hidden" name="associate" value="" /> <input type="hidden" name="phase" value="three" /> @@ -3851,7 +3883,6 @@ ENDPICK } sub csvupload_fields { - my ($symb) = @_; my ($symb,$errorref) = @_; my (@parts) = &getpartlist($symb,$errorref); if (ref($errorref)) { @@ -3884,7 +3915,7 @@ sub csvuploadmap_footer { </table> <input type="hidden" name="nfields" value="$i" /> <input type="hidden" name="keyfields" value="$keyfields" /> -<input type="button" onClick="javascript:verify(this.form)" value="Assign Grades" /><br /> +<input type="button" onclick="javascript:verify(this.form)" value="Assign Grades" /><br /> </form> ENDPICK } @@ -3929,7 +3960,7 @@ sub upcsvScores_form { <input type="hidden" name="probTitle" value="$env{'form.probTitle'}" /> <input type="hidden" name="saveState" value="$env{'form.saveState'}" /> $upfile_select -<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="$upload" /> +<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> <label><input type="checkbox" name="noFirstLine" />$ignore</label> </form> ENDUPFORM @@ -3960,7 +3991,7 @@ sub csvuploadmap { my ($i,$keyfields); if (@records) { my $fieldserror; - my @fields=&csvupload_fields($symb,\$fieldserror); + my @fields=&csvupload_fields($symb,\$fieldserror); if ($fieldserror) { $request->print(&navmap_errormsg()); return; @@ -4204,7 +4235,7 @@ LISTJAVASCRIPT my ($titles,$symbx) = &getSymbMap($map_error); if ($map_error) { $request->print(&navmap_errormsg()); - return; + return; } my ($curpage) =&Apache::lonnet::decode_symb($symb); # my ($curpage,$mapId) =&Apache::lonnet::decode_symb($symb); @@ -4252,7 +4283,7 @@ LISTJAVASCRIPT $result.=' <b>'.&mt('Use CODE').': </b> <input type="text" name="CODE" value="" /> <br />'."\n"; $result.=' <input type="button" '. - 'onClick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /><br />'."\n"; + 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /><br />'."\n"; $request->print($result); @@ -4291,7 +4322,7 @@ LISTJAVASCRIPT } $studentTable.=&Apache::loncommon::end_data_table()."\n"; $studentTable.='<input type="button" '. - 'onClick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /></form>'."\n"; + 'onclick="javascript:checkPickOne(this.form);" value="'.&mt('Next').' →" /></form>'."\n"; $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); @@ -4469,11 +4500,13 @@ sub displayPage { } if (&canmodify($usec)) { + $studentTable.=&gradeBox_start(); foreach my $partid (@{$parts}) { $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record); $studentTable.='<input type="hidden" name="q_'.$question.'" value="'.$partid.'" />'."\n"; $question++; } + $studentTable.=&gradeBox_end(); $prob++; } $studentTable.='</td></tr>'; @@ -4482,10 +4515,11 @@ sub displayPage { $curRes = $iterator->next(); } - $studentTable.='</table>'."\n". - '<input type="button" value="'.&mt('Save').'" '. - 'onClick="javascript:checkSubmitPage(this.form,'.$question.');" />'. - '</form>'."\n"; + $studentTable.= + '</table>'."\n". + '<input type="button" value="'.&mt('Save').'" '. + 'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'. + '</form>'."\n"; $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); @@ -4543,13 +4577,16 @@ sub displaySubByDates { my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); - $displaySub[0].='<b>'.&mt('Part:').'</b> '.$display_part.' '; - $displaySub[0].='<span class="LC_internal_info">('.&mt('ID').' '. - $responseId.')</span> <b>'; + $displaySub[0].='<span class="LC_nobreak"'; + $displaySub[0].='<b>'.&mt('Part: [_1]',$display_part).'</b>' + .' <span class="LC_internal_info">' + .'('.&mt('Part ID: [_1]',$responseId).')' + .'</span>' + .' <b>'; if ($$record{"$where.$partid.tries"} eq '') { - $displaySub[0].=&mt('Trial not counted'); + $displaySub[0].=&mt('Trial not counted'); } else { - $displaySub[0].=&mt('Trial [_1]', + $displaySub[0].=&mt('Trial: [_1]', $$record{"$where.$partid.tries"}); } my $responseType=($isTask ? 'Task' @@ -4560,7 +4597,8 @@ sub displaySubByDates { &get_order($partid,$responseId,$symb,$uname,$udom, $no_increment); } - $displaySub[0].='</b> '. + $displaySub[0].='</b></span>'; # /nobreak + $displaySub[0].=' '. &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'<br />'; } } @@ -4621,6 +4659,7 @@ sub updateGradeByPage { $request->print($result); + my $navmap = Apache::lonnavmaps::navmap->new(); unless (ref($navmap)) { $request->print(&navmap_errormsg()); @@ -4770,7 +4809,7 @@ sub updateGradeByPage { # #------------------------------------------------------------------- -#--------------------Bubblesheet (Scantron) Grading----------------------------------- +#-------------------- Bubblesheet (Scantron) Grading ------------------- # #------ start of section for handling grading by page/sequence --------- @@ -4829,9 +4868,7 @@ the homework problem. Returns html hidden inputs used to hold context/default values. Arguments: - $symb - $symb of the current resource - $map_error - ref to scalar which will container error if - $navmap object is unavailable in &getSymbMap(). + $symb - $symb of the current resource =cut @@ -4850,7 +4887,9 @@ sub defaultFormData { Return html dropdown of possible sequences to grade Arguments: - $symb - $symb of the current resource + $symb - $symb of the current resource + $map_error - ref to scalar which will container error if + $navmap object is unavailable in &getSymbMap(). =cut @@ -5226,7 +5265,7 @@ sub scantron_selectphase { <input name="command" value="scantronupload_save" type="hidden" /> '.&mt('File to upload: [_1]','<input type="file" name="upfile" size="50" />').' <br /> - <input type="button" onClick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> + <input type="button" onclick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> </form> '); @@ -6757,7 +6796,7 @@ sub scantron_validate_ID { #get scantron line setup my %scantron_config=&get_scantron_config($env{'form.scantron_format'}); my ($scanlines,$scan_data)=&scantron_getfile(); - + my $nav_error; &scantron_get_maxbubble(\$nav_error); # parse needs the bubble_lines.. array. if ($nav_error) { @@ -7399,7 +7438,6 @@ sub scantron_validate_doublebubble { sub scantron_get_maxbubble { my ($nav_error) = @_; - if (defined($env{'form.scantron_maxbubble'}) && $env{'form.scantron_maxbubble'}) { &restore_bubble_lines(); @@ -7414,7 +7452,6 @@ sub scantron_get_maxbubble { if (ref($nav_error)) { $$nav_error = 1; } - return; } my $map=$navmap->getResourceByUrl($sequence); my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); @@ -7920,7 +7957,7 @@ sub scantron_upload_scantron_data { &Apache::lonhtmlcommon::end_pick_box().'<br /> <input name="command" value="scantronupload_save" type="hidden" /> -<input type="button" onClick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> +<input type="button" onclick="javascript:checkUpload(this.form);" value="'.&mt('Upload Bubblesheet Data').'" /> </form> '); return ''; @@ -8447,36 +8484,50 @@ sub grading_menu { 'saveState'=>"", 'gradingMenu'=>1, 'showgrading'=>"yes"); - my $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - my @menu = ({ url => $url, - name => &mt('Manual Grading/View Submissions'), - short_description => - &mt('Start the process of hand grading submissions.'), - }); + + my $url1 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'csvform'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Upload Scores'), - short_description => - &mt('Specify a file containing the class scores for current resource.')}); + my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'processclicker'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Process Clicker'), - short_description => - &mt('Specify a file containing the clicker information for this resource.')}); + my $url3 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + $fields{'command'} = 'scantron_selectphase'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => $url, - name => &mt('Grade/Manage/Review Bubblesheets'), - short_description => - &mt('Grade bubblesheet exams, upload/download bubblesheet data files, and review previously graded bubblesheet exams.')}); - $fields{'command'} = 'verify'; - $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push(@menu, { url => "", - name => &mt('Verify Receipt No.'), - short_description => - &mt('')}); + my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + + my @menu = ({ categorytitle=>'Course Grading', + items =>[ + { linktext => 'Manual Grading/View Submissions', + url => $url1, + permission => 'F', + icon => 'edit-find-replace.png', + linktitle => 'Start the process of hand grading submissions.' + }, + { linktext => 'Upload Scores', + url => $url2, + permission => 'F', + icon => 'uploadscores.png', + linktitle => 'Specify a file containing the class scores for current resource.' + }, + { linktext => 'Process Clicker', + url => $url3, + permission => 'F', + icon => 'addClickerInfoFile.png', + linktitle => 'Specify a file containing the clicker information for this resource.' + }, + { linktext => 'Grade/Manage/Review Bubblesheets', + url => $url4, + permission => 'F', + icon => 'stat.png', + linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.' + } + ] + }); + + #$fields{'command'} = 'verify'; + #$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); + # # Create the menu my $Str; # $Str .= '<h2>'.&mt('Please select a grading task').'</h2>'; @@ -8488,24 +8539,15 @@ sub grading_menu { '<input type="hidden" name="saveState" value="" />'."\n". '<input type="hidden" name="gradingMenu" value="1" />'."\n". '<input type="hidden" name="showgrading" value="yes" />'."\n"; - foreach my $menudata (@menu) { - if ($menudata->{'name'} ne &mt('Verify Receipt No.')) { - $Str .=' <h3><a '. - $menudata->{'jscript'}. - ' href="'. - $menudata->{'url'}.'" >'. - $menudata->{'name'}."</a></h3>\n"; - } else { - $Str .='<hr /><input type="button" value="'.&mt('Verify Receipt No.').'" '. - $menudata->{'jscript'}. - ' onClick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '. - ' /> '. - &Apache::lonnet::recprefix($env{'request.course.id'}). - '-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')" />'; - } - $Str .= ' '.(' 'x8).$menudata->{'short_description'}. - "\n"; - } + + $Str .= Apache::lonhtmlcommon::generate_menu(@menu); + #$menudata->{'jscript'} + $Str .='<hr /><input type="button" value="'.&mt('Verify Receipt No.').'" '. + ' onclick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '. + ' /> '. + &Apache::lonnet::recprefix($env{'request.course.id'}). + '-<input type="text" name="receipt" size="4" onchange="javascript:checkReceiptNo(this.form,\'OK\')" />'; + $Str .="</form>\n"; my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box."); $request->print(<<GRADINGMENUJS); @@ -8622,102 +8664,91 @@ GRADINGMENUJS '<input type="hidden" name="showgrading" value="yes" />'."\n"; $result.=' - <div class="LC_grade_select_mode"> - <div class="LC_grade_select_mode_current"> - <h2> - '.&mt('Grade Current Resource').' - </h2> - <div class="LC_grade_select_mode_body"> - <div class="LC_grades_resource_info"> - '.$table.' - </div> - <div class="LC_grade_select_mode_selector"> - <div class="LC_grade_select_mode_selector_header"> - '.&mt('Sections').' - </div> - <div class="LC_grade_select_mode_selector_body"> - <select name="section" multiple="multiple" size="5">'."\n"; - if (ref($sections)) { - foreach my $section (sort(@$sections)) { - $result.='<option value="'.$section.'" '. - ($saveSec eq $section ? 'selected="selected"':'').'>'.$section.'</option>'."\n"; - } - } +<h2> + '.&mt('Grade Current Resource').' +</h2> +<div> + '.$table.' +</div> + +<div class="LC_columnSection"> + + <fieldset> + <legend> + '.&mt('Sections').' + </legend> + <select name="section" multiple="multiple" size="5">'."\n"; + $result.= $selsec; $result.= '<option value="all" '.($saveSec eq 'all' ? 'selected="selected"' : ''). '>all</option></select> '; $result.=' - </div> - </div> - <div class="LC_grade_select_mode_selector"> - <div class="LC_grade_select_mode_selector_header"> - '.&mt('Groups').' - </div> - <div class="LC_grade_select_mode_selector_body"> - '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' - </div> - </div> - <div class="LC_grade_select_mode_selector"> - <div class="LC_grade_select_mode_selector_header"> - '.&mt('Access Status').' - </div> - <div class="LC_grade_select_mode_selector_body"> - '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' - </div> - </div> - <div class="LC_grade_select_mode_selector"> - <div class="LC_grade_select_mode_selector_header"> - '.&mt('Submission Status').' - </div> - <div class="LC_grade_select_mode_selector_body"> - <select name="submitonly" size="5"> - <option value="yes" '. ($saveSub eq 'yes' ? 'selected="selected"' : '').'>'.&mt('with submissions').'</option> - <option value="queued" '. ($saveSub eq 'queued' ? 'selected="selected"' : '').'>'.&mt('in grading queue').'</option> - <option value="graded" '. ($saveSub eq 'graded' ? 'selected="selected"' : '').'>'.&mt('with ungraded submissions').'</option> - <option value="incorrect" '.($saveSub eq 'incorrect' ? 'selected="selected"' : '').'>'.&mt('with incorrect submissions').'</option> + </fieldset> + + <fieldset> + <legend> + '.&mt('Groups').' + </legend> + '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' + </fieldset> + + <fieldset> + <legend> + '.&mt('Access Status').' + </legend> + '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' + </fieldset> + + <fieldset> + <legend> + '.&mt('Submission Status').' + </legend> + <select name="submitonly" size="5"> + <option value="yes" '. ($saveSub eq 'yes' ? 'selected="selected"' : '').'>'.&mt('with submissions').'</option> + <option value="queued" '. ($saveSub eq 'queued' ? 'selected="selected"' : '').'>'.&mt('in grading queue').'</option> + <option value="graded" '. ($saveSub eq 'graded' ? 'selected="selected"' : '').'>'.&mt('with ungraded submissions').'</option> + <option value="incorrect" '.($saveSub eq 'incorrect' ? 'selected="selected"' : '').'>'.&mt('with incorrect submissions').'</option> <option value="all" '. ($saveSub eq 'all' ? 'selected="selected"' : '').'>'.&mt('with any status').'</option> - </select> - </div> - </div> - <div class="LC_grade_select_mode_type_body"> - <div class="LC_grade_select_mode_type"> + </select> + </fieldset> + +</div> + +<br /> + <div> + <div> <label> <input type="radio" name="radioChoice" value="submission" '. ($saveCmd eq 'submission' ? 'checked="checked"' : '').' /> '. &mt('Select individual students to grade and view submissions.').' - </label> + </label> </div> - <div class="LC_grade_select_mode_type"> - <label> + <div> + <label> <input type="radio" name="radioChoice" value="viewgrades" '. ($saveCmd eq 'viewgrades' ? 'checked="checked"' : '').' /> '. &mt('Grade all selected students in a grading table.').' </label> </div> - <div class="LC_grade_select_mode_type"> - <input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next->').'" /> + <div> + <input type="button" onclick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next').' →" /> </div> </div> - </div> - </div> - <div class="LC_grade_select_mode_page"> + + <h2> '.&mt('Grade Complete Folder for One Student').' </h2> - <div class="LC_grades_select_mode_body"> - <div class="LC_grade_select_mode_type_body"> - <div class="LC_grade_select_mode_type"> + <div> + <div> <label> <input type="radio" name="radioChoice" value="pickStudentPage" '. - ($saveCmd eq 'pickStudentPage' ? 'checked="checked"' : '').' /> '. + ($saveCmd eq 'pickStudentPage' ? 'checked="checked"' : '').' /> '. &mt('The <b>complete</b> page/sequence/folder: For one student').' </label> </div> - <div class="LC_grade_select_mode_type"> - <input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next->').'" /> + <div> + <input type="button" onclick="javascript:checkChoice(this.form,\'2\');" value="'.&mt('Next').' →" /> </div> - </div> </div> - </div> - </div> </form>'; $result .= &show_grading_menu_form($symb); return $result; @@ -8895,17 +8926,17 @@ function sanitycheck() { <input type="hidden" name="saveState" value="$env{'form.saveState'}" /> <input type="file" name="upfile" size="50" /> <br /><label>$type: $selectform</label> -<br /><label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onClick="sanitycheck()" />$attendance </label> -<br /><label><input type="radio" name="gradingmechanism" value="personnel"$checked{'personnel'} onClick="sanitycheck()" />$personnel</label> -<br /><label><input type="radio" name="gradingmechanism" value="specific"$checked{'specific'} onClick="sanitycheck()" />$specific </label> +<br /><label><input type="radio" name="gradingmechanism" value="attendance"$checked{'attendance'} onclick="sanitycheck()" />$attendance </label> +<br /><label><input type="radio" name="gradingmechanism" value="personnel"$checked{'personnel'} onclick="sanitycheck()" />$personnel</label> +<br /><label><input type="radio" name="gradingmechanism" value="specific"$checked{'specific'} onclick="sanitycheck()" />$specific </label> <input type="text" name="specificid" value="$env{'form.specificid'}" size="20" /> -<br /><label><input type="radio" name="gradingmechanism" value="given"$checked{'given'} onClick="sanitycheck()" />$given </label> +<br /><label><input type="radio" name="gradingmechanism" value="given"$checked{'given'} onclick="sanitycheck()" />$given </label> <br /> <input type="text" name="givenanswer" size="50" /> <input type="hidden" name="waschecked" value="$env{'form.gradingmechanism'}" /> -<br /><label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onChange="sanitycheck()" /></label> -<br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onChange="sanitycheck()" /></label> -<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="$upload" /> +<br /><label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label> +<br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onchange="sanitycheck()" /></label> +<br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" /> </form> ENDUPFORM $result.='</td></tr></table>'."\n".