Diff for /loncom/homework/lonhomework.pm between versions 1.291 and 1.292

version 1.291, 2008/03/12 02:46:53 version 1.292, 2008/05/19 20:38:04
Line 1079  sub get_template_list { Line 1079  sub get_template_list {
     }      }
     my @files = glob($Apache::lonnet::perlvar{'lonIncludes'}.      my @files = glob($Apache::lonnet::perlvar{'lonIncludes'}.
      '/templates/*.'.$glob_extension);       '/templates/*.'.$glob_extension);
     @files = map {[$_,&mt(&Apache::lonnet::metadata($_, 'title'))]} (@files);      @files = map {[$_,&mt(&Apache::lonnet::metadata($_, 'title')),
     @files = sort {$a->[1] cmp $b->[1]} (@files);                        (&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);      my ($midpoint,$seconddiv,$numfiles);
     $numfiles = 0;      $numfiles = 0;
     foreach my $file (@files) {      foreach my $file (@files) {
Line 1095  sub get_template_list { Line 1097  sub get_template_list {
         }          }
     }      }
     my $count = 0;      my $count = 0;
       my $currentcategory='';
     foreach my $file (@files) {      foreach my $file (@files) {
  next if ($file->[1] !~ /\S/);   next if ($file->[1] !~ /\S/);
           if ($file->[2] ne $currentcategory) {
              $currentcategory=$file->[2];
              $count++;
              if ((!$seconddiv) && ($count >= $midpoint)) {
                  $result .= '</div>'."\n".'<div class="LC_left_float">'."\n";
                  $seconddiv = 1;
              }
              $result.='<h3>'.$currentcategory.'</h3>';
           }
  $result .=   $result .=
     '<label><input type="radio" name="template" value="'.$file->[0].'" />'.      '<label><input type="radio" name="template" value="'.$file->[0].'" />'.
     $file->[1].'</label><br />'."\n";      $file->[1].'</label>';
         $count ++;          if ($file->[3]) {
         if ((!$seconddiv) && ($count >= $midpoint)) {             $result.=&Apache::loncommon::help_open_topic($file->[3]);
             $result .= '</div>'."\n".'<div class="LC_left_float">'."\n";  
             $seconddiv = 1;  
         }          }
           my $filename=$file->[0];
           $filename=~s/^\/home\/httpd\/html//;
           $result.=' <font size="-2"><a href="'.$filename.'" target="sample">'.&mt('Example').'</font></a><br />'."\n";
           $count ++;
     }      }
     if ($numfiles > 0) {      if ($numfiles > 0) {
         $result .= '</div>'."\n".'<div class="LC_clear_float_footer"></div>'."\n";          $result .= '</div>'."\n".'<div class="LC_clear_float_footer"></div>'."\n";

Removed from v.1.291  
changed lines
  Added in v.1.292


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>