[LON-CAPA-cvs] cvs: loncom(version_2_3_X) /interface lonparmset.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 14 Dec 2006 20:50:25 -0000


albertel		Thu Dec 14 15:50:25 2006 EDT

  Modified files:              (Branch: version_2_3_X)
    /loncom/interface	lonparmset.pm 
  Log:
  - backport 1.355
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.350.2.2 loncom/interface/lonparmset.pm:1.350.2.3
--- loncom/interface/lonparmset.pm:1.350.2.2	Thu Dec 14 15:37:24 2006
+++ loncom/interface/lonparmset.pm	Thu Dec 14 15:50:25 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.350.2.2 2006/12/14 20:37:24 albertel Exp $
+# $Id: lonparmset.pm,v 1.350.2.3 2006/12/14 20:50:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3836,6 +3836,12 @@
     $r->print(&Apache::loncommon::end_page());
 }
 
+sub check_for_course_info {
+    my $navmap = Apache::lonnavmaps::navmap->new();
+    return 1 if ($navmap);
+    return 0;
+}
+
 ##################################################
 ##################################################
 
@@ -3879,7 +3885,9 @@
 	(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
 	 &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.
 				  $env{'request.course.sec'}));
-    if ($env{'request.course.id'} &&  $parm_permission) {
+    my $exists = &check_for_course_info();
+
+    if ($env{'request.course.id'} &&  $parm_permission && $exists) {
 
         # Start Page
         &Apache::loncommon::content_type($r,'text/html');
@@ -3949,8 +3957,13 @@
 	}       
     } else {
 # ----------------------------- Not in a course, or not allowed to modify parms
-	$env{'user.error.msg'}=
-	    "/adm/parmset:opa:0:0:Cannot modify assessment parameters";
+	if ($exists) {
+	    $env{'user.error.msg'}=
+		"/adm/parmset:opa:0:0:Cannot modify assessment parameters";
+	} else {
+	    $env{'user.error.msg'}=
+		"/adm/parmset::0:1:Course environment gone, reinitialize the course";
+	}
 	return HTTP_NOT_ACCEPTABLE;
     }
     return OK;