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

version 1.3, 2012/11/29 20:37:07 version 1.4, 2013/05/03 21:57:13
Line 103  sub handler { Line 103  sub handler {
     my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url);      my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url);
     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 '')) {      } 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 114  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';
       }
     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});
Line 126  sub handler { Line 134  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 156  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 207  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.4


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