--- loncom/interface/londocs.pm 2008/11/17 14:46:10 1.315
+++ loncom/interface/londocs.pm 2008/12/19 18:57:43 1.325
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.315 2008/11/17 14:46:10 jms Exp $
+# $Id: londocs.pm,v 1.325 2008/12/19 18:57:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,20 +27,6 @@
#
-=head1 NAME
-
-Apache::londocs
-
-=head1 SYNOPSIS
-
-This is part of the LearningOnline Network with CAPA project
-described at http://www.lon-capa.org.
-
-=head1 SUBROUTINES
-
-=over
-
-=cut
package Apache::londocs;
@@ -70,26 +56,9 @@ my %alreadyseen=();
my $hadchanges;
-=pod
-
-=item %help=()
-
- Available help topics
-
-=cut
-
my %help=();
-=pod
-=item mapread()
-
-Mapread read maps into LONCAPA::map:: global arrays
-@order and @resources, determines status
-sets @order - pointer to resources in right order
-sets @resources - array with the resources with correct idx
-
-=cut
sub mapread {
my ($coursenum,$coursedom,$map)=@_;
@@ -110,26 +79,19 @@ sub storemap {
}
-=pod
-
-=item authorhosts()
-
- Return hash with valid author names
-
-=cut
sub authorhosts {
my %outhash=();
my $home=0;
my $other=0;
- foreach (keys %env) {
- if ($_=~/^user\.role\.(au|ca)\.(.+)$/) {
+ foreach my $key (keys(%env)) {
+ if ($key=~/^user\.role\.(au|ca)\.(.+)$/) {
my $role=$1;
my $realm=$2;
- my ($start,$end)=split(/\./,$env{$_});
+ my ($start,$end)=split(/\./,$env{$key});
if (($start) && ($start>time)) { next; }
if (($end) && (time>$end)) { next; }
- my $ca; my $cd;
+ my ($ca,$cd);
if ($1 eq 'au') {
$ca=$env{'user.name'};
$cd=$env{'user.domain'};
@@ -151,13 +113,7 @@ sub authorhosts {
}
return ($home,$other,%outhash);
}
-=pod
-
-=item dumpbutton()
-
- Generate "dump" button
-=cut
sub dumpbutton {
my ($home,$other,%outhash)=&authorhosts();
@@ -183,13 +139,7 @@ sub clean {
return $title;
}
-=pod
-
-=item dumpcourse()
- Actually dump course
-
-=cut
sub dumpcourse {
my ($r) = @_;
@@ -209,15 +159,15 @@ sub dumpcourse {
my $title=$env{'form.authorfolder'};
$title=&clean($title);
my %replacehash=();
- foreach (keys %env) {
- if ($_=~/^form\.namefor\_(.+)/) {
- $replacehash{$1}=$env{$_};
+ foreach my $key (keys(%env)) {
+ if ($key=~/^form\.namefor\_(.+)/) {
+ $replacehash{$1}=$env{$key};
}
}
my $crs='/uploaded/'.$env{'request.course.id'}.'/';
$crs=~s/\_/\//g;
- foreach (keys %replacehash) {
- my $newfilename=$title.'/'.$replacehash{$_};
+ foreach my $item (keys(%replacehash)) {
+ my $newfilename=$title.'/'.$replacehash{$item};
$newfilename=~s/\.(\w+)$//;
my $ext=$1;
$newfilename=&clean($newfilename);
@@ -232,16 +182,16 @@ sub dumpcourse {
unless(mkdir($makepath,0777)) { $fail=1; }
}
}
- $r->print('
'.$_.' => '.$newfilename.': ');
+ $r->print('
'.$item.' => '.$newfilename.': ');
if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) {
- if ($_=~/\.(sequence|page|html|htm|xml|xhtml)$/) {
+ if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) {
print $fh &Apache::lonclonecourse::rewritefile(
- &Apache::lonclonecourse::readfile($env{'request.course.id'},$_),
+ &Apache::lonclonecourse::readfile($env{'request.course.id'},$item),
(%replacehash,$crs => '')
);
} else {
print $fh
- &Apache::lonclonecourse::readfile($env{'request.course.id'},$_);
+ &Apache::lonclonecourse::readfile($env{'request.course.id'},$item);
}
$fh->close();
} else {
@@ -259,8 +209,8 @@ sub dumpcourse {
$r->print(
'