version 1.301, 2004/10/27 18:15:31
|
version 1.308, 2004/12/12 21:06:36
|
Line 33 use strict;
|
Line 33 use strict;
|
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonmenu(); |
use Apache::lonmenu(); |
|
use Apache::lonenc(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
use POSIX qw (floor strftime); |
use POSIX qw (floor strftime); |
use Data::Dumper; # for debugging, not always |
use Data::Dumper; # for debugging, not always |
|
|
Line 119 window.status='Done.';
|
Line 121 window.status='Done.';
|
ENDCLOSE |
ENDCLOSE |
} |
} |
|
|
sub nav_control_js { |
|
my $nav=($ENV{'environment.remotenavmap'} eq 'on'); |
|
return (<<NAVCONTROL); |
|
var w_loncapanav_flag="$nav"; |
|
|
|
|
|
function gonav(url) { |
|
if (w_loncapanav_flag != 1) { |
|
gopost(url,''); |
|
} else { |
|
navwindow=window.open(url, |
|
"loncapanav","height=600,width=400,scrollbars=1"); |
|
} |
|
} |
|
NAVCONTROL |
|
} |
|
|
|
sub update { |
sub update { |
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
if (!$ENV{'request.course.id'}) { return ''; } |
if (!$ENV{'request.course.id'}) { return ''; } |
Line 392 ENDSUBM
|
Line 377 ENDSUBM
|
<option value=\"default\" $selected{'default'}>".&mt('Default')."</option> |
<option value=\"default\" $selected{'default'}>".&mt('Default')."</option> |
<option value=\"title\" $selected{'title'} >".&mt('Title')."</option> |
<option value=\"title\" $selected{'title'} >".&mt('Title')."</option> |
<option value=\"duedate\" $selected{'duedate'}>".&mt('Duedate')."</option> |
<option value=\"duedate\" $selected{'duedate'}>".&mt('Duedate')."</option> |
<option value=\"discussion\" $selected{'discussion'}>".&mt('Has Discussion')."</option> |
<option value=\"discussion\" $selected{'discussion'}>".&mt('Has New Discussion')."</option> |
</select> |
</select> |
</nobr> |
</nobr> |
</form>"); |
</form>"); |
Line 450 sub removeFromFilter {
|
Line 435 sub removeFromFilter {
|
|
|
# Convenience function: Given a stack returned from getStack on the iterator, |
# Convenience function: Given a stack returned from getStack on the iterator, |
# return the correct src() value. |
# return the correct src() value. |
# Later, this should add an anchor when we start putting anchors in pages. |
|
sub getLinkForResource { |
sub getLinkForResource { |
my $stack = shift; |
my $stack = shift; |
my $res; |
my $res; |
Line 458 sub getLinkForResource {
|
Line 442 sub getLinkForResource {
|
# Check to see if there are any pages in the stack |
# Check to see if there are any pages in the stack |
foreach $res (@$stack) { |
foreach $res (@$stack) { |
if (defined($res)) { |
if (defined($res)) { |
|
my $anchor; |
if ($res->is_page()) { |
if ($res->is_page()) { |
return $res->src(); |
foreach (@$stack) { if (defined($_)) { $anchor = $_; } } |
|
$anchor=&Apache::lonnet::escape($anchor->shown_symb()); |
|
return ($res->link(),$res->shown_symb(),$anchor); |
} |
} |
# in case folder was skipped over as "only sequence" |
# in case folder was skipped over as "only sequence" |
my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); |
my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); |
if ($map=~/\.page$/) { |
if ($map=~/\.page$/) { |
return &Apache::lonnet::clutter($map).'#'. |
my $url=&Apache::lonnet::clutter($map); |
&Apache::lonnet::escape(&Apache::lonnet::declutter($src)); |
$anchor=&Apache::lonnet::escape($src->shown_symb()); |
|
return ($url,$res->shown_symb(),$anchor); |
} |
} |
} |
} |
} |
} |
Line 478 sub getLinkForResource {
|
Line 466 sub getLinkForResource {
|
if (defined($_)) { $res = $_; } |
if (defined($_)) { $res = $_; } |
} |
} |
|
|
return $res->src(); |
return ($res->link(),$res->shown_symb()); |
} |
} |
|
|
# Convenience function: This separates the logic of how to create |
# Convenience function: This separates the logic of how to create |
Line 1026 sub render_resource {
|
Line 1014 sub render_resource {
|
my $nonLinkedText = ''; # stuff after resource title not in link |
my $nonLinkedText = ''; # stuff after resource title not in link |
|
|
my $link = $params->{"resourceLink"}; |
my $link = $params->{"resourceLink"}; |
|
|
|
# The URL part is not escaped at this point, but the symb is... |
|
# The stuff to the left of the ? must have ' replaced by \' since |
|
# it will be quoted with ' in the href. |
|
|
|
my ($left,$right) = split(/\?/, $link); |
|
$left =~ s/'/\\'/g; |
|
$link = $left.'?'.$right; |
|
|
my $src = $resource->src(); |
my $src = $resource->src(); |
my $it = $params->{"iterator"}; |
my $it = $params->{"iterator"}; |
my $filter = $it->{FILTER}; |
my $filter = $it->{FILTER}; |
Line 1041 sub render_resource {
|
Line 1038 sub render_resource {
|
} |
} |
|
|
# links to open and close the folder |
# links to open and close the folder |
|
|
|
|
my $linkopen = "<a href='$link'>"; |
my $linkopen = "<a href='$link'>"; |
|
|
|
|
my $linkclose = "</a>"; |
my $linkclose = "</a>"; |
|
|
# Default icon: unknown page |
# Default icon: unknown page |
Line 1082 sub render_resource {
|
Line 1083 sub render_resource {
|
'&jump=' . |
'&jump=' . |
&Apache::lonnet::escape($resource->symb()) . |
&Apache::lonnet::escape($resource->symb()) . |
"&folderManip=1'>"; |
"&folderManip=1'>"; |
|
|
} else { |
} else { |
# Don't allow users to manipulate folder |
# Don't allow users to manipulate folder |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . |
Line 1109 sub render_resource {
|
Line 1111 sub render_resource {
|
} |
} |
|
|
# Decide what to display |
# Decide what to display |
|
|
$result .= "$newBranchText$linkopen$icon$linkclose"; |
$result .= "$newBranchText$linkopen$icon$linkclose"; |
|
|
my $curMarkerBegin = ''; |
my $curMarkerBegin = ''; |
Line 1417 sub render {
|
Line 1420 sub render {
|
# Determine where the "here" marker is and where the screen jumps to. |
# Determine where the "here" marker is and where the screen jumps to. |
|
|
if ($ENV{'form.postsymb'}) { |
if ($ENV{'form.postsymb'}) { |
$here = $jump = $ENV{'form.postsymb'}; |
$here = $jump = &Apache::lonnet::symbclean($ENV{'form.postsymb'}); |
} elsif ($ENV{'form.postdata'}) { |
} elsif ($ENV{'form.postdata'}) { |
# couldn't find a symb, is there a URL? |
# couldn't find a symb, is there a URL? |
my $currenturl = $ENV{'form.postdata'}; |
my $currenturl = $ENV{'form.postdata'}; |
Line 1857 END
|
Line 1860 END
|
|
|
# Set up some data about the parts that the cols might want |
# Set up some data about the parts that the cols might want |
my $filter = $it->{FILTER}; |
my $filter = $it->{FILTER}; |
my $src; |
my ($src,$symb,$anchor); |
if ($args->{'sort'}) { |
if ($args->{'sort'}) { |
$src = $curRes->src(); # FIXME this is wrong for .pages |
$src = $curRes->src(); # FIXME this is wrong for .pages |
|
$symb = $curRes->symb(); # FIXME this is wrong for .pages |
} else { |
} else { |
my $stack = $it->getStack(); |
my $stack = $it->getStack(); |
$src=getLinkForResource($stack); |
($src,$symb,$anchor)=getLinkForResource($stack); |
} |
|
my $anchor=''; |
|
if ($src=~s/(\#.*)$//) { |
|
$anchor=$1; |
|
} |
} |
|
if (defined($anchor)) { $anchor='#'.$anchor; } |
my $srcHasQuestion = $src =~ /\?/; |
my $srcHasQuestion = $src =~ /\?/; |
$args->{"resourceLink"} = $src. |
$args->{"resourceLink"} = $src. |
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb=' . &Apache::lonnet::escape($curRes->symb()). |
'symb=' . &Apache::lonnet::escape($symb).$anchor; |
$anchor; |
|
|
|
# Now, display each column. |
# Now, display each column. |
foreach my $col (@$cols) { |
foreach my $col (@$cols) { |
Line 3463 Returns the title of the resource.
|
Line 3463 Returns the title of the resource.
|
# These info functions can be used directly, as they don't return |
# These info functions can be used directly, as they don't return |
# resource information. |
# resource information. |
sub comesfrom { my $self=shift; return $self->navHash("comesfrom_", 1); } |
sub comesfrom { my $self=shift; return $self->navHash("comesfrom_", 1); } |
|
sub encrypted { my $self=shift; return $self->navHash("encrypted_", 1); } |
sub ext { my $self=shift; return $self->navHash("ext_", 1) eq 'true:'; } |
sub ext { my $self=shift; return $self->navHash("ext_", 1) eq 'true:'; } |
sub from { my $self=shift; return $self->navHash("from_", 1); } |
sub from { my $self=shift; return $self->navHash("from_", 1); } |
# considered private and undocumented |
# considered private and undocumented |
Line 3474 sub randompick {
|
Line 3475 sub randompick {
|
return $self->{NAV_MAP}->{PARM_HASH}->{$self->symb . |
return $self->{NAV_MAP}->{PARM_HASH}->{$self->symb . |
'.0.parameter_randompick'}; |
'.0.parameter_randompick'}; |
} |
} |
|
sub link { |
|
my $self=shift; |
|
if ($self->encrypted()) { return &Apache::lonenc::encrypted($self->src); } |
|
return $self->src; |
|
} |
sub src { |
sub src { |
my $self=shift; |
my $self=shift; |
return $self->navHash("src_", 1); |
return $self->navHash("src_", 1); |
} |
} |
|
sub shown_symb { |
|
my $self=shift; |
|
if ($self->encrypted()) {return &Apache::lonenc::encrypted($self->symb());} |
|
return $self->symb(); |
|
} |
sub symb { |
sub symb { |
my $self=shift; |
my $self=shift; |
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/; |
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/; |