[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 29 Aug 2005 10:06:54 -0000
foxr Mon Aug 29 06:06:54 2005 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Use code enumeration in grades.pm
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.388 loncom/interface/lonprintout.pm:1.389
--- loncom/interface/lonprintout.pm:1.388 Mon Aug 22 18:21:48 2005
+++ loncom/interface/lonprintout.pm Mon Aug 29 06:06:52 2005
@@ -1,7 +1,7 @@
-# The LearningOnline Network
+# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.388 2005/08/22 22:21:48 foxr Exp $
+# $Id: lonprintout.pm,v 1.389 2005/08/29 10:06:52 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1386,11 +1386,8 @@
$code_type=$result{"type\0$old_name"};
@allcodes=split(',',$result{$old_name});
$num_todo=scalar(@allcodes);
- } elsif ($selected_code) {
+ } elsif ($selected_code) { # Selection value is always numeric.
$num_todo = 1;
- my ($alpha, $numeric) = split(/:/, $selected_code);
- $selected_code = $numeric; # Always use numeric, converted if need be.
- $selected_code =~ s/\s+//g;
@allcodes = ($selected_code);
} elsif ($single_code) {
@@ -2096,20 +2093,26 @@
if ($name =~ /^type\0/) { next; }
$namechoice.='<choice computer="'.$name.'">'.$name.'</choice>';
}
+
+
my %all_codes = &Apache::lonnet::get('CODEs',
\@names, $cdom,$cnum);
+ my %code_values;
my @all_code_array;
foreach my $key (keys %all_codes) {
- my $codes = $all_codes{$key};
- my @numeric_codes = split(/,/,$codes);
- foreach my $numeric (sort {uc($a) cmp uc($b)} @numeric_codes) {
- my $alpha_code = &num_to_letters($numeric);
- push (@all_code_array, "$alpha_code : $numeric");
+ %code_values = &Apache::grades::get_codes($key, $cdom, $cnum);
+ foreach my $key (keys %code_values) {
+ push (@all_code_array, "$key");
}
}
+
my $code_selection = "<choice></choice>\n";
- foreach my $code (@all_code_array) {
- $code_selection .= ' <choice computer="'.$code.'">'.$code."</choice>\n";
+ foreach my $code (sort {uc($a) cmp uc($b)} @all_code_array) {
+ my $choice = $code;
+ if ($code =~ /^[A-Z]+$/) { # Alpha code
+ $choice = &letters_to_num($code);
+ }
+ $code_selection .= ' <choice computer="'.$choice.'">'.$code."</choice>\n";
}
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
my $codechoice='';