version 1.522, 2016/07/18 19:28:57
|
version 1.531, 2017/07/07 17:04:40
|
Line 995 sub render_resource {
|
Line 995 sub render_resource {
|
$linkopen = ""; |
$linkopen = ""; |
$linkclose = ""; |
$linkclose = ""; |
} |
} |
if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
if (((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('cev',$env{'request.course.id'}))) && |
($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) { |
($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) { |
if (!$params->{'map_no_edit_link'}) { |
if (!$params->{'map_no_edit_link'}) { |
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png'; |
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png'; |
Line 1540 END
|
Line 1541 END
|
$result.='</form>'; |
$result.='</form>'; |
} |
} |
if (($args->{'caller'} eq 'navmapsdisplay') && |
if (($args->{'caller'} eq 'navmapsdisplay') && |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { |
((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('cev',$env{'request.course.id'})))) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
if ($env{'course.'.$env{'request.course.id'}.'.url'} eq |
if ($env{'course.'.$env{'request.course.id'}.'.url'} eq |
Line 1682 END
|
Line 1684 END
|
undef($args->{'sort'}); |
undef($args->{'sort'}); |
} |
} |
|
|
|
# Determine if page will be served with https in case |
|
# it contains a syllabus which uses an external URL |
|
# which points at an http site. |
|
|
|
my ($is_ssl,$cdom,$cnum,$hostname); |
|
if ($ENV{'SERVER_PORT'} == 443) { |
|
$is_ssl = 1; |
|
if ($r) { |
|
$hostname = $r->hostname(); |
|
} else { |
|
$hostname = $ENV{'SERVER_NAME'}; |
|
} |
|
} |
|
if ($env{'request.course.id'}) { |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
} |
|
|
while (1) { |
while (1) { |
if ($args->{'sort'}) { |
if ($args->{'sort'}) { |
Line 1815 END
|
Line 1834 END
|
$stack=$it->getStack(); |
$stack=$it->getStack(); |
} |
} |
($src,$symb,$anchor)=getLinkForResource($stack); |
($src,$symb,$anchor)=getLinkForResource($stack); |
|
my $srcHasQuestion = $src =~ /\?/; |
|
if ($env{'request.course.id'}) { |
|
if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) && |
|
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
|
if ($hostname ne '') { |
|
$src = 'http://'.$hostname.$src; |
|
} |
|
$src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; |
|
$srcHasQuestion = 1; |
|
} elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { |
|
if ($hostname ne '') { |
|
$src = 'http://'.$hostname.$src; |
|
} |
|
} |
|
} |
if (defined($anchor)) { $anchor='#'.$anchor; } |
if (defined($anchor)) { $anchor='#'.$anchor; } |
my $srcHasQuestion = $src =~ /\?/; |
|
$args->{"resourceLink"} = $src. |
$args->{"resourceLink"} = $src. |
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb=' . &escape($symb).$anchor; |
'symb=' . &escape($symb).$anchor; |
Line 2686 sub parmval_real {
|
Line 2719 sub parmval_real {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
last if (defined($$useropt{$norecursechk})); |
if (defined($$useropt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return [$$useropt{$norecursechk},'map']; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
if (defined($$useropt{$recursechk})) { return [$$useropt{$recursechk},'map']; } |
if (defined($$useropt{$recursechk})) { return [$$useropt{$recursechk},'map']; } |
} |
} |
Line 2704 sub parmval_real {
|
Line 2743 sub parmval_real {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return [$$courseopt{$norecursechk},'map']; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { return [$$courseopt{$recursechk},'map']; } |
if (defined($$courseopt{$recursechk})) { return [$$courseopt{$recursechk},'map']; } |
} |
} |
Line 2721 sub parmval_real {
|
Line 2766 sub parmval_real {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return [$$courseopt{$norecursechk},'map']; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { return [$$courseopt{$recursechk},'map']; } |
if (defined($$courseopt{$recursechk})) { return [$$courseopt{$recursechk},'map']; } |
} |
} |
Line 2755 sub parmval_real {
|
Line 2806 sub parmval_real {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return [$$courseopt{$norecursechk},'map']; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { |
if (defined($$courseopt{$recursechk})) { |
return [$$courseopt{$recursechk},'map']; |
return [$$courseopt{$recursechk},'map']; |
Line 2894 sub get_mapparam {
|
Line 2951 sub get_mapparam {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
last if (defined($$useropt{$norecursechk})); |
if (defined($$useropt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return $$useropt{$norecursechk}; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
if (defined($$useropt{$recursechk})) { |
if (defined($$useropt{$recursechk})) { |
return $$useropt{$recursechk}; |
return $$useropt{$recursechk}; |
Line 2919 sub get_mapparam {
|
Line 2982 sub get_mapparam {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return $$courseopt{$norecursechk}; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { |
if (defined($$courseopt{$recursechk})) { |
return $$courseopt{$recursechk}; |
return $$courseopt{$recursechk}; |
Line 2943 sub get_mapparam {
|
Line 3012 sub get_mapparam {
|
} |
} |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return $$courseopt{$norecursechk}; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { |
if (defined($$courseopt{$recursechk})) { |
return $$courseopt{$recursechk}; |
return $$courseopt{$recursechk}; |
Line 2974 sub get_mapparam {
|
Line 3049 sub get_mapparam {
|
if (@recurseup) { |
if (@recurseup) { |
foreach my $item (@recurseup) { |
foreach my $item (@recurseup) { |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
my $norecursechk=$usercourseprefix.'.'.$item.'___(all).'.$what; |
last if (defined($$courseopt{$norecursechk})); |
if (defined($$courseopt{$norecursechk})) { |
|
if ($what =~ /\.(encrypturl|hiddenresource)$/) { |
|
return $$courseopt{$norecursechk}; |
|
} else { |
|
last; |
|
} |
|
} |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what; |
if (defined($$courseopt{$recursechk})) { |
if (defined($$courseopt{$recursechk})) { |
return $$courseopt{$recursechk}; |
return $$courseopt{$recursechk}; |
Line 4152 sub enclosing_map_src {
|
Line 4233 sub enclosing_map_src {
|
} |
} |
sub symb { |
sub symb { |
my $self=shift; |
my $self=shift; |
|
if (defined $self->{SYMB}) { return $self->{SYMB}; } |
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/; |
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/; |
my $symbSrc = &Apache::lonnet::declutter($self->src()); |
my $symbSrc = &Apache::lonnet::declutter($self->src()); |
my $symb = &Apache::lonnet::declutter($self->navHash('map_id_'.$first)) |
my $symb = &Apache::lonnet::declutter($self->navHash('map_id_'.$first)) |
Line 4786 sub getReturnHash {
|
Line 4868 sub getReturnHash {
|
my $self = shift; |
my $self = shift; |
|
|
if (!defined($self->{RETURN_HASH})) { |
if (!defined($self->{RETURN_HASH})) { |
my %tmpHash = &Apache::lonnet::restore($self->{SYMB},undef,$self->{DOMAIN},$self->{USERNAME}); |
#my %tmpHash = &Apache::lonnet::restore($self->{SYMB},undef,$self->{DOMAIN},$self->{USERNAME}); |
$self->{RETURN_HASH} = \%tmpHash; |
#$self->{RETURN_HASH} = \%tmpHash; |
|
# When info is retrieved for several resources (as when rendering a directory), |
|
# it is much faster to use the user profile dump and avoid repeated lonnet requests |
|
# (especially since lonnet::currentdump is using Lond directly whenever possible, |
|
# and lonnet::restore is not at this point). |
|
$self->{NAV_MAP}->get_user_data(); |
|
$self->{RETURN_HASH} = $self->{NAV_MAP}->{STUDENT_DATA}->{$self->{SYMB}}; |
} |
} |
} |
} |
|
|
Line 5018 sub extractParts {
|
Line 5106 sub extractParts {
|
my %parts; |
my %parts; |
|
|
# Retrieve part count, if this is a problem |
# Retrieve part count, if this is a problem |
if ($self->is_problem()) { |
if ($self->is_raw_problem()) { |
my $partorder = &Apache::lonnet::metadata($self->src(), 'partorder'); |
my $partorder = &Apache::lonnet::metadata($self->src(), 'partorder'); |
my $metadata = &Apache::lonnet::metadata($self->src(), 'packages'); |
my $metadata = &Apache::lonnet::metadata($self->src(), 'packages'); |
|
|