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

version 1.289, 2008/01/15 03:09:09 version 1.295, 2008/07/07 11:02:25
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 944  sub editxmlmode { Line 937  sub editxmlmode {
     &Apache::loncommon::resize_textarea_js().      &Apache::loncommon::resize_textarea_js().
             &Apache::structuretags::setmode_javascript();              &Apache::structuretags::setmode_javascript();
  my $only_body =  ($env{'environment.remote'} eq 'off')? 0 : 1;   my $only_body =  ($env{'environment.remote'} eq 'off')? 0 : 1;
    my $dragmath = &Apache::lonhtmlcommon::dragmath("LC_editxmltext");
  my $start_page =    my $start_page = 
     &Apache::loncommon::start_page(&mt("EditXML [_1]",$file),$js,      &Apache::loncommon::start_page(&mt("EditXML [_1]",$file),$js,
    {'no_auto_mt_title' => 1,     {'no_auto_mt_title' => 1,
Line 966  sub editxmlmode { Line 960  sub editxmlmode {
               </table>                </table>
               <div class="LC_edit_problem_discards">                <div class="LC_edit_problem_discards">
                 <input type="hidden" name="problemmode" value="editxml" />                  <input type="hidden" name="problemmode" value="editxml" />
   
                 <input type="button" name="submitmode" accesskey="d" value="'.&mt('Discard Edits and View').'" '.                  <input type="button" name="submitmode" accesskey="d" value="'.&mt('Discard Edits and View').'" '.
                 'onclick="javascript:setmode(this.form,'."'discard'".')" />                  'onclick="javascript:setmode(this.form,'."'discard'".')" />
                 <input type="button" '.&Apache::edit::submit_ask_anyway('setmode(this.form,'."'edit'".')').'name="submitmode" accesskey="e" value="'.&mt('Edit').'" />                  <input type="button" '.&Apache::edit::submit_ask_anyway('setmode(this.form,'."'edit'".')').'name="submitmode" accesskey="e" value="'.&mt('Edit').'" />
Line 973  sub editxmlmode { Line 968  sub editxmlmode {
               </div>                </div>
               <div class="LC_edit_problem_saves">                <div class="LC_edit_problem_saves">
                 <input type="submit" name="submitbutton" accesskey="s" value="'.&mt('Save').'"  />                  <input type="submit" name="submitbutton" accesskey="s" value="'.&mt('Save').'"  />
                 <input type="submit" name="submitbutton" accesskey="v" value="'.&mt('Save and View').'" />                  <input type="submit" name="submitbutton" accesskey="v" value="'.&mt('Save and View').'" />'
    .$dragmath.'
               </div>                </div>
               <hr class="LC_edit_problem_divide" />                <hr class="LC_edit_problem_divide" />
       '.&Apache::lonxml::message_location().'        '.&Apache::lonxml::message_location().'
Line 1086  sub get_template_list { Line 1082  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 1100  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 1193  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.295


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