--- loncom/interface/groupsort.pm 2001/12/11 03:19:16 1.4 +++ loncom/interface/groupsort.pm 2001/12/11 03:37:11 1.5 @@ -2,7 +2,7 @@ # The LON-CAPA group sort handler # Allows for sorting prior to import into RAT. # -# $Id: groupsort.pm,v 1.4 2001/12/11 03:19:16 harris41 Exp $ +# $Id: groupsort.pm,v 1.5 2001/12/11 03:37:11 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -114,7 +114,7 @@ END my %shash; # sort order (key is resource location, value is sort order) my %thash; # title (key is resource location, value is title) - map { + foreach (split(/&/,$ENV{'QUERY_STRING'})) { my ($name, $value) = split(/=/,$_); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; @@ -124,7 +124,7 @@ END if ($name eq 'catalogmode') { $ENV{'form.'.$name}=$value; } - } (split(/&/,$ENV{'QUERY_STRING'})); + } my $diropendb; if ($ENV{'form.catalogmode'} eq 'groupsearch') { $diropendb = @@ -140,13 +140,13 @@ END my %ahash; my %achash; my $ac = 0; - map { + foreach (@Acts) { my ($state,$ref) = split(/a/); $ahash{$ref} = $state; $achash{$ref} = $ac; $ac++; - } (@Acts); - map { + } + foreach (sort {$achash{$a} <=> $achash{$b}} (keys %ahash)) { my $key = $_; if ($ahash{$key} eq '1') { # my $keyz=join("
",keys %hash); @@ -162,25 +162,25 @@ END delete $hash{'store_'.$hash{'pre_'.$key.'_link'}}; } } - } sort {$achash{$a} <=> $achash{$b}} (keys %ahash); - map { + } + foreach (keys %hash) { if ($_ =~ /^store_/) { my $key = $_; $key =~ s/^store_//; $shash{$key} = $hash{'storectr_'.$key}; $thash{$key} = $hash{'store_'.$key}; } - } keys %hash; + } if ($ENV{'form.oldval'}) { my $newctr = 0; my %chash; - map { + foreach (sort {$shash{$a} <=> $shash{$b}} (keys %shash)) { my $key = $_; $newctr++; $shash{$key} = $newctr; $hash{'storectr_'.$key} = $newctr; $chash{$newctr} = $key; - } sort {$shash{$a} <=> $shash{$b}} (keys %shash); + } my $oldval = $ENV{'form.oldval'}; my $newval = $ENV{'form.newval'}; if ($oldval != $newval) { @@ -258,7 +258,7 @@ END "\n"); $r->print("Title\n"); $r->print("Path\n"); - map { + foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) { my $key=$_; $ctr++; my @file_ext = split(/\./,$key); @@ -273,7 +273,7 @@ END $r->print(""); $r->print("$thash{$key}\n"); $r->print("$key\n"); - } sort {$shash{$a}<=>$shash{$b}} (keys %shash); + } $r->print(""); $r->print(<