Diff for /loncom/interface/loncommon.pm between versions 1.318 and 1.326

version 1.318, 2006/03/21 21:01:22 version 1.326, 2006/04/06 20:52:58
Line 2737  Inputs: Line 2737  Inputs:
 =item * $forcereg, if page should register as content page (relevant for   =item * $forcereg, if page should register as content page (relevant for 
             text interface only)              text interface only)
   
 =item * $customtitle, overrides the $title in some way ????  =item * $customtitle, alternate text to use instead of $title
                         in the title box that appears, this text
                         is not auto translated like the $title is
   
 =item * $notopbar, if true, keep the 'what is this' info but remove the  =item * $notopbar, if true, keep the 'what is this' info but remove the
                    navigational links                     navigational links
Line 2801  form, .inline { display: inline; } Line 2803  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 2976  Returns a uniform footer for LON-CAPA we Line 2979  Returns a uniform footer for LON-CAPA we
 Inputs: $title - optional title for the head  Inputs: $title - optional title for the head
         $head_extra - optional extra HTML to put inside the <head>          $head_extra - optional extra HTML to put inside the <head>
         $args - optional arguments          $args - optional arguments
               force_register - if is true call registerurl so the remote is 
                                informed
                                
             redirect - array ref of seconds before redirect occurs              redirect - array ref of seconds before redirect occurs
                                     url to redirect to                                      url to redirect to
                            (side effect of setting                              (side effect of setting 
Line 2992  sub headtag { Line 2998  sub headtag {
  '<head>'.   '<head>'.
  &Apache::lonxml::fontsettings().   &Apache::lonxml::fontsettings().
  &Apache::lonhtmlcommon::htmlareaheaders();   &Apache::lonhtmlcommon::htmlareaheaders();
       
       if ($args->{'force_register'}) {
    $result .= &Apache::lonmenu::registerurl(1);
       }
   
     if (ref($args->{'redirect'})) {      if (ref($args->{'redirect'})) {
  my ($time,$url) = @{$args->{'redirect'}};   my ($time,$url) = @{$args->{'redirect'}};
  $url = &Apache::lonenc::check_encrypt($url);   $url = &Apache::lonenc::check_encrypt($url);
  $env{'internal.head.redirect'} = $url;   $env{'internal.head.redirect'} = $url;
  $result.=<<ADDMETA   $result.=<<ADDMETA
 <meta http-equiv="pragma" content="no-cache" />  <meta http-equiv="pragma" content="no-cache" />
 <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$url" />  <meta HTTP-EQUIV="Refresh" CONTENT="$time; url=$url" />
 ADDMETA  ADDMETA
     }      }
     if (!defined($title)) {      if (!defined($title)) {
Line 3007  ADDMETA Line 3017  ADDMETA
     }      }
           
     $result .= '<title> LON-CAPA '.&mt($title).'</title>'.$head_extra;      $result .= '<title> LON-CAPA '.&mt($title).'</title>'.$head_extra;
       
     return $result;      return $result;
 }  }
   
Line 3044  Inputs: $title - optional title for the Line 3053  Inputs: $title - optional title for the
 =cut  =cut
   
 sub head {  sub head {
     my ($title,$head_extra) = @_;      my ($title,$head_extra,$args) = @_;
     return &headtag($title,$head_extra).&endheadtag();      return &headtag($title,$head_extra,$args).&endheadtag();
 }  }
   
 =pod  =pod
Line 3071  Inputs: $title - optional title for the Line 3080  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
                     body_title     -> alternate text to use instead of $title
                                       in the title box that appears, this text
                                       is not auto translated like the $title is
   
 =back  =back
   
Line 3082  sub start_page { Line 3096  sub start_page {
     my ($title,$head_extra,$args) = @_;      my ($title,$head_extra,$args) = @_;
     #&Apache::lonnet::logthis("start_page ".join(':',caller(0)));      #&Apache::lonnet::logthis("start_page ".join(':',caller(0)));
     my %head_args;      my %head_args;
     if (defined($args->{'redirect'})) {      foreach my $arg ('redirect','force_register') {
  $head_args{'redirect'} = $args->{'redirect'};   if (defined($args->{$arg})) {
       $head_args{$arg} = $args->{$arg};
    }
     }      }
   
     $env{'internal.start_page'}++;      $env{'internal.start_page'}++;
     my $result =       my $result = 
  &Apache::lonxml::xmlbegin().   &Apache::lonxml::xmlbegin().
Line 3092  sub start_page { Line 3109  sub start_page {
  &bodytag($title,    &bodytag($title, 
  $args->{'function'},       $args->{'add_entries'},   $args->{'function'},       $args->{'add_entries'},
  $args->{'only_body'},      $args->{'domain'},   $args->{'only_body'},      $args->{'domain'},
  $args->{'force_register'}, undef,   $args->{'force_register'}, $args->{'body_title'},
  $args->{'no_nav_bar'},     $args->{'bgcolor'});   $args->{'no_nav_bar'},     $args->{'bgcolor'});
     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 3111  Returns a complete </body></html> sectio Line 3131  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 3123  sub end_page { Line 3145  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;
 }  }
Line 3169  sub simple_error_page { Line 3202  sub simple_error_page {
  &Apache::loncommon::end_page();   &Apache::loncommon::end_page();
     if (ref($r)) {      if (ref($r)) {
  $r->print($page);   $r->print($page);
  return;   return OK;
     }      }
     return $page;      return $page;
 }  }

Removed from v.1.318  
changed lines
  Added in v.1.326


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