Diff for /loncom/interface/londocs.pm between versions 1.715 and 1.723

version 1.715, 2024/12/28 12:19:21 version 1.723, 2025/02/03 22:52:36
Line 729  function validCrsCopy() { Line 729  function validCrsCopy() {
             alert("$js_lt{'whco'}");              alert("$js_lt{'whco'}");
             return false;              return false;
         }          }
     }         }
     return true;      return true;
 }  }
   
Line 884  ENDJS Line 884  ENDJS
         if (keys(%tocopy)) {          if (keys(%tocopy)) {
             my (%resdirs,%resfiles);              my (%resdirs,%resfiles);
             &Apache::lonnet::recursedirs($is_course_home,1,undef,$res_exclude,0,0,$resurl,'',\%resdirs,\%resfiles);              &Apache::lonnet::recursedirs($is_course_home,1,undef,$res_exclude,0,0,$resurl,'',\%resdirs,\%resfiles);
             my ($notopdir,%newdir,%newfile,%checkdeps);              my ($notopdir,%newdir,%newfile,%checkdeps,%newresfile);
             $r->print('<p>'.&mt('Copy to: [_1]',              $r->print('<p>'.&mt('Copy to: [_1]',
                                 '<span class="LC_filename">'.$desturl.'/'.$subdir.'</span>').                                  '<span class="LC_filename">'.$desturl.'/'.$subdir.'</span>').
                       '</p>'."\n");                        '</p>'."\n");
Line 995  ENDJS Line 995  ENDJS
                                                                    '<span class="LC_filename">'.$desturl.'/'.$subdir.'/'.$file.'</span>').                                                                     '<span class="LC_filename">'.$desturl.'/'.$subdir.'/'.$file.'</span>').
                                       '</p>'."\n");                                        '</p>'."\n");
                         } elsif (($src ne '') && ($dest ne '')) {                          } elsif (($src ne '') && ($dest ne '')) {
                             if ($is_course_home) {                              my $ressrc = $docroot.$resurl.'/'.$file;
                                 if (&File::Copy::copy($src,$dest)) {                              my $ressrcmeta = $ressrc.'.meta';
                                     $newfile{$file} = 1;                              my ($ext) = ($file =~ /\.(\w+)$/);
                                 }                              my $embstyle=&Apache::loncommon::fileembstyle($ext);
                             } else {                              my ($getres,$getresmeta);
                                 if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file,$dest) eq 'ok') {                              if ($respublish) {
                                     $newfile{$file} = 1;                                  if ($path eq '') {
                                 }                                      if ((ref($resfiles{'/'}) eq 'HASH') &&
                             }                                          (exists($resfiles{'/'}{$fname}))) {
                             if ($newfile{$file}) {                                          $getres = 1;
                                 my $gotmeta;                                          $getresmeta = 1;
                                 if ($is_course_home) {  
                                     if ((-e $src.'.meta') && (!-e $dest.'.meta')) {  
                                         if (&File::Copy::copy($src.'.meta',$dest.'.meta')) {  
                                             $gotmeta = 1;  
                                         }  
                                     }  
                                 } else {  
                                     if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file.'.meta',$dest.'.meta') eq 'ok') {  
                                         $gotmeta = 1;  
                                     }                                      }
                                   } elsif ((ref($resfiles{$path}) eq 'HASH') &&
                                            (exists($resfiles{$path}{$fname}))) {
                                       $getres = 1;
                                       $getresmeta = 1;
                                 }                                  }
                                 if ($gotmeta) {                              }
                                     if (open(my $fh,'<',$dest.'.meta')) {                              if ($is_course_home) {
                                         my ($output,$now,setsourceavail);                                  my ($needpriv,$needprivmeta);
                                         $now = time;                                  if ($respublish) {
                                         if (($file =~ /\.(xml|html|htm|xhtml|xhtm)$/i) || ($file =~ /$LONCAPA::assess_re/)) {                                      if ($getres) {
                                             $setsourceavail = 1;                                          if (&Apache::londiff::are_different_files($src,$ressrc)) {
                                         }                                              $needpriv = 1;
                                         while (my $line=<$fh>) {                                              if (&File::Copy::copy($ressrc,$dest)) {
                                             chomp($line);                                                  if ($embstyle eq 'ssi') {
                                             if ($line eq "<authorspace>$coursenum:$coursedom</authorspace>") {                                                      &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd);
                                                 $output .= "<authorspace>$ca:$cd</authorspace>\n";  
                                             } elsif ($line eq '<copyright>custom</copyright>') {  
                                                 $output .= "<copyright>$copyright</copyright>\n";  
                                             } elsif ($line =~ m{^<creationdate>\d+</creationdate>$}) {  
                                                 $output .= "<creationdate>$now</creationdate>\n";  
                                             } elsif ($line eq "<customdistributionfile>/res/$coursedom/$coursenum/default.rights</customdistributionfile>") {  
                                                 $output .= "<customdistributionfile>$customdistfile</customdistributionfile>\n";  
                                             } elsif ($line =~ m{^<sourceavail>(open|closed)</sourceavail>$}) {  
                                                 if ($setsourceavail) {  
                                                     $output .= "<sourceavail>$sourceavail</sourceavail>\n";  
                                                 }                                                  }
                                             } elsif ($line eq "<domain>$coursedom</domain>") {                                              }
                                                 $output .= "<domain>$cd</domain>\n";                                          } else {
                                             } elsif ($line =~ m{^<lastrevisiondate>\d+</lastrevisiondate>$}) {                                              if (&File::Copy::copy($src,$dest)) {
                                                 $output .= "<lastrevisiondate>$now</lastrevisiondate>\n";                                                  $newfile{$file} = $desturl.'/'.$subdir.'/'.$file;
                                             } elsif ($line =~ m{^<modifyinguser>$match_username:$match_domain</modifyinguser>$}) {                                                  if ($embstyle eq 'ssi') {
                                                 $output .= "<modifyinguser>$env{'user.name'}:$env{'user.domain'}</modifyinguser>\n";                                                      &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir);
                                             } elsif ($line eq "<owner>$coursenum:$coursedom</owner>") {  
                                                 $output .= "<owner>$ca:$cd</owner>\n";  
                                             } elsif ($line =~ m{^<dependencies>(.+)</dependencies>$}) {  
                                                 my @deps = split(/\s*,\s*/,$1);  
                                                 my @newdeps;  
                                                 my $changed = 0;  
                                                 foreach my $dep (@deps) {  
                                                     if ($dep =~ m{^/res/$coursedom/$coursenum/(.+)$}) {  
                                                         my $rest = $1;  
                                                         push(@newdeps,"/res/$cd/$ca/$rest");  
                                                         $checkdeps{$rest} = 1;  
                                                         $changed ++;  
                                                     } else {  
                                                         push(@newdeps,$dep);  
                                                     }  
                                                 }                                                  }
                                                 if ($changed) {                                              }
                                                     $output .= '<dependencies>'.join(',',@newdeps).'</dependencies>'."\n";                                          }
                                       } else {
                                           $needpriv = 1;
                                       }
                                       if ($getresmeta) {
                                           if ((-e $src.'.meta') && (!-e $dest.'.meta')) {
                                               if (&Apache::londiff::are_different_files($src.'.meta',$ressrc.'.meta')) {
                                                   if (&File::Copy::copy($ressrc.'.meta',$dest.'.meta')) {
                                                       &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                                                          $customdistfile,$sourceavail,\%checkdeps);
                                                 }                                                  }
                                                   $needprivmeta = 1;
                                             } else {                                              } else {
                                                 $output .= "$line\n";                                                  if (&File::Copy::copy($src.'.meta',$dest.'.meta')) {
                                                       &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                                                          $customdistfile,$sourceavail,\%checkdeps);
                                                   }
                                             }                                              }
                                         }                                          }
                                         close($fh);                                      }
                                         if (open(my $fh,'>',$dest.'.meta')) {                                      if ($getres) {
                                             print $fh $output;                                          my $destresfile = $docroot.$destresurl.'/'.$subdir.'/'.$file;
                                             close($fh);                                          if (-e $dest) {
                                               my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1);
                                               if (-e $destresfile) {
                                                   $newresfile{$file} = $destresurl.'/'.$subdir.'/'.$file;
                                               }
                                         }                                          }
                                     }                                      }
                                   } else {
                                       $needpriv = 1;
                                       if ((-e $src.'.meta') && (!-e $dest.'.meta')) {
                                           $needprivmeta = 1;
                                       }  
                                 }                                  }
                                 my ($ext) = ($file =~ /\.(\w+)$/);                                  if ($needpriv) {
                                 my $embstyle=&Apache::loncommon::fileembstyle($ext);                                      if (&File::Copy::copy($src,$dest)) {
                                 if ($embstyle eq 'ssi') {                                          $newfile{$file} = $desturl.'/'.$subdir.'/'.$file;
                                     my $outstring='';                                          if ($embstyle eq 'ssi') {
                                     my $changes = 0;                                              &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir);
                                     my @parser;                                          }
                                     $parser[0]=HTML::LCParser->new($dest);                                      }
                                     $parser[-1]->xml_mode(1);                                  }
                                     my $token;                                  if ($needprivmeta) {
                                     while (@parser) {                                      if (&File::Copy::copy($src.'.meta',$dest.'.meta')) {
                                         while ($token=$parser[-1]->get_token) {                                           &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                             if ($token->[0] eq 'S') {                                                              $customdistfile,$sourceavail,\%checkdeps);
                                                 my $tag=$token->[1];                                      }
                                                 my $lctag=lc($tag);                                  }
                                                 my %parms=%{$token->[2]};                              } else {
                                                 foreach my $type ('src','href','background','bgimg') {                                  my ($needpriv,$needprivmeta);
                                                     foreach my $key (keys(%parms)) {                                  if ($respublish) {
                                                         if ($key =~ /^$type$/i) {                                      if ($getres) {
                                                             next if (($lctag eq 'img') && ($type eq 'src') &&                                          &Apache::lonnet::repcopy($docroot.$resurl.'/'.$file);
                                                                      ($parms{$key} =~ m{^data\:image/gif;base64,}));                                      }
                                                             if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {                                      if ($getresmeta) {
                                                                 $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;                                          &Apache::lonnet::repcopy($docroot.$resurl.'/'.$file.'.meta');
                                                                 $changes ++;                                      }
                                                             }                                      if (-e $docroot.$resurl.'/'.$file) {
                                                         }                                          if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file,$dest) eq 'ok') {
                                                     }                                              if (&Apache::londiff::are_different_files($docroot.$resurl.'/'.$file,$dest)) {
                                                 }                                                  $needpriv = 1;
                                                 # probably a <randomlabel> image type <label>                                                  if (&File::Copy::copy($docroot.$resurl.'/'.$file,$dest)) {
                                                 # or a <image> tag inside <imageresponse> or <drawimage>                                                      if ($embstyle eq 'ssi') {
                                                 if (($lctag eq 'label' && defined($parms{'description'}))                                                          &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd);
                                                      || ($lctag eq 'image') || ($lctag eq 'import')) {  
                                                     my $next_token=$parser[-1]->get_token();  
                                                     if ($next_token->[0] eq 'T') {  
                                                         $next_token->[1] =~ s/[\n\r\f]+//g;  
                                                         if ($next_token->[1] =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                             $next_token->[1] =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;  
                                                             $changes ++;  
                                                         }  
                                                     }  
                                                     $parser[-1]->unget_token($next_token);  
                                                 }  
                                                 if ($lctag eq 'applet') {  
                                                     my $havecodebase=0;  
                                                     foreach my $key (keys(%parms)) {  
                                                         if (lc($key) eq 'codebase') {  
                                                             if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                                 $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;  
                                                                 $changes ++;  
                                                             }  
                                                             $havecodebase = 1;  
                                                         }  
                                                     }  
                                                     unless ($havecodebase) {  
                                                         foreach my $key (keys(%parms)) {  
                                                             if ($key =~ /(archive|code|object)/i) {  
                                                                 if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                                     $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/si};  
                                                                     $changes ++;  
                                                                 }  
                                                             }  
                                                         }  
                                                     }  
                                                 }  
                                                 my $newparmstring='';  
                                                 my $endtag='';  
                                                 foreach my $parkey (keys(%parms)) {  
                                                     if ($parkey eq '/') {  
                                                         $endtag=' /';  
                                                     } else {  
                                                         my $quote=($parms{$parkey}=~/\"/?"'":'"');  
                                                         $newparmstring.=' '.$parkey.'='.$quote.$parms{$parkey}.$quote;  
                                                     }                                                      }
                                                 }                                                  }
                                                 if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; }                                              } else {
                                                 $outstring.='<'.$tag.$newparmstring.$endtag.'>';                                                  if ($embstyle eq 'ssi') {
                                                 if ($lctag eq 'm' || $lctag eq 'answer' || $lctag eq 'display' ||                                                      &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir);
                                                     $lctag eq 'tex') {  
                                                     $outstring.=&Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);  
                                                 } elsif ($lctag eq 'script') {  
                                                     if ($parms{'type'} eq 'loncapa/perl') {  
                                                         $outstring.=&Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);  
                                                     } else {  
                                                         my $needsupdate;  
                                                         my $script = &Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);  
                                                         if ($script =~ m{\.addMediaSrc\((["'])((?!\1).+)\1\);}) {  
                                                             my $src = $2;  
                                                             if ($src =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                                 $needsupdate = 1;  
                                                             }  
                                                         }  
                                                         if ($script =~ /\(document,\s*(['"])script\1,\s*\[([^\]]+)\]\);/s) {  
                                                             my $scriptslist = $2;  
                                                             my $needsupdate = 1;  
                                                             my @srcs = split(/\s*,\s*/,$scriptslist);  
                                                             foreach my $src (@srcs) {  
                                                                 if ($src =~ /(["'])(?:(?!\1).)+\.js\1/) {  
                                                                     my $quote = $1;  
                                                                     my ($url) = ($src =~ m/\Q$quote\E([^$quote]+)\Q$quote\E/);  
                                                                     if ($url =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                                         $needsupdate = 1;  
                                                                     }  
                                                                 }  
                                                             }  
                                                         }  
                                                         if ($script =~ m{loadScript\(\s*(['"])((?:(?!\1).)+\.js)\1,\s*function}is) {  
                                                             my $src = $2;  
                                                             if ($src =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {  
                                                                 $needsupdate = 1;  
                                                             }  
                                                         }  
                                                         if ($needsupdate) {  
                                                             $script =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/gsi};  
                                                             $changes ++;  
                                                         }  
                                                         $outstring .= $script;  
                                                     }  
                                                 }                                                  }
                                             } elsif ($token->[0] eq 'E') {                                                  $newfile{$file} = $desturl.'/'.$subdir.'/'.$file;
                                                 if ($token->[2]) {                                              }
                                                     unless ($token->[1] eq 'allow') {                                          }
                                                         $outstring.='</'.$token->[1].'>';                                      } else {
                                                     }                                          $needpriv = 1;
                                       }
                                       if (-e $docroot.$resurl.'/'.$file.'.meta') {
                                           if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file.'.meta',$dest.'.meta') eq 'ok') {
                                               if (&Apache::londiff::are_different_files($docroot.$resurl.'/'.$file.'.meta',$dest.'.meta')) {
                                                   $needprivmeta = 1;
                                                   if (&File::Copy::copy($docroot.$resurl.'/'.$file.'.meta',$dest.'.meta')) {
                                                       &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                                                          $customdistfile,$sourceavail,\%checkdeps);
                                                 }                                                  }
                                             } else {                                              } else {
                                                 $outstring.=$token->[1];                                                  &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                                                      $customdistfile,$sourceavail,\%checkdeps);
                                             }                                              }
                                         }                                          }
                                         pop(@parser);                                      } else {
                                           if (!-e $dest.'.meta') {
                                               $needprivmeta = 1;
                                           }
                                     }                                      }
                                     if ($changes) {                                      if ($getres) {
                                         if (open(my $fh,'>',$dest)) {                                          my $destresfile = $docroot.$destresurl.'/'.$subdir.'/'.$file;
                                             print $fh $outstring;                                          if (-e $dest) {
                                             close($fh);                                              my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1);
                                               if (-e $destresfile) {
                                                   $newresfile{$file} = $destresurl.'/'.$subdir.'/'.$file;
                                               }
                                         }                                          }
                                     }                                      }
                                   } else {
                                       $needpriv = 1;
                                       if (!-e $dest.'.meta') {
                                           $needprivmeta = 1;
                                       }
                                 }                                  }
                                 if ($respublish) {                                  if ($needpriv) {
                                     my $destresfile = $docroot.$destresurl.'/'.$subdir.'/'.$file;                                      if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file,$dest) eq 'ok') {
                                     if ($path eq '') {                                          if ($embstyle eq 'ssi') {
                                         if ((ref($resfiles{'/'}) eq 'HASH') &&                                              &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir);
                                             (exists($resfiles{'/'}{$fname}))) {  
                                             my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1);  
                                         }                                          }
                                     } elsif ((ref($resfiles{$path}) eq 'HASH') &&                                          $newfile{$file} = $desturl.'/'.$subdir.'/'.$file;
                                              (exists($resfiles{$path}{$fname}))) {                                      }
                                         my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1);                                  }
                                   if ($needprivmeta) {
                                       if (&Apache::lonnet::repcopy_crsprivfile($srcurl.'/'.$file.'.meta',$dest.'.meta') eq 'ok') {
                                           &crsres_fixup_meta($dest,$coursenum,$coursedom,$ca,$cd,$copyright,
                                                              $customdistfile,$sourceavail,\%checkdeps);
                                     }                                      }
                                 }                                  }
                             }                              }
Line 1244  ENDJS Line 1177  ENDJS
                 $r->print('<p>'.&mt('Copied the following files to [_1]:','<span class="LC_filename">'.$desturl.'/'.$subdir.'</span>').                  $r->print('<p>'.&mt('Copied the following files to [_1]:','<span class="LC_filename">'.$desturl.'/'.$subdir.'</span>').
                           '</p>'."\n".                            '</p>'."\n".
                           '<ul><li>'.join('</li><li>',sort(keys(%newfile))).'</li></ul></p>'."\n");                            '<ul><li>'.join('</li><li>',sort(keys(%newfile))).'</li></ul></p>'."\n");
                   foreach my $file (keys(%newfile)) {
                       my %storehash = (
                                         'priv' => $newfile{$file},
                                         'who'  => $env{'user.name'}.':'.$env{'user.domain'},
                                       );
                       if (exists($newresfile{$file})) {
                           $storehash{'res'} = 1;
                       }
                       &Apache::lonnet::store_userdata(\%storehash,$file,'copycourseauthor',$coursedom,$coursenum);
                   }
             }              }
             if (keys(%checkdeps)) {              if (keys(%checkdeps)) {
                 my %missingdep;                  my %missingdep;
Line 1334  ENDJS Line 1277  ENDJS
                       &mt('Choose the files and/or folders to copy from Course Authoring to User Authoring').                        &mt('Choose the files and/or folders to copy from Course Authoring to User Authoring').
                       '</span><br /><br />'."\n";                        '</span><br /><br />'."\n";
         my $count = 0;          my $count = 0;
         my $startcount = 4 + $home;  #
   # Warning to developers:
   #
   # If you add or remove form elements which precede the table of items to copy
   # you will need to modify the value for startcount. Form elements include both:
   # <input> and <fieldset> tags.
   # $startcount (set to 9) contains the following:
   # fieldsets with following legends: (a) Folder in Authoring Space, (b) Distribution to set in metadata
   # (c) Content to copy
   # inputs: textbox for destination folder; dropdown lists: (a) Copyright, (b) Source
   # hidden: customrights file;  buttons: (a) check all, (b) uncheck all.
   # authorspace: if more than 1: a fieldset with legend: Select the Authoring Space,
   # or if 1: an input (hidden) with available author/coauthor role.
   # if there are multiple possible author/coauthor roles (i.e., $home > 1),
   # incerement startcount by 1 for the dropdown list uses to select the target.
   #
   # If there are published files, increment startcount by 3:
   # fieldset (legend: Published Resources), and two radio buttons (Yes/No).
   #
           my $startcount = 9;
           if ($home > 1) {
               $startcount ++;
           }
           if ($numpub) {
               $startcount += 3;
           }
         my $lastcontainer = $startcount;          my $lastcontainer = $startcount;
         $display .= &Apache::loncommon::start_data_table()."\n".          $display .= &Apache::loncommon::start_data_table()."\n".
                     &Apache::loncommon::start_data_table_header_row().                      &Apache::loncommon::start_data_table_header_row().
Line 1506  sub courseresource_options { Line 1474  sub courseresource_options {
     return $output;      return $output;
 }  }
   
   sub crsres_fixup_meta {
       my ($dest,$coursenum,$coursedom,$ca,$cd,$copyright,$customdistfile,$sourceavail,$checkdeps) = @_;
       return unless (ref($checkdeps) eq 'HASH');
       if (open(my $fh,'<',$dest.'.meta')) {
           my ($output,$now,$setsourceavail);
           $now = time;
           if (($dest =~ /\.(xml|html|htm|xhtml|xhtm)$/i) || ($dest =~ /$LONCAPA::assess_re/)) {
               $setsourceavail = 1;
           }
           while (my $line=<$fh>) {
               chomp($line);
               if ($line eq "<authorspace>$coursenum:$coursedom</authorspace>") {
                   $output .= "<authorspace>$ca:$cd</authorspace>\n";
               } elsif ($line eq '<copyright>custom</copyright>') {
                   $output .= "<copyright>$copyright</copyright>\n";
               } elsif ($line =~ m{^<creationdate>\d+</creationdate>$}) {
                   $output .= "<creationdate>$now</creationdate>\n";
               } elsif ($line eq "<customdistributionfile>/res/$coursedom/$coursenum/default.rights</customdistributionfile>") {
                   $output .= "<customdistributionfile>$customdistfile</customdistributionfile>\n";
               } elsif ($line =~ m{^<sourceavail>(open|closed)</sourceavail>$}) {
                   if ($setsourceavail) {
                       $output .= "<sourceavail>$sourceavail</sourceavail>\n";
                   }
               } elsif ($line eq "<domain>$coursedom</domain>") {
                   $output .= "<domain>$cd</domain>\n";
               } elsif ($line =~ m{^<lastrevisiondate>\d+</lastrevisiondate>$}) {
                   $output .= "<lastrevisiondate>$now</lastrevisiondate>\n";
               } elsif ($line =~ m{^<modifyinguser>$match_username:$match_domain</modifyinguser>$}) {
                   $output .= "<modifyinguser>$env{'user.name'}:$env{'user.domain'}</modifyinguser>\n";
               } elsif ($line eq "<owner>$coursenum:$coursedom</owner>") {
                   $output .= "<owner>$ca:$cd</owner>\n";
               } elsif ($line =~ m{^<dependencies>(.+)</dependencies>$}) {
                   my @deps = split(/\s*,\s*/,$1);
                   my @newdeps;
                   my $changed = 0;
                   foreach my $dep (@deps) {
                       if ($dep =~ m{^/res/$coursedom/$coursenum/(.+)$}) {
                           my $rest = $1;
                           push(@newdeps,"/res/$cd/$ca/$rest");
                           $checkdeps->{$rest} = 1;
                           $changed ++;
                       } else {
                           push(@newdeps,$dep);
                       }
                   }
                   if ($changed) {
                       $output .= '<dependencies>'.join(',',@newdeps).'</dependencies>'."\n";
                   }
               } else {
                   $output .= "$line\n";
               }
           }
           close($fh);
           if (open(my $fh,'>',$dest.'.meta')) {
               print $fh $output;
               close($fh);
           }
       }
   }
   
   sub crsres_fixup {
       my ($dest,$coursenum,$coursedom,$ca,$cd,$subdir) = @_;
       my $outstring='';
       my $changes = 0;
       my @parser;
       $parser[0]=HTML::LCParser->new($dest);
       $parser[-1]->xml_mode(1);
       my $token;
       while (@parser) {
           while ($token=$parser[-1]->get_token) {
               if ($token->[0] eq 'S') {
                   my $tag=$token->[1];
                   my $lctag=lc($tag);
                   my %parms=%{$token->[2]};
                   foreach my $type ('src','href','background','bgimg') {
                       foreach my $key (keys(%parms)) {
                           if ($key =~ /^$type$/i) {
                               next if (($lctag eq 'img') && ($type eq 'src') &&
                                        ($parms{$key} =~ m{^data\:image/gif;base64,}));
                               if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                   $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;
                                   $changes ++;
                               }
                           }
                       }
                   }
                   # probably a <randomlabel> image type <label>
                   # or a <image> tag inside <imageresponse> or <drawimage>
                   if (($lctag eq 'label' && defined($parms{'description'}))
                       || ($lctag eq 'image') || ($lctag eq 'import')) {
                       my $next_token=$parser[-1]->get_token();
                       if ($next_token->[0] eq 'T') {
                           $next_token->[1] =~ s/[\n\r\f]+//g;
                           if ($next_token->[1] =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                               $next_token->[1] =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;
                               $changes ++;
                           }
                       }
                       $parser[-1]->unget_token($next_token);
                   }
                   if ($lctag eq 'applet') {
                       my $havecodebase=0;
                       foreach my $key (keys(%parms)) {
                           if (lc($key) eq 'codebase') {
                               if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                   $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/}si;
                                   $changes ++;
                               }
                               $havecodebase = 1;
                           }
                       }
                       unless ($havecodebase) {
                           foreach my $key (keys(%parms)) {
                               if ($key =~ /(archive|code|object)/i) {
                                   if ($parms{$key} =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                       $parms{$key} =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/si};
                                       $changes ++;
                                   }
                               }
                           }
                       }
                   }
                   my $newparmstring='';
                   my $endtag='';
                   foreach my $parkey (keys(%parms)) {
                       if ($parkey eq '/') {
                           $endtag=' /';
                       } else {
                           my $quote=($parms{$parkey}=~/\"/?"'":'"');
                           $newparmstring.=' '.$parkey.'='.$quote.$parms{$parkey}.$quote;
                       }
                   }
                   if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; }
                   $outstring.='<'.$tag.$newparmstring.$endtag.'>';
                   if ($lctag eq 'm' || $lctag eq 'answer' || $lctag eq 'display' ||
                       $lctag eq 'tex') {
                       $outstring.=&Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);
                   } elsif ($lctag eq 'script') {
                       if ($parms{'type'} eq 'loncapa/perl') {
                           $outstring.=&Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);
                       } else {
                           my $needsupdate;
                           my $script = &Apache::lonxml::get_all_text_unbalanced('/'.$lctag,\@parser);
                           if ($script =~ m{\.addMediaSrc\((["'])((?!\1).+)\1\);}) {
                               my $src = $2;
                               if ($src =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                   $needsupdate = 1;
                               }
                           }
                           if ($script =~ /\(document,\s*(['"])script\1,\s*\[([^\]]+)\]\);/s) {
                               my $scriptslist = $2;
                               my @srcs = split(/\s*,\s*/,$scriptslist);
                               foreach my $src (@srcs) {
                                   if ($src =~ /(["'])(?:(?!\1).)+\.js\1/) {
                                       my $quote = $1;
                                       my ($url) = ($src =~ m/\Q$quote\E([^$quote]+)\Q$quote\E/);
                                       if ($url =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                           $needsupdate = 1;
                                       }
                                   }
                               }
                           }
                           if ($script =~ m{loadScript\(\s*(['"])((?:(?!\1).)+\.js)\1,\s*function}is) {
                               my $src = $2;
                               if ($src =~ m{^\Q/res/$coursedom/$coursenum/\E}si) {
                                   $needsupdate = 1;
                               }
                           }
                           if ($needsupdate) {
                               $script =~ s{^\Q/res/$coursedom/$coursenum/\E}{/res/$cd/$ca/$subdir/gsi};
                               $changes ++;
                           }
                           $outstring .= $script;
                       }
                   }
               } elsif ($token->[0] eq 'E') {
                   if ($token->[2]) {
                       unless ($token->[1] eq 'allow') {
                           $outstring.='</'.$token->[1].'>';
                       }
                   }
               } else {
                   $outstring.=$token->[1];
               }
           }
           pop(@parser);
       }
       if ($changes) {
           if (open(my $fh,'>',$dest)) {
               print $fh $outstring;
               close($fh);
           }
       }
   }
   
 sub group_import {  sub group_import {
     my ($coursenum, $coursedom, $folder, $container, $caller, $ltitoolsref, @files) = @_;      my ($coursenum, $coursedom, $folder, $container, $caller, $ltitoolsref, @files) = @_;
     my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap,      my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap,
Line 2363  sub print_paste_buffer { Line 2526  sub print_paste_buffer {
                     &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});                      &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});
             } else {              } else {
                 my $icon = &Apache::loncommon::icon($extension);                  my $icon = &Apache::loncommon::icon($extension);
                   my $icontext;
                   if ($extension eq 'sequence') {
                       $icontext = &mt('folder icon');
                   } elsif ($extension eq 'page') {
                       $icontext = &mt('composite page icon');
                   } else {
                       $icontext = &mt('file icon');
                   }
                   $icontext = &HTML::Entities::encode($icontext);
                 if ($extension eq 'sequence' &&                  if ($extension eq 'sequence' &&
                     $url =~ m{/default_\d+\.sequence$}x) {                      $url =~ m{/default_\d+\.sequence$}x) {
                     $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));                      $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
Line 2372  sub print_paste_buffer { Line 2544  sub print_paste_buffer {
                 if ($title eq '') {                  if ($title eq '') {
                     ($title) = ($url =~ m{/([^/]+)$});                      ($title) = ($url =~ m{/([^/]+)$});
                 }                  }
                 $buffer = '<img src="'.$icon.'" alt="" class="LC_icon" />'.                  $buffer = '<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" />'.
                           ': '.                            ': '.
                           &Apache::loncommon::parse_supplemental_title(                            &Apache::loncommon::parse_supplemental_title(
                              &LONCAPA::map::qtescape($title));                               &LONCAPA::map::qtescape($title));
Line 4808  sub editor { Line 4980  sub editor {
             if (!$allowed) {              if (!$allowed) {
                 $helpitem = 'Supplemental_Navigation';                  $helpitem = 'Supplemental_Navigation';
             }              }
             $toolslink = '<table><tr><td>'              $toolslink = '<div class="LC_navtools">'
                          .'<div class="LC_navtools">'
                        .&Apache::loncommon::help_open_menu('Navigation Screen',                         .&Apache::loncommon::help_open_menu('Navigation Screen',
                                                            $helpitem,undef,'RAT')                                                             $helpitem,undef,'RAT')
                        .'</td><td class="LC_middle">'.&mt('Tools:').'</td>'                         .'</div><div class="LC_navtools">'.&mt('Tools:').'</div>'
                        .'<td align="left"><ul id="LC_toolbar">'                         .'<div class="LC_navtools">'."\n".'<ul id="LC_toolbar">' 
                        .'<li><a href="/adm/coursedocs?forcesupplement=1&amp;command=editsupp" '                         .'<li><a href="/adm/coursedocs?forcesupplement=1&amp;command=editsupp" '
                        .'id="LC_content_toolbar_edittoplevel" '                         .'id="LC_content_toolbar_edittoplevel" '
                        .'class="LC_toolbarItem" '                         .'class="LC_toolbarItem" '
                        .'title="'.&mt('Supplemental Content Editor').'">'                         .'title="'.&mt('Supplemental Content Editor').'">'
                        .'</a></li></ul></td></tr></table><br />';                         .'</a></li></ul></div></div>'."\n"
                          .'<div style="padding:0;clear:both;margin:0;border:0"></div><br />'."\n";
         }          }
         if ($shown) {          if ($shown) {
             if ($allowed) {              if ($allowed) {
Line 5320  ENDCOPY Line 5494  ENDCOPY
     $copylink=(<<ENDCOPY);      $copylink=(<<ENDCOPY);
 <form name="$formname" method="post" action="/adm/coursedocs">  <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common  $form_common
 <input type="checkbox" name="copy" id="copy_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','copy');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_copy">$lt{'cp'}</a>  <label><input type="checkbox" name="copy" id="copy_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','copy');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_copy">$lt{'cp'}</a></label>
 $form_end  $form_end
 ENDCOPY  ENDCOPY
             if (($ishash) && (ref($filtersref->{'cancopy'}) eq 'ARRAY')) {              if (($ishash) && (ref($filtersref->{'cancopy'}) eq 'ARRAY')) {
Line 5338  ENDCUT Line 5512  ENDCUT
 <form name="$formname" method="post" action="/adm/coursedocs">  <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common  $form_common
 <input type="hidden" name="skip_$orderidx" id="skip_cut_$orderidx" value="$skip_confirm" />  <input type="hidden" name="skip_$orderidx" id="skip_cut_$orderidx" value="$skip_confirm" />
 <input type="checkbox" name="cut" id="cut_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','cut');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_cut">$lt{'ct'}</a>  <label><input type="checkbox" name="cut" id="cut_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','cut');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_cut">$lt{'ct'}</a></label>
 $form_end  $form_end
 ENDCUT  ENDCUT
             if (($ishash) && (ref($filtersref->{'cancut'}) eq 'ARRAY')) {              if (($ishash) && (ref($filtersref->{'cancut'}) eq 'ARRAY')) {
Line 5357  ENDREM Line 5531  ENDREM
 $form_common  $form_common
 <input type="hidden" name="skip_$orderidx" id="skip_remove_$orderidx" value="$skip_confirm" />  <input type="hidden" name="skip_$orderidx" id="skip_remove_$orderidx" value="$skip_confirm" />
 <input type="hidden" name="confirm_rem_$orderidx" id="confirm_removal_$orderidx" value="$confirm_removal" />  <input type="hidden" name="confirm_rem_$orderidx" id="confirm_removal_$orderidx" value="$confirm_removal" />
 <input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a>  <label><input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a></label>
 $form_end  $form_end
 ENDREM  ENDREM
             if (($ishash) && (ref($filtersref->{'canremove'}) eq 'ARRAY')) {              if (($ishash) && (ref($filtersref->{'canremove'}) eq 'ARRAY')) {
Line 5402  $copylink Line 5576  $copylink
 </td>  </td>
 END  END
     }      }
       my $icontext;
 # Figure out what kind of a resource this is  # Figure out what kind of a resource this is
     my ($extension)=($url=~/\.(\w+)$/);      my ($extension)=($url=~/\.(\w+)$/);
       if ($extension eq 'sequence') {
           $icontext = &mt('folder icon');
       } elsif ($extension eq 'page') {
           $icontext = &mt('composite page icon');
       } else {
           $icontext = &mt('file icon');
       }
       $icontext = &HTML::Entities::encode($icontext);
     my $uploaded=($url=~/^\/*uploaded\//);      my $uploaded=($url=~/^\/*uploaded\//);
     my $icon=&Apache::loncommon::icon($url);      my $icon=&Apache::loncommon::icon($url);
     my $isfolder;      my $isfolder;
Line 5745  $form_end; Line 5928  $form_end;
             }              }
         }          }
         if ($nolink) {          if ($nolink) {
             $line .= '<img src="'.$icon.'" alt="" class="LC_icon" /></a>';              $line .= '<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" /></a>';
         } else {          } else {
             $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';              $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" /></a>';
         }          }
     } elsif ($url) {      } elsif ($url) {
        if ($anchor ne '') {         if ($anchor ne '') {
Line 5777  $form_end; Line 5960  $form_end;
            }             }
        }         }
        if ($nolink) {         if ($nolink) {
            $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';             $line.='<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" />';
        } elsif ($nomodal) {         } elsif ($nomodal) {
            $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.             $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
                   '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';                    '<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" border="0" /></a>';
        } else {         } else {
            $line.=&Apache::loncommon::modal_link($link,             $line.=&Apache::loncommon::modal_link($link,
                                                  '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);                                                   '<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" />',600,500);
        }         }
     } else {      } else {
        $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';         $line.='<img src="'.$icon.'" alt="'.$icontext.'" class="LC_icon" />';
     }      }
     $line.='</span></td><td'.$tdwidth.'>';      $line.='</span></td><td'.$tdwidth.'>';
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {      if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
Line 7428  sub handler { Line 7611  sub handler {
     my $quotainfo = '<p>'.&mt('Currently using [_1] of the [_2] available.',      my $quotainfo = '<p>'.&mt('Currently using [_1] of the [_2] available.',
                               $percent.'%',$quota.' MB').'</p>';                                $percent.'%',$quota.' MB').'</p>';
   
  my $fileupload=(<<FIUP);  
         $quotainfo  
  $lt{'file'}:<br />  
 FIUP  
  my $checkbox=(<<CHBO);   my $checkbox=(<<CHBO);
  <!-- <label>$lt{'parse'}?   <!-- <label>$lt{'parse'}?
  <input type="checkbox" name="parserflag" />   <input type="checkbox" name="parserflag" />
Line 7450  CHBO Line 7629  CHBO
         <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          $quotainfo
         <input type="file" name="uploaddoc" id="uploaddocims" class="LC_flUpload LC_uploaddoc" size="40" $disabled />          <label>$lt{'file'}:<br />
           <input type="file" name="uploaddoc" id="uploaddocims" class="LC_flUpload LC_uploaddoc" size="40" $disabled /></label>
         <input type="hidden" id="LC_free_space_ims" value="$free_space" />          <input type="hidden" id="LC_free_space_ims" value="$free_space" />
         <br />          <br />
         <p>          <p>
Line 7478  IMSFORM Line 7658  IMSFORM
         <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          $quotainfo
         <input type="file" name="uploaddoc" class="LC_flUpload" size="40" $disabled />          <label>$lt{'file'}:<br />
           <input type="file" name="uploaddoc" class="LC_flUpload" size="40" $disabled /></label>
         <input type="hidden" id="LC_free_space" value="$free_space" />          <input type="hidden" id="LC_free_space" value="$free_space" />
  <br />   <br />
           <label>
  $lt{'title'}:<br />   $lt{'title'}:<br />
  <input type="text" size="60" name="comment" $disabled />   <input type="text" size="60" name="comment" $disabled /></label>
  $pathitem   $pathitem
  <input type="hidden" name="cmd" value="upload_default" />   <input type="hidden" name="cmd" value="upload_default" />
  <br />   <br />
Line 7509  FUFORM Line 7691  FUFORM
         <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 />          <label>$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();$mapimportjs" $disabled />          onfocus="this.blur();$mapimportjs" $disabled />
         &nbsp;<a href="$mapimportjs">$lt{'selm'}</a></span><br />          &nbsp;<a href="$mapimportjs">$lt{'selm'}</a></span></label><br />
         <input type="submit" name="loadmap" value="$lt{'load'}" $disabled />          <input type="submit" name="loadmap" value="$lt{'load'}" $disabled />
         </fieldset>          </fieldset>
         </form>          </form>
Line 7554  SEDFFORM Line 7736  SEDFFORM
         <div id="importcrsrescontent" style="display: none;">          <div id="importcrsrescontent" style="display: none;">
         <input type="hidden" name="active" value="bb" />          <input type="hidden" name="active" value="bb" />
         $pickfile          $pickfile
         <p>          <p><label>
         $lt{'title'}: <input type="text" name="crsrestitle" value="" $disabled />          $lt{'title'}: <input type="text" name="crsrestitle" value="" $disabled />
         </p>          </label></p>
         <input type="hidden" name="importdetail" value="" />          <input type="hidden" name="importdetail" value="" />
         <input type="submit" name="crsres" value="$lt{'impo'}" $disabled /><br />          <input type="submit" name="crsres" value="$lt{'impo'}" $disabled /><br />
         </div>          </div>
Line 7819  NWEBFORM Line 8001  NWEBFORM
             $is_home{'course'} = 1;              $is_home{'course'} = 1;
         }          }
         $rolehomes .= '<input type="hidden" id="rolehome_course" name="rolehome_course" value="'.$crshome.'" />'."\n";          $rolehomes .= '<input type="hidden" id="rolehome_course" name="rolehome_course" value="'.$crshome.'" />'."\n";
         my $pickdir = $lt{'loca'}.          my $pickdir = '<label>'.$lt{'loca'}.
                    '<select name="authorrole" onchange="populateDirSelects(this.form,'."'authorrole','authorpath'".',1,1,0);">'."\n".                     '<select name="authorrole" onchange="populateDirSelects(this.form,'."'authorrole','authorpath'".',1,1,0);">'."\n".
                    '<option value="" selected="selected">'.&mt('Select').'</option>'."\n";                     '<option value="" selected="selected">'.&mt('Select').'</option>'."\n";
         if ($env{'user.author'}) {          if ($env{'user.author'}) {
Line 7840  NWEBFORM Line 8022  NWEBFORM
         if ($checkcrsres) {          if ($checkcrsres) {
             $pickdir .= '<option value="course">'.&mt('Course Resource').'</option>'."\n";              $pickdir .= '<option value="course">'.&mt('Course Resource').'</option>'."\n";
         }          }
         $pickdir .= '</select><br />'."\n".          $pickdir .= '</select></label><br />'."\n".
                     $lt{'dire'}.                      '<label>'.$lt{'dire'}.
                     '<select name="authorpath" onchange="toggleCrsResTitle();">'.                      '<select name="authorpath" onchange="toggleCrsResTitle();">'.
                     '<option value=""></option>'.                      '<option value=""></option>'.
                     '</select><br />'."\n";                      '</select></label><br />'."\n";
         my %seltemplate_menus;          my %seltemplate_menus;
         my @files = &Apache::lonhomework::get_template_list('problem');          my @files = &Apache::lonhomework::get_template_list('problem');
         my @noexamplelink = ('blank.problem','blank.library','script.library');          my @noexamplelink = ('blank.problem','blank.library','script.library');
Line 7877  NWEBFORM Line 8059  NWEBFORM
             }              }
         }          }
   
         my $templates = $lt{'cate'}.' '.          my ($templates,$haslabel);
                         &Apache::loncommon::linked_select_forms('courseresform','<br />'.$lt{'tmpl'}.' ',          if ($lt{'cate'} ne '') {
                                                                 $defcategory,'tempcategory','template',              $templates = '<label>';
                                                                 \%seltemplate_menus,\@catorder,              $haslabel = 1;
                                                                 "resize_scrollbox('contentscroll','1','0');",          }
                                                                 "toggleExampleText();",'template').'<br />';          $templates .= $lt{'cate'}.' '.
                         &Apache::loncommon::linked_select_forms('courseresform','<br />'.$lt{'tmpl'}.' ',
                                                                 $defcategory,'tempcategory','template',
                                                                 \%seltemplate_menus,\@catorder,
                                                                 "resize_scrollbox('contentscroll','1','0');",
                                                                 "toggleExampleText();",'template',$haslabel).'<br />';
         my $templatepreview =  '<a href="#" target="sample" onclick="javascript:getExample(600,420,\'yes\',true);  return false;">'.          my $templatepreview =  '<a href="#" target="sample" onclick="javascript:getExample(600,420,\'yes\',true);  return false;">'.
                                '<span id="newresexample">'.&mt('Example').'</span></a>';                                 '<span id="newresexample">'.&mt('Example').'</span></a>';
         my $crsresform;          my $crsresform;
Line 7903  NWEBFORM Line 8090  NWEBFORM
         <label><input type="radio" name="newsubdir" value="0" onclick="toggleNewsubdir(this.form);" checked="checked" $disabled />No</label>          <label><input type="radio" name="newsubdir" value="0" onclick="toggleNewsubdir(this.form);" checked="checked" $disabled />No</label>
         &nbsp;          &nbsp;
         <label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" $disabled />Yes</label>          <label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" $disabled />Yes</label>
         </span><span id="newsubdir"></span>          </span><label for="newsubdirname"><span id="newsubdir"></span></label>
         <input type="hidden" name="newsubdirname" id="newsubdirname" value="" autocomplete="off" />          <input type="hidden" name="newsubdirname" id="newsubdirname" value="" autocomplete="off" />
         </p>          </p>
         </div>          </div>
         $lt{'fnam'}          <label>$lt{'fnam'}
         <input type="text" size="20" name="newresourcename" autocomplete="off" $disabled />          <input type="text" size="20" name="newresourcename" autocomplete="off" $disabled /></label>
         <div id="newresource" style="display:none">          <div id="newresource" style="display:none">
         <p>          <p>
         $lt{'addp'}          $lt{'addp'}
Line 7916  NWEBFORM Line 8103  NWEBFORM
         $lt{'no'}</label>&nbsp;&nbsp;          $lt{'no'}</label>&nbsp;&nbsp;
         <label><input type="radio" name="newresourceadd" value="1" onclick="toggleNewInCourse(this.form);" $disabled />          <label><input type="radio" name="newresourceadd" value="1" onclick="toggleNewInCourse(this.form);" $disabled />
         $lt{'yes'}</label>          $lt{'yes'}</label>
         <span id="newrestitle"></span>          <label for="newresourcetitle"><span id="newrestitle"></span></label>
         <input type="hidden" size="20" name="newresourcetitle" id="newresourcetitle" autocomplete="off" $disabled />          <input type="hidden" size="20" name="newresourcetitle" id="newresourcetitle" autocomplete="off" $disabled />
         </p>          </p>
         </div>          </div>
Line 8111  unless ($container eq 'page') { Line 8298  unless ($container eq 'page') {
         <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   $quotainfo
         <input type="file" name="uploaddoc" id="uploaddocsupp" class="LC_flUpload LC_uploaddoc" size="40" $disabled />          <label>$lt{'file'}:<br />
           <input type="file" name="uploaddoc" id="uploaddocsupp" class="LC_flUpload LC_uploaddoc" size="40" $disabled /></label>
         <input type="hidden" id="LC_free_space_supp" value="$free_space" />          <input type="hidden" id="LC_free_space_supp" value="$free_space" />
  <br />   <br />
  <br />   <br />
Line 8120  unless ($container eq 'page') { Line 8308  unless ($container eq 'page') {
  $checkbox   $checkbox
  </span>   </span>
  <br /><br />   <br /><br />
  $lt{'comment'}:<br />   <label>$lt{'comment'}:<br />
  <textarea cols="50" rows="4" name="comment"></textarea>   <textarea cols="50" rows="4" name="comment"></textarea></label>
  <br />   <br />
  $pathitem   $pathitem
  <input type="hidden" name="cmd" value="upload_supplemental" />   <input type="hidden" name="cmd" value="upload_supplemental" />
Line 8521  sub generate_admin_menu { Line 8709  sub generate_admin_menu {
                 if (grep(/^\Q$crshome\E$/,@ids)) {                  if (grep(/^\Q$crshome\E$/,@ids)) {
                     $linkurl = $crsauthorurl;                      $linkurl = $crsauthorurl;
                 } else {                  } else {
                     $linkurl =                      my $jscall = &Apache::lonhtmlcommon::jump_to_editres($crsauthorurl,$crshome,1);
                         &Apache::lonhtmlcommon::jump_to_editres($crsauthorurl,$crshome,1);                      if ($jscall) {
                           $linkurl = 'javascript:'.$jscall;
                       }
                 }                  }
                 if ((ref($menu[0]) eq 'HASH') && (ref($menu[0]->{'items'}) eq 'ARRAY')) {                  if ((ref($menu[0]) eq 'HASH') && (ref($menu[0]->{'items'}) eq 'ARRAY') && ($linkurl)) {
                      push(@{$menu[0]->{items}},                       push(@{$menu[0]->{items}},
                      {   linktext   => $lt{'ca'},                       {   linktext   => $lt{'ca'},
                          url        => $linkurl,                           url        => $linkurl,

Removed from v.1.715  
changed lines
  Added in v.1.723


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