--- loncom/interface/lonnavmaps.pm 2003/06/14 00:11:12 1.204
+++ loncom/interface/lonnavmaps.pm 2006/05/30 20:13:45 1.385
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.204 2003/06/14 00:11:12 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.385 2006/05/30 20:13:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,29 +25,23 @@
#
# http://www.lon-capa.org/
#
-# (Page Handler
-#
-# (TeX Content Handler
-#
-# 05/29/00,05/30 Gerd Kortemeyer)
-# 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
-# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer)
-#
-# 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21,9/24,9/25 Gerd Kortemeyer
-# YEAR=2002
-# 1/1 Gerd Kortemeyer
-# Oct-Nov Jeremy Bowers
-# YEAR=2003
-# Jeremy Bowers ... lots of days
+###
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; }
@@ -61,19 +55,15 @@ my $resObj = "Apache::lonnavmaps::resour
# Keep these mappings in sync with lonquickgrades, which uses the colors
# instead of the icons.
my %statusIconMap =
- ( $resObj->NETWORK_FAILURE => '',
- $resObj->NOTHING_SET => '',
- $resObj->CORRECT => 'navmap.correct.gif',
- $resObj->EXCUSED => 'navmap.correct.gif',
- $resObj->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
- $resObj->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
- $resObj->ANSWER_OPEN => 'navmap.wrong.gif',
- $resObj->OPEN_LATER => '',
- $resObj->TRIES_LEFT => 'navmap.open.gif',
- $resObj->INCORRECT => 'navmap.wrong.gif',
- $resObj->OPEN => 'navmap.open.gif',
- $resObj->ATTEMPTED => 'navmap.ellipsis.gif',
- $resObj->ANSWER_SUBMITTED => '' );
+ (
+ $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 => ''
+ );
my %iconAltTags =
( 'navmap.correct.gif' => 'Correct',
@@ -92,11 +82,71 @@ my %colormap =
$resObj->TRIES_LEFT => '',
$resObj->INCORRECT => '',
$resObj->OPEN => '',
- $resObj->NOTHING_SET => '' );
+ $resObj->NOTHING_SET => '',
+ $resObj->ATTEMPTED => '',
+ $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,$toplinkitems,$firsttime)=@_;
+ my $result;
+ if ($script ne 'no') {
+ $result.='';
+ }
+ if ($mode eq 'link') {
+ &add_linkitem($toplinkitems,'launchnav','launch_navmapwin()',
+ "Launch navigation window");
+ }
+ return $result;
+}
+
+sub close {
+ if ($env{'environment.remotenavmap'} ne 'on') { return ''; }
+ return(<
+window.status='Accessing Nav Control';
+menu=window.open("/adm/rat/empty.html","loncapanav",
+ "height=600,width=400,scrollbars=1");
+window.status='Closing Nav Control';
+menu.close();
+window.status='Done.';
+
+ENDCLOSE
+}
+
+sub update {
+ if ($env{'environment.remotenavmap'} ne 'on') { return ''; }
+ if (!$env{'request.course.id'}) { return ''; }
+ if ($ENV{'REQUEST_URI'}=~m|^/adm/navmaps|) { return ''; }
+ return(<
+
+ENDUPDATE
+}
+
sub handler {
my $r = shift;
real_handler($r);
@@ -104,138 +154,208 @@ sub handler {
sub real_handler {
my $r = shift;
-
+ #my $t0=[&gettimeofday()];
# Handle header-only request
if ($r->header_only) {
- if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
+ if ($env{'browser.mathml'}) {
+ &Apache::loncommon::content_type($r,'text/xml');
} else {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
}
$r->send_http_header;
return OK;
}
# Send header, don't cache this page
- if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
+ if ($env{'browser.mathml'}) {
+ &Apache::loncommon::content_type($r,'text/xml');
} else {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
}
&Apache::loncommon::no_cache($r);
- $r->send_http_header;
- # Create the nav map
- my $navmap = Apache::lonnavmaps::navmap->new(
- $ENV{"request.course.fn"}.".db",
- $ENV{"request.course.fn"}."_parms.db", 1, 1);
+ 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');
+ my $menu=&Apache::lonmenu::reopenmenu();
+ my $navstatus=&Apache::lonmenu::get_nav_status();
+ if ($menu) {
+ $menu=(<