[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 13 Nov 2004 20:40:33 -0000


albertel		Sat Nov 13 15:40:33 2004 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  - add in bodytag for edixtxml and anlyze modes
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.182 loncom/homework/lonhomework.pm:1.183
--- loncom/homework/lonhomework.pm:1.182	Mon Oct 18 14:08:54 2004
+++ loncom/homework/lonhomework.pm	Sat Nov 13 15:40:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.182 2004/10/18 18:08:54 albertel Exp $
+# $Id: lonhomework.pm,v 1.183 2004/11/13 20:40:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -449,9 +449,13 @@
 
 sub analyze_header {
     my ($request) = @_;
+    my $bodytag='<body bgcolor="#ffffff">';
+    if ($ENV{'environment.remote'} eq 'off') {
+	$bodytag=&Apache::loncommon::bodytag();
+    }
     my $result.='<html>
             <head><title>'.&mt("Analyzing a problem").'</title></head>
-            <body bgcolor="#FFFFFF">'.&Apache::lonxml::message_location().'
+            '.$bodytag.&Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.
 	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.
 	    &Apache::structuretags::remember_problem_state().'
@@ -572,8 +576,11 @@
 	if ($cols > 80) { $cols = 80; }
 	if ($cols < 70) { $cols = 70; }
 	if ($rows < 20) { $rows = 20; }
-	$result.='<html><body bgcolor="#FFFFFF">'.
-	    &Apache::lonxml::message_location().'
+	my $bodytag='<body bgcolor="#ffffff">';
+	if ($ENV{'environment.remote'} eq 'off') {
+	    $bodytag=&Apache::loncommon::bodytag();
+	}
+	$result.='<html>'.$bodytag.&Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.
 	    &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.
 	    &Apache::structuretags::remember_problem_state().'
@@ -603,6 +610,13 @@
     &Apache::lonxml::debug("Running targets ".join(':',@targets));
     my $overall_result;
     foreach my $target (@targets) {
+	# FIXME need to do something intelligent when a problem goes
+        # from viewable to not viewable due to map conditions
+	#&setuppermissions();
+	#if (   $Apache::lonhomework::browse ne '2'
+	#    && $Apache::lonhomework::browse ne 'F' ) {
+	#    $request->print(" You most likely shouldn't see me.");
+	#}
 	#my $t0 = [&gettimeofday()];
 	my $problem=&Apache::lonnet::getfile($file);
 	if ($problem eq -1) {
@@ -755,7 +769,6 @@
     $Apache::lonxml::debug=$ENV{'user.debug'};
     if (&setupheader($request)) { return OK; }
     $ENV{'request.uri'}=$request->uri;
-
     &setuppermissions();
     &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:");
     # some times multiple problemmodes are submitted, need to select