version 1.512, 2012/11/30 14:46:21
|
version 1.529, 2013/01/09 04:31:57
|
Line 40 use Apache::lonxml;
|
Line 40 use Apache::lonxml;
|
use Apache::lonclonecourse; |
use Apache::lonclonecourse; |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonnavdisplay(); |
use Apache::lonnavdisplay(); |
use Apache::lonuserstate(); |
|
use Apache::lonextresedit(); |
use Apache::lonextresedit(); |
use HTML::Entities; |
use HTML::Entities; |
use HTML::TokeParser; |
use HTML::TokeParser; |
Line 271 sub dumpcourse {
|
Line 270 sub dumpcourse {
|
|
|
sub group_import { |
sub group_import { |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
|
my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap, |
|
%removeparam,$importuploaded,$fixuperrors); |
|
$allmaps = {}; |
while (@files) { |
while (@files) { |
my ($name, $url, $residx) = @{ shift(@files) }; |
my ($name, $url, $residx) = @{ shift(@files) }; |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) |
Line 297 sub group_import {
|
Line 298 sub group_import {
|
} |
} |
} |
} |
if ($url) { |
if ($url) { |
|
if (($caller eq 'londocs') && |
|
($folder =~ /^default/)) { |
|
unless ($donechk) { |
|
my $chome = &Apache::lonnet::homeserver($coursenum,$coursedom); |
|
my $cid = $coursedom.'_'.$coursenum; |
|
$allmaps = |
|
&Apache::loncommon::allmaps_incourse($coursedom,$coursenum, |
|
$chome,$cid); |
|
$donechk = 1; |
|
} |
|
if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) { |
|
&contained_map_check($url,$folder,\%removefrommap,\%removeparam, |
|
\%addedmaps,\%hierarchy,\%titles,$allmaps); |
|
$importuploaded = 1; |
|
} elsif ($url =~ m{^/res/.+\.(page|sequence)$}) { |
|
next if ($allmaps->{$url}); |
|
} |
|
} |
if (!$residx |
if (!$residx |
|| defined($LONCAPA::map::zombies[$residx])) { |
|| defined($LONCAPA::map::zombies[$residx])) { |
$residx = &LONCAPA::map::getresidx($url,$residx); |
$residx = &LONCAPA::map::getresidx($url,$residx); |
Line 310 sub group_import {
|
Line 329 sub group_import {
|
join(':', ($name, $url, $ext, 'normal', 'res')); |
join(':', ($name, $url, $ext, 'normal', 'res')); |
} |
} |
} |
} |
return &storemap($coursenum, $coursedom, $folder.'.'.$container,1); |
if ($importuploaded) { |
|
my %import_errors; |
|
my %updated = ( |
|
removefrommap => \%removefrommap, |
|
removeparam => \%removeparam, |
|
); |
|
&apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated); |
|
if (keys(%import_errors) > 0) { |
|
$fixuperrors = |
|
'<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". |
|
'<ul>'."\n"; |
|
foreach my $key (sort(keys(%import_errors))) { |
|
$fixuperrors .= '<li>'.$key.'</li>'."\n"; |
|
} |
|
$fixuperrors .= '</ul></p>'."\n"; |
|
} |
|
} |
|
my ($errtext,$fatal) = |
|
&storemap($coursenum, $coursedom, $folder.'.'.$container,1); |
|
return ($errtext,$fatal,$fixuperrors); |
} |
} |
|
|
sub log_docs { |
sub log_docs { |
Line 391 sub docs_change_log {
|
Line 430 sub docs_change_log {
|
my %orderhash; |
my %orderhash; |
my $container='sequence'; |
my $container='sequence'; |
my $pathitem; |
my $pathitem; |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /\:1$/) { |
$container='page'; |
$container='page'; |
$pathitem = '<input type="hidden" name="pagepath" value="'. |
|
&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'; |
|
} else { |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath eq '') { |
|
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents')); |
|
} |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
|
&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
|
} |
} |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath eq '') { |
|
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents').':::::'); |
|
} |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
|
&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
my $jumpto = $readfile; |
my $jumpto = $readfile; |
$jumpto =~ s{^/}{}; |
$jumpto =~ s{^/}{}; |
Line 654 sub print_paste_buffer {
|
Line 690 sub print_paste_buffer {
|
$is_external = 1; |
$is_external = 1; |
} |
} |
|
|
my ($canpaste,$nopaste,$othercrs,$areachange,$is_uploaded_map); |
my ($canpaste,$nopaste,$othercrs,$areachange); |
if ($folder =~ /^supplemental/) { |
if ($folder =~ /^supplemental/) { |
$canpaste = &supp_pasteable($env{'docs.markedcopy_url'}); |
$canpaste = &supp_pasteable($env{'docs.markedcopy_url'}); |
unless ($canpaste) { |
unless ($canpaste) { |
Line 761 sub print_paste_buffer {
|
Line 797 sub print_paste_buffer {
|
} |
} |
} |
} |
$r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs); |
$r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs); |
if ($container eq 'page') { |
$r->print(' |
$r->print(' |
|
<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" /> |
|
<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" /> |
|
'); |
|
} else { |
|
$r->print(' |
|
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /> |
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /> |
'); |
'); |
} |
|
$r->print('</form>'); |
$r->print('</form>'); |
} else { |
} else { |
$r->print(&mt('Paste buffer contains:').' '.$buffer. |
$r->print(&mt('Paste buffer contains:').' '.$buffer. |
Line 905 sub do_paste_from_buffer {
|
Line 934 sub do_paste_from_buffer {
|
%dbcopies,%zombies,%params,%docmoves,%mapmoves,%newsubdir,%newurls); |
%dbcopies,%zombies,%params,%docmoves,%mapmoves,%newsubdir,%newurls); |
$oldurl = $url; |
$oldurl = $url; |
if ($is_map) { |
if ($is_map) { |
if ($folder =~ /^default/) { |
|
my $lastchange = &Apache::lonnet::get_coursechange($coursedom,$coursenum); |
|
if ($lastchange > $env{'request.course.tied'}) { |
|
&reinit_role($coursedom,$coursenum,$env{"course.$env{'request.course.id'}.home"}); |
|
} |
|
} |
|
# If pasting a map, check if map contains other maps |
# If pasting a map, check if map contains other maps |
my (%allmaps,%hierarchy,%titles); |
my ($allmaps,%hierarchy,%titles); |
|
$allmaps = {}; |
if ($folder =~ /^default/) { |
if ($folder =~ /^default/) { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$allmaps = |
if (defined($navmap)) { |
&Apache::loncommon::allmaps_incourse($coursedom,$coursenum, |
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_map() },1,0,1)) { |
$env{"course.$env{'request.course.id'}.home"}, |
$allmaps{$res->src()} = 1; |
$env{'request.course.id'}); |
} |
|
} |
|
} |
} |
&contained_map_check($url,$folder,\%removefrommap,\%removeparam, |
&contained_map_check($url,$folder,\%removefrommap,\%removeparam, |
\%addedmaps,\%hierarchy,\%titles,\%allmaps); |
\%addedmaps,\%hierarchy,\%titles,$allmaps); |
if ($url=~ m{^/uploaded/}) { |
if ($url=~ m{^/uploaded/}) { |
my $newurl; |
my $newurl; |
unless ($env{'form.docs.markedcopy_options'} eq 'move') { |
unless ($env{'form.docs.markedcopy_options'} eq 'move') { |
($newurl,my $error) = |
($newurl,my $error) = |
&get_newmap_url($url,$folder,$prefixchg,$coursedom,$coursenum, |
&get_newmap_url($url,$folder,$prefixchg,$coursedom,$coursenum, |
$srcdom,$srcnum,\$title,\%allmaps,\%newurls); |
$srcdom,$srcnum,\$title,$allmaps,\%newurls); |
if ($error) { |
if ($error) { |
return ($error); |
return ($error); |
} |
} |
Line 944 sub do_paste_from_buffer {
|
Line 966 sub do_paste_from_buffer {
|
if (($srcdom ne $coursedom) || ($srcnum ne $coursenum) || ($prefixchg) || |
if (($srcdom ne $coursedom) || ($srcnum ne $coursenum) || ($prefixchg) || |
(($newurl ne '') && ($newurl ne $url))) { |
(($newurl ne '') && ($newurl ne $url))) { |
unless (&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum, |
unless (&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum, |
\%allmaps,\%rewrites,\%retitles,\%copies,\%dbcopies, |
$allmaps,\%rewrites,\%retitles,\%copies,\%dbcopies, |
\%zombies,\%params,\%mapmoves,\%mapchanges,\%tomove, |
\%zombies,\%params,\%mapmoves,\%mapchanges,\%tomove, |
\%newsubdir,\%newurls)) { |
\%newsubdir,\%newurls)) { |
$mapmoves{$url} = 1; |
$mapmoves{$url} = 1; |
} |
} |
$url = $newurl; |
$url = $newurl; |
} elsif ($env{'docs.markedcopy_nested'}) { |
} elsif ($env{'docs.markedcopy_nested'}) { |
&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum,\%allmaps,\%rewrites, |
&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum,$allmaps,\%rewrites, |
\%retitles,\%copies,\%dbcopies,\%zombies,\%params,\%mapmoves, |
\%retitles,\%copies,\%dbcopies,\%zombies,\%params,\%mapmoves, |
\%mapchanges,\%tomove,\%newsubdir,\%newurls); |
\%mapchanges,\%tomove,\%newsubdir,\%newurls); |
} |
} |
Line 960 sub do_paste_from_buffer {
|
Line 982 sub do_paste_from_buffer {
|
&Apache::lonnet::delenv('docs.markedcopy'); |
&Apache::lonnet::delenv('docs.markedcopy'); |
# if pasting published map (main content are only) check map is not already in course |
# if pasting published map (main content are only) check map is not already in course |
if ($folder =~ /^default/) { |
if ($folder =~ /^default/) { |
if ($allmaps{$url}) { |
if ((ref($allmaps) eq 'HASH') && ($allmaps->{$url})) { |
return (&mt('Paste failed: only one instance of a particular published sequence or page is allowed within each course.')); |
return (&mt('Paste failed: only one instance of a particular published sequence or page is allowed within each course.')); |
} |
} |
} |
} |
Line 1026 sub do_paste_from_buffer {
|
Line 1048 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 |
my ($result,$save_err); |
my ($result,$save_err); |
|
my %updated = ( |
|
rewrites => \%rewrites, |
|
zombies => \%zombies, |
|
removefrommap => \%removefrommap, |
|
removeparam => \%removeparam, |
|
dbcopies => \%dbcopies, |
|
retitles => \%retitles, |
|
); |
|
my %info = ( |
|
newsubdir => \%newsubdir, |
|
params => \%params, |
|
before => \%before, |
|
after => \%after, |
|
); |
|
my %moves = ( |
|
copies => \%copies, |
|
docmoves => \%docmoves, |
|
mapmoves => \%mapmoves, |
|
); |
$result = |
$result = |
&apply_fixups($folder,$is_map,$prefixchg,$coursedom,$coursenum,$oldurl, |
&apply_fixups($folder,$is_map,$coursedom,$coursenum,$errors, |
$url,\%removefrommap,\%removeparam,\%rewrites,\%retitles, |
\%updated,\%info,\%moves,$prefixchg,$oldurl,$url,'paste'); |
\%copies,\%dbcopies,\%zombies,\%params,\%docmoves, |
|
\%mapmoves,\%newsubdir,$errors,\%before,\%after); |
|
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if ($is_map) { |
if ($is_map) { |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
Line 1190 sub contained_map_check {
|
Line 1229 sub contained_map_check {
|
$titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'}; |
$titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'}; |
} else { |
} else { |
if ($allmaps->{$ressrc}) { |
if ($allmaps->{$ressrc}) { |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
} elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') { |
} elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') { |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
} else { |
} else { |
Line 1214 sub contained_map_check {
|
Line 1253 sub contained_map_check {
|
return; |
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 { |
sub url_paste_fixups { |
my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$allmaps,$rewrites,$retitles,$copies, |
my ($oldurl,$folder,$prefixchg,$cdom,$cnum,$allmaps,$rewrites,$retitles,$copies, |
$dbcopies,$zombies,$params,$mapmoves,$mapchanges,$tomove,$newsubdir,$newurls) = @_; |
$dbcopies,$zombies,$params,$mapmoves,$mapchanges,$tomove,$newsubdir,$newurls) = @_; |
Line 1341 sub url_paste_fixups {
|
Line 1371 sub url_paste_fixups {
|
} |
} |
|
|
sub apply_fixups { |
sub apply_fixups { |
my ($folder,$is_map,$prefixchg,$cdom,$cnum,$oldurl,$url,$removefrommap, |
my ($folder,$is_map,$cdom,$cnum,$errors,$updated,$info,$moves,$prefixchg, |
$removeparam,$rewrites,$retitles,$copies,$dbcopies,$zombies,$params, |
$oldurl,$url,$caller) = @_; |
$docmoves,$mapmoves,$newsubdir,$errors,$before,$after) = @_; |
my (%rewrites,%zombies,%removefrommap,%removeparam,%dbcopies,%retitles, |
foreach my $key (keys(%{$copies}),keys(%{$docmoves})) { |
%params,%newsubdir,%before,%after,%copies,%docmoves,%mapmoves); |
|
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 @allcopies; |
my @allcopies; |
if (ref($copies->{$key}) eq 'HASH') { |
if (exists($copies{$key})) { |
my %added; |
if (ref($copies{$key}) eq 'HASH') { |
foreach my $innerkey (keys(%{$copies->{$key}})) { |
my %added; |
if (($innerkey ne '') && (!$added{$innerkey})) { |
foreach my $innerkey (keys(%{$copies{$key}})) { |
push(@allcopies,$innerkey); |
if (($innerkey ne '') && (!$added{$innerkey})) { |
$added{$innerkey} = 1; |
push(@allcopies,$innerkey); |
|
$added{$innerkey} = 1; |
|
} |
} |
} |
|
undef(%added); |
} |
} |
undef(%added); |
|
} |
} |
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 1371 sub apply_fixups {
|
Line 1449 sub apply_fixups {
|
my $content = &Apache::lonnet::getfile($item); |
my $content = &Apache::lonnet::getfile($item); |
unless ($content eq '-1') { |
unless ($content eq '-1') { |
my $storefn; |
my $storefn; |
if (($key eq $oldurl) && (ref($docmoves) eq 'HASH') && (exists($docmoves->{$key}))) { |
if (($key eq $oldurl) && (exists($docmoves{$key}))) { |
$storefn = $docmoves->{$key}; |
$storefn = $docmoves{$key}; |
} else { |
} else { |
$storefn = $relpath; |
$storefn = $relpath; |
$storefn =~s{^/uploaded/$match_domain/$match_courseid/}{}; |
$storefn =~s{^/uploaded/$match_domain/$match_courseid/}{}; |
if ($prefixchg) { |
if ($prefixchg && $before{'doc'} && $after{'doc'}) { |
$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 1388 sub apply_fixups {
|
Line 1466 sub apply_fixups {
|
&Apache::lonclonecourse::writefile($env{'request.course.id'}, |
&Apache::lonclonecourse::writefile($env{'request.course.id'}, |
$storefn.$fname,$content); |
$storefn.$fname,$content); |
if ($copyurl eq '/adm/notfound.html') { |
if ($copyurl eq '/adm/notfound.html') { |
if ((ref($docmoves) eq 'HASH') && (exists($docmoves->{$oldurl}))) { |
if (exists($docmoves{$oldurl})) { |
return &mt('Paste failed: an error occurred copying the file.'); |
return &mt('Paste failed: an error occurred copying the file.'); |
} elsif (ref($errors) eq 'HASH') { |
} elsif (ref($errors) eq 'HASH') { |
$errors->{$item} = 1; |
$errors->{$item} = 1; |
Line 1399 sub apply_fixups {
|
Line 1477 sub apply_fixups {
|
} |
} |
} |
} |
} |
} |
foreach my $key (keys(%{$mapmoves})) { |
foreach my $key (keys(%mapmoves)) { |
my $storefn=$key; |
my $storefn=$key; |
$storefn=~s{^/uploaded/$match_domain/$match_courseid/}{}; |
$storefn=~s{^/uploaded/$match_domain/$match_courseid/}{}; |
if ($prefixchg) { |
if ($prefixchg && $before{'map'} && $after{'map'}) { |
$storefn =~ s/^\Q$before->{'map'}\E/$after->{'map'}/; |
$storefn =~ s/^\Q$before{'map'}\E/$after{'map'}/; |
} |
} |
if ($newsubdir->{$key}) { |
if ($newsubdir{$key}) { |
$storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir->{$key}/; |
$storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/; |
} |
} |
my $mapcontent = &Apache::lonnet::getfile($key); |
my $mapcontent = &Apache::lonnet::getfile($key); |
if ($mapcontent eq '-1') { |
if ($mapcontent eq '-1') { |
Line 1426 sub apply_fixups {
|
Line 1504 sub apply_fixups {
|
} |
} |
my %updates; |
my %updates; |
if ($is_map) { |
if ($is_map) { |
foreach my $key (keys(%{$rewrites})) { |
if (ref($updated) eq 'HASH') { |
$updates{$key} = 1; |
foreach my $type (keys(%{$updated})) { |
} |
if (ref($updated->{$type}) eq 'HASH') { |
foreach my $key (keys(%{$zombies})) { |
foreach my $key (keys(%{$updated->{$type}})) { |
$updates{$key} = 1; |
$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)) { |
foreach my $key (keys(%updates)) { |
my (%torewrite,%toretitle,%toremove,%remparam,%currparam,%zombie,%newdb); |
my (%torewrite,%toretitle,%toremove,%remparam,%currparam,%zombie,%newdb); |
if (ref($rewrites->{$key}) eq 'HASH') { |
if (ref($rewrites{$key}) eq 'HASH') { |
%torewrite = %{$rewrites->{$key}}; |
%torewrite = %{$rewrites{$key}}; |
} |
} |
if (ref($retitles->{$key}) eq 'HASH') { |
if (ref($retitles{$key}) eq 'HASH') { |
%toretitle = %{$retitles->{$key}}; |
%toretitle = %{$retitles{$key}}; |
} |
} |
if (ref($removefrommap->{$key}) eq 'HASH') { |
if (ref($removefrommap{$key}) eq 'HASH') { |
%toremove = %{$removefrommap->{$key}}; |
%toremove = %{$removefrommap{$key}}; |
} |
} |
if (ref($removeparam->{$key}) eq 'HASH') { |
if (ref($removeparam{$key}) eq 'HASH') { |
%remparam = %{$removeparam->{$key}}; |
%remparam = %{$removeparam{$key}}; |
} |
} |
if (ref($zombies->{$key}) eq 'HASH') { |
if (ref($zombies{$key}) eq 'HASH') { |
%zombie = %{$zombies->{$key}}; |
%zombie = %{$zombies{$key}}; |
} |
} |
if (ref($dbcopies->{$key}) eq 'HASH') { |
if (ref($dbcopies{$key}) eq 'HASH') { |
foreach my $item (keys(%{$dbcopies->{$key}})) { |
foreach my $item (keys(%{$dbcopies{$key}})) { |
$newdb{$item} = &dbcopy($item); |
$newdb{$item} = &dbcopy($item); |
} |
} |
} |
} |
if (ref($params->{$key}) eq 'HASH') { |
if (ref($params{$key}) eq 'HASH') { |
%currparam = %{$params->{$key}}; |
%currparam = %{$params{$key}}; |
} |
} |
my ($errtext,$fatal) = &LONCAPA::map::mapread($key); |
my ($errtext,$fatal) = &LONCAPA::map::mapread($key); |
if ($fatal) { |
if ($fatal) { |
Line 1481 sub apply_fixups {
|
Line 1550 sub apply_fixups {
|
} |
} |
} |
} |
} |
} |
for (my $i=0; $i<@LONCAPA::map::resources; $i++) { |
for (my $i=0; $i<@LONCAPA::map::order; $i++) { |
if (defined($LONCAPA::map::resources[$i])) { |
my $idx = $LONCAPA::map::order[$i]; |
|
if (defined($LONCAPA::map::resources[$idx])) { |
my $changed; |
my $changed; |
my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::resources[$i]); |
my ($title,$src,$ext,$type)=split(/\:/,$LONCAPA::map::resources[$idx]); |
if ($toremove{$src} eq $i) { |
if ((exists($toremove{$idx})) && ($toremove{$idx} eq $src)) { |
splice(@LONCAPA::map::order,$i,1); |
splice(@LONCAPA::map::order,$i,1); |
if (ref($currparam{$i}) eq 'ARRAY') { |
if (ref($currparam{$idx}) eq 'ARRAY') { |
foreach my $name (@{$currparam{$i}}) { |
foreach my $name (@{$currparam{$idx}}) { |
&LONCAPA::map::delparameter($i,'parameter_'.$name); |
&LONCAPA::map::delparameter($idx,'parameter_'.$name); |
} |
} |
} |
} |
next; |
next; |
} |
} |
my $origsrc = $src; |
my $origsrc = $src; |
if ((exists($toretitle{$src})) && ($toretitle{$src} eq $i)) { |
if ((exists($toretitle{$src})) && ($toretitle{$src} eq $idx)) { |
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 $i)) { |
if ((exists($torewrite{$src})) && ($torewrite{$src} eq $idx)) { |
$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) { |
if ($prefixchg && $before{'map'} && $after{'map'}) { |
if ($src =~ /\.(page|sequence)$/) { |
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 { |
} 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 ($newsubdir->{$origsrc}) { |
if ($newsubdir{$origsrc}) { |
if ($src =~ /\.(page|sequence)$/) { |
if ($src =~ /\.(page|sequence)$/) { |
$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 { |
} else { |
$src =~ s#^(/uploaded/$match_domain/$match_courseid/\w+/)(\d+)#$1$newsubdir->{$origsrc}#; |
$src =~ s#^(/uploaded/$match_domain/$match_courseid/\w+/)(\d+)#$1$newsubdir{$origsrc}#; |
} |
} |
} |
} |
} |
} |
Line 1524 sub apply_fixups {
|
Line 1594 sub apply_fixups {
|
$changed = 1; |
$changed = 1; |
} |
} |
if ($changed) { |
if ($changed) { |
$LONCAPA::map::resources[$i] = join(':',($title,$src,$ext,$type)); |
$LONCAPA::map::resources[$idx] = join(':',($title,$src,$ext,$type)); |
} |
} |
} |
} |
} |
} |
Line 1542 sub apply_fixups {
|
Line 1612 sub apply_fixups {
|
} else { |
} else { |
$storefn = $key; |
$storefn = $key; |
$storefn=~s{^/uploaded/$match_domain/$match_courseid/}{}; |
$storefn=~s{^/uploaded/$match_domain/$match_courseid/}{}; |
if ($prefixchg) { |
if ($prefixchg && $before{'map'} && $after{'map'}) { |
$storefn =~ s/^\Q$before->{'map'}\E/$after->{'map'}/; |
$storefn =~ s/^\Q$before{'map'}\E/$after{'map'}/; |
} |
} |
if ($newsubdir->{$key}) { |
if ($newsubdir{$key}) { |
$storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir->{$key}/; |
$storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/; |
} |
} |
} |
} |
my $report; |
my $report; |
if ($folder !~ /^supplemental/) { |
if ($folder !~ /^supplemental/) { |
$report = 1; |
$report = 1; |
} |
} |
my ($outtext,$errtext) = |
(my $outtext,$errtext) = |
&LONCAPA::map::storemap("/uploaded/$cdom/$cnum/$storefn",1,$report); |
&LONCAPA::map::storemap("/uploaded/$cdom/$cnum/$storefn",1,$report); |
if ($errtext) { |
if ($errtext) { |
return &mt('Paste failed: an error occurred saving the folder or page.'); |
if ($caller eq 'paste') { |
|
return &mt('Paste failed: an error occurred saving the folder or page.'); |
|
} |
} |
} |
} |
} |
} |
} |
Line 1692 sub handle_edit_cmd {
|
Line 1764 sub handle_edit_cmd {
|
sub editor { |
sub editor { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_; |
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_; |
my $container= ($env{'form.pagepath'}) ? 'page' |
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container); |
: 'sequence'; |
|
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order); |
|
if ($allowed) { |
if ($allowed) { |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) = |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain, |
|
$is_random_order,$container) = |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
$r->print($breadcrumbtrail); |
$r->print($breadcrumbtrail); |
|
} elsif ($env{'form.folderpath'} =~ /\:1$/) { |
|
$container = 'page'; |
|
} else { |
|
$container = 'sequence'; |
} |
} |
|
|
my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; |
my $jumpto; |
|
|
|
unless ($supplementalflag) { |
|
$jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'"; |
|
} |
|
|
unless ($allowed) { |
unless ($allowed) { |
$randompick = -1; |
$randompick = -1; |
Line 1793 sub editor {
|
Line 1872 sub editor {
|
push(@imports, [$name, $url, $residx]); |
push(@imports, [$name, $url, $residx]); |
} |
} |
} |
} |
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, |
($errtext,$fatal,my $fixuperrors) = |
$container,'londocs',@imports); |
&group_import($coursenum, $coursedom, $folder,$container, |
|
'londocs',@imports); |
return $errtext if ($fatal); |
return $errtext if ($fatal); |
|
if ($fixuperrors) { |
|
$r->print($fixuperrors); |
|
} |
} |
} |
# Loading a complete map |
# Loading a complete map |
if ($env{'form.loadmap'}) { |
if ($env{'form.loadmap'}) { |
Line 1862 sub editor {
|
Line 1945 sub editor {
|
unless ($name) { $idx++; next; } |
unless ($name) { $idx++; next; } |
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$coursenum,$coursedom,$crstype, |
$coursenum,$coursedom,$crstype, |
$pathitem,$supplementalflag); |
$pathitem,$supplementalflag,$container); |
$idx++; |
$idx++; |
$shown++; |
$shown++; |
} |
} |
&Apache::loncommon::end_data_table_count(); |
&Apache::loncommon::end_data_table_count(); |
|
|
if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) { |
if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) { |
|
my $toolslink = '<table><tr><td>' |
|
.&Apache::loncommon::help_open_menu('Navigation Screen', |
|
'Navigation_Screen',undef,'RAT') |
|
.'</td><td class="LC_middle">'.&mt('Tools:').'</td>' |
|
.'<td align="left"><ul id="LC_toolbar">' |
|
.'<li><a href="/adm/coursedocs?forcesupplement=1&command=editsupp" ' |
|
.'id="LC_content_toolbar_edittoplevel" ' |
|
.'class="LC_toolbarItem" ' |
|
.'title="'.&mt('Supplemental Content Editor').'">' |
|
.'</a></li></ul></td></tr></table><br />'; |
if ($shown) { |
if ($shown) { |
if ($allowed) { |
if ($allowed) { |
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') |
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') |
Line 1886 sub editor {
|
Line 1979 sub editor {
|
.'<br style="line-height:2px;" />' |
.'<br style="line-height:2px;" />' |
.&Apache::loncommon::end_scrollbox(); |
.&Apache::loncommon::end_scrollbox(); |
} else { |
} else { |
$to_show = '<table><tr><td>'.&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT') |
$to_show .= $toolslink |
.'</td><td class="LC_middle">'.&mt('Tools:').'</td>' |
|
.'<td align="left"><ul id="LC_toolbar">' |
|
.'<li><a href="/adm/coursedocs?forcesupplement=1" ' |
|
.'id="LC_content_toolbar_edittoplevel" ' |
|
.'class="LC_toolbarItem" ' |
|
.'title="'.&mt('Supplemental Content Editor').'">' |
|
.'</a></li></ul></td></tr></table><br />' |
|
.&Apache::loncommon::start_data_table('LC_tableOfContent') |
.&Apache::loncommon::start_data_table('LC_tableOfContent') |
.$output.' ' |
.$output.' ' |
.&Apache::loncommon::end_data_table(); |
.&Apache::loncommon::end_data_table(); |
} |
} |
} else { |
} else { |
|
if (!$allowed) { |
|
$to_show .= $toolslink; |
|
} |
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') |
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') |
.'<div class="LC_info" id="contentlist">' |
.'<div class="LC_info" id="contentlist">' |
.&mt('Currently no documents.') |
.&mt('Currently no documents.') |
Line 1948 sub process_file_upload {
|
Line 2037 sub process_file_upload {
|
my $errtext=''; |
my $errtext=''; |
my $fatal=0; |
my $fatal=0; |
my $container='sequence'; |
my $container='sequence'; |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /:1$/) { |
$container='page'; |
$container='page'; |
} |
} |
($errtext,$fatal)= |
($errtext,$fatal)= |
Line 2038 sub process_file_upload {
|
Line 2127 sub process_file_upload {
|
my $archiveurl = &HTML::Entities::encode($url,'<>&"'); |
my $archiveurl = &HTML::Entities::encode($url,'<>&"'); |
my %archiveitems = ( |
my %archiveitems = ( |
folderpath => $env{'form.folderpath'}, |
folderpath => $env{'form.folderpath'}, |
pagepath => $env{'form.pagepath'}, |
|
cmd => $nextphase, |
cmd => $nextphase, |
newidx => $newidx, |
newidx => $newidx, |
position => $position, |
position => $position, |
Line 2093 sub is_supplemental_title {
|
Line 2181 sub is_supplemental_title {
|
|
|
sub entryline { |
sub entryline { |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
$crstype,$pathitem,$supplementalflag)=@_; |
$crstype,$pathitem,$supplementalflag,$container)=@_; |
my ($foldertitle,$pagetitle,$renametitle); |
my ($foldertitle,$renametitle); |
if (&is_supplemental_title($title)) { |
if (&is_supplemental_title($title)) { |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
$pagetitle = $foldertitle; |
|
} else { |
} else { |
$title=&HTML::Entities::encode($title,'"<>&\''); |
$title=&HTML::Entities::encode($title,'"<>&\''); |
$renametitle=$title; |
$renametitle=$title; |
$foldertitle=$title; |
$foldertitle=$title; |
$pagetitle=$title; |
|
} |
} |
|
|
my $orderidx=$LONCAPA::map::order[$index]; |
my $orderidx=$LONCAPA::map::order[$index]; |
Line 2113 sub entryline {
|
Line 2199 sub entryline {
|
my $line=&Apache::loncommon::start_data_table_row(); |
my $line=&Apache::loncommon::start_data_table_row(); |
my ($form_start,$form_end,$form_common); |
my ($form_start,$form_end,$form_common); |
# Edit commands |
# Edit commands |
my ($container, $type, $esc_path, $path, $symb); |
my ($type, $esc_path, $path, $symb); |
|
if ($container eq 'page') { |
|
$type = 'page'; |
|
} else { |
|
$type = 'folder'; |
|
} |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
$type = 'folder'; |
|
$container = 'sequence'; |
|
$esc_path=&escape($env{'form.folderpath'}); |
$esc_path=&escape($env{'form.folderpath'}); |
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
# $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; |
my $isexternal; |
if ($residx) { |
if ($residx) { |
my $currurl = $url; |
my $currurl = $url; |
Line 2142 sub entryline {
|
Line 2226 sub entryline {
|
&Apache::lonnet::declutter($currurl)); |
&Apache::lonnet::declutter($currurl)); |
} |
} |
} |
} |
my %lt; |
my ($renamelink,%lt); |
if ($allowed) { |
if ($allowed) { |
my $incindex=$index+1; |
my $incindex=$index+1; |
my $selectbox=''; |
my $selectbox=''; |
Line 2239 sub entryline {
|
Line 2323 sub entryline {
|
$nocopy=1; |
$nocopy=1; |
} |
} |
} |
} |
my ($copylink,$cutlink,$removelink,$renamelink); |
my ($copylink,$cutlink,$removelink); |
my $skip_confirm = 0; |
my $skip_confirm = 0; |
if ( $folder =~ /^supplemental/ |
if ( $folder =~ /^supplemental/ |
|| ($url =~ m{( /smppg$ |
|| ($url =~ m{( /smppg$ |
Line 2258 sub entryline {
|
Line 2342 sub entryline {
|
ENDCOPY |
ENDCOPY |
} else { |
} else { |
$copylink=(<<ENDCOPY); |
$copylink=(<<ENDCOPY); |
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a> |
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$folder');" class="LC_docs_copy">$lt{'cp'}</a> |
ENDCOPY |
ENDCOPY |
} |
} |
if ($nocut) { |
if ($nocut) { |
Line 2267 ENDCOPY
|
Line 2351 ENDCOPY
|
ENDCUT |
ENDCUT |
} else { |
} else { |
$cutlink=(<<ENDCUT); |
$cutlink=(<<ENDCUT); |
<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a> |
<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a> |
ENDCUT |
ENDCUT |
} |
} |
if ($noremove) { |
if ($noremove) { |
Line 2276 ENDCUT
|
Line 2360 ENDCUT
|
ENDREM |
ENDREM |
} else { |
} else { |
$removelink=(<<ENDREM); |
$removelink=(<<ENDREM); |
<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a> |
<a href='javascript:removeres("$esc_path","$index","$renametitle",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a> |
ENDREM |
ENDREM |
} |
} |
$renamelink=(<<ENDREN); |
unless ($isexternal) { |
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a> |
$renamelink=(<<ENDREN); |
|
<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a> |
ENDREN |
ENDREN |
|
} |
$form_start = ' |
$form_start = ' |
<form action="/adm/coursedocs" method="post"> |
<form action="/adm/coursedocs" method="post"> |
'; |
'; |
Line 2313 END
|
Line 2399 END
|
</td> |
</td> |
<td class="LC_docs_entry_commands"><span class="LC_nobreak"> |
<td class="LC_docs_entry_commands"><span class="LC_nobreak"> |
$removelink |
$removelink |
$renamelink |
|
$cutlink |
$cutlink |
$copylink |
$copylink |
</span> |
</span> |
Line 2325 END
|
Line 2410 END
|
my ($extension)=($url=~/\.(\w+)$/); |
my ($extension)=($url=~/\.(\w+)$/); |
my $uploaded=($url=~/^\/*uploaded\//); |
my $uploaded=($url=~/^\/*uploaded\//); |
my $icon=&Apache::loncommon::icon($url); |
my $icon=&Apache::loncommon::icon($url); |
my $isfolder=0; |
my $isfolder; |
my $ispage=0; |
my $ispage; |
my $folderarg; |
my $containerarg; |
my $pagearg; |
|
my $pagefile; |
|
if ($uploaded) { |
if ($uploaded) { |
if (($extension eq 'sequence') || ($extension eq 'page')) { |
if (($extension eq 'sequence') || ($extension eq 'page')) { |
$url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/; |
$url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/; |
my $containerarg = $1; |
$containerarg = $1; |
if ($extension eq 'sequence') { |
if ($extension eq 'sequence') { |
$icon=$iconpath.'navmap.folder.closed.gif'; |
$icon=$iconpath.'navmap.folder.closed.gif'; |
$folderarg=$containerarg; |
|
$isfolder=1; |
$isfolder=1; |
} else { |
} else { |
$icon=$iconpath.'page.gif'; |
$icon=$iconpath.'page.gif'; |
$pagearg=$containerarg; |
|
$ispage=1; |
$ispage=1; |
} |
} |
if ($allowed) { |
if ($allowed) { |
Line 2353 END
|
Line 2434 END
|
} |
} |
} |
} |
|
|
my $editlink; |
my ($editlink,$extresform); |
my $orig_url = $url; |
my $orig_url = $url; |
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
$url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
if (!$supplementalflag && $residx && $symb) { |
if (!$supplementalflag && $residx && $symb) { |
if ($container eq 'page') { |
|
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]); |
|
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
|
} |
|
if ((!$isfolder) && (!$ispage)) { |
if ((!$isfolder) && (!$ispage)) { |
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
$url=&Apache::lonnet::clutter($url); |
$url=&Apache::lonnet::clutter($url); |
Line 2386 END
|
Line 2463 END
|
} |
} |
} |
} |
my ($rand_pick_text,$rand_order_text); |
my ($rand_pick_text,$rand_order_text); |
if ($isfolder || $extension eq 'sequence') { |
if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') { |
my $foldername=&escape($foldertitle); |
my $foldername=&escape($foldertitle); |
my $folderpath=$env{'form.folderpath'}; |
my $folderpath=$env{'form.folderpath'}; |
if ($folderpath) { $folderpath.='&' }; |
if ($folderpath) { $folderpath.='&' }; |
if (!$allowed && $supplementalflag) { |
if (!$allowed && $supplementalflag) { |
$folderpath.=$folderarg.'&'.$foldername; |
$folderpath.=$containerarg.'&'.$foldername; |
$url.='folderpath='.&escape($folderpath); |
$url.='folderpath='.&escape($folderpath); |
} else { |
} else { |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# so it gets transferred between levels |
# so it gets transferred between levels |
$folderpath.=$folderarg.'&'.$foldername. |
$folderpath.=$containerarg.'&'.$foldername. |
':'.(&LONCAPA::map::getparameter($orderidx, |
':'.(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0] |
'parameter_randompick'))[0] |
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
Line 2404 END
|
Line 2481 END
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_encrypturl'))[0]=~/^yes$/i) |
'parameter_encrypturl'))[0]=~/^yes$/i) |
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_randomorder'))[0]=~/^yes$/i); |
'parameter_randomorder'))[0]=~/^yes$/i) |
|
.':'.$ispage; |
$url.='folderpath='.&escape($folderpath); |
$url.='folderpath='.&escape($folderpath); |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]; |
'parameter_randompick'))[0]; |
Line 2438 $form_common.'
|
Line 2516 $form_common.'
|
$url .= '&idx='.$orderidx; |
$url .= '&idx='.$orderidx; |
} |
} |
} |
} |
if ($ispage) { |
my ($tdalign,$tdwidth); |
my $pagename=&escape($pagetitle); |
|
my $pagepath; |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath) { $pagepath = $folderpath.'&' }; |
|
$pagepath.=$pagearg.'&'.$pagename; |
|
$url.='pagepath='.&escape($pagepath). |
|
'&pagesymb='.&escape($symb); |
|
} |
|
if ($allowed) { |
if ($allowed) { |
my $fileloc = |
my $fileloc = |
&Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url)); |
&Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url)); |
if ($isexternal) { |
if ($isexternal) { |
$editlink = ' '. |
($editlink,$extresform) = |
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); |
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); |
} elsif (!$isfolder && !$ispage) { |
} elsif (!$isfolder && !$ispage) { |
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
Line 2463 $form_common.'
|
Line 2533 $form_common.'
|
$forceedit, |
$forceedit, |
undef,$symb, |
undef,$symb, |
&escape($env{'form.folderpath'}), |
&escape($env{'form.folderpath'}), |
$renametitle); |
$renametitle,'','',1); |
if ($jscall) { |
if ($jscall) { |
$editlink = ' <a class="LC_docs_ext_edit" href="javascript:'. |
$editlink = '<a class="LC_docs_ext_edit" href="javascript:'. |
$jscall.'" >'.&mt('Edit').'</a>'; |
$jscall.'" >'.&mt('Edit').'</a> '."\n"; |
} |
} |
} |
} |
} |
} |
|
$tdalign = ' align="right" valign="top"'; |
|
$tdwidth = ' width="80%"'; |
} |
} |
my $reinit; |
my $reinit; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$reinit = &mt('(re-initialize community to access)'); |
$reinit = &mt('(re-initialize community to access)'); |
} else { |
} else { |
$reinit = &mt('(re-initialize course to access)'); |
$reinit = &mt('(re-initialize course to access)'); |
} |
} |
$line.='<td>'; |
$line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink; |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>'; |
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>'; |
} elsif ($url) { |
} elsif ($url) { |
Line 2486 $form_common.'
|
Line 2558 $form_common.'
|
} else { |
} else { |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
} |
} |
$line.='</td><td>'; |
$line.='</span></td><td'.$tdwidth.'>'; |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
$line.='<a href="'.$url.'">'.$title.'</a>'; |
$line.='<a href="'.$url.'">'.$title.'</a>'; |
} elsif ($url) { |
} elsif ($url) { |
Line 2495 $form_common.'
|
Line 2567 $form_common.'
|
} else { |
} else { |
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>'; |
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>'; |
} |
} |
$line.=$editlink."</td>"; |
$line.="$extresform</td>"; |
$rand_pick_text = ' ' if ($rand_pick_text eq ''); |
$rand_pick_text = ' ' if ($rand_pick_text eq ''); |
$rand_order_text = ' ' if ($rand_order_text eq ''); |
$rand_order_text = ' ' if ($rand_order_text eq ''); |
if (($allowed) && ($folder!~/^supplemental/)) { |
if (($allowed) && ($folder!~/^supplemental/)) { |
Line 2645 sub checkonthis {
|
Line 2717 sub checkonthis {
|
$r->print('<span class="LC_error">'.&mt('connection down').'</span>'); |
$r->print('<span class="LC_error">'.&mt('connection down').'</span>'); |
} elsif ($result eq 'not_found') { |
} elsif ($result eq 'not_found') { |
unless ($url=~/\$/) { |
unless ($url=~/\$/) { |
$r->print('<span class="LC_error">'.&mt('not found').'</b></span>'); |
$r->print('<span class="LC_error">'.&mt('not found').'</span>'); |
} else { |
} else { |
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>'); |
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>'); |
} |
} |
Line 2691 sub list_symbs {
|
Line 2763 sub list_symbs {
|
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<td>'.$res->compTitle().'</td>'. |
'<td>'.$res->compTitle().'</td>'. |
'<td>'.$res->symb().'</td>'. |
'<td>'.$res->symb().'</td>'. |
&Apache::loncommon::start_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
$count ++; |
$count ++; |
} |
} |
if (!$count) { |
if (!$count) { |
Line 2701 sub list_symbs {
|
Line 2773 sub list_symbs {
|
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
|
|
Line 2731 sub verifycontent {
|
Line 2804 sub verifycontent {
|
} |
} |
&untiehash(); |
&untiehash(); |
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
|
|
Line 2810 sub checkversions {
|
Line 2884 sub checkversions {
|
if ($env{'form.timerange'} eq 'all') { |
if ($env{'form.timerange'} eq 'all') { |
# show all documents |
# show all documents |
$header=&mt('All Documents in '.$crstype); |
$header=&mt('All Documents in '.$crstype); |
$allsel=1; |
$allsel=' selected="selected"'; |
foreach my $key (keys(%hash)) { |
foreach my $key (keys(%hash)) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
my $src=$1; |
my $src=$1; |
Line 2831 sub checkversions {
|
Line 2905 sub checkversions {
|
.&mt('seconds'); |
.&mt('seconds'); |
if ($env{'form.timerange'}==-1) { |
if ($env{'form.timerange'}==-1) { |
$seltext='since start of course'; |
$seltext='since start of course'; |
$startsel='selected'; |
$startsel=' selected="selected"'; |
$env{'form.timerange'}=time; |
$env{'form.timerange'}=time; |
} |
} |
$starttime=time-$env{'form.timerange'}; |
$starttime=time-$env{'form.timerange'}; |
if ($env{'form.timerange'}==2592000) { |
if ($env{'form.timerange'}==2592000) { |
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$monthsel='selected'; |
$monthsel=' selected="selected"'; |
} elsif ($env{'form.timerange'}==604800) { |
} elsif ($env{'form.timerange'}==604800) { |
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$weeksel='selected'; |
$weeksel=' selected="selected"'; |
} elsif ($env{'form.timerange'}==86400) { |
} elsif ($env{'form.timerange'}==86400) { |
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$daysel='selected'; |
$daysel=' selected="selected"'; |
} |
} |
$header=&mt('Content changed').' '.$seltext; |
$header=&mt('Content changed').' '.$seltext; |
} else { |
} else { |
Line 2881 sub checkversions {
|
Line 2955 sub checkversions {
|
<fieldset> |
<fieldset> |
<legend>$lt{'cd'}</legend> |
<legend>$lt{'cd'}</legend> |
<select name="timerange"> |
<select name="timerange"> |
<option value='all' $allsel>$lt{'al'}</option> |
<option value='all'$allsel>$lt{'al'}</option> |
<option value="-1" $startsel>$lt{'st'}</option> |
<option value="-1"$startsel>$lt{'st'}</option> |
<option value="2592000" $monthsel>$lt{'lm'}</option> |
<option value="2592000"$monthsel>$lt{'lm'}</option> |
<option value="604800" $weeksel>$lt{'lw'}</option> |
<option value="604800"$weeksel>$lt{'lw'}</option> |
<option value="86400" $daysel>$lt{'sy'}</option> |
<option value="86400"$daysel>$lt{'sy'}</option> |
</select> |
</select> |
<input type="submit" name="display" value="$lt{'sd'}" /> |
<input type="submit" name="display" value="$lt{'sd'}" /> |
</fieldset> |
</fieldset> |
Line 2901 $lt{'sc'}: <input type="submit" name="se
|
Line 2975 $lt{'sc'}: <input type="submit" name="se
|
<hr /> |
<hr /> |
<h4>$lt{'vers'}</h4> |
<h4>$lt{'vers'}</h4> |
<input type="submit" name="setversions" value="$lt{'save'}" /> |
<input type="submit" name="setversions" value="$lt{'save'}" /> |
<table border="0"> |
|
ENDHEADERS |
ENDHEADERS |
#number of columns for version history |
#number of columns for version history |
my $num_ver_col = 1; |
|
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Resources').'</th>'. |
'<th>'.&mt('Resources').'</th>'. |
"<th>$lt{'mr'}</th>". |
"<th>$lt{'mr'}</th>". |
"<th>$lt{'ve'}</th>". |
"<th>$lt{'ve'}</th>". |
"<th>$lt{'vu'}</th>". |
"<th>$lt{'vu'}</th>". |
'<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'. |
'<th>'.&mt('History').'</th>'. |
'</b>'); |
&Apache::loncommon::end_data_table_header_row() |
|
); |
foreach my $key (sort(keys(%changes))) { |
foreach my $key (sort(keys(%changes))) { |
#excludes not versionable problems from resource version history: |
#excludes not versionable problems from resource version history: |
if ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/) { |
next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my $currentversion=&Apache::lonnet::getversion($key); |
my $currentversion=&Apache::lonnet::getversion($key); |
if ($currentversion<0) { |
if ($currentversion<0) { |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
} |
} |
my $linkurl=&Apache::lonnet::clutter($key); |
my $linkurl=&Apache::lonnet::clutter($key); |
$r->print( |
$r->print( |
&Apache::loncommon::end_data_table_header_row(). |
|
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'. |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('. |
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
'<td align="right">'); |
'<td align="right">' |
# Used in course |
); |
my $usedversion=$hash{'version_'.$linkurl}; |
# Used in course |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
my $usedversion=$hash{'version_'.$linkurl}; |
if($usedversion != $currentversion){ |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
|
if ($usedversion != $currentversion) { |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
}else{ |
} else { |
$r->print($usedversion); |
$r->print($usedversion); |
} |
} |
} else { |
|
$r->print($currentversion); |
|
} |
|
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
|
# Set version |
|
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
|
'set_version_'.$linkurl, |
|
{'select_form_order' => |
|
['',1..$currentversion,'mostrecent'], |
|
'' => '', |
|
'mostrecent' => &mt('most recent'), |
|
map {$_,$_} (1..$currentversion)})); |
|
my $lastold=1; |
|
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
|
my $url=$root.'.'.$prevvers.'.'.$extension; |
|
if (&Apache::lonnet::metadata($url,'lastrevisiondate')< |
|
$starttime) { |
|
$lastold=$prevvers; |
|
} |
|
} |
|
# |
|
# Code to figure out how many version entries should go in |
|
# each of the four columns |
|
my $entries_per_col = 0; |
|
my $num_entries = ($currentversion-$lastold); |
|
if ($num_entries % $num_ver_col == 0) { |
|
$entries_per_col = $num_entries/$num_ver_col; |
|
} else { |
} else { |
$entries_per_col = $num_entries/$num_ver_col + 1; |
$r->print($currentversion); |
} |
} |
my $entries_count = 0; |
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
# Set version |
my $cols_output = 1; |
$r->print(&Apache::loncommon::select_form( |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
$setversions{$linkurl}, |
my $url=$root.'.'.$prevvers.'.'.$extension; |
'set_version_'.$linkurl, |
$r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url). |
{'select_form_order' => ['',1..$currentversion,'mostrecent'], |
'">'.&mt('Version').' '.$prevvers.'</a> ('. |
'' => '', |
&Apache::lonlocal::locallocaltime( |
'mostrecent' => &mt('most recent'), |
&Apache::lonnet::metadata($url, |
map {$_,$_} (1..$currentversion)})); |
'lastrevisiondate') |
my $lastold=1; |
). |
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
')'); |
my $url=$root.'.'.$prevvers.'.'.$extension; |
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { |
if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { |
$r->print(' <a href="/adm/diff?filename='. |
$lastold=$prevvers; |
&Apache::lonnet::clutter($root.'.'.$extension). |
} |
'&versionone='.$prevvers. |
} |
'" target="diffs">'.&mt('Diffs').'</a>'); |
$r->print('</td>'); |
} |
# List all available versions |
$r->print('</span><br />'); |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
if (++$entries_count % $entries_per_col == 0) { |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
$r->print('</span></td>'); |
my $url=$root.'.'.$prevvers.'.'.$extension; |
if ($cols_output != $num_ver_col) { |
$r->print( |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
'<span class="LC_nobreak">' |
$cols_output++; |
.'<a href="'.&Apache::lonnet::clutter($url).'">' |
} |
.&mt('Version [_1]',$prevvers).'</a>' |
} |
.' ('.&Apache::lonlocal::locallocaltime( |
} |
&Apache::lonnet::metadata($url,'lastrevisiondate')) |
while($cols_output++ < $num_ver_col) { |
.')'); |
$r->print('</span></td><td>'); |
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { |
|
$r->print( |
|
' <a href="/adm/diff?filename='. |
|
&Apache::lonnet::clutter($root.'.'.$extension). |
|
&HTML::Entities::encode('&versionone='.$prevvers,'"<>&'). |
|
'" target="diffs">'.&mt('Diffs').'</a>'); |
} |
} |
} |
$r->print('</span><br />'); |
|
} |
|
$r->print('</span></td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print('</td>'.&Apache::loncommon::end_data_table_row(). |
$r->print( |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'); |
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'. |
|
'</form>' |
|
); |
|
|
&untiehash(); |
&untiehash(); |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
sub mark_hash_old { |
sub mark_hash_old { |
Line 3037 sub changewarning {
|
Line 3093 sub changewarning {
|
my $pathvar='folderpath'; |
my $pathvar='folderpath'; |
my $path=&escape($env{'form.folderpath'}); |
my $path=&escape($env{'form.folderpath'}); |
if (!defined($url)) { |
if (!defined($url)) { |
if (defined($env{'form.pagepath'})) { |
|
$pathvar='pagepath'; |
|
$path=&escape($env{'form.pagepath'}); |
|
$path.='&pagesymb='.&escape($env{'form.pagesymb'}); |
|
} |
|
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
} |
} |
my $course_type = &Apache::loncommon::course_type(); |
my $course_type = &Apache::loncommon::course_type(); |
Line 3215 sub handler {
|
Line 3266 sub handler {
|
# Get the parameters that may be needed |
# Get the parameters that may be needed |
# |
# |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','pagepath', |
['folderpath', |
'pagesymb','forcesupplement','forcestandard', |
'forcesupplement','forcestandard', |
'tools','symb','command','supppath']); |
'tools','symb','command','supppath']); |
|
|
# standard=1: this is a "new-style" course with an uploaded map as top level |
# standard=1: this is a "new-style" course with an uploaded map as top level |
Line 3231 sub handler {
|
Line 3282 sub handler {
|
|
|
|
|
my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); |
my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); |
if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) { |
if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) { |
$supplementalflag=0; |
$supplementalflag=0; |
} |
} |
if ($env{'form.forcesupplement'}) { $supplementalflag=1; } |
if ($env{'form.forcesupplement'}) { $supplementalflag=1; } |
Line 3250 sub handler {
|
Line 3301 sub handler {
|
|
|
# Do we directly jump somewhere? |
# Do we directly jump somewhere? |
|
|
if ($env{'form.command'} eq 'direct') { |
if (($env{'form.command'} eq 'direct') || ($env{'form.command'} eq 'directnav')) { |
my ($mapurl,$id,$resurl); |
|
if ($env{'form.symb'} ne '') { |
if ($env{'form.symb'} ne '') { |
($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); |
$env{'form.folderpath'}= |
if ($resurl=~/\.(sequence|page)$/) { |
&Apache::loncommon::symb_to_docspath($env{'form.symb'}); |
$mapurl=$resurl; |
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => |
} elsif ($resurl eq 'adm/navmaps') { |
$env{'form.command'}.'_'.$env{'form.symb'}}); |
$mapurl=$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
} |
|
my $mapresobj; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$mapresobj = $navmap->getResourceByUrl($mapurl); |
|
} |
|
$mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1}; |
|
my $type=$2; |
|
my $path; |
|
if (ref($mapresobj)) { |
|
my $pcslist = $mapresobj->map_hierarchy(); |
|
if ($pcslist ne '') { |
|
foreach my $pc (split(/,/,$pcslist)) { |
|
next if ($pc <= 1); |
|
my $res = $navmap->getByMapPc($pc); |
|
if (ref($res)) { |
|
my $thisurl = $res->src(); |
|
$thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
|
my $thistitle = $res->title(); |
|
$path .= '&'. |
|
&Apache::lonhtmlcommon::entity_encode($thisurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($thistitle). |
|
':'.$res->randompick(). |
|
':'.$res->randomout(). |
|
':'.$res->encrypted(). |
|
':'.$res->randomorder(); |
|
} |
|
} |
|
} |
|
$path =~ s/^\&//; |
|
my $maptitle = $mapresobj->title(); |
|
if ($mapurl eq 'default') { |
|
$maptitle = 'Main Course Documents'; |
|
} |
|
$path .= (($path ne '')? '&' : ''). |
|
&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle). |
|
':'.$mapresobj->randompick(). |
|
':'.$mapresobj->randomout(). |
|
':'.$mapresobj->encrypted(). |
|
':'.$mapresobj->randomorder(); |
|
} else { |
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
|
if ($mapurl eq 'default') { |
|
$maptitle = 'Main Course Documents'; |
|
} |
|
$path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
|
} |
|
unless ($mapurl eq 'default') { |
|
$path = 'default&'. |
|
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
|
'::::&'.$path; |
|
} |
|
if ($type eq 'sequence') { |
|
$env{'form.folderpath'}=$path; |
|
$env{'form.pagepath'}=''; |
|
} else { |
|
$env{'form.pagepath'}=$path; |
|
$env{'form.folderpath'}=''; |
|
} |
|
} 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'} => |
|
$env{'form.command'}.'_'.$env{'form.supppath'}}); |
} |
} |
} elsif ($env{'form.command'} eq 'editdocs') { |
} elsif ($env{'form.command'} eq 'editdocs') { |
$env{'form.folderpath'} = 'default&'. |
$env{'form.folderpath'} = 'default&'. |
&Apache::lonhtmlcommon::entity_encode('Main Course Content'); |
&Apache::lonhtmlcommon::entity_encode('Main Course Content'). |
$env{'form.pagepath'}=''; |
':::::'; |
|
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}}); |
} elsif ($env{'form.command'} eq 'editsupp') { |
} elsif ($env{'form.command'} eq 'editsupp') { |
$env{'form.folderpath'} = 'default&'. |
$env{'form.folderpath'} = 'supplemental&'. |
&Apache::lonhtmlcommon::entity_encode('Supplemental Content'); |
&Apache::lonhtmlcommon::entity_encode('Supplemental Content'); |
$env{'form.pagepath'}=''; |
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/supplemental'}); |
|
} elsif ($env{'form.command'} eq 'contents') { |
|
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/navmaps'}); |
|
} elsif ($env{'form.command'} eq 'home') { |
|
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/menu'}); |
} |
} |
|
|
|
|
# Where do we store these for when we come back? |
# Where do we store these for when we come back? |
my $stored_folderpath='docs_folderpath'; |
my $stored_folderpath='docs_folderpath'; |
if ($supplementalflag) { |
if ($supplementalflag) { |
$stored_folderpath='docs_sup_folderpath'; |
$stored_folderpath='docs_sup_folderpath'; |
} |
} |
|
|
# No folderpath, no pagepath, and in edit mode, see if we have something stored |
# No folderpath, and in edit mode, see if we have something stored |
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'}) && $allowed) { |
if ((!$env{'form.folderpath'}) && $allowed) { |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
{'folderpath' => 'scalar'}); |
{'folderpath' => 'scalar'}); |
|
unless (&unescape($env{'form.folderpath'}) =~ m{^(default|supplemental)&}) { |
|
undef($env{'form.folderpath'}); |
|
} |
} |
} |
|
|
# If we are not allowed to make changes, all we can see are supplemental docs |
# If we are not allowed to make changes, all we can see are supplemental docs |
if (!$allowed) { |
if (!$allowed) { |
$env{'form.pagepath'}=''; |
|
unless ($env{'form.folderpath'} =~ /^supplemental/) { |
unless ($env{'form.folderpath'} =~ /^supplemental/) { |
$env{'form.folderpath'} = &supplemental_base(); |
$env{'form.folderpath'} = &supplemental_base(); |
} |
} |
} |
} |
# If we still not have a folderpath, see if we can resurrect at pagepath |
|
if (!$env{'form.folderpath'} && $allowed) { |
|
&Apache::loncommon::restore_course_settings($stored_folderpath, |
|
{'pagepath' => 'scalar'}); |
|
} |
|
# Make the zeroth entry in supplemental docs page paths, so we can get to top level |
# Make the zeroth entry in supplemental docs page paths, so we can get to top level |
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { |
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { |
$env{'form.folderpath'} = &supplemental_base() |
$env{'form.folderpath'} = &supplemental_base() |
Line 3363 sub handler {
|
Line 3356 sub handler {
|
$env{'form.folderpath'}; |
$env{'form.folderpath'}; |
} |
} |
# If after all of this, we still don't have any paths, make them |
# If after all of this, we still don't have any paths, make them |
unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) { |
unless ($env{'form.folderpath'}) { |
if ($supplementalflag) { |
if ($supplementalflag) { |
$env{'form.folderpath'}=&supplemental_base(); |
$env{'form.folderpath'}=&supplemental_base(); |
} else { |
} else { |
$env{'form.folderpath'}='default'; |
$env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Documents')). |
|
':::::'; |
} |
} |
} |
} |
|
|
Line 3375 sub handler {
|
Line 3369 sub handler {
|
unless ($toolsflag) { |
unless ($toolsflag) { |
if ($allowed) { |
if ($allowed) { |
&Apache::loncommon::store_course_settings($stored_folderpath, |
&Apache::loncommon::store_course_settings($stored_folderpath, |
{'pagepath' => 'scalar', |
{'folderpath' => 'scalar'}); |
'folderpath' => 'scalar'}); |
|
} |
} |
|
my $folderpath; |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
my (@folderpath)=split('&',$env{'form.folderpath'}); |
$folderpath = $env{'form.folderpath'}; |
$env{'form.foldername'}=&unescape(pop(@folderpath)); |
my (@folders)=split('&',$env{'form.folderpath'}); |
$env{'form.folder'}=pop(@folderpath); |
$env{'form.foldername'}=&unescape(pop(@folders)); |
$container='sequence'; |
if ($env{'form.foldername'} =~ /\:1$/) { |
} |
$container = 'page'; |
if ($env{'form.pagepath'}) { |
} else { |
my (@pagepath)=split('&',$env{'form.pagepath'}); |
$container = 'sequence'; |
$env{'form.pagename'}=&unescape(pop(@pagepath)); |
} |
$env{'form.folder'}=pop(@pagepath); |
$env{'form.folder'}=pop(@folders); |
$container='page'; |
|
$containertag = '<input type="hidden" name="pagepath" value="" />'. |
|
'<input type="hidden" name="pagesymb" value="" />'; |
|
$pathitem = |
|
'<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'. |
|
'<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'. |
|
'<input type="hidden" name="folderpath" value="" />'; |
|
} else { |
} else { |
my $folderpath=$env{'form.folderpath'}; |
if ($env{'form.folder'} eq '' || |
if (!$folderpath) { |
$env{'form.folder'} eq 'supplemental') { |
if ($env{'form.folder'} eq '' || |
$folderpath='default&'. |
$env{'form.folder'} eq 'supplemental') { |
&escape(&mt('Main '.$crstype.' Documents')). |
$folderpath='default&'. |
':::::'; |
&escape(&mt('Main '.$crstype.' Documents')); |
|
} |
|
} |
} |
$containertag = '<input type="hidden" name="folderpath" value="" />'; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
|
} |
} |
|
$containertag = '<input type="hidden" name="folderpath" value="" />'; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { |
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { |
$showdoc='/'.$1; |
$showdoc='/'.$1; |
} |
} |
Line 3444 sub handler {
|
Line 3429 sub handler {
|
@tabids = ('002','ee2','ff2'); |
@tabids = ('002','ee2','ff2'); |
} else { |
} else { |
@tabids = ('aa1','bb1','cc1','ff1'); |
@tabids = ('aa1','bb1','cc1','ff1'); |
unless ($env{'form.pagepath'}) { |
unless ($env{'form.folderpath'} =~ /\:1$/) { |
unshift(@tabids,'001'); |
unshift(@tabids,'001'); |
push(@tabids,('dd1','ee1')); |
push(@tabids,('dd1','ee1')); |
} |
} |
Line 3558 sub handler {
|
Line 3543 sub handler {
|
} elsif ((!$showdoc) && (!$uploadphase)) { |
} elsif ((!$showdoc) && (!$uploadphase)) { |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'uplm' => 'Upload a new main '.lc($crstype).' document', |
|
'upls' => 'Upload a new supplemental '.lc($crstype).' document', |
|
'impp' => 'Import a document', |
|
'copm' => 'All documents out of a published map into this folder', |
'copm' => 'All documents out of a published map into this folder', |
'upfi' => 'Upload File', |
'upfi' => 'Upload File', |
'upld' => 'Import Content', |
'upld' => 'Import Content', |
Line 3570 sub handler {
|
Line 3552 sub handler {
|
'impm' => 'Import from Assembled Map', |
'impm' => 'Import from Assembled Map', |
'selm' => 'Select Map', |
'selm' => 'Select Map', |
'load' => 'Load Map', |
'load' => 'Load Map', |
'reco' => 'Recover Deleted Documents', |
|
'newf' => 'New Folder', |
'newf' => 'New Folder', |
'newp' => 'New Composite Page', |
'newp' => 'New Composite Page', |
'extr' => 'External Resource', |
|
'syll' => 'Syllabus', |
'syll' => 'Syllabus', |
'navc' => 'Table of Contents', |
'navc' => 'Table of Contents', |
'sipa' => 'Simple Course Page', |
'sipa' => 'Simple Course Page', |
Line 3584 sub handler {
|
Line 3564 sub handler {
|
'mypi' => 'My Personal Information Page', |
'mypi' => 'My Personal Information Page', |
'grpo' => 'Group Portfolio', |
'grpo' => 'Group Portfolio', |
'rost' => 'Course Roster', |
'rost' => 'Course Roster', |
'abou' => 'Personal Information Page for a User', |
'abou' => 'Personal Information Page for a User', |
'imsf' => 'IMS Import', |
'imsf' => 'IMS Import', |
'imsl' => 'Import IMS package', |
'imsl' => 'Import IMS package', |
'cms' => 'Origin of IMS package', |
'cms' => 'Origin of IMS package', |
Line 3592 sub handler {
|
Line 3572 sub handler {
|
'file' => 'File', |
'file' => 'File', |
'title' => 'Title', |
'title' => 'Title', |
'comment' => 'Comment', |
'comment' => 'Comment', |
'url' => 'URL', |
|
'prev' => 'Preview', |
|
'lnk' => 'Add Link', |
|
'parse' => 'Upload embedded images/multimedia files if HTML file', |
'parse' => 'Upload embedded images/multimedia files if HTML file', |
'nd' => 'Upload Document', |
|
'pm' => 'Published Map', |
|
'sd' => 'Special Document', |
|
'mo' => 'More Options', |
|
); |
); |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
my $fileupload=(<<FIUP); |
my $fileupload=(<<FIUP); |
Line 3623 CHBO
|
Line 3596 CHBO
|
<a class="LC_menubuttons_link" href="javascript:toggleUpload('ims');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('ims');"> |
$lt{'imsf'}</a> $help{'Importing_IMS_Course'} |
$lt{'imsf'}</a> $help{'Importing_IMS_Course'} |
<form name="uploadims" action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" target="IMSimport"> |
<form name="uploadims" action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" target="IMSimport"> |
<fieldset id="uploadimsform" style="display: none;" /> |
<fieldset id="uploadimsform" style="display: none;"> |
<legend>$lt{'imsf'}</legend> |
<legend>$lt{'imsf'}</legend> |
$fileupload |
$fileupload |
<br /> |
<br /> |
Line 3648 IMSFORM
|
Line 3621 IMSFORM
|
<a class="LC_menubuttons_link" href="javascript:toggleUpload('doc');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('doc');"> |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<fieldset id="uploaddocform" style="display: none;" /> |
<fieldset id="uploaddocform" style="display: none;"> |
<legend>$lt{'upfi'}</legend> |
<legend>$lt{'upfi'}</legend> |
<input type="hidden" name="active" value="aa" /> |
<input type="hidden" name="active" value="aa" /> |
$fileupload |
$fileupload |
Line 3668 IMSFORM
|
Line 3641 IMSFORM
|
FUFORM |
FUFORM |
|
|
my $importpubform=(<<SEDFFORM); |
my $importpubform=(<<SEDFFORM); |
<a class="LC_menubuttons_link" href="javascript:toggleMap();"> |
<a class="LC_menubuttons_link" href="javascript:toggleMap('map');"> |
$lt{'impm'}</a>$help{'Load_Map'} |
$lt{'impm'}</a>$help{'Load_Map'} |
<form action="/adm/coursedocs" method="post" name="mapimportform"> |
<form action="/adm/coursedocs" method="post" name="mapimportform"> |
<fieldset id="importmapform" style="display: none;" /> |
<fieldset id="importmapform" style="display: none;"> |
<legend>$lt{'impm'}</legend> |
<legend>$lt{'impm'}</legend> |
<input type="hidden" name="active" value="bb" /> |
<input type="hidden" name="active" value="bb" /> |
$lt{'copm'}<br /> |
$lt{'copm'}<br /> |
<span class="LC_nobreak"> |
<span class="LC_nobreak"> |
<input type="text" name="importmap" size="40" value="" |
<input type="text" name="importmap" size="40" value="" |
onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" /> |
onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" /> |
<a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a><br /> |
<a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a></span><br /> |
<input type="submit" name="loadmap" value="$lt{'load'}" /> |
<input type="submit" name="loadmap" value="$lt{'load'}" /> |
</fieldset> |
</fieldset> |
</form> |
</form> |
Line 3688 SEDFFORM
|
Line 3661 SEDFFORM
|
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap();" />' => $importpubform } |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap(\'map\');" />' => $importpubform } |
); |
); |
$importpubform = &create_form_ul(&create_list_elements(@importpubforma)); |
$importpubform = &create_form_ul(&create_list_elements(@importpubforma)); |
my $extresourcesform = |
my $extresourcesform = |
Line 3755 HIDDENFORM
|
Line 3728 HIDDENFORM
|
} |
} |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
my $container='sequence'; |
|
if ($env{'form.pagepath'}) { |
|
$container='page'; |
|
} |
|
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
|
|
my $newnavform=(<<NNFORM); |
my $newnavform=(<<NNFORM); |
Line 3916 NGFFORM
|
Line 3885 NGFFORM
|
|
|
|
|
my @importdoc = ( |
my @importdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform}, |
); |
{'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform, |
unless ($container eq 'page') { |
}); |
push(@importdoc, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform} |
|
); |
|
} |
|
push(@importdoc, |
|
{'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform} |
|
); |
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc)); |
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc)); |
|
|
@gradingforma=( |
@gradingforma=( |
Line 3944 my %orderhash = (
|
Line 3919 my %orderhash = (
|
'bb' => ['Published Content',$importpubform], |
'bb' => ['Published Content',$importpubform], |
'cc' => ['Grading Resources',$gradingform], |
'cc' => ['Grading Resources',$gradingform], |
); |
); |
unless ($env{'form.pagepath'}) { |
unless ($container eq 'page') { |
$orderhash{'00'} = ['Newfolder',$newfolderform]; |
$orderhash{'00'} = ['Newfolder',$newfolderform]; |
$orderhash{'dd'} = ['Collaboration',$communityform]; |
$orderhash{'dd'} = ['Collaboration',$communityform]; |
$orderhash{'ee'} = ['Special Documents',$specialdocumentsform]; |
$orderhash{'ee'} = ['Special Pages',$specialdocumentsform]; |
} |
} |
|
|
$hadchanges=0; |
$hadchanges=0; |
Line 3977 unless ($env{'form.pagepath'}) {
|
Line 3952 unless ($env{'form.pagepath'}) {
|
} elsif ($allowed) { |
} elsif ($allowed) { |
$env{'form.folderpath'} = $savefolderpath; |
$env{'form.folderpath'} = $savefolderpath; |
} |
} |
$env{'form.pagepath'} = ''; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
$pathitem = '<input type="hidden" name="folderpath" value="'. |
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
if ($allowed) { |
if ($allowed) { |
Line 3988 unless ($env{'form.pagepath'}) {
|
Line 3962 unless ($env{'form.pagepath'}) {
|
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');"> |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data"> |
<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data"> |
<fieldset id="uploadsuppdocform" style="display: none;" /> |
<fieldset id="uploadsuppdocform" style="display: none;"> |
<legend>$lt{'upfi'}</legend> |
<legend>$lt{'upfi'}</legend> |
<input type="hidden" name="active" value="ee" /> |
<input type="hidden" name="active" value="ee" /> |
$fileupload |
$fileupload |
Line 4051 my @specialdocs = (
|
Line 4025 my @specialdocs = (
|
=>$supnewaboutmeform}, |
=>$supnewaboutmeform}, |
); |
); |
my @supimportdoc = ( |
my @supimportdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'suppext\')" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />' |
=>$supextform}, |
=>$supextform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
=>$supupdocform}, |
=>$supupdocform}, |
Line 4061 $supupdocform = &create_form_ul(&create
|
Line 4035 $supupdocform = &create_form_ul(&create
|
my %suporderhash = ( |
my %suporderhash = ( |
'00' => ['Supnewfolder', $supnewfolderform], |
'00' => ['Supnewfolder', $supnewfolderform], |
'ee' => ['Import Content',$supupdocform], |
'ee' => ['Import Content',$supupdocform], |
'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] |
'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))] |
); |
); |
if ($supplementalflag) { |
if ($supplementalflag) { |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
Line 4146 sub decompression_info {
|
Line 4120 sub decompression_info {
|
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $container='sequence'; |
my $container='sequence'; |
my ($pathitem,$hiddenelem); |
my ($pathitem,$hiddenelem); |
my @hiddens = ('newidx','comment','position'); |
my @hiddens = ('newidx','comment','position','folderpath'); |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /\:1$/) { |
$container='page'; |
$container='page'; |
$pathitem = 'pagepath'; |
|
} else { |
|
$pathitem = 'folderpath'; |
|
} |
} |
unshift(@hiddens,$pathitem); |
unshift(@hiddens,$pathitem); |
foreach my $item (@hiddens) { |
foreach my $item (@hiddens) { |
Line 4341 sub generate_edit_table {
|
Line 4312 sub generate_edit_table {
|
my $form; |
my $form; |
my $activetab; |
my $activetab; |
my $active; |
my $active; |
if($env{'form.active'} ne ''){ |
if (($env{'form.active'} ne '') && ($env{'form.active'} ne 'aa')) { |
$activetab = $env{'form.active'}; |
$activetab = $env{'form.active'}; |
} |
} |
my $backicon = $iconpath.'clickhere.gif'; |
my $backicon = $iconpath.'clickhere.gif'; |
my $backtext = &mt('To Overview'); |
my $backtext = &mt('Exit Editor'); |
$form = '<div class="LC_Box" style="margin:0;">'. |
$form = '<div class="LC_Box" style="margin:0;">'. |
'<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n". |
'<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n". |
'<li class="goback">'. |
'<li class="goback">'. |
'<a href="javascript:toContents('."'$jumpto'".');">'. |
'<a href="javascript:toContents('.$jumpto.');">'. |
'<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'. |
'<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'. |
' alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n". |
' alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n". |
'<li>'. |
'<li>'. |
Line 4438 sub editing_js {
|
Line 4409 sub editing_js {
|
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"'); |
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"'); |
my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"'); |
|
my $main_container_page; |
my $main_container_page; |
if ($docs_folderpath eq '') { |
if (&HTML::Entities::decode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'}) =~ /\:1$/) { |
if ($docs_pagepath ne '') { |
$main_container_page = 1; |
$main_container_page = 1; |
|
} |
|
} |
} |
my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents'; |
my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A'; |
my $toplevelsupp = &supplemental_base(); |
my $toplevelsupp = &supplemental_base(); |
|
|
my $backtourl = '/adm/navmaps'; |
my $backtourl; |
if ($supplementalflag) { |
if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) { |
|
my $caller = $1; |
|
if ($caller =~ /^supplemental/) { |
|
$backtourl = '/adm/supplemental?folderpath='.&escape($caller); |
|
} else { |
|
my ($map,$id,$res)=&Apache::lonnet::decode_symb($caller); |
|
$res = &Apache::lonnet::clutter($res); |
|
if (&Apache::lonnet::is_on_map($res)) { |
|
$backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='. |
|
&HTML::Entities::encode($caller,'<>&"'); |
|
} |
|
} |
|
} elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') { |
|
$backtourl = '/adm/menu'; |
|
} elsif ($supplementalflag) { |
$backtourl = '/adm/supplemental'; |
$backtourl = '/adm/supplemental'; |
|
} else { |
|
$backtourl = '/adm/navmaps'; |
} |
} |
|
|
my $fieldsets = "'ext','doc','ims'"; |
my $fieldsets = "'ext','doc'"; |
|
unless ($main_container_page) { |
|
$fieldsets .=",'ims'"; |
|
} |
if ($supplementalflag) { |
if ($supplementalflag) { |
$fieldsets = "'suppext','suppdoc'"; |
$fieldsets = "'suppext','suppdoc'"; |
} |
} |
Line 4555 function toggleUpload(caller) {
|
Line 4542 function toggleUpload(caller) {
|
return; |
return; |
} |
} |
|
|
function toggleMap() { |
function toggleMap(caller) { |
var disp = 'none'; |
var disp = 'none'; |
if (document.getElementById('importmapform')) { |
if (document.getElementById('importmapform')) { |
var curr = document.getElementById('importmapform').style.display; |
if (caller == 'map') { |
if (curr == 'none') { |
var curr = document.getElementById('importmapform').style.display; |
disp='block'; |
if (curr == 'none') { |
|
disp='block'; |
|
} |
} |
} |
document.getElementById('importmapform').style.display=disp; |
document.getElementById('importmapform').style.display=disp; |
resize_scrollbox('contentscroll','1','1'); |
resize_scrollbox('contentscroll','1','1'); |
Line 4581 function makeims(imsform) {
|
Line 4570 function makeims(imsform) {
|
imsform.submit(); |
imsform.submit(); |
} |
} |
|
|
function changename(folderpath,index,oldtitle,container,pagesymb) { |
function changename(folderpath,index,oldtitle) { |
var title=prompt('$lt{"p_chn"}',oldtitle); |
var title=prompt('$lt{"p_chn"}',oldtitle); |
if (title) { |
if (title) { |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.title.value=title; |
this.document.forms.renameform.title.value=title; |
this.document.forms.renameform.cmd.value='rename_'+index; |
this.document.forms.renameform.cmd.value='rename_'+index; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) { |
function removeres(folderpath,index,oldtitle,skip_confirm) { |
if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { |
if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.cmd.value='del_'+index; |
this.document.forms.renameform.cmd.value='del_'+index; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) { |
function cutres(folderpath,index,oldtitle,container,folder,skip_confirm) { |
if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { |
if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { |
this.document.forms.renameform.cmd.value='cut_'+index; |
this.document.forms.renameform.cmd.value='cut_'+index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) { |
function markcopy(folderpath,index,oldtitle,container,folder) { |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
if (container == 'sequence') { |
|
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
|
|
Line 4736 function showPage(current, pageId, nav,
|
Line 4701 function showPage(current, pageId, nav,
|
toggleMap(); |
toggleMap(); |
if (nav == 'mainnav') { |
if (nav == 'mainnav') { |
var storedpath = "$docs_folderpath"; |
var storedpath = "$docs_folderpath"; |
if (storedpath == '') { |
|
storedpath = "$docs_pagepath"; |
|
} |
|
var storedpage = "$main_container_page"; |
var storedpage = "$main_container_page"; |
var reg = new RegExp("^supplemental"); |
var reg = new RegExp("^supplemental"); |
if (pageId == 'mainCourseDocuments') { |
if (pageId == 'mainCourseDocuments') { |
Line 4774 function showPage(current, pageId, nav,
|
Line 4736 function showPage(current, pageId, nav,
|
|
|
function toContents(jumpto) { |
function toContents(jumpto) { |
var newurl = '$backtourl'; |
var newurl = '$backtourl'; |
if (jumpto != '') { |
if ((newurl == '/adm/navmaps') && (jumpto != '')) { |
newurl = newurl+'?postdata='+jumpto; |
newurl = newurl+'?postdata='+jumpto; |
; |
|
} |
} |
location.href=newurl; |
location.href=newurl; |
} |
} |
Line 4968 Return hash with valid author names
|
Line 4929 Return hash with valid author names
|
|
|
=item contained_map_check() |
=item contained_map_check() |
|
|
=item reinit_role() |
|
|
|
=item url_paste_fixups() |
=item url_paste_fixups() |
|
|
=item apply_fixups() |
=item apply_fixups() |