[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Wed Dec 12 21:45:28 EST 2012
raeburn Thu Dec 13 02:45:28 2012 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface londocs.pm
Log:
- For 2.11
- Backport 1.504
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.14 loncom/interface/londocs.pm:1.484.2.15
--- loncom/interface/londocs.pm:1.484.2.14 Thu Dec 13 02:35:08 2012
+++ loncom/interface/londocs.pm Thu Dec 13 02:45:27 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.14 2012/12/13 02:35:08 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.15 2012/12/13 02:45:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1828,6 +1828,18 @@
if (defined($item)) {
my ($name,$url,$residx)=
map {&unescape($_)} split(/\=/,$item);
+ if ($url=~ m{^\Q/uploaded/$coursedom/$coursenum/\E(default|supplemental)_new\.(sequence|page)$}) {
+ my ($suffix,$errortxt,$locknotfreed) =
+ &newmap_suffix($1,$2,$coursedom,$coursenum);
+ if ($locknotfreed) {
+ $r->print($locknotfreed);
+ }
+ if ($suffix) {
+ $url =~ s/_new\./_$suffix./;
+ } else {
+ return $errortxt;
+ }
+ }
push(@imports, [$name, $url, $residx]);
}
}
@@ -2537,6 +2549,30 @@
return $line;
}
+sub newmap_suffix {
+ my ($area,$container,$coursedom,$coursenum) = @_;
+ my ($prefix,$idtype,$errtext,$locknotfreed);
+ $prefix = 'docs';
+ if ($area eq 'supplemental') {
+ $prefix = 'supp';
+ }
+ $prefix .= $container;
+ $idtype = 'concat';
+ my ($suffix,$freedlock,$error) =
+ &Apache::lonnet::get_timebased_id($prefix,'num','uploadedmaps',
+ $coursedom,$coursenum);
+ if (!$suffix) {
+ $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new folder/page.');
+ if ($error) {
+ $errtext .= '<br />'.$error;
+ }
+ }
+ if ($freedlock ne 'ok') {
+ $locknotfreed = '<div class="LC_error">'.&mt('There was a problem removing a lockfile. This will prevent creation of additional folders or composite pages in this course. Please contact the domain coordinator for your LON-CAPA domain.').'</div>';
+ }
+ return ($suffix,$errtext,$locknotfreed);
+}
+
=pod
=item tiehash()
@@ -3734,9 +3770,9 @@
} else {
#$postexec='self.close();';
}
- my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
+ my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence';
'.sequence';
- my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
+ my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page';
'.page';
my $container='sequence';
if ($env{'form.pagepath'}) {
@@ -3964,8 +4000,7 @@
$env{'form.pagepath'} = '';
if ($allowed) {
my $folderseq=
- '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
- '.sequence';
+ '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_new.sequence';
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
More information about the LON-CAPA-cvs
mailing list