Diff for /loncom/interface/londocs.pm between versions 1.484.2.85.2.9 and 1.484.2.86

version 1.484.2.85.2.9, 2021/04/23 13:35:26 version 1.484.2.86, 2020/01/20 20:09:37
Line 43  use Apache::lonnavdisplay(); Line 43  use Apache::lonnavdisplay();
 use Apache::lonextresedit();  use Apache::lonextresedit();
 use Apache::lontemplate();  use Apache::lontemplate();
 use Apache::lonsimplepage();  use Apache::lonsimplepage();
 use Apache::loncourserespicker();  
 use HTML::Entities;  use HTML::Entities;
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
Line 178  sub default_folderpath { Line 177  sub default_folderpath {
     }      }
 }  }
   
 sub validate_folderpath {  
     my ($supplementalflag) = @_;  
     if ($env{'form.folderpath'} ne '') {  
         my @items = split(/\&/,$env{'form.folderpath'});  
         my $badpath;  
         for (my $i=0; $i<@items; $i++) {  
             my $odd = $i%2;  
             if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {  
                 $badpath = 1;  
             } elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) {  
                 $badpath = 1;  
             }  
             last if ($badpath);  
         }  
         if ($badpath) {  
             delete($env{'form.folderpath'});  
         }  
     }  
     return;  
 }  
   
 sub validate_suppath {  
     if ($env{'form.supppath'} ne '') {  
         my @items = split(/\&/,$env{'form.supppath'});  
         my $badpath;  
         for (my $i=0; $i<@items; $i++) {  
             my $odd = $i%2;  
             if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) {  
                 $badpath = 1;  
             }  
             last if ($badpath);  
         }  
         if ($badpath) {  
             delete($env{'form.supppath'});  
         }  
     }  
     return;  
 }  
   
 sub dumpcourse {  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
Line 662  sub recurse_html { Line 622  sub recurse_html {
 }  }
   
 sub group_import {  sub group_import {
     my ($coursenum, $coursedom, $folder, $container, $caller, $ltitoolsref, @files) = @_;      my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
     my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap,      my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap,
         %removeparam,$importuploaded,$fixuperrors);          %removeparam,$importuploaded,$fixuperrors);
     $allmaps = {};      $allmaps = {};
Line 691  sub group_import { Line 651  sub group_import {
             }              }
         }          }
  if ($url) {   if ($url) {
             if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/ext\.tool)\:?(.*)$}) {  
                 $url = $1;  
                 my $marker = $2;  
                 my $info = $3;  
                 my ($toolid,%toolhash,%toolsettings);  
                 my @extras = ('linktext','explanation','crslabel','crstitle','crsappend');  
                 my @toolinfo = split(/:/,$info);  
                 if ($residx) {  
                     %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);  
                     $toolid = $toolsettings{'id'};  
                 } else {  
                     $toolid = shift(@toolinfo);  
                 }  
                 $toolid =~ s/\D//g;  
                 ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},  
                  $toolhash{'linktext'},$toolhash{'explanation'},  
                  $toolhash{'crslabel'},$toolhash{'crstitle'},$toolhash{'crsappend'}) = @toolinfo;  
                 foreach my $item (@extras) {  
                     $toolhash{$item} = &unescape($toolhash{$item});  
                 }  
                 if (ref($ltitoolsref) eq 'HASH') {  
                     my @deleted;  
                     if (ref($ltitoolsref->{$toolid}) eq 'HASH') {  
                         $toolhash{'id'} = $toolid;  
                         if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') ||  
                             ($toolhash{'target'} eq 'window')) {  
                             if ($toolhash{'target'} eq 'window') {  
                                 foreach my $item ('width','height') {  
                                     $toolhash{$item} =~ s/^\s+//;  
                                     $toolhash{$item} =~ s/\s+$//;  
                                     if ($toolhash{$item} =~ /\D/) {  
                                         delete($toolhash{$item});  
                                         if ($residx) {  
                                             if ($toolsettings{$item}) {  
                                                 push(@deleted,$item);  
                                             }  
                                         }  
                                     }  
                                 }  
                             }  
                         } elsif ($residx) {  
                             $toolhash{'target'} = $toolsettings{'target'};  
                             if ($toolhash{'target'} eq 'window') {  
                                 foreach my $item ('width','height') {  
                                     $toolhash{$item} = $toolsettings{$item};  
                                 }  
                             }  
                         } elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') {  
                             $toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'};  
                             if ($toolhash{'target'} eq 'window') {  
                                 $toolhash{'width'} = $ltitoolsref->{$toolid}->{'display'}->{'width'};  
                                 $toolhash{'height'} = $ltitoolsref->{$toolid}->{'display'}->{'height'};  
                             }  
                         }  
                         if ($toolhash{'target'} eq 'iframe') {  
                             foreach my $item ('width','height','linktext','explanation') {  
                                 delete($toolhash{$item});  
                                 if ($residx) {  
                                     if ($toolsettings{$item}) {  
                                         push(@deleted,$item);  
                                     }  
                                 }  
                             }  
                         } elsif ($toolhash{'target'} eq 'tab') {  
                             foreach my $item ('width','height') {  
                                 delete($toolhash{$item});  
                                 if ($residx) {  
                                     if ($toolsettings{$item}) {  
                                         push(@deleted,$item);  
                                     }  
                                 }  
                             }  
                         }  
                         if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') {  
                             foreach my $item ('label','title','linktext','explanation') {  
                                 my $crsitem;  
                                 if (($item eq 'label') || ($item eq 'title')) {  
                                     $crsitem = 'crs'.$item;  
                                 } else {  
                                     $crsitem = $item;  
                                 }  
                                 if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) {  
                                     $toolhash{$crsitem} =~ s/^\s+//;  
                                     $toolhash{$crsitem} =~ s/\s+$//;  
                                     if ($toolhash{$crsitem} eq '') {  
                                         delete($toolhash{$crsitem});  
                                     }  
                                 } else {  
                                     delete($toolhash{$crsitem});  
                                 }  
                                 if (($residx) && (exists($toolsettings{$crsitem}))) {  
                                     unless (exists($toolhash{$crsitem})) {  
                                         push(@deleted,$crsitem);  
                                     }  
                                 }  
                             }  
                         }  
                         my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum);  
                         if ($putres eq 'ok') {  
                             if (@deleted) {  
                                 &Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum);  
                             }  
                         }  
                     }  
                 }  
             }  
             if (($caller eq 'londocs') &&              if (($caller eq 'londocs') &&
                 ($folder =~ /^default/)) {                  ($folder =~ /^default/)) {
                 if (($url =~ /\.(page|sequence)$/) && (!$donechk)) {                  if (($url =~ /\.(page|sequence)$/) && (!$donechk)) {
Line 808  sub group_import { Line 662  sub group_import {
                     $donechk = 1;                      $donechk = 1;
                 }                  }
                 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)$}) {
                     &contained_map_check($url,$folder,$coursenum,$coursedom,\%removefrommap,                      &contained_map_check($url,$folder,\%removefrommap,\%removeparam,
                                          \%removeparam,\%addedmaps,\%hierarchy,\%titles,$allmaps);                                           \%addedmaps,\%hierarchy,\%titles,$allmaps);
                     $importuploaded = 1;                      $importuploaded = 1;
                 } elsif ($url =~ m{^/res/.+\.(page|sequence)$}) {                  } elsif ($url =~ m{^/res/.+\.(page|sequence)$}) {
                     next if ($allmaps->{$url});                      next if ($allmaps->{$url});
Line 822  sub group_import { Line 676  sub group_import {
     }      }
     my $ext = 'false';      my $ext = 'false';
     if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }      if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }
       $name = &LONCAPA::map::qtunescape($name);
               if ($name eq '') {
                   $name = &LONCAPA::map::qtunescape(&mt('Web Page'));
               }
             if ($url =~ m{^/uploaded/$coursedom/$coursenum/((?:docs|supplemental)/(?:default|\d+))/new\.html$}) {              if ($url =~ m{^/uploaded/$coursedom/$coursenum/((?:docs|supplemental)/(?:default|\d+))/new\.html$}) {
                 my $filepath = $1;                  my $filepath = $1;
                 my $fname;                  my $fname = $name;
                 if ($name eq '') {                  if ($fname =~ /^\W+$/) {
                     $name = &mt('Web Page');  
                     $fname = 'web';                      $fname = 'web';
                 } else {                  } else {
                     $fname = $name;                      $fname =~ s/\W/_/g;
                     $fname=&Apache::lonnet::clean_filename($fname);                  }
                     if ($fname eq '') {                  if (length($fname) > 15) {
                         $fname = 'web';                      $fname = substr($fname,0,14);
                     } elsif (length($fname) > 15) {  
                         $fname = substr($fname,0,14);  
                     }  
                 }                  }
                 my $title = &Apache::loncommon::cleanup_html($name);  
                 my $initialtext = &mt('Replace with your own content.');                  my $initialtext = &mt('Replace with your own content.');
                 my $newhtml = <<END;                  my $newhtml = <<END;
 <html>  <html>
 <head>  <head>
 <title>$title</title>  <title>$name</title>
 </head>  </head>
 <body bgcolor="#ffffff">  <body bgcolor="#ffffff">
 $initialtext  $initialtext
Line 864  END Line 717  END
                     return (&mt('Failed to save new web page.'),1);                      return (&mt('Failed to save new web page.'),1);
                 }                  }
             }              }
             $name = &LONCAPA::map::qtunescape($name);  
             $url  = &LONCAPA::map::qtunescape($url);              $url  = &LONCAPA::map::qtunescape($url);
     $LONCAPA::map::resources[$residx] =      $LONCAPA::map::resources[$residx] =
  join(':', ($name, $url, $ext, 'normal', 'res'));   join(':', ($name, $url, $ext, 'normal', 'res'));
Line 982  sub docs_change_log { Line 834  sub docs_change_log {
              '// <![CDATA['."\n".               '// <![CDATA['."\n".
              &Apache::loncommon::display_filter_js('docslog')."\n".               &Apache::loncommon::display_filter_js('docslog')."\n".
              &editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag,               &editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag,
                          $coursedom,$coursenum,'',$canedit,'',\$navmap)."\n".                           $coursedom,$coursenum,$canedit,'',\$navmap)."\n".
              &history_tab_js()."\n".               &history_tab_js()."\n".
              &Apache::lonratedt::editscript('simple')."\n".               &Apache::lonratedt::editscript('simple')."\n".
              '// ]]>'."\n".               '// ]]>'."\n".
Line 1207  sub update_paste_buffer { Line 1059  sub update_paste_buffer {
 # Construct identifiers for current contents of user's paste buffer  # Construct identifiers for current contents of user's paste buffer
     if (@currpaste) {      if (@currpaste) {
         foreach my $suffix (@currpaste) {          foreach my $suffix (@currpaste) {
             my $cid = $env{'docs.markedcopy_crs_'.$suffix};               my $cid = $env{'docs.markedcopy_crs_'.$suffix};
             my $url = $env{'docs.markedcopy_url_'.$suffix};               my $url = $env{'docs.markedcopy_url_'.$suffix};
             my $mapidx = $env{'docs.markedcopy_map_'.$suffix};               my $mapidx = $env{'docs.markedcopy_map_'.$suffix};
             if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&               if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
                 ($url ne '')) {                   ($url ne '')) {
                 if ($url eq '/res/lib/templates/simpleproblem.problem') {                   $pasteurls{$cid.'_'.$url.'_'.$mapidx} = 1;
                     $pasteurls{$cid.'_'.$mapidx} = 1;               }
                 } elsif ($url =~ m{^/res/$match_domain/$match_username/}) {  
                     $pasteurls{$url} = 1;  
                 } else {  
                     $pasteurls{$cid.'_'.$url} = 1;  
                 }  
             }  
         }          }
     }      }
   
Line 1228  sub update_paste_buffer { Line 1074  sub update_paste_buffer {
   
     my @pathitems = split(/\&/,$env{'form.folderpath'});      my @pathitems = split(/\&/,$env{'form.folderpath'});
     my @folderconf = split(/\:/,$pathitems[-1]);      my @folderconf = split(/\:/,$pathitems[-1]);
     my $ispage = $folderconf[5];      my $ispage = $folderconf[4];
   
     foreach my $item (@possibles) {      foreach my $item (@possibles) {
         my ($orderidx,$cmd) = split(/:/,$item);          my ($orderidx,$cmd) = split(/:/,$item);
Line 1241  sub update_paste_buffer { Line 1087  sub update_paste_buffer {
                                           $env{'form.folderpath'},\%curr_groups);                                            $env{'form.folderpath'},\%curr_groups);
         next if ($denied{'copy'});          next if ($denied{'copy'});
         $url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};          $url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};
         if ($url eq '/res/lib/templates/simpleproblem.problem') {          next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$mapidx}));
             next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$mapidx}));  
         } elsif ($url =~ m{^/res/$match_domain/$match_username/}) {  
             next if (exists($pasteurls{$url}));  
         } else {  
             next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url}));  
         }  
         my ($suffix,$errortxt,$locknotfreed) =          my ($suffix,$errortxt,$locknotfreed) =
             &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');              &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');
         if ($suffix ne '') {          if ($suffix ne '') {
Line 1274  sub update_paste_buffer { Line 1114  sub update_paste_buffer {
                 $subdir = $prefix;                  $subdir = $prefix;
             }              }
             my (%addedmaps,%removefrommap,%removeparam,%hierarchy,%titles,%allmaps);              my (%addedmaps,%removefrommap,%removeparam,%hierarchy,%titles,%allmaps);
             &contained_map_check($url,$folder,$coursenum,$coursedom,\%removefrommap,              &contained_map_check($url,$folder,\%removefrommap,\%removeparam,\%addedmaps,
                                  \%removeparam,\%addedmaps,\%hierarchy,\%titles,\%allmaps);                                   \%hierarchy,\%titles,\%allmaps);
             if (ref($hierarchy{$url}) eq 'HASH') {              if (ref($hierarchy{$url}) eq 'HASH') {
                 my ($nested,$nestednames);                  my ($nested,$nestednames);
                 &recurse_uploaded_maps($url,$subdir,\%hierarchy,\%titles,\$nested,\$nestednames);                  &recurse_uploaded_maps($url,$subdir,\%hierarchy,\%titles,\$nested,\$nestednames);
Line 1349  sub print_paste_buffer { Line 1189  sub print_paste_buffer {
             ($url ne '')) {              ($url ne '')) {
             $clipboardcount ++;              $clipboardcount ++;
             my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,              my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,
                 $canpaste,$nopaste,$othercrs,$areachange,$is_exttool);                  $canpaste,$nopaste,$othercrs,$areachange);
             my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];              my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
             if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?:&colon;|:))//} ) {              if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?:&colon;|:))//} ) {
                 $is_external = 1;                  $is_external = 1;
             } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {  
                 $is_exttool = 1;  
             }              }
             if ($folder =~ /^supplemental/) {              if ($folder =~ /^supplemental/) {
                 $canpaste = &supp_pasteable($env{'docs.markedcopy_url_'.$suffix});                  $canpaste = &supp_pasteable($env{'docs.markedcopy_url_'.$suffix});
Line 1387  sub print_paste_buffer { Line 1225  sub print_paste_buffer {
                         $is_uploaded_map = 1;                          $is_uploaded_map = 1;
                     }                      }
                 } elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||                  } elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||
                          ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg|ext\.tool)$})) {                           ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg)$})) {
                     if ($cid ne $env{'request.course.id'}) {                      if ($cid ne $env{'request.course.id'}) {
                         my ($srcdom,$srcnum) = split(/_/,$cid);                          my ($srcdom,$srcnum) = split(/_/,$cid);
                         if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {                          if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
                             if (($is_exttool) && ($srcdom ne $coursedom)) {                              $othercrs = '<br />'.&mt('(from another course)');
                                 $canpaste = 0;  
                                 $nopaste = &mt('Paste from another domain unavailable.');  
                             } else {  
                                 $othercrs = '<br />'.&mt('(from another course)');  
                             }  
                         } else {                          } else {
                             $canpaste = 0;                              $canpaste = 0;
                             $nopaste = &mt('Paste from another course unavailable.');                              $nopaste = &mt('Paste from another course unavailable.');
Line 1412  sub print_paste_buffer { Line 1245  sub print_paste_buffer {
                 $buffer = &mt('External Resource').': '.                  $buffer = &mt('External Resource').': '.
                     &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}).' ('.                      &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}).' ('.
                     &LONCAPA::map::qtescape($url).')';                      &LONCAPA::map::qtescape($url).')';
             } elsif ($is_exttool) {  
                 $buffer = &mt('External Tool').': '.  
                     &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});  
             } else {              } else {
                 my $icon = &Apache::loncommon::icon($extension);                  my $icon = &Apache::loncommon::icon($extension);
                 if ($extension eq 'sequence' &&                  if ($extension eq 'sequence' &&
Line 1470  sub print_paste_buffer { Line 1300  sub print_paste_buffer {
             }              }
             $buttons = '<input type="submit" name="pastemarked" value="'.$value.'" />'.('&nbsp;'x2);              $buttons = '<input type="submit" name="pastemarked" value="'.$value.'" />'.('&nbsp;'x2);
         }          }
         $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Remove from clipboard').'" />'.('&nbsp;'x2);          $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Clear selected').'" />'.('&nbsp;'x2);
         if ($clipboardcount > 1) {          if ($clipboardcount > 1) {
             $buttons .=              $buttons .=
                 '<span style="text-decoration:line-through">'.('&nbsp;'x20).'</span>'.('&nbsp;'x2).                  '<span style="text-decoration:line-through">'.('&nbsp;'x20).'</span>'.('&nbsp;'x2).
Line 1571  sub supp_pasteable { Line 1401  sub supp_pasteable {
         (($url =~ /\.sequence$/) && ($url =~ m{^/uploaded/})) ||          (($url =~ /\.sequence$/) && ($url =~ m{^/uploaded/})) ||
         ($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||          ($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||
         ($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||          ($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||
         ($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) ||          ($url =~ m{^/public/$match_domain/$match_courseid/syllabus})) {
         ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$})) {  
         return 1;          return 1;
     }      }
     return;      return;
Line 1694  sub do_paste_from_buffer { Line 1523  sub do_paste_from_buffer {
         return();          return();
     }      }
   
     my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%notindom,%duplicate,      my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,
         %prefixchg,%srcdom,%srcnum,%srcmapidx,%marktomove,$save_err,$lockerrors,$allresult);          %prefixchg,%srcdom,%srcnum,%srcmapidx,%marktomove,$save_err,$lockerrors,$allresult);
   
     foreach my $suffix (@topaste) {      foreach my $suffix (@topaste) {
Line 1722  sub do_paste_from_buffer { Line 1551  sub do_paste_from_buffer {
             }              }
             $srcdom{$suffix} = $srcd;              $srcdom{$suffix} = $srcd;
             $srcnum{$suffix} = $srcn;              $srcnum{$suffix} = $srcn;
         } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {  
             my ($srcd,$srcn) = split(/_/,$cid);  
 # When paste buffer was populated using an active role in a different course  
 # check for mdc privilege in the course from which the resource was pasted  
             if (($srcd ne $coursedom) || ($srcn ne $coursenum)) {  
                 unless ($env{"user.priv.cm./$srcd/$srcn"} =~ /\Q:mdc&F\E/) {  
                     $notincrs{$suffix} = 1;  
                     next;  
                 }  
             }  
 # When buffer was populated using an active role in a different course  
 # disallow pasting of External Tool if course is in a different domain.  
             if ($srcd ne $coursedom) {  
                 $notindom{$suffix} = 1;  
                 next;  
             }  
             $srcdom{$suffix} = $srcd;  
             $srcnum{$suffix} = $srcn;  
         } elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||          } elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) ||
                  ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$})) {                   ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$})) {
             my ($srcd,$srcn) = split(/_/,$cid);              my ($srcd,$srcn) = split(/_/,$cid);
Line 1804  sub do_paste_from_buffer { Line 1615  sub do_paste_from_buffer {
     %msgs = &Apache::lonlocal::texthash (      %msgs = &Apache::lonlocal::texthash (
                 notinsupp => 'Paste failed: content type is not supported within Supplemental Content',                  notinsupp => 'Paste failed: content type is not supported within Supplemental Content',
                 notincrs  => 'Paste failed: Item is from a different course which you do not have rights to edit.',                  notincrs  => 'Paste failed: Item is from a different course which you do not have rights to edit.',
                 notindom  => 'Paste failed: Item is an external tool from a course in a different donain.',  
                 duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',                  duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',
             );              );
   
Line 1858  sub do_paste_from_buffer { Line 1668  sub do_paste_from_buffer {
                                                          $env{'request.course.id'});                                                           $env{'request.course.id'});
                 $donechk = 1;                   $donechk = 1; 
             }              }
             &contained_map_check($url,$folder,$coursenum,$coursedom,              &contained_map_check($url,$folder,\%removefrommap,\%removeparam,
                                  \%removefrommap,\%removeparam,\%addedmaps,                                   \%addedmaps,\%hierarchy,\%titles,$allmaps);
                                  \%hierarchy,\%titles,$allmaps);  
             if ($url=~ m{^/uploaded/}) {              if ($url=~ m{^/uploaded/}) {
                 my $newurl;                  my $newurl;
                 unless ($env{'form.docs.markedcopy_options_'.$suffix} eq 'move') {                  unless ($env{'form.docs.markedcopy_options_'.$suffix} eq 'move') {
Line 1913  sub do_paste_from_buffer { Line 1722  sub do_paste_from_buffer {
                 }                  }
             }              }
         }          }
         if ($url=~ m{/(bulletinboard|smppg|ext\.tool)$}) {          if ($url=~ m{/(bulletinboard|smppg)$}) {
             my $prefix = $1;              my $prefix = $1;
             my $fromothercrs;              my $fromothercrs;
             #need to copy the db contents to a new one, unless this is a move.              #need to copy the db contents to a new one, unless this is a move.
Line 1941  sub do_paste_from_buffer { Line 1750  sub do_paste_from_buffer {
                         $msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;                          $msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;
                     } elsif ($prefix eq 'bulletinboard') {                      } elsif ($prefix eq 'bulletinboard') {
                         $msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;                          $msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;
                     } elsif ($prefix eq 'ext.tool') {  
                         $msg = &mt('Paste failed: An error occurred when copying the external tool.').' '.$errtext;  
                     }                      }
                     $results{$suffix} = $result;                      $results{$suffix} = $result;
                     $msgerrs{$suffix} = $msg;                      $msgerrs{$suffix} = $msg;
Line 2202  sub dbcopy { Line 2009  sub dbcopy {
     my ($url,$result,$errtext);      my ($url,$result,$errtext);
     if (ref($dbref) eq 'HASH') {      if (ref($dbref) eq 'HASH') {
         $url = $dbref->{'src'};          $url = $dbref->{'src'};
         if ($url =~ m{/(smppg|bulletinboard|ext\.tool)$}) {          if ($url =~ m{/(smppg|bulletinboard)$}) {
             my $prefix = $1;              my $prefix = $1;
             if ($prefix eq 'ext.tool') {  
                 $prefix = 'exttool';  
             }  
             if (($dbref->{'cdom'} =~ /^$match_domain$/) &&              if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
                 ($dbref->{'cnum'} =~ /^$match_courseid$/)) {                  ($dbref->{'cnum'} =~ /^$match_courseid$/)) {
                 my $db_name;                  my $db_name;
Line 2217  sub dbcopy { Line 2021  sub dbcopy {
                         &Apache::lonsimplepage::get_db_name($url,$marker,                          &Apache::lonsimplepage::get_db_name($url,$marker,
                                                             $dbref->{'cdom'},                                                              $dbref->{'cdom'},
                                                             $dbref->{'cnum'});                                                              $dbref->{'cnum'});
                 } elsif ($dbref->{'src'} =~ m{/ext\.tool$}) {  
                     $db_name = 'exttool_'.$marker;  
                 } else {                  } else {
                     $db_name = 'bulletinpage_'.$marker;                      $db_name = 'bulletinpage_'.$marker;
                 }                  }
Line 2229  sub dbcopy { Line 2031  sub dbcopy {
                 if (!$suffix) {                  if (!$suffix) {
                     if ($prefix eq 'smppg') {                      if ($prefix eq 'smppg') {
                         $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);                          $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);
                     } elsif ($prefix eq 'exttool') {  
                         $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying an external tool [_1].',$url);  
                     } else {                      } else {
                         $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url);                          $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url);
                     }                      }
Line 2264  sub dbcopy { Line 2064  sub dbcopy {
                     $result=&Apache::lonnet::put($db_name,\%contents,                      $result=&Apache::lonnet::put($db_name,\%contents,
                                                  $coursedom,$coursenum);                                                   $coursedom,$coursenum);
                     if ($result eq 'ok') {                      if ($result eq 'ok') {
                         $url =~ s{/(\d*)/(smppg|bulletinboard|ext\.tool)$}{/$suffix/$2}x;                          $url =~ s{/(\d*)/(smppg|bulletinboard)$}{/$suffix/$2}x;
                     }                      }
                 }                  }
                 if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {                  if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {
Line 2274  sub dbcopy { Line 2074  sub dbcopy {
                     if ($prefix eq 'smppg') {                      if ($prefix eq 'smppg') {
                         $lockerrorsref->{$prefix} .=                          $lockerrorsref->{$prefix} .=
                             ' '.&mt('This will prevent creation of additional simple pages in this course.');                              ' '.&mt('This will prevent creation of additional simple pages in this course.');
                     } elsif ($prefix eq 'exttool') {  
                         $lockerrorsref->{$prefix} .=  
                             ' '.&mt('This will prevent addition of more external tools to this course.');  
                     } else {                      } else {
                         $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional discussion boards in this course.');                          $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional discussion boards in this course.');
                     }                      }
Line 2408  sub uniqueness_check { Line 2205  sub uniqueness_check {
 }  }
   
 sub contained_map_check {  sub contained_map_check {
     my ($url,$folder,$coursenum,$coursedom,$removefrommap,$removeparam,$addedmaps,      my ($url,$folder,$removefrommap,$removeparam,$addedmaps,$hierarchy,$titles,
         $hierarchy,$titles,$allmaps) = @_;          $allmaps) = @_;
     my $content = &Apache::lonnet::getfile($url);      my $content = &Apache::lonnet::getfile($url);
     unless ($content eq '-1') {      unless ($content eq '-1') {
         my $parser = HTML::TokeParser->new(\$content);          my $parser = HTML::TokeParser->new(\$content);
Line 2438  sub contained_map_check { Line 2235  sub contained_map_check {
                             $addedmaps->{$ressrc} = [$url];                              $addedmaps->{$ressrc} = [$url];
                         }                          }
                     }                      }
                     &contained_map_check($ressrc,$folder,$coursenum,$coursedom,                      &contained_map_check($ressrc,$folder,$removefrommap,$removeparam,
                                          $removefrommap,$removeparam,  
                                          $addedmaps,$hierarchy,$titles,$allmaps);                                           $addedmaps,$hierarchy,$titles,$allmaps);
                 }                  }
             } elsif ($token->[1] eq 'param') {              } elsif ($token->[1] eq 'param') {
Line 3128  sub handle_edit_cmd { Line 2924  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,$ltitoolsref,          $supplementalflag,$orderhash,$iconpath,$pathitem,$canedit,
         $canedit,$hostname,$navmapref,$hiddentop)=@_;          $hostname,$navmapref,$hiddentop)=@_;
     my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);      my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
     if ($allowed) {      if ($allowed) {
         (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,          (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
Line 3340  sub editor { Line 3136  sub editor {
                         } else {                          } else {
                             return $errortxt;                              return $errortxt;
                         }                          }
                     } elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/ext\.tool}) {  
                         my ($suffix,$errortxt,$locknotfreed) =  
                             &new_timebased_suffix($coursedom,$coursenum,'exttool');  
                         if ($locknotfreed) {  
                             $r->print($locknotfreed);  
                         }  
                         if ($suffix) {  
                             $url =~ s{^(/adm/$coursedom/$coursenum)/new}{$1/$suffix};  
                         } else {  
                             return $errortxt;  
                         }  
                     } elsif ($url =~ m{^/uploaded/$coursedom/$coursenum/(docs|supplemental)/(default|\d+)/new.html$}) {                      } elsif ($url =~ m{^/uploaded/$coursedom/$coursenum/(docs|supplemental)/(default|\d+)/new.html$}) {
                         if ($supplementalflag) {                          if ($supplementalflag) {
                             next unless ($1 eq 'supplemental');                              next unless ($1 eq 'supplemental');
Line 3373  sub editor { Line 3158  sub editor {
     }      }
             ($errtext,$fatal,my $fixuperrors) =              ($errtext,$fatal,my $fixuperrors) =
                 &group_import($coursenum, $coursedom, $folder,$container,                  &group_import($coursenum, $coursedom, $folder,$container,
                               'londocs',$ltitoolsref,@imports);                                'londocs',@imports);
     return $errtext if ($fatal);      return $errtext if ($fatal);
             if ($fixuperrors) {              if ($fixuperrors) {
                 $r->print($fixuperrors);                  $r->print($fixuperrors);
Line 3459  sub editor { Line 3244  sub editor {
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,          $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,                                $coursenum,$coursedom,$crstype,
                               $pathitem,$supplementalflag,$container,                                $pathitem,$supplementalflag,$container,
                               \%filters,\%curr_groups,$ltitoolsref,$canedit,                                \%filters,\%curr_groups,$canedit,
                               $isencrypted,$navmapref,$hostname);                                $isencrypted,$navmapref,$hostname);
         $idx++;          $idx++;
         $shown++;          $shown++;
Line 3839  sub is_supplemental_title { Line 3624  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,$container,$filtersref,$currgroups,          $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
         $ltitoolsref,$canedit,$isencrypted,$navmapref,$hostname)=@_;          $canedit,$isencrypted,$navmapref,$hostname)=@_;
     my ($foldertitle,$renametitle,$oldtitle);      my ($foldertitle,$renametitle,$oldtitle);
     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);
Line 3936  END Line 3721  END
  'rn' => 'Rename',   'rn' => 'Rename',
  'cp' => 'Copy',   'cp' => 'Copy',
                 'ex' => 'External Resource',                  'ex' => 'External Resource',
                 'et' => 'External Tool',  
                 'ed' => 'Edit',                  'ed' => 'Edit',
                 'pr' => 'Preview',                  'pr' => 'Preview',
                 'sv' => 'Save',                  'sv' => 'Save',
Line 3956  END Line 3740  END
     |/aboutme$      |/aboutme$
     |/navmaps$      |/navmaps$
     |/bulletinboard$      |/bulletinboard$
                             |/ext\.tool$  
     |\.html$)}x)      |\.html$)}x)
              || $isexternal) {               || $isexternal) {
     $skip_confirm = 1;      $skip_confirm = 1;
Line 4091  END Line 3874  END
     my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);      my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);
     my $orig_url = $url;      my $orig_url = $url;
     $orig_url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};      $orig_url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};
     if ($container eq 'page') {      $url=~s{^http(|s)(&colon;|:)//}{/adm/wrapper/ext/};
         $url=~s{^http(|s)(&colon;|:)//}{/ext/};  
     } else {  
         $url=~s{^http(|s)(&colon;|:)//}{/adm/wrapper/ext/};  
     }  
     if (!$supplementalflag && $residx && $symb) {      if (!$supplementalflag && $residx && $symb) {
         if ((!$isfolder) && (!$ispage)) {          if ((!$isfolder) && (!$ispage)) {
     (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);      (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
             if (($url =~ m{^ext/}) && ($container eq 'page')) {      $url=&Apache::lonnet::clutter($url);
                 $url=&Apache::lonnet::clutter_with_no_wrapper($url);  
             } else {  
                 $url=&Apache::lonnet::clutter($url);  
             }  
     if ($url=~/^\/*uploaded\//) {      if ($url=~/^\/*uploaded\//) {
         $url=~/\.(\w+)$/;          $url=~/\.(\w+)$/;
         my $embstyle=&Apache::loncommon::fileembstyle($1);          my $embstyle=&Apache::loncommon::fileembstyle($1);
Line 4117  END Line 3892  END
             } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {              } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {
                 my $wrapped = $1;                  my $wrapped = $1;
                 my $exturl = $2;                  my $exturl = $2;
                 if (($wrapped eq '') && ($container ne 'page')) {                  if ($wrapped eq '') {
                     $url='/adm/wrapper'.$url;                      $url='/adm/wrapper'.$url;
                 }                  }
                 if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {                  if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
                     $nomodal = 1;                      $nomodal = 1;
                 }                  }
             } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {  
                 $url='/adm/wrapper'.$url;  
             } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {              } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
                 if (($ENV{'SERVER_PORT'} == 443) &&                  if (($ENV{'SERVER_PORT'} == 443) &&
                     ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {                      ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
Line 4137  END Line 3910  END
             if (&Apache::lonnet::symbverify($symb,$url)) {              if (&Apache::lonnet::symbverify($symb,$url)) {
                 my $shownsymb = $symb;                  my $shownsymb = $symb;
                 if ($isexternal) {                  if ($isexternal) {
                     $url =~ s/\#[^#]+$//;                      if ($url =~ /^([^#]+)#([^#]+)$/) {
                     if ($container eq 'page') {                          $url = $1;
                         $url = &Apache::lonnet::clutter($url);                          $anchor = $2;
                           my $escan = &escape('#');
                           $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;
                     }                      }
                 }                  }
                 unless ($env{'request.role.adv'}) {                  unless ($env{'request.role.adv'}) {
Line 4301  $form_common."\n". Line 4076  $form_common."\n".
 $form_end;  $form_end;
         }          }
     } elsif ($supplementalflag && !$allowed) {      } elsif ($supplementalflag && !$allowed) {
         my $isexttool;  
         if ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {  
             $url='/adm/wrapper'.$url;  
             $isexttool = 1;  
         }  
         $url .= ($url =~ /\?/) ? '&amp;':'?';          $url .= ($url =~ /\?/) ? '&amp;':'?';
         $url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');          $url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');
         if ($title) {          if ($title) {
             $url .= '&amp;title='.&HTML::Entities::encode($renametitle,'<>&"');              $url .= '&amp;title='.&HTML::Entities::encode($renametitle,'<>&"');
         }          }
         if ((($isexternal) || ($isexttool)) && $orderidx) {          if ($isexternal && $orderidx) {
             $url .= '&amp;idx='.$orderidx;              $url .= '&amp;idx='.$orderidx;
         }          }
         if ($anchor ne '') {          if ($anchor ne '') {
Line 4325  $form_end; Line 4095  $form_end;
         if ($isexternal) {          if ($isexternal) {
             ($editlink,$extresform) =               ($editlink,$extresform) = 
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,                  &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,undef,undef,undef,                                                       undef,undef,undef,$disabled);
                                                      undef,$disabled);  
         } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {  
             ($editlink,$extresform) =  
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,  
                                                      undef,undef,undef,'tool',$coursedom,  
                                                      $coursenum,$ltitoolsref,$disabled);  
         } elsif (!$isfolder && !$ispage) {          } elsif (!$isfolder && !$ispage) {
             my ($cfile,$home,$switchserver,$forceedit,$forceview) =               my ($cfile,$home,$switchserver,$forceedit,$forceview) = 
                 &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);                  &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
Line 4542  sub new_timebased_suffix { Line 4306  sub new_timebased_suffix {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new folder/page.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new folder/page.');
         } elsif ($type eq 'smppg') {          } elsif ($type eq 'smppg') {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.');
         } elsif ($type eq 'exttool') {  
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new external tool.');  
         } else {          } else {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');
         }          }
Line 4572  sub new_timebased_suffix { Line 4334  sub new_timebased_suffix {
         } elsif ($type eq 'smppg') {          } elsif ($type eq 'smppg') {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional simple pages in this course.');                  &mt('This will prevent creation of additional simple pages in this course.');
         } elsif ($type eq 'exttool') {  
             $locknotfreed .=  
                 &mt('This will prevent creation of additional external tools in this course.');  
         } else {          } else {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional discussion boards in this course.');                  &mt('This will prevent creation of additional discussion boards in this course.');
Line 4758  sub list_symbs { Line 4517  sub list_symbs {
     $r->print(&endContentScreen());      $r->print(&endContentScreen());
 }  }
   
 sub short_urls {  
     my ($r,$canedit) = @_;  
     my $crstype = &Apache::loncommon::course_type();  
     my $formname = 'shortenurl';  
     $r->print(&Apache::loncommon::start_page('Display/Set Shortened URLs'));  
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Shortened URLs'));  
     $r->print(&startContentScreen('tools'));  
     my ($navmap,$errormsg) =  
         &Apache::loncourserespicker::get_navmap_object($crstype,'shorturls');  
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};  
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
     my (%maps,%resources,%titles);  
     if (!ref($navmap)) {  
         $r->print($errormsg.  
                   &endContentScreen());  
         return '';  
     } else {  
         $r->print('<h4 class="LC_info">'.&mt('Tiny URLs for deep-linking into course').'</h4>'."\n");  
         $r->rflush();  
         my $readonly;  
         if ($canedit) {  
             my ($numnew,$errors) = &Apache::loncommon::get_requested_shorturls($cdom,$cnum,$navmap);  
             if ($numnew) {  
                 $r->print('<p class="LC_info">'.&mt('Created [quant,_1,URL]',$numnew).'</p>');  
             }  
             if ((ref($errors) eq 'ARRAY') && (@{$errors} > 0)) {  
                 $r->print(&mt('The following errors occurred when processing your request to create shortened URLs:').'<br /><ul>');  
                 foreach my $error (@{$errors}) {  
                     $r->print('<li>'.$error.'</li>');  
                 }  
                 $r->print('</ul><br />');  
             }  
         } else {  
             $readonly = 1;  
         }  
         my %currtiny = &Apache::lonnet::dump('tiny',$cdom,$cnum);  
         $r->print(&Apache::loncourserespicker::create_picker($navmap,'shorturls',$formname,$crstype,undef,  
                                                              undef,undef,undef,undef,undef,\%currtiny,$readonly));  
     }  
     $r->print(&endContentScreen());  
 }  
   
 sub contentverifyform {  sub contentverifyform {
     my ($r) = @_;      my ($r) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
Line 4814  sub contentverifyform { Line 4531  sub contentverifyform {
               &mt('No').'</label>'.('&nbsp;'x2).                &mt('No').'</label>'.('&nbsp;'x2).
               '<label><input type="radio" name="checkstale" value="1" />'.                '<label><input type="radio" name="checkstale" value="1" />'.
               &mt('Yes').'</label></span></p><p>'.                &mt('Yes').'</label></span></p><p>'.
               '<input type="submit" value="'.&mt('Verify Content').' "/>'.                '<input type="submit" value="'.&mt('Verify content').' "/>'.
               '<input type="hidden" value="1" name="tools" />'.                '<input type="hidden" value="1" name="tools" />'.
               '<input type="hidden" value="1" name="verify" /></p></form>');                '<input type="hidden" value="1" name="verify" /></p></form>');
     $r->print(&endContentScreen());      $r->print(&endContentScreen());
Line 5273  sub handler { Line 4990  sub handler {
 #  #
 # --------------------------------------------- Initialize help topics for this  # --------------------------------------------- Initialize help topics for this
     foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',      foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
                        'Adding_External_Resource','Adding_External_Tool',                 'Adding_External_Resource','Navigate_Content',
                        'Navigate_Content','Adding_Folders','Docs_Overview',                 'Adding_Folders','Docs_Overview', 'Load_Map',
                        'Load_Map','Supplemental','Score_Upload_Form',                 'Supplemental','Score_Upload_Form','Adding_Pages',
                        'Adding_Pages','Importing_LON-CAPA_Resource',                 'Importing_LON-CAPA_Resource','Importing_IMS_Course',
                        'Importing_IMS_Course','Uploading_From_Harddrive',                         'Uploading_From_Harddrive','Course_Roster','Web_Page',
                        'Course_Roster','Web_Page','Dropbox','Simple_Problem') {                         'Dropbox','Simple_Problem') {
  $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);   $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
     }      }
     # Composite help files      # Composite help files
Line 5332  sub handler { Line 5049  sub handler {
   } elsif ($allowed && $env{'form.listsymbs'}) {    } elsif ($allowed && $env{'form.listsymbs'}) {
       &init_breadcrumbs('listsymbs','List Content IDs');        &init_breadcrumbs('listsymbs','List Content IDs');
       &list_symbs($r);        &list_symbs($r);
   } elsif ($allowed && $env{'form.shorturls'}) {  
       &init_breadcrumbs('shorturls','Set/Display Shortened URLs','Docs_Short_URLs');  
       &short_urls($r,$canedit);  
   } elsif ($allowed && $env{'form.docslog'}) {    } elsif ($allowed && $env{'form.docslog'}) {
       &init_breadcrumbs('docslog','Show Log');        &init_breadcrumbs('docslog','Show Log');
       my $folder = $env{'form.folder'};        my $folder = $env{'form.folder'};
Line 5405  sub handler { Line 5119  sub handler {
     if ($env{'form.tools'}) { $toolsflag=1; }      if ($env{'form.tools'}) { $toolsflag=1; }
   
     if ($env{'form.folderpath'} ne '') {      if ($env{'form.folderpath'} ne '') {
         &validate_folderpath($supplementalflag);          my @items = split(/\&/,$env{'form.folderpath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {
                   $badpath = 1;
               } elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.folderpath'});
           }
     }      }
   
     if ($env{'form.supppath'} ne '') {      if ($env{'form.supppath'} ne '') {
         &validate_suppath();          my @items = split(/\&/,$env{'form.supppath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.supppath'});
           }
     }      }
   
     my $script='';      my $script='';
Line 5418  sub handler { Line 5156  sub handler {
     my $container;      my $container;
     my $containertag;      my $containertag;
     my $pathitem;      my $pathitem;
     my %ltitools;  
     my $hiddentop;      my $hiddentop;
     my $navmap;      my $navmap;
     my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) };      my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) };
Line 5468  sub handler { Line 5205  sub handler {
         } else {          } else {
             undef($env{'form.folderpath'});              undef($env{'form.folderpath'});
         }          }
         if ($env{'form.folderpath'} ne '') {  
             &validate_folderpath($supplementalflag);  
         }  
     }      }
         
 # 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
Line 5495  sub handler { Line 5229  sub handler {
             undef($env{'form.folderpath'});              undef($env{'form.folderpath'});
         } else {          } else {
             $folderurl = "uploaded/$coursedom/$coursenum/$folder";              $folderurl = "uploaded/$coursedom/$coursenum/$folder";
             if ((split(/\:/,$pathitems[-1]))[5]) {              if ((split(/\:/,$pathitems[-1]))[4]) {
                 $folderurl .= '.page';                  $folderurl .= '.page';
             } else {              } else {
                 $folderurl .= '.sequence';                  $folderurl .= '.sequence';
Line 5599  sub handler { Line 5333  sub handler {
                 }                  }
             }              }
             my $tabidstr = join("','",@tabids);              my $tabidstr = join("','",@tabids);
             %ltitools = &Apache::lonnet::get_domain_lti($coursedom,'consumer');  
             my $posslti = keys(%ltitools);  
             my $hostname = $r->hostname();              my $hostname = $r->hostname();
             $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,      $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,
                                    $canedit,$hostname,\$navmap).                                     $canedit,$hostname,\$navmap).
                        &history_tab_js().                         &history_tab_js().
                        &inject_data_js().                         &inject_data_js().
                        &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).                         &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).
                        &Apache::lonextresedit::extedit_javascript(\%ltitools);                         &Apache::lonextresedit::extedit_javascript();
             $addentries = {              $addentries = {
                             onload   => "javascript:resize_scrollbox('contentscroll','1','1');",                              onload   => "javascript:resize_scrollbox('contentscroll','1','1');",
                           };                            };
Line 5743  sub handler { Line 5475  sub handler {
                 'impo' => 'Import',                  'impo' => 'Import',
  'lnks' => 'Import from Stored Links',   'lnks' => 'Import from Stored Links',
                 'impm' => 'Import from Assembled Map',                  'impm' => 'Import from Assembled Map',
                 'extr' => 'External Resource',  
                 'extt' => 'External Tool',   
                 'selm' => 'Select Map',                  'selm' => 'Select Map',
                 'load' => 'Load Map',                  'load' => 'Load Map',
                 'newf' => 'New Folder',                  'newf' => 'New Folder',
Line 5916  SEDFFORM Line 5646  SEDFFORM
         my $extresourcesform =          my $extresourcesform =
             &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,              &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,
                                                  $help{'Adding_External_Resource'},                                                   $help{'Adding_External_Resource'},
                                                  undef,undef,undef,undef,undef,undef,$disabled);                                                   undef,undef,$disabled);
         my $exttoolform =  
             &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,  
                                                  $help{'Adding_External_Tool'},undef,  
                                                  undef,'tool',$coursedom,$coursenum,  
                                                  \%ltitools,$disabled);  
     if ($allowed) {      if ($allowed) {
         my $folder = $env{'form.folder'};          my $folder = $env{'form.folder'};
         if ($folder eq '') {          if ($folder eq '') {
Line 6157  NSYLFORM Line 5882  NSYLFORM
  $help{'Group Portfolio'}   $help{'Group Portfolio'}
  </form>   </form>
 NGFFORM  NGFFORM
         if ($container eq 'page') {   @specialdocumentsforma=(
             @specialdocumentsforma=(  
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/webpage.png" alt="'.$lt{webp}.'" onclick="javascript:makewebpage();" />'=>$newwebpageform},  
             );  
         } else {  
     @specialdocumentsforma=(  
  {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/page.png" alt="'.$lt{newp}.'"  onclick="javascript:makenewpage(document.newpage,\''.$pageseq.'\');" />'=>$newpageform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/page.png" alt="'.$lt{newp}.'"  onclick="javascript:makenewpage(document.newpage,\''.$pageseq.'\');" />'=>$newpageform},
  {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="javascript:makenew(document.newsyl);" />'=>$newsylform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="javascript:makenew(document.newsyl);" />'=>$newsylform},
  {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="javascript:makenew(document.newnav);" />'=>$newnavform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="javascript:makenew(document.newnav);" />'=>$newnavform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simple.png" alt="'.$lt{sipa}.'" onclick="javascript:makesmppage();" />'=>$newsmppageform},          {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simple.png" alt="'.$lt{sipa}.'" onclick="javascript:makesmppage();" />'=>$newsmppageform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/webpage.png" alt="'.$lt{webp}.'" onclick="javascript:makewebpage();" />'=>$newwebpageform},          {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/webpage.png" alt="'.$lt{webp}.'" onclick="javascript:makewebpage();" />'=>$newwebpageform},
             );          );
         }  
         $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma));          $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma));
   
   
         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}
         );          );
         if (keys(%ltitools)) {  
             push(@importdoc,  
                 {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="toggleUpload(\'tool\');" />'=>$exttoolform},  
         );  
         }  
         unless ($container eq 'page') {          unless ($container eq 'page') {
             push(@importdoc,              push(@importdoc,
                 {'<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/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform}
Line 6212  my %orderhash = ( Line 5926  my %orderhash = (
                 'aa' => ['Upload',$fileuploadform],                  'aa' => ['Upload',$fileuploadform],
                 'bb' => ['Import',$importpubform],                  'bb' => ['Import',$importpubform],
                 'cc' => ['Grading',$gradingform],                  'cc' => ['Grading',$gradingform],
                 'ee' => ['Other',$specialdocumentsform],  
                 );                  );
 unless ($container eq 'page') {  unless ($container eq 'page') {
     $orderhash{'00'} = ['Newfolder',$newfolderform];      $orderhash{'00'} = ['Newfolder',$newfolderform];
     $orderhash{'dd'} = ['Collaboration',$communityform];      $orderhash{'dd'} = ['Collaboration',$communityform];
       $orderhash{'ee'} = ['Other',$specialdocumentsform];
 }  }
   
  $hadchanges=0;   $hadchanges=0;
        unless (($supplementalflag || $toolsflag)) {         unless (($supplementalflag || $toolsflag)) {
           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                               $supplementalflag,\%orderhash,$iconpath,$pathitem,                                $supplementalflag,\%orderhash,$iconpath,$pathitem,
                               \%ltitools,$canedit,$hostname,\$navmap,$hiddentop);                                $canedit,$hostname,\$navmap,$hiddentop);
           undef($navmap);            undef($navmap);
           if ($error) {            if ($error) {
              $r->print('<p><span class="LC_error">'.$error.'</span></p>');               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
Line 6293  SNFFORM Line 6007  SNFFORM
             &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,              &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,
                                                  $help{'Adding_External_Resource'},                                                   $help{'Adding_External_Resource'},
                                                  undef,undef,$disabled);                                                   undef,undef,$disabled);
         my $supexttoolform =  
             &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,  
                                                  $help{'Adding_External_Tool'},  
                                                  undef,undef,'tool',$coursedom,  
                                                  $coursenum,\%ltitools,$disabled);  
   
  my $supnewsylform=(<<SNSFORM);   my $supnewsylform=(<<SNSFORM);
  <form action="/adm/coursedocs" method="post" name="supnewsyl">   <form action="/adm/coursedocs" method="post" name="supnewsyl">
Line 6352  my @specialdocs = ( Line 6061  my @specialdocs = (
  );   );
 my @supimportdoc = (  my @supimportdoc = (
  {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />'   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />'
             =>$supextform});              =>$supextform},
         if (keys(%ltitools)) {  
             push(@supimportdoc,  
                 {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="javascript:toggleUpload(\'supptool\')" />'  
             =>$supexttoolform});  
         }  
         push(@supimportdoc,  
                 {'<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},
         );                     );
   
 $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));  $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));
 my %suporderhash = (  my %suporderhash = (
Line 6372  my %suporderhash = ( Line 6075  my %suporderhash = (
         if ($supplementalflag) {          if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,             my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                                $supplementalflag,\%suporderhash,$iconpath,$pathitem,                                 $supplementalflag,\%suporderhash,$iconpath,$pathitem,
                                \%ltitools,$canedit,$hostname);                                 $canedit,$hostname);
            if ($error) {             if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');                $r->print('<p><span class="LC_error">'.$error.'</span></p>');
            } else {             } else {
Line 6592  sub generate_admin_menu { Line 6295  sub generate_admin_menu {
                                          'vc'   => 'Verify Content',                                           'vc'   => 'Verify Content',
                                          'cv'   => 'Check/Set Resource Versions',                                           'cv'   => 'Check/Set Resource Versions',
                                          'ls'   => 'List Resource Identifiers',                                           'ls'   => 'List Resource Identifiers',
                                          'ct'   => 'Display/Set Shortened URLs for Deep-linking',  
                                          'imse' => 'Export contents to IMS Archive',                                           'imse' => 'Export contents to IMS Archive',
                                          'dcd'  => "Copy $crstype Content to Authoring Space",                                           'dcd'  => "Copy $crstype Content to Authoring Space",
             );              );
Line 6643  sub generate_admin_menu { Line 6345  sub generate_admin_menu {
                     icon       => 'symbs.png',                      icon       => 'symbs.png',
                     linktitle  => "List the unique identifier used for each resource instance in your $lc_crstype"                      linktitle  => "List the unique identifier used for each resource instance in your $lc_crstype"
                 },                  },
                 {   linktext   => $lt{'ct'},  
                     url        => "javascript:injectData(document.courseverify,'dummy','shorturls','$lt{'ct'}')",  
                     permission => 'F',  
                     help       => 'Docs_Short_URLs',  
                     icon       => 'shorturls.png',  
                     linktitle  => "Set shortened URLs for a resource or folder in your $lc_crstype for use in deep-linking"  
                 },  
                 ]                  ]
         });          });
     if ($canedit) {      if ($canedit) {
Line 6780  END Line 6475  END
 }  }
   
 sub editing_js {  sub editing_js {
     my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,      my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,
         $canedit,$hostname,$navmapref) = @_;          $canedit,$hostname,$navmapref) = @_;
     my %js_lt = &Apache::lonlocal::texthash(      my %js_lt = &Apache::lonlocal::texthash(
                                           p_mnf => 'Name of New Folder',                                            p_mnf => 'Name of New Folder',
Line 6897  sub editing_js { Line 6592  sub editing_js {
     }      }
   
     my $fieldsets = "'ext','doc'";      my $fieldsets = "'ext','doc'";
     if ($posslti) {  
         $fieldsets .= ",'tool'";  
     }  
     unless ($main_container_page) {      unless ($main_container_page) {
         $fieldsets .=",'ims'";          $fieldsets .=",'ims'";
     }      }
     if ($supplementalflag) {      if ($supplementalflag) {
         $fieldsets = "'suppext','suppdoc'";          $fieldsets = "'suppext','suppdoc'";
         if ($posslti) {  
             $fieldsets .= ",'supptool'";  
         }  
     }      }
   
     my $jsmakefunctions;      my $jsmakefunctions;
Line 6916  sub editing_js { Line 6605  sub editing_js {
 function makenewfolder(targetform,folderseq) {  function makenewfolder(targetform,folderseq) {
     var foldername=prompt('$js_lt{"p_mnf"}','$js_lt{"t_mnf"}');      var foldername=prompt('$js_lt{"p_mnf"}','$js_lt{"t_mnf"}');
     if (foldername) {      if (foldername) {
        targetform.importdetail.value=encodeURIComponent(foldername)+"="+folderseq;         targetform.importdetail.value=escape(foldername)+"="+folderseq;
         targetform.submit();          targetform.submit();
     }      }
 }  }
Line 6924  function makenewfolder(targetform,folder Line 6613  function makenewfolder(targetform,folder
 function makenewpage(targetform,folderseq) {  function makenewpage(targetform,folderseq) {
     var pagename=prompt('$js_lt{"p_mnp"}','$js_lt{"t_mnp"}');      var pagename=prompt('$js_lt{"p_mnp"}','$js_lt{"t_mnp"}');
     if (pagename) {      if (pagename) {
         targetform.importdetail.value=encodeURIComponent(pagename)+"="+folderseq;          targetform.importdetail.value=escape(pagename)+"="+folderseq;
         targetform.submit();          targetform.submit();
     }      }
 }  }
Line 6933  function makeexamupload() { Line 6622  function makeexamupload() {
    var title=prompt('$js_lt{"p_mxu"}');     var title=prompt('$js_lt{"p_mxu"}');
    if (title) {     if (title) {
     this.document.forms.newexamupload.importdetail.value=      this.document.forms.newexamupload.importdetail.value=
  encodeURIComponent(title)+'=/res/lib/templates/examupload.problem';   escape(title)+'=/res/lib/templates/examupload.problem';
     this.document.forms.newexamupload.submit();      this.document.forms.newexamupload.submit();
    }     }
 }  }
Line 6942  function makesmppage() { Line 6631  function makesmppage() {
    var title=prompt('$js_lt{"p_msp"}');     var title=prompt('$js_lt{"p_msp"}');
    if (title) {     if (title) {
     this.document.forms.newsmppg.importdetail.value=      this.document.forms.newsmppg.importdetail.value=
  encodeURIComponent(title)+'=/adm/$udom/$uname/new/smppg';   escape(title)+'=/adm/$udom/$uname/new/smppg';
     this.document.forms.newsmppg.submit();      this.document.forms.newsmppg.submit();
    }     }
 }  }
Line 6957  function makewebpage(type) { Line 6646  function makewebpage(type) {
    }     }
    if (title) {     if (title) {
        var webpage = formname.importdetail.value;         var webpage = formname.importdetail.value;
        formname.importdetail.value = encodeURIComponent(title)+'='+webpage;         formname.importdetail.value = escape(title)+'='+webpage;
        formname.submit();         formname.submit();
    }     }
 }  }
Line 6966  function makesmpproblem() { Line 6655  function makesmpproblem() {
    var title=prompt('$js_lt{"p_msb"}');     var title=prompt('$js_lt{"p_msb"}');
    if (title) {     if (title) {
     this.document.forms.newsmpproblem.importdetail.value=      this.document.forms.newsmpproblem.importdetail.value=
  encodeURIComponent(title)+'=/res/lib/templates/simpleproblem.problem';   escape(title)+'=/res/lib/templates/simpleproblem.problem';
     this.document.forms.newsmpproblem.submit();      this.document.forms.newsmpproblem.submit();
    }     }
 }  }
Line 6975  function makedropbox() { Line 6664  function makedropbox() {
    var title=prompt('$js_lt{"p_mdb"}');     var title=prompt('$js_lt{"p_mdb"}');
    if (title) {     if (title) {
     this.document.forms.newdropbox.importdetail.value=      this.document.forms.newdropbox.importdetail.value=
         encodeURIComponent(title)+'=/res/lib/templates/DropBox.problem';          escape(title)+'=/res/lib/templates/DropBox.problem';
     this.document.forms.newdropbox.submit();      this.document.forms.newdropbox.submit();
    }     }
 }  }
Line 6984  function makebulboard() { Line 6673  function makebulboard() {
    var title=prompt('$js_lt{"p_mbb"}');     var title=prompt('$js_lt{"p_mbb"}');
    if (title) {     if (title) {
     this.document.forms.newbul.importdetail.value=      this.document.forms.newbul.importdetail.value=
  encodeURIComponent(title)+'=/adm/$udom/$uname/new/bulletinboard';   escape(title)+'=/adm/$udom/$uname/new/bulletinboard';
     this.document.forms.newbul.submit();      this.document.forms.newbul.submit();
    }     }
 }  }
Line 7104  function toggleUpload(caller) { Line 6793  function toggleUpload(caller) {
             }              }
         }          }
         document.getElementById('upload'+blocks[i]+'form').style.display=disp;          document.getElementById('upload'+blocks[i]+'form').style.display=disp;
         if ((caller == 'tool') || (caller == 'supptool')) {  
             if (disp == 'block') {  
                 if (document.getElementById('LC_exttoolid')) {  
                     var toolselector = document.getElementById('LC_exttoolid');  
                     var suppflag = 0;  
                     if (caller == 'supptool') {  
                         suppflag = 1;  
                     }  
                     currForm = document.getElementById('new'+caller);  
                     updateExttool(toolselector,currForm,suppflag);  
                 }  
             }  
         }  
     }      }
     resize_scrollbox('contentscroll','1','1');      resize_scrollbox('contentscroll','1','1');
     return;      return;

Removed from v.1.484.2.85.2.9  
changed lines
  Added in v.1.484.2.86


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