version 1.156, 2002/09/16 12:52:33
|
version 1.160, 2002/11/03 19:03:29
|
Line 171 string that holds portions of the screen
|
Line 171 string that holds portions of the screen
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
# |
# |
|
|
|
my $loaderror=&Apache::lonnet::overloaderror($r); |
|
if ($loaderror) { return $loaderror; } |
|
|
my $closebutton; # button that closes the search window |
my $closebutton; # button that closes the search window |
# This button is different for the RAT compared to |
# This button is different for the RAT compared to |
# normal invocation. |
# normal invocation. |
Line 187 sub handler {
|
Line 191 sub handler {
|
## |
## |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['catalogmode','launch','acts','mode','form','element','pause', |
['catalogmode','launch','acts','mode','form','element','pause', |
'phase','persistent_db_id','table','start','show']); |
'phase','persistent_db_id','table','start','show', |
|
'cleargroupsort']); |
## |
## |
## The following is a trick - we wait a few seconds if asked to so |
## The following is a trick - we wait a few seconds if asked to so |
## the daemon running the search can get ahead of the daemon |
## the daemon running the search can get ahead of the daemon |
Line 238 END
|
Line 243 END
|
## Clear out old values from groupsearch database |
## Clear out old values from groupsearch database |
## |
## |
untie %groupsearch_db if (tied(%groupsearch_db)); |
untie %groupsearch_db if (tied(%groupsearch_db)); |
if (($ENV{'form.launch'} eq '1') && |
if (($ENV{'form.cleargroupsort'} eq '1') || |
($ENV{'form.catalogmode'} eq 'groupsearch')) { |
(($ENV{'form.launch'} eq '1') && |
|
($ENV{'form.catalogmode'} eq 'groupsearch'))) { |
if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
&start_fresh_session(); |
&start_fresh_session(); |
untie %groupsearch_db; |
untie %groupsearch_db; |
|
delete($ENV{'form.cleargroupsort'}); |
} else { |
} else { |
# This is a stupid error to give to the user. |
# This is a stupid error to give to the user. |
# It really tells them nothing. |
# It really tells them nothing. |
Line 432 ENDDOCUMENT
|
Line 439 ENDDOCUMENT
|
' '; |
' '; |
my $checkbox = &simplecheckbox('related',$ENV{'form.related'}); |
my $checkbox = &simplecheckbox('related',$ENV{'form.related'}); |
$scrout.=<<END; |
$scrout.=<<END; |
</td><td><a href="/adm/searchcat?phase=disp_adv">Advanced Search</a></td></tr> |
</td><td><a |
|
href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}" |
|
>Advanced Search</a></td></tr> |
<tr><td>$checkbox use related words</td><td></td></tr> |
<tr><td>$checkbox use related words</td><td></td></tr> |
</table> |
</table> |
</p> |
</p> |
Line 1867 sub revise_button {
|
Line 1876 sub revise_button {
|
$revise_phase = 'disp_adv' if ($ENV{'form.searchmode'} eq 'advanced'); |
$revise_phase = 'disp_adv' if ($ENV{'form.searchmode'} eq 'advanced'); |
my $newloc = '/adm/searchcat'. |
my $newloc = '/adm/searchcat'. |
'?persistent_db_id='.$ENV{'form.persistent_db_id'}. |
'?persistent_db_id='.$ENV{'form.persistent_db_id'}. |
|
'&cleargroupsort=1'. |
'&phase='.$revise_phase; |
'&phase='.$revise_phase; |
my $result = qq{<input type="button" value="Revise search" name="revise"} . |
my $result = qq{<input type="button" value="Revise search" name="revise"} . |
qq{ onClick="parent.location='$newloc';" /> }; |
qq{ onClick="parent.location='$newloc';" /> }; |
Line 1968 END
|
Line 1978 END
|
my $time_remaining = $max_time - (time - $starttime) ; |
my $time_remaining = $max_time - (time - $starttime) ; |
my $last_time = $time_remaining; |
my $last_time = $time_remaining; |
&update_seconds($r,$time_remaining); |
&update_seconds($r,$time_remaining); |
while (($time_remaining > 0) && |
while (($time_remaining > 0) && |
((@Servers_to_contact) || keys(%Server_status))) { |
((@Servers_to_contact) || keys(%Server_status))) { |
# Send out a search request if it needs to be done. |
# Send out a search request if it needs to be done. |
if (@Servers_to_contact) { |
if (@Servers_to_contact) { |
Line 1986 END
|
Line 1996 END
|
# left to contact. |
# left to contact. |
sleep(1); |
sleep(1); |
} |
} |
&update_status($r,'waiting on '.(join(' ',keys(%Server_status)))); |
# |
|
if (scalar (keys(%Server_status))) { |
|
&update_status($r,'waiting on '.(join(' ',keys(%Server_status)))); |
|
} |
|
# |
|
# Loop through the servers we have contacted but do not |
|
# have results from yet, looking for results. |
while (my ($server,$status) = each(%Server_status)) { |
while (my ($server,$status) = each(%Server_status)) { |
last if ($connection->aborted()); |
last if ($connection->aborted()); |
if ($status eq 'con_lost') { |
if ($status eq 'con_lost') { |
Line 2049 END
|
Line 2065 END
|
} |
} |
last if ($connection->aborted()); |
last if ($connection->aborted()); |
# Finished looping through the servers |
# Finished looping through the servers |
|
$starttime = time if (@Servers_to_contact); |
$time_remaining = $max_time - (time - $starttime) ; |
$time_remaining = $max_time - (time - $starttime) ; |
if ($last_time - $time_remaining > 0) { |
if ($last_time - $time_remaining > 0) { |
$last_time = $time_remaining; |
$last_time = $time_remaining; |
Line 2140 sub display_results {
|
Line 2157 sub display_results {
|
return; |
return; |
} |
} |
## |
## |
|
## $checkbox_num is a count of the number of checkboxes output on the |
|
## page this is used only during catalogmode=groupsearch. |
|
my $checkbox_num = 0; |
|
## |
## Get the catalog controls setup |
## Get the catalog controls setup |
## |
## |
my $action = "/adm/searchcat?phase=results"; |
my $action = "/adm/searchcat?phase=results"; |
Line 2218 sub display_results {
|
Line 2239 sub display_results {
|
} |
} |
my %Fields = %{&parse_row(@$row)}; |
my %Fields = %{&parse_row(@$row)}; |
my $output="<p>\n"; |
my $output="<p>\n"; |
my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'}); |
my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'}, |
|
$Fields{'id'},$checkbox_num++); |
# Render the result into html |
# Render the result into html |
$output.= &$viewfunction($prefix,%Fields); |
$output.= &$viewfunction($prefix,%Fields); |
# Print them out as they come in. |
# Print them out as they come in. |
Line 2249 sub display_results {
|
Line 2271 sub display_results {
|
|
|
=pod |
=pod |
|
|
=item &catalogmode_output($title,$url) |
=item &catalogmode_output($title,$url,$fnum,$checkbox_num) |
|
|
Returns html needed for the various catalog modes. Gets inputs from |
Returns html needed for the various catalog modes. Gets inputs from |
$ENV{'form.catalogmode'}. Stores data in %groupsearch_db and $fnum |
$ENV{'form.catalogmode'}. Stores data in %groupsearch_db. |
(local variable). |
|
|
|
=cut |
=cut |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
{ |
|
my $fnum = 0; |
|
|
|
sub catalogmode_output { |
sub catalogmode_output { |
my $output = ''; |
my $output = ''; |
my ($title,$url) = @_; |
my ($title,$url,$fnum,$checkbox_num) = @_; |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
$title=~ s/\'/\\\'/g; |
$title=~ s/\'/\\\'/g; |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
Line 2280 END
|
Line 2298 END
|
$output.=<<END; |
$output.=<<END; |
<font size='-1'> |
<font size='-1'> |
<input type="checkbox" name="returnvalues" value="SELECT" |
<input type="checkbox" name="returnvalues" value="SELECT" |
onClick="javascript:queue($fnum)" /> |
onClick="javascript:queue($checkbox_num,$fnum)" /> |
</font> |
</font> |
END |
END |
$fnum++; |
|
} |
} |
return $output; |
return $output; |
} |
} |
|
|
} |
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
|
|
Line 2536 SCRIPT
|
Line 2551 SCRIPT
|
} |
} |
$result.=<<SCRIPT if $ENV{'form.catalogmode'} eq 'groupsearch'; |
$result.=<<SCRIPT if $ENV{'form.catalogmode'} eq 'groupsearch'; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function queue(val) { |
function queue(checkbox_num,val) { |
if (document.forms.results.returnvalues[val].checked) { |
if (document.forms.results.returnvalues[checkbox_num].checked) { |
parent.statusframe.document.forms.statusform.elements.Queue.value +='1a'+val+'b'; |
parent.statusframe.document.forms.statusform.elements.Queue.value +='1a'+val+'b'; |
} else { |
} else { |
parent.statusframe.document.forms.statusform.elements.Queue.value +='0a'+val+'b'; |
parent.statusframe.document.forms.statusform.elements.Queue.value +='0a'+val+'b'; |
Line 2592 sub print_frames_interface {
|
Line 2607 sub print_frames_interface {
|
<head> |
<head> |
<script> |
<script> |
var targetwin = opener; |
var targetwin = opener; |
|
var queue = ''; |
</script> |
</script> |
<title>LON-CAPA Digital Library Search Results</title> |
<title>LON-CAPA Digital Library Search Results</title> |
</head> |
</head> |