--- loncom/interface/londocs.pm 2022/12/31 14:08:59 1.690
+++ loncom/interface/londocs.pm 2023/03/23 16:45:50 1.696
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.690 2022/12/31 14:08:59 raeburn Exp $
+# $Id: londocs.pm,v 1.696 2023/03/23 16:45:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1207,7 +1207,13 @@ 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{/([^/]+)$});
+ } elsif ($is_supp) {
+ $title = &Apache::loncommon::parse_supplemental_title($title);
+ }
+ $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 +3115,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;
@@ -4294,7 +4300,7 @@ END
$nomodal = 1;
}
}
- my ($checkencrypt,$shownurl);
+ my $checkencrypt;
if (!$env{'request.role.adv'}) {
if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||
($isencrypted) || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {
@@ -4314,7 +4320,7 @@ END
my $currenc = $env{'request.enc'};
$env{'request.enc'} = 1;
$shownsymb = &Apache::lonenc::encrypted($symb);
- $shownurl = &Apache::lonenc::encrypted($url);
+ my $shownurl = &Apache::lonenc::encrypted($url);
if (&Apache::lonnet::symbverify($symb,$url)) {
$url = $shownurl;
} else {
@@ -4329,7 +4335,8 @@ END
$url = &Apache::lonnet::clutter($url);
}
}
- $shownurl = $url;
+ } else {
+ $url = '';
}
unless ($env{'request.role.adv'}) {
if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
@@ -4340,8 +4347,8 @@ END
$hiddenres = 1;
}
}
- if ($url ne '') {
- $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
+ if (($url ne '') && ($shownsymb ne '')) {
+ $url .= (($url=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
}
}
} elsif ($supplementalflag) {
@@ -4646,7 +4653,7 @@ $form_end;
my ($enctext,$hidtext,$formhidden,$formurlhidden);
if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
$hidtext = ' checked="checked"';
- if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) {
+ if (($ishash) && (ref($filtersref->{'hiddenresource'}) eq 'ARRAY')) {
push(@{$filtersref->{'hiddenresource'}},$orderidx);
}
}
@@ -6532,165 +6539,62 @@ NROSTFORM
NWEBFORM
my @ids=&Apache::lonnet::current_machine_ids();
- my (%select_menus,$rolehomes);
- my $numauthor = 0;
- my $numcrsdirs = 0;
- my ($showstdprob,$showswitch,$switchlink);
- my $toppath = "/priv/$env{'user.domain'}/$env{'user.name'}";
- my $exclude = &Apache::lonnet::priv_exclude();
+ my $machines_str = "'".join("','",@ids)."'";
+ my (%is_home,%toppath,$rolehomes);
if ($env{'user.author'}) {
- $numauthor ++;
- $select_menus{'author'}->{'text'} = &Apache::lonnet::plaintext('au');
if (grep(/^\Q$env{'user.home'}\E$/,@ids)) {
- my $is_home = 1;
- my %subdirs;
- &Apache::lonnet::recursedirs($is_home,1,'',$exclude,0,$toppath,'',\%subdirs);
- $select_menus{'author'}->{'default'} = '/';
- my @ordered = ();
- foreach my $relpath (sort { lc($a) cmp lc($b) } (keys(%subdirs))) {
- $select_menus{'author'}->{'select2'}->{$relpath} = $relpath;
- push(@ordered,$relpath);
- }
- $select_menus{'author'}->{'order'} = \@ordered;
- $showstdprob = 'block';
- } else {
- $rolehomes = ''."\n";
- $select_menus{'author'}->{'select2'}->{'switch'} = &mt('Switch server required');
- $select_menus{'author'}->{'default'} = 'switch';
- $select_menus{'author'}->{'order'} = ['switch'];
- $showstdprob = 'none';
+ $is_home{'author'} = 1;
}
+ $rolehomes = ''."\n";
}
my %roleshash = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},'userroles',
['active'],['ca','aa']);
- my $crshome = $env{'course.'.$env{'request.course.id'}.'.home'};
- my (%by_roletype,%at_home);
+ my %by_roletype;
if (keys(%roleshash)) {
foreach my $entry (keys(%roleshash)) {
my ($auname,$audom,$roletype) = split(/:/,$entry);
my $key = $entry;
$key =~ s/:/___/g;
- $by_roletype{$roletype}{$auname.'___'.$audom} = 1;
- $select_menus{$key}->{'text'} = &Apache::lonnet::plaintext($roletype)." ($audom/$auname)";
+ my $author = $auname.'___'.$audom;
+ $by_roletype{$roletype}{$author} = 1;
my $rolehome = &Apache::lonnet::homeserver($auname,$audom);
- if (grep(/^\Q$rolehome\E$/,@ids)) {
- $at_home{$auname.'___'.$audom} = 1;
- my $is_home = 1;
- my (%subdirs,@ordered);
- my $toppath="/priv/$audom/$auname";
- &Apache::lonnet::recursedirs($is_home,1,'',$exclude,0,$toppath,'',\%subdirs);
- $select_menus{$key}->{'default'} = '/';
- foreach my $relpath (sort { lc($a) cmp lc($b) } (keys(%subdirs))) {
- $select_menus{$key}->{'select2'}->{$relpath} = $relpath;
- push(@ordered,$relpath);
- }
- $select_menus{$key}->{'order'} = \@ordered;
- } else {
- $rolehomes .= ''."\n";
- $select_menus{$key}->{'select2'}->{'switch'} = &mt('Switch server required');
- $select_menus{$key}->{'default'} = 'switch';
- $select_menus{$key}->{'order'} = ['switch'];
- }
- $numauthor ++;
- }
- }
- my ($pickdir,$showtitle);
- if ($numauthor) {
- my @order;
- my $defrole;
- if ($env{'user.author'}) {
- push(@order,'author');
- $defrole = 'author';
- }
- if (keys(%by_roletype)) {
- foreach my $possrole ('ca','aa') {
- if (ref($by_roletype{$possrole}) eq 'HASH') {
- foreach my $author (sort { lc($a) cmp lc($b) } (keys(%{$by_roletype{$possrole}}))) {
- unless ($defrole) {
- $defrole = $author;
- if ($at_home{$author}) {
- $showstdprob = 'block';
- } else {
- $showstdprob = 'none';
- }
- }
- push(@order,$author.'___'.$possrole);
- }
- }
+ $toppath{$author} = "/priv/$audom/$auname";
+ if (grep(/^\Q$rolehome\E$/,@ids)) {
+ $is_home{$author} = 1;
}
+ $rolehomes .= ''."\n";
}
- $select_menus{'course'}->{'text'} = &mt('Course Resource');
- if (grep(/^\Q$crshome\E$/,@ids)) {
- my $is_home = 1;
- my %subdirs;
- my $toppath="/priv/$coursedom/$coursenum";
- &Apache::lonnet::recursedirs($is_home,1,'',$exclude,0,$toppath,'',\%subdirs);
- $numcrsdirs = keys(%subdirs);
- $select_menus{'course'}->{'default'} = '/';
- my @ordered = ();
- foreach my $relpath (sort { lc($a) cmp lc($b) } (keys(%subdirs))) {
- $select_menus{'course'}->{'select2'}->{$relpath} = $relpath;
- push(@ordered,$relpath);
- }
- $select_menus{'course'}->{'order'} = \@ordered;
- } else {
- $rolehomes .= ''."\n";
- $select_menus{'course'}->{'select2'}->{'switch'} = &mt('Switch server required');
- $select_menus{'course'}->{'default'} = 'switch';
- $select_menus{'course'}->{'order'} = ['switch'];
- }
- push(@order,'course');
- $pickdir = $lt{'loca'}.
- &Apache::loncommon::linked_select_forms('courseresform','
'.$lt{'dire'},
- $defrole,'authorrole','authorpath',
- \%select_menus,\@order,'toggleCrsResTitle();',
- '','priv').'
';
- $showtitle = 'none';
- } else {
- my $is_home;
- $showtitle = 'inline';
- if (grep(/^\Q$crshome\E$/,@ids)) {
- $is_home = 1;
- $showstdprob = 'block';
- $pickdir .= '';
- my $toppath="/priv/$coursedom/$coursenum'}";
- my %subdirs;
- &Apache::lonnet::recursedirs($is_home,1,'',$exclude,0,$toppath,'',\%subdirs);
- $numcrsdirs = keys(%subdirs);
- if ($numcrsdirs) {
- $pickdir .= $lt{'dire'}.'
'."\n".
+ $lt{'dire'}.
+ ''.
+ ''.
+ '
'."\n";
my %seltemplate_menus;
my @files = &Apache::lonhomework::get_template_list('problem');
@@ -6733,7 +6637,7 @@ NWEBFORM
my $templatepreview = ''.
''.&mt('Example').'';
my $crsresform=(<