--- loncom/interface/lonnavmaps.pm 2004/07/27 23:35:34 1.273
+++ loncom/interface/lonnavmaps.pm 2006/06/05 17:55:59 1.387
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.273 2004/07/27 23:35:34 www Exp $
+# $Id: lonnavmaps.pm,v 1.387 2006/06/05 17:55:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,12 +30,18 @@
package Apache::lonnavmaps;
use strict;
+use GDBM_File;
use Apache::Constants qw(:common :http);
use Apache::loncommon();
use Apache::lonmenu();
+use Apache::lonenc();
use Apache::lonlocal;
+use Apache::lonnet;
use POSIX qw (floor strftime);
-use Data::Dumper; # for debugging, not always used
+use Data::Dumper; # for debugging, not always
+use Time::HiRes qw( gettimeofday tv_interval );
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
# symbolic constants
sub SYMB { return 1; }
@@ -53,6 +59,7 @@ my %statusIconMap =
$resObj->CLOSED => '',
$resObj->OPEN => 'navmap.open.gif',
$resObj->CORRECT => 'navmap.correct.gif',
+ $resObj->PARTIALLY_CORRECT => 'navmap.partial.gif',
$resObj->INCORRECT => 'navmap.wrong.gif',
$resObj->ATTEMPTED => 'navmap.ellipsis.gif',
$resObj->ERROR => ''
@@ -77,21 +84,28 @@ my %colormap =
$resObj->OPEN => '',
$resObj->NOTHING_SET => '',
$resObj->ATTEMPTED => '',
- $resObj->ANSWER_SUBMITTED => ''
+ $resObj->ANSWER_SUBMITTED => '',
+ $resObj->PARTIALLY_CORRECT => '#006600'
);
# And a special case in the nav map; what to do when the assignment
# is not yet done and due in less then 24 hours
my $hurryUpColor = "#FF0000";
sub launch_win {
- my ($mode,$script)=@_;
+ my ($mode,$script,$toplinkitems,$firsttime)=@_;
my $result;
if ($script ne 'no') {
$result.='';
}
if ($mode eq 'link') {
- $result.=''
- .&mt("Launch navigation in separate window")." ";
+ &add_linkitem($toplinkitems,'launchnav','launch_navmapwin()',
+ "Launch navigation window");
}
return $result;
}
sub close {
- if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; }
+ if ($env{'environment.remotenavmap'} ne 'on') { return ''; }
return(<
window.status='Accessing Nav Control';
@@ -120,8 +134,8 @@ ENDCLOSE
}
sub update {
- if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; }
- if (!$ENV{'request.course.id'}) { return ''; }
+ if ($env{'environment.remotenavmap'} ne 'on') { return ''; }
+ if (!$env{'request.course.id'}) { return ''; }
if ($ENV{'REQUEST_URI'}=~m|^/adm/navmaps|) { return ''; }
return(<
@@ -140,10 +154,10 @@ sub handler {
sub real_handler {
my $r = shift;
-
+ #my $t0=[&gettimeofday()];
# Handle header-only request
if ($r->header_only) {
- if ($ENV{'browser.mathml'}) {
+ if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($r,'text/xml');
} else {
&Apache::loncommon::content_type($r,'text/html');
@@ -153,34 +167,71 @@ sub real_handler {
}
# Send header, don't cache this page
- if ($ENV{'browser.mathml'}) {
+ if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($r,'text/xml');
} else {
&Apache::loncommon::content_type($r,'text/html');
}
&Apache::loncommon::no_cache($r);
- $r->send_http_header;
+ my %toplinkitems=();
+ &add_linkitem(\%toplinkitems,'blank','',"Select Action");
if ($ENV{QUERY_STRING} eq 'collapseExternal') {
&Apache::lonnet::put('environment',{'remotenavmap' => 'off'});
&Apache::lonnet::appenv('environment.remotenavmap' => 'off');
- $r->print(<<"ENDSUBM");
-
-
+ my $menu=&Apache::lonmenu::reopenmenu();
+ my $navstatus=&Apache::lonmenu::get_nav_status();
+ if ($menu) {
+ $menu=(<