Diff for /loncom/interface/loncommon.pm between versions 1.314 and 1.315

version 1.314, 2006/03/19 22:48:53 version 1.315, 2006/03/21 16:32:50
Line 2752  other decorations will be returned. Line 2752  other decorations will be returned.
   
 sub bodytag {  sub bodytag {
     my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,      my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,
  $notopbar)=@_;   $notopbar,$bgcolor)=@_;
     $title=&mt($title);      $title=&mt($title);
     $function = &get_users_function() if (!$function);      $function = &get_users_function() if (!$function);
     my $img=&designparm($function.'.img',$domain);      my $img=&designparm($function.'.img',$domain);
     my $pgbg=&designparm($function.'.pgbg',$domain);      my $pgbg= $bgcolor || &designparm($function.'.pgbg',$domain);
     my $tabbg=&designparm($function.'.tabbg',$domain);      my $tabbg=&designparm($function.'.tabbg',$domain);
     my $font=&designparm($function.'.font',$domain);      my $font=&designparm($function.'.font',$domain);
     my $link=&designparm($function.'.link',$domain);      my $link=&designparm($function.'.link',$domain);
Line 2953  Inputs: none Line 2953  Inputs: none
 sub endbodytag {  sub endbodytag {
     my $endbodytag='</body>';      my $endbodytag='</body>';
     $endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;      $endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;
       if ( exists( $env{'internal.head.redirect'} ) ) {
    $endbodytag=
       "<br /><a href=\"$env{'internal.head.redirect'}\">".
       &mt('Continue').'</a>'.
       $endbodytag;
       }
     return $endbodytag;      return $endbodytag;
 }  }
   
Line 2966  Returns a uniform footer for LON-CAPA we Line 2972  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
               redirect - array ref of seconds before redirect occurs
                                       url to redirect to
                              (side effect of setting 
                                  $env{'internal.head.redirect'} to the url 
                                  redirected too)
 =back  =back
   
 =cut  =cut
Line 2981  sub headtag { Line 2992  sub headtag {
           
     if (ref($args->{'redirect'})) {      if (ref($args->{'redirect'})) {
  my ($time,$url) = @{$args->{'redirect'}};   my ($time,$url) = @{$args->{'redirect'}};
    $url = &Apache::lonenc::check_encrypt($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="2; url=$url" />
Line 2990  ADDMETA Line 3003  ADDMETA
  $title = 'The LearningOnline Network with CAPA';   $title = 'The LearningOnline Network with CAPA';
     }      }
           
     $result .= '<title>'.&mt($title).'</title>'.$head_extra;      $result .= '<title> LON-CAPA '.&mt($title).'</title>'.$head_extra;
           
     return $result;      return $result;
 }  }
Line 3042  Returns a complete <html> .. <body> sect Line 3055  Returns a complete <html> .. <body> sect
   
 Inputs: $title - optional title for the page  Inputs: $title - optional title for the page
         $head_extra - optional extra HTML to incude inside the <head>          $head_extra - optional extra HTML to incude inside the <head>
         %args - additional optional args supported are:          $args - additional optional args supported are:
                   only_body   -> is true will set &bodytag() onlybodytag arg on                    only_body   -> is true will set &bodytag() onlybodytag arg on
                   no_nav_bar  -> is true will set &bodytag() notopbar arg on                    no_nav_bar  -> is true will set &bodytag() notopbar arg on
                   add_entries -> additional attributes to add to the  <body>                    add_entries -> additional attributes to add to the  <body>
                   domain      -> force to color decorate a page for a                     domain      -> force to color decorate a page for a 
                                  specific domain                                   specific domain
                   function    -> force usage of a specific rolish color scheme                    function    -> force usage of a specific rolish color scheme
                   redirect    -> ...                    redirect    -> see &headtag()
                     bgcolor     -> override the default page bg color
                    js_ready     -> return a string ready for being used in 
                                    a javascript writeln
   
 =back  =back
   
Line 3061  sub start_page { Line 3077  sub start_page {
     if (defined($args->{'redirect'})) {      if (defined($args->{'redirect'})) {
  $head_args{'redirect'} = $args->{'redirect'};   $head_args{'redirect'} = $args->{'redirect'};
     }      }
       $env{'internal.start_page'}++;
     return       my $result = 
  &Apache::lonxml::xmlbegin().   &Apache::lonxml::xmlbegin().
  &headtag($title,$head_extra,\%head_args).&endheadtag().   &headtag($title,$head_extra,\%head_args).&endheadtag().
  &bodytag($title, $args->{'function'}, $args->{'add_entries'},   &bodytag($title, $args->{'function'}, $args->{'add_entries'},
  $args->{'only_body'},   $args->{'only_body'},
  undef,undef,undef,$args->{'no_nav_bar'});   undef,undef,undef,$args->{'no_nav_bar'},$args->{'bgcolor'});
       if ($args->{'js_ready'}) {
    $result =~ s/[\n\r]/ /g;
    $result =~ s/'/\\'/g;
       }
       return $result;
 }  }
   
 =pod  =pod
Line 3078  sub start_page { Line 3099  sub start_page {
   
 Returns a complete </body></html> section for LON-CAPA web pages.  Returns a complete </body></html> section for LON-CAPA web pages.
   
 Inputs: None  Inputs:         $args - additional optional args supported are:
                    js_ready     -> return a string ready for being used in 
                                    a javascript writeln
 =back  =back
   
 =cut  =cut
   
 sub end_page {  sub end_page {
     return &endbodytag."\n</html>";      my ($args) = @_;
       $env{'internal.end_page'}++;
       my $result = &endbodytag()."\n</html>";
       if ($args->{'js_ready'}) {
    $result =~ s/[\n\r]/ /g;
    $result =~ s/'/\\'/g;
       }
       return $result;
 }  }
   
   sub validate_page {
       if (  exists($env{'internal.start_page'})
     &&    $env{'internal.start_page'} > 1) {
    &Apache::lonnet::logthis('start_page called multiple times');
       }
       if (  exists($env{'internal.end_page'})
     &&    $env{'internal.end_page'} > 1) {
    &Apache::lonnet::logthis('end_page called multiple times');
       }
       if (     exists($env{'internal.start_page'})
    && ! exists($env{'internal.end_page'})) {
    &Apache::lonnet::logthis('start_page called without end_page');
       }
       if (   ! exists($env{'internal.start_page'})
    &&   exists($env{'internal.end_page'})) {
    &Apache::lonnet::logthis('end_page called without start_page');
       }
   }
   
 ###############################################  ###############################################
   
 =pod  =pod

Removed from v.1.314  
changed lines
  Added in v.1.315


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