--- loncom/interface/londocs.pm 2022/10/27 21:35:30 1.686
+++ loncom/interface/londocs.pm 2023/01/19 16:43:49 1.693
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.686 2022/10/27 21:35:30 raeburn Exp $
+# $Id: londocs.pm,v 1.693 2023/01/19 16:43:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -205,7 +205,7 @@ sub validate_supppath {
$backto .= '&'.$items[$i];
my $is_hidden;
unless ($got_supp) {
- my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom);
+ my ($supplemental) = &Apache::loncommon::get_supplemental($coursenum,$coursedom);
if (ref($supplemental) eq 'HASH') {
if (ref($supplemental->{'hidden'}) eq 'HASH') {
%supphidden = %{$supplemental->{'hidden'}};
@@ -1207,7 +1207,11 @@ sub docs_change_log {
}
$r->print('');
if ($docslog{$id}{'logentry'}{'parameter_res'}) {
- $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':
');
+ my ($title,$url) = split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'},3);
+ if ($title eq '') {
+ ($title) = ($url =~ m{/([^/]+)$});
+ }
+ $r->print(&LONCAPA::map::qtescape($title).':');
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder','gradable') {
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {
# FIXME: internationalization seems wrong here
@@ -3109,7 +3113,7 @@ sub update_parameter {
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
$name=&LONCAPA::map::qtescape($name);
$url=&LONCAPA::map::qtescape($url);
- next unless ($name && $url);
+ next unless $url;
my $is_map;
if ($url =~ m{/uploaded/.+\.(page|sequence)$}) {
$is_map = 1;
@@ -3562,7 +3566,7 @@ sub editor {
}
if ((!$allowed) && ($folder =~ /^supplemental_\d+$/)) {
- my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom);
+ my ($supplemental) = &Apache::loncommon::get_supplemental($coursenum,$coursedom);
if (ref($supplemental) eq 'HASH') {
if ((ref($supplemental->{'hidden'}) eq 'HASH') &&
(ref($supplemental->{'ids'}) eq 'HASH')) {
@@ -3992,11 +3996,13 @@ sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
$crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
$ltitoolsref,$canedit,$isencrypted,$ishidden,$navmapref,$hostname)=@_;
- my ($foldertitle,$renametitle,$oldtitle);
+ my ($foldertitle,$renametitle,$oldtitle,$encodedtitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
+ $encodedtitle=$title;
} else {
$title=&HTML::Entities::encode($title,'"<>&\'');
+ $encodedtitle=$title;
$renametitle=$title;
$foldertitle=$title;
}
@@ -4483,7 +4489,7 @@ $form_end;
$url .= ($url =~ /\?/) ? '&':'?';
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');
if ($title) {
- $url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"');
+ $url .= '&title='.$encodedtitle;
}
if ((($isexternal) || ($isexttool)) && $orderidx) {
$url .= '&idx='.$orderidx;
@@ -5784,7 +5790,7 @@ sub handler {
}
# If allowed and user's role is not advanced check folderpath is not hidden
my $hidden_and_empty;
- if (($allowed) && (!$env{'request.role.adv'}) && ($env{'form.folderpath'} ne '')) {
+ if (($allowed) && (!$env{'request.role.adv'}) && ($env{'form.folderpath'} ne '')) {
my ($folderurl,$foldername,$hiddenfolder);
my @pathitems = split(/\&/,$env{'form.folderpath'});
my $folder = $pathitems[-2];
@@ -5800,7 +5806,7 @@ sub handler {
if ($supplementalflag) {
($foldername,$hiddenfolder) = ($pathitems[-1] =~ /^([^:]*)::(|1):::$/);
$foldername = &HTML::Entities::decode(&unescape($foldername));
- my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom);
+ my ($supplemental) = &Apache::loncommon::get_supplemental($coursenum,$coursedom);
if (ref($supplemental) eq 'HASH') {
my ($suppmap,$suppmapnum);
if ($folder eq 'supplemental') {
@@ -5989,7 +5995,8 @@ sub handler {
if ($showdoc) {
my $args;
if ($supplementalflag) {
- my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$env{'form.title'},1);
+ my $title = &HTML::Entities::encode($env{'form.title'},'\'"<>&');
+ my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
$args = {'bread_crumbs' => $brcrum};
} else {
$args = {'force_register' => $showdoc};
@@ -6132,6 +6139,7 @@ sub handler {
'stpr' => 'Standard Problem',
'news' => 'New sub-directory',
'crpr' => 'Create Problem',
+ 'swit' => 'Switch Server',
'drbx' => 'Drop Box',
'scuf' => 'External Scores (handgrade, upload, clicker)',
'bull' => 'Discussion Board',
@@ -6290,12 +6298,12 @@ FUFORM
SEDFFORM
my $importcrsresform;
my ($numdirs,$pickfile) =
- &Apache::loncommon::import_crsauthor_form('crsresimportform','coursepath','coursefile',
+ &Apache::loncommon::import_crsauthor_form('coursepath','coursefile',
"resize_scrollbox('contentscroll','1','0');",
undef,'res');
if ($pickfile) {
$importcrsresform=(<