[LON-CAPA-cvs] cvs: loncom /interface groupsort.pm
banghart
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 25 Jul 2007 23:10:23 -0000
banghart Wed Jul 25 19:10:23 2007 EDT
Modified files:
/loncom/interface groupsort.pm
Log:
Bug 5314. Now remembers selections when changing directories.
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.59 loncom/interface/groupsort.pm:1.60
--- loncom/interface/groupsort.pm:1.59 Thu Jul 12 15:54:43 2007
+++ loncom/interface/groupsort.pm Wed Jul 25 19:10:23 2007
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.59 2007/07/12 19:54:43 albertel Exp $
+# $Id: groupsort.pm,v 1.60 2007/07/25 23:10:23 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,14 +45,15 @@
sub update_actions_hash {
my ($hash) = @_;
+ # be careful in here, there is also a global %hash
my $acts=$env{'form.acts'};
my @Acts=split(/b/,$acts);
my %ahash;
my %achash;
- my $ac=0;
# some initial hashes for working with data
+ my $ac=0;
foreach (@Acts) {
- my ($state,$ref)=split(/a/);
+ my ($state,$ref)=split(/a/);
$ahash{$ref}=$state;
$achash{$ref}=$ac;
$ac++;
@@ -60,15 +61,16 @@
# sorting through the actions and changing the global database hash
foreach my $key (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) {
if ($ahash{$key} eq '1') {
- $hash->{'store_'.$hash{'pre_'.$key.'_link'}}=
+ $hash->{'store_'.$hash->{'pre_'.$key.'_link'}}=
$hash->{'pre_'.$key.'_title'};
- $hash->{'storectr_'.$hash{'pre_'.$key.'_link'}}=
+ $hash->{'storectr_'.$hash->{'pre_'.$key.'_link'}}=
$hash->{'storectr'}+0;
$hash->{'storectr'}++;
}
if ($ahash{$key} eq '0') {
- if ($hash->{'store_'.$hash{'pre_'.$key.'_link'}}) {
- delete($hash->{'store_'.$hash{'pre_'.$key.'_link'}});
+ if ($hash->{'store_'.$hash->{'pre_'.$key.'_link'}}) {
+ delete($hash->{'store_'.$hash->{'pre_'.$key.'_link'}});
+ delete($hash->{'storectr_'.$hash->{'pre_'.$key.'_link'}});
}
}
}