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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 13 Jun 2003 20:01:02 -0000


albertel		Fri Jun 13 16:01:02 2003 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - Fixes BUG#1738, if no parameters don't show the parameter setting screen.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.98 loncom/interface/lonparmset.pm:1.99
--- loncom/interface/lonparmset.pm:1.98	Thu Jun  5 22:24:49 2003
+++ loncom/interface/lonparmset.pm	Fri Jun 13 16:01:02 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.98 2003/06/06 02:24:49 www Exp $
+# $Id: lonparmset.pm,v 1.99 2003/06/13 20:01:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -285,8 +285,8 @@
 
 
 sub startpage {
-    my ($r,$id,$udom,$csec,$uname)=@_;
- 
+    my ($r,$id,$udom,$csec,$uname,$have_assesments)=@_;
+
     my $bodytag=&Apache::loncommon::bodytag('Set Course Parameters','',
                                             'onUnload="pclose()"');
     my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
@@ -351,6 +351,12 @@
 </form>
 <form method="post" action="/adm/parmset" name="parmform">
 <h3>Course Assessments</h3>
+ENDHEAD
+
+    if (!$have_assesments) {
+	$r->print('<font color="red">There are no assesment parameters in this course to set.</font><br />');	
+    } else {
+	$r->print(<<ENDHEAD);
 <b>
 Section/Group:
 <input type="text" value="$csec" size="6" name="csec">
@@ -366,7 +372,7 @@
 <input type="hidden" value='' name="pres_type">
 <input type="hidden" value='' name="pres_marker">
 ENDHEAD
-
+    }
 }
 
 sub print_row {
@@ -761,6 +767,7 @@
 
     $mapp{'0.0'} = '';
     $symbp{'0.0'} = '';
+
 # ---------------------------------------------------------- Anything to store?
     if ($ENV{'form.pres_marker'}) {
 	my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'});
@@ -877,7 +884,12 @@
     if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
 # ------------------------------------------------------------------ Start page
 
-    &startpage($r,$id,$udom,$csec,$uname);
+    my $have_assesments=1;
+    if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; }
+
+    &startpage($r,$id,$udom,$csec,$uname,$have_assesments);
+
+    if (!$have_assesments) { return ''; }
 #    if ($ENV{'form.url'}) {
 #	$r->print('<input type="hidden" value="'.$ENV{'form.url'}.
 #		  '" name="url"><input type="hidden" name="command" value="set">');
@@ -1043,9 +1055,7 @@
         my $csuname=$ENV{'user.name'};
         my $csudom=$ENV{'user.domain'};
 
-
         if ($parmlev eq 'full' || $parmlev eq 'brief') {
-
            my $coursespan=$csec?8:5;
            $r->print('<p><table border=2>');
            $r->print('<tr><td colspan=5></td>');
@@ -1586,7 +1596,6 @@
 
     $r->content_type('text/html');
     $r->send_http_header;
-
 # ----------------------------------------------------- Needs to be in a course
 
     if (($ENV{'request.course.id'}) &&