--- rat/lonwrapper.pm 2003/04/15 03:53:03 1.12 +++ rat/lonwrapper.pm 2004/09/18 16:32:17 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.12 2003/04/15 03:53:03 www Exp $ +# $Id: lonwrapper.pm,v 1.16 2004/09/18 16:32:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,7 +45,7 @@ use Apache::lonmenu; sub handler { my $r=shift; - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; @@ -54,8 +54,11 @@ sub handler { ['wrapperdisplay']); my $orgurl=$r->uri; my $url=$orgurl; + $orgurl.=(($orgurl=~/\?/)?'&':'?').$ENV{'QUERY_STRING'}; + $orgurl.=(($orgurl=~/\?/)?'&':'?').'wrapperdisplay=menu'; $url=~s/^\/adm\/wrapper//; $url=~s/^\/ext\//http\:\/\//; + $url=~s|:|:|g; if ($ENV{'form.wrapperdisplay'} eq 'menu') { # # Producing the menu buttons @@ -66,39 +69,47 @@ sub handler { # # Actual URL # - if ($url=~/^\/uploaded\//) { - $url=&Apache::lonnet::tokenwrapper($url); - } - $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'}; #reappend the query arguments - my $events='onLoad="'.&Apache::lonmenu::loadevents. - '" onUnload="'.&Apache::lonmenu::unloadevents.'"'; - my $script=&Apache::lonmenu::registerurl(1,undef); + if ($url=~/\.(problem|exam|quiz|assess|survey|form|library)$/) { +# +# This is uploaded homework +# + $ENV{'request.state'}='uploaded'; + &Apache::lonhomework::renderpage($r,$url); + } else { +# +# This is not homework +# + $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'}; + # reappend the query arguments + my $events='onLoad="'.&Apache::lonmenu::loadevents. + '" onUnload="'.&Apache::lonmenu::unloadevents.'"'; + my $script=&Apache::lonmenu::registerurl(1,undef); - if ($ENV{'browser.interface'} eq 'textual') { + if ($ENV{'browser.interface'} eq 'textual') { # # ssi-based rendering for text-based interface # - $r->print(''. - &Apache::lonmenu::registerurl(1). - ''. - &Apache::lonmenu::menubuttons(1). - &Apache::lonnet::ssi_body($url).''); - } elsif ($ENV{'environment.remote'} eq 'off') { + $r->print(''. + &Apache::lonmenu::registerurl(1). + ''. + &Apache::lonmenu::menubuttons(1). + &Apache::lonnet::ssi_body($url).''); + } elsif ($ENV{'environment.remote'} eq 'off') { # # This is inline remote # - $r->print(<print(< $script - + ENDDOCUMENTINL - } else { + } else { # # frame-based rendering for graphical interface # @@ -113,10 +124,11 @@ $script ENDDOCUMENT - } - } + } + } # not homework + } # not just the menu return OK; -} +} # handler 1; __END__