[LON-CAPA-cvs] cvs: rat / lonwrapper.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 13 May 2003 15:13:17 -0000
www Tue May 13 11:13:17 2003 EDT
Modified files:
/rat lonwrapper.pm
Log:
Handle homework rendering through the wrapper.
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.12 rat/lonwrapper.pm:1.13
--- rat/lonwrapper.pm:1.12 Mon Apr 14 23:53:03 2003
+++ rat/lonwrapper.pm Tue May 13 11:13:17 2003
@@ -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.13 2003/05/13 15:13:17 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,28 +66,39 @@
#
# 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
+#
+ 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 ($ENV{'browser.interface'} eq 'textual') {
+ if ($ENV{'browser.interface'} eq 'textual') {
#
# ssi-based rendering for text-based interface
#
- $r->print('<html><head>'.
- &Apache::lonmenu::registerurl(1).
- '</head><body bgcolor="#FFFFFF">'.
- &Apache::lonmenu::menubuttons(1).
- &Apache::lonnet::ssi_body($url).'</body></html>');
- } elsif ($ENV{'environment.remote'} eq 'off') {
+ $r->print('<html><head>'.
+ &Apache::lonmenu::registerurl(1).
+ '</head><body bgcolor="#FFFFFF">'.
+ &Apache::lonmenu::menubuttons(1).
+ &Apache::lonnet::ssi_body($url).'</body></html>');
+ } elsif ($ENV{'environment.remote'} eq 'off') {
#
# This is inline remote
#
- $r->print(<<ENDDOCUMENTINL);
+ $r->print(<<ENDDOCUMENTINL);
<html>
<head>
$script
@@ -98,7 +109,7 @@
</frameset>
</html>
ENDDOCUMENTINL
- } else {
+ } else {
#
# frame-based rendering for graphical interface
#
@@ -113,10 +124,11 @@
</frameset>
</html>
ENDDOCUMENT
- }
- }
+ }
+ } # not homework
+ } # not just the menu
return OK;
-}
+} # handler
1;
__END__