--- loncom/homework/lonhomework.pm 2008/01/21 17:20:45 1.290 +++ loncom/homework/lonhomework.pm 2008/05/19 20:38:04 1.292 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.290 2008/01/21 17:20:45 www Exp $ +# $Id: lonhomework.pm,v 1.292 2008/05/19 20:38:04 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1079,8 +1079,10 @@ sub get_template_list { } my @files = glob($Apache::lonnet::perlvar{'lonIncludes'}. '/templates/*.'.$glob_extension); - @files = map {[$_,&mt(&Apache::lonnet::metadata($_, 'title'))]} (@files); - @files = sort {$a->[1] cmp $b->[1]} (@files); + @files = map {[$_,&mt(&Apache::lonnet::metadata($_, 'title')), + (&Apache::lonnet::metadata($_, 'category')?&mt(&Apache::lonnet::metadata($_, 'category')):&mt('Miscellaneous')), + &mt(&Apache::lonnet::metadata($_, 'help'))]} (@files); + @files = sort {$a->[2].$a->[1] cmp $b->[2].$b->[1]} (@files); my ($midpoint,$seconddiv,$numfiles); $numfiles = 0; foreach my $file (@files) { @@ -1095,16 +1097,28 @@ sub get_template_list { } } my $count = 0; + my $currentcategory=''; foreach my $file (@files) { next if ($file->[1] !~ /\S/); + if ($file->[2] ne $currentcategory) { + $currentcategory=$file->[2]; + $count++; + if ((!$seconddiv) && ($count >= $midpoint)) { + $result .= ''."\n".'