Diff for /loncom/interface/loncommon.pm between versions 1.327 and 1.333

version 1.327, 2006/04/07 21:56:00 version 1.333, 2006/04/13 19:07:11
Line 720  sub help_open_menu { Line 720  sub help_open_menu {
   "<td bgcolor='#CC6600'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";    "<td bgcolor='#CC6600'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";
     }      }
     my $nothing=&Apache::lonhtmlcommon::javascript_nothing();      my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
     my $html=&Apache::lonxml::xmlbegin();  
     my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");      my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
       my $start_page =
           &Apache::loncommon::start_page('Help Menu', undef,
          {'frameset'    => 1,
    'js_ready'    => 1,
    'add_entries' => {
       'border' => '0',
       'rows'   => "105,*",},});
       my $end_page =
           &Apache::loncommon::end_page({'frameset' => 1,
         'js_ready' => 1,});
   
     $template .= <<"ENDTEMPLATE";      $template .= <<"ENDTEMPLATE";
  <script type="text/javascript">   <script type="text/javascript">
 // <!-- BEGIN LON-CAPA Internal  // <!-- BEGIN LON-CAPA Internal
Line 745  function helpMenu(target) { Line 755  function helpMenu(target) {
     return;      return;
 }  }
 function writeHelp(caller) {  function writeHelp(caller) {
     caller.document.writeln('$html<head><title>LON-CAPA Help Menu</title><meta http-equiv="pragma" content="no-cache"></head>')      caller.document.writeln('$start_page<frame name="bannerframe"  src="$banner_link" /><frame name="bodyframe" src="$details_link" /> $end_page')
     caller.document.writeln("<frameset rows='105,*' border='0'><frame name='bannerframe'  src='$banner_link'><frame name='bodyframe' src='$details_link'></frameset>")  
     caller.document.writeln("</html>")  
     caller.document.close()      caller.document.close()
     caller.focus()      caller.focus()
 }  }
Line 2768  sub bodytag { Line 2776  sub bodytag {
     my $vlink=&designparm($function.'.vlink',$domain);      my $vlink=&designparm($function.'.vlink',$domain);
     my $sidebg=&designparm($function.'.sidebg',$domain);      my $sidebg=&designparm($function.'.sidebg',$domain);
 # Accessibility font enhance  # Accessibility font enhance
     unless ($addentries) { $addentries=''; }  
     my $addstyle='';      my $addstyle='';
     if ($env{'browser.fontenhance'} eq 'on') {      if ($env{'browser.fontenhance'} eq 'on') {
  $addstyle=' font-size: x-large;';   $addstyle=' font-size: x-large;';
Line 2787  sub bodytag { Line 2794  sub bodytag {
 # Port for miniserver  # Port for miniserver
     my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};      my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
     if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }      if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
   
       my $extra_body_attr = &make_attr_string($forcereg,$addentries);
   
 # construct main body tag  # construct main body tag
     my $bodytag = <<END;      my $bodytag = <<END;
 <style type="text/css">  <style type="text/css">
Line 2799  form, .inline { display: inline; } Line 2809  form, .inline { display: inline; }
 .filename {font-family: monospace;}  .filename {font-family: monospace;}
 </style>  </style>
 <body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"  <body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link"
 style="margin-top: 0px;$addstyle" $addentries>  style="margin-top: 0px;$addstyle" $extra_body_attr>
 END  END
     &Apache::lontexconvert::jsMath_reset();  
     if ($env{'environment.texengine'} eq 'jsMath' ||      $bodytag .= &Apache::lontexconvert::init_math_support();
  $env{'form.texengine'}        eq 'jsMath' ) {  
  $bodytag.=&Apache::lontexconvert::jsMath_header();  
     }  
   
     my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'.      my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'.
                    $lonhttpdPort.$img.'" alt="'.$function.'" />';                     $lonhttpdPort.$img.'" alt="'.$function.'" />';
     if ($bodyonly) {      if ($bodyonly 
    || ($env{'request.state'} eq 'construct' 
       && $env{'environment.remote'} ne 'off' )) {
         return $bodytag;          return $bodytag;
     } elsif ($env{'browser.interface'} eq 'textual') {      } elsif ($env{'browser.interface'} eq 'textual') {
 # Accessibility  # Accessibility
Line 2934  $titleinfo $dc_info $menu Line 2943  $titleinfo $dc_info $menu
 ENDBODY  ENDBODY
 }  }
   
   sub make_attr_string {
       my ($register,$attr_ref) = @_;
   
       if ($attr_ref && !ref($attr_ref)) {
    die("addentries Must be a hash ref ".
       join(':',caller(1))." ".
       join(':',caller(0))." ");
       }
   
       if ($register) {
    $attr_ref->{'onload'}   = &Apache::lonmenu::loadevents().
       $attr_ref->{'onload'};
    $attr_ref->{'onunload'} = &Apache::lonmenu::unloadevents().
       $attr_ref->{'onunload'};
       }
       my $attr_string;
       foreach my $attr (keys(%$attr_ref)) {
    $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" ';
       }
       return $attr_string;
   }
   
   
 ###############################################  ###############################################
 ###############################################  ###############################################
   
Line 3086  Inputs: $title - optional title for the Line 3118  Inputs: $title - optional title for the
                   body_title     -> alternate text to use instead of $title                    body_title     -> alternate text to use instead of $title
                                     in the title box that appears, this text                                      in the title box that appears, this text
                                     is not auto translated like the $title is                                      is not auto translated like the $title is
                     frameset       -> if true will start with a <frameset>
                                       rather than <body>
 =back  =back
   
 =cut  =cut
Line 3104  sub start_page { Line 3137  sub start_page {
     $env{'internal.start_page'}++;      $env{'internal.start_page'}++;
     my $result =       my $result = 
  &Apache::lonxml::xmlbegin().   &Apache::lonxml::xmlbegin().
  &headtag($title,$head_extra,\%head_args).&endheadtag().   &headtag($title,$head_extra,\%head_args).&endheadtag();
  &bodytag($title,       if ($args->{'frameset'}) {
  $args->{'function'},       $args->{'add_entries'},   my $attr_string = &make_attr_string($args->{'force_register'},
  $args->{'only_body'},      $args->{'domain'},      $args->{'add_entries'});
  $args->{'force_register'}, $args->{'body_title'},   $result .= "\n<frameset $attr_string>\n";
  $args->{'no_nav_bar'},     $args->{'bgcolor'});      } else {
    $result .=
       &bodytag($title, 
        $args->{'function'},       $args->{'add_entries'},
        $args->{'only_body'},      $args->{'domain'},
        $args->{'force_register'}, $args->{'body_title'},
        $args->{'no_nav_bar'},     $args->{'bgcolor'});
       }
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }
Line 3119  sub start_page { Line 3159  sub start_page {
     return $result;      return $result;
 }  }
   
   
 =pod  =pod
   
 =over 4  =over 4
Line 3132  Inputs:         $args - additional optio Line 3173  Inputs:         $args - additional optio
                                  a javascript writeln                                   a javascript writeln
                  html_encode  -> return a string ready for being used in                    html_encode  -> return a string ready for being used in 
                                  a html attribute                                   a html attribute
                    frameset     -> if true will start with a <frameset>
                                    rather than <body>
 =back  =back
   
 =cut  =cut
Line 3140  sub end_page { Line 3183  sub end_page {
     my ($args) = @_;      my ($args) = @_;
     #&Apache::lonnet::logthis("end_page ".join(':',caller(0)));      #&Apache::lonnet::logthis("end_page ".join(':',caller(0)));
     $env{'internal.end_page'}++;      $env{'internal.end_page'}++;
     my $result = &endbodytag()."\n</html>";      my $result;
       if ($args->{'frameset'}) {
    $result .= '</frameset>';
       } else {
    $result .= &endbodytag();
       }
       $result .= "\n</html>";
   
     if ($args->{'js_ready'}) {      if ($args->{'js_ready'}) {
  $result = &js_ready($result);   $result = &js_ready($result);
     }      }
Line 3623  sub get_user_info { Line 3673  sub get_user_info {
     return;      return;
 }  }
   
 ###############################################  
   
 sub get_posted_cgi {  
     my $r=shift;  
   
     my $buffer;  
     if ($r->header_in('Content-length')) {  
  $r->read($buffer,$r->header_in('Content-length'),0);  
     }  
     unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) {  
  my @pairs=split(/&/,$buffer);  
  my $pair;  
  foreach $pair (@pairs) {  
     my ($name,$value) = split(/=/,$pair);  
     $value =~ tr/+/ /;  
     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;  
     $name  =~ tr/+/ /;  
     $name  =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;  
     &add_to_env("form.$name",$value);  
  }  
     } else {  
  my $contentsep=$1;  
  my @lines = split (/\n/,$buffer);  
  my $name='';  
  my $value='';  
  my $fname='';  
  my $fmime='';  
  my $i;  
  for ($i=0;$i<=$#lines;$i++) {  
     if ($lines[$i]=~/^$contentsep/) {  
  if ($name) {  
     chomp($value);  
     if ($fname) {  
  $env{"form.$name.filename"}=$fname;  
  $env{"form.$name.mimetype"}=$fmime;  
     } else {  
  $value=~s/\s+$//s;  
     }  
     &add_to_env("form.$name",$value);  
  }  
  if ($i<$#lines) {  
     $i++;  
     $lines[$i]=~  
  /Content\-Disposition\:\s*form\-data\;\s*name\=\"([^\"]+)\"/i;  
     $name=$1;  
     $value='';  
     if ($lines[$i]=~/filename\=\"([^\"]+)\"/i) {  
  $fname=$1;  
  if   
                             ($lines[$i+1]=~/Content\-Type\:\s*([\w\-\/]+)/i) {  
  $fmime=$1;  
  $i++;  
     } else {  
  $fmime='';  
     }  
     } else {  
  $fname='';  
  $fmime='';  
     }  
     $i++;  
  }  
     } else {  
  $value.=$lines[$i]."\n";  
     }  
  }  
     }  
     $env{'request.method'}=$ENV{'REQUEST_METHOD'};  
     $r->method_number(M_GET);  
     $r->method('GET');  
     $r->headers_in->unset('Content-length');  
 }  
   
 =pod  =pod
   
 =item * get_unprocessed_cgi($query,$possible_names)  =item * get_unprocessed_cgi($query,$possible_names)

Removed from v.1.327  
changed lines
  Added in v.1.333


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