--- loncom/homework/grades.pm 2010/01/18 17:54:26 1.590 +++ loncom/homework/grades.pm 2010/04/13 16:12:54 1.617 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.590 2010/01/18 17:54:26 bisitz Exp $ +# $Id: grades.pm,v 1.617 2010/04/13 16:12:54 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -96,6 +96,9 @@ sub ssi_print_error { # # --- Retrieve the parts from the metadata file.--- +# Returns an array of everything that the resources stores away +# + sub getpartlist { my ($symb,$errorref) = @_; @@ -120,21 +123,6 @@ sub getpartlist { return @stores; } -# --- Get the symbolic name of a problem and the url -sub get_symb { - my ($request,$silent) = @_; - (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; - my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); - if ($symb eq '') { - if (!$silent) { - $request->print("Unable to handle ambiguous references:$url:."); - return (); - } - } - &Apache::lonenc::check_decrypt(\$symb); - return ($symb); -} - #--- Format fullname, username:domain if different for display #--- Use anywhere where the student names are listed sub nameUserString { @@ -160,6 +148,10 @@ sub response_type { return; } my $res = $navmap->getBySymb($symb); + unless (ref($res)) { + $$response_error = 1; + return; + } my $partlist = $res->parts(); my %vPart = map { $_ => 1 } (&Apache::loncommon::get_env_multiple('form.vPart')); @@ -203,55 +195,6 @@ sub get_display_part { return $display; } -#--- Show resource title -#--- and parts and response type -sub showResourceInfo { - my ($symb,$probTitle,$checkboxes,$res_error) = @_; - my $result = '

'.&mt('Current Resource').': '.$probTitle.'

'."\n"; - my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); - if (ref($res_error)) { - if ($$res_error) { - return; - } - } - $result.=&Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_header_row(); - if ($checkboxes) { - $result.=' '; - } - $result.=''.&mt('Problem Part').'' - .''.&mt('Res. ID').'' - .''.&mt('Type').'' - .&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.=&Apache::loncommon::start_data_table_row(); - if ($checkboxes) { - if (exists($partsseen{$partID})) { - $result.=" "; - } else { - $result.=""; - } - $partsseen{$partID}=1; - } - my $display_part=&get_display_part($partID,$symb); - $result.=''.$display_part.'' - .''.''.$resID.'' - .''.&mt($responsetype).'' -# .''.&mt('Handgrade: [_1]',$handgrade).'' - .&Apache::loncommon::end_data_table_row(); - } - } - $result.=&Apache::loncommon::end_data_table(); - return $result,$responseType,$hdgrade,$partlist,$handgrade; -} - sub reset_caches { &reset_analyze_cache(); &reset_perm(); @@ -421,7 +364,7 @@ sub cleanRecord { return '
'. ''.$toprow.''. ''. - $grayFont.$bottomrow.''.'
'.&mt('Answer').'
'.$grayFont.&mt('Option ID').'
'; + $bottomrow.''.''; } elsif ($response eq 'essay') { if (! exists ($env{'form.'.$symb})) { my (%keyhash) = &Apache::lonnet::dump('nohist_handgrade', @@ -483,8 +426,7 @@ sub cleanRecord { #-- A couple of common js functions sub commonJSfunctions { my $request = shift; - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< 1) { @@ -512,7 +454,6 @@ sub commonJSfunctions { return selectOne.value; } } - COMMONJSFUNCTIONS } @@ -667,17 +608,15 @@ sub student_gradeStatus { sub jscriptNform { my ($symb) = @_; my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); - my $jscript=''."\n"; + "\n"); $jscript.= '
'."\n". ''."\n". - ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -730,7 +669,7 @@ sub most_similar { # ignore empty submissions (occuring when only files are sent) - unless ($uessay=~/\w+/) { return ''; } + unless ($uessay=~/\w+/s) { return ''; } # these will be returned. Do not care if not at least 50 percent similar my $limit=0.6; @@ -767,22 +706,31 @@ sub most_similar { #------------------------------------ Receipt Verification Routines # + +sub initialverifyreceipt { + my ($request,$symb) = @_; + &commonJSfunctions($request); + return ''. + &Apache::lonnet::recprefix($env{'request.course.id'}). + '-'. + ''."\n". + ''. + "
\n"; +} + #--- Check whether a receipt number is valid.--- sub verifyreceipt { - my $request = shift; + my ($request,$symb) = @_; my $courseid = $env{'request.course.id'}; my $receipt = &Apache::lonnet::recprefix($courseid).'-'. $env{'form.receipt'}; $receipt =~ s/[^\-\d]//g; - my ($symb) = &get_symb($request); my $title.= '

'. - &mt('Verifying Receipt No. [_1]',$receipt). - '

'."\n". - '

'.&mt('Resource: [_1]',$env{'form.probTitle'}). - '

'."\n"; + &mt('Verifying Receipt Number [_1]',$receipt). + ''."\n"; my ($string,$contents,$matches) = ('','',0); my (undef,undef,$fullname) = &getclasslist('all','0'); @@ -852,7 +800,7 @@ sub verifyreceipt { $contents. &Apache::loncommon::end_data_table()."\n"; } - return $string.&show_grading_menu_form($symb); + return $string; } #--- This is called by a number of programs. @@ -860,30 +808,30 @@ sub verifyreceipt { #--- Also called directly when one clicks on the subm button # on the problem page. sub listStudents { - my ($request) = shift; + my ($request,$symb,$submitonly) = @_; - my ($symb) = &get_symb($request); 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 $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; - my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; + unless ($submitonly) { + $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; + } my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View'; - $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? - &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; my $result='

 ' .&mt("$viewgrade Submissions for a Student or a Group of Students") .'

'; - my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($symb,$env{'form.probTitle'},($env{'form.showgrading'} eq 'yes')); + my ($partlist,$handgrade,$responseType) = &response_type($symb +#,$res_error + ); my %lt = &Apache::lonlocal::texthash ( 'multiple' => 'Please select a student or group of students before clicking on the Next button.', 'single' => 'Please select the student before clicking on the Next button.', ); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< LISTJAVASCRIPT &commonJSfunctions($request); @@ -921,7 +868,7 @@ LISTJAVASCRIPT my $checkhdgrade = ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked="checked"' : ''; my $checklastsub = $checkhdgrade eq '' ? 'checked="checked"' : ''; my $gradeTable='
'. - "\n".$table; + "\n"; $gradeTable .= &Apache::lonhtmlcommon::start_pick_box(); $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('View Problem Text')) @@ -944,10 +891,18 @@ LISTJAVASCRIPT my $saveStatus = $stu_status eq '' ? 'Active' : $stu_status; $env{'form.Status'} = $saveStatus; $submission_options.= - ''."\n". - ''."\n". - ''."\n". - ''; + ''. + ''."\n". + ''. + ''."\n". + ''. + ''."\n". + ''. + ''; $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Submissions')) .$submission_options .&Apache::lonhtmlcommon::row_closure(); @@ -966,8 +921,6 @@ LISTJAVASCRIPT ''."\n". '
'."\n". '
'."\n". - ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -1131,7 +1084,6 @@ LISTJAVASCRIPT } elsif ($ctr == 1) { $gradeTable =~ s/type="checkbox"/type="checkbox" checked="checked"/; } - $gradeTable.=&show_grading_menu_form($symb); $request->print($gradeTable); return ''; } @@ -1140,7 +1092,7 @@ LISTJAVASCRIPT sub check_script { my ($form, $type)=@_; - my $chkallscript=''."\n"; +'."\n"); return $chkallscript; } @@ -1210,8 +1162,7 @@ sub processGroup { sub sub_page_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(< SUBJAVASCRIPT } @@ -1389,8 +1339,7 @@ sub sub_page_kw_js { my $iconpath = $request->dir_config('lonIconsURL'); &commonJSfunctions($request); - my $inner_js_msg_central=< + my $inner_js_msg_central= &Apache::lonhtmlcommon::scripttag(< INNERJS - my $inner_js_highlight_central=< + my $inner_js_highlight_central= &Apache::lonhtmlcommon::scripttag(< INNERJS my $start_page_msg_central = @@ -1466,8 +1412,7 @@ INNERJS my $docopen=&Apache::lonhtmlcommon::javascript_docopen(); $docopen=~s/^document\.//; my $alertmsg = &mt('Please select a word or group of words from document and then click this link.'); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< SUBJAVASCRIPT } @@ -1785,7 +1729,6 @@ sub gradeBox { $line.=''."\n"; - #&mt('Part:[_1]Points:[_2]or[_3]',$display_part,$radio,$line); $result .= ''.$display_part.''.$radio.''.&mt('or').''.$line.''; $result.=&Apache::loncommon::end_data_table_row(); @@ -1941,19 +1884,19 @@ sub build_section_inputs { # --------------------------- show submissions of a student, option to grade sub submission { - my ($request,$counter,$total) = @_; + my ($request,$counter,$total,$symb) = @_; my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); $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 $probtitle=&Apache::lonnet::gettitle($symb); if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } if (!&canview($usec)) { $request->print('Unable to view requested student.('. $uname.':'.$udom.' in section '.$usec.' in course id '. $env{'request.course.id'}.')'); - $request->print(&show_grading_menu_form($symb)); return; } @@ -1970,13 +1913,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. @@ -2007,17 +1947,15 @@ 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'}; my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); $request->print(''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -2079,12 +2017,31 @@ KEYWORDS } # This is where output for one specific student would start - my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : ''; - $request->print("\n\n". - '
'. - '
'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'
'. - '
'."\n"); + my $add_class = ($counter%2) ? ' LC_grade_show_user_odd_row' : ''; + $request->print( + "\n\n" + .'
' + .'

'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'

' + ."\n" + ); + # Show additional functions if allowed + if ($perm{'vgr'}) { + $request->print( + &Apache::loncommon::track_student_link( + &mt('View recent activity'), + $uname,$udom,'check') + .' ' + ); + } + if ($perm{'opa'}) { + $request->print( + &Apache::loncommon::pprmlink( + &mt('Set/Change parameters'), + $uname,$udom,$symb,'check')); + } + + # Show Problem if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') { my $mode; if ($env{'form.vProb'} eq 'all' && $env{'form.vAns'} eq 'all') { @@ -2144,7 +2101,9 @@ KEYWORDS if ($$timestamp eq '') { $lastsubonly.='
'.$$string[0].'
'; } else { - $lastsubonly = '
Date Submitted: '.$$timestamp."\n"; + $lastsubonly = + '
' + .''.&mt('Date Submitted:').' '.$$timestamp."\n"; my %seenparts; my @part_response_id = &flatten_responseType($responseType); @@ -2171,7 +2130,7 @@ KEYWORDS $lastsubonly.="\n".'
'. ''.&mt('Part: [_1]',$display_part).''. ' '. - '('.&mt('Part ID: [_1]',$respid).')'. + '('.&mt('Part ID: [_1]',$respid).')'. '   '. ''.&mt('Nothing submitted - no attempts.').'

'; next; @@ -2179,7 +2138,7 @@ KEYWORDS foreach my $submission (@$string) { my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/); if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; } - my ($ressub,$subval) = split(/:/,$submission,2); + my ($ressub,$hide,$subval) = split(/:/,$submission,3); # Similarity check my $similar=''; if($env{'form.checkPlag'}){ @@ -2191,16 +2150,21 @@ KEYWORDS &Apache::lonnet::coursedescription($ocrsid, {'one_time' => 1}); - $similar="

". - &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', - $osim, - &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', - $old_course_desc{'description'}, - $old_course_desc{'num'}, - $old_course_desc{'domain'}). - '

'. - &keywords_highlight($oessay). - '

'; + 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 { + $similar="

". + &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])', + $osim, + &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')', + $old_course_desc{'description'}, + $old_course_desc{'num'}, + $old_course_desc{'domain'}). + '

'. + &keywords_highlight($oessay). + '

'; + } } } my $order=&get_order($partid,$respid,$symb,$uname,$udom); @@ -2212,21 +2176,27 @@ KEYWORDS ''.&mt('Part: [_1]',$display_part).''. ' '. '('.&mt('Part ID: [_1]',$respid).')'. - '   '; + '   '; my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); if (@$files) { - $lastsubonly.='
'.&mt('Like all files provided by users, this file may contain viruses').'
'; - my $file_counter = 0; - foreach my $file (@$files) { - $file_counter++; - &Apache::lonnet::allowuploaded('/adm/grades',$file); - $lastsubonly.='
'.$file.''; - } + 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').'
'; + foreach my $file (@$files) { + &Apache::lonnet::allowuploaded('/adm/grades',$file); + $lastsubonly.='
'.$file.''; + } + } $lastsubonly.='
'; } - $lastsubonly.=''.&mt('Submitted Answer:').' '. - &cleanRecord($subval,$responsetype,$symb,$partid, - $respid,\%record,$order,undef,$uname,$udom); + if ($hide) { + $lastsubonly.=''.&mt('Anonymous Survey').''; + } else { + $lastsubonly.=''.&mt('Submitted Answer:').' '. + &cleanRecord($subval,$responsetype,$symb,$partid, + $respid,\%record,$order,undef,$uname,$udom); + } if ($similar) {$lastsubonly.="

$similar\n";} $lastsubonly.='
'; } @@ -2236,7 +2206,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, @@ -2253,10 +2225,6 @@ KEYWORDS 'onclick="javascript:checksubmit(this.form,\'Grade Student\',\'' .$counter.'\');" target="_self" />  '."\n" if (&canmodify($usec)); $toGrade.='
'."\n"; - if (($env{'form.command'} eq 'submission') || - ($env{'form.command'} eq 'processGroup' && $counter == $total)) { - $toGrade.=''.&show_grading_menu_form($symb); - } $request->print($toGrade); return; } else { @@ -2298,7 +2266,7 @@ KEYWORDS '
' .'

'.&mt('Assign Grades').'

' ); - $request->print(&gradeBox_start()); #
+ $request->print(&gradeBox_start()); foreach my $part_response_id (@part_response_id) { my ($partid,$respid) = @{ $part_response_id }; my $part_resp = join('_',@{ $part_response_id }); @@ -2314,16 +2282,6 @@ KEYWORDS $request->print('
'); $request->print(''); $result=''."\n"; + my $endform='

'."\n"; $endform.='  '."\n"; @@ -2361,11 +2318,12 @@ KEYWORDS 'onclick="javascript:checksubmit(this.form,\'Previous\');" target="_self" />  '."\n". '  '; - $endform.=&mt('(Next and Previous (student) do not save the scores.)')."\n" ; + $endform.=''. + &mt('(Next and Previous (student) do not save the scores.)'). + ''."\n" ; $endform.=""; $endform.='
'; - $endform.=&show_grading_menu_form($symb); $request->print($endform); } return ''; @@ -2430,7 +2388,7 @@ sub check_collaborators { #--- Retrieve the last submission for all the parts sub get_last_submission { my ($returnhash)=@_; - my (@string,$timestamp); + my (@string,$timestamp,%lasthidden); if ($$returnhash{'version'}) { my %lasthash=(); my ($version); @@ -2442,13 +2400,39 @@ sub get_last_submission { &Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'}); } } + 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')) { + my ($ign,@parts) = split(/\./,$key); + pop(@parts); + unless ($showsurv) { + my $id = join(',',@parts); + $typeparts{$ign.'.'.$id} = $lasthash{$key}; + } + delete($lasthash{$key}); + } + } + } + my @hidden = keys(%typeparts); foreach my $key (keys(%lasthash)) { next if ($key !~ /\.submission$/); - + my $hide; + if (@hidden) { + foreach my $id (@hidden) { + if ($key =~ /^\Q$id\E/) { + $hide = 1; + last; + } + } + } my ($partid,$foo) = split(/submission$/,$key); my $draft = $lasthash{$partid.'awarddetail'} eq 'DRAFT' ? 'Draft Copy ' : ''; - push(@string, join(':', $key, $draft.$lasthash{$key})); + push(@string, join(':', $key, $hide, $draft.$lasthash{$key})); } } if (!@string) { @@ -2473,8 +2457,7 @@ sub keywords_highlight { #--- Called from submission routine sub processHandGrade { - my ($request) = shift; - my $symb = &get_symb($request); + my ($request,$symb) = @_; my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); my $button = $env{'form.gradeOpt'}; my $ngrade = $env{'form.NCT'}; @@ -2514,7 +2497,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, @@ -2542,7 +2525,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); @@ -2615,7 +2598,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}; @@ -2642,6 +2625,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); } @@ -2652,6 +2636,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); @@ -2711,7 +2696,6 @@ sub processHandGrade { my $the_end = '

'.&mt('LON-CAPA User Message').'


'."\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); } return ''; @@ -3109,8 +3093,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 } #--- show scores for a section or whole class w/ option to change/update a score sub viewgrades { - my ($request) = shift; + my ($request,$symb) = @_; &viewgrades_js($request); - my ($symb) = &get_symb($request); #need to make sure we have the correct data for later EXT calls, #thus invalidate the cache &Apache::lonnet::devalidatecourseresdata( @@ -3289,7 +3270,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); @@ -3300,9 +3280,7 @@ sub viewgrades { ''."\n". ''."\n". &build_section_inputs(). - ''."\n". ''."\n". - ''."\n"; my ($common_header,$specific_header); if ($env{'form.section'} eq 'all') { @@ -3448,7 +3426,6 @@ sub viewgrades { $section_display, $stu_status). ''; } - $result.=&show_grading_menu_form($symb); return $result; } @@ -3520,12 +3497,10 @@ sub viewstudentgrade { #--- change scores for all the students in a section/class # record does not get update if unchanged sub editgrades { - my ($request) = @_; + my ($request,$symb) = @_; - 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(). @@ -3537,6 +3512,7 @@ sub editgrades { 'incorrect'=>'incorrect_by_override', 'excused' =>'excused', 'ungraded' =>'ungraded_attempted', + 'credited' =>'credit_attempted', 'nothing' => '', ); my ($classlist,undef,$fullname) = &getclasslist($env{'form.section'},'0'); @@ -3732,8 +3708,7 @@ sub editgrades { &Apache::loncommon::end_data_table_row(); } } - $result .= &Apache::loncommon::end_data_table(). - &show_grading_menu_form($symb); + $result .= &Apache::loncommon::end_data_table(); my $msg = '

'. &mt('Number of records updated = [_1] for [quant,_2,student].', $rec_update,$count).'
'. @@ -3846,7 +3821,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); @@ -3869,14 +3844,10 @@ to this page if the data selected is ins - -


- ENDPICK + $request->print(&Apache::lonhtmlcommon::scripttag($javascript)); return ''; } @@ -3921,8 +3892,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; } sub upcsvScores_form { - my ($request) = shift; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; 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.'). @@ -3956,8 +3921,6 @@ sub upcsvScores_form {
- - $upfile_select
@@ -3967,14 +3930,12 @@ ENDUPFORM &mt("How do I create a CSV file from a spreadsheet")) .'
'."\n"; $result.='


'."\n"; - $result.=&show_grading_menu_form($symb); return $result; } sub csvuploadmap { - my ($request)= @_; - my ($symb)=&get_symb($request); + my ($request,$symb)= @_; if (!$symb) {return '';} my $datatoken; @@ -4015,14 +3976,12 @@ sub csvuploadmap { } } &csvuploadmap_footer($request,$i,$keyfields); - $request->print(&show_grading_menu_form($symb)); return ''; } sub csvuploadoptions { - my ($request)= @_; - my ($symb)=&get_symb($request); + my ($request,$symb)= @_; my $checked=(($env{'form.noFirstLine'})?'1':'0'); my $ignore=&mt('Ignore First Line'); $request->print(<print('

'."\n"); - $request->print(&show_grading_menu_form($symb)); return ''; } @@ -4082,8 +4040,7 @@ sub get_fields { } sub csvuploadassign { - my ($request)= @_; - my ($symb)=&get_symb($request); + my ($request,$symb)= @_; if (!$symb) {return '';} my $error_msg = ''; &Apache::loncommon::load_tmp_file($request); @@ -4190,7 +4147,6 @@ sub csvuploadassign { $request->print(join(', ',@notallowed)); } $request->print("
\n"); - $request->print(&show_grading_menu_form($symb)); return $error_msg; } #------------- end of section for handling csv file upload --------- @@ -4201,11 +4157,10 @@ sub csvuploadassign { # #--- Select a page/sequence and a student to grade sub pickStudentPage { - my ($request) = shift; + my ($request,$symb) = @_; my $alertmsg = &mt('Please select the student you wish to grade.'); - $request->print(< + $request->print(&Apache::lonhtmlcommon::scripttag(< LISTJAVASCRIPT &commonJSfunctions($request); - my ($symb) = &get_symb($request); + 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'}; @@ -4276,8 +4230,7 @@ LISTJAVASCRIPT my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); $result.=''."\n". ''."\n". - ''."\n". - ''."
\n"; + ''."
\n"; $result.=' '.&mt('Use CODE').':
'."\n"; @@ -4323,7 +4276,6 @@ LISTJAVASCRIPT $studentTable.=''."\n"; - $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); return ''; @@ -4360,9 +4312,7 @@ sub getSymbMap { # #--- Displays a page/sequence w/wo problems, w/wo submissions sub displayPage { - my ($request) = shift; - - my ($symb) = &get_symb($request); + my ($request,$symb) = @_; 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'}; @@ -4380,7 +4330,6 @@ sub displayPage { if (!&canview($usec)) { $request->print(''.&mt('Unable to view requested student. ([_1])',$env{'form.student'}).''); - $request->print(&show_grading_menu_form($symb)); return; } my $result='

 '.$env{'form.title'}.'

'; @@ -4398,14 +4347,12 @@ sub displayPage { my $navmap = Apache::lonnavmaps::navmap->new(); unless (ref($navmap)) { $request->print(&navmap_errormsg()); - $request->print(&show_grading_menu_form($symb)); return; } my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'}); my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps if (!$map) { $request->print(''.&mt('Unable to view requested sequence. ([_1])',$resUrl).''); - $request->print(&show_grading_menu_form($symb)); return; } my $iterator = $navmap->getIterator($map->map_start(), @@ -4418,8 +4365,7 @@ sub displayPage { ''."\n". ''."\n". ''."\n". - ''."\n". - ''."\n"; + ''."\n"; if (defined($env{'form.CODE'})) { $studentTable.= @@ -4428,7 +4374,9 @@ sub displayPage { my $checkIcon = ''.&mt('Check Mark').
 	''; - $studentTable.=' '.&mt('Note: Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon)."\n". + $studentTable.=' '. + &mt('Problems graded correct by the computer are marked with a [_1] symbol.',$checkIcon). + ''."\n". &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(). ' Prob. '. @@ -4519,7 +4467,6 @@ sub displayPage { ''. ''."\n"; - $studentTable.=&show_grading_menu_form($symb); $request->print($studentTable); return ''; @@ -4564,16 +4511,20 @@ sub displaySubByDates { my @versionKeys = split(/\:/,$$record{$version.':keys'}); my @displaySub = (); foreach my $partid (@{$parts}) { + my $hidden; + if (($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurvey') || + ($$record{$version.':resource.'.$partid.'.type'} eq 'anonsurveycred')) { + $hidden = 1; + } my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys) : sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys)); - # next if ($$record{"$version:resource.$partid.solved"} eq ''); my $display_part=&get_display_part($partid,$symb); foreach my $matchKey (@matchKey) { if (exists($$record{$version.':'.$matchKey}) && $$record{$version.':'.$matchKey} ne '') { - + my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/) : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/)); $displaySub[0].='' .' '; - if ($$record{"$where.$partid.tries"} eq '') { - $displaySub[0].=&mt('Trial not counted'); - } else { - $displaySub[0].=&mt('Trial: [_1]', + if ($hidden) { + $displaySub[0].= &mt('Anonymous Survey').''; + } else { + if ($$record{"$where.$partid.tries"} eq '') { + $displaySub[0].=&mt('Trial not counted'); + } else { + $displaySub[0].=&mt('Trial: [_1]', $$record{"$where.$partid.tries"}); - } - my $responseType=($isTask ? 'Task' + } + my $responseType=($isTask ? 'Task' : $responseType->{$partid}->{$responseId}); - if (!exists($orders{$partid})) { $orders{$partid}={}; } - if (!exists($orders{$partid}->{$responseId})) { - $orders{$partid}->{$responseId}= - &get_order($partid,$responseId,$symb,$uname,$udom, - $no_increment); - } - $displaySub[0].=''; # /nobreak - $displaySub[0].='  '. - &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'
'; + if (!exists($orders{$partid})) { $orders{$partid}={}; } + if (!exists($orders{$partid}->{$responseId})) { + $orders{$partid}->{$responseId}= + &get_order($partid,$responseId,$symb,$uname,$udom, + $no_increment); + } + $displaySub[0].=''; # /nobreak + $displaySub[0].='  '. + &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom).'
'; + } } } if (exists($$record{"$where.$partid.checkedin"})) { @@ -4638,7 +4593,7 @@ sub displaySubByDates { } sub updateGradeByPage { - my ($request) = shift; + my ($request,$symb) = @_; my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; @@ -4649,7 +4604,6 @@ sub updateGradeByPage { my $usec=$classlist->{$env{'form.student'}}[5]; if (!&canmodify($usec)) { $request->print(''.&mt('Unable to modify requested student ([_1])',$env{'form.student'}).''); - $request->print(&show_grading_menu_form($env{'form.symb'})); return; } my $result='

 '.$env{'form.title'}.'

'; @@ -4668,8 +4622,6 @@ sub updateGradeByPage { my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps if (!$map) { $request->print(''.&mt('Unable to grade requested sequence ([_1]).',$resUrl).''); - my ($symb)=&get_symb($request); - $request->print(&show_grading_menu_form($symb)); return; } my $iterator = $navmap->getIterator($map->map_start(), @@ -4795,7 +4747,6 @@ sub updateGradeByPage { } $studentTable.=&Apache::loncommon::end_data_table(); - $studentTable.=&show_grading_menu_form($env{'form.symb'}); my $grademsg=($changeflag == 0 ? &mt('No score was changed or updated.') : &mt('The scores were changed for [quant,_1,problem].', $changeflag)); @@ -4873,9 +4824,7 @@ the homework problem. sub defaultFormData { my ($symb)=@_; - return ''."\n". - ''."\n". - ''."\n"; + return ''; } @@ -5161,8 +5110,7 @@ sub scantron_CODEunique { =cut sub scantron_selectphase { - my ($r,$file2grade) = @_; - my ($symb)=&get_symb($r); + my ($r,$file2grade,$symb) = @_; if (!$symb) {return '';} my $map_error; my $sequence_selector=&getSequenceDropDown($symb,\$map_error); @@ -5171,7 +5119,6 @@ sub scantron_selectphase { return; } my $default_form_data=&defaultFormData($symb); - my $grading_menu_button=&show_grading_menu_form($symb); my $file_selector=&scantron_uploads($file2grade); my $format_selector=&scantron_scantab(); my $CODE_selector=&scantron_CODElist(); @@ -5180,6 +5127,52 @@ sub scantron_selectphase { $ssi_error = 0; + if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || + &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { + + # Chunk of form to prompt for a scantron file upload. + + $r->print(' +
+ '.&Apache::loncommon::start_data_table('LC_scantron_action').' + '.&Apache::loncommon::start_data_table_header_row().' + +  '.&mt('Specify a bubblesheet data file to upload.').' + + '.&Apache::loncommon::end_data_table_header_row().' + '.&Apache::loncommon::start_data_table_row().' + +'); + my $default_form_data=&defaultFormData($symb); + my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; + $r->print(&Apache::lonhtmlcommon::scripttag(' + function checkUpload(formname) { + if (formname.upfile.value == "") { + alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); + return false; + } + formname.submit(); + }')); + $r->print(' +
+ '.$default_form_data.' + + + + '.&mt('File to upload: [_1]','').' +
+ +
+'); + + $r->print(' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::end_data_table().' +'); + } + # Chunk of form to prompt for a file to grade and how: $result.= ' @@ -5227,53 +5220,7 @@ sub scantron_selectphase { $r->print($result); - if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || - &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { - # Chunk of form to prompt for a scantron file upload. - - $r->print(' -
- '.&Apache::loncommon::start_data_table('LC_scantron_action').' - '.&Apache::loncommon::start_data_table_header_row().' - -  '.&mt('Specify a bubblesheet data file to upload.').' - - '.&Apache::loncommon::end_data_table_header_row().' - '.&Apache::loncommon::start_data_table_row().' - -'); - my $default_form_data=&defaultFormData(&get_symb($r,1)); - my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; - $r->print(' - - -
- '.$default_form_data.' - - - - '.&mt('File to upload: [_1]','').' -
- -
-'); - - $r->print(' - - '.&Apache::loncommon::end_data_table_row().' - '.&Apache::loncommon::end_data_table().' -'); - } # Chunk of the form that prompts to view a scoring office file, # corrected file, skipped records in a file. @@ -5333,7 +5280,6 @@ sub scantron_selectphase { &Apache::loncommon::end_data_table_row()."\n". &Apache::loncommon::end_data_table()."\n". '
'); - $r->print($grading_menu_button); return; } @@ -6233,8 +6179,7 @@ sub scantron_warning_screen { =cut sub scantron_do_warning { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} my $default_form_data=&defaultFormData($symb); $r->print(&scantron_form_start().$default_form_data); @@ -6259,7 +6204,7 @@ sub scantron_do_warning { '); } - $r->print("
".&show_grading_menu_form($symb)); + $r->print("
"); return ''; } @@ -6315,8 +6260,7 @@ SCANTRONFORM =cut sub scantron_validate_file { - my ($r) = @_; - my ($symb)=&get_symb($r); + my ($r,$symb) = @_; if (!$symb) {return '';} my $default_form_data=&defaultFormData($symb); @@ -6408,7 +6352,7 @@ sub scantron_validate_file { $r->print(" ".&mt("this scanline saving it for later.")); } } - $r->print("
".&show_grading_menu_form($symb)); + $r->print("
"); return ''; } @@ -6943,8 +6887,7 @@ sub scantron_get_correction { $r->print("\n
"); } - $r->print(< + $r->print(&Apache::lonhtmlcommon::scripttag(< ENDSCRIPT my $href="/adm/pickcode?". "form=".&escape("scantronupload"). @@ -7024,8 +6966,7 @@ sub verify_bubbles_checked { my (@ansnums) = @_; my $ansnumstr = join('","',@ansnums); my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines."); - my $output = (< + my $output = &Apache::lonhtmlcommon::scripttag((< ENDSCRIPT return $output; } @@ -7451,6 +7391,7 @@ 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); @@ -7591,10 +7532,9 @@ sub scantron_validate_missingbubbles { sub scantron_process_students { - my ($r) = @_; + my ($r,$symb) = @_; my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($env{'form.selectpage'}); - my ($symb)=&get_symb($r); if (!$symb) { return ''; } @@ -7675,7 +7615,6 @@ SCANTRONFORM if ($ssi_error) { $r->print(""); &ssi_print_error($r); - $r->print(&show_grading_menu_form($symb)); &Apache::lonnet::remove_lock($lock); return ''; # Dunno why the other returns return '' rather than just returning. } @@ -7753,7 +7692,6 @@ SCANTRONFORM $ssi_error = 0; # So end of handler error message does not trigger. $r->print(""); &ssi_print_error($r); - $r->print(&show_grading_menu_form($symb)); &Apache::lonnet::remove_lock($lock); return ''; # Why return ''? Beats me. } @@ -7781,7 +7719,6 @@ SCANTRONFORM $ssi_error = 0; # So end of handler error message does not trigger. $r->print(""); &ssi_print_error($r); - $r->print(&show_grading_menu_form($symb)); &Apache::lonnet::remove_lock($lock); delete($completedstudents{$uname}); return ''; @@ -7837,7 +7774,6 @@ SCANTRONFORM # $r->print("

took $lasttime

"); $r->print(""); - $r->print(&show_grading_menu_form($symb)); return ''; } @@ -7894,7 +7830,7 @@ sub grade_student_bubbles { } sub scantron_upload_scantron_data { - my ($r)=@_; + my ($r,$symb)=@_; my $dom = $env{'request.role.domain'}; my $domdesc = &Apache::lonnet::domain($dom,'description'); $r->print(&Apache::loncommon::coursebrowser_javascript($dom)); @@ -7903,11 +7839,10 @@ sub scantron_upload_scantron_data { 'coursename',$dom); my $syllabuslink = ''.&mt('Syllabus').''. (' 'x2).&mt('(shows course personnel)'); - my $default_form_data=&defaultFormData(&get_symb($r,1)); + my $default_form_data=&defaultFormData($symb); 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(' - - +')); + $r->print('

'.&mt('Send scanned bubblesheet data to a course').'

@@ -7964,8 +7899,7 @@ sub scantron_upload_scantron_data { sub scantron_upload_scantron_data_save { - my($r)=@_; - my ($symb)=&get_symb($r,1); + my($r,$symb)=@_; my $doanotherupload= '
'."\n". ''."\n". @@ -7975,9 +7909,7 @@ sub scantron_upload_scantron_data_save { !&Apache::lonnet::allowed('usc', $env{'form.domainid'}.'_'.$env{'form.courseid'})) { $r->print(&mt("You are not allowed to upload bubblesheet data to the requested course.")."
"); - if ($symb) { - $r->print(&show_grading_menu_form($symb)); - } else { + unless ($symb) { $r->print($doanotherupload); } return ''; @@ -8005,7 +7937,7 @@ sub scantron_upload_scantron_data_save { } } if ($symb) { - $r->print(&scantron_selectphase($r,$uploadedfile)); + $r->print(&scantron_selectphase($r,$uploadedfile,$symb)); } else { $r->print($doanotherupload); } @@ -8107,8 +8039,8 @@ sub valid_file { } sub scantron_download_scantron_data { - my ($r)=@_; - my $default_form_data=&defaultFormData(&get_symb($r,1)); + my ($r,$symb)=@_; + my $default_form_data=&defaultFormData($symb); my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my $file=$env{'form.scantron_selectfile'}; @@ -8118,7 +8050,6 @@ sub scantron_download_scantron_data { '.&mt('The requested file name was invalid.').'

'); - $r->print(&show_grading_menu_form(&get_symb($r,1))); return; } my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file; @@ -8141,15 +8072,12 @@ sub scantron_download_scantron_data { '','').'

'); - $r->print(&show_grading_menu_form(&get_symb($r,1))); return ''; } sub checkscantron_results { - my ($r) = @_; - my ($symb)=&get_symb($r); + my ($r,$symb) = @_; if (!$symb) {return '';} - my $grading_menu_button=&show_grading_menu_form($symb); my $cid = $env{'request.course.id'}; my %lettdig = &letter_to_digits(); my $numletts = scalar(keys(%lettdig)); @@ -8302,7 +8230,7 @@ sub checkscantron_results { &Apache::loncommon::end_data_table()).'
'. &mt('Differences can occur if submissions were modified using manual grading after a bubblesheet grading pass.').'
'.&mt('If unexpected discrepancies were detected, it is recommended that you inspect the original bubblesheets.'); } - $r->print('

'.$grading_menu_button); + $r->print('
'); return; } @@ -8444,48 +8372,33 @@ sub letter_to_digits { #-------------------------- Menu interface ------------------------- # -#--- Show a Grading Menu button - Calls the next routine --- -sub show_grading_menu_form { - my ($symb)=@_; - my $result.='
'."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - '
'."\n"; - return $result; -} +#--- Href with symb and command --- -# -- 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 href_symb_cmd { + my ($symb,$cmd)=@_; + return '/adm/grades?symb='.&HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb),'<>&"').'&command='.$cmd; } sub grading_menu { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; 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); @@ -8494,15 +8407,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 page/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', @@ -8520,166 +8458,123 @@ sub grading_menu { permission => 'F', icon => 'stat.png', linktitle => 'Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.' - } + }, + { linktext => 'Verify Receipt Number', + 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,$symb) = @_; + if (!$symb) {return '';} &commonJSfunctions($request); - return $Str; + my $result; + + $result.='
'."\n". + ''."\n". + ''."\n". + ''."\n"; + + $result.=' +

+ '.&mt('Grade page/folder for one student').' +

'. + &selectfield(0). + ' +
+ +
+
+ '; + return $result; +} + +sub submit_options_table { + my ($request,$symb) = @_; + if (!$symb) {return '';} + &commonJSfunctions($request); + my $result; + + $result.='
'."\n". + ''."\n". + ''."\n". + ''."\n"; + + $result.=' +

+ '.&mt('Grading table').' +

'. + &selectfield(0). + ' +
+ +
+
+ '; + return $result; } + #--- Displays the submissions first page ------- sub submit_options { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; 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.=''."\n"; - } - } $result.='
'."\n". ''."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". ''."\n". ''."\n"; $result.='

- '.&mt('Grade Current Resource').' -

-
- '.$table.' -
+ '.&mt('Select individual students to grade').' +'.&selectfield(1).' + + +
+
+ + + '; + return $result; +} -
+sub selectfield { + my ($full)=@_; + my $result='
'.&mt('Sections').' -   '; - $result.=' + '.&Apache::lonstatistics::SectionSelect('section','multiple',5).'
@@ -8693,63 +8588,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('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; } @@ -8837,18 +8694,14 @@ sub clicker_grading_parameters { } sub process_clicker { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; 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.='
'."\n"; $result.=' '.&mt('Specify a file containing the clicker information for this resource.'). '
'."\n"; + $result.='
'."\n"; # Attempt to restore parameters from last session, set defaults if not present my %Saveable_Parameters=&clicker_grading_parameters(); &Apache::loncommon::restore_course_settings('grades_clicker', @@ -8878,8 +8731,7 @@ sub process_clicker { ('iclicker' => 'i>clicker', 'interwrite' => 'interwrite PRS')); $symb = &Apache::lonenc::check_encrypt($symb); - $result.=< + $result.= &Apache::lonhtmlcommon::scripttag(< +ENDUPFORM + $result.= < - -

@@ -8936,31 +8787,28 @@ function sanitycheck() {


- +' ENDUPFORM $result.='
'."\n". '


'."\n"; - $result.=&show_grading_menu_form($symb); return $result; } sub process_clicker_file { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} 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); + return $result; } if (($env{'form.gradingmechanism'} eq 'given') && ($env{'form.givenanswer'}!~/\S/)) { $result.=''.&mt('You need to specify the correct answer').''; - return $result.&show_grading_menu_form($symb); + return $result; } my $foundgiven=0; if ($env{'form.gradingmechanism'} eq 'given') { @@ -9007,7 +8855,7 @@ sub process_clicker_file { $result.="

\n"; if ($number==0) { $result.=''.&mt('No IDs found to determine correct answer').''; - return $result.&show_grading_menu_form($symb); + return $result; } } if (length($env{'form.upfile'}) < 2) { @@ -9015,7 +8863,7 @@ sub process_clicker_file { '', '', ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''); - return $result.&show_grading_menu_form($symb); + return $result; } # Were able to get all the info needed, now analyze the file @@ -9030,8 +8878,6 @@ sub process_clicker_file {
- - @@ -9056,7 +8902,7 @@ ENDHEADER '
'; if (($env{'form.gradingmechanism'} eq 'given') && ($number!=$foundgiven)) { $result.=''.&mt('Number of given answers does not agree with number of questions in file.').''; - return $result.&show_grading_menu_form($symb); + return $result; } # Remember Question Titles # FIXME: Possibly need delimiter other than ":" @@ -9118,7 +8964,7 @@ ENDHEADER } $result.='
'."\n". '

'."\n"; - return $result.&show_grading_menu_form($symb); + return $result; } sub iclicker_eval { @@ -9180,8 +9026,7 @@ sub interwrite_eval { } sub assign_clicker_grades { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} # See which part we are saving to my $res_error; @@ -9192,7 +9037,7 @@ 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'}); + my $result=''; my $heading=&mt('Assigning grades based on clicker file'); $result.=(<'."\n". '

'."\n"; - return $result.&show_grading_menu_form($symb); + return $result; } sub navmap_errormsg { return '
'. &mt('An error occurred retrieving information about resources in the course.').'
'. - &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page..','',''). + &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page.','',''). '
'; } +sub startpage { + my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag) = @_; + unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"}); + $r->print(&Apache::loncommon::start_page('Grading',undef, + {'bread_crumbs' => $crumbs})); + unless ($nodisplayflag) { + $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag)); + } +} + sub handler { my $request=$_[0]; &reset_caches(); @@ -9310,7 +9165,9 @@ sub handler { $request->send_http_header; return '' if $request->header_only; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); - my $symb=&get_symb($request,1); + +# see what command we need to execute + my @commands=&Apache::loncommon::get_env_multiple('form.command'); my $command=$commands[0]; @@ -9318,107 +9175,147 @@ sub handler { &Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); } +# see what the symb is + + my $symb=$env{'form.symb'}; + unless ($symb) { + (my $url=$env{'form.url'}) =~ s-^https*://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + $symb=&Apache::lonnet::symbread($url); + } + &Apache::lonenc::check_decrypt(\$symb); + $ssi_error = 0; - my $brcrum = [{href=>"/adm/grades",text=>"Grading"}]; - $request->print(&Apache::loncommon::start_page('Grading',undef, - {'bread_crumbs' => $brcrum})); if ($symb eq '' && $command eq '') { - if ($env{'user.adv'}) { - 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()); - } - } +# +# Not called from a resource +# + } else { &init_perm(); if ($command eq 'submission' && $perm{'vgr'}) { - ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); + &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}]); + ($env{'form.student'} eq '' ? &listStudents($request,$symb) : &submission($request,0,0,$symb)); } elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { - &pickStudentPage($request); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, + {href=>'',text=>'Select student'}],1,1); + &pickStudentPage($request,$symb); } elsif ($command eq 'displayPage' && $perm{'vgr'}) { - &displayPage($request); + &startpage($request,$symb, + [{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, + {href=>'',text=>'Select student'}, + {href=>'',text=>'Grade student'}],1,1); + &displayPage($request,$symb); } elsif ($command eq 'gradeByPage' && $perm{'mgr'}) { - &updateGradeByPage($request); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'}, + {href=>'',text=>'Select student'}, + {href=>'',text=>'Grade student'}, + {href=>'',text=>'Store grades'}],1,1); + &updateGradeByPage($request,$symb); } elsif ($command eq 'processGroup' && $perm{'vgr'}) { - &processGroup($request); + &startpage($request,$symb); + &processGroup($request,$symb); } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { - $request->print(&grading_menu($request)); - } elsif ($command eq 'submit_options' && $perm{'vgr'}) { - $request->print(&submit_options($request)); + &startpage($request,$symb); + $request->print(&grading_menu($request,$symb)); + } elsif ($command eq 'individual' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>'',text=>'Select individual students to grade'}]); + $request->print(&submit_options($request,$symb)); + } elsif ($command eq 'ungraded' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>'',text=>'Grade ungraded submissions'}]); + $request->print(&listStudents($request,$symb,'graded')); + } elsif ($command eq 'table' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>"", text=>"Grading table"}]); + $request->print(&submit_options_table($request,$symb)); + } elsif ($command eq 'all_for_one' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>'',text=>'Grade page/folder for one student'}],1,1); + $request->print(&submit_options_sequence($request,$symb)); } elsif ($command eq 'viewgrades' && $perm{'vgr'}) { - $request->print(&viewgrades($request)); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"},{href=>'', text=>"Modify grades"}]); + $request->print(&viewgrades($request,$symb)); } elsif ($command eq 'handgrade' && $perm{'mgr'}) { - $request->print(&processHandGrade($request)); + &startpage($request,$symb); + $request->print(&processHandGrade($request,$symb)); } elsif ($command eq 'editgrades' && $perm{'mgr'}) { - $request->print(&editgrades($request)); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"table"), text=>"Grading table"}, + {href=>&href_symb_cmd($symb,'viewgrades').'&group=all§ion=all&Status=Active', + text=>"Modify grades"}, + {href=>'', text=>"Store grades"}]); + $request->print(&editgrades($request,$symb)); + } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) { + &startpage($request,$symb,[{href=>'',text=>'Verify Receipt Number'}]); + $request->print(&initialverifyreceipt($request,$symb)); } elsif ($command eq 'verify' && $perm{'vgr'}) { - $request->print(&verifyreceipt($request)); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,"initialverifyreceipt"),text=>'Verify Receipt Number'}, + {href=>'',text=>'Verification Result'}]); + $request->print(&verifyreceipt($request,$symb)); } elsif ($command eq 'processclicker' && $perm{'mgr'}) { - $request->print(&process_clicker($request)); + &startpage($request,$symb,[{href=>'', text=>'Process clicker'}]); + $request->print(&process_clicker($request,$symb)); } elsif ($command eq 'processclickerfile' && $perm{'mgr'}) { - $request->print(&process_clicker_file($request)); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'}, + {href=>'', text=>'Process clicker file'}]); + $request->print(&process_clicker_file($request,$symb)); } elsif ($command eq 'assignclickergrades' && $perm{'mgr'}) { - $request->print(&assign_clicker_grades($request)); + &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'processclicker'), text=>'Process clicker'}, + {href=>'', text=>'Process clicker file'}, + {href=>'', text=>'Store grades'}]); + $request->print(&assign_clicker_grades($request,$symb)); } elsif ($command eq 'csvform' && $perm{'mgr'}) { - $request->print(&upcsvScores_form($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&upcsvScores_form($request,$symb)); } elsif ($command eq 'csvupload' && $perm{'mgr'}) { - $request->print(&csvupload($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&csvupload($request,$symb)); } elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { - $request->print(&csvuploadmap($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&csvuploadmap($request,$symb)); } elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) { if ($env{'form.associate'} ne 'Reverse Association') { - $request->print(&csvuploadoptions($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&csvuploadoptions($request,$symb)); } else { if ( $env{'form.upfile_associate'} ne 'reverse' ) { $env{'form.upfile_associate'} = 'reverse'; } else { $env{'form.upfile_associate'} = 'forward'; } - $request->print(&csvuploadmap($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&csvuploadmap($request,$symb)); } } elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) { - $request->print(&csvuploadassign($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&csvuploadassign($request,$symb)); } elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { - $request->print(&scantron_selectphase($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_selectphase($request,undef,$symb)); } elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { - $request->print(&scantron_do_warning($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_do_warning($request,$symb)); } elsif ($command eq 'scantron_validate' && $perm{'mgr'}) { - $request->print(&scantron_validate_file($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_validate_file($request,$symb)); } elsif ($command eq 'scantron_process' && $perm{'mgr'}) { - $request->print(&scantron_process_students($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_process_students($request,$symb)); } elsif ($command eq 'scantronupload' && (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { - $request->print(&scantron_upload_scantron_data($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_upload_scantron_data($request,$symb)); } elsif ($command eq 'scantronupload_save' && (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { - $request->print(&scantron_upload_scantron_data_save($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_upload_scantron_data_save($request,$symb)); } elsif ($command eq 'scantron_download' && &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { - $request->print(&scantron_download_scantron_data($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&scantron_download_scantron_data($request,$symb)); } elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { - $request->print(&checkscantron_results($request)); + &startpage($request,$symb,[{href=>'', text=>'Grade/Manage/Review Bubblesheets'}],1,1); + $request->print(&checkscantron_results($request,$symb)); } elsif ($command) { + &startpage($request,$symb); $request->print('

'.&mt('Access Denied ([_1])',$command).'

'); } }