--- loncom/lonnet/perl/lonnet.pm 2006/02/07 16:21:05 1.707 +++ loncom/lonnet/perl/lonnet.pm 2006/02/10 22:33:48 1.710 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.707 2006/02/07 16:21:05 albertel Exp $ +# $Id: lonnet.pm,v 1.710 2006/02/10 22:33:48 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -948,7 +948,7 @@ sub studentphoto { my ($udom,$unam,$ext) = @_; my $home=&Apache::lonnet::homeserver($unam,$udom); if (defined($env{'request.course.id'})) { - if ($env{'course.'.$env{'request.course.id'}.'.internal.showphotos'}) { + if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) { if ($udom eq $env{'course.'.$env{'request.course.id'}.'.domain'}) { return(&retrievestudentphoto($udom,$unam,$ext)); } else { @@ -3450,16 +3450,17 @@ sub allowed { return 'F'; } +sub split_uri_for_cond { + my $uri=&deversion(&declutter(shift)); + my @uriparts=split(/\//,$uri); + my $filename=pop(@uriparts); + my $pathname=join('/',@uriparts); + return ($pathname,$filename); +} # --------------------------------------------------- Is a resource on the map? sub is_on_map { - my $uri=&deversion(&declutter(shift)); - my @uriparts=split(/\//,$uri); - my $filename=$uriparts[$#uriparts]; - my $pathname=$uri; - $pathname=~s|/\Q$filename\E$||; - $pathname=~s/^adm\/wrapper\///; - $pathname=~s/^adm\/coursedocs\/showdoc\///; + my ($pathname,$filename) = &split_uri_for_cond(shift); #Trying to find the conditional for the file my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~ /\&\Q$filename\E\:([\d\|]+)\&/); @@ -3737,6 +3738,9 @@ sub auto_photo_permission { my $homeserver = &homeserver($cnum,$cdom); my ($outcome,$perm_reqd,$conditions) = split(/:/,&unescape(&reply('autophotopermission:'.$cdom,$homeserver)),3); + if ($outcome =~ /^(con_lost|unknown_cmd|no_such_host)$/) { + return (undef,undef); + } return ($outcome,$perm_reqd,$conditions); } @@ -3747,6 +3751,9 @@ sub auto_checkphotos { my $outcome = &unescape(&reply('autophotocheck:'.&escape($udom).':'. &escape($uname).':'.&escape($pid), $homeserver)); + if ($outcome =~ /^(con_lost|unknown_cmd|no_such_host)$/) { + return (undef,undef); + } if ($outcome) { ($result,$resulttype) = split(/:/,$outcome); } @@ -3759,6 +3766,9 @@ sub auto_photochoice { my ($update,$comment) = split(/:/,&unescape(&reply('autophotochoice:'. &escape($cdom), $homeserver))); + if ($update =~ /^(con_lost|unknown_cmd|no_such_host)$/) { + return (undef,undef); + } return ($update,$comment); }