');
$r->rflush();
$r->print(<
@@ -759,9 +795,14 @@ ENDPOP
my $servernum=(keys %rhash)+0;
$r->print('');
+ $servernum.', 0%, count=0/'.$servernum.'";');
$r->rflush();
+ my $servercount=0;
foreach my $rkey (keys %rhash) {
+ $servercount++;
+ $tflag=1;
+ $compiledresult='';
+ my $hostname=$rkey;
$r->print('');
$r->rflush();
@@ -769,30 +810,40 @@ ENDPOP
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;
- {
- while (1) {
- $r->print('') if -e $replyfile;
- $r->rflush();
- last if -e "$replyfile.end";
- last unless $timeremain;
- sleep 1;
- $timeremain--;
- $r->print('');
- $r->rflush();
+
+ if ($reply eq 'con_lost') {
+ my $percent=sprintf('%3.0f',($servercount/$servernum*100));
+ $r->print('');
+ }
+ else {
+ $reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting
+ $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;
+ $reply=~/(.*?)\_/;
+ {
+ while (1) {
+ if (-e $replyfile && $tflag) {
+ $r->print('');
+ $r->rflush();
+ $tflag=0;
+ }
+ 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..
+ my $fh=Apache::File->new($replyfile) or
+ ($r->print('ERROR: file cannot be opened') and return OK);
+ @results=<$fh>;
}
- # QUESTION: how should I handle this error condition..
- # I'm sure there is syntax elsewhere I can use..
- my $fh=Apache::File->new($replyfile) or
- ($r->print('file cannot be opened') and return OK);
- @results=<$fh>;
}
-
my $customshow='';
my $extrashow='';
my @customfields;
@@ -800,7 +851,7 @@ ENDPOP
$customshow=$ENV{'form.customshow'};
$customshow=~s/[^\w\s]//g;
my @fields=map {"$_:"}
- split(/\s+/,$customshow);
+ split(/\s+/,$customshow);
@customfields=split(/\s+/,$customshow);
if ($customshow) {
$extrashow="
".join("
",@fields)."
\n";
@@ -822,8 +873,8 @@ ENDPOP
chomp $result;
next unless $result;
my @fields=map
- {&Apache::lonnet::unescape($_)}
- (split(/\,/,$result));
+ {&Apache::lonnet::unescape($_)}
+ (split(/\,/,$result));
my ($title,$author,$subject,$url,$keywords,$version,
$notes,$abstract,$mime,$lang,
$creationdate,$lastrevisiondate,$owner,$copyright)=@fields;
@@ -835,19 +886,19 @@ ENDPOP
foreach my $field (@customfields) {
my $value='';
if ($customhash{$url}=~/\<${field}[^\>]*\>(.*?)\<\/${field}[^\>]*\>/s) {
- $value=$1;
+ $value=$1;
}
- $extrashow2=~s/\<\!\-\- $field \-\-\>/ $value/g;
- }
- }
-
- $compiledresult.=</ $value/g;
+ }
+ }
+
+ $compiledresult.=<
END
- $compiledresult.=<
END
- $compiledresult.=<
@@ -855,74 +906,54 @@ onClick="javascript:select_data('$title'
END
my $httphost=$ENV{'HTTP_HOST'};
- my $viewselect;
- if ($mode eq 'Basic') {
+ my $viewselect;
+ if ($mode eq 'Basic') {
$viewselect=$ENV{'form.basicviewselect'};
}
- elsif ($mode eq 'Advanced') {
- $viewselect=$ENV{'form.advancedviewselect'};
- }
+ elsif ($mode eq 'Advanced') {
+ $viewselect=$ENV{'form.advancedviewselect'};
+ }
if ($viewselect eq 'Detailed Citation View') {
- $compiledresult.=&detailed_citation_view(@fields,
- $hostname,$httphost,
- $extrashow2);
+ $compiledresult.=&detailed_citation_view(@fields,
+ $hostname,$httphost,
+ $extrashow2);
}
elsif ($viewselect eq 'Summary View') {
$compiledresult.=&summary_view(@fields,$hostname,$httphost,
- $extrashow2);
+ $extrashow2);
}
elsif ($viewselect eq 'Fielded Format') {
$compiledresult.=&fielded_format_view(@fields,$hostname,
- $httphost,$extrashow2);
+ $httphost,$extrashow2);
}
elsif ($viewselect eq 'XML/SGML') {
$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost,
- $extrashow2);
+ $extrashow2);
}
-
+
}
- unless ($compiledresult) {
- $compiledresult="There were no results that matched your query";
+ if ($compiledresult) {
+ $resultflag=1;
}
- # make query information persistent to allow for subsequent revision
- my $persistent=&make_persistent();
-
- $r->print(<
-$customdata
-
-$closebutton
-$persistent
-
-
Search Query
-RESULTS
- if ($mode eq 'Basic') {
$r->print(<
-Basic search: $ENV{'form.basicexp'}
-
+$compiledresult
RESULTS
+ my $percent=sprintf('%3.0f',($servercount/$servernum*100));
+ $r->print('');
}
- elsif ($mode eq 'Advanced') {
- $r->print(<
-Advanced search
-$query
-
-RESULTS
+ unless ($resultflag) {
+ $r->print("\nThere were no results that matched your query\n");
}
- $r->print(<Search Results
-$compiledresult
+ $r->print(''); $r->rflush();
+ $r->print(<
RESULTS
- }
- $r->print(''); $r->rflush();
}
# ------------------------------------------------------------- build_SQL_query
@@ -964,6 +995,11 @@ sub recursive_SQL_query_build {
if ($key eq 'literal') {
$replacement="($dkey like \"\%$value\%\")";
}
+ elsif ($key eq 'not') {
+ $value=~s/like/not like/;
+# $replacement="($dkey not like $value)";
+ $replacement="$value";
+ }
elsif ($key eq 'and') {
$value=~/(.*[\"|\)]) ([|\(|\^].*)/;
$replacement="($1 AND $2)";