--- loncom/interface/londocs.pm 2003/10/08 17:34:33 1.86
+++ loncom/interface/londocs.pm 2004/09/14 01:21:49 1.142
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.86 2003/10/08 17:34:33 albertel Exp $
+# $Id: londocs.pm,v 1.142 2004/09/14 01:21:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@ use Apache::lonratedt;
use Apache::lonratsrv;
use Apache::lonxml;
use Apache::loncreatecourse;
+use Apache::lonnavmaps;
use HTML::Entities;
use GDBM_File;
use Apache::lonlocal;
@@ -68,10 +69,13 @@ sub mapread {
sub storemap {
my ($coursenum,$coursedom,$map)=@_;
- $hadchanges=1;
- return
+ my ($outtext,$errtext)=
&Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
$map,1);
+ if ($errtext) { return ($errtext,2); }
+
+ $hadchanges=1;
+ return ($errtext,0);
}
# ----------------------------------------- Return hash with valid author names
@@ -94,13 +98,15 @@ sub authorhosts {
} else {
($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/);
}
- if (&Apache::lonnet::homeserver($ca,$cd) eq
- $Apache::lonnet::perlvar{'lonHostID'}) {
+ my $allowed=0;
+ my $myhome=&Apache::lonnet::homeserver($ca,$cd);
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $myhome) { $allowed=1; } }
+ if ($allowed) {
$home++;
$outhash{'home_'.$ca.'@'.$cd}=1;
} else {
- $outhash{'otherhome_'.$ca.'@'.$cd}=
- &Apache::lonnet::homeserver($ca,$cd);
+ $outhash{'otherhome_'.$ca.'@'.$cd}=$myhome;
$other++;
}
}
@@ -116,7 +122,8 @@ sub dumpbutton {
if ($home) {
return '
'.
'';
+ &mt('Dump Course DOCS to Construction Space').'" />'.
+ &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
} else {
return'
'.
&mt('Dump Course DOCS to Construction Space: available on other servers');
@@ -138,7 +145,7 @@ sub dumpcourse {
# Do the dumping
unless ($outhash{'home_'.$ENV{'form.authorspace'}}) { return ''; }
my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});
- $r->print('
Copying Files
');
+ $r->print('
'.&mt('Copying Files').'
');
my $title=$ENV{'form.authorfolder'};
$title=~s/[^\w\/]+/\_/g;
my %replacehash=();
@@ -151,7 +158,7 @@ sub dumpcourse {
$crs=~s/\_/\//g;
foreach (keys %replacehash) {
my $newfilename=$title.'/'.$replacehash{$_};
- $newfilename=~s/[^\w\/\.]+/\_/g;
+ $newfilename=~s/[^\w\/\.\/]+/\_/g;
my @dirs=split(/\//,$newfilename);
my $path='/home/'.$ca.'/public_html';
my $makepath=$path;
@@ -195,7 +202,8 @@ sub dumpcourse {
$r->print(
'');
} else {
- $r->print('');
+ $r->print('');
}
}
}
@@ -218,7 +226,7 @@ sub dumpcourse {
$title=$_;
}
$title=~s/\.(\w+)$//;
- $title=~s/\W+/\_/gs;
+ $title=~s/[^\w\/]+/\_/gs;
$title.='.'.$ext;
$r->print("\n