version 1.66, 2011/02/07 19:16:34
|
version 1.67, 2011/02/20 20:57:46
|
Line 173 sub getData {
|
Line 173 sub getData {
|
|
|
my ($showPoints,$uname,$udom)=@_; |
my ($showPoints,$uname,$udom)=@_; |
|
|
&Apache::lonnet::logthis("About to call with $uname $udom"); |
|
|
|
# Create the nav map |
# Create the nav map |
my $navmap = Apache::lonnavmaps::navmap->new($uname,$udom); |
my $navmap = Apache::lonnavmaps::navmap->new($uname,$udom); |
|
|
Line 431 sub outputCategories {
|
Line 429 sub outputCategories {
|
# Process the changes |
# Process the changes |
%categories=&process_category_edits($r,$cangrade,%categories); |
%categories=&process_category_edits($r,$cangrade,%categories); |
# Actually store |
# Actually store |
|
# &Apache::lonnet::logthis("Storing ".$categories{'order'}); |
&Apache::lonnet::put('grading_categories',\%categories,$cdom,$cnum); |
&Apache::lonnet::put('grading_categories',\%categories,$cdom,$cnum); |
} |
} |
# new categories loaded now |
# new categories loaded now |
Line 454 sub outputCategories {
|
Line 453 sub outputCategories {
|
sub process_category_edits { |
sub process_category_edits { |
my ($r,$cangrade,%categories)=@_; |
my ($r,$cangrade,%categories)=@_; |
unless ($cangrade) { return %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 |
# Business logic here |
# |
# |
Line 467 sub process_category_edits {
|
Line 470 sub process_category_edits {
|
sub output_category_table { |
sub output_category_table { |
my ($r,$cangrade,$navmaps,%categories)=@_; |
my ($r,$cangrade,$navmaps,%categories)=@_; |
my $sum=0; |
my $sum=0; |
|
my $total=0; |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
# |
# |
&output_category_table_header($r,$cangrade); |
&output_category_table_header($r,$cangrade); |
# |
# |
my @order=split(/\,/,$categories{'order'}); |
my @order=split(/\,/,$categories{'order'}); |
# |
# |
# FIXME: Debug only |
|
@order=('3131_4123_42124','4124_34231_3412'); |
|
# |
|
my $maxpos=$#order; |
my $maxpos=$#order; |
for (my $i=0;$i<=$maxpos;$i++) { |
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,%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()); |
$r->print(&Apache::loncommon::end_data_table()); |
return $sum; |
return $sum; |
Line 551 ENDMOVE
|
Line 554 ENDMOVE
|
# |
# |
|
|
sub bottom_line_category { |
sub bottom_line_category { |
my ($r,$cangrade)=@_; |
my ($r,$cangrade,$sum,$total)=@_; |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
if ($cangrade) { |
|
$r->print('<td colspan="3"><a href="/adm/quickgrades?cmd=createnewcat&storechanges=1">'.&mt('Create New Category').'</a></td>'); |
|
} |
|
$r->print('<td colspan="5">'.&mt('Current:').$sum.'<br />'.&mt('Total:').$total.'<br /></td>'); |
} |
} |
|
|
# |
# |