--- loncom/interface/lonnavmaps.pm 2005/04/15 21:28:54 1.325
+++ loncom/interface/lonnavmaps.pm 2005/06/17 21:17:09 1.329
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.325 2005/04/15 21:28:54 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.329 2005/06/17 21:17:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1039,7 +1039,7 @@ 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
@@ -1051,16 +1051,16 @@ sub render_resource {
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
@@ -1075,7 +1075,8 @@ sub render_resource {
if (!$params->{'resource_no_folder_link'}) {
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
- $icon = "";
+ $icon = "";
$linkopen = "{'queryString'} . '&filter=';
@@ -1093,7 +1094,8 @@ sub render_resource {
# Don't allow users to manipulate folder
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .
'.nomanip.gif';
- $icon = "";
+ $icon = "";
$linkopen = "";
$linkclose = "";
@@ -1650,7 +1652,7 @@ END
$args->{'condensed'} = 0;
my $location=
&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace1.gif");
- $args->{'indentString'} = setDefault($args->{'indentString'}, "");
+ $args->{'indentString'} = setDefault($args->{'indentString'}, "");
$args->{'displayedHereMarker'} = 0;
# If we're suppressing empty sequences, look for them here. Use DFS for speed,
@@ -2112,39 +2114,34 @@ sub generate_course_user_opt {
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
- my $uhome=$env{'user.home'};
my $cid=$env{'request.course.id'};
- my ($cdom,$cnum)=split(/\_/,$cid);
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my $cnum=$env{'course.'.$cid.'.num'};
- my %useropt; my %courseopt;
- unless ($uhome eq 'no_host') {
# ------------------------------------------------- Get coursedata (if present)
- %courseopt=&Apache::lonnet::dump('resourcedata',$cdom,$cnum);
- # Check for network failure
- my ($tmp)=keys(%courseopt);
-
- if ( $tmp =~ /no.such.host/i || $tmp =~ /con_lost/i) {
+ my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
+ # Check for network failure
+ if (!ref($courseopt)) {
+ if ( $courseopt =~ /no.such.host/i || $courseopt =~ /con_lost/i) {
$self->{NETWORK_FAILURE} = 1;
- undef(%courseopt);
- } elsif ($tmp=~/^error\:/) {
- undef(%courseopt);
}
+ undef($courseopt);
+ }
# --------------------------------------------------- Get userdata (if present)
- %useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname);
- ($tmp)=keys(%courseopt);
- if ($tmp=~/^error\:/) {
- undef(%useropt);
- } elsif ( $tmp=~/no.such.host/i || $tmp=~/con.lost/i ) {
- # check to see if network failed
+ my $useropt=&Apache::lonnet::get_userresdata($uname,$udom);
+ # Check for network failure
+ if (!ref($useropt)) {
+ if ( $useropt =~ /no.such.host/i || $useropt =~ /con_lost/i) {
$self->{NETWORK_FAILURE} = 1;
- undef(%useropt);
}
- $self->{COURSE_OPT} = \%courseopt;
- $self->{USER_OPT} = \%useropt;
+ undef($useropt);
}
+ $self->{COURSE_OPT} = $courseopt;
+ $self->{USER_OPT} = $useropt;
+
$self->{COURSE_USER_OPT_GENERATED} = 1;
return;
@@ -2156,7 +2153,8 @@ sub generate_email_discuss_status {
if ($self->{EMAIL_DISCUSS_GENERATED}) { return; }
my $cid=$env{'request.course.id'};
- my ($cdom,$cnum)=split(/\_/,$cid);
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my $cnum=$env{'course.'.$cid.'.num'};
my %emailstatus = &Apache::lonnet::dump('email_status');
my $logoutTime = $emailstatus{'logout'};
@@ -3504,6 +3502,15 @@ sub shown_symb {
if ($self->encrypted()) {return &Apache::lonenc::encrypted($self->symb());}
return $self->symb();
}
+sub id {
+ my $self=shift;
+ return $self->{ID};
+}
+sub enclosing_map_src {
+ my $self=shift;
+ (my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/;
+ return $self->navHash('map_id_'.$first);
+}
sub symb {
my $self=shift;
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/;