[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet lonspreadsheet.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 20 Jun 2003 16:55:46 -0000


www		Fri Jun 20 12:55:46 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	lonspreadsheet.pm 
  Log:
  Proper error handling call.
  
  
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.13 loncom/interface/spreadsheet/lonspreadsheet.pm:1.14
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.13	Thu Jun 19 12:04:06 2003
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Fri Jun 20 12:55:46 2003
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.13 2003/06/19 16:04:06 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.14 2003/06/20 16:55:46 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -238,13 +238,6 @@
         $name   = $ENV{'form.sname'};
         $domain = $ENV{'form.sdomain'};
     }
-    #
-    # Open page, try to prevent browser cache.
-    #
-    $r->content_type('text/html');
-    $r->header_out('Cache-control','no-cache');
-    $r->header_out('Pragma','no-cache');
-    $r->send_http_header;
     ##
     ## Check permissions
     my $allowed_to_edit = &Apache::lonnet::allowed('mgr',
@@ -265,10 +258,10 @@
     # if they are not requesting their own.
     if ($sheettype eq 'classcalc') {
         if (! $allowed_to_view) {
-            $r->print('<h1>Access Permission Denied</h1>'.
-                      '</form></body></html>');
-            return OK;
-        }
+	    $ENV{'user.error.msg'}=
+		$r->uri.":vgr:0:0:Access Permission Denied";
+	    return HTTP_NOT_ACCEPTABLE; 
+	}
     }
     if ((($name   ne $ENV{'user.name'} ) ||
          ($domain ne $ENV{'user.domain'})) && $sheettype ne 'classcalc') {
@@ -278,13 +271,22 @@
             my $stu_sec = &Apache::lonnet::usection($domain,$name,
                                                     $ENV{'request.course.id'});
             if ($stu_sec ne $ENV{'request.course.sec'}) {
-                $r->print
-                    ('<h1>The student requested is not in your section.</h1>'.
-                     '</form></body></html>');
-                return OK;
+		$ENV{'user.error.msg'}=
+		    $r->uri.":vgr:0:0:Requested student not in your section.";
+		return HTTP_NOT_ACCEPTABLE; 
             }
         }
     }
+
+# ================================================================== Good to go
+
+    #
+    # Open page, try to prevent browser cache.
+    #
+    $r->content_type('text/html');
+    $r->header_out('Cache-control','no-cache');
+    $r->header_out('Pragma','no-cache');
+    $r->send_http_header;
 
     #
     # Header....