--- loncom/interface/lonnavmaps.pm 2008/11/21 20:17:11 1.417
+++ loncom/interface/lonnavmaps.pm 2009/02/24 20:10:30 1.426
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.417 2008/11/21 20:17:11 jms Exp $
+# $Id: lonnavmaps.pm,v 1.426 2009/02/24 20:10:30 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -670,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";
}
@@ -865,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 $whitespaceLocation = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21_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
@@ -902,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}) ?
@@ -925,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 = "";
@@ -944,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 = "
";
+ # We're done preparing and finally ready to start the rendering
+ my $result = ' | ';
+ my $newfolderType = $resource->is_sequence() ? 'folder' : 'page';
+
my $indentLevel = $params->{'indentLevel'};
if ($newBranchText) { $indentLevel--; }
@@ -957,7 +954,6 @@ sub render_resource {
}
# Decide what to display
-
$result .= "$newBranchText$linkopen$icon$linkclose";
my $curMarkerBegin = '';
@@ -966,9 +962,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' &&
@@ -988,9 +984,9 @@ sub render_resource {
$target=' target="loncapaclient" ';
}
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
- $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText | ";
+ $result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$nonLinkedText";
} else {
- $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText";
+ $result .= "$curMarkerBegin$linkopen$title$partLabel$curMarkerEnd$nonLinkedText";
}
return $result;
@@ -1010,7 +1006,7 @@ sub render_communication_status {
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
if ($resource->hasDiscussion()) {
$discussionHTML = $linkopen .
- '
' .
+ '
' .
$linkclose;
}
@@ -1020,8 +1016,7 @@ sub render_communication_status {
if ($msgid) {
$feedbackHTML .= ' '
- . '
';
+ . '
';
}
}
}
@@ -1035,8 +1030,7 @@ sub render_communication_status {
$errorcount++;
$errorHTML .= ' '
- . '
';
+ . '
';
}
}
}
@@ -1044,8 +1038,7 @@ sub render_communication_status {
if ($params->{'multipart'} && $part != '0') {
$discussionHTML = $feedbackHTML = $errorHTML = '';
}
-
- return "$discussionHTML$feedbackHTML$errorHTML | ";
+ return "$discussionHTML$feedbackHTML$errorHTML | ";
}
sub render_quick_status {
@@ -1061,28 +1054,28 @@ sub render_quick_status {
}
my $linkopen = "";
my $linkclose = "";
-
+
+ $result .= '';
if ($resource->is_problem() &&
!$firstDisplayed) {
-
my $icon = $statusIconMap{$resource->simpleStatus($part)};
my $alt = $iconAltTags{$icon};
if ($icon) {
my $location=
&Apache::loncommon::lonhttpdurl("/adm/lonIcons/$icon");
- $result .= " | $linkopen $linkclose | \n";
+ $result .= "$linkopen
$linkclose";
} else {
- $result .= " | \n";
+ $result .= " ";
}
} else { # not problem, no icon
- $result .= " | \n";
+ $result .= " ";
}
-
+ $result .= "\n";
return $result;
}
sub render_long_status {
my ($resource, $part, $params) = @_;
- my $result = "\n";
+ my $result = ' | ';
my $firstDisplayed = !$params->{'condensed'} &&
$params->{'multipart'} && $part eq "0";
@@ -1269,7 +1262,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').' ';
}
@@ -1337,6 +1330,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
@@ -1381,7 +1379,7 @@ sub render {
my $printKey = $args->{'printKey'};
my $printCloseAll = $args->{'printCloseAll'};
if (!defined($printCloseAll)) { $printCloseAll = 1; }
-
+
# Print key?
if ($printKey) {
$result .= '';
@@ -1456,6 +1454,7 @@ END
$result.='';
}
+
if ($args->{'caller'} eq 'navmapsdisplay') {
$result .= ''.
&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' | ';
@@ -1479,31 +1478,35 @@ 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";
+ $result .= '' ."\n";
+
my $res = "Apache::lonnavmaps::resource";
my %condenseStatuses =
( $res->NETWORK_FAILURE => 1,
$res->NOTHING_SET => 1,
$res->CORRECT => 1 );
- my @backgroundColors = ("#FFFFFF", "#F6F6F6");
+ my @backgroundColors = ("LC_trEven", "LC_trOdd");
# Shared variables
$args->{'counter'} = 0; # counts the rows
$args->{'indentLevel'} = 0;
$args->{'isNewBranch'} = 0;
- $args->{'condensed'} = 0;
- my $location=
- &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace1.gif");
- $args->{'indentString'} = setDefault($args->{'indentString'}, " ");
+ $args->{'condensed'} = 0;
+
+ my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21_21.gif");
+ $args->{'indentString'} = setDefault($args->{'indentString'}, " ");
$args->{'displayedHereMarker'} = 0;
# If we're suppressing empty sequences, look for them here. Use DFS for speed,
@@ -1731,7 +1734,7 @@ END
$rownum ++;
my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];
- $result .= " \n";
+ $result .= " \n";
# Set up some data about the parts that the cols might want
my $filter = $it->{FILTER};
@@ -1828,7 +1831,7 @@ ENDBLOCK
$result.='}
'."\n";
+ '."\n";
return $result;
}
1;
+
+
+
+
+
+
+
+
package Apache::lonnavmaps::navmap;
=pod
@@ -3729,7 +3740,7 @@ sub map_contains_problem {
sub is_sequence {
my $self=shift;
return $self->navHash("is_map_", 1) &&
- $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
+ $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
}
sub is_survey {
my $self = shift();
|