version 1.484.2.81, 2019/08/14 14:02:49
|
version 1.484.2.82, 2019/08/16 16:12:37
|
Line 1061 sub update_paste_buffer {
|
Line 1061 sub update_paste_buffer {
|
foreach my $suffix (@currpaste) { |
foreach my $suffix (@currpaste) { |
my $cid = $env{'docs.markedcopy_crs_'.$suffix}; |
my $cid = $env{'docs.markedcopy_crs_'.$suffix}; |
my $url = $env{'docs.markedcopy_url_'.$suffix}; |
my $url = $env{'docs.markedcopy_url_'.$suffix}; |
|
my $mapidx = $env{'docs.markedcopy_map_'.$suffix}; |
if (($cid =~ /^$match_domain(?:_)$match_courseid$/) && |
if (($cid =~ /^$match_domain(?:_)$match_courseid$/) && |
($url ne '')) { |
($url ne '')) { |
$pasteurls{$cid.'_'.$url} = 1; |
$pasteurls{$cid.'_'.$url.'_'.$mapidx} = 1; |
} |
} |
} |
} |
} |
} |
|
|
# Mark items for copying (skip any items already in user's paste buffer) |
# Mark items for copying (skip any items already in user's paste buffer) |
my %addtoenv; |
my %addtoenv; |
|
|
|
my @pathitems = split(/\&/,$env{'form.folderpath'}); |
|
my @folderconf = split(/\:/,$pathitems[-1]); |
|
my $ispage = $folderconf[4]; |
|
|
foreach my $item (@possibles) { |
foreach my $item (@possibles) { |
my ($orderidx,$cmd) = split(/:/,$item); |
my ($orderidx,$cmd) = split(/:/,$item); |
next if ($orderidx =~ /\D/); |
next if ($orderidx =~ /\D/); |
next unless (($cmd eq 'cut') || ($cmd eq 'copy') || ($cmd eq 'remove')); |
next unless (($cmd eq 'cut') || ($cmd eq 'copy') || ($cmd eq 'remove')); |
|
my $mapidx = $folder.':'.$orderidx.':'.$ispage; |
my ($title,$url)=split(':',$LONCAPA::map::resources[$orderidx]); |
my ($title,$url)=split(':',$LONCAPA::map::resources[$orderidx]); |
my %denied = &action_restrictions($coursenum,$coursedom, |
my %denied = &action_restrictions($coursenum,$coursedom, |
&LONCAPA::map::qtescape($url), |
&LONCAPA::map::qtescape($url), |
$env{'form.folderpath'},\%curr_groups); |
$env{'form.folderpath'},\%curr_groups); |
next if ($denied{'copy'}); |
next if ($denied{'copy'}); |
$url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$url=~s{http(:|:)//https(:|:)//}{https$2//}; |
next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url})); |
next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$mapidx})); |
my ($suffix,$errortxt,$locknotfreed) = |
my ($suffix,$errortxt,$locknotfreed) = |
&new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste'); |
&new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste'); |
if ($suffix ne '') { |
if ($suffix ne '') { |
Line 1100 sub update_paste_buffer {
|
Line 1106 sub update_paste_buffer {
|
$addtoenv{'docs.markedcopy_url_'.$suffix} = $url, |
$addtoenv{'docs.markedcopy_url_'.$suffix} = $url, |
$addtoenv{'docs.markedcopy_cmd_'.$suffix} = $cmd, |
$addtoenv{'docs.markedcopy_cmd_'.$suffix} = $cmd, |
$addtoenv{'docs.markedcopy_crs_'.$suffix} = $env{'request.course.id'}; |
$addtoenv{'docs.markedcopy_crs_'.$suffix} = $env{'request.course.id'}; |
|
$addtoenv{'docs.markedcopy_map_'.$suffix} = $mapidx; |
if ($url =~ m{^/uploaded/$match_domain/$match_courseid/(default|supplemental)_?(\d*)\.(page|sequence)$}) { |
if ($url =~ m{^/uploaded/$match_domain/$match_courseid/(default|supplemental)_?(\d*)\.(page|sequence)$}) { |
my $prefix = $1; |
my $prefix = $1; |
my $subdir =$2; |
my $subdir =$2; |
Line 1178 sub print_paste_buffer {
|
Line 1184 sub print_paste_buffer {
|
next if ($suffix =~ /\D/); |
next if ($suffix =~ /\D/); |
my $cid = $env{'docs.markedcopy_crs_'.$suffix}; |
my $cid = $env{'docs.markedcopy_crs_'.$suffix}; |
my $url = $env{'docs.markedcopy_url_'.$suffix}; |
my $url = $env{'docs.markedcopy_url_'.$suffix}; |
|
my $mapidx = $env{'docs.markedcopy_map_'.$suffix}; |
if (($cid =~ /^$match_domain\_$match_courseid$/) && |
if (($cid =~ /^$match_domain\_$match_courseid$/) && |
($url ne '')) { |
($url ne '')) { |
$clipboardcount ++; |
$clipboardcount ++; |
Line 1217 sub print_paste_buffer {
|
Line 1224 sub print_paste_buffer {
|
} |
} |
$is_uploaded_map = 1; |
$is_uploaded_map = 1; |
} |
} |
} elsif ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg)$}) { |
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) || |
|
($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg)$})) { |
if ($cid ne $env{'request.course.id'}) { |
if ($cid ne $env{'request.course.id'}) { |
my ($srcdom,$srcnum) = split(/_/,$cid); |
my ($srcdom,$srcnum) = split(/_/,$cid); |
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
Line 1516 sub do_paste_from_buffer {
|
Line 1524 sub do_paste_from_buffer {
|
} |
} |
|
|
my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate, |
my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate, |
%prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult); |
%prefixchg,%srcdom,%srcnum,%srcmapidx,%marktomove,$save_err,$lockerrors,$allresult); |
|
|
foreach my $suffix (@topaste) { |
foreach my $suffix (@topaste) { |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix}); |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix}); |
my $cid=&LONCAPA::map::qtescape($env{'docs.markedcopy_crs_'.$suffix}); |
my $cid=&LONCAPA::map::qtescape($env{'docs.markedcopy_crs_'.$suffix}); |
|
my $mapidx=&LONCAPA::map::qtescape($env{'docs.markedcopy_map_'.$suffix}); |
# Supplemental content may only include certain types of content |
# Supplemental content may only include certain types of content |
# Early out if pasted content is not supported in Supplemental area |
# Early out if pasted content is not supported in Supplemental area |
if ($folder =~ /^supplemental/) { |
if ($folder =~ /^supplemental/) { |
Line 1542 sub do_paste_from_buffer {
|
Line 1551 sub do_paste_from_buffer {
|
} |
} |
$srcdom{$suffix} = $srcd; |
$srcdom{$suffix} = $srcd; |
$srcnum{$suffix} = $srcn; |
$srcnum{$suffix} = $srcn; |
} elsif ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$}) { |
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) || |
|
($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$})) { |
my ($srcd,$srcn) = split(/_/,$cid); |
my ($srcd,$srcn) = split(/_/,$cid); |
# When paste buffer was populated using an active role in a different course |
# When paste buffer was populated using an active role in a different course |
# check for mdc privilege in the course from which the resource was pasted |
# check for mdc privilege in the course from which the resource was pasted |
Line 1555 sub do_paste_from_buffer {
|
Line 1565 sub do_paste_from_buffer {
|
$srcdom{$suffix} = $srcd; |
$srcdom{$suffix} = $srcd; |
$srcnum{$suffix} = $srcn; |
$srcnum{$suffix} = $srcn; |
} |
} |
|
$srcmapidx{$suffix} = $mapidx; |
push(@dopaste,$suffix); |
push(@dopaste,$suffix); |
if ($url=~/\.(page|sequence)$/) { |
if ($url=~/\.(page|sequence)$/) { |
$is_map{$suffix} = 1; |
$is_map{$suffix} = 1; |
Line 1564 sub do_paste_from_buffer {
|
Line 1575 sub do_paste_from_buffer {
|
my $oldprefix = $1; |
my $oldprefix = $1; |
# When pasting content from Main Content to Supplemental Content and vice versa |
# When pasting content from Main Content to Supplemental Content and vice versa |
# URLs will contain different paths (which depend on whether pasted item is |
# URLs will contain different paths (which depend on whether pasted item is |
# a folder/page or a document. |
# a folder/page or a document). |
if (($folder =~ /^supplemental/) && (($oldprefix =~ /^default/) || ($oldprefix eq 'docs'))) { |
if (($folder =~ /^supplemental/) && (($oldprefix =~ /^default/) || ($oldprefix eq 'docs'))) { |
$prefixchg{$suffix} = 'docstosupp'; |
$prefixchg{$suffix} = 'docstosupp'; |
} elsif (($folder =~ /^default/) && ($oldprefix =~ /^supplemental/)) { |
} elsif (($folder =~ /^default/) && ($oldprefix =~ /^supplemental/)) { |
Line 1639 sub do_paste_from_buffer {
|
Line 1650 sub do_paste_from_buffer {
|
# Maps need to be copied first |
# Maps need to be copied first |
my (%removefrommap,%removeparam,%addedmaps,%rewrites,%retitles,%copies, |
my (%removefrommap,%removeparam,%addedmaps,%rewrites,%retitles,%copies, |
%dbcopies,%zombies,%params,%docmoves,%mapmoves,%mapchanges,%newsubdir, |
%dbcopies,%zombies,%params,%docmoves,%mapmoves,%mapchanges,%newsubdir, |
%newurls,%tomove); |
%newurls,%tomove,%resdatacopy); |
if (ref($marktomove{$suffix}) eq 'ARRAY') { |
if (ref($marktomove{$suffix}) eq 'ARRAY') { |
map { $tomove{$_} = 1; } @{$marktomove{$suffix}}; |
map { $tomove{$_} = 1; } @{$marktomove{$suffix}}; |
} |
} |
Line 1688 sub do_paste_from_buffer {
|
Line 1699 sub do_paste_from_buffer {
|
\%retitles,\%copies,\%dbcopies, |
\%retitles,\%copies,\%dbcopies, |
\%zombies,\%params,\%mapmoves, |
\%zombies,\%params,\%mapmoves, |
\%mapchanges,\%tomove,\%newsubdir, |
\%mapchanges,\%tomove,\%newsubdir, |
\%newurls)) { |
\%newurls,\%resdatacopy)) { |
$mapmoves{$url} = 1; |
$mapmoves{$url} = 1; |
} |
} |
$url = $newurl; |
$url = $newurl; |
Line 1697 sub do_paste_from_buffer {
|
Line 1708 sub do_paste_from_buffer {
|
$coursenum,$srcdom{$suffix},$srcnum{$suffix}, |
$coursenum,$srcdom{$suffix},$srcnum{$suffix}, |
$allmaps,\%rewrites,\%retitles,\%copies,\%dbcopies, |
$allmaps,\%rewrites,\%retitles,\%copies,\%dbcopies, |
\%zombies,\%params,\%mapmoves,\%mapchanges, |
\%zombies,\%params,\%mapmoves,\%mapchanges, |
\%tomove,\%newsubdir,\%newurls); |
\%tomove,\%newsubdir,\%newurls,\%resdatacopy); |
} |
} |
} elsif ($url=~m {^/res/}) { |
} elsif ($url=~m {^/res/}) { |
# published map can only exists once, so remove from paste buffer when done |
# published map can only exist once, so remove from paste buffer when done |
push(@toclear,$suffix); |
push(@toclear,$suffix); |
# if pasting published map (main content area only) check map not already in course |
# if pasting published map (main content area only) check map not already in course |
if ($folder =~ /^default/) { |
if ($folder =~ /^default/) { |
Line 1803 sub do_paste_from_buffer {
|
Line 1814 sub do_paste_from_buffer {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($url =~ m{^/res/lib/templates/(\w+)\.problem$}) { |
|
my $template = $1; |
|
if ($newidx) { |
|
©_templated_files($url,$srcdom{$suffix},$srcnum{$suffix},$srcmapidx{$suffix}, |
|
$coursedom,$coursenum,$template,$newidx,"$folder.$container"); |
|
} |
} |
} |
$LONCAPA::map::resources[$newidx]=$title.':'.&LONCAPA::map::qtunescape($url). |
$LONCAPA::map::resources[$newidx]=$title.':'.&LONCAPA::map::qtunescape($url). |
':'.$ext.':normal:res'; |
':'.$ext.':normal:res'; |
Line 1816 sub do_paste_from_buffer {
|
Line 1833 sub do_paste_from_buffer {
|
} |
} |
} |
} |
|
|
# Apply any changes to maps, or copy dependencies for uploaded HTML pages |
# Apply any changes to maps, or copy dependencies for uploaded HTML pages, or update |
|
# resourcedata for simpleproblems copied from another course |
unless ($allresult eq 'fail') { |
unless ($allresult eq 'fail') { |
my %updated = ( |
my %updated = ( |
rewrites => \%rewrites, |
rewrites => \%rewrites, |
Line 1824 sub do_paste_from_buffer {
|
Line 1842 sub do_paste_from_buffer {
|
removefrommap => \%removefrommap, |
removefrommap => \%removefrommap, |
removeparam => \%removeparam, |
removeparam => \%removeparam, |
dbcopies => \%dbcopies, |
dbcopies => \%dbcopies, |
|
resdatacopy => \%resdatacopy, |
retitles => \%retitles, |
retitles => \%retitles, |
); |
); |
my %info = ( |
my %info = ( |
Line 2080 sub dbcopy {
|
Line 2099 sub dbcopy {
|
return ($url,$result,$errtext); |
return ($url,$result,$errtext); |
} |
} |
|
|
|
sub copy_templated_files { |
|
my ($srcurl,$srcdom,$srcnum,$srcmapinfo,$coursedom,$coursenum,$template,$newidx,$newmapname) = @_; |
|
my ($srcfolder,$srcid,$srcwaspage) = split(/:/,$srcmapinfo); |
|
my $srccontainer = 'sequence'; |
|
if ($srcwaspage) { |
|
$srccontainer = 'page'; |
|
} |
|
my $srcsymb = "uploaded/$srcdom/$srcnum/$srcfolder.$srccontainer". |
|
'___'.$srcid.'___'.&Apache::lonnet::declutter($srcurl); |
|
my $srcprefix = $srcdom.'_'.$srcnum.'.'.$srcsymb; |
|
my %srcparms=&Apache::lonnet::dump('resourcedata',$srcdom,$srcnum,$srcprefix); |
|
my $newsymb = "uploaded/$coursedom/$coursenum/$newmapname".'___'.$newidx.'___lib/templates/'. |
|
$template.'.problem'; |
|
my $newprefix = $coursedom.'_'.$coursenum.'.'.$newsymb; |
|
if ($template eq 'simpleproblem') { |
|
$srcprefix .= '.0.'; |
|
my $weightprefix = $newprefix; |
|
$newprefix .= '.0.'; |
|
my @simpleprobqtypes = qw(radio option string essay numerical); |
|
my $qtype=$srcparms{$srcprefix.'questiontype'}; |
|
if (grep(/^\Q$qtype\E$/,@simpleprobqtypes)) { |
|
my %newdata = ( |
|
$newprefix.'questiontype' => $qtype, |
|
) |
|
foreach my $type (@simpleprobqtypes) { |
|
if ($type eq $qtype) { |
|
$newdata{"$weightprefix.$type.weight"}=1; |
|
} else { |
|
$newdata{"$weightprefix.$type.weight"}=0; |
|
} |
|
} |
|
$newdata{$newprefix.'hiddenparts'} = '!'.$qtype; |
|
$newdata{$newprefix.'questiontext'} = $srcparms{$srcprefix.'questiontext'}; |
|
$newdata{$newprefix.'hinttext'} = $srcparms{$srcprefix.'hinttext'}; |
|
if ($qtype eq 'numerical') { |
|
$newdata{$newprefix.'numericalscript'} = $srcparms{$srcprefix.'numericalscript'}; |
|
$newdata{$newprefix.'numericalanswer'} = $srcparms{$srcprefix.'numericalanswer'}; |
|
$newdata{$newprefix.'numericaltolerance'} = $srcparms{$srcprefix.'numericaltolerance'}; |
|
$newdata{$newprefix.'numericalsigfigs'} = $srcparms{$srcprefix.'numericalsigfigs'}; |
|
} elsif (($qtype eq 'option') || ($qtype eq 'radio')) { |
|
my $maxfoils=$srcparms{$srcprefix.'maxfoils'}; |
|
unless (defined($maxfoils)) { $maxfoils=10; } |
|
unless ($maxfoils=~/^\d+$/) { $maxfoils=10; } |
|
if ($maxfoils<=0) { $maxfoils=10; } |
|
my $randomize=$srcparms{$srcprefix.'randomize'}; |
|
unless (defined($randomize)) { $randomize='yes'; } |
|
unless ($randomize eq 'no') { $randomize='yes'; } |
|
$newdata{$newprefix.'maxfoils'} = $maxfoils; |
|
$newdata{$newprefix.'randomize'} = $randomize; |
|
if ($qtype eq 'option') { |
|
$newdata{$newprefix.'options'} = $srcparms{$srcprefix.'options'}; |
|
} |
|
for (my $i=1; $i<=10; $i++) { |
|
$newdata{$newprefix.'value'.$i} = $srcparms{$srcprefix.'value'.$i}; |
|
$newdata{$newprefix.'position'.$i} = $srcparms{$srcprefix.'position'.$i}; |
|
$newdata{$newprefix.'text'.$i} = $srcparms{$srcprefix.'text'.$i}; |
|
} |
|
|
|
} elsif (($qtype eq 'option') || ($qtype eq 'radio')) { |
|
my $maxfoils=$srcparms{$srcprefix.'maxfoils'}; |
|
unless (defined($maxfoils)) { $maxfoils=10; } |
|
unless ($maxfoils=~/^\d+$/) { $maxfoils=10; } |
|
if ($maxfoils<=0) { $maxfoils=10; } |
|
my $randomize=$srcparms{$srcprefix.'randomize'}; |
|
unless (defined($randomize)) { $randomize='yes'; } |
|
unless ($randomize eq 'no') { $randomize='yes'; } |
|
$newdata{$newprefix.'maxfoils'} = $maxfoils; |
|
$newdata{$newprefix.'randomize'} = $randomize; |
|
if ($qtype eq 'option') { |
|
$newdata{$newprefix.'options'} = $srcparms{$srcprefix.'options'}; |
|
} |
|
for (my $i=1; $i<=10; $i++) { |
|
$newdata{$newprefix.'value'.$i} = $srcparms{$srcprefix.'value'.$i}; |
|
$newdata{$newprefix.'position'.$i} = $srcparms{$srcprefix.'position'.$i}; |
|
$newdata{$newprefix.'text'.$i} = $srcparms{$srcprefix.'text'.$i}; |
|
} |
|
} elsif ($qtype eq 'string') { |
|
$newdata{$newprefix.'stringanswer'} = $srcparms{$srcprefix.'stringanswer'}; |
|
$newdata{$newprefix.'stringtype'} = $srcparms{$srcprefix.'stringtype'}; |
|
} |
|
if (keys(%newdata)) { |
|
my $putres = &Apache::lonnet::cput('resourcedata',\%newdata,$coursedom, |
|
$coursenum); |
|
if ($putres eq 'ok') { |
|
&Apache::lonnet::devalidatecourseresdata($coursenum,$coursedom); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
sub uniqueness_check { |
sub uniqueness_check { |
my ($newurl) = @_; |
my ($newurl) = @_; |
my $unique = 1; |
my $unique = 1; |
Line 2145 sub contained_map_check {
|
Line 2255 sub contained_map_check {
|
sub url_paste_fixups { |
sub url_paste_fixups { |
my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$fromcdom,$fromcnum,$allmaps, |
my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$fromcdom,$fromcnum,$allmaps, |
$rewrites,$retitles,$copies,$dbcopies,$zombies,$params,$mapmoves, |
$rewrites,$retitles,$copies,$dbcopies,$zombies,$params,$mapmoves, |
$mapchanges,$tomove,$newsubdir,$newurls) = @_; |
$mapchanges,$tomove,$newsubdir,$newurls,$resdatacopy) = @_; |
my $checktitle; |
my $checktitle; |
if (($prefixchg) && |
if (($prefixchg) && |
($oldurl =~ m{^/uploaded/$match_domain/$match_courseid/supplemental})) { |
($oldurl =~ m{^/uploaded/$match_domain/$match_courseid/supplemental})) { |
Line 2194 sub url_paste_fixups {
|
Line 2304 sub url_paste_fixups {
|
$srcdom,$srcnum,$allmaps,$rewrites, |
$srcdom,$srcnum,$allmaps,$rewrites, |
$retitles,$copies,$dbcopies,$zombies, |
$retitles,$copies,$dbcopies,$zombies, |
$params,$mapmoves,$mapchanges,$tomove, |
$params,$mapmoves,$mapchanges,$tomove, |
$newsubdir,$newurls); |
$newsubdir,$newurls,$resdatacopy); |
next; |
next; |
} else { |
} else { |
($newurl,my $error) = |
($newurl,my $error) = |
Line 2218 sub url_paste_fixups {
|
Line 2328 sub url_paste_fixups {
|
$cnum,$srcdom,$srcnum,$allmaps, |
$cnum,$srcdom,$srcnum,$allmaps, |
$rewrites,$retitles,$copies,$dbcopies, |
$rewrites,$retitles,$copies,$dbcopies, |
$zombies,$params,$mapmoves,$mapchanges, |
$zombies,$params,$mapmoves,$mapchanges, |
$tomove,$newsubdir,$newurls)) { |
$tomove,$newsubdir,$newurls,$resdatacopy)) { |
$mapmoves->{$ressrc} = 1; |
$mapmoves->{$ressrc} = 1; |
} |
} |
$changed = 1; |
$changed = 1; |
Line 2247 sub url_paste_fixups {
|
Line 2357 sub url_paste_fixups {
|
$dbcopies->{$oldurl}{$id}{'cnum'} = $fromcnum; |
$dbcopies->{$oldurl}{$id}{'cnum'} = $fromcnum; |
$changed = 1; |
$changed = 1; |
} |
} |
|
} elsif ($ressrc eq '/res/lib/templates/simpleproblem.problem') { |
|
if (($fromcdom ne $cdom) || ($fromcnum ne $cnum)) { |
|
$resdatacopy->{$oldurl}{$id}{'src'} = $ressrc; |
|
$resdatacopy->{$oldurl}{$id}{'cdom'} = $fromcdom; |
|
$resdatacopy->{$oldurl}{$id}{'cnum'} = $fromcnum; |
|
} |
} elsif ($ressrc =~ m{^/public/($match_domain)/($match_courseid)/(.+)$}) { |
} elsif ($ressrc =~ m{^/public/($match_domain)/($match_courseid)/(.+)$}) { |
next if ($skip); |
next if ($skip); |
my $srcdom = $1; |
my $srcdom = $1; |
Line 2278 sub apply_fixups {
|
Line 2394 sub apply_fixups {
|
$oldurl,$url,$caller) = @_; |
$oldurl,$url,$caller) = @_; |
my (%rewrites,%zombies,%removefrommap,%removeparam,%dbcopies,%retitles, |
my (%rewrites,%zombies,%removefrommap,%removeparam,%dbcopies,%retitles, |
%params,%newsubdir,%before,%after,%copies,%docmoves,%mapmoves,@msgs, |
%params,%newsubdir,%before,%after,%copies,%docmoves,%mapmoves,@msgs, |
%lockerrors,$lockmsg); |
%resdatacopy,%lockerrors,$lockmsg); |
if (ref($updated) eq 'HASH') { |
if (ref($updated) eq 'HASH') { |
if (ref($updated->{'rewrites'}) eq 'HASH') { |
if (ref($updated->{'rewrites'}) eq 'HASH') { |
%rewrites = %{$updated->{'rewrites'}}; |
%rewrites = %{$updated->{'rewrites'}}; |
Line 2298 sub apply_fixups {
|
Line 2414 sub apply_fixups {
|
if (ref($updated->{'retitles'}) eq 'HASH') { |
if (ref($updated->{'retitles'}) eq 'HASH') { |
%retitles = %{$updated->{'retitles'}}; |
%retitles = %{$updated->{'retitles'}}; |
} |
} |
|
if (ref($updated->{'resdatacopy'}) eq 'HASH') { |
|
%resdatacopy = %{$updated->{'resdatacopy'}}; |
|
} |
} |
} |
if (ref($info) eq 'HASH') { |
if (ref($info) eq 'HASH') { |
if (ref($info->{'newsubdir'}) eq 'HASH') { |
if (ref($info->{'newsubdir'}) eq 'HASH') { |
Line 2448 sub apply_fixups {
|
Line 2567 sub apply_fixups {
|
} |
} |
} |
} |
} |
} |
|
if (ref($resdatacopy{$key}) eq 'HASH') { |
|
my ($gotnewmapname,$newmapname,$srcfolder,$srccontainer); |
|
foreach my $idx (keys(%{$resdatacopy{$key}})) { |
|
if (ref($resdatacopy{$key}{$idx}) eq 'HASH') { |
|
my $srcurl = $resdatacopy{$key}{$idx}{'src'}; |
|
if ($srcurl =~ m{^/res/lib/templates/(\w+)\.problem$}) { |
|
my $template = $1; |
|
if (($resdatacopy{$key}{$idx}{'cdom'} =~ /^$match_domain$/) && |
|
($resdatacopy{$key}{$idx}{'cnum'} =~ /^$match_courseid$/)) { |
|
my $srcdom = $resdatacopy{$key}{$idx}{'cdom'}; |
|
my $srcnum = $resdatacopy{$key}{$idx}{'cnum'}; |
|
unless ($gotnewmapname) { |
|
($newmapname) = ($key =~ m{/([^/]+)$}); |
|
($srcfolder,$srccontainer) = split(/\./,$newmapname); |
|
if ($newsubdir{$key}) { |
|
$newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/; |
|
} |
|
$gotnewmapname = 1; |
|
} |
|
my $srcmapinfo = $srcfolder.':'.$idx; |
|
if ($srccontainer eq 'page') { |
|
$srcmapinfo .= ':1'; |
|
} |
|
©_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom, |
|
$cnum,$template,$idx,$newmapname); |
|
} |
|
} |
|
} |
|
} |
|
} |
if (ref($params{$key}) eq 'HASH') { |
if (ref($params{$key}) eq 'HASH') { |
%currparam = %{$params{$key}}; |
%currparam = %{$params{$key}}; |
} |
} |
Line 4076 sub action_restrictions {
|
Line 4225 sub action_restrictions {
|
if ($url=~ m{^/res/.+\.(page|sequence)$}) { |
if ($url=~ m{^/res/.+\.(page|sequence)$}) { |
# no copy for published maps |
# no copy for published maps |
$denied{'copy'} = 1; |
$denied{'copy'} = 1; |
} elsif ($url=~m{^/res/lib/templates/}) { |
} elsif ($url=~m{^/res/lib/templates/([^/]+)\.problem$}) { |
$denied{'copy'} = 1; |
unless ($1 eq 'simpleproblem') { |
$denied{'cut'} = 1; |
$denied{'copy'} = 1; |
|
} |
|
$denied{'cut'} = 1; |
} elsif ($url eq "/uploaded/$cdom/$cnum/group_allfolders.sequence") { |
} elsif ($url eq "/uploaded/$cdom/$cnum/group_allfolders.sequence") { |
if ($folderpath =~ /^default&[^\&]+$/) { |
if ($folderpath =~ /^default&[^\&]+$/) { |
if ((ref($currgroups) eq 'HASH') && (keys(%{$currgroups}) > 0)) { |
if ((ref($currgroups) eq 'HASH') && (keys(%{$currgroups}) > 0)) { |
Line 5355 sub handler {
|
Line 5506 sub handler {
|
'er' => 'Editing rights unavailable for your current role.', |
'er' => 'Editing rights unavailable for your current role.', |
); |
); |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
# Calculate free quota space for a user or course. |
# Calculate free quota space for a user or course. A javascript function checks |
|
# file size to determine if upload should be allowed. |
my $quotatype = 'unofficial'; |
my $quotatype = 'unofficial'; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$quotatype = 'community'; |
$quotatype = 'community'; |