version 1.91, 2001/04/02 13:15:26
|
version 1.92, 2001/04/02 16:57:38
|
Line 623 sub advancedsearch {
|
Line 623 sub advancedsearch {
|
$customquery,$customshow); |
$customquery,$customshow); |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
} |
} |
$r->print(' '); # just in case.. hrrmm.. |
# should not get to this point |
return OK; |
return 'Error. Should not have gone to this point.'; |
} |
} |
|
|
# ---------------------------------------------------- see if a field is filled |
# ---------------------------------------------------- see if a field is filled |
sub filled { |
sub filled { |
my ($field)=@_; |
my ($field)=@_; |
if ($field=~/\S/) { |
if ($field=~/\S/ && $field ne 'any') { |
return 1; |
return 1; |
} |
} |
else { |
else { |
Line 706 RESULTS
|
Line 706 RESULTS
|
|
|
# ----------------------------- format and output results based on a reply list |
# ----------------------------- format and output results based on a reply list |
sub output_results { |
sub output_results { |
my ($mode,$r,$envhash,$query,@replylist)=@_; |
my ($mode,$r,$envhash,$query,$replyref)=@_; |
my %ENV=%{$envhash}; |
my %ENV=%{$envhash}; |
|
my %rhash=%{$replyref}; |
my $compiledresult=''; |
my $compiledresult=''; |
|
my $timeremain=30; |
|
$r->print(<<BEGINNING); |
|
<html> |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
BEGINNING |
|
$r->print(<<SCRIPT) if $ENV{'form.catalogmode'} eq 'interactive'; |
|
<script> |
|
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> |
|
SCRIPT |
|
$r->print(<<CATALOGBEGIN); |
|
</head> |
|
<body bgcolor="#ffffff"> |
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>Search Catalog</h1> |
|
CATALOGBEGIN |
|
$r->rflush(); |
|
$r->print(<<ENDPOP); |
|
<script> |
|
popwin=open('','popwin','width=400,height=200'); |
|
popwin.document.writeln('<html><body bgcolor="#FFFFFF">'+ |
|
'<h3>Search Results Progress</h3>'+ |
|
'<form name=popremain>'+ |
|
'<br />Server space <input type=text size=25 name=space value="">'+ |
|
'<br />Status <input type=text size=25 name=status value="">'+ |
|
'<br />Maximum remaining time <input type=text size=25 name=timeout value="30">'+ |
|
'</form>'+ |
|
'</body></html>'); |
|
popwin.document.close(); |
|
</script> |
|
ENDPOP |
|
$r->rflush(); |
|
|
foreach my $reply (@replylist) { |
my $servernum=(keys %rhash)+0; |
|
$r->print('<script>popwin.document.popremain.space.value="'. |
|
$servernum.', 0%, count=0/1";</script>'); |
|
$r->rflush(); |
|
foreach my $rkey (keys %rhash) { |
|
$r->print('<script>popwin.document.popremain.status.value="'. |
|
$rkey.', trying contact";</script>'); |
|
$r->rflush(); |
|
my $reply=$rhash{$rkey}; |
my @results; |
my @results; |
|
|
my $replyfile=''; |
my $replyfile=''; |
$reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting |
$reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting |
$replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1; |
$replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1; |
$reply=~/(.*?)\_/; |
$reply=~/(.*?)\_/; |
my $hostname=$1; |
my $hostname=$1; |
sleep 3; # temporary fix, need to check for completion and status |
|
{ |
{ |
while (1) { |
while (1) { |
last if -e $replyfile; |
$r->print('<script>popwin.document.popremain.status.value="'. |
|
$rkey.', contacted";</script>') if -e $replyfile; |
|
$r->rflush(); |
|
last if -e "$replyfile.end"; |
|
last unless $timeremain; |
sleep 1; |
sleep 1; |
|
$timeremain--; |
|
$r->print('<script>popwin.document.popremain.timeout.value="'. |
|
$timeremain.'";</script>'); |
|
$r->rflush(); |
} |
} |
# QUESTION: how should I handle this error condition.. |
# QUESTION: how should I handle this error condition.. |
# I'm sure there is syntax elsewhere I can use.. |
# I'm sure there is syntax elsewhere I can use.. |
Line 829 END
|
Line 890 END
|
# make query information persistent to allow for subsequent revision |
# make query information persistent to allow for subsequent revision |
my $persistent=&make_persistent(); |
my $persistent=&make_persistent(); |
|
|
$r->print(<<BEGINNING); |
|
<html> |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
BEGINNING |
|
$r->print(<<SCRIPT) if $ENV{'form.catalogmode'} eq 'interactive'; |
|
<script> |
|
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> |
|
SCRIPT |
|
$r->print(<<RESULTS); |
$r->print(<<RESULTS); |
</head> |
|
<body bgcolor="#ffffff"> |
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>Search Catalog</h1> |
|
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |
$customdata |
$customdata |
<input type='button' value='Revise search request' |
<input type='button' value='Revise search request' |
Line 888 $compiledresult
|
Line 922 $compiledresult
|
</html> |
</html> |
RESULTS |
RESULTS |
} |
} |
|
$r->print('<script>popwin.close()</script>'); $r->rflush(); |
} |
} |
|
|
# ------------------------------------------------------------- build_SQL_query |
# ------------------------------------------------------------- build_SQL_query |