--- loncom/lonnet/perl/lonnet.pm 2004/01/13 16:29:41 1.461 +++ loncom/lonnet/perl/lonnet.pm 2004/01/30 14:42:00 1.467 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.461 2004/01/13 16:29:41 www Exp $ +# $Id: lonnet.pm,v 1.467 2004/01/30 14:42:00 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1446,6 +1446,7 @@ sub get_course_adv_roles { if (($tend) && ($tend<$now)) { next; } if (($tstart) && ($now<$tstart)) { next; } my ($role,$username,$domain,$section)=split(/\:/,$_); + if (&privileged($username,$domain)) { next; } my $key=&plaintext($role); if ($section) { $key.=' (Sec/Grp '.$section.')'; } if ($returnhash{$key}) { @@ -3822,7 +3823,9 @@ sub packages_tab_default { foreach my $package (split(/,/,$packages)) { my ($pack_type,$pack_part)=split(/_/,$package,2); if ($pack_part eq $part) { - return $packagetab{"$pack_type&$name&default"}; + if (defined($packagetab{"$pack_type&$name&default"})) { + return $packagetab{"$pack_type&$name&default"}; + } } } return undef; @@ -4457,7 +4460,7 @@ sub filelocation { $location=$file; } else { $file=~s/^$perlvar{'lonDocRoot'}//; - $file=~s:^/*res::; + $file=~s:^/res/:/:; if ( !( $file =~ m:^/:) ) { $location = $dir. '/'.$file; } else { @@ -4474,13 +4477,38 @@ sub hreflocation { unless (($file=~m-^http://-i) || ($file=~m-^/-)) { my $finalpath=filelocation($dir,$file); $finalpath=~s-^/home/httpd/html--; - $finalpath=~s-/home/(\w+)/public_html/-/~$1/-; + $finalpath=~s-^/home/(\w+)/public_html/-/~$1/-; return $finalpath; } elsif ($file=~m-^/home-) { $file=~s-^/home/httpd/html--; - $file=~s-/home/(\w+)/public_html/-/~$1/-; + $file=~s-^/home/(\w+)/public_html/-/~$1/-; return $file; } + return $file; +} + +sub current_machine_domains { + my $hostname=$hostname{$perlvar{'lonHostID'}}; + my @domains; + while( my($id, $name) = each(%hostname)) { +# &logthis("-$id-$name-$hostname-"); + if ($hostname eq $name) { + push(@domains,$hostdom{$id}); + } + } + return @domains; +} + +sub current_machine_ids { + my $hostname=$hostname{$perlvar{'lonHostID'}}; + my @ids; + while( my($id, $name) = each(%hostname)) { +# &logthis("-$id-$name-$hostname-"); + if ($hostname eq $name) { + push(@ids,$id); + } + } + return @ids; } # ------------------------------------------------------------- Declutters URLs