';
@@ -1352,7 +1343,7 @@ sub processHandGrade {
my $ctr = 0;
while ($ctr < $ngrade) {
my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr});
- my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
+ my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr);
if ($errorflag eq 'no_score') {
$ctr++;
next;
@@ -1366,7 +1357,9 @@ sub processHandGrade {
foreach (@msgnum) {
$message.=$ENV{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne '');
}
- #$message =~ s/\s+/ /g;
+ $message =~ s/<([^>]|\n)*>//g; # removes html codes Or should this be lonnet::escape ??
+ $message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
+ $message.=" for $ENV{'form.probTitle'} ";
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,
$ENV{'form.msgsub'},$message);
}
@@ -1504,8 +1497,9 @@ sub processHandGrade {
#---- Save the score and award for each student, if changed
sub saveHandGrade {
my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
- my %record=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
- my %newrecord;
+ my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
+ my %newrecord = ();
+ my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
@@ -1515,11 +1509,11 @@ sub saveHandGrade {
}
}
} else {
- my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
- $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
- $ENV{'form.RADVAL'.$newflg.'_'.$_});
+ $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
+ $ENV{'form.GD_BOX'.$newflg.'_'.$_} :
+ $ENV{'form.RADVAL'.$newflg.'_'.$_});
return 'no_score' if ($pts eq '' && $ENV{'form.GD_SEL'.$newflg.'_'.$_} eq '');
- my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
+ $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
$ENV{'form.WGT'.$newflg.'_'.$_};
my $partial= $pts/$wgt;
$newrecord{'resource.'.$_.'.awarded'} = $partial
@@ -1542,7 +1536,7 @@ sub saveHandGrade {
&Apache::lonnet::cstore(\%newrecord,$symb,
$ENV{'request.course.id'},$domain,$stuname);
}
- return '';
+ return '',$pts,$wgt;
}
#--------------------------------------------------------------------------------------
@@ -1738,10 +1732,7 @@ sub viewgrades {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
+ ' '."\n".
' '."\n";
$result.='Assign Common Grade To ';
@@ -2158,10 +2149,7 @@ to this page if the data selected is ins
value="$ENV{'form.upfile_associate'}" />
-
-
-
-
+
@@ -2390,10 +2378,7 @@ LISTJAVASCRIPT
' '."\n".
' '."\n".
' '." \n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n";
+ ' '."\n";
$result.=' '."\n";
@@ -2525,10 +2510,7 @@ sub displayPage {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n";
+ ' '."\n";
my $checkIcon = ' ';
@@ -2590,13 +2572,14 @@ sub displayPage {
my @displaySub = ();
foreach my $partid (@{$parts}) {
my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
- next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' &&
- $record{"$version:resource.$partid.solved"} eq '');
+ next if ($record{"$version:resource.$partid.solved"} eq '');
+# next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' &&
+# $record{"$version:resource.$partid.solved"} eq '');
$displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ?
- 'Part: '.$partid.' Submission: '
+ 'Trial '.$version.' Part '.$partid.' '
.$record{$version.':'.$matchKey[0]}.' ' : '';
$displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ?
- 'Part: '.$partid.' '.
+ 'Part '.$partid.' '.
$record{"$version:resource.$partid.award"}.'/'.
$record{"$version:resource.$partid.solved"}.' ' : '';
$displaySub[2].=(exists $record{"$version:resource.$partid.regrader"}) ?
@@ -2878,16 +2861,24 @@ sub show_grading_menu_form {
my $result.=' '."\n";
return $result;
}
+# -- Retrieve choices for grading form
+sub savedState {
+ my %savedState = ();
+ if ($ENV{'form.saveState'}) {
+ foreach (split(/:/,$ENV{'form.saveState'})) {
+ my ($key,$value) = split(/=/,$_,2);
+ $savedState{$key} = $value;
+ }
+ }
+ return \%savedState;
+}
#--- Displays the main menu page -------
sub gradingmenu {
@@ -2895,19 +2886,13 @@ sub gradingmenu {
my ($symb,$url)=&get_symb_and_url($request);
if (!$symb) {return '';}
my $probTitle = &Apache::lonnet::gettitle($symb);
- my $saveCmd = ($ENV{'form.saveCmd'} eq '' ? 'pickStudentPage' : $ENV{'form.saveCmd'});
- my $saveSec = ($ENV{'form.saveSec'} eq '' ? 'all' : $ENV{'form.saveSec'});
- my $saveSub = ($ENV{'form.saveSub'} eq '' ? 'yes' : $ENV{'form.saveSub'});
- my $saveStatus = ($ENV{'form.saveStatus'} eq '' ? 'Active' : $ENV{'form.saveStatus'});
$request->print(<
function checkChoice(formname) {
var cmd = formname.command;
- formname.saveCmd.value = radioSelection(cmd);
- formname.saveSec.value = pullDownSelection(formname.section);
- formname.saveSub.value = radioSelection(formname.submitonly);
- formname.saveStatus.value = pullDownSelection(formname.status);
+ formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+
+ ":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.status);
if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[4].checked) formname.submit();
if (cmd[3].checked) browseAndUpload();
@@ -2974,7 +2959,10 @@ sub gradingmenu {
lDoc.write(" alert(\\"Please use the browse button to select a file from your local directory.\\");");
lDoc.write(" return false;");
lDoc.write(" }");
+ lDoc.write(" var openformname = opener.document.gradingMenu;");
+ lDoc.write(" formname.saveState.value = \\"saveCmd=\\"+opener.radioSelection(openformname.command)+\\":saveSec=\\"+opener.pullDownSelection(openformname.section)+\\":saveSub=\\"+opener.radioSelection(openformname.submitonly)+\\":saveStatus=\\"+opener.pullDownSelection(openformname.status);");
lDoc.write(" document.gradesupload.submit();");
+ lDoc.write(" if (navigator.appName !=\\"Netscape\\") {self.close()};");
lDoc.write(" setTimeout('self.close()',750)");
lDoc.write("}");
@@ -2986,13 +2974,10 @@ sub gradingmenu {
lDoc.write(" ");
lDoc.write(" ");
lDoc.write(" ");
- lDoc.write(" ");
- lDoc.write(" ");
- lDoc.write(" ");
- lDoc.write(" ");
+ lDoc.write(" ");
lDoc.write(" ");
- lDoc.write("Specify a file containing the class scores for problem - $probTitle ");
+ lDoc.write(" Specify a file containing the class scores for problem - $probTitle ");
lDoc.write("");
lDoc.write("");
@@ -3030,6 +3015,11 @@ GRADINGMENUJS
$result.='
'."\n";
my (undef,$sections) = &getclasslist('all','0');
+ my $savedState = &savedState();
+ my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'pickStudentPage' : $$savedState{'saveCmd'});
+ my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'});
+ my $saveSub = ($$savedState{'saveSub'} eq '' ? 'yes' : $$savedState{'saveSub'});
+ my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
$result.='