--- loncom/interface/lonnavmaps.pm 2008/11/18 20:18:37 1.416
+++ loncom/interface/lonnavmaps.pm 2009/03/16 15:25:40 1.431
@@ -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.431 2009/03/16 15:25:40 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) = @_;
@@ -874,34 +865,32 @@ sub render_resource {
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
# If this is a new branch, label it so
if ($params->{'isNewBranch'}) {
- $newBranchText = "";
+ $newBranchText = "
";
}
# links to open and close the folder
-
- my $linkopen = "";
-
-
+ my $whitespace = $location.'/whitespace_21.gif';
+ my $linkopen = "
"."";
my $linkclose = "";
# Default icon: unknown page
- my $icon = "
";
+ my $icon = "
";
if ($resource->is_problem()) {
if ($part eq '0' || $params->{'condensed'}) {
- $icon = '
';
+ $icon .='" />';
} else {
$icon = $params->{'indentString'};
}
} else {
- $icon = "
";
+ $icon = "
";
}
# Display the correct map icon to open or shut map
@@ -911,15 +900,15 @@ sub render_resource {
if ($it->{CONDITION}) {
$nowOpen = !$nowOpen;
}
-
+
my $folderType = $resource->is_sequence() ? 'folder' : 'page';
my $title=$resource->title;
- $title=~s/\"/\"/g;
+ $title=~s/\"/\&qout;/g;
if (!$params->{'resource_no_folder_link'}) {
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
- $icon = "
";
-
+ $icon = "
"
+ ."
";
$linkopen = "{'url'} . '?' .
$params->{'queryString'} . '&filter=';
$linkopen .= ($nowOpen xor $it->{CONDITION}) ?
@@ -934,10 +923,8 @@ sub render_resource {
} else {
# Don't allow users to manipulate folder
- $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .
- '.nomanip.gif';
- $icon = "
";
+ $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
+ $icon = "
"."
";
$linkopen = "";
$linkclose = "";
@@ -953,10 +940,11 @@ sub render_resource {
if (($resource->is_practice()) && ($resource->is_raw_problem())) {
$nonLinkedText .=' '.&mt('not graded').'';
}
-
- # We're done preparing and finally ready to start the rendering
- my $result = "