--- loncom/interface/loncommon.pm 2006/04/11 20:00:44 1.331 +++ loncom/interface/loncommon.pm 2006/04/14 20:12:35 1.336 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.331 2006/04/11 20:00:44 albertel Exp $ +# $Id: loncommon.pm,v 1.336 2006/04/14 20:12:35 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,6 +61,8 @@ use POSIX qw(strftime mktime); use Apache::lonmenu(); use Apache::lonlocal; use HTML::Entities; +use Apache::lonhtmlcommon(); +use Apache::loncoursedata(); my $readit; @@ -2816,13 +2818,14 @@ END my $upperleft=''.$function.''; - if ($bodyonly) { + if ($bodyonly + || ($env{'request.state'} eq 'construct' + && $env{'environment.remote'} ne 'off' )) { return $bodytag; } elsif ($env{'browser.interface'} eq 'textual') { # Accessibility - return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web', - $forcereg). + return $bodytag.&Apache::lonmenu::menubuttons($forcereg,$forcereg). '

LON-CAPA: '.$title.'

'; } elsif ($env{'environment.remote'} eq 'off') { # No Remote @@ -2880,13 +2883,13 @@ ENDROLE if ($notopbar) { $bodytag .= $titletable; } else { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg,$titletable); + $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg,$titletable); } } else { if ($notopbar) { $bodytag .= $titletable; } else { - $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg). + $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg). $titletable; } } @@ -3182,6 +3185,15 @@ sub end_page { #&Apache::lonnet::logthis("end_page ".join(':',caller(0))); $env{'internal.end_page'}++; my $result; + if ($args->{'discussion'}) { + my ($target,$parser); + if (ref($args->{'discussion'})) { + ($target,$parser) =($args->{'discussion'}{'target'}, + $args->{'discussion'}{'parser'}); + } + $result .= &Apache::lonxml::xmlend($target,$parser); + } + if ($args->{'frameset'}) { $result .= ''; } else { @@ -3192,9 +3204,11 @@ sub end_page { if ($args->{'js_ready'}) { $result = &js_ready($result); } + if ($args->{'html_encode'}) { $result = &html_encode($result); } + return $result; } @@ -3671,92 +3685,6 @@ sub get_user_info { 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"; - } - } - } -# -# Digested POSTed values -# -# Remember the way this was originally done (GET or POST) -# - $env{'request.method'}=$ENV{'REQUEST_METHOD'}; -# -# There may also be stuff in the query string -# Tell subsequent handlers that this was GET, not POST, so they can access query string. -# Also, unset POSTed content length to cover all tracks. -# - -# This does not work, because M_GET is not defined (if it's defined, it is just 0). -# Commenting out for now ... not sure if harm is done. -# $r->method_number(M_GET); - - $r->method('GET'); - $r->headers_in->unset('Content-length'); -} - =pod =item * get_unprocessed_cgi($query,$possible_names)