--- loncom/lonnet/perl/lonnet.pm 2007/08/02 20:40:13 1.903 +++ loncom/lonnet/perl/lonnet.pm 2007/08/10 23:02:36 1.906 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.903 2007/08/02 20:40:13 albertel Exp $ +# $Id: lonnet.pm,v 1.906 2007/08/10 23:02:36 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -862,16 +862,28 @@ sub inst_directory_query { my %results; my $homeserver = &domain($udom,'primary'); if ($homeserver ne '') { - my $response=&reply("instdirsrch:$udom".':'. - &escape($srch->{'srchby'}).':'. - &escape($srch->{'srchterm'}).':'. - $srch->{'srchtype'},$homeserver); - if ($response ne 'refused') { - my @matches = split(/&/,$response); + my $queryid=&reply("querysend:instdirsearch:". + &escape($srch->{'srchby'}).':'. + &escape($srch->{'srchterm'}).':'. + &escape($srch->{'srchtype'}),$homeserver); + my $host=&hostname($homeserver); + if ($queryid !~/^\Q$host\E\_/) { + &logthis('instituional directory search invalid queryid: '.$queryid.' for host: '.$homeserver.'in domain '.$udom); + return; + } + my $response = &get_query_reply($queryid); + my $maxtries = 5; + my $tries = 1; + while (($response=~/^timeout/) && ($tries < $maxtries)) { + $response = &get_query_reply($queryid); + $tries ++; + } + + if (!&error($response) && $response ne 'refused') { + my @matches = split(/\n/,$response); foreach my $match (@matches) { my ($key,$value) = split(/=/,$match); - my %userhash = &str2hash(&unescape($value)); - $results{&unescape($key).':'.$udom} = \%userhash; + $results{&unescape($key).':'.$udom} = &thaw_unescape($value); } } } @@ -4541,8 +4553,8 @@ sub get_query_reply { sleep 2; if (-e $replyfile.'.end') { if (open(my $fh,$replyfile)) { - $reply.=<$fh>; - close($fh); + $reply = join('',<$fh>); + close($fh); } else { return 'error: reply_file_error'; } return &unescape($reply); } @@ -6305,6 +6317,12 @@ sub EXT { my ($map) = &decode_symb($symbparm); return &symbread($map); } + if ($space eq 'filename') { + if ($symbparm) { + return &clutter((&decode_symb($symbparm))[2]); + } + return &hreflocation('',$env{'request.filename'}); + } my ($section, $group, @groups); my ($courselevelm,$courselevel); @@ -8550,7 +8568,7 @@ explanation of a user role term get_my_roles($uname,$udom,$context,$types,$roles,$roledoms) : All arguments are optional. Returns a hash of a roles, either for co-author/assistant author roles for a user's Construction Space -(default), or if $context is 'user', roles for the user himself, +(default), or if $context is 'userroles', roles for the user himself, In the hash, keys are set to colon-sparated $uname,$udom,and $role, and value is set to colon-separated start and end times for the role. If no username and domain are specified, will default to current