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

www lon-capa-cvs@mail.lon-capa.org
Fri, 18 Mar 2005 15:17:36 -0000


www		Fri Mar 18 10:17:36 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Stop people from setting parameters for non-existing sections and wondering
  what happened.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.188 loncom/interface/lonparmset.pm:1.189
--- loncom/interface/lonparmset.pm:1.188	Thu Mar 17 17:34:24 2005
+++ loncom/interface/lonparmset.pm	Fri Mar 18 10:17:36 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.188 2005/03/17 22:34:24 www Exp $
+# $Id: lonparmset.pm,v 1.189 2005/03/18 15:17:36 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -474,8 +474,21 @@
 </form>
 <hr />
 ENDHEAD2
-}
-    $r->print(<<ENDHEAD3);
+    }
+    my %sectionhash=();
+    my $sections='';
+    if (&Apache::loncommon::get_sections(
+                 $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+                 $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
+					 \%sectionhash)) {
+        $sections=$lt{'sg'}.': <select name="csec">';
+	foreach ('',sort keys %sectionhash) {
+	    $sections.='<option value="'.$_.'"'.
+		($_ eq $csec?'selected="selected"':'').'>'.$_.'</option>';
+        }
+        $sections.='</select>';
+     }
+     $r->print(<<ENDHEAD3);
 <form method="post" action="/adm/parmset" name="parmform">
 <h4>$lt{'captm'}</h4>
 ENDHEAD3
@@ -485,8 +498,7 @@
     } else {
 	$r->print(<<ENDHEAD);
 <b>
-$lt{'sg'}:
-<input type="text" value="$csec" size="6" name="csec" />
+$sections
 <br />
 $lt{'fu'} 
 <input type="text" value="$uname" size="12" name="uname" />