--- loncom/homework/grades.pm 2010/03/19 22:00:06 1.600 +++ loncom/homework/grades.pm 2010/04/01 00:58:43 1.604 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.600 2010/03/19 22:00:06 www Exp $ +# $Id: grades.pm,v 1.604 2010/04/01 00:58:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -214,55 +214,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(); @@ -776,6 +727,19 @@ sub most_similar { #------------------------------------ Receipt Verification Routines # + +sub initialverifyreceipt { + my $request = shift; + &commonJSfunctions($request); + my ($symb) = &get_symb($request); + return '
'. + &Apache::lonnet::recprefix($env{'request.course.id'}). + '-'. + ''."\n". + ''. + "
\n"; +} + #--- Check whether a receipt number is valid.--- sub verifyreceipt { my $request = shift; @@ -885,7 +849,6 @@ sub listStudents { .&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 ); @@ -1795,7 +1758,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(); @@ -8515,29 +8477,15 @@ 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); -# $request->print($table); my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), 'probTitle'=>$probTitle, 'command'=>'individual', - 'saveState'=>"", 'gradingMenu'=>1, 'showgrading'=>"yes"); @@ -8560,6 +8508,9 @@ 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=>'Hand Grading', items =>[ @@ -8608,70 +8559,27 @@ 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 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 .="
\n"; - my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box."); - $request->print(&Apache::lonhtmlcommon::scripttag(<'.$section.''."\n"; - } - } $result.='
'."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; $result.='

'.&mt('Grade complete page/sequence/folder for one student').' -

- -
- -
- - '.&mt('Sections').' - -   '; - $result.=' -
- -
- - '.&mt('Groups').' - - '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' -
- -
- - '.&mt('Access Status').' - - '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' -
- -
- -
- - +'. + &selectfield(0). + '
@@ -8760,64 +8622,18 @@ sub submit_options_table { if (!$symb) {return '';} &commonJSfunctions($request); 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"; $result.='

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

- -
- -
- - '.&mt('Sections').' - -   '; - $result.=' -
- -
- - '.&mt('Groups').' - - '.&Apache::lonstatistics::GroupSelect('group','multiple',5).' -
- -
- - '.&mt('Access Status').' - - '.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,5,undef,'mult').' -
- -
- -
- - +'. + &selectfield(0). + '
@@ -8838,44 +8654,37 @@ sub submit_options { &commonJSfunctions($request); 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"; $result.='

'.&mt('Select individual students to grade').' -

+'.&selectfield(1).' + + + + + + +
'; + $result .= &show_grading_menu_form($symb); + return $result; +} -
+sub selectfield { + my ($full)=@_; + my $result='
'.&mt('Sections').' -   '; - $result.=' + '.&Apache::lonstatistics::SectionSelect('section','multiple',5).'
@@ -8889,33 +8698,25 @@ sub submit_options { '.&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').' - - -
- -
- -
- - -
- - - - '; - $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; } @@ -9008,13 +8809,11 @@ sub process_clicker { 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', @@ -9490,31 +9289,10 @@ sub handler { $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'}) { @@ -9543,6 +9321,8 @@ sub handler { $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'}) { 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.