');
- hDoc.write("$lt{'txtc'}<\\/b><\\/td> $lt{'font'}<\\/b><\\/td> $lt{'fnst'}<\\/td><\\/tr>");
+ hDoc.write(" Text Color<\\/b><\\/td> Font Size<\\/b><\\/td> Font Style<\\/td><\\/tr>");
}
function highlightbody(clrval,clrtxt,clrsel,szval,sztxt,szsel,syval,sytxt,sysel) {
@@ -1736,14 +1659,13 @@ INNERJS
var hDoc = hwdWin.document;
hDoc.write("<\\/table>");
hDoc.write("<\\/td><\\/tr><\\/table> ");
- hDoc.write(" ");
- hDoc.write(" ");
+ hDoc.write(" ");
+ hDoc.write(" ");
hDoc.write("<\\/form>");
hDoc.write('$end_page_highlight_central');
hDoc.close();
}
-
SUBJAVASCRIPT
}
@@ -1853,7 +1775,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) {
@@ -1865,10 +1787,9 @@ sub handback_box {
my $prefix = $counter.'_'.$partid.'_'.$respid.'_';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
next if (!@$files);
- my $file_counter = 0;
+ my $file_counter = 1;
foreach my $file (@$files) {
if ($file =~ /\/portfolio\//) {
- $file_counter++;
my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|);
my ($name,$version,$ext) = &file_name_version_ext($file_disp);
$file_disp = "$name.$ext";
@@ -1876,14 +1797,11 @@ sub handback_box {
$result.=&mt('Return commented version of [_1] to student.',
''.$file_disp.' ');
$result.=' '."\n";
- $result.=' '."\n";
+ $result.=' ';
+ $result.='('.&mt('File will be uploaded when you click on Save & Next below.').') ';
+ $file_counter++;
}
}
- if ($file_counter) {
- $result .= ' '."\n".
- ''.
- '('.&mt('File(s) will be uploaded when you click on Save & Next below.',$file_counter).') ';
- }
}
return $result;
}
@@ -1994,7 +1912,8 @@ sub submission {
$udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student?
my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'});
$env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq '';
- my $symb = &get_symb($request);
+ my $symb = &get_symb($request);
+ my $probtitle=&Apache::lonnet::gettitle($symb);
if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; }
if (!&canview($usec)) {
@@ -2018,13 +1937,10 @@ sub submission {
if ($counter == 0) {
&sub_page_js($request);
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');
- $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?
- &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) {
&download_all_link($request, $symb);
}
- $request->print(' '.&mt('Submission Record').' '."\n".
- ' '.&mt('Resource: [_1]',$env{'form.probTitle'}).' '."\n");
+ $request->print(' '.&mt('Submission Record').' ');
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
@@ -2055,7 +1971,7 @@ sub submission {
$env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0';
$env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
$env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ?
- $keyhash{$symb.'_subject'} : $env{'form.probTitle'};
+ $keyhash{$symb.'_subject'} : $probtitle;
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0';
}
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'};
@@ -2065,7 +1981,6 @@ sub submission {
' '."\n".
' '."\n".
' '."\n".
- ' '."\n".
' '."\n".
' '."\n".
' '."\n".
@@ -2105,22 +2020,15 @@ sub submission {
$request->print($prnmsg);
if ($env{'form.handgrade'} eq 'yes' && $env{'form.showgrading'} eq 'yes') {
-
- my %lt = &Apache::lonlocal::texthash(
- keyw => 'Keyword Options',
- list => 'List',
- past => 'Paste Selection to List',
- high => 'Highlight Attribute',
- );
#
# Print out the keyword options line
#
$request->print(<$lt{'keyw'}:
-$lt{'list'}
+ Keyword Options:
+List
$lt{'past'}
-$lt{'high'}
+ CLASS="page">Paste Selection to List
+Highlight Attribute
KEYWORDS
#
# Load the other essays for similarity check
@@ -2247,7 +2155,7 @@ KEYWORDS
$lastsubonly.="\n".''.
''.&mt('Part: [_1]',$display_part).' '.
' '.
- '('.&mt('Response ID: [_1]',$respid).')'.
+ '('.&mt('Part ID: [_1]',$respid).')'.
' '.
''.&mt('Nothing submitted - no attempts.').'
';
next;
@@ -2258,12 +2166,6 @@ KEYWORDS
my ($ressub,$hide,$subval) = split(/:/,$submission,3);
# Similarity check
my $similar='';
- my ($type,$trial,$rndseed);
- if ($hide eq 'rand') {
- $type = 'randomizetry';
- $trial = $record{"resource.$partid.tries"};
- $rndseed = $record{"resource.$partid.rndseed"};
- }
if($env{'form.checkPlag'}){
my ($oname,$odom,$ocrsid,$oessay,$osim)=
&most_similar($uname,$udom,$subval,\%old_essays);
@@ -2273,7 +2175,7 @@ KEYWORDS
&Apache::lonnet::coursedescription($ocrsid,
{'one_time' => 1});
- if ($hide eq 'anon') {
+ if ($hide) {
$similar=''.&mt("Essay was found to be similar to another essay submitted for this assignment.").' '.
&mt('As the current submission is for an anonymous survey, no other details are available.').' ';
} else {
@@ -2290,8 +2192,7 @@ KEYWORDS
}
}
}
- my $order=&get_order($partid,$respid,$symb,$uname,$udom,
- undef,$type,$trial,$rndseed);
+ my $order=&get_order($partid,$respid,$symb,$uname,$udom);
if ($env{'form.lastSub'} eq 'lastonly' ||
($env{'form.lastSub'} eq 'hdgrade' &&
$$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
@@ -2299,11 +2200,11 @@ KEYWORDS
$lastsubonly.=''.
''.&mt('Part: [_1]',$display_part).' '.
' '.
- '('.&mt('Response ID: [_1]',$respid).')'.
+ '('.&mt('Part ID: [_1]',$respid).')'.
' ';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
if (@$files) {
- if ($hide eq 'anon') {
+ if ($hide) {
$lastsubonly.=' '.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
} else {
$lastsubonly.=''.&mt('Like all files provided by users, this file may contain viruses').' ';
@@ -2314,12 +2215,12 @@ KEYWORDS
}
$lastsubonly.=' ';
}
- if ($hide eq 'anon') {
+ if ($hide) {
$lastsubonly.=''.&mt('Anonymous Survey').' ';
} else {
$lastsubonly.=''.&mt('Submitted Answer:').' '.
&cleanRecord($subval,$responsetype,$symb,$partid,
- $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
+ $respid,\%record,$order,undef,$uname,$udom);
}
if ($similar) {$lastsubonly.=" $similar\n";}
$lastsubonly.='
';
@@ -2330,7 +2231,9 @@ KEYWORDS
}
$request->print($lastsubonly);
} elsif ($env{'form.lastSub'} eq 'datesub') {
- my (undef,$responseType,undef,$parts) = &showResourceInfo($symb);
+# my (undef,$responseType,undef,$parts) = &showResourceInfo($symb);
+ my ($parts,$handgrade,$responseType) = &response_type($symb);
+
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
} elsif ($env{'form.lastSub'} =~ /^(last|all)$/) {
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
@@ -2469,10 +2372,10 @@ sub check_collaborators {
next if ($record->{'resource.'.$part.'.collaborators'} eq '');
my (@good_collaborators, @bad_collaborators);
foreach my $possible_collaborator
- (split(/[,;\s]+/,$record->{'resource.'.$part.'.collaborators'})) {
+ (split(/,?\s+/,$record->{'resource.'.$part.'.collaborators'})) {
$possible_collaborator =~ s/[\$\^\(\)]//g;
next if ($possible_collaborator eq '');
- my ($co_name,$co_dom) = split(/:/,$possible_collaborator);
+ my ($co_name,$co_dom) = split(/\@|:/,$possible_collaborator);
$co_dom = $udom if (! defined($co_dom) || $co_dom =~ /^domain$/i);
next if ($co_name eq $uname && $co_dom eq $udom);
# Doing this grep allows 'fuzzy' specification
@@ -2485,13 +2388,13 @@ sub check_collaborators {
}
}
if (scalar(@good_collaborators) != 0) {
- $result.=' '.&mt('Collaborators:').'';
+ $result.=' '.&mt('Collaborators: ');
foreach my $name (@good_collaborators) {
my ($lastname,$givenn) = split(/,/,$$fullname{$name});
push(@col_fullnames, $givenn.' '.$lastname);
- $result.=''.$fullname->{$name}.' ';
+ $result.=$fullname->{$name}.' ';
}
- $result.=' '."\n";
+ $result.=' '."\n";
my ($part)=split(/\./,$part);
$result.=' '.
@@ -2527,51 +2430,35 @@ sub get_last_submission {
&Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'});
}
}
- my (%typeparts,%randombytry);
+ my %typeparts;
my $showsurv =
&Apache::lonnet::allowed('vas',$env{'request.course.id'});
foreach my $key (sort(keys(%lasthash))) {
if ($key =~ /\.type$/) {
if (($lasthash{$key} eq 'anonsurvey') ||
- ($lasthash{$key} eq 'anonsurveycred') ||
- ($lasthash{$key} eq 'randomizetry')) {
+ ($lasthash{$key} eq 'anonsurveycred')) {
my ($ign,@parts) = split(/\./,$key);
pop(@parts);
- my $id = join('.',@parts);
- if ($lasthash{$key} eq 'randomizetry') {
- $randombytry{$ign.'.'.$id} = $lasthash{$key};
- } else {
- unless ($showsurv) {
- $typeparts{$ign.'.'.$id} = $lasthash{$key};
- }
+ unless ($showsurv) {
+ my $id = join(',',@parts);
+ $typeparts{$ign.'.'.$id} = $lasthash{$key};
}
delete($lasthash{$key});
}
}
}
my @hidden = keys(%typeparts);
- my @randomize = keys(%randombytry);
foreach my $key (keys(%lasthash)) {
next if ($key !~ /\.submission$/);
my $hide;
if (@hidden) {
foreach my $id (@hidden) {
if ($key =~ /^\Q$id\E/) {
- $hide = 'anon';
+ $hide = 1;
last;
}
}
}
- unless ($hide) {
- if (@randomize) {
- foreach my $id (@hidden) {
- if ($key =~ /^\Q$id\E/) {
- $hide = 'rand';
- last;
- }
- }
- }
- }
my ($partid,$foo) = split(/submission$/,$key);
my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ?
'Draft Copy ' : '';
@@ -2641,7 +2528,7 @@ sub processHandGrade {
if ($env{'form.withgrades'.$ctr}) {
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
$messagetail = " for $env{'form.probTitle'} ";
+ $feedurl."?symb=$showsymb\">$restitle";
}
$msgstatus =
&Apache::lonmsg::user_normal_msg($uname,$udom,$subject,
@@ -2650,7 +2537,7 @@ sub processHandGrade {
undef,undef,$showsymb,
$restitle);
$request->print(' '.&mt('Sending message to [_1]',$uname.':'.$udom).': '.
- $msgstatus.' ');
+ $msgstatus);
}
if ($env{'form.collaborator'.$ctr}) {
my @collabstrs=&Apache::loncommon::get_env_multiple("form.collaborator$ctr");
@@ -2669,7 +2556,7 @@ sub processHandGrade {
$udom);
if ($env{'form.withgrades'.$ctr}) {
$messagetail = " for $env{'form.probTitle'} ";
+ $baseurl."?symb=$showsymb\">$restitle";
}
$msgstatus =
&Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle);
@@ -2742,7 +2629,7 @@ sub processHandGrade {
# Go directly to grade student - from submission or link from chart page
if ($button eq 'Grade Student') {
- (undef,undef,$env{'form.handgrade'},undef,undef) = &showResourceInfo($symb);
+# (undef,undef,$env{'form.handgrade'},undef,undef) = &showResourceInfo($symb);
my $processUser = $env{'form.unamedom'.$env{'form.studentNo'}};
($env{'form.student'},$env{'form.userdom'}) = split(/:/,$processUser);
$env{'form.fullname'} = $$fullname{$processUser};
@@ -2769,6 +2656,7 @@ sub processHandGrade {
}
return $a cmp $b;
} (keys(%$fullname))) {
+# FIXME: this is fishy, looks like the button label
if ($nextflg == 1 && $button =~ /Next$/) {
push(@parsedlist,$item);
}
@@ -2779,6 +2667,7 @@ sub processHandGrade {
}
}
$ctr = 0;
+# FIXME: this is fishy, looks like the button label
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
my $res_error;
my ($partlist) = &response_type($symb,\$res_error);
@@ -2836,7 +2725,7 @@ sub processHandGrade {
}
if ($total < 0) {
my $the_end = ''.&mt('LON-CAPA User Message').' '."\n";
- $the_end.=''.&mt('[_1]Message:[_2] No more students for this section or class.','',' ').'
'."\n";
+ $the_end.=&mt('Message: No more students for this section or class.').' '."\n";
$the_end.=&mt('Click on the button below to return to the grading menu.').' '."\n";
$the_end.=&show_grading_menu_form($symb);
$request->print($the_end);
@@ -2989,79 +2878,64 @@ sub handback_files {
$request->print(' '.&navmap_errormsg().' ');
return;
}
- my @handedback;
- my $file_msg;
my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
my ($part_id,$resp_id) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
- if (($env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'} =~ /^\d+$/) & ($new_part eq $part_id)) {
- for (my $counter=1; $counter<=$env{'form.'.$newflg.'_'.$part_resp.'_countreturndoc'}; $counter++) {
+ if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) {
# if multiple files are uploaded names will be 'returndoc2','returndoc3'
- if ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter}) {
- my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$counter.'.filename'};
+ my $file_counter = 1;
+ my $file_msg;
+ while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) {
+ my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'};
my ($directory,$answer_file) =
- ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter} =~ /^(.*?)([^\/]*)$/);
+ ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/);
my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,
- $domain,$stuname,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$portfolio_path,$domain,$stuname,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
# fix file name
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/);
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain,
- $newflg.'_'.$part_resp.'_returndoc'.$counter,
+ $newflg.'_'.$part_resp.'_returndoc'.$file_counter,
$save_file_name);
if ($result !~ m|^/uploaded/|) {
$request->print(''.
&mt('An error occurred ([_1]) while trying to upload [_2].',
- $result,$newflg.'_'.$part_resp.'_returndoc'.$counter).
+ $result,$newflg.'_'.$part_resp.'_returndoc'.$file_counter).
' ');
} else {
# mark the file as read only
- push(@handedback,$save_file_name);
+ my @files = ($save_file_name);
+ my @what = ($symb,$env{'request.course.id'},'handback');
+ &Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what);
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) {
$$newrecord{"resource.$new_part.$resp_id.handback"}.=',';
}
$$newrecord{"resource.$new_part.$resp_id.handback"} .= $save_file_name;
- $file_msg.=''.$save_file_name." ";
+ $file_msg.= "\n".''.$save_file_name." ";
}
- $request->print(' '.&mt('[_1] will be the uploaded file name [_2]',''.$fname.' ',''.$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$counter}.' '));
+ $request->print(" ".$fname." will be the uploaded file name");
+ $request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});
+ $file_counter++;
}
+ my $subject = "File Handed Back by Instructor ";
+ my $message = "A file has been returned that was originally submitted in reponse to: ";
+ $message .= "".&Apache::lonnet::gettitle($symb)." ";
+ $message .= ' The returned file(s) are named: '. $file_msg;
+ $message .= " and can be found in your portfolio space.";
+ my ($feedurl,$showsymb) =
+ &get_feedurl_and_symb($symb,$domain,$stuname);
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my $msgstatus =
+ &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject.
+ ' (File Returned) ['.$restitle.']',$message,undef,
+ $feedurl,undef,undef,undef,$showsymb,$restitle);
}
}
- }
- if (@handedback > 0) {
- $request->print(' ');
- my @what = ($symb,$env{'request.course.id'},'handback');
- &Apache::lonnet::mark_as_readonly($domain,$stuname,\@handedback,\@what);
- my $user_lh = &Apache::loncommon::user_lang($stuname,$domain,$env{'request.course.id'});
- my ($subject,$message);
- if (scalar(@handedback) == 1) {
- $subject = &mt_user($user_lh,'File Handed Back by Instructor');
- } else {
- $subject = &mt_user($user_lh,'Files Handed Back by Instructor');
- $message = &mt_user($user_lh,'Files have been returned that were originally submitted in response to: ');
- }
- $message .= "".&Apache::lonnet::gettitle($symb)."
";
- $message .= &mt_user($user_lh,'The returned file(s) are named: [_1]'," $file_msg ").
- &mt_user($user_lh,'The file(s) can be found in your [_1]portfolio[_2].','',' ');
- my ($feedurl,$showsymb) =
- &get_feedurl_and_symb($symb,$domain,$stuname);
- my $restitle = &Apache::lonnet::gettitle($symb);
- $subject .= ' '.&mt_user($user_lh,'(File Returned)').' ['.$restitle.']';
- my $msgstatus =
- &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject,
- $message,undef,$feedurl,undef,undef,undef,$showsymb,
- $restitle);
- if ($msgstatus) {
- $request->print(&mt('Notification message status: [_1]',''.$msgstatus.' ').' ');
- }
- }
return;
}
@@ -3169,11 +3043,9 @@ sub version_portfiles {
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
- my $getpropath = 1;
- my ($dir_list,$listerror) =
- &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,
- $stu_name,$getpropath);
- my $version = &get_next_version($answer_name,$answer_ext,$dir_list);
+ my $getpropath = 1;
+ my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$directory,$domain,$stu_name,$getpropath);
+ my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
my $new_answer = &version_selected_portfile($domain, $stu_name, $directory, $answer_file, $version);
if ($new_answer ne 'problem getting file') {
push(@versioned_portfiles, $directory.$new_answer);
@@ -3192,24 +3064,21 @@ sub version_portfiles {
sub get_next_version {
my ($answer_name, $answer_ext, $dir_list) = @_;
my $version;
- if (ref($dir_list) eq 'ARRAY') {
- foreach my $row (@{$dir_list}) {
- my ($file) = split(/\&/,$row,2);
- my ($file_name,$file_version,$file_ext) =
- &file_name_version_ext($file);
- if (($file_name eq $answer_name) &&
- ($file_ext eq $answer_ext)) {
- # gets here if filename and extension match,
- # regardless of version
+ foreach my $row (@$dir_list) {
+ my ($file) = split(/\&/,$row,2);
+ my ($file_name,$file_version,$file_ext) =
+ &file_name_version_ext($file);
+ if (($file_name eq $answer_name) &&
+ ($file_ext eq $answer_ext)) {
+ # gets here if filename and extension match, regardless of version
if ($file_version ne '') {
- # a versioned file is found so save it for later
- if ($file_version > $version) {
- $version = $file_version;
- }
+ # a versioned file is found so save it for later
+ if ($file_version > $version) {
+ $version = $file_version;
}
}
}
- }
+ }
$version ++;
return($version);
}
@@ -3256,8 +3125,7 @@ sub viewgrades_js {
my ($request) = shift;
my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = ');
- $request->print(<
+ $request->print(&Apache::lonhtmlcommon::scripttag(<
VIEWJAVASCRIPT
}
@@ -3436,7 +3303,6 @@ sub viewgrades {
&Apache::lonnet::clear_EXT_cache_status();
my $result=''.&mt('Manual Grading').' ';
- $result.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
#view individual student submission form - called using Javascript viewOneStudent
$result.=&jscriptNform($symb);
@@ -3449,7 +3315,6 @@ sub viewgrades {
&build_section_inputs().
' '."\n".
' '."\n".
- ' '."\n";
my ($common_header,$specific_header);
if ($env{'form.section'} eq 'all') {
@@ -3672,7 +3537,6 @@ sub editgrades {
my $symb=&get_symb($request);
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title=''.&mt('Current Grade Status').' ';
- $title.=''.&mt('Current Resource: [_1]',$env{'form.probTitle'}).' '."\n";
$title.=''.&mt('Section: [_1]',$section_display).' '."\n";
my $result= &Apache::loncommon::start_data_table().
@@ -3994,7 +3858,7 @@ sub csvuploadmap_header {
$javascript=&csvupload_javascript_forward_associate();
}
- my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+ my $result='';
my $checked=(($env{'form.noFirstLine'})?' checked="checked"':'');
my $ignore=&mt('Ignore First Line');
$symb = &Apache::lonenc::check_encrypt($symb);
@@ -4018,13 +3882,10 @@ to this page if the data selected is ins
value="$env{'form.upfile_associate'}" />
-
-
ENDPICK
+ $request->print(&Apache::lonhtmlcommon::scripttag($javascript));
return '';
}
@@ -4069,8 +3930,7 @@ ENDPICK
sub checkforfile_js {
my $alertmsg = &mt('Please use the browse button to select a file from your local directory.');
- my $result =<
+ my $result = &Apache::lonhtmlcommon::scripttag(<
CSVFORMJS
return $result;
}
@@ -4088,14 +3947,11 @@ sub upcsvScores_form {
my ($symb)=&get_symb($request);
if (!$symb) {return '';}
my $result=&checkforfile_js();
- $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
- my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
- $result.=$table;
$result.=''."\n";
$result.=''."\n";
$result.=' '.&mt('Specify a file containing the class scores for current resource.').
' '."\n";
- $result.=''."\n";
+ $result.=' '."\n";
my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
@@ -4104,7 +3960,6 @@ sub upcsvScores_form {
");
&ssi_print_error($r);
@@ -8006,8 +7782,7 @@ SCANTRONFORM
if ($studentrecord ne $studentdata) {
&Apache::lonxml::clear_problem_counter();
if (&grade_student_bubbles($r,$uname,$udom,$scan_record,$scancode,
- \@resources,\%partids_by_symb,
- $bubbles_per_row) eq 'ssi_error') {
+ \@resources,\%partids_by_symb) eq 'ssi_error') {
$ssi_error = 0; # So end of handler error message does not trigger.
$r->print("");
&ssi_print_error($r);
@@ -8027,12 +7802,12 @@ SCANTRONFORM
$studentrecord .= $recording;
}
if ($studentrecord ne $studentdata) {
- $r->print('');
+ $r->print('');
if ($scancode eq '') {
- $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2].',
+ $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2].',
$uname.':'.$udom,$scan_record->{'scantron.ID'}));
} else {
- $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2] and CODE: [_3].',
+ $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2] and CODE: [_3].',
$uname.':'.$udom,$scan_record->{'scantron.ID'},$scancode));
}
$r->print(' '.&Apache::loncommon::start_data_table()."\n".
@@ -8040,11 +7815,11 @@ SCANTRONFORM
'
'.&mt('Source').' '.&mt('Bubbled responses').' '.
&Apache::loncommon::end_data_table_header_row()."\n".
&Apache::loncommon::start_data_table_row().
- ''.&mt('Bubblesheet').' '.
+ ''.&mt('Bubble Sheet').' '.
''.$studentdata.' '.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::start_data_table_row().
- ''.&mt('Stored submissions').' '.
+ 'Stored submissions '.
''.$studentrecord.' '."\n".
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().'');
@@ -8079,8 +7854,7 @@ sub graders_resources_pass {
my $ressymb = $resource->symb();
my ($analysis,$parts) =
&scantron_partids_tograde($resource,$env{'request.course.id'},
- $env{'user.name'},$env{'user.domain'},
- 1,$bubbles_per_row);
+ $env{'user.name'},$env{'user.domain'},1);
$grader_partids_by_symb->{$ressymb} = $parts;
if (ref($analysis) eq 'HASH') {
if (ref($analysis->{'parts_withrandomlist'}) eq 'ARRAY') {
@@ -8094,7 +7868,7 @@ sub graders_resources_pass {
}
sub grade_student_bubbles {
- my ($r,$uname,$udom,$scan_record,$scancode,$resources,$parts,$bubbles_per_row) = @_;
+ my ($r,$uname,$udom,$scan_record,$scancode,$resources,$parts) = @_;
if (ref($resources) eq 'ARRAY') {
my $count = 0;
foreach my $resource (@{$resources}) {
@@ -8107,9 +7881,6 @@ sub grade_student_bubbles {
'grade_symb' => $ressymb,
'CODE' => $scancode
);
- if ($bubbles_per_row ne '') {
- $form{'bubbles_per_row'} = $bubbles_per_row;
- }
if (ref($parts) eq 'HASH') {
if (ref($parts->{$ressymb}) eq 'ARRAY') {
foreach my $part (@{$parts->{$ressymb}}) {
@@ -8140,8 +7911,7 @@ sub scantron_upload_scantron_data {
my $default_form_data=&defaultFormData(&get_symb($r,1));
my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.');
my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded.");
- $r->print('
-
-
-'.&mt('Send bubblesheet data to a course').'
+'));
+ $r->print('
+'.&mt('Send scanned bubblesheet data to a course').'
'.$default_form_data.
@@ -8420,7 +8190,7 @@ sub checkscantron_results {
'inline',undef,'checkscantron');
my ($username,$domain,$started);
my $nav_error;
- &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse.
+ &scantron_get_maxbubble(\$nav_error); # Need the bubble lines array to parse.
if ($nav_error) {
$r->print(&navmap_errormsg());
return '';
@@ -8470,9 +8240,7 @@ sub checkscantron_results {
if ((exists($grader_randomlists_by_symb{$ressymb})) ||
(ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) {
(my $analysis,$parts) =
- &scantron_partids_tograde($resource,$env{'request.course.id'},
- $username,$domain,undef,
- $bubbles_per_row);
+ &scantron_partids_tograde($resource,$env{'request.course.id'},$username,$domain);
} else {
$parts = $grader_partids_by_symb{$ressymb};
}
@@ -8517,14 +8285,7 @@ sub checkscantron_results {
}
}
}
- $r->print(''.
- &mt('Comparison of bubblesheet data (including corrections) with corresponding submission records (most recent submission) for [_1][quant,_2,student][_3] ([quant,_4,bubblesheet line] per student).',
- '',
- $numstudents,
- ' ',
- $env{'form.scantron_maxbubble'}).
- '
'
- );
+ $r->print(''.&mt('Comparison of bubblesheet data (including corrections) with corresponding submission records (most recent submission) for [quant,_1,student] ([_2] scantron lines/student).',$numstudents,$env{'form.scantron_maxbubble'}).'
');
$r->print(''.&mt('Exact matches for [quant,_1,student] .',$passed).' '.&mt('Discrepancies detected for [quant,_1,student] .',$failed).'
');
if ($passed) {
$r->print(&mt('Students with exact correspondence between bubblesheet data and submissions are as follows:').' ');
@@ -8699,36 +8460,27 @@ sub show_grading_menu_form {
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;
-}
-
sub grading_menu {
my ($request) = @_;
my ($symb)=&get_symb($request);
if (!$symb) {return '';}
- my $probTitle = &Apache::lonnet::gettitle($symb);
- my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
- $request->print($table);
my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb),
- 'handgrade'=>$hdgrade,
- 'probTitle'=>$probTitle,
- 'command'=>'submit_options',
- 'saveState'=>"",
+ 'command'=>'individual',
'gradingMenu'=>1,
'showgrading'=>"yes");
- my $url1 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
-
+ my $url1a = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
+ $fields{'command'}='ungraded';
+ my $url1b=&Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
+ $fields{'command'}='table';
+ my $url1c=&Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
+ $fields{'command'}='all_for_one';
+ my $url1d=&Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
$fields{'command'} = 'csvform';
my $url2 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
@@ -8737,15 +8489,40 @@ sub grading_menu {
$fields{'command'} = 'scantron_selectphase';
my $url4 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
+
+ $fields{'command'} = 'initialverifyreceipt';
+ my $url5 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- my @menu = ({ categorytitle=>'Course Grading',
+ my @menu = ({ categorytitle=>'Hand Grading',
items =>[
- { linktext => 'Manual Grading/View Submissions',
- url => $url1,
+ { linktext => 'Select individual students to grade',
+ url => $url1a,
permission => 'F',
icon => 'edit-find-replace.png',
- linktitle => 'Start the process of hand grading submissions.'
+ linktitle => 'Grade current resource for a selection of students.'
+ },
+ { linktext => 'Grade ungraded submissions.',
+ url => $url1b,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Grade all submissions that have not been graded yet.'
},
+
+ { linktext => 'Grading table',
+ url => $url1c,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Grade current resource for all students.'
+ },
+ { linktext => 'Grade complete page/sequence/folder for one student',
+ url => $url1d,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Grade all resources in current page/sequence/folder for one student.'
+ }]},
+ { categorytitle=>'Automated Grading',
+ items =>[
+
{ linktext => 'Upload Scores',
url => $url2,
permission => 'F',
@@ -8762,167 +8539,130 @@ sub grading_menu {
url => $url4,
permission => 'F',
icon => 'stat.png',
- linktitle => 'Grade bubblesheet exams, upload/download bubblesheet data files, and review previously graded bubblesheet exams.'
- }
+ linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.'
+ },
+ { linktext => 'Verify Receipt No.',
+ url => $url5,
+ permission => 'F',
+ icon => 'edit-find-replace.png',
+ linktitle => 'Verify a system-generated receipt number for correct problem solution.'
+ }
+
]
});
- #$fields{'command'} = 'verify';
- #$url = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
- #
# Create the menu
my $Str;
- # $Str .= ''.&mt('Please select a grading task').' ';
$Str .= ' ';
$Str .= ' '.
' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
' '."\n".
' '."\n";
- $Str .= Apache::lonhtmlcommon::generate_menu(@menu);
- #$menudata->{'jscript'}
- $Str .=' '.
- &Apache::lonnet::recprefix($env{'request.course.id'}).
- '- ';
+ $Str .= &Apache::lonhtmlcommon::generate_menu(@menu);
+ return $Str;
+}
- $Str .=" \n";
- my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
- $request->print(<
- function checkChoice(formname,val,cmdx) {
- if (val <= 2) {
- var cmd = radioSelection(formname.radioChoice);
- var cmdsave = cmd;
- } else {
- cmd = cmdx;
- cmdsave = 'submission';
- }
- formname.command.value = cmd;
- if (val < 5) formname.submit();
- if (val == 5) {
- if (!checkReceiptNo(formname,'notOK')) {
- return false;
- } else {
- formname.submit();
- }
- }
- }
- function checkReceiptNo(formname,nospace) {
- var receiptNo = formname.receipt.value;
- var checkOpt = false;
- if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;}
- if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;}
- if (checkOpt) {
- alert("$receiptalert");
- formname.receipt.value = "";
- formname.receipt.focus();
- return false;
- }
- return true;
- }
-
-GRADINGMENUJS
+sub ungraded {
+ my ($request)=@_;
+ &submit_options($request);
+}
+
+sub submit_options_sequence {
+ my ($request) = @_;
+ my ($symb)=&get_symb($request);
+ if (!$symb) {return '';}
&commonJSfunctions($request);
- return $Str;
+ my $result;
+
+ $result.=''."\n".
+ ' '."\n".
+ ' '."\n".
+ ' '."\n";
+
+ $result.='
+
+ '.&mt('Grade complete page/sequence/folder for one student').'
+ '.
+ &selectfield(0).
+ '
+
+
+
+
+ ';
+ $result .= &show_grading_menu_form($symb);
+ return $result;
+}
+
+sub submit_options_table {
+ my ($request) = @_;
+ my ($symb)=&get_symb($request);
+ if (!$symb) {return '';}
+ &commonJSfunctions($request);
+ my $result;
+
+ $result.=''."\n".
+ ' '."\n".
+ ' '."\n".
+ ' '."\n";
+
+ $result.='
+
+ '.&mt('Grading table').'
+ '.
+ &selectfield(0).
+ '
+
+
+
+
+ ';
+ $result .= &show_grading_menu_form($symb);
+ return $result;
}
+
#--- Displays the submissions first page -------
sub submit_options {
my ($request) = @_;
my ($symb)=&get_symb($request);
if (!$symb) {return '';}
- my $probTitle = &Apache::lonnet::gettitle($symb);
- my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
- $request->print(<
- function checkChoice(formname,val,cmdx) {
- if (val <= 2) {
- var cmd = radioSelection(formname.radioChoice);
- var cmdsave = cmd;
- } else {
- cmd = cmdx;
- cmdsave = 'submission';
- }
- formname.command.value = cmd;
- formname.saveState.value = "saveCmd="+cmdsave+":saveSec="+pullDownSelection(formname.section)+
- ":saveSub="+pullDownSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
- if (val < 5) formname.submit();
- if (val == 5) {
- if (!checkReceiptNo(formname,'notOK')) { return false;}
- formname.submit();
- }
- if (val < 7) formname.submit();
- }
-
- function checkReceiptNo(formname,nospace) {
- var receiptNo = formname.receipt.value;
- var checkOpt = false;
- if (nospace == "OK" && isNaN(receiptNo)) {checkOpt = true;}
- if (nospace == "notOK" && (isNaN(receiptNo) || receiptNo == "")) {checkOpt = true;}
- if (checkOpt) {
- alert("$receiptalert");
- formname.receipt.value = "";
- formname.receipt.focus();
- return false;
- }
- return true;
- }
-
-GRADINGMENUJS
&commonJSfunctions($request);
- my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
my $result;
- my (undef,$sections) = &getclasslist('all','0');
- my $savedState = &savedState();
- my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
- my $saveSec = ($$savedState{'saveSec'} eq '' ? 'all' : $$savedState{'saveSec'});
- my $saveSub = ($$savedState{'saveSub'} eq '' ? 'all' : $$savedState{'saveSub'});
- my $saveStatus = ($$savedState{'saveStatus'} eq '' ? 'Active' : $$savedState{'saveStatus'});
-
- # Preselect sections
- my $selsec="";
- if (ref($sections)) {
- foreach my $section (sort(@$sections)) {
- $selsec.=''.$section.' '."\n";
- }
- }
$result.=''."\n".
' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
- ' '."\n".
' '."\n".
' '."\n";
$result.='
- '.&mt('Grade Current Resource').'
-
-
- '.$table.'
-
+ '.&mt('Select individual students to grade').'
+'.&selectfield(1).'
+
+
+
+
+
+
+ ';
+ $result .= &show_grading_menu_form($symb);
+ return $result;
+}
-
+sub selectfield {
+ my ($full)=@_;
+ my $result='
'.&mt('Sections').'
- '."\n";
- $result.= $selsec;
- $result.= 'all ';
- $result.='
+ '.&Apache::lonstatistics::SectionSelect('section','multiple',5).'
@@ -8936,63 +8676,25 @@ GRADINGMENUJS
'.&mt('Access Status').'
- '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').'
-
-
+ '.&Apache::lonhtmlcommon::StatusOptions(undef,undef,5,undef,'mult').'
+ ';
+ if ($full) {
+ $result.='
'.&mt('Submission Status').'
-
-
- '.&mt('with submissions').'
- '.&mt('in grading queue').'
- '.&mt('with ungraded submissions').'
- '.&mt('with incorrect submissions').'
- '.&mt('with any status').'
-
-
-
-
-
-
-
-
-
-
- '.&mt('Grade Complete Folder for One Student').'
-
-
- ';
- $result .= &show_grading_menu_form($symb);
+ '.
+ &Apache::loncommon::select_form('all','submitonly',
+ (&Apache::lonlocal::texthash(
+ 'yes' => 'with submissions',
+ 'queued' => 'in grading queue',
+ 'graded' => 'with ungraded submissions',
+ 'incorrect' => 'with incorrect submissions',
+ 'all' => 'with any status'),
+ 'select_form_order' => ['yes','queued','graded','incorrect','all'])).
+ '';
+ }
+ $result.='
';
return $result;
}
@@ -9084,9 +8786,6 @@ sub process_clicker {
my ($symb)=&get_symb($r);
if (!$symb) {return '';}
my $result=&checkforfile_js();
- $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
- my ($table) = &showResourceInfo($symb,$env{'form.probTitle'});
- $result.=$table;
$result.=''."\n";
$result.=''."\n".
'
'."\n";
@@ -9195,8 +8893,7 @@ sub process_clicker_file {
my %Saveable_Parameters=&clicker_grading_parameters();
&Apache::loncommon::store_course_settings('grades_clicker',
\%Saveable_Parameters);
-
- my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
+ my $result='';
if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) {
$result.=''.&mt('You need to specify a clicker ID for the correct answer').' ';
return $result.&show_grading_menu_form($symb);
@@ -9209,7 +8906,7 @@ sub process_clicker_file {
if ($env{'form.gradingmechanism'} eq 'given') {
$env{'form.givenanswer'}=~s/^\s*//gs;
$env{'form.givenanswer'}=~s/\s*$//gs;
- $env{'form.givenanswer'}=~s/[^a-zA-Z0-9\.\*\-\+]+/\,/g;
+ $env{'form.givenanswer'}=~s/[^a-zA-Z0-9\.\*\-]+/\,/g;
$env{'form.givenanswer'}=uc($env{'form.givenanswer'});
my @answers=split(/\,/,$env{'form.givenanswer'});
$foundgiven=$#answers+1;
@@ -9269,11 +8966,10 @@ sub process_clicker_file {
$result.=(<
-$heading
+$heading
-
@@ -9338,7 +9034,7 @@ ENDHEADER
"\n".&mt("Username").": ".
"\n".&mt("Domain").": ".
&Apache::loncommon::select_dom_form($env{'course.'.$env{'request.course.id'}.'.domain'},'udom'.$id).' '.
- &Apache::loncommon::selectstudent_link('clickeranalysis','uname'.$id,'udom'.$id,0,$id);
+ &Apache::loncommon::selectstudent_link('clickeranalysis','uname'.$id,'udom'.$id);
$unknown_count++;
}
}
@@ -9383,7 +9079,6 @@ sub iclicker_eval {
$id=~s/^[\#0]+//;
for (my $i=0;$i<$number;$i++) {
my $idx=3+$i*6;
- $entries[$idx]=~s/[^a-zA-Z0-9\.\*\-\+]+//g;
push(@idresponses,$entries[$idx]);
}
$$responses{$id}=join(',',@idresponses);
@@ -9436,15 +9131,14 @@ sub assign_clicker_grades {
# FIXME: This should probably look for the first handgradeable part
my $part=$$partlist[0];
# Start screen output
- my ($result) = &showResourceInfo($symb,$env{'form.probTitle'});
-
- $result .= ' '.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- ''.&mt('Assigning grades based on clicker file').' '.
- &Apache::loncommon::end_data_table_header_row().
- &Apache::loncommon::start_data_table_row().'';
+ my $result='';
+ my $heading=&mt('Assigning grades based on clicker file');
+ $result.=(<
+
+$heading
+ENDHEADER
# Get correct result
# FIXME: Possibly need delimiter other than ":"
my @correct=();
@@ -9460,26 +9154,25 @@ sub assign_clicker_grades {
$result.=''.
&mt('More than one correct result given for question "[_1]": [_2] versus [_3].',
$env{'form.question:'.$i},$correct[$i],$input[$i]).' ';
- } elsif (($input[$i]) || ($input[$i] eq '0')) {
+ } elsif ($input[$i]) {
$correct[$i]=$input[$i];
}
}
}
}
for (my $i=0;$i<$number;$i++) {
- if ((!$correct[$i]) && ($correct[$i] ne '0')) {
+ if (!$correct[$i]) {
$result.=''.
&mt('No correct result given for question "[_1]"!',
$env{'form.question:'.$i}).' ';
}
}
- $result.=' '.&mt("Correct answer: [_1]",join(', ',map { ((($_) || ($_ eq '0'))?$_:'-') } @correct));
+ $result.=' '.&mt("Correct answer: [_1]",join(', ',map { ($_?$_:'-') } @correct));
}
# Start grading
my $pcorrect=$env{'form.pcorrect'};
my $pincorrect=$env{'form.pincorrect'};
my $storecount=0;
- my %users=();
foreach my $key (keys(%env)) {
my $user='';
if ($key=~/^form\.student\:(.*)$/) {
@@ -9493,13 +9186,7 @@ sub assign_clicker_grades {
$user=$env{'form.multi'.$id};
}
}
- if ($user) {
- if ($users{$user}) {
- $result.=''.
- &mt("More than one entry found for [_1] !",$user).
- ' ';
- }
- $users{$user}=1;
+ if ($user) {
my @answer=split(/\,/,$env{$key});
my $sum=0;
my $realnumber=$number;
@@ -9512,23 +9199,11 @@ sub assign_clicker_grades {
} elsif ($correct[$i] eq '*') {
$sum+=$pcorrect;
} else {
-# We actually grade if correct or not
- my $increment=$pincorrect;
-# Special case: numerical answer "0"
- if ($correct[$i] eq '0') {
- if ($answer[$i]=~/^[0\.]+$/) {
- $increment=$pcorrect;
- }
-# General numerical answer, both evaluate to something non-zero
- } elsif ((1.0*$correct[$i]!=0) && (1.0*$answer[$i]!=0)) {
- if (1.0*$correct[$i]==1.0*$answer[$i]) {
- $increment=$pcorrect;
- }
-# Must be just alphanumeric
- } elsif ($answer[$i] eq $correct[$i]) {
- $increment=$pcorrect;
+ if ($answer[$i] eq $correct[$i]) {
+ $sum+=$pcorrect;
+ } else {
+ $sum+=$pincorrect;
}
- $sum+=$increment;
}
}
}
@@ -9551,9 +9226,8 @@ sub assign_clicker_grades {
}
# We are done
$result.=' '.&mt('Successfully stored grades for [quant,_1,student].',$storecount).
- ' '.
- &Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table()." \n";
+ '
'."\n".
+ '
'."\n";
return $result.&show_grading_menu_form($symb);
}
@@ -9567,13 +9241,14 @@ sub navmap_errormsg {
sub handler {
my $request=$_[0];
&reset_caches();
- if ($request->header_only) {
- &Apache::loncommon::content_type($request,'text/html');
- $request->send_http_header;
- return OK;
+ if ($env{'browser.mathml'}) {
+ &Apache::loncommon::content_type($request,'text/xml');
+ } else {
+ &Apache::loncommon::content_type($request,'text/html');
}
+ $request->send_http_header;
+ return '' if $request->header_only;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
-
my $symb=&get_symb($request,1);
my @commands=&Apache::loncommon::get_env_multiple('form.command');
my $command=$commands[0];
@@ -9584,61 +9259,15 @@ sub handler {
$ssi_error = 0;
my $brcrum = [{href=>"/adm/grades",text=>"Grading"}];
- my $start_page = &Apache::loncommon::start_page('Grading',undef,
- {'bread_crumbs' => $brcrum});
+ $request->print(&Apache::loncommon::start_page('Grading',undef,
+ {'bread_crumbs' => $brcrum}));
if ($symb eq '' && $command eq '') {
- if ($env{'user.adv'}) {
- &Apache::loncommon::content_type($request,'text/html');
- $request->send_http_header;
- $request->print($start_page);
- if (($env{'form.codeone'}) && ($env{'form.codetwo'}) &&
- ($env{'form.codethree'})) {
- my $token=$env{'form.codeone'}.'*'.$env{'form.codetwo'}.'*'.
- $env{'form.codethree'};
- my ($tsymb,$tuname,$tudom,$tcrsid)=
- &Apache::lonnet::checkin($token);
- if ($tsymb) {
- my ($map,$id,$url)=&Apache::lonnet::decode_symb($tsymb);
- if (&Apache::lonnet::allowed('mgr',$tcrsid)) {
- $request->print(&ssi_with_retries('/res/'.$url, $ssi_retries,
- ('grade_username' => $tuname,
- 'grade_domain' => $tudom,
- 'grade_courseid' => $tcrsid,
- 'grade_symb' => $tsymb)));
- } else {
- $request->print('Not authorized: '.$token.' ');
- }
- } else {
- $request->print('Not a valid DocID: '.$token.' ');
- }
- } else {
- $request->print(&Apache::lonxml::tokeninputfield());
- }
- } elsif ($env{'request.course.id'}) {
- &init_perm();
- if (!%perm) {
- $request->internal_redirect('/adm/quickgrades');
- } else {
- &Apache::loncommon::content_type($request,'text/html');
- $request->send_http_header;
- $request->print($start_page);
- }
- }
+#
+# Not called from a resource
+#
+
} else {
- &init_perm();
- if (!$env{'request.course.id'}) {
- unless ((&Apache::lonnet::allowed('usc',$env{'request.role.domain'})) &&
- ($command =~ /^scantronupload/)) {
- # Not in a course.
- $env{'user.error.msg'}="/adm/grades::vgr:0:0:Cannot display grades page outside course context";
- return HTTP_NOT_ACCEPTABLE;
- }
- } elsif (!%perm) {
- $request->internal_redirect('/adm/quickgrades');
- }
- &Apache::loncommon::content_type($request,'text/html');
- $request->send_http_header;
- $request->print($start_page);
+ &init_perm();
if ($command eq 'submission' && $perm{'vgr'}) {
($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {
@@ -9651,14 +9280,22 @@ sub handler {
&processGroup($request);
} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
$request->print(&grading_menu($request));
- } elsif ($command eq 'submit_options' && $perm{'vgr'}) {
+ } elsif ($command eq 'individual' && $perm{'vgr'}) {
$request->print(&submit_options($request));
+ } elsif ($command eq 'ungraded' && $perm{'vgr'}) {
+ $request->print(&submit_options($request));
+ } elsif ($command eq 'table' && $perm{'vgr'}) {
+ $request->print(&submit_options_table($request));
+ } elsif ($command eq 'all_for_one' && $perm{'vgr'}) {
+ $request->print(&submit_options_sequence($request));
} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
$request->print(&viewgrades($request));
} elsif ($command eq 'handgrade' && $perm{'mgr'}) {
$request->print(&processHandGrade($request));
} elsif ($command eq 'editgrades' && $perm{'mgr'}) {
$request->print(&editgrades($request));
+ } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) {
+ $request->print(&initialverifyreceipt($request));
} elsif ($command eq 'verify' && $perm{'vgr'}) {
$request->print(&verifyreceipt($request));
} elsif ($command eq 'processclicker' && $perm{'mgr'}) {
@@ -9716,7 +9353,7 @@ sub handler {
}
$request->print(&Apache::loncommon::end_page());
&reset_caches();
- return OK;
+ return '';
}
1;
@@ -9820,8 +9457,6 @@ ssi_with_retries()
calling routine should trap the error condition and display the warning
found in &navmap_errormsg().
- $scantron_config - Reference to bubblesheet format configuration hash.
-
Returns the maximum number of bubble lines that are expected to
occur. Does this by walking the selected sequence rendering the
resource and then checking &Apache::lonxml::get_problem_counter()
@@ -9845,7 +9480,7 @@ ssi_with_retries()
=item scantron_process_students() :
- Routine that does the actual grading of the bubblesheet information.
+ Routine that does the actual grading of the bubble sheet information.
The parsed scanline hash is added to %env
@@ -9865,7 +9500,7 @@ ssi_with_retries()
=item scantron_upload_scantron_data() :
- Creates the screen for adding a new bubblesheet data file to a course.
+ Creates the screen for adding a new bubble sheet data file to a course.
=item scantron_upload_scantron_data_save() :
@@ -9879,7 +9514,7 @@ ssi_with_retries()
=item scantron_download_scantron_data() :
Shows a list of the three internal files (original, corrected,
- skipped) for a specific bubblesheet data file that exists in the
+ skipped) for a specific bubble sheet data file that exists in the
course.
=item scantron_validate_ID() :