--- loncom/interface/loncommon.pm 2023/03/11 21:58:18 1.1401
+++ loncom/interface/loncommon.pm 2023/03/27 18:41:04 1.1402
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1401 2023/03/11 21:58:18 raeburn Exp $
+# $Id: loncommon.pm,v 1.1402 2023/03/27 18:41:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1851,7 +1851,7 @@ sub colorfuleditor_js {
if (document.getElementById('crsres_include_'+element)) {
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')) {
@@ -1859,7 +1859,7 @@ sub colorfuleditor_js {
if (currcrsupload == 'none') {
dirsel = 'crsauthorpath_'+element;
filesel = '';
- populateCrsSelects(form,dirsel,filesel,0,'',1,0,1,0);
+ populateCrsSelects(form,dirsel,filesel,0,'',1,0,1,0,1);
}
}
}
@@ -1874,6 +1874,16 @@ sub colorfuleditor_js {
if (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;
if (numdirs > 1) {
var selelem = form.elements['coursefile_'+element];
@@ -2266,7 +2276,7 @@ sub import_crsauthor_form {
return (0) unless (($cnum ne '') && ($cdom ne ''));
my @ids=&Apache::lonnet::current_machine_ids();
my ($output,$is_home,$toppath,%subdirs,%files,%selimport_menus,$include,$exclude);
-
+
if (grep(/^\Q$crshome\E$/,@ids)) {
$is_home = 1;
}
@@ -2278,25 +2288,29 @@ sub import_crsauthor_form {
$js_only = join(',',map { &js_escape($_); } sort(keys(%{$include})));
}
$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 %lt = &Apache::lonlocal::texthash (
fnam => 'Filename',
dire => 'Directory',
se => 'Select',
);
- $output = $lt{'dire'}.
+ $output = $lt{'dire'}.': '.
'
'."\n".
- $lt{'fnam'}.''."\n".
+ '';
return ($numdirs,$output);
}
@@ -2310,7 +2324,7 @@ sub show_crsfiles_js {
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 = '';
if ((setfile) && (dirsel != null) && (dirsel != 'undefined') && (dirsel != '')) {
var currdir = form.elements[dirsel].options[form.elements[dirsel].selectedIndex].value;
@@ -2340,7 +2354,7 @@ sub show_crsfiles_js {
if (exc) {
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.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() {
@@ -2358,11 +2372,7 @@ sub show_crsfiles_js {
}
var len = data.dirs.length;
if (len) {
- if (len > 1) {
- selelem.options[selelem.options.length] = new Option('$se','');
- }
- }
- if (len) {
+ selelem.options[selelem.options.length] = new Option('$se','');
var j;
for (j = 0; j < len; j++) {
selelem.options[selelem.options.length] = new Option(data.dirs[j],data.dirs[j]);
@@ -18600,7 +18610,7 @@ sub parse_supplemental_title {
$name = &HTML::Entities::encode($name,'"<>&\'');
$renametitle = &HTML::Entities::encode($renametitle,'"<>&\'');
$title=''.&Apache::lonlocal::locallocaltime($time).' '.$name;
- if ($foldertitle ne '') {
+ if ($foldertitle ne '') {
$title .= ':
'.$foldertitle;
}
}