--- loncom/interface/groupsort.pm 2010/08/24 09:11:37 1.67
+++ loncom/interface/groupsort.pm 2015/03/12 02:12:40 1.68.6.7
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.67 2010/08/24 09:11:37 wenzelju Exp $
+# $Id: groupsort.pm,v 1.68.6.7 2015/03/12 02:12:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,7 +37,7 @@ use GDBM_File;
use Apache::loncommon;
use Apache::lonlocal;
use Apache::lonnet;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
my $iconpath; # variable to be accessible to multiple subroutines
my %hash; # variable to tie to user specific database
@@ -59,7 +59,7 @@ sub update_actions_hash {
$ac++;
}
# sorting through the actions and changing the global database hash
- foreach my $key (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) {
+ foreach my $key (sort {$achash{$a}<=>$achash{$b}} (keys(%ahash))) {
if ($ahash{$key} eq '1') {
$hash->{'store_'.$hash->{'pre_'.$key.'_link'}}=
$hash->{'pre_'.$key.'_title'};
@@ -86,8 +86,8 @@ sub update_actions_hash {
sub readfromdb {
my ($r,$resources)=@_;
- my $diropendb =
- "/home/httpd/perl/tmp/$env{'user.domain'}_$env{'user.name'}_sel_res.db";
+ my $diropendb = LONCAPA::tempdir() .
+ "$env{'user.domain'}_$env{'user.name'}_sel_res.db";
# ----------------------------- diropendb is now the filename of the db to open
if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) {
@@ -152,12 +152,23 @@ sub readfromfile {
&Apache::lonnet::filelocation('',$env{'form.readfile'}));
} else {
my $parser = HTML::TokeParser->new(\$cont);
- my $token;
+ my ($token,$donechk,$allmaps);
+ $allmaps = {};
while ($token = $parser->get_token) {
if ($token->[0] eq 'S') {
if ($token->[1] eq 'resource') {
if ($env{'form.recover'}) {
if ($token->[2]->{'type'} ne 'zombie') { next; }
+ if ($token->[2]->{'src'} =~ /\.(page|sequence)$/) {
+ if (($env{'request.course.id'}) &&
+ ($env{'form.readfile'} =~ m{/default(|_\d+)\.(page|sequence)$})) {
+ unless ($donechk) {
+ $allmaps = &Apache::loncommon::allmaps_incourse();
+ $donechk = 1;
+ }
+ }
+ if ($allmaps->{$token->[2]->{'src'}}) { next; }
+ }
} else {
if ($token->[2]->{'type'} eq 'zombie') { next; }
}
@@ -181,7 +192,6 @@ sub readfromfile {
}
}
-
# ---------------------------------------------------------------- Main Handler
sub handler {
my $r = shift;
@@ -329,8 +339,8 @@ END
if ($env{'form.recover'}) {
$r->print(<