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

www lon-capa-cvs@mail.lon-capa.org
Sun, 03 Nov 2002 19:05:31 -0000


www		Sun Nov  3 14:05:31 2002 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Bug #927
  "grep" in part selection grep'd too much, so specific part selection did not 
  work. Default mode is now to only show part 0.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.75 loncom/interface/lonparmset.pm:1.76
--- loncom/interface/lonparmset.pm:1.75	Mon Oct 28 18:28:52 2002
+++ loncom/interface/lonparmset.pm	Sun Nov  3 14:05:31 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.75 2002/10/28 23:28:52 albertel Exp $
+# $Id: lonparmset.pm,v 1.76 2002/11/03 19:05:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -657,6 +657,7 @@
     my @pscat=&get_env_multiple('form.pscat');
     my $pschp=$ENV{'form.pschp'};
     my @psprt=&get_env_multiple('form.psprt');
+    if (!@psprt) { $psprt[0]='0'; }
     my $showoptions=$ENV{'form.showoptions'};
 
     my $pssymb='';
@@ -930,7 +931,6 @@
         $r->print('>All Parameters</td>');
 
         my $cnt=0;
-
         foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} }
                       keys %allparms ) {
             ++$cnt;
@@ -949,10 +949,12 @@
         $r->print('<option value="all"');
         $r->print(' selected') unless (@psprt);
         $r->print('>All Parts</option>');
+        my %temphash=();
+        foreach (@psprt) { $temphash{$_}=1; }
         foreach $tempkey (sort keys %allparts) {
             unless ($tempkey =~ /\./) {
                 $r->print('<option value="'.$tempkey.'"');
-                if ($psprt[0] eq "all" ||  grep $_ == $tempkey, @psprt) {
+                if ($psprt[0] eq "all" ||  $temphash{$tempkey}) {
                     $r->print(' selected');
                 }
                 $r->print('>'.$allparts{$tempkey}.'</option>');
@@ -999,12 +1001,12 @@
     }
     $r->print('</table>');
 
-    my @temp_psprt;
-    foreach my $t (@psprt) {
-	push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));
-    }
+#    my @temp_psprt;
+#    foreach my $t (@psprt) {
+#	push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));
+#    }
 
-    @psprt = @temp_psprt;
+#    @psprt = @temp_psprt;
 
     my @temp_pscat;
     map {