--- loncom/interface/lonnavmaps.pm 2006/02/16 19:38:27 1.361
+++ loncom/interface/lonnavmaps.pm 2012/04/04 15:00:17 1.482
@@ -1,7 +1,8 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.361 2006/02/16 19:38:27 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.482 2012/04/04 15:00:17 raeburn Exp $
+
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,713 +28,25 @@
#
###
-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
-use Time::HiRes qw( gettimeofday tv_interval );
-
-# symbolic constants
-sub SYMB { return 1; }
-sub URL { return 2; }
-sub NOTHING { return 3; }
-
-# Some data
-
-my $resObj = "Apache::lonnavmaps::resource";
-
-# Keep these mappings in sync with lonquickgrades, which uses the colors
-# instead of the icons.
-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 => ''
- );
-
-my %iconAltTags =
- ( 'navmap.correct.gif' => 'Correct',
- 'navmap.wrong.gif' => 'Incorrect',
- 'navmap.open.gif' => 'Open' );
-
-# Defines a status->color mapping, null string means don't color
-my %colormap =
- ( $resObj->NETWORK_FAILURE => '',
- $resObj->CORRECT => '',
- $resObj->EXCUSED => '#3333FF',
- $resObj->PAST_DUE_ANSWER_LATER => '',
- $resObj->PAST_DUE_NO_ANSWER => '',
- $resObj->ANSWER_OPEN => '#006600',
- $resObj->OPEN_LATER => '',
- $resObj->TRIES_LEFT => '',
- $resObj->INCORRECT => '',
- $resObj->OPEN => '',
- $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);
-}
-
-sub real_handler {
- my $r = shift;
- #my $t0=[&gettimeofday()];
- # Handle header-only request
- if ($r->header_only) {
- if ($env{'browser.mathml'}) {
- &Apache::loncommon::content_type($r,'text/xml');
- } else {
- &Apache::loncommon::content_type($r,'text/html');
- }
- $r->send_http_header;
- return OK;
- }
-
- # Send header, don't cache this page
- if ($env{'browser.mathml'}) {
- &Apache::loncommon::content_type($r,'text/xml');
- } else {
- &Apache::loncommon::content_type($r,'text/html');
- }
- &Apache::loncommon::no_cache($r);
-
- 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=(<