--- loncom/interface/londocs.pm 2013/05/25 21:56:23 1.551
+++ loncom/interface/londocs.pm 2013/10/06 20:33:45 1.566
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.551 2013/05/25 21:56:23 raeburn Exp $
+# $Id: londocs.pm,v 1.566 2013/10/06 20:33:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,6 +56,7 @@ my $hashtied;
my %alreadyseen=();
my $hadchanges;
+my $suppchanges;
my %help=();
@@ -79,7 +80,11 @@ sub storemap {
$map,1,$report);
if ($errtext) { return ($errtext,2); }
- $hadchanges=1;
+ if ($map =~ /^default/) {
+ $hadchanges=1;
+ } else {
+ $suppchanges=1;
+ }
return ($errtext,0);
}
@@ -402,6 +407,13 @@ END
}
my ($errtext,$fatal) =
&storemap($coursenum, $coursedom, $folder.'.'.$container,1);
+ unless ($fatal) {
+ if ($folder =~ /^supplemental/) {
+ &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
+ my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
+ $folder.'.'.$container);
+ }
+ }
return ($errtext,$fatal,$fixuperrors);
}
@@ -700,7 +712,7 @@ sub update_paste_buffer {
my $url = $env{'docs.markedcopy_url_'.$suffix};
if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
($url ne '')) {
- $pasteurls{$cid.'_'.$url};
+ $pasteurls{$cid.'_'.$url} = 1;
}
}
}
@@ -1097,8 +1109,7 @@ sub do_paste_from_buffer {
}
my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,
- %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult,
- %msgs);
+ %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult);
foreach my $suffix (@topaste) {
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});
@@ -1299,7 +1310,7 @@ sub do_paste_from_buffer {
if ($prefix eq 'smppg') {
$msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;
} elsif ($prefix eq 'bulletinboard') {
- $msg = &mt('Paste failed: An error occurred when copying the bulletin board.').' '.$errtext;
+ $msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;
}
$results{$suffix} = $result;
$msgerrs{$suffix} = $msg;
@@ -1549,7 +1560,7 @@ sub get_newmap_url {
sub dbcopy {
my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;
my ($url,$result,$errtext);
- my $url = $dbref->{'src'};
+ $url = $dbref->{'src'};
if (ref($dbref) eq 'HASH') {
if ($url =~ m{/(smppg|bulletinboard)$}) {
my $prefix = $1;
@@ -1574,7 +1585,7 @@ sub dbcopy {
if ($prefix eq 'smppg') {
$errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);
} else {
- $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a bulletin board [_1].',$url);
+ $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url);
}
if ($error) {
$errtext .= '
'.$error;
@@ -1610,16 +1621,18 @@ sub dbcopy {
}
}
if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {
- $lockerrorsref->{$prefix} =
+ $lockerrorsref->{$prefix} =
'
'.$error.'
'); - } + } else { + if ($suppchanges) { + my %servers = &Apache::lonnet::internet_dom_servers($coursedom); + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $server (keys(%servers)) { + next if (grep(/^\Q$server\E$/,@ids)); + my $hashid=$coursenum.':'.$coursedom; + my $cachekey = &escape('suppcount').':'.&escape($hashid); + &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]); + } + &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1); + undef($suppchanges); + } + } } } elsif ($supplementalflag) { my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, @@ -5101,8 +5150,8 @@ sub remove_archive { } else { my $currcmd = $env{'form.cmd'}; my $position = $env{'form.position'}; - if ($position > 0) { - $env{'form.cmd'} = 'del_'.$position; + if ($position > 0) { + $env{'form.cmd'} = 'remove_'.$position; my ($title,$url,@rrest) = split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]); if (&handle_edit_cmd($docuname,$docudom)) { @@ -5137,13 +5186,13 @@ sub generate_admin_menu { my ($crstype) = @_; my $lc_crstype = lc($crstype); my ($home,$other,%outhash)=&authorhosts(); - my %lt=&Apache::lonlocal::texthash ( + my %lt= ( # do not translate here 'vc' => 'Verify Content', 'cv' => 'Check/Set Resource Versions', 'ls' => 'List Resource Identifiers', 'imse' => 'Export contents to IMS Archive', 'dcd' => "Dump $crstype Content to Authoring Space", - ); + ); my ($candump,$dumpurl); if ($home + $other > 0) { $candump = 'F';