--- loncom/interface/groupsort.pm 2001/12/11 03:19:16 1.4 +++ loncom/interface/groupsort.pm 2002/05/09 23:07:36 1.9 @@ -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.9 2002/05/09 23:07:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,6 +28,8 @@ # # YEAR=2001 # 8/7,8/8,10/14,10/15,12/10 Scott Harrison +# YEAR=2002 +# 1/17 Scott Harrison # ### @@ -44,6 +46,9 @@ my $iconpath; # variable to be accessibl # ---------------------------------------------------------------- Main Handler sub handler { my $r = shift; + + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['acts','catalogmode','mode']); # color scheme my $fileclr = '#ffffe6'; @@ -53,7 +58,38 @@ sub handler { $r->send_http_header; return OK if $r->header_only; - # output start of web page +# finish_import looks different for graphical or "simple" RAT + my $finishimport=''; + if ($ENV{'form.mode'} eq 'simple') { + $finishimport=(<print(< @@ -73,24 +109,7 @@ function placeResourceInLastRow (title,u } opener.linkmode=opener.mostrecent; } -function finish_import() { - var linkflag=false; - for (var num=0; num$dindext) { + $diropendb=$dsearch; + } + else { + $diropendb=$dindex; + } + } if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) { my $acts = $ENV{'form.acts'}; my @Acts = split(/b/,$acts); 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 +194,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 +290,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 +305,7 @@ END $r->print(""); $r->print("$thash{$key}\n"); $r->print("$key\n"); - } sort {$shash{$a}<=>$shash{$b}} (keys %shash); + } $r->print(""); $r->print(<