[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface groupsort.pm
raeburn
raeburn at source.lon-capa.org
Wed Jan 9 11:41:03 EST 2013
raeburn Wed Jan 9 16:41:03 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface groupsort.pm
Log:
- For 2.11
- Backport 1.71, 1.72.
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.68.6.4 loncom/interface/groupsort.pm:1.68.6.5
--- loncom/interface/groupsort.pm:1.68.6.4 Tue Jan 8 03:51:06 2013
+++ loncom/interface/groupsort.pm Wed Jan 9 16:41:03 2013
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.68.6.4 2013/01/08 03:51:06 raeburn Exp $
+# $Id: groupsort.pm,v 1.68.6.5 2013/01/09 16:41:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -152,17 +152,22 @@
&Apache::lonnet::filelocation('',$env{'form.readfile'}));
} else {
my $parser = HTML::TokeParser->new(\$cont);
- my ($token,$donechk,%allmaps);
+ 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)$/) {
- unless ($donechk) {
- $donechk = &get_allmaps(\%allmaps);
+ 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; }
+ if ($allmaps->{$token->[2]->{'src'}}) { next; }
}
} else {
if ($token->[2]->{'type'} eq 'zombie') { next; }
@@ -187,35 +192,6 @@
}
}
-sub get_allmaps {
- my ($allmaps) = @_;
- return unless (ref($allmaps) eq 'HASH');
- if (($env{'form.recover'}) &&
- ($env{'request.course.id'}) &&
- ($env{'form.readfile'} =~ m{/default(|_\d+)\.(page|sequence)$})) {
- my $cid = $env{'request.course.id'};
- my $cdom = $env{'course.'.$cid.'.domain'};
- my $cnum = $env{'course.'.$cid.'.num'};
- my $chome = $env{'course.'.$cid.'.home'};
- my $lastchange =
- &Apache::lonnet::get_coursechange($cdom,$cnum);
- if ($lastchange > $env{'request.course.tied'}) {
- my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
- unless ($ferr) {
- &Apache::loncommon::update_content_constraints($cdom,$cnum,
- $chome,$cid);
- }
- }
- my $navmap = Apache::lonnavmaps::navmap->new();
- if (defined($navmap)) {
- foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_map() },1,0,1)) {
- $allmaps->{$res->src()} = 1;
- }
- }
- }
- return 1;
-}
-
# ---------------------------------------------------------------- Main Handler
sub handler {
my $r = shift;
@@ -452,7 +428,7 @@
} else {
$r->print($resource->{'title'});
}
- $r->print($resource->{'notes'}."</td><td>\n");
+ $r->print($resource->{'notes'}."</td><td>\n");
$r->print($resource->{'url'}."</td>"
.&Apache::loncommon::end_data_table_row()
."\n");
More information about the LON-CAPA-cvs
mailing list