Diff for /loncom/interface/loncommon.pm between versions 1.1401 and 1.1402

version 1.1401, 2023/03/11 21:58:18 version 1.1402, 2023/03/27 18:41:04
Line 1851  sub colorfuleditor_js { Line 1851  sub colorfuleditor_js {
                     if (document.getElementById('crsres_include_'+element)) {                      if (document.getElementById('crsres_include_'+element)) {
                         include = document.getElementById('crsres_include_'+element).value;                          include = document.getElementById('crsres_include_'+element).value;
                     }                      }
                     populateCrsSelects(form,dirsel,filesel,1,include,1,0,1,1);                      populateCrsSelects(form,dirsel,filesel,1,include,1,0,1,1,0);
                 }                  }
             }              }
             if (document.getElementById('chooser_'+element+'_upload')) {              if (document.getElementById('chooser_'+element+'_upload')) {
Line 1859  sub colorfuleditor_js { Line 1859  sub colorfuleditor_js {
                 if (currcrsupload == 'none') {                  if (currcrsupload == 'none') {
                     dirsel = 'crsauthorpath_'+element;                      dirsel = 'crsauthorpath_'+element;
                     filesel = '';                      filesel = '';
                     populateCrsSelects(form,dirsel,filesel,0,'',1,0,1,0);                      populateCrsSelects(form,dirsel,filesel,0,'',1,0,1,0,1);
                 }                  }
             }              }
         }          }
Line 1874  sub colorfuleditor_js { Line 1874  sub colorfuleditor_js {
                     if (document.getElementById('coursepath_'+element).length) {                      if (document.getElementById('coursepath_'+element).length) {
                         numdirs = document.getElementById('coursepath_'+element).length;                          numdirs = document.getElementById('coursepath_'+element).length;
                     }                      }
                       if ((document.getElementById('hascrsres_'+element)) &&
                           (document.getElementById('nocrsres_'+element))) {
                           if (numdirs) {
                               document.getElementById('hascrsres_'+element).style.display='inline-block';
                               document.getElementById('nocrsres_'+element).style.display='none';
                           } else {
                               document.getElementById('hascrsres_'+element).style.display='none';
                               document.getElementById('nocrsres_'+element).style.display='inline-block';
                           }
                       }
                     form.elements['coursepath_'+element].selectedIndex = 0;                      form.elements['coursepath_'+element].selectedIndex = 0;
                     if (numdirs > 1) {                      if (numdirs > 1) {
                         var selelem = form.elements['coursefile_'+element];                          var selelem = form.elements['coursefile_'+element];
Line 2266  sub import_crsauthor_form { Line 2276  sub import_crsauthor_form {
     return (0) unless (($cnum ne '') && ($cdom ne ''));      return (0) unless (($cnum ne '') && ($cdom ne ''));
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
     my ($output,$is_home,$toppath,%subdirs,%files,%selimport_menus,$include,$exclude);      my ($output,$is_home,$toppath,%subdirs,%files,%selimport_menus,$include,$exclude);
       
     if (grep(/^\Q$crshome\E$/,@ids)) {      if (grep(/^\Q$crshome\E$/,@ids)) {
         $is_home = 1;          $is_home = 1;
     }      }
Line 2278  sub import_crsauthor_form { Line 2288  sub import_crsauthor_form {
         $js_only = join(',',map { &js_escape($_); } sort(keys(%{$include})));          $js_only = join(',',map { &js_escape($_); } sort(keys(%{$include})));
     }      }
     $exclude = &Apache::lonnet::priv_exclude();      $exclude = &Apache::lonnet::priv_exclude();
     &Apache::lonnet::recursedirs($is_home,1,$include,$exclude,1,$toppath,'',\%subdirs,\%files);      &Apache::lonnet::recursedirs($is_home,1,$include,$exclude,1,0,$toppath,'',\%subdirs,\%files);
     my $numdirs = scalar(keys(%files));      my $numdirs = scalar(keys(%files));
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
         fnam => 'Filename',          fnam => 'Filename',
         dire => 'Directory',          dire => 'Directory',
         se   => 'Select',          se   => 'Select',
     );      );
     $output = $lt{'dire'}.      $output = $lt{'dire'}.': '.
               '<select id="'.$firstselectname.'" name="'.$firstselectname.'" '.                '<select id="'.$firstselectname.'" name="'.$firstselectname.'" '.
               'onchange="populateCrsSelects(this.form,'."'$firstselectname','$secondselectname',1,'$js_only',0,1,0,0".');">'.                'onchange="populateCrsSelects(this.form,'."'$firstselectname','$secondselectname',1,'$js_only',0,1,0,0,0".');">'.
               '<option value="" selected="selected">'.$lt{'se'}.'</option>';                '<option value="" selected="selected">'.$lt{'se'}.'</option>';
       if ($files{'/'}) {
           $output .= '<option value="/">/</option>'."\n";
       }
     foreach my $key (sort { lc($a) cmp lc($b) } (keys(%files))) {      foreach my $key (sort { lc($a) cmp lc($b) } (keys(%files))) {
           next if ($key eq '/');
         $output .= '<option value="'.$key.'">'.$key.'</option>'."\n";          $output .= '<option value="'.$key.'">'.$key.'</option>'."\n";
     }      }
     $output .= '</select><br />'."\n".      $output .= '</select><br />'."\n".
                $lt{'fnam'}.'<select id="'.$secondselectname.'" name="'.$secondselectname.'">'."\n".                 $lt{'fnam'}.':&nbsp;<select id="'.$secondselectname.'" name="'.$secondselectname.'">'."\n".
                '<option value="" selected="selected"></option>'."\n".                 '<option value="" selected="selected"></option>'."\n".
                '</select>'."\n";                 '</select>'."\n".
     $output .= '<input type="hidden" id="crsres_include_'.$suffix.'" value="'.$only.'" />';                 '<input type="hidden" id="crsres_include_'.$suffix.'" value="'.$only.'" />';
     return ($numdirs,$output);      return ($numdirs,$output);
 }  }
   
Line 2310  sub show_crsfiles_js { Line 2324  sub show_crsfiles_js {
     my $js = <<"END";      my $js = <<"END";
   
   
     function populateCrsSelects (form,dirsel,filesel,exc,include,setdir,setfile,recurse,nonemptydir) {      function populateCrsSelects (form,dirsel,filesel,exc,include,setdir,setfile,recurse,nonemptydir,addtopdir) {
         var relpath = '';          var relpath = '';
         if ((setfile) && (dirsel != null) && (dirsel != 'undefined') && (dirsel != '')) {          if ((setfile) && (dirsel != null) && (dirsel != 'undefined') && (dirsel != '')) {
             var currdir = form.elements[dirsel].options[form.elements[dirsel].selectedIndex].value;              var currdir = form.elements[dirsel].options[form.elements[dirsel].selectedIndex].value;
Line 2340  sub show_crsfiles_js { Line 2354  sub show_crsfiles_js {
         if (exc) {          if (exc) {
             exclude = '$exclude';              exclude = '$exclude';
         }          }
         var params = "role=course&files=1&rec="+recurse+"&nonempty="+nonemptydir+"&exc="+exclude+"&inc="+include+"&path="+relpath;          var params = "role=course&files=1&rec="+recurse+"&nonempty="+nonemptydir+"&exc="+exclude+"&inc="+include+"&addtop="+addtopdir+"&path="+relpath;
         http.open("POST", url, true);          http.open("POST", url, true);
         http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");          http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         http.onreadystatechange = function() {          http.onreadystatechange = function() {
Line 2358  sub show_crsfiles_js { Line 2372  sub show_crsfiles_js {
                         }                          }
                         var len = data.dirs.length;                          var len = data.dirs.length;
                         if (len) {                          if (len) {
                             if (len > 1) {                              selelem.options[selelem.options.length] = new Option('$se','');
                                 selelem.options[selelem.options.length] = new Option('$se','');  
                             }  
                         }  
                         if (len) {  
                             var j;                              var j;
                             for (j = 0; j < len; j++) {                              for (j = 0; j < len; j++) {
                                 selelem.options[selelem.options.length] = new Option(data.dirs[j],data.dirs[j]);                                  selelem.options[selelem.options.length] = new Option(data.dirs[j],data.dirs[j]);
Line 18600  sub parse_supplemental_title { Line 18610  sub parse_supplemental_title {
         $name = &HTML::Entities::encode($name,'"<>&\'');          $name = &HTML::Entities::encode($name,'"<>&\'');
         $renametitle = &HTML::Entities::encode($renametitle,'"<>&\'');          $renametitle = &HTML::Entities::encode($renametitle,'"<>&\'');
         $title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.$name;          $title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.$name;
         if ($foldertitle ne '') {           if ($foldertitle ne '') {
             $title .= ': <br />'.$foldertitle;              $title .= ': <br />'.$foldertitle;
         }          }
     }      }

Removed from v.1.1401  
changed lines
  Added in v.1.1402


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