version 1.542, 2018/04/14 17:52:43
|
version 1.547, 2019/01/16 21:49:39
|
Line 963 sub render_resource {
|
Line 963 sub render_resource {
|
$newBranchText = "<img src='$location/branch.gif' alt=".mt('Branch')." />"; |
$newBranchText = "<img src='$location/branch.gif' alt=".mt('Branch')." />"; |
} |
} |
|
|
# links to open and close the folder |
|
|
|
my $whitespace = $location.'/whitespace_21.gif'; |
my $whitespace = $location.'/whitespace_21.gif'; |
my $linkopen = "<img src='$whitespace' alt='' />"; |
my ($nomodal,$linkopen,$linkclose); |
my $nomodal; |
unless ($resource->is_map() || $params->{'resource_nolink'}) { |
if (($params->{'modalLink'}) && (!$resource->is_sequence())) { |
$linkopen = "<img src='$whitespace' alt='' />"; |
if ($link =~m{^(?:|/adm/wrapper)/ext/([^#]+)}) { |
$linkclose = "</a>"; |
my $exturl = $1; |
if (($params->{'modalLink'}) && (!$resource->is_sequence())) { |
if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) { |
if ($link =~m{^(?:|/adm/wrapper)/ext/([^#]+)}) { |
|
my $exturl = $1; |
|
if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) { |
|
$nomodal = 1; |
|
} |
|
} elsif (($link eq "/public/$LONCAPA::match_domain/$LONCAPA::match_courseid/syllabus") && |
|
($env{'request.course.id'}) && ($ENV{'SERVER_PORT'} == 443) && |
|
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
$nomodal = 1; |
$nomodal = 1; |
} |
} |
} elsif (($link eq "/public/$LONCAPA::match_domain/$LONCAPA::match_courseid/syllabus") && |
my $esclink = &js_escape($link); |
($env{'request.course.id'}) && ($ENV{'SERVER_PORT'} == 443) && |
if ($nomodal) { |
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
$linkopen .= "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />"; |
$nomodal = 1; |
} else { |
} |
$linkopen .= "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">"; |
my $esclink = &js_escape($link); |
} |
if ($nomodal) { |
|
$linkopen .= "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />"; |
|
} else { |
} else { |
$linkopen .= "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">"; |
$linkopen .= "<a href=\"$link\">"; |
} |
} |
} else { |
|
$linkopen .= "<a href=\"$link\">"; |
|
} |
} |
my $linkclose = "</a>"; |
|
|
|
# Default icon: unknown page |
# Default icon: unknown page |
my $icon = "<img class=\"LC_contentImage\" src='$location/unknown.gif' alt='' />"; |
my $icon = "<img class=\"LC_contentImage\" src='$location/unknown.gif' alt='' />"; |
Line 1036 sub render_resource {
|
Line 1036 sub render_resource {
|
'&jump=' . |
'&jump=' . |
&escape($resource->symb()) . |
&escape($resource->symb()) . |
"&folderManip=1\">"; |
"&folderManip=1\">"; |
|
$linkclose = '</a>'; |
} else { |
} else { |
# Don't allow users to manipulate folder |
# Don't allow users to manipulate folder |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif'; |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif'; |
$icon = "<img class=\"LC_space\" src='$whitespace' alt='' />"."<img class=\"LC_contentImage\" src='$location/$icon' alt=\"".($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" />"; |
$icon = "<img class=\"LC_space\" src='$whitespace' alt='' />"."<img class=\"LC_contentImage\" src='$location/$icon' alt=\"".($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" />"; |
if ($params->{'caller'} eq 'sequence') { |
if ($params->{'caller'} eq 'sequence') { |
$linkopen = "<a href=\"$link\">"; |
$linkopen = "<a href=\"$link\">"; |
|
$linkclose = '</a>'; |
} else { |
} else { |
$linkopen = ""; |
$linkopen = ""; |
$linkclose = ""; |
$linkclose = ""; |
Line 1061 sub render_resource {
|
Line 1062 sub render_resource {
|
} |
} |
if ($params->{'mapHidden'} || $resource->randomout()) { |
if ($params->{'mapHidden'} || $resource->randomout()) { |
$nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> '; |
$nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> '; |
|
} elsif ($params->{'mapUnlisted'}) { |
|
$nonLinkedText .= ' <span class="LC_warning">('.&mt('unlisted').')</span> '; |
} |
} |
} else { |
} else { |
if ($resource->randomout()) { |
if ($resource->randomout()) { |
$nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> '; |
$nonLinkedText .= ' <span class="LC_warning">('.&mt('hidden').')</span> '; |
|
} elsif (($resource->deeplink($params->{caller}) eq 'absent') || |
|
($resource->deeplink($params->{caller}) eq 'grades')) { |
|
$nonLinkedText .= ' <span class="LC_warning">('.&mt('unlisted').')</span> '; |
} |
} |
} |
} |
if (!$resource->condval()) { |
if (!$resource->condval()) { |
Line 1388 sub render {
|
Line 1394 sub render {
|
# Without renaming the filterfunc, the server seems to go into |
# Without renaming the filterfunc, the server seems to go into |
# an infinite loop |
# an infinite loop |
my $oldFilterFunc = $filterFunc; |
my $oldFilterFunc = $filterFunc; |
$filterFunc = sub { my $res = shift; return !$res->randomout() && |
$filterFunc = sub { my $res = shift; return !$res->randomout() && |
|
($res->deeplink($args->{'caller'}) ne 'absent') && |
|
($res->deeplink($args->{'caller'}) ne 'grades') && |
&$oldFilterFunc($res);}; |
&$oldFilterFunc($res);}; |
} |
} |
|
|
Line 1482 sub render {
|
Line 1490 sub render {
|
if ($args->{'iterator_map'}) { |
if ($args->{'iterator_map'}) { |
my $map = $args->{'iterator_map'}; |
my $map = $args->{'iterator_map'}; |
$map = $navmap->getResourceByUrl($map); |
$map = $navmap->getResourceByUrl($map); |
my $firstResource = $map->map_start(); |
if (ref($map)) { |
my $finishResource = $map->map_finish(); |
my $firstResource = $map->map_start(); |
|
my $finishResource = $map->map_finish(); |
$args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition); |
$args->{'iterator'} = $it = $navmap->getIterator($firstResource, $finishResource, $filterHash, $condition); |
|
} else { |
|
return; |
|
} |
} else { |
} else { |
$args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition,undef,$args->{'include_top_level_map'}); |
$args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition,undef,$args->{'include_top_level_map'}); |
} |
} |
Line 1805 END
|
Line 1816 END
|
|
|
# If this is an empty sequence and we're filtering them, continue on |
# If this is an empty sequence and we're filtering them, continue on |
$args->{'mapHidden'} = 0; |
$args->{'mapHidden'} = 0; |
|
$args->{'mapUnlisted'} = 0; |
if (($curRes->is_map()) && (!$curRes->{DATA}->{HAS_VISIBLE_CHILDREN})) { |
if (($curRes->is_map()) && (!$curRes->{DATA}->{HAS_VISIBLE_CHILDREN})) { |
if ($args->{'suppressEmptySequences'}) { |
if ($args->{'suppressEmptySequences'}) { |
next; |
next; |
Line 1817 END
|
Line 1829 END
|
} else { |
} else { |
next; |
next; |
} |
} |
|
} else { |
|
my $deeplink = $navmap->get_mapparam(undef,$mapname,"0.deeplink"); |
|
if ($deeplink =~ /^(absent|grades),/) { |
|
if ($userCanSeeHidden) { |
|
$args->{'mapUnlisted'} = 1; |
|
} else { |
|
next; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 1879 END
|
Line 1900 END
|
$args->{'condensed'} = 1; |
$args->{'condensed'} = 1; |
} |
} |
} |
} |
} |
} |
|
# If deep-link parameter is set (and is not set to full) suppress link |
|
# unless privileged user, or calling context is sequence, and parameter |
|
# set at map level |
|
if ((!$curRes->deeplink($args->{'caller'})) || |
|
($curRes->deeplink($args->{'caller'}) =~ /^full,/) || &advancedUser()) { |
|
$args->{'resource_nolink'} = 0; |
|
} else { |
|
$args->{'resource_nolink'} = 1; |
|
} |
|
|
# If the multipart problem was condensed, "forget" it was multipart |
# If the multipart problem was condensed, "forget" it was multipart |
if (scalar(@parts) == 1) { |
if (scalar(@parts) == 1) { |
$args->{'multipart'} = 0; |
$args->{'multipart'} = 0; |
Line 1906 END
|
Line 1936 END
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) && |
if (($is_ssl) && ($src =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) && |
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) { |
if ($hostname ne '') { |
unless (&Apache::lonnet::uses_sts()) { |
$src = 'http://'.$hostname.$src; |
if ($hostname ne '') { |
|
$src = 'http://'.$hostname.$src; |
|
} |
|
$src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; |
|
$srcHasQuestion = 1; |
} |
} |
$src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; |
|
$srcHasQuestion = 1; |
|
} elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { |
} elsif (($is_ssl) && ($src =~ m{^\Q/adm/wrapper/ext/\E(?!https:)})) { |
if ($hostname ne '') { |
unless (&Apache::lonnet::uses_sts()) { |
$src = 'http://'.$hostname.$src; |
if ($hostname ne '') { |
|
$src = 'http://'.$hostname.$src; |
|
} |
|
$src .= ($srcHasQuestion? '&' : '?') . 'usehttp=1'; |
|
$srcHasQuestion = 1; |
} |
} |
} |
} |
} |
} |
Line 2958 sub recursed_crumbs {
|
Line 2994 sub recursed_crumbs {
|
my $pc = $map->map_pc(); |
my $pc = $map->map_pc(); |
next if ((!$pc) || ($pc == 1)); |
next if ((!$pc) || ($pc == 1)); |
push(@links,$map); |
push(@links,$map); |
push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); |
push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $map->title(),'no_mt' => 1,}); |
$totallength += length($map->title()); |
$totallength += length($map->title()); |
} |
} |
my $numlinks = scalar(@links); |
my $numlinks = scalar(@links); |
Line 2973 sub recursed_crumbs {
|
Line 3009 sub recursed_crumbs {
|
foreach my $map (@links) { |
foreach my $map (@links) { |
my $showntitle = &truncate_crumb_text($map->title(),$avg); |
my $showntitle = &truncate_crumb_text($map->title(),$avg); |
if ($showntitle ne '') { |
if ($showntitle ne '') { |
push(@revmapinfo,{'href' => $map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,}); |
push(@revmapinfo,{'href' => $env{'request.use_absolute'}.$map->link().'?navmap=1','text' => $showntitle,'no_mt' => 1,}); |
} |
} |
} |
} |
} |
} |
Line 4692 sub is_task {
|
Line 4728 sub is_task {
|
|
|
sub is_empty_sequence { |
sub is_empty_sequence { |
my $self=shift; |
my $self=shift; |
my $src = $self->src(); |
|
return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc()); |
return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc()); |
} |
} |
|
|
Line 5112 sub slot_control {
|
Line 5147 sub slot_control {
|
my $available = $self->parmval("available", $part); |
my $available = $self->parmval("available", $part); |
return ($useslots,$availablestudent,$available); |
return ($useslots,$availablestudent,$available); |
} |
} |
|
sub deeplink { |
|
my ($self,$caller) = @_; |
|
my $value = $self->parmval("deeplink"); |
|
if ($value) { |
|
my @deeplink = split(/,/,$value); |
|
if ($caller eq 'sequence') { |
|
if ($deeplink[1] ne 'res') { |
|
return; |
|
} |
|
} |
|
return $deeplink[0]; |
|
} |
|
return; |
|
} |
|
|
# Multiple things need this |
# Multiple things need this |
sub getReturnHash { |
sub getReturnHash { |