--- loncom/interface/lonnavmaps.pm 2008/11/18 20:18:37 1.416
+++ loncom/interface/lonnavmaps.pm 2009/02/14 14:39:31 1.425
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.416 2008/11/18 20:18:37 jms Exp $
+# $Id: lonnavmaps.pm,v 1.425 2009/02/14 14:39:31 schulted Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -425,31 +425,45 @@ manner:
Very, very, very, VERY English-only... goodness help a localizer on
this func...
-=item
+=item resource()
-=item
+returns 0
-=item
+=item communication_status()
-=item
+returns 1
-=item
+=item quick_status()
-=item
+returns 2
-=item
+=item long_status()
-=item
+returns 3
-=item
+=item part_status_summary()
-=item
+returns 4
-=item
+=item render_resource()
-=item
+=item render_communication_status()
-=item
+=item render_quick_status()
+
+=item render_long_status()
+
+=item render_parts_summary_status()
+
+=item setDefault()
+
+=item cmp_title()
+
+=item render()
+
+=item add_linkitem()
+
+=item show_linkitems()
=back
@@ -544,9 +558,7 @@ this.document.navform.submit();
ENDUPDATE
}
-# Convenience functions: Returns a string that adds or subtracts
-# the second argument from the first hash, appropriate for the
-# query string that determines which folders to recurse on
+
sub addToFilter {
my $hashIn = shift;
my $addition = shift;
@@ -565,8 +577,6 @@ sub removeFromFilter {
return join(",", keys(%hash));
}
-# Convenience function: Given a stack returned from getStack on the iterator,
-# return the correct src() value.
sub getLinkForResource {
my $stack = shift;
my $res;
@@ -604,11 +614,7 @@ sub getLinkForResource {
return;
}
-# Convenience function: This separates the logic of how to create
-# the problem text strings ("Due: DATE", "Open: DATE", "Not yet assigned",
-# etc.) into a separate function. It takes a resource object as the
-# first parameter, and the part number of the resource as the second.
-# It's basically a big switch statement on the status of the resource.
+
sub getDescription {
my $res = shift;
@@ -664,7 +670,7 @@ sub getDescription {
my $maxtries = $res->maxtries($part);
my $triesString = "";
if ($tries && $maxtries) {
- $triesString = '('.&mt('[_1] of [_2] tries used',$tries,$maxtries).')';
+ $triesString = '('.&mt('[_1] of [quant,_2,try,tries] used',$tries,$maxtries).')';
if ($maxtries > 1 && $maxtries - $tries == 1) {
$triesString = "$triesString";
}
@@ -681,8 +687,6 @@ sub getDescription {
}
}
-# Convenience function, so others can use it: Is the problem due in less than
-# 24 hours, and still can be done?
sub dueInLessThan24Hours {
my $res = shift;
@@ -695,8 +699,7 @@ sub dueInLessThan24Hours {
$res->duedate($part) > time();
}
-# Convenience function, so others can use it: Is there only one try remaining for the
-# part, with more than one try to begin with, not due yet and still can be done?
+
sub lastTry {
my $res = shift;
my $part = shift;
@@ -708,23 +711,11 @@ sub lastTry {
$res->duedate($part) > time();
}
-# This puts a human-readable name on the env variable.
sub advancedUser {
return $env{'request.role.adv'};
}
-
-# timeToHumanString takes a time number and converts it to a
-# human-readable representation, meant to be used in the following
-# manner:
-# print "Due $timestring"
-# print "Open $timestring"
-# print "Answer available $timestring"
-# Very, very, very, VERY English-only... goodness help a localizer on
-# this func...
-
-
sub timeToHumanString {
my ($time,$type,$format) = @_;
@@ -975,9 +966,9 @@ sub render_resource {
# Is this the current resource?
if (!$params->{'displayedHereMarker'} &&
$resource->symb() eq $params->{'here'} ) {
- $curMarkerBegin = '>';
- $curMarkerEnd = '<';
- $params->{'displayedHereMarker'} = 1;
+ $curMarkerBegin = '';
+ $curMarkerEnd = '';
+ $params->{'displayedHereMarker'} = 1;
}
if ($resource->is_problem() && $part ne '0' &&
@@ -1029,7 +1020,7 @@ sub render_communication_status {
if ($msgid) {
$feedbackHTML .= ' '
- . '
';
}
}
@@ -1278,7 +1269,7 @@ sub render {
if (!defined($navmap)) {
$navmap = Apache::lonnavmaps::navmap->new();
if (!defined($navmap)) {
- # no londer in course
+ # no longer in course
return ''.&mt('No course selected').'
'.&mt('Select a course').'
';
}
@@ -1346,6 +1337,11 @@ sub render {
# Step 1: Check to see if we have a navmap
if (!defined($navmap)) {
$navmap = Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ # no longer in course
+ return ''.&mt('No course selected').'
+ '.&mt('Select a course').'
';
+ }
}
# See if we're being passed a specific map
@@ -1390,7 +1386,7 @@ sub render {
my $printKey = $args->{'printKey'};
my $printCloseAll = $args->{'printCloseAll'};
if (!defined($printCloseAll)) { $printCloseAll = 1; }
-
+
# Print key?
if ($printKey) {
$result .= '
';
@@ -1465,6 +1461,7 @@ END
$result.='';
}
+
if ($args->{'caller'} eq 'navmapsdisplay') {
$result .= ''.
&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' | ';
@@ -1488,14 +1485,17 @@ END
$result.=$args->{'sort_html'};
}
- $result .= "
\n";
+ #$result .= "
\n";
if ($r) {
$r->print($result);
$r->rflush();
$result = "";
}
# End parameter setting
-
+
+ $result .= "\n\n";
+ $result .= "
\n";
+
# Data
$result .= '' ."\n";
my $res = "Apache::lonnavmaps::resource";
@@ -1837,7 +1837,7 @@ ENDBLOCK
$result.='}
'."\n";
+ '."\n";
return $result;
}
1;
+
+
+
+
+
+
+
+
package Apache::lonnavmaps::navmap;
=pod