--- loncom/interface/loncommon.pm 2006/04/11 20:00:44 1.331 +++ loncom/interface/loncommon.pm 2006/04/14 20:16:02 1.337 @@ -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.337 2006/04/14 20:16:02 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; @@ -2764,7 +2766,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, - $notopbar,$bgcolor)=@_; + $notopbar,$bgcolor,$hidetitle)=@_; $title=&mt($title); $function = &get_users_function() if (!$function); my $img=&designparm($function.'.img',$domain); @@ -2816,14 +2818,18 @@ 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). - '

LON-CAPA: '.$title.'

'; + $bodytag.=&Apache::lonmenu::menubuttons($forcereg,$forcereg); + if (!$hidetitle) { + $bodytag.='

LON-CAPA: '.$title.'

'; + } + return $bodytag; } elsif ($env{'environment.remote'} eq 'off') { # No Remote my $roleinfo=(<'. ''. $titleinfo.''.$roleinfo.''; - if ($env{'request.state'} eq 'construct') { + } + if ($env{'request.state'} eq 'construct') { 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; } } @@ -2913,6 +2924,9 @@ ENDROLE # Explicit link to get inline menu my $menu='
 '.&mt('Switch to Inline Menu Mode').''; # + if ($hidetitle) { + return $bodytag; + } return(< @@ -3010,7 +3024,6 @@ Inputs: $title - optional title for the $args - optional arguments force_register - if is true call registerurl so the remote is informed - redirect - array ref of seconds before redirect occurs url to redirect to (side effect of setting @@ -3118,6 +3131,7 @@ Inputs: $title - optional title for the is not auto translated like the $title is frameset -> if true will start with a rather than + =back =cut @@ -3182,6 +3196,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 +3215,11 @@ sub end_page { if ($args->{'js_ready'}) { $result = &js_ready($result); } + if ($args->{'html_encode'}) { $result = &html_encode($result); } + return $result; } @@ -3671,92 +3696,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)