--- loncom/lonnet/perl/lonnet.pm 2007/08/10 23:02:36 1.906 +++ loncom/lonnet/perl/lonnet.pm 2007/09/25 00:26:20 1.910.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.906 2007/08/10 23:02:36 albertel Exp $ +# $Id: lonnet.pm,v 1.910.2.1 2007/09/25 00:26:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -861,6 +861,7 @@ sub inst_directory_query { my $udom = $srch->{'srchdomain'}; my %results; my $homeserver = &domain($udom,'primary'); + my $outcome; if ($homeserver ne '') { my $queryid=&reply("querysend:instdirsearch:". &escape($srch->{'srchby'}).':'. @@ -880,14 +881,19 @@ sub inst_directory_query { } if (!&error($response) && $response ne 'refused') { - my @matches = split(/\n/,$response); - foreach my $match (@matches) { - my ($key,$value) = split(/=/,$match); - $results{&unescape($key).':'.$udom} = &thaw_unescape($value); + if ($response eq 'unavailable') { + $outcome = $response; + } else { + $outcome = 'ok'; + my @matches = split(/\n/,$response); + foreach my $match (@matches) { + my ($key,$value) = split(/=/,$match); + $results{&unescape($key).':'.$udom} = &thaw_unescape($value); + } } } } - return %results; + return ($outcome,%results); } sub usersearch { @@ -1217,8 +1223,10 @@ sub do_cache_new { $time=600; } if ($debug) { &Apache::lonnet::logthis("Setting $id to $value"); } - if (!($memcache->set($id,$setvalue,$time))) { + my $result = $memcache->set($id,$setvalue,$time); + if (! $result) { &logthis("caching of id -> $id failed"); + $memcache->disconnect_all(); } # need to make a copy of $value #&make_room($id,$value,$debug); @@ -6696,10 +6704,11 @@ sub metadata { # only ws inside the tag, and not in default, so use default # as value $metaentry{':'.$unikey}=$default; - } else { - # either something interesting inside the tag or default - # uninteresting + } elsif ( $internaltext =~ /\S/ ) { + # something interesting inside the tag $metaentry{':'.$unikey}=$internaltext; + } else { + # no interesting values, don't set a default } # end of not-a-package not-a-library import } @@ -6839,12 +6848,15 @@ sub gettitle { } my ($map,$resid,$url)=&decode_symb($symb); my $title=''; - my %bighash; - if (tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db', - &GDBM_READER(),0640)) { - my $mapid=$bighash{'map_pc_'.&clutter($map)}; - $title=$bighash{'title_'.$mapid.'.'.$resid}; - untie %bighash; + if (!$map && $resid == 0 && $url =~/default\.sequence$/) { + $title = $env{'course.'.$env{'request.course.id'}.'.description'}; + } else { + if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', + &GDBM_READER(),0640)) { + my $mapid=$bighash{'map_pc_'.&clutter($map)}; + $title=$bighash{'title_'.$mapid.'.'.$resid}; + untie(%bighash); + } } $title=~s/\&colon\;/\:/gs; if ($title) { @@ -7723,6 +7735,9 @@ sub hreflocation { $file=~s-^/home/httpd/lonUsers/($match_domain)/./././($match_name)/userfiles/ -/uploaded/$1/$2/-x; } + if ($file=~ m{^/userfiles/}) { + $file =~ s{^/userfiles/}{/uploaded/}; + } return $file; }