--- loncom/interface/lonquickgrades.pm 2011/03/26 22:37:47 1.82 +++ loncom/interface/lonquickgrades.pm 2011/05/22 21:53:52 1.88 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Quick Student Grades Display # -# $Id: lonquickgrades.pm,v 1.82 2011/03/26 22:37:47 www Exp $ +# $Id: lonquickgrades.pm,v 1.88 2011/05/22 21:53:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,7 +62,8 @@ sub real_handler { $r->send_http_header; my $showPoints = - $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard'; + (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard') + || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories')); my $notshowSPRSlink = (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external') || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals')); @@ -266,8 +267,12 @@ sub getData { $totalRight += $score; $partsCount += $curRes->weight($part); + $curRes->{DATA}->{PROB_SCORE} += $score; + $curRes->{DATA}->{PROB_WEIGHT} += $curRes->weight($part); + if ($curRes->opendate($part) < $now) { $totalPossible += $curRes->weight($part); + $curRes->{DATA}->{PROB_POSSIBLE} += $curRes->weight($part); } $totalParts += $curRes->weight($part); } else { @@ -459,8 +464,10 @@ sub outputCategories { &output_category_table($r,$cangrade,$navmap,%categories); # if ($cangrade) { - $r->print(''. + $r->print(&Apache::loncommon::resourcebrowser_javascript(). + ''. ''. + ''. ''. ''); } @@ -470,7 +477,7 @@ sub outputCategories { # my %data=&dumpdata($navmap); # foreach (keys(%data)) { # $r->print("\n
".$_.'='.$data{$_}); -# } +# } } # @@ -491,8 +498,12 @@ sub dumpdata { while ($depth > 0) { if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} if ($curRes == $iterator->END_MAP()) { $depth--; } - if (ref($curRes) && $curRes->is_map()) { - $returndata{$curRes->symb()}=$curRes->{DATA}->{CHILD_PARTS}.':'.$curRes->{DATA}->{CHILD_ATTEMPTED}.':'.$curRes->{DATA}->{CHILD_CORRECT}; + if (ref($curRes)) { + if ($curRes->is_map()) { + $returndata{$curRes->symb()}='folder:'.$curRes->{DATA}->{CHILD_PARTS}.':'.$curRes->{DATA}->{CHILD_ATTEMPTED}.':'.$curRes->{DATA}->{CHILD_CORRECT}; + } else { + $returndata{$curRes->symb()}='res:'.$curRes->{DATA}->{PROB_WEIGHT}.':'.$curRes->{DATA}->{PROB_POSSIBLE}.':'.$curRes->{DATA}->{PROB_SCORE}; + } } $curRes = $iterator->next(); } @@ -528,7 +539,7 @@ sub process_category_edits { } elsif ($cmd=~/^delcat\_(.+)$/) { %categories=&del_category($1,$cangrade,%categories); } elsif ($cmd=~/^addcont\_(.+)$/) { - %categories=&add_category_content($1,$cangrade,$env{'form.addcont_'.$1.'_symb'},%categories); + %categories=&add_category_content($1,$cangrade,$env{'form.resourcesymb'},%categories); } elsif ($cmd=~/^delcont\_(.+)\_\_\_\_\_\_(.+)$/) { %categories=&del_category_content($1,$cangrade,$2,%categories); } elsif ($cmd=~/^newrule\_(.+)$/) { @@ -558,9 +569,10 @@ sub output_category_table { # my @order=split(/\,/,$categories{'order'}); # + my %performance=&dumpdata($navmaps); 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); + my ($value,$weight)=&output_and_calc_category($r,$cangrade,$navmaps,$order[$i],$i,$maxpos,\%performance,%categories); $sum+=$value*$weight; $total+=$weight; } @@ -592,7 +604,7 @@ sub output_category_table_header { # sub output_and_calc_category { - my ($r,$cangrade,$navmaps,$id,$currentpos,$maxpos,%categories)=@_; + my ($r,$cangrade,$navmaps,$id,$currentpos,$maxpos,$performance,%categories)=@_; my $value=0; my $weight=0; my $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/"); @@ -635,7 +647,7 @@ ENDMOVE $r->print(''); if ($cangrade) { - $r->print('
'.&mt('Add Problem or Folder').'
'. - &Apache::lonstathelpers::problem_selector('.',undef,1,1,'addcont_'.$id.'_',1,'this.form.cmd.value="addcont_'.$id.'";this.form.submit();')); + $r->print('
'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'
'); } $r->print(''); @@ -834,6 +845,7 @@ sub set_category_rules { sub add_category_content { my ($id,$cangrade,$newcontent,%categories)=@_; unless ($cangrade) { return %categories; } + &Apache::lonnet::logthis("In here $newcontent"); my %newcontent=($newcontent => 1); foreach my $current (split(/\,/,$categories{$id.'_content'})) { $newcontent{$current}=1;