--- loncom/interface/lonprintout.pm 2005/08/22 22:21:48 1.388 +++ loncom/interface/lonprintout.pm 2005/09/19 10:58:33 1.393 @@ -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.393 2005/09/19 10:58:33 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,8 +42,6 @@ use Apache::lonratedt; use POSIX qw(strftime); use Apache::lonlocal; -my $resources_printed = ''; - # # Convert a numeric code to letters # @@ -508,6 +506,7 @@ sub character_chart { $result =~ s/&(prod|\#8719);/\\ensuremath\{\\prod\}/g; $result =~ s/&(sum|\#8721);/\\ensuremath\{\\sum\}/g; $result =~ s/&(minus|\#8722);/\\ensuremath\{-\}/g; + $result =~ s/–/\\ensuremath\{-\}/g; $result =~ s/&(lowast|\#8727);/\\ensuremath\{*\}/g; $result =~ s/&(radic|\#8730);/\\ensuremath\{\\surd\}/g; $result =~ s/&(prop|\#8733);/\\ensuremath\{\\propto\}/g; @@ -822,6 +821,7 @@ sub print_latex_header { $output.='\newcommand{\keephidden}[1]{}\renewcommand{\deg}{$^{\circ}$}'."\n". '\usepackage{longtable}\usepackage{textcomp}\usepackage{makeidx}'."\n". '\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n". + '\usepackage{wrapfig}'. '\usepackage{picins}\usepackage{calc}'."\n". '\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n". '\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n". @@ -926,6 +926,7 @@ sub get_page_breaks { sub output_data { my ($r,$helper,$rparmhash) = @_; my %parmhash = %$rparmhash; + my $resources_printed = ''; my $html=&Apache::lonxml::xmlbegin(); my $bodytag=&Apache::loncommon::bodytag('Preparing Printout'); $r->print(<'.$name.''; } + + 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 = "\n"; - foreach my $code (@all_code_array) { - $code_selection .= ' '.$code."\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 .= ' '.$code."\n"; } open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); my $codechoice=''; @@ -2318,6 +2322,8 @@ CHOOSE_FROM_SUBDIR CHOOSE_FROM_ANY_SEQUENCE return \$res->is_sequence; return $urlValue; + return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0); +