Diff for /loncom/homework/lonhomework.pm between versions 1.289 and 1.293

version 1.289, 2008/01/15 03:09:09 version 1.293, 2008/05/19 21:07:33
Line 712  sub handle_save_or_undo { Line 712  sub handle_save_or_undo {
  my $fs=Apache::File->new(">$filebak");   my $fs=Apache::File->new(">$filebak");
  if (defined($fs)) {   if (defined($fs)) {
     print $fs $$problem;      print $fs $$problem;
     &Apache::lonxml::info("<b>".&mt("Making Backup to [_1]",  
     '<span class="LC_filename">'.  
     $filebak.'</span>').  
   "</b>");  
  } else {   } else {
     &Apache::lonxml::info("<span class=\"LC_error\">".      &Apache::lonxml::info("<span class=\"LC_error\">".
   &mt("Unable to make backup [_1]",    &mt("Unable to make backup [_1]",
Line 726  sub handle_save_or_undo { Line 722  sub handle_save_or_undo {
  my $fh=Apache::File->new(">$file");   my $fh=Apache::File->new(">$file");
  if (defined($fh)) {   if (defined($fh)) {
     print $fh $$result;      print $fh $$result;
     &Apache::lonxml::info("<b>".&mt("Saving Modifications to [_1]",  
    '<span class="LC_filename">'.  
     $file.'</span>' )."</b>");  
  } else {   } else {
     &Apache::lonxml::info('<span class="LC_error">'.      &Apache::lonxml::info('<span class="LC_error">'.
   &mt("Unable to write to [_1]",    &mt("Unable to write to [_1]",
Line 1086  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 1102  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];
              if ((!$seconddiv) && ($count >= $midpoint)) {
                  $result .= '</div>'."\n".'<div class="LC_left_float">'."\n";
                  $seconddiv = 1;
              }
              $result.='<h3>'.$currentcategory.'</h3>';
              $count++;
           }
  $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";
Line 1183  sub update_construct_style { Line 1190  sub update_construct_style {
     &Apache::lonnet::delenv('construct\\.style');      &Apache::lonnet::delenv('construct\\.style');
  } elsif ($env{'form.style_file'}    } elsif ($env{'form.style_file'} 
     && $env{'construct.style'} ne $env{'form.style_file'}) {      && $env{'construct.style'} ne $env{'form.style_file'}) {
     &Apache::lonnet::appenv('construct.style' =>       &Apache::lonnet::appenv({'construct.style' => 
         $env{'form.style_file'});          $env{'form.style_file'}});
  }   }
     }      }
 }  }

Removed from v.1.289  
changed lines
  Added in v.1.293


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