--- 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".'
'."\n"; + $seconddiv = 1; + } + $result.='

'.$currentcategory.'

'; + } $result .= '
'."\n"; - $count ++; - if ((!$seconddiv) && ($count >= $midpoint)) { - $result .= '
'."\n".'
'."\n"; - $seconddiv = 1; + $file->[1].''; + if ($file->[3]) { + $result.=&Apache::loncommon::help_open_topic($file->[3]); } + my $filename=$file->[0]; + $filename=~s/^\/home\/httpd\/html//; + $result.=' '.&mt('Example').'
'."\n"; + $count ++; } if ($numfiles > 0) { $result .= '
'."\n".''."\n"; @@ -1176,8 +1190,8 @@ sub update_construct_style { &Apache::lonnet::delenv('construct\\.style'); } elsif ($env{'form.style_file'} && $env{'construct.style'} ne $env{'form.style_file'}) { - &Apache::lonnet::appenv('construct.style' => - $env{'form.style_file'}); + &Apache::lonnet::appenv({'construct.style' => + $env{'form.style_file'}}); } } }