'.
- &mt('There was a problem removing a lockfile.');
- if ($prefix eq 'smppg') {
- $lockerrorsref->{$prefix} .=
- &mt('This will prevent creation of additional simple pages in this course.');
- } else {
- $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.');
- }
- $lockerrorsref->{$prefix} .= &mt('Please contact the domain coordinator for your LON-CAPA domain.').'
';
- }
- }
- } elsif ($url =~ m{/syllabus$}) {
- if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
- ($dbref->{'cnum'} =~ /^$match_courseid$/)) {
- if (($dbref->{'cdom'} ne $coursedom) ||
- ($dbref->{'cnum'} ne $coursenum)) {
- my %contents=&Apache::lonnet::dump('syllabus',
- $dbref->{'cdom'},
- $dbref->{'cnum'});
- $result=&Apache::lonnet::put('syllabus',\%contents,
- $coursedom,$coursenum);
- }
- }
+ my ($url,$coursedom,$coursenum) = @_;
+ if ($url=~ m{/smppg$}) {
+ my $db_name = &Apache::lonsimplepage::get_db_name($url);
+ if ($db_name =~ /^smppage_/) {
+ #simple pages, need to copy the db contents to a new one.
+ my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum);
+ my $now = time();
+ $db_name =~ s{_\d*$ }{_$now}x;
+ my $result=&Apache::lonnet::put($db_name,\%contents,
+ $coursedom,$coursenum);
+ $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
}
}
- return ($url,$result,$errtext);
+ return $url;
}
sub uniqueness_check {
@@ -1394,7 +1190,7 @@ sub contained_map_check {
$titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'};
} else {
if ($allmaps->{$ressrc}) {
- $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
+ $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
} elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') {
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
} else {
@@ -1418,10 +1214,18 @@ sub contained_map_check {
return;
}
+sub reinit_role {
+ my ($cdom,$cnum,$chome) = @_;
+ my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
+ unless ($ferr) {
+ &Apache::loncommon::update_content_constraints($cdom,$cnum,$chome,$cdom.'_'.$cnum);
+ }
+ return;
+}
+
sub url_paste_fixups {
- my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$fromcdom,$fromcnum,$allmaps,
- $rewrites,$retitles,$copies,$dbcopies,$zombies,$params,$mapmoves,
- $mapchanges,$tomove,$newsubdir,$newurls) = @_;
+ my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$allmaps,$rewrites,$retitles,$copies,
+ $dbcopies,$zombies,$params,$mapmoves,$mapchanges,$tomove,$newsubdir,$newurls) = @_;
my $checktitle;
if (($prefixchg) &&
($oldurl =~ m{^/uploaded/$match_domain/$match_courseid/supplemental})) {
@@ -1448,13 +1252,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;
@@ -1466,11 +1270,10 @@ sub url_paste_fixups {
my $prefix = $1;
$mapname = $prefix.$2;
if ($tomove->{$mapname}) {
- &url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,
- $srcdom,$srcnum,$allmaps,$rewrites,
- $retitles,$copies,$dbcopies,$zombies,
- $params,$mapmoves,$mapchanges,$tomove,
- $newsubdir,$newurls);
+ &url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,$allmaps,
+ $rewrites,$retitles,$copies,$dbcopies,$zombies,
+ $params,$mapmoves,$mapchanges,$tomove,$newsubdir,
+ $newurls);
next;
} else {
($newurl,my $error) =
@@ -1488,39 +1291,28 @@ 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,$srcdom,$srcnum,$allmaps,
- $rewrites,$retitles,$copies,$dbcopies,
- $zombies,$params,$mapmoves,$mapchanges,
- $tomove,$newsubdir,$newurls)) {
+ unless (&url_paste_fixups($ressrc,$folder,$prefixchg,$cdom,$cnum,$allmaps,
+ $rewrites,$retitles,$copies,$dbcopies,$zombies,
+ $params,$mapmoves,$mapchanges,$tomove,$newsubdir,
+ $newurls)) {
$mapmoves->{$ressrc} = 1;
}
$changed = 1;
} else {
- $rewrites->{$oldurl}{$id} = $ressrc;
+ $rewrites->{$oldurl}{$ressrc} = $id;
$copies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
}
- } elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/.+$}) {
+ } elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) {
next if ($skip);
my $srcdom = $1;
my $srcnum = $2;
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
- $rewrites->{$oldurl}{$id} = $ressrc;
- $dbcopies->{$oldurl}{$id}{'src'} = $ressrc;
- $dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom;
- $dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum;
- $changed = 1;
- }
- } elsif ($ressrc =~ m{^/adm/$match_domain/$match_username/\d+/(smppg|bulletinboard)$}) {
- if (($fromcdom ne $cdom) || ($fromcnum ne $cnum) ||
- ($env{'form.docs.markedcopy_options'} ne 'move')) {
- $dbcopies->{$oldurl}{$id}{'src'} = $ressrc;
- $dbcopies->{$oldurl}{$id}{'cdom'} = $fromcdom;
- $dbcopies->{$oldurl}{$id}{'cnum'} = $fromcnum;
+ $rewrites->{$oldurl}{$ressrc} = $id;
+ $dbcopies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
} elsif ($ressrc =~ m{^/public/($match_domain)/($match_courseid)/(.+)$}) {
@@ -1528,9 +1320,8 @@ sub url_paste_fixups {
my $srcdom = $1;
my $srcnum = $2;
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
- $dbcopies->{$oldurl}{$id}{'src'} = $ressrc;
- $dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom;
- $dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum;
+ $rewrites->{$oldurl}{$ressrc} = $id;
+ $dbcopies->{$oldurl}{$ressrc} = $id;
$changed = 1;
}
}
@@ -1550,73 +1341,24 @@ sub url_paste_fixups {
}
sub apply_fixups {
- my ($folder,$is_map,$cdom,$cnum,$errors,$updated,$info,$moves,$prefixchg,
- $oldurl,$url,$caller) = @_;
- my (%rewrites,%zombies,%removefrommap,%removeparam,%dbcopies,%retitles,
- %params,%newsubdir,%before,%after,%copies,%docmoves,%mapmoves,@msgs,
- %lockerrors,$lockmsg);
- if (ref($updated) eq 'HASH') {
- if (ref($updated->{'rewrites'}) eq 'HASH') {
- %rewrites = %{$updated->{'rewrites'}};
- }
- if (ref($updated->{'zombies'}) eq 'HASH') {
- %zombies = %{$updated->{'zombies'}};
- }
- if (ref($updated->{'removefrommap'}) eq 'HASH') {
- %removefrommap = %{$updated->{'removefrommap'}};
- }
- if (ref($updated->{'removeparam'}) eq 'HASH') {
- %removeparam = %{$updated->{'removeparam'}};
- }
- if (ref($updated->{'dbcopies'}) eq 'HASH') {
- %dbcopies = %{$updated->{'dbcopies'}};
- }
- if (ref($updated->{'retitles'}) eq 'HASH') {
- %retitles = %{$updated->{'retitles'}};
- }
- }
- if (ref($info) eq 'HASH') {
- if (ref($info->{'newsubdir'}) eq 'HASH') {
- %newsubdir = %{$info->{'newsubdir'}};
- }
- if (ref($info->{'params'}) eq 'HASH') {
- %params = %{$info->{'params'}};
- }
- if (ref($info->{'before'}) eq 'HASH') {
- %before = %{$info->{'before'}};
- }
- if (ref($info->{'after'}) eq 'HASH') {
- %after = %{$info->{'after'}};
- }
- }
- if (ref($moves) eq 'HASH') {
- if (ref($moves->{'copies'}) eq 'HASH') {
- %copies = %{$moves->{'copies'}};
- }
- if (ref($moves->{'docmoves'}) eq 'HASH') {
- %docmoves = %{$moves->{'docmoves'}};
- }
- if (ref($moves->{'mapmoves'}) eq 'HASH') {
- %mapmoves = %{$moves->{'mapmoves'}};
- }
- }
- foreach my $key (keys(%copies),keys(%docmoves)) {
+ my ($folder,$is_map,$prefixchg,$cdom,$cnum,$oldurl,$url,$removefrommap,
+ $removeparam,$rewrites,$retitles,$copies,$dbcopies,$zombies,$params,
+ $docmoves,$mapmoves,$newsubdir,$errors,$before,$after) = @_;
+ foreach my $key (keys(%{$copies}),keys(%{$docmoves})) {
my @allcopies;
- if (exists($copies{$key})) {
- if (ref($copies{$key}) eq 'HASH') {
- my %added;
- foreach my $innerkey (keys(%{$copies{$key}})) {
- if (($innerkey ne '') && (!$added{$innerkey})) {
- push(@allcopies,$innerkey);
- $added{$innerkey} = 1;
- }
+ if (ref($copies->{$key}) eq 'HASH') {
+ my %added;
+ foreach my $innerkey (keys(%{$copies->{$key}})) {
+ if (($innerkey ne '') && (!$added{$innerkey})) {
+ push(@allcopies,$innerkey);
+ $added{$innerkey} = 1;
}
- undef(%added);
}
+ undef(%added);
}
if ($key eq $oldurl) {
- if ((exists($docmoves{$key}))) {
- unless (grep(/^\Q$oldurl\E$/,@allcopies)) {
+ if ((exists($docmoves->{$key}))) {
+ unless (grep(/^\Q$oldurl\E/,@allcopies)) {
push(@allcopies,$oldurl);
}
}
@@ -1629,16 +1371,16 @@ sub apply_fixups {
my $content = &Apache::lonnet::getfile($item);
unless ($content eq '-1') {
my $storefn;
- if (($key eq $oldurl) && (exists($docmoves{$key}))) {
- $storefn = $docmoves{$key};
+ if (($key eq $oldurl) && (ref($docmoves) eq 'HASH') && (exists($docmoves->{$key}))) {
+ $storefn = $docmoves->{$key};
} else {
$storefn = $relpath;
$storefn =~s{^/uploaded/$match_domain/$match_courseid/}{};
- if ($prefixchg && $before{'doc'} && $after{'doc'}) {
- $storefn =~ s/^\Q$before{'doc'}\E/$after{'doc'}/;
+ if ($prefixchg) {
+ $storefn =~ s/^\Q$before->{'doc'}\E/$after->{'doc'}/;
}
- if ($newsubdir{$key}) {
- $storefn =~ s#^(docs|supplemental)/\Q$oldsubdir\E/#$1/$newsubdir{$key}/#;
+ if ($newsubdir->{$key}) {
+ $storefn =~ s#^(docs|supplemental)/\Q$oldsubdir\E/#$1/$newsubdir->{$key}#;
}
}
©_dependencies($item,$storefn,$relpath,$errors,\$content);
@@ -1646,7 +1388,7 @@ sub apply_fixups {
&Apache::lonclonecourse::writefile($env{'request.course.id'},
$storefn.$fname,$content);
if ($copyurl eq '/adm/notfound.html') {
- if (exists($docmoves{$oldurl})) {
+ if ((ref($docmoves) eq 'HASH') && (exists($docmoves->{$oldurl}))) {
return &mt('Paste failed: an error occurred copying the file.');
} elsif (ref($errors) eq 'HASH') {
$errors->{$item} = 1;
@@ -1657,14 +1399,14 @@ sub apply_fixups {
}
}
}
- foreach my $key (keys(%mapmoves)) {
+ foreach my $key (keys(%{$mapmoves})) {
my $storefn=$key;
$storefn=~s{^/uploaded/$match_domain/$match_courseid/}{};
- if ($prefixchg && $before{'map'} && $after{'map'}) {
- $storefn =~ s/^\Q$before{'map'}\E/$after{'map'}/;
+ if ($prefixchg) {
+ $storefn =~ s/^\Q$before->{'map'}\E/$after->{'map'}/;
}
- if ($newsubdir{$key}) {
- $storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;
+ if ($newsubdir->{$key}) {
+ $storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir->{$key}/;
}
my $mapcontent = &Apache::lonnet::getfile($key);
if ($mapcontent eq '-1') {
@@ -1684,106 +1426,105 @@ sub apply_fixups {
}
my %updates;
if ($is_map) {
- if (ref($updated) eq 'HASH') {
- foreach my $type (keys(%{$updated})) {
- if (ref($updated->{$type}) eq 'HASH') {
- foreach my $key (keys(%{$updated->{$type}})) {
- $updates{$key} = 1;
- }
- }
- }
+ foreach my $key (keys(%{$rewrites})) {
+ $updates{$key} = 1;
+ }
+ foreach my $key (keys(%{$zombies})) {
+ $updates{$key} = 1;
+ }
+ foreach my $key (keys(%{$removefrommap})) {
+ $updates{$key} = 1;
+ }
+ foreach my $key (keys(%{$removeparam})) {
+ $updates{$key} = 1;
+ }
+ foreach my $key (keys(%{$dbcopies})) {
+ $updates{$key} = 1;
+ }
+ foreach my $key (keys(%{$retitles})) {
+ $updates{$key} = 1;
}
foreach my $key (keys(%updates)) {
my (%torewrite,%toretitle,%toremove,%remparam,%currparam,%zombie,%newdb);
- if (ref($rewrites{$key}) eq 'HASH') {
- %torewrite = %{$rewrites{$key}};
+ if (ref($rewrites->{$key}) eq 'HASH') {
+ %torewrite = %{$rewrites->{$key}};
}
- if (ref($retitles{$key}) eq 'HASH') {
- %toretitle = %{$retitles{$key}};
+ if (ref($retitles->{$key}) eq 'HASH') {
+ %toretitle = %{$retitles->{$key}};
}
- if (ref($removefrommap{$key}) eq 'HASH') {
- %toremove = %{$removefrommap{$key}};
+ if (ref($removefrommap->{$key}) eq 'HASH') {
+ %toremove = %{$removefrommap->{$key}};
}
- if (ref($removeparam{$key}) eq 'HASH') {
- %remparam = %{$removeparam{$key}};
- }
- if (ref($zombies{$key}) eq 'HASH') {
- %zombie = %{$zombies{$key}};
- }
- if (ref($dbcopies{$key}) eq 'HASH') {
- foreach my $idx (keys(%{$dbcopies{$key}})) {
- if (ref($dbcopies{$key}{$idx}) eq 'HASH') {
- my ($newurl,$result,$errtext) =
- &dbcopy($dbcopies{$key}{$idx},$cdom,$cnum,\%lockerrors);
- if ($result eq 'ok') {
- $newdb{$idx} = $newurl;
- } elsif (ref($errors) eq 'HASH') {
- $errors->{$key} = 1;
- }
- push(@msgs,$errtext);
- }
+ if (ref($removeparam->{$key}) eq 'HASH') {
+ %remparam = %{$removeparam->{$key}};
+ }
+ if (ref($zombies->{$key}) eq 'HASH') {
+ %zombie = %{$zombies->{$key}};
+ }
+ if (ref($dbcopies->{$key}) eq 'HASH') {
+ foreach my $item (keys(%{$dbcopies->{$key}})) {
+ $newdb{$item} = &dbcopy($item);
}
}
- if (ref($params{$key}) eq 'HASH') {
- %currparam = %{$params{$key}};
+ if (ref($params->{$key}) eq 'HASH') {
+ %currparam = %{$params->{$key}};
}
my ($errtext,$fatal) = &LONCAPA::map::mapread($key);
if ($fatal) {
- return ($errtext);
+ return $errtext;
}
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]);
}
}
}
- for (my $i=0; $i<@LONCAPA::map::order; $i++) {
- my $idx = $LONCAPA::map::order[$i];
- if (defined($LONCAPA::map::resources[$idx])) {
+ for (my $i=0; $i<@LONCAPA::map::resources; $i++) {
+ if (defined($LONCAPA::map::resources[$i])) {
my $changed;
- my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::resources[$idx]);
- if ((exists($toremove{$idx})) && ($toremove{$idx} eq $src)) {
+ my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::resources[$i]);
+ if ($toremove{$src} eq $i) {
splice(@LONCAPA::map::order,$i,1);
- if (ref($currparam{$idx}) eq 'ARRAY') {
- foreach my $name (@{$currparam{$idx}}) {
- &LONCAPA::map::delparameter($idx,'parameter_'.$name);
+ if (ref($currparam{$i}) eq 'ARRAY') {
+ foreach my $name (@{$currparam{$i}}) {
+ &LONCAPA::map::delparameter($i,'parameter_'.$name);
}
}
next;
}
my $origsrc = $src;
- if ((exists($toretitle{$idx})) && ($toretitle{$idx} eq $src)) {
+ if ((exists($toretitle{$src})) && ($toretitle{$src} eq $i)) {
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 $i)) {
$src =~ s{^/(uploaded|adm|public)/$match_domain/$match_courseid/}{/$1/$cdom/$cnum/};
if ($origsrc =~ m{^/uploaded/}) {
- if ($prefixchg && $before{'map'} && $after{'map'}) {
+ if ($prefixchg) {
if ($src =~ /\.(page|sequence)$/) {
- $src =~ s#^(/uploaded/$match_domain/$match_courseid/)\Q$before{'map'}\E#$1$after{'map'}#;
+ $src =~ s#^(/uploaded/$match_domain/$match_courseid/)\Q$before->{'map'}\E#$1$after->{'map'}#;
} else {
- $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 ($origsrc =~ /\.(page|sequence)$/) {
- if ($newsubdir{$origsrc}) {
- $src =~ s#^(/uploaded/$match_domain/$match_courseid/(?:default|supplemental)_)(\d+)#$1$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;
- } elsif ($newdb{$idx} ne '') {
- $src = $newdb{$idx};
+ } elsif ($newdb{$src} ne '') {
+ $src = $newdb{$src};
$changed = 1;
}
if ($changed) {
- $LONCAPA::map::resources[$idx] = join(':',($title,$src,$ext,$type));
+ $LONCAPA::map::resources[$i] = join(':',($title,$src,$ext,$type));
}
}
}
@@ -1794,9 +1535,6 @@ sub apply_fixups {
}
}
}
- if (values(%lockerrors) > 0) {
- $lockmsg = join(''
.&mt('Currently no documents.')
@@ -2384,15 +1948,19 @@ sub process_file_upload {
my $errtext='';
my $fatal=0;
my $container='sequence';
- if ($env{'form.folderpath'} =~ /:1$/) {
+ if ($env{'form.pagepath'}) {
$container='page';
}
($errtext,$fatal)=
- &mapread($coursenum,$coursedom,$folder.'.'.$container);
+ &mapread($coursenum,$coursedom,$folder.'.'.$container);
if ($#LONCAPA::map::order<1) {
$LONCAPA::map::order[0]=1;
$LONCAPA::map::resources[1]='';
}
+ if ($fatal) {
+ $$upload_output = '
'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'
';
+ return;
+ }
my $destination = 'docs/';
if ($folder =~ /^supplemental/) {
$destination = 'supplemental/';
@@ -2402,10 +1970,6 @@ sub process_file_upload {
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
$destination .= $2.'/';
}
- if ($fatal) {
- $$upload_output = '
'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'
';
- return;
- }
# this is for a course, not a user, so set context to coursedoc.
my $newidx=&LONCAPA::map::getresidx();
$destination .= $newidx;
@@ -2474,6 +2038,7 @@ sub process_file_upload {
my $archiveurl = &HTML::Entities::encode($url,'<>&"');
my %archiveitems = (
folderpath => $env{'form.folderpath'},
+ pagepath => $env{'form.pagepath'},
cmd => $nextphase,
newidx => $newidx,
position => $position,
@@ -2528,14 +2093,16 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$pathitem,$supplementalflag,$container)=@_;
- my ($foldertitle,$renametitle);
+ $crstype,$pathitem,$supplementalflag)=@_;
+ my ($foldertitle,$pagetitle,$renametitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
+ $pagetitle = $foldertitle;
} else {
$title=&HTML::Entities::encode($title,'"<>&\'');
$renametitle=$title;
$foldertitle=$title;
+ $pagetitle=$title;
}
my $orderidx=$LONCAPA::map::order[$index];
@@ -2546,12 +2113,19 @@ sub entryline {
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common);
# Edit commands
- my ($esc_path, $path, $symb);
+ my ($container, $type, $esc_path, $path, $symb);
if ($env{'form.folderpath'}) {
+ $type = 'folder';
+ $container = 'sequence';
$esc_path=&escape($env{'form.folderpath'});
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
}
+ if ($env{'form.pagepath'}) {
+ $type = $container = 'page';
+ $esc_path=&escape($env{'form.pagepath'});
+ $path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
+ }
my $isexternal;
if ($residx) {
my $currurl = $url;
@@ -2568,7 +2142,7 @@ sub entryline {
&Apache::lonnet::declutter($currurl));
}
}
- my ($renamelink,%lt);
+ my %lt;
if ($allowed) {
my $incindex=$index+1;
my $selectbox='';
@@ -2665,7 +2239,7 @@ sub entryline {
$nocopy=1;
}
}
- my ($copylink,$cutlink,$removelink);
+ my ($copylink,$cutlink,$removelink,$renamelink);
my $skip_confirm = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
@@ -2684,7 +2258,7 @@ sub entryline {
ENDCOPY
} else {
$copylink=(<
$lt{'cp'}
+$lt{'cp'}
ENDCOPY
}
if ($nocut) {
@@ -2693,7 +2267,7 @@ ENDCOPY
ENDCUT
} else {
$cutlink=(<$lt{'ct'}
+$lt{'ct'}
ENDCUT
}
if ($noremove) {
@@ -2702,20 +2276,18 @@ ENDCUT
ENDREM
} else {
$removelink=(<$lt{'rm'}
+$lt{'rm'}
ENDREM
}
- unless ($isexternal) {
- $renamelink=(<$lt{'rn'}
+ $renamelink=(<$lt{'rn'}
ENDREN
- }
$form_start = '