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

version 1.319, 2006/03/21 21:49:30 version 1.320, 2006/03/23 23:43:13
Line 3078  Inputs: $title - optional title for the Line 3078  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 3109  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 3126  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 3140  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 html_encode {
       my ($result) = @_;
   
       $result = &HTML::Entities::encode($result,'"');
       
       return $result;
   }
 sub js_ready {  sub js_ready {
     my ($result) = @_;      my ($result) = @_;
     $result = &HTML::Entities::encode($result,'<>&"');  
   
     $result =~ s/[\n\r]/ /g;      $result =~ s/[\n\r]/ /g;
     $result =~ s/'/\\'/g;      $result =~ s/'/\\'/g;

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


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