version 1.256, 2006/03/15 20:56:16
|
version 1.259, 2006/03/21 21:07:31
|
Line 116 sub handler {
|
Line 116 sub handler {
|
my $diropendb; # The full path to the (temporary) search database file. |
my $diropendb; # The full path to the (temporary) search database file. |
# This is set and used in &handler() and is also used in |
# This is set and used in &handler() and is also used in |
# &output_results(). |
# &output_results(). |
my $bodytag; # LON-CAPA standard body tag, gotten from |
|
# &Apache::lonnet::bodytag. |
|
# No title, no table, just a <body> tag. |
|
|
|
my $loaderror=&Apache::lonnet::overloaderror($r); |
my $loaderror=&Apache::lonnet::overloaderror($r); |
if ($loaderror) { return $loaderror; } |
if ($loaderror) { return $loaderror; } |
Line 165 sub handler {
|
Line 162 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 202 sub handler {
|
Line 199 sub handler {
|
'We were unable to retrieve data describing your search. '. |
'We were unable to retrieve data describing your search. '. |
'This is a serious error and has been logged. '. |
'This is a serious error and has been logged. '. |
'Please alert your LON-CAPA administrator.'; |
'Please alert your LON-CAPA administrator.'; |
return &error_page($r,$msg); |
return &Apache::loncommon::simple_error_page($r,'Search Error', |
|
$msg); |
} |
} |
} |
} |
} else { |
} else { |
Line 223 sub handler {
|
Line 221 sub handler {
|
# 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. |
my $msg = 'Unable to tie hash to db file.'; |
my $msg = 'Unable to tie hash to db file.'; |
return &error_page($r,$msg); |
return &Apache::loncommon::simple_error_page($r,'Search Error', |
|
$msg); |
} |
} |
} |
} |
## |
## |
Line 364 END
|
Line 363 END
|
my $msg = |
my $msg = |
'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.'; |
return &error_page($r,$msg); |
return &Apache::loncommon::simple_error_page($r,'Search Error', |
|
$msg); |
} |
} |
delete($env{'form.launch'}); |
delete($env{'form.launch'}); |
if (! &make_form_data_persistent($r,$persistent_db_file)) { |
if (! &make_form_data_persistent($r,$persistent_db_file)) { |
my $msg= |
my $msg= |
'Unable to properly store search information. '. |
'Unable to properly store search information. '. |
'The search has been aborted.'; |
'The search has been aborted.'; |
return &error_page($r,$msg); |
return &Apache::loncommon::simple_error_page($r,'Search Error', |
|
$msg); |
} |
} |
## |
## |
## Print out the frames interface |
## Print out the frames interface |
Line 383 END
|
Line 384 END
|
return OK; |
return OK; |
} |
} |
|
|
sub error_page { |
|
my ($r,$msg) = @_; |
|
$r->print(&Apache::loncommon::start_page('Search Error'). |
|
&mt($msg). |
|
&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
|
|
|
# |
# |
# The mechanism used to store values away and retrieve them does not |
# The mechanism used to store values away and retrieve them does not |
# handle the case of missing environment variables being significant. |
# handle the case of missing environment variables being significant. |
Line 2065 a link to change the search query.
|
Line 2058 a link to change the search query.
|
###################################################################### |
###################################################################### |
sub print_sort_form { |
sub print_sort_form { |
my ($r,$pretty_query_string) = @_; |
my ($r,$pretty_query_string) = @_; |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1). |
|
&Apache::lonhtmlcommon::breadcrumbs |
|
(undef,'Searching','Searching',undef,undef, |
|
$env{'form.catalogmode'} ne 'groupsearch'); |
|
|
|
## |
## |
my %SortableFields=&Apache::lonlocal::texthash( |
my %SortableFields=&Apache::lonlocal::texthash( |
Line 2101 sub print_sort_form {
|
Line 2090 sub print_sort_form {
|
&Apache::lonnet::logthis(&Apache::lonmysql::get_error()); |
&Apache::lonnet::logthis(&Apache::lonmysql::get_error()); |
return; |
return; |
} |
} |
my $result; |
my $js =<<END; |
my $html = &Apache::lonxml::xmlbegin(); |
<script type="text/javascript"> |
my $head = &Apache::lonxml::headtag('Results'); |
|
my $end_head = &Apache::loncommon::endheadtag(); |
|
$result.=<<END; |
|
$html |
|
$head |
|
<script> |
|
function change_sort() { |
function change_sort() { |
var newloc = "/adm/searchcat?phase=results"; |
var newloc = "/adm/searchcat?phase=results"; |
newloc += "&persistent_db_id=$env{'form.persistent_db_id'}"; |
newloc += "&persistent_db_id=$env{'form.persistent_db_id'}"; |
Line 2117 $head
|
Line 2100 $head
|
parent.resultsframe.location= newloc; |
parent.resultsframe.location= newloc; |
} |
} |
</script> |
</script> |
$end_head |
END |
$bodytag |
|
<form name="statusform" action="" method="post"> |
my $start_page = &Apache::loncommon::start_page('Results',$js, |
|
{'only_body' => 1}); |
|
my $breadcrumbs= |
|
&Apache::lonhtmlcommon::breadcrumbs |
|
(undef,'Searching','Searching',undef,undef, |
|
$env{'form.catalogmode'} ne 'groupsearch'); |
|
|
|
my $result = <<END; |
|
$start_page |
|
$breadcrumbs |
|
<form name="statusform" action="" method="POST"> |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
END |
END |
|
|
Line 2335 results into MySQL.
|
Line 2328 results into MySQL.
|
###################################################################### |
###################################################################### |
sub run_search { |
sub run_search { |
my ($r,$query,$customquery,$customshow,$serverlist,$pretty_string) = @_; |
my ($r,$query,$customquery,$customshow,$serverlist,$pretty_string) = @_; |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); |
|
$bodytag.=&Apache::lonhtmlcommon::breadcrumbs |
|
(undef,'Searching','Searching',undef,undef, |
|
$env{'form.catalogmode'} ne 'groupsearch'); |
|
my $connection = $r->connection; |
my $connection = $r->connection; |
# |
# |
# Print run_search header |
# Print run_search header |
# |
# |
my $html = &Apache::lonxml::xmlbegin(); |
my $start_page = &Apache::loncommon::start_page('Search Status',undef, |
my $head = &Apache::loncommon::head('Search Status'); |
{'only_body' => 1}); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs |
|
(undef,'Searching','Searching',undef,undef, |
|
$env{'form.catalogmode'} ne 'groupsearch'); |
$r->print(<<END); |
$r->print(<<END); |
$html |
$start_page |
$head |
$breadcrumbs |
$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 2998 the name of the input field to put the t
|
Line 2990 the name of the input field to put the t
|
###################################################################### |
###################################################################### |
sub search_results_header { |
sub search_results_header { |
my ($importbutton,$closebutton) = @_; |
my ($importbutton,$closebutton) = @_; |
my $result = |
|
&Apache::lonxml::xmlbegin(). |
|
&Apache::loncommon::headtag(); |
|
|
|
|
my $js; |
# output beginning of search page |
# output beginning of search page |
# conditional output of script functions dependent on the mode in |
# conditional output of script functions dependent on the mode in |
# which the search was invoked |
# which the search was invoked |
if ($env{'form.catalogmode'} eq 'interactive'){ |
if ($env{'form.catalogmode'} eq 'interactive'){ |
if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') { |
if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') { |
$result.=<<SCRIPT; |
$js.=<<SCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function select_data(title,url) { |
function select_data(title,url) { |
changeTitle(title); |
changeTitle(title); |
Line 3046 function changeTitle(val) {
|
Line 3036 function changeTitle(val) {
|
END |
END |
} |
} |
|
|
$result.=<<SCRIPT; |
$js.=<<SCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function select_data(title,url) { |
function select_data(title,url) { |
changeURL(url); |
changeURL(url); |
Line 3066 function changeURL(val) {
|
Line 3056 function changeURL(val) {
|
SCRIPT |
SCRIPT |
} |
} |
} |
} |
$result.=<<SCRIPT if $env{'form.catalogmode'} eq 'groupsearch'; |
$js.=<<SCRIPT if $env{'form.catalogmode'} eq 'groupsearch'; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function queue(checkbox_num,val) { |
function queue(checkbox_num,val) { |
if (document.forms.results.returnvalues.length != "undefined" && |
if (document.forms.results.returnvalues.length != "undefined" && |
Line 3092 SCRIPT
|
Line 3082 SCRIPT
|
</script> |
</script> |
SCRIPT |
SCRIPT |
|
|
my $end_head = &Apache::loncommon::endheadtag(); |
my $start_page = &Apache::loncommon::start_page(undef,$js, |
my $bodytag = &Apache::loncommon::bodytag(undef,undef,undef,1); |
{'only_body' =>1}); |
$result.=<<END; |
my $result=<<END; |
$end_head |
$start_page |
$bodytag |
|
<form name="results" method="post" action="/adm/searchcat" > |
<form name="results" method="post" action="/adm/searchcat" > |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
$importbutton |
$importbutton |
Line 3107 END
|
Line 3096 END
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub search_status_header { |
sub search_status_header { |
my $bodytag = &Apache::loncommon::bodytag(undef,undef,undef,1); |
my $start_page = &Apache::loncommon::start_page('Search Status',undef, |
my $html = &Apache::lonxml::xmlbegin(); |
{'only_body' => 1}); |
my $head = &Apache::loncommon::head('Search Status'); |
|
return <<ENDSTATUS; |
return <<ENDSTATUS; |
$html |
$start_page |
$head |
|
$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 3621 $parms is extra information to include i
|
Line 3607 $parms is extra information to include i
|
###################################################################### |
###################################################################### |
sub output_blank_field_error { |
sub output_blank_field_error { |
my ($r,$closebutton,$parms,$hidden_fields)=@_; |
my ($r,$closebutton,$parms,$hidden_fields)=@_; |
my $bodytag=&Apache::loncommon::bodytag('Search'); |
|
my $errormsg = &mt('You did not fill in enough information for the search to be started. You need to fill in relevant fields on the search page in order for a query to be processed.'); |
my $errormsg = &mt('You did not fill in enough information for the search to be started. You need to fill in relevant fields on the search page in order for a query to be processed.'); |
my $revise = &mt('Revise Search Request'); |
my $revise = &mt('Revise Search Request'); |
my $heading = &mt('Unactionable Search Queary'); |
my $heading = &mt('Unactionable Search Queary'); |