--- rat/lonsequence.pm 2007/01/16 21:19:11 1.30 +++ rat/lonsequence.pm 2007/07/11 23:51:02 1.31 @@ -2,7 +2,7 @@ # # Sequence Handler # -# $Id: lonsequence.pm,v 1.30 2007/01/16 21:19:11 albertel Exp $ +# $Id: lonsequence.pm,v 1.31 2007/07/11 23:51:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use GDBM_File; use LONCAPA::map(); use Apache::lonpageflip(); use Apache::loncommon(); +use Apache::groupsort(); use Apache::lonlocal; use HTML::Entities(); @@ -114,46 +115,9 @@ ENDSELECT $successtied=1; # - Evaluate actions from previous page (both cumulatively and chronologically) - if ($env{'form.catalogmode'} eq 'import') { - my $acts=$env{'form.acts'}; - my @Acts=split(/b/,$acts); - my %ahash; - my %achash; - my $ac=0; - # some initial hashes for working with data - foreach (@Acts) { - my ($state,$ref)=split(/a/); - $ahash{$ref}=$state; - $achash{$ref}=$ac; - $ac++; + if ($env{'form.catalogmode'} eq 'import') { + &Apache::groupsort::update_actions_hash(\%selhash); } - # sorting through the actions and changing the tied database hash - foreach (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) { - my $key=$_; - if ($ahash{$key} eq '1') { - $selhash{'store_'.$selhash{'pre_'.$key.'_link'}}= - $selhash{'pre_'.$key.'_title'}; - $selhash{'storectr_'.$selhash{'pre_'.$key.'_link'}}= - $selhash{'storectr'}+0; - $selhash{'storectr'}++; - } - if ($ahash{$key} eq '0') { - if ($selhash{'store_'.$selhash{'pre_'.$key.'_link'}}) { - delete $selhash{'store_'.$selhash{'pre_'.$key.'_link'}}; - } - } - } - # deleting the previously cached listing - foreach (keys %selhash) { - if ($_ =~ /^pre_/ && $_ =~/link$/) { - my $key = $_; - $key =~ s/^pre_//; - $key =~ s/_[^_]*$//; - delete $selhash{'pre_'.$key.'_title'}; - delete $selhash{'pre_'.$key.'_link'}; - } - } - } # - } }