Diff for /loncom/interface/londependencies.pm between versions 1.3 and 1.5

version 1.3, 2012/11/29 20:37:07 version 1.5, 2017/08/13 20:52:59
Line 101  sub handler { Line 101  sub handler {
     my $docs_url = $env{'form.url'};      my $docs_url = $env{'form.url'};
     my $folderpath = &unescape($env{'form.folderpath'});      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{^/}{};
     }      }
Line 113  sub handler { Line 118  sub handler {
                 '<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 126  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 148  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 199  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">'.

Removed from v.1.3  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>