Diff for /loncom/xml/lonxml.pm between versions 1.234 and 1.242

version 1.234, 2003/02/14 19:35:55 version 1.242, 2003/03/29 22:50:22
Line 145  $Apache::lonxml::registered=0; Line 145  $Apache::lonxml::registered=0;
 $Apache::lonxml::request='';  $Apache::lonxml::request='';
   
 # a problem number counter, and check on ether it is used  # a problem number counter, and check on ether it is used
 $Apache::lonxml::counter=4;  $Apache::lonxml::counter=1;
 $Apache::lonxml::counter_changed=0;  $Apache::lonxml::counter_changed=0;
   
 #internal check on whether to look at style defs  #internal check on whether to look at style defs
Line 257  sub xmlend { Line 257  sub xmlend {
 <font size="1">Note: in anonymous discussion, your name is visible only to  <font size="1">Note: in anonymous discussion, your name is visible only to
 course faculty</font><br />  course faculty</font><br />
 <textarea name=comment cols=60 rows=10 wrap=hard></textarea>  <textarea name=comment cols=60 rows=10 wrap=hard></textarea>
   <p>
   Attachment (128 KB max size): <input type="file" name="attachment" />
   </p>
 </form>  </form>
 ENDDISCUSS  ENDDISCUSS
              $discussion.=&Apache::lonfeedback::generate_preview_button();               $discussion.=&Apache::lonfeedback::generate_preview_button();
Line 457  sub htmlclean { Line 460  sub htmlclean {
   
 sub latex_special_symbols {  sub latex_special_symbols {
     my ($current_token,$stack,$parstack,$where)=@_;      my ($current_token,$stack,$parstack,$where)=@_;
     if ($where=='header') {      if ($where eq 'header') {
       $current_token =~ s/_/ /g;   $current_token =~ s/(\\|_|\^)/ /g;
       $current_token =~ s/\^/ /g;   $current_token =~ s/(\$|%|\#|&|\{|\})/\\$1/g;
       $current_token =~ s/&/\\&/g;  
     } else {      } else {
      $current_token=~s/\\ /\\char92 /g;   $current_token=~s/\\ /\\char92 /g;
      $current_token=~s/\^/\\char94 /g;   $current_token=~s/\^/\\char94 /g;
      $current_token=~s/\~/\\char126 /g;   $current_token=~s/\~/\\char126 /g;
      $current_token=~s/(&[^a-z\#])/\\$1/g;   $current_token=~s/(&[^a-z\#])/\\$1/g;
      $current_token=~s/([^&])\#/$1\\#/g;   $current_token=~s/([^&])\#/$1\\#/g;
      $current_token=~s/(\$|_|{|})/\\$1/g;   $current_token=~s/(\$|_|{|})/\\$1/g;
      $current_token=~s/\\char92 /\\texttt{\\char92}/g;   $current_token=~s/\\char92 /\\texttt{\\char92}/g;
      $current_token=~s/>/\$>\$/g; #more   $current_token=~s/(>|<)/\$$1\$/g; #more or less
      $current_token=~s/</\$<\$/g; #less   if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit
      if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit   if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space
      if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space  
     }      }
     return $current_token;      return $current_token;
 }  }
Line 488  sub inner_xmlparse { Line 489  sub inner_xmlparse {
  if ($metamode<1) {   if ($metamode<1) {
     my $text=$token->[1];      my $text=$token->[1];
     if ($token->[0] eq 'C' && $target eq 'tex') {      if ($token->[0] eq 'C' && $target eq 'tex') {
  $text = '%'.$text."\n";   $text = '';
   # $text = '%'.$text."\n";
     }      }
     $result.=$text;      $result.=$text;
  }   }
Line 592  sub callsub { Line 594  sub callsub {
     my $sub1;      my $sub1;
     no strict 'refs';      no strict 'refs';
     my $tag=$token->[1];      my $tag=$token->[1];
   # get utterly rid of extended html tags
       if ($tag=~/^x\-/i) { return ''; }
     my $space=$Apache::lonxml::alltags{$tag}[-1];      my $space=$Apache::lonxml::alltags{$tag}[-1];
     if (!$space) {      if (!$space) {
       $tag=~tr/A-Z/a-z/;        $tag=~tr/A-Z/a-z/;
Line 794  sub default_homework_load { Line 798  sub default_homework_load {
     my ($safeeval)=@_;      my ($safeeval)=@_;
     &Apache::lonxml::debug('Loading default_homework');      &Apache::lonxml::debug('Loading default_homework');
     my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');      my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm');
     if ($default == -1) {      if ($default eq -1) {
  &Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>");   &Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>");
     } else {      } else {
  &Apache::run::run($default,$safeeval);   &Apache::run::run($default,$safeeval);
Line 893  sub increment_counter { Line 897  sub increment_counter {
 sub init_counter {  sub init_counter {
     if (defined($ENV{'form.counter'})) {      if (defined($ENV{'form.counter'})) {
  $Apache::lonxml::counter=$ENV{'form.counter'};   $Apache::lonxml::counter=$ENV{'form.counter'};
     } elsif (not defined($Apache::lonxml::counter)) {      } else {
  $Apache::lonxml::counter=1;   $Apache::lonxml::counter=1;
  &store_counter();   &store_counter();
     }      }
Line 1099  sub inserteditinfo { Line 1103  sub inserteditinfo {
       my ($result,$filecontents)=@_;        my ($result,$filecontents)=@_;
       $filecontents = &HTML::Entities::encode($filecontents);        $filecontents = &HTML::Entities::encode($filecontents);
 #      my $editheader='<a href="#editsection">Edit below</a><hr />';  #      my $editheader='<a href="#editsection">Edit below</a><hr />';
         my $xml_help = '<table><tr><td>'.
     &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols',
         undef,undef,600)
         .'</td><td>'.
             &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols',
         undef,undef,600)
         .'</td></tr></table>';
       my $buttons=(<<BUTTONS);        my $buttons=(<<BUTTONS);
 <input type="submit" name="attemptclean"   <input type="submit" name="attemptclean" 
        value="Save and then attempt to clean HTML" />         value="Save and then attempt to clean HTML" />
Line 1109  BUTTONS Line 1120  BUTTONS
 <hr />  <hr />
 <a name="editsection" />  <a name="editsection" />
 <form method="post">  <form method="post">
   $xml_help
 <input type="hidden" name="editmode" value="Edit" />  <input type="hidden" name="editmode" value="Edit" />
 $buttons<br />  $buttons<br />
 <textarea cols="80" rows="40" name="filecont">$filecontents</textarea>  <textarea cols="80" rows="40" name="filecont">$filecontents</textarea>
Line 1178  sub handler { Line 1190  sub handler {
   my %mystyle;    my %mystyle;
   my $result = '';    my $result = '';
   my $filecontents=&Apache::lonnet::getfile($file);    my $filecontents=&Apache::lonnet::getfile($file);
   if ($filecontents == -1) {    if ($filecontents eq -1) {
     $result=(<<ENDNOTFOUND);      $result=(<<ENDNOTFOUND);
 <html>  <html>
 <head>  <head>

Removed from v.1.234  
changed lines
  Added in v.1.242


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