version 1.149, 2003/02/28 15:06:45
|
version 1.154, 2003/03/08 20:52:41
|
Line 38
|
Line 38
|
# YEAR=2002 |
# YEAR=2002 |
# 1/1 Gerd Kortemeyer |
# 1/1 Gerd Kortemeyer |
# Oct-Nov Jeremy Bowers |
# Oct-Nov Jeremy Bowers |
|
# YEAR=2003 |
|
# Jeremy Bowers ... lots of days |
|
|
package Apache::lonnavmaps; |
package Apache::lonnavmaps; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Apache::lonmenu(); |
use POSIX qw (floor strftime); |
use POSIX qw (floor strftime); |
|
|
my %navmaphash; |
my %navmaphash; |
Line 152 sub real_handler {
|
Line 155 sub real_handler {
|
} |
} |
|
|
$r->print("<html><head>\n"); |
$r->print("<html><head>\n"); |
$r->print("<title>Navigate Course Contents</title></head>"); |
$r->print("<title>Navigate Course Contents</title>"); |
|
# ------------------------------------------------------------ Get query string |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register']); |
|
# ----------------------------------------------------- Force menu registration |
|
my $addentries=''; |
|
if ($ENV{'form.register'}) { |
|
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
|
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
|
$r->print(&Apache::lonmenu::registerurl(1)); |
|
} |
|
|
# Header |
# Header |
$r->print(&Apache::loncommon::bodytag('Navigate Course Contents','', |
$r->print('</head>'. |
'')); |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
|
$addentries,'','',$ENV{'form.register'})); |
$r->print('<script>window.focus();</script>'); |
$r->print('<script>window.focus();</script>'); |
|
|
$r->rflush(); |
$r->rflush(); |
Line 178 sub real_handler {
|
Line 191 sub real_handler {
|
# renderer call |
# renderer call |
my $render = render({ 'cols' => [0,1,2,3], |
my $render = render({ 'cols' => [0,1,2,3], |
'url' => '/adm/navmaps', |
'url' => '/adm/navmaps', |
#'printKey' => 1, |
'suppressNavmap' => 1, |
'r' => $r}); |
'r' => $r}); |
|
|
$navmap->untieHashes(); |
$navmap->untieHashes(); |
Line 525 Most of these parameters are only useful
|
Line 538 Most of these parameters are only useful
|
|
|
=item * B<printCloseAll>: If true, print the "Close all folders" or "open all folders" links. Default is true. |
=item * B<printCloseAll>: If true, print the "Close all folders" or "open all folders" links. Default is true. |
|
|
=item * B<filterFunc>: A function that takes the resource object as its only parameter and returns a true or false value. If true, the resource is displayed. If false, it is simply skipped in the display. By default, all resources are showne. |
=item * B<filterFunc>: A function that takes the resource object as its only parameter and returns a true or false value. If true, the resource is displayed. If false, it is simply skipped in the display. By default, all resources are shown. |
|
|
|
=item * B<suppressNavmaps>: If true, will not display Navigate Content resources. Default to false. |
|
|
=back |
=back |
|
|
Line 804 sub render {
|
Line 819 sub render {
|
my $here; |
my $here; |
my $jump; |
my $jump; |
my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0); |
my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0); |
|
my $suppressNavmap = setDefault($args->{'suppressNavmap'}, 0); |
my $currentJumpDelta = 2; # change this to change how many resources are displayed |
my $currentJumpDelta = 2; # change this to change how many resources are displayed |
# before the current resource when using #current |
# before the current resource when using #current |
|
|
Line 1070 sub render {
|
Line 1086 sub render {
|
next; |
next; |
} |
} |
|
|
|
# If we're suppressing navmaps and this is a navmap, continue on |
|
if ($suppressNavmap && $curRes->src() =~ /^\/adm\/navmaps/) { |
|
$curRes = $it->next(); |
|
next; |
|
} |
|
|
# Does it have multiple parts? |
# Does it have multiple parts? |
$args->{'multipart'} = 0; |
$args->{'multipart'} = 0; |
$args->{'condensed'} = 0; |
$args->{'condensed'} = 0; |
Line 1181 sub render {
|
Line 1203 sub render {
|
$result .= " </tr>\n"; |
$result .= " </tr>\n"; |
$args->{'isNewBranch'} = 0; |
$args->{'isNewBranch'} = 0; |
} |
} |
|
|
if ($r && $rownum % 20 == 0) { |
if ($r && $rownum % 20 == 0) { |
$r->print($result); |
$r->print($result); |
$result = ""; |
$result = ""; |
Line 2680 sub countParts {
|
Line 2702 sub countParts {
|
sub extractParts { |
sub extractParts { |
my $self = shift; |
my $self = shift; |
|
|
return if ($self->{PARTS}); |
return if (defined($self->{PARTS})); |
return if ($self->ext); |
return if ($self->ext); |
|
|
$self->{PARTS} = []; |
$self->{PARTS} = []; |
|
|
# Retrieve part count, if this is a problem |
# Retrieve part count, if this is a problem |
if ($self->is_problem()) { |
if ($self->is_problem()) { |
my $metadata = &Apache::lonnet::metadata($self->src(), 'allpossiblekeys'); |
my $metadata = &Apache::lonnet::metadata($self->src(), 'packages'); |
if (!$metadata) { |
if (!$metadata) { |
$self->{RESOURCE_ERROR} = 1; |
$self->{RESOURCE_ERROR} = 1; |
$self->{PARTS} = []; |
$self->{PARTS} = []; |
return; |
return; |
} |
} |
|
|
foreach (split(/\,/,$metadata)) { |
foreach (split(/\,/,$metadata)) { |
if ($_ =~ /^parameter\_(.*)\_opendate$/) { |
if ($_ =~ /^part_(.*)$/) { |
my $part = $1; |
my $part = $1; |
# check to see if part is turned off. |
# check to see if part is turned off. |
if (! Apache::loncommon::check_if_partid_hidden($part, $self->symb())) { |
if (! Apache::loncommon::check_if_partid_hidden($part, $self->symb())) { |
Line 2709 sub extractParts {
|
Line 2730 sub extractParts {
|
$self->{PARTS} = \@sortedParts; |
$self->{PARTS} = \@sortedParts; |
} |
} |
|
|
|
# Ensure part 0 is included at the beginning. |
|
if ($self->{PARTS}->[0] ne '0') { |
|
unshift @{$self->{PARTS}}, '0'; |
|
} |
|
|
return; |
return; |
} |
} |
|
|