--- loncom/interface/lonnavmaps.pm 2010/02/10 16:45:31 1.423.2.3
+++ loncom/interface/lonnavmaps.pm 2010/09/13 03:07:56 1.440.2.2
@@ -1,7 +1,8 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.423.2.3 2010/02/10 16:45:31 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.440.2.2 2010/09/13 03:07:56 raeburn Exp $
+
#
# Copyright Michigan State University Board of Trustees
#
@@ -504,10 +505,13 @@ my %statusIconMap =
$resObj->ERROR => ''
);
-my %iconAltTags =
- ( 'navmap.correct.gif' => 'Correct',
- 'navmap.wrong.gif' => 'Incorrect',
- 'navmap.open.gif' => 'Open' );
+my %iconAltTags = #texthash does not work here
+ ( 'navmap.correct.gif' => 'Correct',
+ 'navmap.wrong.gif' => 'Incorrect',
+ 'navmap.open.gif' => 'Open',
+ 'navmap.partial.gif' => 'Partially Correct',
+ 'navmap.ellipsis.gif' => 'Attempted',
+ );
# Defines a status->color mapping, null string means don't color
my %colormap =
@@ -597,7 +601,7 @@ sub getLinkForResource {
my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb());
if ($map=~/\.page$/) {
my $url=&Apache::lonnet::clutter($map);
- $anchor=&escape($res->shown_symb());
+ $anchor=&escape($res->shown_symb());
return ($url,$res->shown_symb(),$anchor);
}
}
@@ -695,7 +699,11 @@ sub getDescription {
return &mt("Excused by instructor");
}
if ($status == $res->ATTEMPTED) {
- return &mt("Answer submitted, not yet graded");
+ if ($res->src() eq '/res/gci/gci/internal/submission.problem') {
+ return &mt('Question(s) submitted for review');
+ } else {
+ return &mt("Answer submitted, not yet graded");
+ }
}
if ($status == $res->TRIES_LEFT) {
my $tries = $res->tries($part);
@@ -715,7 +723,11 @@ sub getDescription {
}
}
if ($status == $res->ANSWER_SUBMITTED) {
- return &mt('Answer submitted');
+ if ($res->src() eq '/res/gci/gci/internal/submission.problem') {
+ return &mt('Question(s) submitted for review');
+ } else {
+ return &mt('Answer submitted');
+ }
}
}
@@ -892,35 +904,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
@@ -930,15 +939,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}) ?
@@ -953,10 +962,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 = "";
@@ -972,10 +979,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--; }
@@ -985,7 +993,6 @@ sub render_resource {
}
# Decide what to display
-
$result .= "$newBranchText$linkopen$icon$linkclose";
my $curMarkerBegin = '';
@@ -994,9 +1001,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' &&
@@ -1016,9 +1023,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;
@@ -1038,7 +1045,7 @@ sub render_communication_status {
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
if ($resource->hasDiscussion()) {
$discussionHTML = $linkopen .
- '' .
+ '' .
$linkclose;
}
@@ -1048,8 +1055,7 @@ sub render_communication_status {
if ($msgid) {
$feedbackHTML .= ' '
- . '';
+ . '';
}
}
}
@@ -1063,8 +1069,7 @@ sub render_communication_status {
$errorcount++;
$errorHTML .= ' '
- . '';
+ . '';
}
}
}
@@ -1072,8 +1077,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 {
@@ -1089,28 +1093,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";
@@ -1414,7 +1418,7 @@ sub render {
my $printKey = $args->{'printKey'};
my $printCloseAll = $args->{'printCloseAll'};
if (!defined($printCloseAll)) { $printCloseAll = 1; }
-
+
# Print key?
if ($printKey) {
$result .= '';
@@ -1489,6 +1493,7 @@ END
$result.='';
}
+
if ($args->{'caller'} eq 'navmapsdisplay') {
$result .= ''.
&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' | ';
@@ -1497,7 +1502,8 @@ END
} else {
$result .= ' ';
}
- $result.=&show_linkitems($args->{'linkitems'});
+ $result.="".mt('Tools:')." | ";
+ $result.=&show_linkitems_toolbar($args->{'linkitems'});
if ($args->{'sort_html'}) {
if ($env{'environment.remotenavmap'} ne 'on') {
$result.=' | | | '.
@@ -1512,31 +1518,33 @@ END
$result.=$args->{'sort_html'};
}
- $result .= " \n";
+ #$result .= " \n";
if ($r) {
$r->print($result);
$r->rflush();
$result = "";
}
# End parameter setting
-
+
+ $result .= " \n";
+
# Data
- $result .= '' ."\n";
+ $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");
+
my $res = "Apache::lonnavmaps::resource";
my %condenseStatuses =
( $res->NETWORK_FAILURE => 1,
$res->NOTHING_SET => 1,
$res->CORRECT => 1 );
- my @backgroundColors = ("#FFFFFF", "#F6F6F6");
# 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.gif");
+ $args->{'indentString'} = setDefault($args->{'indentString'}, "");
$args->{'displayedHereMarker'} = 0;
# If we're suppressing empty sequences, look for them here. Use DFS for speed,
@@ -1762,9 +1770,8 @@ END
# show them.
foreach my $part (@parts) {
$rownum ++;
- my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];
- $result .= " \n";
+ $result .= &Apache::loncommon::start_data_table_row();
# Set up some data about the parts that the cols might want
my $filter = $it->{FILTER};
@@ -1790,7 +1797,7 @@ END
}
$result .= $colHTML . "\n";
}
- $result .= " \n";
+ $result .= &Apache::loncommon::end_data_table_row();
$args->{'isNewBranch'} = 0;
}
@@ -1826,8 +1833,8 @@ if (location.href.indexOf('#curloc')==-1
";
}
- $result .= " ";
-
+ $result.=&Apache::loncommon::end_data_table();
+
if ($r) {
$r->print($result);
$result = "";
@@ -1877,6 +1884,41 @@ ENDBLOCK
return $result;
}
+sub show_linkitems_toolbar {
+ my ($linkitems,$condition)=@_;
+ my @linkorder = ("blank","launchnav","closenav","firsthomework",
+ "everything","uncompleted","changefolder","clearbubbles");
+
+ my $result .='
+
+ '."\n';
+ $result .= ' | '."\n";
+
+ return $result;
+}
+
+
1;
@@ -2343,7 +2385,7 @@ resource object.
Based on the symb of the resource, get a resource object for that
resource. This is one of the proper ways to get a resource object.
-=item * B(map_pc):
+=item * B(map_pc):
Based on the map_pc of the resource, get a resource object for
the given map. This is one of the proper ways to get a resource object.
@@ -3498,11 +3540,7 @@ sub navHash {
my $self = shift;
my $param = shift;
my $id = shift;
- my $arg = $param . ($id?$self->{ID}:"");
- if (defined($arg)) {
- return $self->{NAV_MAP}->navhash($arg);
- }
- return;
+ return $self->{NAV_MAP}->navhash($param . ($id?$self->{ID}:""));
}
=pod
@@ -3774,7 +3812,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();
@@ -3841,6 +3879,12 @@ resource of the map.
Returns a string with the type of the map in it.
+=item *B:
+
+Returns a string with a comma-separated ordered list of map_pc IDs
+for the hierarchy of maps containing a map, with the top level
+map first, then descending to deeper levels, with the enclosing map last.
+
=back
=cut
@@ -3871,6 +3915,11 @@ sub map_type {
my $pc = $self->map_pc();
return $self->navHash("map_type_$pc", 0);
}
+sub map_hierarchy {
+ my $self = shift;
+ my $pc = $self->map_pc();
+ return $self->navHash("map_hierarchy_$pc", 0);
+}
#####
# Property queries
@@ -4105,7 +4154,7 @@ sub slot_control {
if (!defined($part)) { $part = '0'; }
my $useslots = $self->parmval("useslots", $part);
my $availablestudent = $self->parmval("availablestudent", $part);
- my $available = $self->parmval("available", $part);
+ my $available = $self->parmval("available", $part);
return ($useslots,$availablestudent,$available);
}
@@ -4540,7 +4589,7 @@ sub OPEN { return 1; }
sub PAST_DUE_NO_ANSWER { return 2; }
sub PAST_DUE_ANSWER_LATER { return 3; }
sub ANSWER_OPEN { return 4; }
-sub NOTHING_SET { return 5; }
+sub NOTHING_SET { return 5; }
sub NETWORK_FAILURE { return 100; }
# getDateStatus gets the date status for a given problem part.
@@ -4752,9 +4801,9 @@ An answer has been submitted, but the st
=cut
-sub TRIES_LEFT { return 20; }
-sub ANSWER_SUBMITTED { return 21; }
-sub PARTIALLY_CORRECT{ return 22; }
+sub TRIES_LEFT { return 20; }
+sub ANSWER_SUBMITTED { return 21; }
+sub PARTIALLY_CORRECT { return 22; }
sub RESERVED_LATER { return 30; }
sub RESERVED { return 31; }
@@ -4897,11 +4946,11 @@ sub check_for_slot {
if (!&Apache::loncommon::check_ip_acc($ip)) {
return (RESERVED_LOCATION,$ip,$slot_name);
}
- }
+ }
if (@proctors > 0) {
unless ((grep(/^\Q$checkedin\E/,@proctors)) &&
($checkedinslot eq $slot_name)) {
- return (NEEDS_CHECKIN,undef,$slot_name);
+ return (NEEDS_CHECKIN,undef,$slot_name);
}
}
return (RESERVED,$end,$slot_name);
@@ -4917,19 +4966,19 @@ sub check_for_slot {
my ($is_correct,$got_grade);
if ($self->is_task()) {
my $taskstatus = $self->taskstatus();
- $is_correct = (($taskstatus eq 'pass') ||
+ $is_correct = (($taskstatus eq 'pass') ||
($self->solved() =~ /^correct_/));
$got_grade = ($self->solved() =~ /^(?:pass|fail)$/);
} else {
$got_grade = 1;
- $is_correct = ($self->solved() =~ /^correct_/);
+ $is_correct = ($self->solved() =~ /^correct_/);
}
($checkedin,$checkedinslot) = $self->checkedin();
if ($checkedin) {
if (!$got_grade) {
return (WAITING_FOR_GRADE);
} elsif ($is_correct) {
- return (CORRECT);
+ return (CORRECT);
}
}
return(NOT_IN_A_SLOT);
|