--- loncom/homework/grades.pm 2002/08/02 21:10:03 1.44 +++ loncom/homework/grades.pm 2002/09/21 00:08:17 1.52 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.44 2002/08/02 21:10:03 ng Exp $ +# $Id: grades.pm,v 1.52 2002/09/21 00:08:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -103,17 +103,6 @@ sub response_type { return \@partlist,\%handgrade; } -#--- Prints a message on screen if a user did something wrong -#--- Operator error --- -sub userError { - my ($request, $reason, $step) = @_; - $request->print('

LON-CAPA User Error


'."\n"); - $request->print('Reason: '.$reason.'

'."\n"); - $request->print('Step: '.($step ne '' ? $step : 'Use your browser back button to correct') - .'

'."\n"); - return ''; -} - #--- Dumps the class list with usernames,list of sections, #--- section, ids and fullnames for each user. sub getclasslist { @@ -122,6 +111,10 @@ sub getclasslist { my %classlist=&Apache::lonnet::dump('classlist', $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + my ($tmp) = keys(%classlist); + # Bail out if we were unable to get the classlist + return if ($tmp =~ /^(con_lost|error|no_such_host)/i); + # codes to check for fields in the classlist # should contain end:start:id:section:fullname for (keys %classlist) { @@ -224,11 +217,33 @@ sub student_gradeStatus { return %partstatus; } +# hidden form and javascript that calls the form +# Use by verifyscript and viewgrades +# Shows a student's view of problem and submission +sub jscriptNform { + my ($url,$symb) = @_; + my $jscript=''."\n"; + $jscript.= '
'."\n". + ''."\n". + ''."\n". + ''."\n". + ''."\n". + ''."\n". + '
'."\n"; + return $jscript; +} #------------------ End of general use routines -------------------- #------------------------------------------------------------------- #------------------------------------ Receipt Verification Routines +# #--- Check whether a receipt number is valid.--- sub verifyreceipt { my $request = shift; @@ -243,23 +258,8 @@ sub verifyreceipt { $symb = &Apache::lonnet::symbread($url); } - my $jscript=''."\n"; - $jscript.= '
'."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - '
'."\n"; - - my $title.='

Verifying Submission Receipt '. - $receipt.'

'."\n". + my $title.='

Verifying Submission Receipt '. + $receipt.'

'."\n". 'Resource: '.$ENV{'form.url'}.'

'."\n"; my ($string,$contents,$matches) = ('','',0); @@ -281,7 +281,7 @@ sub verifyreceipt { if ($matches == 0) { $string = $title.'No match found for the above receipt.'; } else { - $string = $jscript.$title. + $string = &jscriptNform($url,$symb).$title. 'The above receipt matches the following student'. ($matches <= 1 ? '.' : 's.')."\n". '
'."\n". @@ -292,7 +292,7 @@ sub verifyreceipt { $contents. '
'."\n"; } - return $string.&show_grading_menu_form ($symb,$url); + return $string.&show_grading_menu_form($symb,$url); } #--- This is called by a number of programs. @@ -301,17 +301,15 @@ sub verifyreceipt { # on the problem page. sub listStudents { my ($request) = shift; + + my ($symb,$url) = &get_symb_and_url(); my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"}; my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'}; - my $result='

 '. - 'View Submissions for a Student or a Group of Students

'; - $result.=''; - $result.=''; - my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); + my $result; + my ($partlist,$handgrade) = &response_type($url); for (sort keys(%$handgrade)) { my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); $ENV{'form.handgrade'} = 'yes' if ($handgrade eq 'yes'); @@ -320,62 +318,108 @@ sub listStudents { ''; } $result.='
'. - 'Resource: '.$ENV{'form.url'}.'
Handgrade: '.$handgrade.'
'; - $request->print($result); - $request->print(<View Problem: no - yes
Submissions: - handgrade only - last sub only - last sub & parts info - all details - - - -
-
- -ENDTABLEST - if ($ENV{'form.url'}) { - $request->print(''."\n"); + my $viewgrade; + if ($ENV{'form.handgrade'} eq 'yes') { + $viewgrade = 'View/Grade'; + } else { + $viewgrade = 'View'; } - if ($ENV{'form.symb'}) { - $request->print(''."\n"); + + $result='

 '. + $viewgrade. + ' Submissions for a Student or a Group of Students

'. + ''.$result; + + $request->print(< + function checkSelect(checkBox) { + var ctr=0; + var sense=""; + if (checkBox.length > 1) { + for (var i=0; iprint(''."\n"); + if (ctr == 0) { + alert("Please select "+sense+" before clicking on the $viewgrade button."); + return false; + } + document.gradesub.submit(); + } + +LISTJAVASCRIPT + + $request->print($result); + + my $checkhdgrade = $ENV{'form.handgrade'} eq 'yes' ? 'checked' : ''; + my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked'; + my $gradeTable='
'."\n". + ' View Problem: no '."\n". + ' yes
'."\n". + ' Submissions: '."\n"; + if ($ENV{'form.handgrade'} eq 'yes') { + $gradeTable.=' handgrade only'."\n"; + } + $gradeTable.=' last sub only'."\n". + ' last sub & parts info'."\n". + ' all details'."\n". + ''."\n". + ''."\n". + ''."\n". + '
'."\n". + '
'."\n". + ''."\n". + ''."\n". + 'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n". + 'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n". + ' on the check boxes for the group of students.
'."\n". + ''."\n". + ''."\n"; + my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); - $result='
'. + 'Resource: '.$url.'
'. + $gradeTable.='
'. ''. ''. ''; foreach (sort(@$partlist)) { - $result.=''; + $gradeTable.=''; } - $request->print($result.''."\n"); + $gradeTable.=''."\n"; + my $ctr = 0; foreach my $student (sort {$$fullname{$a} cmp $$fullname{$b} } keys %$fullname) { my ($uname,$udom) = split(/:/,$student); - my (%status) = &student_gradeStatus($ENV{'form.url'}, - $ENV{'form.symb'},$udom,$uname,$partlist); + my (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist); my $statusflg = ''; foreach (keys(%status)) { $statusflg = 1 if ($status{$_} ne 'nothing'); my ($foo,$partid,$foo1) = split(/\./,$_); if ($status{'resource.'.$partid.'.submitted_by'} ne '') { $statusflg = ''; - $request->print(''); + $gradeTable.=''; } } next if ($statusflg eq '' && $submitonly eq 'yes'); + $ctr++; if ( $Apache::grades::viewgrades eq 'F' ) { - $result=''. + $gradeTable.=''. ''."\n". ''."\n". @@ -384,13 +428,23 @@ ENDTABLEST foreach (sort keys(%status)) { next if (/^resource.*?submitted_by$/); - $result.=''."\n"; + $gradeTable.=''."\n"; } - $request->print($result.''."\n"); + $gradeTable.=''."\n"; } } - $request->print('
 Select  Fullname  Username  Domain  Part '.(split(/_/))[0].' Status  Part '.(split(/_/))[0].' Status 
 '.$$fullname{$student}.'  '.$status{$_}.'  '.$status{$_}.' 
'); - $request->print(''); + $gradeTable.='
'. + ''."\n"; + if ($ctr == 0) { + $gradeTable='
 '. + 'No submission found for this resource.
'; + } elsif ($ctr == 1) { + $gradeTable =~ s/type=checkbox/type=checkbox checked/; + } + $gradeTable.=&show_grading_menu_form($symb,$url); + $request->print($gradeTable); return ''; } @@ -402,10 +456,7 @@ sub processGroup { my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}} : ($ENV{'form.stuinfo'})); my $total = scalar(@stuchecked)-1; - if ($stuchecked[0] eq '') { - &userError($request,'No student was selected for viewing/grading.'); - return; - } + foreach (@stuchecked) { my ($uname,$udom,$fullname) = split(/:/); $ENV{'form.student'} = $uname; @@ -489,6 +540,30 @@ sub sub_page_js { return; } +//=================== Check that a point is assigned for all the parts ============== + function checksubmit(val,total,parttot) { + document.SCORE.gradeOpt.value = val; + if (val == "Save & Next") { + for (i=0;i<=total;i++) { + for (j=0;jprint('

 Submission Record

'. - ' Resource: '.$url.''); + $request->print('

 Submission Record

'."\n". + ' Resource: '.$url.''."\n"); # option to display problem, only once else it cause problems # with the form later since the problem has a form. @@ -778,7 +853,7 @@ sub submission { $ENV{'request.course.id'}); my $result.='
'; $result.='
'; - $result.=' View of the problem for '.$ENV{'form.fullname'}. + $result.=' View of the problem - '.$ENV{'form.fullname'}. '
'.$rendered.'
'; $result.='Correct answer:
'.$companswer; $result.='
'; @@ -851,16 +926,17 @@ KEYWORDS # Display student info $request->print(($counter == 0 ? '' : '
')); - my $result='
'. - '
'; + my $result='
'."\n". + '
'."\n"; -# $result.=''; + $lastsubonly.=''."\n"; } else { for my $part (sort keys(%$handgrade)) { foreach (@$string) { @@ -939,7 +1016,7 @@ KEYWORDS $lastsubonly.='' + &keywords_highlight($subval).''."\n" if ($ENV{'form.lastSub'} eq 'lastonly' || ($ENV{'form.lastSub'} eq 'hdgrade' && $$handgrade{$part} =~ /:yes$/)); @@ -947,7 +1024,7 @@ KEYWORDS } } } - $lastsubonly.=''."\n"; $request->print($lastsubonly); } } else { @@ -959,17 +1036,25 @@ KEYWORDS # return if view submission with no grading option if ($ENV{'form.showgrading'} eq '') { - $request->print('
Fullname: '.$ENV{'form.fullname'}. $result.='Fullname: '.$ENV{'form.fullname'}. '   Username: '.$uname.''. - '   Domain: '.$udom.'
'; + '   Domain: '.$udom.'
'."\n"; + $result.=''."\n"; # If this is handgraded, then check for collaborators - my $col_flag = 0; + my @col_fullnames; if ($ENV{'form.handgrade'} eq 'yes') { my @col_list; ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist('all','0'); @@ -883,8 +959,9 @@ KEYWORDS push @badcollaborators,$collaborator; next; } - $col_flag++; push @col_list, $collaborator; + my ($lastname,$givenn) = split(/,/,$$fullname{$collaborator.':'.$udom}); + push @col_fullnames, $givenn.' '.$lastname; $result.=$$fullname{$collaborator.':'.$udom}.'     '; } $result.='
'."\n"; @@ -924,12 +1001,12 @@ KEYWORDS $request->print($submitby); } else { my ($string,$timestamp)= - &get_last_submission ($symb,$uname,$udom,$ENV{'request.course.id'}); + &get_last_submission (%record); my $lastsubonly.=''. ($$timestamp eq '' ? '' : 'Date Submitted: '. $$timestamp).''; if ($$timestamp eq '') { - $lastsubonly.='
'.$$string[0].'
'.$$string[0].'
Part '. $partid.' ( ID '.$respid. ' )   Answer: '. - &keywords_highlight($subval).'
'."\n"; + $lastsubonly.='
'); + $request->print('
'."\n"); return; } # Grading options $result=''."\n". ''."\n". - ''."\n"; - $result.=' '. - 'Compose Message to student'.($col_flag > 1 ? 's' : '').''. + ''."\n"; + my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); + my $msgfor = $givenn.' '.$lastname; + if (scalar(@col_fullnames) > 0) { + my $lastone = pop @col_fullnames; + $msgfor .= ', '.(join ', ',@col_fullnames).' and '.$lastone.'.'; + } + $result.='
'."\n". + ' '. + 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').''. '
 (Message will be sent when you click on Save & Next below.)'."\n" if ($ENV{'form.handgrade'} eq 'yes'); $request->print($result); @@ -1022,26 +1107,45 @@ KEYWORDS ''. ''."  \n"; $result.=''; - $result.='
'; + $result.='
'."\n"; $request->print($result); } - $request->print(''."\n"); - $request->print(''."\n"); + $result=''."\n"; + my $ctr = 0; + while ($ctr < scalar(@partlist)) { + $result.=''."\n"; + $ctr++; + } + $request->print($result.''."\n"); # print end of form if ($counter == $total) { - my $endform.='
'; - my $ntstu =''."\n"; - my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); - $ntstu =~ s/
'; + my $endform='
'. + ''."\n"; + if ($ENV{'form.handgrade'} eq 'yes') { + $endform.='  '."\n"; + my $ntstu =''."\n"; + my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1'); + $ntstu =~ s/
'; + $endform.=&show_grading_menu_form($symb,$url); $request->print($endform); } return ''; @@ -1049,31 +1153,30 @@ KEYWORDS #--- Retrieve the last submission for all the parts sub get_last_submission { - my ($symb,$username,$domain,$course)=@_; - if ($symb) { - my (@string,$timestamp); - my (%returnhash)=&Apache::lonnet::restore($symb,$course,$domain,$username); - if ($returnhash{'version'}) { - my %lasthash=(); - my ($version); - for ($version=1;$version<=$returnhash{'version'};$version++) { - foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { - $lasthash{$_}=$returnhash{$version.':'.$_}; - } - } - foreach ((keys %lasthash)) { - if ($_ =~ /\.submission$/) { - my ($partid,$foo) = split(/submission$/,$_); - my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? - 'Draft Copy ' : ''; - push @string, (join(':',$_,$draft.$lasthash{$_})); - } - if ($_ =~ /timestamp/) {$timestamp = scalar(localtime($lasthash{$_}))}; + my (%returnhash)=@_; + my (@string,$timestamp); + if ($returnhash{'version'}) { + my %lasthash=(); + my ($version); + for ($version=1;$version<=$returnhash{'version'};$version++) { + foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { + $lasthash{$_}=$returnhash{$version.':'.$_}; + if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) { + $timestamp = scalar(localtime($returnhash{$version.':timestamp'})); + } + } + } + foreach ((keys %lasthash)) { + if ($_ =~ /\.submission$/) { + my ($partid,$foo) = split(/submission$/,$_); + my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? + 'Draft Copy ' : ''; + push @string, (join(':',$_,$draft.$lasthash{$_})); } } - @string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; - return \@string,\$timestamp; } + @string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string; + return \@string,\$timestamp; } #--- High light keywords, with style choosen by user. @@ -1102,8 +1205,7 @@ sub processHandGrade { my $ctr = 0; while ($ctr < $ngrade) { my ($uname,$udom) = split(/:/,$ENV{'form.unamedom'.$ctr}); - my ($errorflg) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); - return '' if ($errorflg eq 'error'); + my ($errorflag) = &saveHandGrade($request,$url,$symb,$uname,$udom,$ctr); my $includemsg = $ENV{'form.includemsg'.$ctr}; my ($subject,$message,$msgstatus) = ('','',''); @@ -1263,11 +1365,6 @@ sub saveHandGrade { my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? $ENV{'form.GD_BOX'.$newflg.'_'.$_} : $ENV{'form.RADVAL'.$newflg.'_'.$_}); - if ($pts eq '') { - &userError($request,'No point was assigned for part '.$_. - ' and for username '.$stuname.'.'); - return 'error'; - } my $wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 : $ENV{'form.WGT'.$newflg.'_'.$_}; my $partial= $pts/$wgt; @@ -1304,13 +1401,7 @@ sub viewgrades_js { $request->print(< - function viewOneStudent(user,domain) { - document.onestudent.student.value = user; - document.onestudent.userdom.value = domain; - document.onestudent.submit(); - } - - function writePoint(partid,weight,point) { + function writePoint(partid,weight,point) { var radioButton = eval("document.classgrade.RADVAL_"+partid); var textbox = eval("document.classgrade.TEXTVAL_"+partid); if (point == "textval") { @@ -1480,18 +1571,12 @@ sub viewgrades { &viewgrades_js($request); my ($symb,$url) = ($ENV{'form.symb'},$ENV{'form.url'}); - my $result='

Manual Grading

'; + my $result='

Manual Grading

'; $result.='Resource: '.$ENV{'form.url'}.''."\n"; #view individual student submission form - called using Javascript viewOneStudent - $result.= '
'."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - '
'."\n"; + $result.=&jscriptNform($url,$symb); #beginning of class grading form $result.= '
'."\n". @@ -1499,22 +1584,34 @@ sub viewgrades { ''."\n". ''."\n". ''."\n"; - - $result.='To assign the same score for all the students use the radio buttons or '. - 'text box below. To assign scores individually fill in the score boxes for '. - 'each student in the table below. A part that has already '. - 'been graded does not get changed using the radio buttons or text box. '. - 'If needed, it has to be changed individually.'; - + $result.='

Assign Common Grade To '; + if ($ENV{'form.section'} eq 'all') { + $result.='Class

'; + } elsif ($ENV{'form.section'} eq 'no') { + $result.='Students in no Section '; + } else { + $result.='Students in Section '.$ENV{'form.section'}.''; + } + $result.= '
'."\n". + '
'; +# $result.='To assign the same score for all the students use the radio buttons or '. +# 'text box below. To assign scores individually fill in the score boxes for '. +# 'each student in the table below. A part that has already '. +# 'been graded does not get changed using the radio buttons or text box. '. +# 'If needed, it has to be changed individually.'; +# $result.='
'; #radio buttons/text box for assigning points for a section or class. #handles different parts of a problem my ($partlist,$handgrade) = &response_type($ENV{'form.url'}); my %weight = (); my $ctsparts = 0; $result.=''; + my %seen = (); for (sort keys(%$handgrade)) { - my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); my ($partid,$respid) = split (/_/); + next if $seen{$partid}; + $seen{$partid}++; + my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb); $weight{$partid} = $wgt eq '' ? '1' : $wgt; @@ -1544,15 +1641,23 @@ sub viewgrades { ''."\n"; $ctsparts++; } - $result.='
'; + $result.='
'.'
'.''."\n". + ''; $result.='    '; -# $result.=''."\n"; - $result.= ''."\n"; + $result.=''."\n"; #table listing all the students in a section/class #header of table + $result.= '

Assign Grade to Specific Students in '; + if ($ENV{'form.section'} eq 'all') { + $result.='the Class

'; + } elsif ($ENV{'form.section'} eq 'no') { + $result.='no Section '; + } else { + $result.='Section '.$ENV{'form.section'}.''; + } $result.= '
'."\n". ''. ''."\n"; @@ -1586,7 +1691,8 @@ sub viewgrades { } $result.='
FullnameUsernameDomain
'; $result.=''."\n"; - $result.='
'; + $result.=''."\n"; $result.=&show_grading_menu_form($symb,$url); return $result; } @@ -1638,7 +1744,7 @@ sub editgrades { my $symb=$ENV{'form.symb'}; my $url =$ENV{'form.url'}; - my $title='

Current Grade Status

'; + my $title='

Current Grade Status

'; $title.='Resource: '.$ENV{'form.url'}.'
'."\n"; $title.='Section: '.$ENV{'form.section'}.''."\n"; $title.= &show_grading_menu_form ($symb,$url); @@ -1810,16 +1916,30 @@ ENDPICK sub csvuploadmap_header { my ($request,$symb,$url,$datatoken,$distotal)= @_; - my $result; my $javascript; if ($ENV{'form.upfile_associate'} eq 'reverse') { $javascript=&csvupload_javascript_reverse_associate(); } else { $javascript=&csvupload_javascript_forward_associate(); } + + my $result=''; + $result.=''; + my ($partlist,$handgrade) = &response_type($url); + my ($resptype,$hdgrade)=('','no'); + for (sort keys(%$handgrade)) { + my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_}); + $resptype = $responsetype; + $hdgrade = $handgrade if ($handgrade eq 'yes'); + $result.=''. + ''. + ''; + } + $result.='
Resource: '.$url.'
Part '.(split(/_/))[0].'Type: '.$responsetype.'Handgrade: '.$handgrade.'
'; $request->print(< -

Uploading Class Grades for resource $url

+

Uploading Class Grades

+$result

Identify fields

Total number of records found in file: $distotal
@@ -1887,6 +2007,7 @@ sub csvuploadmap { my ($i,$keyfields); if (@records) { my @fields=&csvupload_fields($url); + if ($ENV{'form.upfile_associate'} eq 'reverse') { &Apache::loncommon::csv_print_samples($request,\@records); $i=&Apache::loncommon::csv_print_select_table($request,\@records, @@ -1926,8 +2047,6 @@ sub csvuploadassign { } $request->print('

Assigning Grades

'); my $courseid=$ENV{'request.course.id'}; -# my $cdom=$ENV{"course.$courseid.domain"}; -# my $cnum=$ENV{"course.$courseid.num"}; my ($classlist) = &getclasslist('all','1'); my @skipped; my $countdone=0; @@ -1987,7 +2106,7 @@ sub gradingmenu { my ($request) = @_; my ($symb,$url)=&get_symb_and_url($request); if (!$symb) {return '';} - my $result='

 Select a Grading Method

'; + my $result='

 Select a Grading Method

'; $result.=''; $result.=''; my ($partlist,$handgrade) = &response_type($url); @@ -2016,18 +2135,20 @@ sub view_edit_entire_class_form { my ($classlist,$sections) = &getclasslist('all','0'); my $result.='
Resource: '.$url.'
'."\n"; $result.=''."\n"; + $result.=' Grade Entire Section or Class'."\n"; $result.='
'."\n"; - $result.=' View/Grade Entire Section/Class
'."\n"; $result.='
'."\n". ''."\n". ''."\n". ''."\n"; $result.=' Select section: '."
\n"; - $result.=' 
'."\n"; + $result.=' '."\n"; $result.='
'."\n"; $result.='
'."\n"; return $result; @@ -2037,7 +2158,17 @@ sub view_edit_entire_class_form { sub upcsvScores_form { my ($symb,$url) = @_; if (!$symb) {return '';} - my $result.='
'."\n"; + my $result = ''."\n"; + + $result.='
'."\n"; $result.=''."\n"; $result.='
'."\n"; $result.=' Specify a file containing the class scores for above resource
'."\n"; @@ -2048,7 +2179,7 @@ sub upcsvScores_form { $upfile_select -
  +
  ENDUPFORM $result.='
'."\n"; @@ -2062,7 +2193,13 @@ sub viewGradeaStu_form { my ($classlist,$sections) = &getclasslist('all','0'); my $result.='
'."\n"; $result.=''."\n"; + $result.=' '; + if ($handgrade eq 'yes') { + $result.="View/Grade "; + } else { + $result.="View "; + } + $result.='an Individual Student\'s Submission'."\n"; $result.='
'."\n"; - $result.=' View/Grade an Individual Student\'s Submission
'."\n"; $result.='
'."\n". ''."\n". @@ -2073,18 +2210,26 @@ sub viewGradeaStu_form { ''."\n"; $result.=' Select section: '."\n"; $result.='  Display students who has: '. ' submitted'. ' everybody
'; - $result.=' (Section "no" implies the students were not assigned a section.)
' - if (grep /no/,@$sections); - - $result.='
 '."\n". - '
'."\n"; + if (ref($sections)) { + $result.=' (Section "no" implies the students were not assigned a section.)
' + if (grep /no/,@$sections); + } + + + $result.='
 '."\n"; $result.='
'."\n"; $result.='
'."\n"; return $result; @@ -2093,17 +2238,27 @@ sub viewGradeaStu_form { #--- Form to input a receipt number --- sub verifyReceipt_form { my ($symb,$url) = @_; - my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; - my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"}; + my $result = ''."\n"; + my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); - my $result.='
'."\n"; + $result.='
'."\n"; $result.=''."\n"; $result.='
'."\n"; $result.=' Verify a Submission Receipt Issued by this Server
'."\n"; - $result.='
'."\n"; + $result.=''."\n"; $result.=' '.$hostver.'-
'."\n"; - $result.=' '."\n"; + $result.=' '."\n"; $result.=''."\n"; if ($ENV{'form.url'}) { $result.=''; @@ -2155,17 +2310,16 @@ sub handler { 'grade_courseid' => $tcrsid, 'grade_symb' => $tsymb))); } else { - $request->print('

Not authorized: '.$token.'

'); + $request->print('

Not authorized: '.$token.'

'); } } else { - $request->print('

Not a valid DocID: '.$token.'

'); + $request->print('

Not a valid DocID: '.$token.'

'); } } else { $request->print(&Apache::lonxml::tokeninputfield()); } } } else { - #&Apache::lonhomework::showhashsubset(\%ENV,'^form'); $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); if ($command eq 'submission') { &listStudents($request) if ($ENV{'form.student'} eq ''); @@ -2215,7 +2369,7 @@ sub send_header { #remotewindow=open('','homeworkremote'); #remotewindow.close(); #"); - $request->print(''); + $request->print(&Apache::loncommon::bodytag('Grading')); } sub send_footer {