--- loncom/interface/lonquickgrades.pm 2011/02/07 19:16:34 1.66 +++ loncom/interface/lonquickgrades.pm 2011/02/20 20:57:46 1.67 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Quick Student Grades Display # -# $Id: lonquickgrades.pm,v 1.66 2011/02/07 19:16:34 www Exp $ +# $Id: lonquickgrades.pm,v 1.67 2011/02/20 20:57:46 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -173,8 +173,6 @@ sub getData { my ($showPoints,$uname,$udom)=@_; - &Apache::lonnet::logthis("About to call with $uname $udom"); - # Create the nav map my $navmap = Apache::lonnavmaps::navmap->new($uname,$udom); @@ -431,6 +429,7 @@ sub outputCategories { # Process the changes %categories=&process_category_edits($r,$cangrade,%categories); # Actually store +# &Apache::lonnet::logthis("Storing ".$categories{'order'}); &Apache::lonnet::put('grading_categories',\%categories,$cdom,$cnum); } # new categories loaded now @@ -454,6 +453,10 @@ sub outputCategories { sub process_category_edits { my ($r,$cangrade,%categories)=@_; unless ($cangrade) { return %categories; } + my $cmd=$env{'form.cmd'}; + if ($cmd eq 'createnewcat') { + %categories=&make_new_category($r,$cangrade,undef,%categories); + } # # Business logic here # @@ -467,21 +470,21 @@ sub process_category_edits { sub output_category_table { my ($r,$cangrade,$navmaps,%categories)=@_; my $sum=0; + my $total=0; $r->print(&Apache::loncommon::start_data_table()); # &output_category_table_header($r,$cangrade); # my @order=split(/\,/,$categories{'order'}); # -# FIXME: Debug only - @order=('3131_4123_42124','4124_34231_3412'); -# my $maxpos=$#order; for (my $i=0;$i<=$maxpos;$i++) { my ($value,$weight)=&output_and_calc_category($r,$cangrade,$navmaps,$order[$i],$i,$maxpos,%categories); + $sum+=$value*$weight; + $total+=$weight; } # - &bottom_line_category($r,$cangrade); + &bottom_line_category($r,$cangrade,$sum,$total); # $r->print(&Apache::loncommon::end_data_table()); return $sum; @@ -551,7 +554,12 @@ ENDMOVE # sub bottom_line_category { - my ($r,$cangrade)=@_; + my ($r,$cangrade,$sum,$total)=@_; + $r->print(&Apache::loncommon::start_data_table_row()); + if ($cangrade) { + $r->print(''.&mt('Create New Category').''); + } + $r->print(''.&mt('Current:').$sum.'
'.&mt('Total:').$total.'
'); } #