version 1.154, 2002/08/21 17:18:08
|
version 1.158, 2002/09/16 20:57:28
|
Line 115 that produces it. Adding a new view typ
|
Line 115 that produces it. Adding a new view typ
|
adding a line to the definition of this hash and making sure the function |
adding a line to the definition of this hash and making sure the function |
takes the proper parameters. |
takes the proper parameters. |
|
|
|
=item $bodytag |
|
|
|
LON-CAPA standard body tag, gotten from &Apache::lonnet::bodytag. |
|
No title, no table, just a <body> tag. |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 136 my %Views = ("Detailed Citation View" =>
|
Line 141 my %Views = ("Detailed Citation View" =>
|
"Compact View" => \&compact_view); |
"Compact View" => \&compact_view); |
my %persistent_db; |
my %persistent_db; |
my $hidden_fields; |
my $hidden_fields; |
|
my $bodytag; |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
|
|
Line 164 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 171 sub handler {
|
Line 182 sub handler {
|
$r->content_type('text/html'); |
$r->content_type('text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
|
## |
|
## Prevent caching of the search interface window. Hopefully this means |
|
## we will get the launch=1 passed in a little more. |
|
&Apache::loncommon::no_cache($r); |
## |
## |
## Pick up form fields passed in the links. |
## Pick up form fields passed in the links. |
## |
## |
&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 201 sub handler {
|
Line 217 sub handler {
|
($ENV{'form.launch'} eq '1')) { |
($ENV{'form.launch'} eq '1')) { |
$ENV{'form.persistent_db_id'} = time; |
$ENV{'form.persistent_db_id'} = time; |
} |
} |
|
$bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); |
my $persistent_db_file = "/home/httpd/perl/tmp/". |
my $persistent_db_file = "/home/httpd/perl/tmp/". |
&Apache::lonnet::escape($domain). |
&Apache::lonnet::escape($domain). |
'_'.&Apache::lonnet::escape($ENV{'user.name'}). |
'_'.&Apache::lonnet::escape($ENV{'user.name'}). |
Line 213 sub handler {
|
Line 230 sub handler {
|
$r->print(<<END); |
$r->print(<<END); |
<html> |
<html> |
<head><title>LON-CAPA Search Error</title></head> |
<head><title>LON-CAPA Search Error</title></head> |
<body> |
$bodytag |
We were unable to retrieve data describing your search. This is a serious |
We were unable to retrieve data describing your search. This is a serious |
error and has been logged. Please alert your LON-CAPA administrator. |
error and has been logged. Please alert your LON-CAPA administrator. |
</body> |
</body> |
Line 226 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.phase'} eq 'results')) { |
($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 { |
$r->print('<html><head></head><body>Unable to tie hash to db '. |
# This is a stupid error to give to the user. |
'file</body></html>'); |
# It really tells them nothing. |
|
$r->print('<html><head></head>'.$bodytag. |
|
'Unable to tie hash to db file</body></html>'); |
return OK; |
return OK; |
} |
} |
} |
} |
Line 329 END
|
Line 349 END
|
if (! defined(&create_results_table())) { |
if (! defined(&create_results_table())) { |
$r->print(<<END); |
$r->print(<<END); |
<html><head><title>Search Error</title></head> |
<html><head><title>Search Error</title></head> |
<body> |
$bodytag |
Unable to create table in which to store search results. |
Unable to create table in which to store search results. |
The search has been aborted. |
The search has been aborted. |
</body> |
</body> |
Line 341 END
|
Line 361 END
|
if (! &make_form_data_persistent($r,$persistent_db_file)) { |
if (! &make_form_data_persistent($r,$persistent_db_file)) { |
$r->print(<<END); |
$r->print(<<END); |
<html><head><title>Search Error</title></head> |
<html><head><title>Search Error</title></head> |
<body> |
$bodytag |
Unable to properly store search information. The search has been aborted. |
Unable to properly store search information. The search has been aborted. |
</body> |
</body> |
</html> |
</html> |
Line 1667 sub print_sort_form {
|
Line 1687 sub print_sort_form {
|
</script> |
</script> |
<title>Results</title> |
<title>Results</title> |
</head> |
</head> |
<body> |
$bodytag |
<form name="statusform" action="" method="post"> |
<form name="statusform" action="" method="post"> |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
END |
END |
Line 1854 sub revise_button {
|
Line 1874 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 1885 sub run_search {
|
Line 1906 sub run_search {
|
$r->print(<<END); |
$r->print(<<END); |
<html> |
<html> |
<head><title>Search Status</title></head> |
<head><title>Search Status</title></head> |
<body> |
$bodytag |
<form name="statusform" action="" method="post"> |
<form name="statusform" action="" method="post"> |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
END |
END |
Line 2127 sub display_results {
|
Line 2148 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 2205 sub display_results {
|
Line 2230 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 2236 sub display_results {
|
Line 2262 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 2267 END
|
Line 2289 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 2523 SCRIPT
|
Line 2542 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 2539 SCRIPT
|
Line 2558 SCRIPT
|
SCRIPT |
SCRIPT |
$result.=<<END; |
$result.=<<END; |
</head> |
</head> |
|
$bodytag |
<form name="results" method="post" action="" > |
<form name="results" method="post" action="" > |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
$importbutton |
$importbutton |
Line 2551 END
|
Line 2571 END
|
sub search_status_header { |
sub search_status_header { |
return <<ENDSTATUS; |
return <<ENDSTATUS; |
<html><head><title>Search Status</title></head> |
<html><head><title>Search Status</title></head> |
<body> |
$bodytag |
<h3>Search Status</h3> |
<h3>Search Status</h3> |
Sending search request to LON-CAPA servers.<br /> |
Sending search request to LON-CAPA servers.<br /> |
ENDSTATUS |
ENDSTATUS |
Line 2578 sub print_frames_interface {
|
Line 2598 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> |
Line 2823 sub output_blank_field_error {
|
Line 2844 sub output_blank_field_error {
|
BEGINNING |
BEGINNING |
$r->print(<<RESULTS); |
$r->print(<<RESULTS); |
</head> |
</head> |
<body bgcolor="#ffffff"> |
$bodytag |
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<h1>Search Catalog</h1> |
<h1>Search Catalog</h1> |
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |
Line 2870 sub output_date_error {
|
Line 2891 sub output_date_error {
|
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
<body bgcolor="#ffffff"> |
$bodytag |
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<h1>Search Catalog</h1> |
<h1>Search Catalog</h1> |
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |