Diff for /loncom/interface/loncommon.pm between versions 1.319 and 1.323

version 1.319, 2006/03/21 21:49:30 version 1.323, 2006/03/27 19:38:53
Line 2801  form, .inline { display: inline; } Line 2801  form, .inline { display: inline; }
 style="margin-top: 0px;$addstyle" $addentries>  style="margin-top: 0px;$addstyle" $addentries>
 END  END
     &Apache::lontexconvert::jsMath_reset();      &Apache::lontexconvert::jsMath_reset();
     if ($env{'environment.texengine'} eq 'jsMath') {      if ($env{'environment.texengine'} eq 'jsMath' ||
    $env{'form.texengine'}        eq 'jsMath' ) {
  $bodytag.=&Apache::lontexconvert::jsMath_header();   $bodytag.=&Apache::lontexconvert::jsMath_header();
     }      }
   
Line 3078  Inputs: $title - optional title for the Line 3079  Inputs: $title - optional title for the
                   bgcolor        -> override the default page bg color                    bgcolor        -> override the default page bg color
                   js_ready       -> return a string ready for being used in                     js_ready       -> return a string ready for being used in 
                                     a javascript writeln                                      a javascript writeln
                     html_encode    -> return a string ready for being used in 
                                       a html attribute
                   force_register -> if is true will turn on the &bodytag()                    force_register -> if is true will turn on the &bodytag()
                                     $forcereg arg                                      $forcereg arg
   
Line 3107  sub start_page { Line 3110  sub start_page {
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }
       if ($args->{'html_encode'}) {
    $result = &html_encode($result);
       }
     return $result;      return $result;
 }  }
   
Line 3121  Returns a complete </body></html> sectio Line 3127  Returns a complete </body></html> sectio
 Inputs:         $args - additional optional args supported are:  Inputs:         $args - additional optional args supported are:
                  js_ready     -> return a string ready for being used in                    js_ready     -> return a string ready for being used in 
                                  a javascript writeln                                   a javascript writeln
                    html_encode  -> return a string ready for being used in 
                                    a html attribute
 =back  =back
   
 =cut  =cut
Line 3133  sub end_page { Line 3141  sub end_page {
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }
       if ($args->{'html_encode'}) {
    $result = &html_encode($result);
       }
     return $result;      return $result;
 }  }
   
 sub js_ready {  sub html_encode {
     my ($result) = @_;      my ($result) = @_;
   
     $result = &HTML::Entities::encode($result,'<>&"');      $result = &HTML::Entities::encode($result,'<>&"');
       
       return $result;
   }
   sub js_ready {
       my ($result) = @_;
   
     $result =~ s/[\n\r]/ /g;      $result =~ s/[\n\r]/ /xmsg;
     $result =~ s/'/\\'/g;      $result =~ s/\\/\\\\/xmsg;
       $result =~ s/'/\\'/xmsg;
       $result =~ s{</script>}{</scrip'+'t>}xmsg;
           
     return $result;      return $result;
 }  }

Removed from v.1.319  
changed lines
  Added in v.1.323


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