--- loncom/homework/grades.pm 2010/03/15 07:54:04 1.598 +++ loncom/homework/grades.pm 2010/03/21 18:31:45 1.601 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.598 2010/03/15 07:54:04 www Exp $ +# $Id: grades.pm,v 1.601 2010/03/21 18:31:45 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -8515,18 +8515,6 @@ 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); @@ -8537,7 +8525,6 @@ sub grading_menu { my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), 'probTitle'=>$probTitle, 'command'=>'individual', - 'saveState'=>"", 'gradingMenu'=>1, 'showgrading'=>"yes"); @@ -8582,7 +8569,7 @@ sub grading_menu { icon => 'edit-find-replace.png', linktitle => 'Grade current resource for all students.' }, - { linktext => 'Grade complete page/sequence/folder for one student.', + { linktext => 'Grade complete page/sequence/folder for one student', url => $url1d, permission => 'F', icon => 'edit-find-replace.png', @@ -8623,7 +8610,6 @@ sub grading_menu { ''."\n". # ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -8675,27 +8661,68 @@ GRADINGMENUJS return $Str; } -sub individual { - my ($request)=@_; - &submit_options($request); -} sub ungraded { my ($request)=@_; &submit_options($request); } -sub table { - my ($request)=@_; - &submit_options($request); +sub submit_options_sequence { + my ($request) = @_; + my ($symb)=&get_symb($request); + if (!$symb) {return '';} + &commonJSfunctions($request); + my $result; + + $result.='
'."\n". + ''."\n". + ''."\n". + ''."\n"; + + $result.=' +

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

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

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

'. + &selectfield(0). + ' +
+ +
+ +
'; + $result .= &show_grading_menu_form($symb); + return $result; } + #--- Displays the submissions first page ------- sub submit_options { my ($request) = @_; @@ -8703,84 +8730,39 @@ sub submit_options { 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(&Apache::lonhtmlcommon::scripttag(<'.$section.''."\n"; - } - } $result.='
'."\n". ''."\n". -# ''."\n". ''."\n". - ''."\n". - ''."\n". ''."\n". ''."\n"; $result.='

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

+ '.&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).'
@@ -8794,63 +8776,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; } @@ -8943,13 +8887,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', @@ -9425,31 +9367,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'}) { @@ -9465,13 +9386,13 @@ sub handler { } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { $request->print(&grading_menu($request)); } elsif ($command eq 'individual' && $perm{'vgr'}) { - $request->print(&individual($request)); + $request->print(&submit_options($request)); } elsif ($command eq 'ungraded' && $perm{'vgr'}) { $request->print(&submit_options($request)); } elsif ($command eq 'table' && $perm{'vgr'}) { - $request->print(&submit_options($request)); + $request->print(&submit_options_table($request)); } elsif ($command eq 'all_for_one' && $perm{'vgr'}) { - $request->print(&submit_options($request)); + $request->print(&submit_options_sequence($request)); } elsif ($command eq 'viewgrades' && $perm{'vgr'}) { $request->print(&viewgrades($request)); } elsif ($command eq 'handgrade' && $perm{'mgr'}) {