--- loncom/interface/londocs.pm 2013/01/14 23:14:59 1.484.2.25
+++ loncom/interface/londocs.pm 2013/01/09 04:31:57 1.529
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.25 2013/01/14 23:14:59 raeburn Exp $
+# $Id: londocs.pm,v 1.529 2013/01/09 04:31:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -152,7 +152,7 @@ sub dumpcourse {
$r->print(&endContentScreen());
return '';
}
- my ($ca,$cd)=split(/\:/,$env{'form.authorspace'});
+ my ($ca,$cd)=split(/\@/,$env{'form.authorspace'});
$r->print('
'.&mt('Copying Files').'
');
my $title=$env{'form.authorfolder'};
$title=&clean($title);
@@ -337,7 +337,7 @@ sub group_import {
);
&apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated);
if (keys(%import_errors) > 0) {
- $fixuperrors =
+ $fixuperrors =
''."\n".
&mt('The following files are either dependencies of a web page or references within a folder and/or composite page for which errors occurred during import:')."\n".
'
'."\n";
@@ -1066,7 +1066,7 @@ sub do_paste_from_buffer {
copies => \%copies,
docmoves => \%docmoves,
mapmoves => \%mapmoves,
- );
+ );
$result =
&apply_fixups($folder,$is_map,$coursedom,$coursenum,$errors,
\%updated,\%info,\%moves,$prefixchg,$oldurl,$url,'paste');
@@ -1282,13 +1282,13 @@ sub url_paste_fixups {
my $title = $token->[2]->{'title'};
if ($checktitle) {
if ($title =~ m{\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) {
- $retitles->{$oldurl}{$id} = $ressrc;
+ $retitles->{$oldurl}{$ressrc} = $id;
}
}
next if ($token->[2]->{'type'} eq 'external');
if ($token->[2]->{'type'} eq 'zombie') {
next if ($skip);
- $zombies->{$oldurl}{$id} = $ressrc;
+ $zombies->{$oldurl}{$ressrc} = $id;
$changed = 1;
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {
my $srcdom = $1;
@@ -1321,7 +1321,7 @@ sub url_paste_fixups {
($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) {
if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) {
- $rewrites->{$oldurl}{$id} = $ressrc;
+ $rewrites->{$oldurl}{$ressrc} = $id;
$mapchanges->{$ressrc} = 1;
unless (&url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,$allmaps,
$rewrites,$retitles,$copies,$dbcopies,$zombies,
@@ -1331,7 +1331,7 @@ sub url_paste_fixups {
}
$changed = 1;
} else {
- $rewrites->{$oldurl}{$id} = $ressrc;
+ $rewrites->{$oldurl}{$ressrc} = $id;
$copies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
@@ -1341,7 +1341,7 @@ sub url_paste_fixups {
my $srcdom = $1;
my $srcnum = $2;
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
- $rewrites->{$oldurl}{$id} = $ressrc;
+ $rewrites->{$oldurl}{$ressrc} = $id;
$dbcopies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
@@ -1350,7 +1350,7 @@ sub url_paste_fixups {
my $srcdom = $1;
my $srcnum = $2;
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
- $rewrites->{$oldurl}{$id} = $ressrc;
+ $rewrites->{$oldurl}{$ressrc} = $id;
$dbcopies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
@@ -1436,7 +1436,7 @@ sub apply_fixups {
}
if ($key eq $oldurl) {
if ((exists($docmoves{$key}))) {
- unless (grep(/^\Q$oldurl\E$/,@allcopies)) {
+ unless (grep(/^\Q$oldurl\E/,@allcopies)) {
push(@allcopies,$oldurl);
}
}
@@ -1458,7 +1458,7 @@ sub apply_fixups {
$storefn =~ s/^\Q$before{'doc'}\E/$after{'doc'}/;
}
if ($newsubdir{$key}) {
- $storefn =~ s#^(docs|supplemental)/\Q$oldsubdir\E/#$1/$newsubdir{$key}/#;
+ $storefn =~ s#^(docs|supplemental)/\Q$oldsubdir\E/#$1/$newsubdir{$key}#;
}
}
©_dependencies($item,$storefn,$relpath,$errors,\$content);
@@ -1545,7 +1545,7 @@ sub apply_fixups {
for (my $i=0; $i<@LONCAPA::map::zombies; $i++) {
if (defined($LONCAPA::map::zombies[$i])) {
my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::zombies[$i]);
- if ($zombie{$i} eq $src) {
+ if ($zombie{$src} eq $i) {
undef($LONCAPA::map::zombies[$i]);
}
}
@@ -1565,12 +1565,12 @@ sub apply_fixups {
next;
}
my $origsrc = $src;
- if ((exists($toretitle{$idx})) && ($toretitle{$idx} eq $src)) {
+ if ((exists($toretitle{$src})) && ($toretitle{$src} eq $idx)) {
if ($title =~ m{^\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) {
$changed = 1;
}
}
- if ((exists($torewrite{$idx})) && ($torewrite{$idx} eq $src)) {
+ if ((exists($torewrite{$src})) && ($torewrite{$src} eq $idx)) {
$src =~ s{^/(uploaded|adm|public)/$match_domain/$match_courseid/}{/$1/$cdom/$cnum/};
if ($origsrc =~ m{^/uploaded/}) {
if ($prefixchg && $before{'map'} && $after{'map'}) {
@@ -1580,12 +1580,12 @@ sub apply_fixups {
$src =~ s#^(/uploaded/$match_domain/$match_courseid/)\Q$before{'doc'}\E#$1$after{'doc'}#;
}
}
- if ($origsrc =~ /\.(page|sequence)$/) {
- if ($newsubdir{$origsrc}) {
+ if ($newsubdir{$origsrc}) {
+ if ($src =~ /\.(page|sequence)$/) {
$src =~ s#^(/uploaded/$match_domain/$match_courseid/(?:default|supplemental)_)(\d+)#$1$newsubdir{$origsrc}#;
+ } else {
+ $src =~ s#^(/uploaded/$match_domain/$match_courseid/\w+/)(\d+)#$1$newsubdir{$origsrc}#;
}
- } elsif ($newsubdir{$key}) {
- $src =~ s#^(/uploaded/$match_domain/$match_courseid/\w+/)(\d+)#$1$newsubdir{$key}#;
}
}
$changed = 1;
@@ -1872,7 +1872,7 @@ sub editor {
push(@imports, [$name, $url, $residx]);
}
}
- ($errtext,$fatal,my $fixuperrors) =
+ ($errtext,$fatal,my $fixuperrors) =
&group_import($coursenum, $coursedom, $folder,$container,
'londocs',@imports);
return $errtext if ($fatal);
@@ -3158,6 +3158,7 @@ sub startContentScreen {
if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
$output .= '- '.&mt('Content Overview').'
'."\n";
$output .= '- '.&mt('Content Search').'
'."\n";
+ $output .= '- '.&mt('Content Index').'
'."\n";
$output .= '- '.&mt('Supplemental Content').'
';
} else {
$output .= '- '.&mt('Content Editor').'
'."\n";
@@ -3304,11 +3305,11 @@ sub handler {
if ($env{'form.symb'} ne '') {
$env{'form.folderpath'}=
&Apache::loncommon::symb_to_docspath($env{'form.symb'});
- &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} =>
+ &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} =>
$env{'form.command'}.'_'.$env{'form.symb'}});
} elsif ($env{'form.supppath'} ne '') {
$env{'form.folderpath'}=$env{'form.supppath'};
- &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} =>
+ &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} =>
$env{'form.command'}.'_'.$env{'form.supppath'}});
}
} elsif ($env{'form.command'} eq 'editdocs') {
@@ -4416,8 +4417,8 @@ sub editing_js {
my $toplevelsupp = &supplemental_base();
my $backtourl;
- if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) {
- my $caller = $1;
+ if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) {
+ my $caller = $1;
if ($caller =~ /^supplemental/) {
$backtourl = '/adm/supplemental?folderpath='.&escape($caller);
} else {