version 1.2, 2012/07/06 22:46:06
|
version 1.5, 2017/08/13 20:52:59
|
Line 94 sub handler {
|
Line 94 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['action','symb','title','url']); |
['action','symb','title','url','folderpath']); |
my $action = $env{'form.action'}; |
my $action = $env{'form.action'}; |
my $symb = $env{'form.symb'}; |
my $symb = $env{'form.symb'}; |
my $docs_title = $env{'form.title'}; |
my $docs_title = $env{'form.title'}; |
my $docs_url = $env{'form.url'}; |
my $docs_url = $env{'form.url'}; |
|
my $folderpath = &unescape($env{'form.folderpath'}); |
my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url); |
my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url); |
|
my $earlyout; |
if ($symb) { |
if ($symb) { |
(undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
(undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
} elsif (($docs_url) && ($env{'httpref.'.$docs_url} ne '')) { |
unless (&Apache::lonnet::is_on_map($url)) { |
|
$earlyout = 1; |
|
} |
|
} elsif (($docs_url) && (($env{'httpref.'.$docs_url} ne '') || |
|
($docs_url =~ m{^\Q/uploaded/$cdom/$cnum/\E(portfolio/syllabus)/}))) { |
$url = $docs_url; |
$url = $docs_url; |
$url =~ s{^/}{}; |
$url =~ s{^/}{}; |
} |
} |
my $title = &mt('Manage Dependencies'); |
my $title = &mt('Manage Dependencies'); |
my $state = '<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
my $state = '<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
|
'<input type="hidden" name="folderpath" value="'.$env{'form.folderpath'}.'" />'."\n". |
'<input type="hidden" name="title" value="'.$docs_title.'" />'."\n". |
'<input type="hidden" name="title" value="'.$docs_title.'" />'."\n". |
'<input type="hidden" name="url" value="'.$docs_url.'" />'."\n"; |
'<input type="hidden" name="url" value="'.$docs_url.'" />'."\n"; |
my $dir_root = '/userfiles'; |
my $dir_root = '/userfiles'; |
my ($destination) = |
my ($destination,$context); |
($url =~ m{^\Quploaded/$cdom/$cnum/\E((?:docs|supplemental)/(?:default|\d+)/\d+)/}); |
if ($url =~ m{^\Quploaded/$cdom/$cnum/\E(portfolio/syllabus)/}) { |
|
$destination = $1; |
|
$context = 'syllabus'; |
|
} else { |
|
($destination) = |
|
($url =~ m{^\Quploaded/$cdom/$cnum/\E((?:docs|supplemental)/(?:default|\d+)/\d+)/}); |
|
$context = 'coursedoc'; |
|
if ($destination eq '') { |
|
$earlyout = 1; |
|
} |
|
} |
my $js = &Apache::loncommon::ask_embedded_js(); |
my $js = &Apache::loncommon::ask_embedded_js(); |
my $output = &Apache::loncommon::start_page($title,$js, |
my $output = &Apache::loncommon::start_page($title,$js, |
{'only_body' => 1}); |
{'only_body' => 1}); |
|
if ($earlyout) { |
|
$r->print($output.&mt('Cannot display dependency information - invalid file: [_1].',$url). |
|
&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
if ($action eq 'modifyhrefs') { |
if ($action eq 'modifyhrefs') { |
my ($result,$count,$codebasecount) = |
my ($result,$count,$codebasecount) = |
&Apache::loncommon::modify_html_refs('manage_dependencies',$destination, |
&Apache::loncommon::modify_html_refs('manage_dependencies',$destination, |
Line 124 sub handler {
|
Line 146 sub handler {
|
$numrefchanges = $count + $codebasecount; |
$numrefchanges = $count + $codebasecount; |
} elsif ($action eq 'process_changes') { |
} elsif ($action eq 'process_changes') { |
(my $result,$numpathchgs) = |
(my $result,$numpathchgs) = |
&process_changes($cdom,$cnum,$chome,$url,$destination,$dir_root,$state); |
&process_changes($cdom,$cnum,$chome,$url,$destination,$dir_root,$state,$context); |
$output .= $result; |
$output .= $result; |
} |
} |
unless ((($action eq 'process_changes') && ($numpathchgs > 0)) || |
unless ((($action eq 'process_changes') && ($numpathchgs > 0)) || |
Line 146 sub handler {
|
Line 168 sub handler {
|
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($cdom,$cnum,$chome,$url,$destination,$dir_root,$state) = @_; |
my ($cdom,$cnum,$chome,$url,$destination,$dir_root,$state,$context) = @_; |
my ($output,$numpathchgs); |
my ($output,$numpathchgs); |
my ($numnew,$numtodelete,$numtomod) = (0,0,0); |
my ($numnew,$numtodelete,$numtomod) = (0,0,0); |
my $url_root = "/uploaded/$cdom/$cnum"; |
my $url_root = "/uploaded/$cdom/$cnum"; |
Line 197 sub process_changes {
|
Line 219 sub process_changes {
|
} |
} |
if ((@modifications > 0) || ($numnew > 0)) { |
if ((@modifications > 0) || ($numnew > 0)) { |
(my $result,my $flag,$numpathchgs) = |
(my $result,my $flag,$numpathchgs) = |
&Apache::loncommon::upload_embedded('coursedoc',$destination,$cnum,$cdom, |
&Apache::loncommon::upload_embedded($context,$destination,$cnum,$cdom, |
$dir_root,$url_root,undef,undef,undef, |
$dir_root,$url_root,undef,undef,undef, |
$state,'/adm/dependencies'); |
$state,'/adm/dependencies'); |
$output .= '<h4>'.&mt('Uploaded files').'</h4>'. |
$output .= '<h4>'.&mt('Uploaded files').'</h4>'. |
$result; |
$result; |
|
unless ($numpathchgs) { |
|
if ($context eq 'syllabus') { |
|
my $modres = |
|
&Apache::loncommon::modify_html_refs($context,'portfolio/syllabus', |
|
$cnum,$cdom, |
|
'/userfiles',"/$url"); |
|
$result .= $modres; |
|
} |
|
} |
} |
} |
} else { |
} else { |
$output .= '<span class="LC_warning">'. |
$output .= '<span class="LC_warning">'. |