--- loncom/interface/lonsearchcat.pm 2001/04/02 13:15:26 1.91 +++ loncom/interface/lonsearchcat.pm 2001/04/02 16:57:38 1.92 @@ -623,14 +623,14 @@ sub advancedsearch { $customquery,$customshow); &output_results('Advanced',$r,$envhash,$customquery,$reply); } - $r->print(' '); # just in case.. hrrmm.. - return OK; + # should not get to this point + return 'Error. Should not have gone to this point.'; } # ---------------------------------------------------- see if a field is filled sub filled { my ($field)=@_; - if ($field=~/\S/) { + if ($field=~/\S/ && $field ne 'any') { return 1; } else { @@ -706,24 +706,85 @@ RESULTS # ----------------------------- format and output results based on a reply list sub output_results { - my ($mode,$r,$envhash,$query,@replylist)=@_; + my ($mode,$r,$envhash,$query,$replyref)=@_; my %ENV=%{$envhash}; + my %rhash=%{$replyref}; my $compiledresult=''; + my $timeremain=30; + $r->print(< + +The LearningOnline Network with CAPA +BEGINNING + $r->print(< + function select_data(title,url) { + changeTitle(title); + changeURL(url); + } + function changeTitle(val) { + if (opener.inf.document.forms.resinfo.elements.t) { + opener.inf.document.forms.resinfo.elements.t.value=val; + } + } + function changeURL(val) { + if (opener.inf.document.forms.resinfo.elements.u) { + opener.inf.document.forms.resinfo.elements.u.value=val; + } + } + +SCRIPT + $r->print(< + + +

Search Catalog

+CATALOGBEGIN + $r->rflush(); + $r->print(< + popwin=open('','popwin','width=400,height=200'); + popwin.document.writeln(''+ + '

Search Results Progress

'+ + '
'+ + '
Server space '+ + '
Status '+ + '
Maximum remaining time '+ + '
'+ + ''); + popwin.document.close(); + +ENDPOP + $r->rflush(); - foreach my $reply (@replylist) { - + my $servernum=(keys %rhash)+0; + $r->print(''); + $r->rflush(); + foreach my $rkey (keys %rhash) { + $r->print(''); + $r->rflush(); + my $reply=$rhash{$rkey}; my @results; - + my $replyfile=''; $reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1; $reply=~/(.*?)\_/; my $hostname=$1; - sleep 3; # temporary fix, need to check for completion and status { while (1) { - last if -e $replyfile; + $r->print('') if -e $replyfile; + $r->rflush(); + last if -e "$replyfile.end"; + last unless $timeremain; sleep 1; + $timeremain--; + $r->print(''); + $r->rflush(); } # QUESTION: how should I handle this error condition.. # I'm sure there is syntax elsewhere I can use.. @@ -829,34 +890,7 @@ END # make query information persistent to allow for subsequent revision my $persistent=&make_persistent(); - $r->print(< - -The LearningOnline Network with CAPA -BEGINNING - $r->print(< - function select_data(title,url) { - changeTitle(title); - changeURL(url); - } - function changeTitle(val) { - if (opener.inf.document.forms.resinfo.elements.t) { - opener.inf.document.forms.resinfo.elements.t.value=val; - } - } - function changeURL(val) { - if (opener.inf.document.forms.resinfo.elements.u) { - opener.inf.document.forms.resinfo.elements.u.value=val; - } - } - -SCRIPT $r->print(< - - -

Search Catalog

$customdata RESULTS } + $r->print(''); $r->rflush(); } # ------------------------------------------------------------- build_SQL_query