version 1.529, 2013/01/09 04:31:57
|
version 1.532, 2013/01/14 20:32:04
|
Line 152 sub dumpcourse {
|
Line 152 sub dumpcourse {
|
$r->print(&endContentScreen()); |
$r->print(&endContentScreen()); |
return ''; |
return ''; |
} |
} |
my ($ca,$cd)=split(/\@/,$env{'form.authorspace'}); |
my ($ca,$cd)=split(/\:/,$env{'form.authorspace'}); |
$r->print('<h3>'.&mt('Copying Files').'</h3>'); |
$r->print('<h3>'.&mt('Copying Files').'</h3>'); |
my $title=$env{'form.authorfolder'}; |
my $title=$env{'form.authorfolder'}; |
$title=&clean($title); |
$title=&clean($title); |
Line 337 sub group_import {
|
Line 337 sub group_import {
|
); |
); |
&apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated); |
&apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated); |
if (keys(%import_errors) > 0) { |
if (keys(%import_errors) > 0) { |
$fixuperrors = |
$fixuperrors = |
'<p span class="LC_warning">'."\n". |
'<p span class="LC_warning">'."\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". |
&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". |
'<ul>'."\n"; |
'<ul>'."\n"; |
Line 1066 sub do_paste_from_buffer {
|
Line 1066 sub do_paste_from_buffer {
|
copies => \%copies, |
copies => \%copies, |
docmoves => \%docmoves, |
docmoves => \%docmoves, |
mapmoves => \%mapmoves, |
mapmoves => \%mapmoves, |
); |
); |
$result = |
$result = |
&apply_fixups($folder,$is_map,$coursedom,$coursenum,$errors, |
&apply_fixups($folder,$is_map,$coursedom,$coursenum,$errors, |
\%updated,\%info,\%moves,$prefixchg,$oldurl,$url,'paste'); |
\%updated,\%info,\%moves,$prefixchg,$oldurl,$url,'paste'); |
Line 1282 sub url_paste_fixups {
|
Line 1282 sub url_paste_fixups {
|
my $title = $token->[2]->{'title'}; |
my $title = $token->[2]->{'title'}; |
if ($checktitle) { |
if ($checktitle) { |
if ($title =~ m{\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) { |
if ($title =~ m{\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) { |
$retitles->{$oldurl}{$ressrc} = $id; |
$retitles->{$oldurl}{$id} = $ressrc; |
} |
} |
} |
} |
next if ($token->[2]->{'type'} eq 'external'); |
next if ($token->[2]->{'type'} eq 'external'); |
if ($token->[2]->{'type'} eq 'zombie') { |
if ($token->[2]->{'type'} eq 'zombie') { |
next if ($skip); |
next if ($skip); |
$zombies->{$oldurl}{$ressrc} = $id; |
$zombies->{$oldurl}{$id} = $ressrc; |
$changed = 1; |
$changed = 1; |
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { |
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { |
my $srcdom = $1; |
my $srcdom = $1; |
Line 1321 sub url_paste_fixups {
|
Line 1321 sub url_paste_fixups {
|
($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) { |
($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) { |
|
|
if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) { |
if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) { |
$rewrites->{$oldurl}{$ressrc} = $id; |
$rewrites->{$oldurl}{$id} = $ressrc; |
$mapchanges->{$ressrc} = 1; |
$mapchanges->{$ressrc} = 1; |
unless (&url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,$allmaps, |
unless (&url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,$allmaps, |
$rewrites,$retitles,$copies,$dbcopies,$zombies, |
$rewrites,$retitles,$copies,$dbcopies,$zombies, |
Line 1331 sub url_paste_fixups {
|
Line 1331 sub url_paste_fixups {
|
} |
} |
$changed = 1; |
$changed = 1; |
} else { |
} else { |
$rewrites->{$oldurl}{$ressrc} = $id; |
$rewrites->{$oldurl}{$id} = $ressrc; |
$copies->{$oldurl}{$ressrc} = $id; |
$copies->{$oldurl}{$ressrc} = $id; |
$changed = 1; |
$changed = 1; |
} |
} |
Line 1341 sub url_paste_fixups {
|
Line 1341 sub url_paste_fixups {
|
my $srcdom = $1; |
my $srcdom = $1; |
my $srcnum = $2; |
my $srcnum = $2; |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
$rewrites->{$oldurl}{$ressrc} = $id; |
$rewrites->{$oldurl}{$id} = $ressrc; |
$dbcopies->{$oldurl}{$ressrc} = $id; |
$dbcopies->{$oldurl}{$ressrc} = $id; |
$changed = 1; |
$changed = 1; |
} |
} |
Line 1350 sub url_paste_fixups {
|
Line 1350 sub url_paste_fixups {
|
my $srcdom = $1; |
my $srcdom = $1; |
my $srcnum = $2; |
my $srcnum = $2; |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
$rewrites->{$oldurl}{$ressrc} = $id; |
$rewrites->{$oldurl}{$id} = $ressrc; |
$dbcopies->{$oldurl}{$ressrc} = $id; |
$dbcopies->{$oldurl}{$ressrc} = $id; |
$changed = 1; |
$changed = 1; |
} |
} |
Line 1436 sub apply_fixups {
|
Line 1436 sub apply_fixups {
|
} |
} |
if ($key eq $oldurl) { |
if ($key eq $oldurl) { |
if ((exists($docmoves{$key}))) { |
if ((exists($docmoves{$key}))) { |
unless (grep(/^\Q$oldurl\E/,@allcopies)) { |
unless (grep(/^\Q$oldurl\E$/,@allcopies)) { |
push(@allcopies,$oldurl); |
push(@allcopies,$oldurl); |
} |
} |
} |
} |
Line 1458 sub apply_fixups {
|
Line 1458 sub apply_fixups {
|
$storefn =~ s/^\Q$before{'doc'}\E/$after{'doc'}/; |
$storefn =~ s/^\Q$before{'doc'}\E/$after{'doc'}/; |
} |
} |
if ($newsubdir{$key}) { |
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); |
©_dependencies($item,$storefn,$relpath,$errors,\$content); |
Line 1545 sub apply_fixups {
|
Line 1545 sub apply_fixups {
|
for (my $i=0; $i<@LONCAPA::map::zombies; $i++) { |
for (my $i=0; $i<@LONCAPA::map::zombies; $i++) { |
if (defined($LONCAPA::map::zombies[$i])) { |
if (defined($LONCAPA::map::zombies[$i])) { |
my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::zombies[$i]); |
my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::zombies[$i]); |
if ($zombie{$src} eq $i) { |
if ($zombie{$i} eq $src) { |
undef($LONCAPA::map::zombies[$i]); |
undef($LONCAPA::map::zombies[$i]); |
} |
} |
} |
} |
Line 1565 sub apply_fixups {
|
Line 1565 sub apply_fixups {
|
next; |
next; |
} |
} |
my $origsrc = $src; |
my $origsrc = $src; |
if ((exists($toretitle{$src})) && ($toretitle{$src} eq $idx)) { |
if ((exists($toretitle{$idx})) && ($toretitle{$idx} eq $src)) { |
if ($title =~ m{^\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) { |
if ($title =~ m{^\d+\Q___&&&___\E$match_username\Q___&&&___\E$match_domain\Q___&&&___\E(.+)$}) { |
$changed = 1; |
$changed = 1; |
} |
} |
} |
} |
if ((exists($torewrite{$src})) && ($torewrite{$src} eq $idx)) { |
if ((exists($torewrite{$idx})) && ($torewrite{$idx} eq $src)) { |
$src =~ s{^/(uploaded|adm|public)/$match_domain/$match_courseid/}{/$1/$cdom/$cnum/}; |
$src =~ s{^/(uploaded|adm|public)/$match_domain/$match_courseid/}{/$1/$cdom/$cnum/}; |
if ($origsrc =~ m{^/uploaded/}) { |
if ($origsrc =~ m{^/uploaded/}) { |
if ($prefixchg && $before{'map'} && $after{'map'}) { |
if ($prefixchg && $before{'map'} && $after{'map'}) { |
Line 1580 sub apply_fixups {
|
Line 1580 sub apply_fixups {
|
$src =~ s#^(/uploaded/$match_domain/$match_courseid/)\Q$before{'doc'}\E#$1$after{'doc'}#; |
$src =~ s#^(/uploaded/$match_domain/$match_courseid/)\Q$before{'doc'}\E#$1$after{'doc'}#; |
} |
} |
} |
} |
if ($newsubdir{$origsrc}) { |
if ($origsrc =~ /\.(page|sequence)$/) { |
if ($src =~ /\.(page|sequence)$/) { |
if ($newsubdir{$origsrc}) { |
$src =~ s#^(/uploaded/$match_domain/$match_courseid/(?:default|supplemental)_)(\d+)#$1$newsubdir{$origsrc}#; |
$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; |
$changed = 1; |
Line 1872 sub editor {
|
Line 1872 sub editor {
|
push(@imports, [$name, $url, $residx]); |
push(@imports, [$name, $url, $residx]); |
} |
} |
} |
} |
($errtext,$fatal,my $fixuperrors) = |
($errtext,$fatal,my $fixuperrors) = |
&group_import($coursenum, $coursedom, $folder,$container, |
&group_import($coursenum, $coursedom, $folder,$container, |
'londocs',@imports); |
'londocs',@imports); |
return $errtext if ($fatal); |
return $errtext if ($fatal); |
Line 3305 sub handler {
|
Line 3305 sub handler {
|
if ($env{'form.symb'} ne '') { |
if ($env{'form.symb'} ne '') { |
$env{'form.folderpath'}= |
$env{'form.folderpath'}= |
&Apache::loncommon::symb_to_docspath($env{'form.symb'}); |
&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'}}); |
$env{'form.command'}.'_'.$env{'form.symb'}}); |
} elsif ($env{'form.supppath'} ne '') { |
} elsif ($env{'form.supppath'} ne '') { |
$env{'form.folderpath'}=$env{'form.supppath'}; |
$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'}}); |
$env{'form.command'}.'_'.$env{'form.supppath'}}); |
} |
} |
} elsif ($env{'form.command'} eq 'editdocs') { |
} elsif ($env{'form.command'} eq 'editdocs') { |
Line 4417 sub editing_js {
|
Line 4417 sub editing_js {
|
my $toplevelsupp = &supplemental_base(); |
my $toplevelsupp = &supplemental_base(); |
|
|
my $backtourl; |
my $backtourl; |
if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) { |
if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) { |
my $caller = $1; |
my $caller = $1; |
if ($caller =~ /^supplemental/) { |
if ($caller =~ /^supplemental/) { |
$backtourl = '/adm/supplemental?folderpath='.&escape($caller); |
$backtourl = '/adm/supplemental?folderpath='.&escape($caller); |
} else { |
} else { |