'."\n";
+ 'onClick="javascript:submit();" target="_self" />'."\n";
if (scalar(%$fullname) eq 0) {
my $colspan=3+scalar(@parts);
$result='There are no students in section "'.$env{'form.section'}.
@@ -3107,7 +3093,7 @@ sub viewstudentgrade {
''.
"\n".$ctr.'
'."\n";
$student=~s/:/_/; # colon doen't work in javascript for names
foreach my $apart (@$parts) {
@@ -3471,6 +3457,7 @@ sub csvuploadmap_header {
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
my $ignore=&mt('Ignore First Line');
+ $symb = &Apache::lonenc::check_encrypt($symb);
$request->print(<
Uploading Class Grades
@@ -3565,6 +3552,7 @@ sub upcsvScores_form {
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
+ $symb = &Apache::lonenc::check_encrypt($symb);
$result.=<
@@ -3873,7 +3861,7 @@ LISTJAVASCRIPT
$result.=''."\n".
''."\n".
''."\n".
- ''."\n".
+ ''."\n".
''." \n";
$result.=' '.&mt('Use CODE:').' '.
@@ -3997,7 +3985,7 @@ sub displayPage {
''."\n".
''."\n".
''."\n".
- ''."\n".
+ ''."\n".
''."\n".
''."\n";
@@ -4369,7 +4357,7 @@ sub updateGradeByPage {
sub defaultFormData {
my ($symb)=@_;
return '
- '."\n".
+ '."\n".
''."\n".
''."\n";
}
@@ -5938,7 +5926,7 @@ DOWNLOAD
sub show_grading_menu_form {
my ($symb)=@_;
my $result.='
'."\n".
- ''."\n".
+ ''."\n".
''."\n".
''."\n".
''."\n".
@@ -6224,7 +6212,7 @@ sub process_clicker {
my $pincorrect=&mt("Percentage points for incorrect solution");
my $selectform=&Apache::loncommon::select_form($env{'form.upfiletype'},'upfiletype',
('iclicker' => 'i>clicker'));
-
+ $symb = &Apache::lonenc::check_encrypt($symb);
$result.=<
function sanitycheck() {
@@ -6349,6 +6337,7 @@ sub process_clicker_file {
# Were able to get all the info needed, now analyze the file
$result.=&Apache::loncommon::studentbrowser_javascript();
+ $symb = &Apache::lonenc::check_encrypt($symb);
my $heading=&mt('Scanning clicker file');
$result.=(<
@@ -6453,7 +6442,13 @@ sub assign_clicker_grades {
my ($r)=@_;
my ($symb)=&get_symb($r);
if (!$symb) {return '';}
+# See which part we are saving to
+ my ($partlist,$handgrade,$responseType) = &response_type($symb);
+# FIXME: This should probably look for the first handgradeable part
+ my $part=$$partlist[0];
+# Start screen output
my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+
my $heading=&mt('Assigning grades based on clicker file');
$result.=(<
@@ -6463,7 +6458,9 @@ ENDHEADER
# Get correct result
# FIXME: Possibly need delimiter other than ":"
my @correct=();
- if ($env{'form.gradingmechanism'} ne 'attendance') {
+ my $gradingmechanism=$env{'form.gradingmechanism'};
+ my $number=$env{'form.number'};
+ if ($gradingmechanism ne 'attendance') {
foreach my $key (keys(%env)) {
if ($key=~/^form\.correct\:/) {
my @input=split(/\,/,$env{$key});
@@ -6479,7 +6476,7 @@ ENDHEADER
}
}
}
- for (my $i=0;$i<$env{'form.number'};$i++) {
+ for (my $i=0;$i<$number;$i++) {
if (!$correct[$i]) {
$result.=' '.
&mt('No correct result given for question "[_1]"!',
@@ -6489,7 +6486,47 @@ ENDHEADER
$result.=' '.&mt("Correct answer: [_1]",join(', ',map { ($_?$_:'-') } @correct));
}
# Start grading
- $result.='
'."\n".
+ my $pcorrect=$env{'form.pcorrect'};
+ my $pincorrect=$env{'form.pincorrect'};
+ my $storecount=0;
+ foreach my $key (keys(%env)) {
+ if ($key=~/^form\.student\:(.*)$/) {
+ my $user=$1;
+ my @answer=split(/\,/,$env{$key});
+ my $sum=0;
+ for (my $i=0;$i<$number;$i++) {
+ if ($answer[$i]) {
+ if ($gradingmechanism eq 'attendance') {
+ $sum+=$pcorrect;
+ } else {
+ if ($answer[$i] eq $correct[$i]) {
+ $sum+=$pcorrect;
+ } else {
+ $sum+=$pincorrect;
+ }
+ }
+ }
+ }
+ my $ave=$sum/(100*$number);
+# Store
+ my ($username,$domain)=split(/\:/,$user);
+ my %grades=();
+ $grades{"resource.$part.solved"}='correct_by_override';
+ $grades{"resource.$part.awarded"}=$ave;
+ $grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}";
+ my $returncode=&Apache::lonnet::cstore(\%grades,$symb,
+ $env{'request.course.id'},
+ $domain,$username);
+ if ($returncode ne 'ok') {
+ $result.=" Failed to save student $username:$domain. Message when trying to save was ($returncode)";
+ } else {
+ $storecount++;
+ }
+ }
+ }
+# We are done
+ $result.=' '.&mt('Successfully stored grades for [_1] student(s).',$storecount).
+ '