Diff for /loncom/interface/londocs.pm between versions 1.484.2.85.2.6 and 1.484.2.93.2.8

version 1.484.2.85.2.6, 2020/09/09 02:34:27 version 1.484.2.93.2.8, 2023/01/20 16:30:43
Line 178  sub default_folderpath { Line 178  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 657  sub group_import { Line 696  sub group_import {
                 my $marker = $2;                  my $marker = $2;
                 my $info = $3;                  my $info = $3;
                 my ($toolid,%toolhash,%toolsettings);                  my ($toolid,%toolhash,%toolsettings);
                 my @extras = ('linktext','explanation','crslabel','crstitle');                  my @extras = ('linktext','explanation','crslabel','crstitle','crsappend');
                 my @toolinfo = split(/:/,$info);                  my @toolinfo = split(/:/,$info);
                 if ($residx) {                  if ($residx) {
                     %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);                      %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);
Line 668  sub group_import { Line 707  sub group_import {
                 $toolid =~ s/\D//g;                  $toolid =~ s/\D//g;
                 ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},                  ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},
                  $toolhash{'linktext'},$toolhash{'explanation'},                   $toolhash{'linktext'},$toolhash{'explanation'},
                  $toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo;                   $toolhash{'crslabel'},$toolhash{'crstitle'},$toolhash{'crsappend'}) = @toolinfo;
                 foreach my $item (@extras) {                  foreach my $item (@extras) {
                     $toolhash{$item} = &unescape($toolhash{$item});                      $toolhash{$item} = &unescape($toolhash{$item});
                 }                  }
Line 754  sub group_import { Line 793  sub group_import {
                             if (@deleted) {                              if (@deleted) {
                                 &Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum);                                  &Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum);
                             }                              }
                           } else {
                               return (&mt('Failed to save update to external tool.'),1);
                         }                          }
                     }                      }
                 }                  }
Line 783  sub group_import { Line 824  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 = $name;                  my $fname;
                 if ($fname =~ /^\W+$/) {                  if ($name eq '') {
                       $name = &mt('Web Page');
                     $fname = 'web';                      $fname = 'web';
                 } else {                  } else {
                     $fname =~ s/\W/_/g;                      $fname = $name;
                 }                      $fname=&Apache::lonnet::clean_filename($fname);
                 if (length($fname) > 15) {                      if ($fname eq '') {
                     $fname = substr($fname,0,14);                          $fname = 'web';
                       } 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>$name</title>  <title>$title</title>
 </head>  </head>
 <body bgcolor="#ffffff">  <body bgcolor="#ffffff">
 $initialtext  $initialtext
Line 824  END Line 866  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 1097  sub docs_change_log { Line 1140  sub docs_change_log {
  }   }
  $r->print('</ul>');   $r->print('</ul>');
  if ($docslog{$id}{'logentry'}{'parameter_res'}) {   if ($docslog{$id}{'logentry'}{'parameter_res'}) {
     $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>');              my ($title,$url) = split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'},3);
               if ($title eq '') {
                   ($title) = ($url =~ m{/([^/]+)$});
               }
               $r->print(&LONCAPA::map::qtescape($title).':<ul>');
     foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') {      foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') {
  if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {   if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {
 # FIXME: internationalization seems wrong here  # FIXME: internationalization seems wrong here
Line 1403  sub print_paste_buffer { Line 1450  sub print_paste_buffer {
             }              }
             $pasteitems .= '<label><input type="checkbox" name="pasting" id="pasting_'.$suffix.'" value="'.$suffix.'" '.$onclick.'/>'.$buffer.'</label>';              $pasteitems .= '<label><input type="checkbox" name="pasting" id="pasting_'.$suffix.'" value="'.$suffix.'" '.$onclick.'/>'.$buffer.'</label>';
             if ($nopaste) {              if ($nopaste) {
                  $pasteitems .= $nopaste;                      $pasteitems .= ' <span class="LC_cusr_emph">'.$nopaste.'</span>';   
             } else {              } else {
                 if ($othercrs) {                  if ($othercrs) {
                     $pasteitems .= $othercrs;                      $pasteitems .= $othercrs;
Line 2673  sub apply_fixups { Line 2720  sub apply_fixups {
             $storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;              $storefn =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;
         }          }
         my $mapcontent = &Apache::lonnet::getfile($key);          my $mapcontent = &Apache::lonnet::getfile($key);
           if (($mapcontent eq '-1') && ($before{'map'} eq 'supplemental') &&
               ($after{'map'} eq 'default') &&
               ($key =~ m{^/uploaded/$match_domain/$match_courseid/supplemental_\d+\.sequence$})) {
               $mapcontent = '<map>'."\n".
                             '<resource id="1" src="" type="start" />'."\n".
                             '<link from="1" to="2" index="1" />'."\n".
                             '<resource id="2" src="" type="finish" />'."\n".
                             '</map>';
           }
         if ($mapcontent eq '-1') {          if ($mapcontent eq '-1') {
             if (ref($errors) eq 'HASH') {              if (ref($errors) eq 'HASH') {
                 $errors->{$key} = 1;                  $errors->{$key} = 1;
Line 2955  sub update_parameter { Line 3011  sub update_parameter {
             my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);              my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
             $name=&LONCAPA::map::qtescape($name);              $name=&LONCAPA::map::qtescape($name);
             $url=&LONCAPA::map::qtescape($url);              $url=&LONCAPA::map::qtescape($url);
             next unless ($name && $url);              next unless $url;
             my $is_map;              my $is_map;
             if ($url =~ m{/uploaded/.+\.(page|sequence)$}) {              if ($url =~ m{/uploaded/.+\.(page|sequence)$}) {
                 $is_map = 1;                  $is_map = 1;
Line 3825  sub entryline { Line 3881  sub entryline {
     my $line=&Apache::loncommon::start_data_table_row();      my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end,$form_common,$form_param);      my ($form_start,$form_end,$form_common,$form_param);
 # Edit commands  # Edit commands
     my ($esc_path, $path, $symb);      my ($esc_path, $path, $symb, $shownsymb);
     if ($env{'form.folderpath'}) {      if ($env{'form.folderpath'}) {
  $esc_path=&escape($env{'form.folderpath'});   $esc_path=&escape($env{'form.folderpath'});
  $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');   $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
Line 4087  END Line 4143  END
             } 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://})) {
                     unless (&Apache::lonnet::uses_sts()) {                      unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
                         $url .= '?usehttp=1';                          $url .= '?usehttp=1';
                     }                      }
                     $nomodal = 1;                      $nomodal = 1;
                 }                  }
     }      }
             if (&Apache::lonnet::symbverify($symb,$url)) {              my ($checkencrypt,$shownurl);
                 my $shownsymb = $symb;              if (!$env{'request.role.adv'}) {
                 if ($isexternal) {  
                     $url =~ s/\#[^#]+$//;  
                     if ($container eq 'page') {  
                         $url = &Apache::lonnet::clutter($url);  
                     }  
                 }  
                 unless ($env{'request.role.adv'}) {  
                     if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {  
                         $url = '';  
                     }  
                     if (&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) {  
                         $url = '';  
                         $hiddenres = 1;  
                     }  
                 }  
                 if ($url ne '') {  
                     $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($shownsymb);  
                 }  
             } elsif (!$env{'request.role.adv'}) {  
                 my $checkencrypt;  
                 if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||                  if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||
                       $isencrypted || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {                      ($isencrypted) || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {
                     $checkencrypt = 1;                      $checkencrypt = 1;
                 } elsif (ref($navmapref)) {                  } elsif (ref($navmapref)) {
                     unless (ref($$navmapref)) {                      unless (ref($$navmapref)) {
Line 4128  END Line 4164  END
                         }                          }
                     }                      }
                 }                  }
                 if ($checkencrypt) {              }
                     my $shownsymb = &Apache::lonenc::encrypted($symb);              if ($checkencrypt) {
                     my $shownurl = &Apache::lonenc::encrypted($url);                  my $currenc = $env{'request.enc'};
                     if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) {                  $env{'request.enc'} = 1;
                         $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb);                  $shownsymb = &Apache::lonenc::encrypted($symb);
                         if ($env{'request.enc'} ne '') {                  $shownurl = &Apache::lonenc::encrypted($url);
                             delete($env{'request.enc'});                  if (&Apache::lonnet::symbverify($symb,$url)) {
                         }                      $url = $shownurl;
                     } else {  
                         $url='';  
                     }  
                 } else {                  } else {
                     $url='';                      $url = '';
                 }                  }
             } else {                  $env{'request.enc'} = $currenc;
                 $url='';              } elsif (&Apache::lonnet::symbverify($symb,$url)) {
                   $shownsymb = $symb;
                   if ($isexternal) {
                       $url =~ s/\#[^#]+$//;
                       if ($container eq 'page') {
                           $url = &Apache::lonnet::clutter($url);
                       }
                   }
                   $shownurl = $url;
               }
               unless ($env{'request.role.adv'}) {
                   if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
                       $url = '';
                   }
                   if (&Apache::lonnet::EXT('resource.0.hiddenresource',$symb) =~ /^yes$/i) {
                       $url = '';
                       $hiddenres = 1;
                   }
               }
               if ($url ne '') {
                   $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
             }              }
  }   }
     } elsif ($supplementalflag) {      } elsif ($supplementalflag) {
Line 4152  END Line 4205  END
                 $url = $1;                  $url = $1;
                 $anchor = $2;                  $anchor = $2;
                 if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {                  if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
                     unless (&Apache::lonnet::uses_sts()) {                      unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
                         if ($hostname ne '') {                          if ($hostname ne '') {
                             $url = 'http://'.$hostname.$url;                              $url = 'http://'.$hostname.$url;
                         }                          }
Line 4164  END Line 4217  END
         } elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {          } elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
             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://})) {
                 unless (&Apache::lonnet::uses_sts()) {                  unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
                     if ($hostname ne '') {                      if ($hostname ne '') {
                         $url = 'http://'.$hostname.$url;                          $url = 'http://'.$hostname.$url;
                     }                      }
Line 4303  $form_end; Line 4356  $form_end;
                     &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,                      &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,
                                                             $switchserver,                                                              $switchserver,
                                                             $forceedit,                                                              $forceedit,
                                                             undef,$symb,                                                              undef,$symb,$shownsymb,
                                                             &escape($env{'form.folderpath'}),                                                              &escape($env{'form.folderpath'}),
                                                             $renametitle,$hostname,                                                              $renametitle,$hostname,
                                                             '','',1,$suppanchor);                                                              '','',1,$suppanchor);
Line 5232  sub handler { Line 5285  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','Adding_External_Tool',
                        'Navigate_Content','Adding_Folders','Docs_Overview',                         'Navigate_Content','Adding_Folders','Docs_Overview',
                        'Load_Map','Supplemental','Score_Upload_Form',                 'Load_Map','Supplemental','Score_Upload_Form', 
                        'Adding_Pages','Importing_LON-CAPA_Resource',                 'Adding_Pages','Importing_LON-CAPA_Resource',
                        'Importing_IMS_Course','Uploading_From_Harddrive',                 'Importing_IMS_Course','Uploading_From_Harddrive',
                        'Course_Roster','Web_Page','Dropbox','Simple_Problem') {                         'Course_Roster','Web_Page','Dropbox','Simple_Problem') {
  $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);   $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
     }      }
Line 5364  sub handler { Line 5417  sub handler {
     if ($env{'form.tools'}) { $toolsflag=1; }      if ($env{'form.tools'}) { $toolsflag=1; }
   
     if ($env{'form.folderpath'} ne '') {      if ($env{'form.folderpath'} ne '') {
         my @items = split(/\&/,$env{'form.folderpath'});          &validate_folderpath($supplementalflag);
         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 '') {
         my @items = split(/\&/,$env{'form.supppath'});          &validate_suppath();
         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 5451  sub handler { Line 5480  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 5579  sub handler { Line 5611  sub handler {
                 }                  }
             }              }
             my $tabidstr = join("','",@tabids);              my $tabidstr = join("','",@tabids);
             %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom);              %ltitools = &Apache::lonnet::get_domain_lti($coursedom,'consumer');
             my $posslti = keys(%ltitools);              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,$posslti,
Line 5724  sub handler { Line 5756  sub handler {
  'lnks' => 'Import from Stored Links',   'lnks' => 'Import from Stored Links',
                 'impm' => 'Import from Assembled Map',                  'impm' => 'Import from Assembled Map',
                 'extr' => 'External Resource',                  'extr' => 'External Resource',
                 'extt' => 'External Tool',                   'extt' => 'External Tool',
                 'selm' => 'Select Map',                  'selm' => 'Select Map',
                 'load' => 'Load Map',                  'load' => 'Load Map',
                 'newf' => 'New Folder',                  'newf' => 'New Folder',
Line 6372  my %suporderhash = ( Line 6404  my %suporderhash = (
         }          }
     } elsif ($supplementalflag) {      } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                             $supplementalflag,'',$iconpath,$pathitem,'',$hostname);                              $supplementalflag,'',$iconpath,$pathitem,'',$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>');
         }          }
Line 6843  sub editing_js { Line 6876  sub editing_js {
                 if ($backtourl =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {                  if ($backtourl =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
                     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://})) {
                         unless (&Apache::lonnet::uses_sts()) {                          unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
                             if ($hostname ne '') {                              if ($hostname ne '') {
                                 $backtourl = 'http://'.$hostname.$backtourl;                                  $backtourl = 'http://'.$hostname.$backtourl;
                             }                              }
Line 6852  sub editing_js { Line 6885  sub editing_js {
                     }                      }
                 } elsif ($backtourl =~ m{^/adm/wrapper/ext/(?!https:)}) {                  } elsif ($backtourl =~ m{^/adm/wrapper/ext/(?!https:)}) {
                     if (($ENV{'SERVER_PORT'} == 443) && ($hostname ne '')) {                      if (($ENV{'SERVER_PORT'} == 443) && ($hostname ne '')) {
                         unless (&Apache::lonnet::uses_sts()) {                          unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
                             if ($hostname ne '') {                              if ($hostname ne '') {
                                 $backtourl = 'http://'.$hostname.$backtourl;                                  $backtourl = 'http://'.$hostname.$backtourl;
                             }                              }
Line 6896  sub editing_js { Line 6929  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=escape(foldername)+"="+folderseq;         targetform.importdetail.value=encodeURIComponent(foldername)+"="+folderseq;
         targetform.submit();          targetform.submit();
     }      }
 }  }
Line 6904  function makenewfolder(targetform,folder Line 6937  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=escape(pagename)+"="+folderseq;          targetform.importdetail.value=encodeURIComponent(pagename)+"="+folderseq;
         targetform.submit();          targetform.submit();
     }      }
 }  }
Line 6913  function makeexamupload() { Line 6946  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=
  escape(title)+'=/res/lib/templates/examupload.problem';   encodeURIComponent(title)+'=/res/lib/templates/examupload.problem';
     this.document.forms.newexamupload.submit();      this.document.forms.newexamupload.submit();
    }     }
 }  }
Line 6922  function makesmppage() { Line 6955  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=
  escape(title)+'=/adm/$udom/$uname/new/smppg';   encodeURIComponent(title)+'=/adm/$udom/$uname/new/smppg';
     this.document.forms.newsmppg.submit();      this.document.forms.newsmppg.submit();
    }     }
 }  }
Line 6937  function makewebpage(type) { Line 6970  function makewebpage(type) {
    }     }
    if (title) {     if (title) {
        var webpage = formname.importdetail.value;         var webpage = formname.importdetail.value;
        formname.importdetail.value = escape(title)+'='+webpage;         formname.importdetail.value = encodeURIComponent(title)+'='+webpage;
        formname.submit();         formname.submit();
    }     }
 }  }
Line 6946  function makesmpproblem() { Line 6979  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=
  escape(title)+'=/res/lib/templates/simpleproblem.problem';   encodeURIComponent(title)+'=/res/lib/templates/simpleproblem.problem';
     this.document.forms.newsmpproblem.submit();      this.document.forms.newsmpproblem.submit();
    }     }
 }  }
Line 6955  function makedropbox() { Line 6988  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=
         escape(title)+'=/res/lib/templates/DropBox.problem';          encodeURIComponent(title)+'=/res/lib/templates/DropBox.problem';
     this.document.forms.newdropbox.submit();      this.document.forms.newdropbox.submit();
    }     }
 }  }
Line 6964  function makebulboard() { Line 6997  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=
  escape(title)+'=/adm/$udom/$uname/new/bulletinboard';   encodeURIComponent(title)+'=/adm/$udom/$uname/new/bulletinboard';
     this.document.forms.newbul.submit();      this.document.forms.newbul.submit();
    }     }
 }  }

Removed from v.1.484.2.85.2.6  
changed lines
  Added in v.1.484.2.93.2.8


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