--- loncom/interface/lonsearchcat.pm 2006/03/15 20:56:16 1.256 +++ loncom/interface/lonsearchcat.pm 2006/03/23 22:01:58 1.260 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.256 2006/03/15 20:56:16 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.260 2006/03/23 22:01:58 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -116,9 +116,6 @@ sub handler { my $diropendb; # The full path to the (temporary) search database file. # This is set and used in &handler() and is also used in # &output_results(). - my $bodytag; # LON-CAPA standard body tag, gotten from - # &Apache::lonnet::bodytag. - # No title, no table, just a tag. my $loaderror=&Apache::lonnet::overloaderror($r); if ($loaderror) { return $loaderror; } @@ -165,7 +162,7 @@ sub handler { ($env{'form.launch'} eq '1')) { $env{'form.persistent_db_id'} = time; } - $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); + my $persistent_db_file = "/home/httpd/perl/tmp/". &Apache::lonnet::escape($domain). '_'.&Apache::lonnet::escape($env{'user.name'}). @@ -202,7 +199,8 @@ sub handler { 'We were unable to retrieve data describing your search. '. 'This is a serious error and has been logged. '. 'Please alert your LON-CAPA administrator.'; - return &error_page($r,$msg); + return &Apache::loncommon::simple_error_page($r,'Search Error', + $msg); } } } else { @@ -223,7 +221,8 @@ sub handler { # This is a stupid error to give to the user. # It really tells them nothing. my $msg = 'Unable to tie hash to db file.'; - return &error_page($r,$msg); + return &Apache::loncommon::simple_error_page($r,'Search Error', + $msg); } } ## @@ -364,14 +363,16 @@ END my $msg = 'Unable to create table in which to store search results. '. 'The search has been aborted.'; - return &error_page($r,$msg); + return &Apache::loncommon::simple_error_page($r,'Search Error', + $msg); } delete($env{'form.launch'}); if (! &make_form_data_persistent($r,$persistent_db_file)) { my $msg= 'Unable to properly store search information. '. '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 @@ -383,14 +384,6 @@ END 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 # handle the case of missing environment variables being significant. @@ -2065,10 +2058,6 @@ a link to change the search query. ###################################################################### sub print_sort_form { 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( @@ -2101,14 +2090,8 @@ sub print_sort_form { &Apache::lonnet::logthis(&Apache::lonmysql::get_error()); return; } - my $result; - my $html = &Apache::lonxml::xmlbegin(); - my $head = &Apache::lonxml::headtag('Results'); - my $end_head = &Apache::loncommon::endheadtag(); - $result.=< + my $js =< function change_sort() { var newloc = "/adm/searchcat?phase=results"; newloc += "&persistent_db_id=$env{'form.persistent_db_id'}"; @@ -2117,9 +2100,19 @@ $head parent.resultsframe.location= newloc; } -$end_head -$bodytag -
+END + + 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 @@ -2335,20 +2328,19 @@ results into MySQL. ###################################################################### sub run_search { 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; # # Print run_search header # - my $html = &Apache::lonxml::xmlbegin(); - my $head = &Apache::loncommon::head('Search Status'); + my $start_page = &Apache::loncommon::start_page('Search Status',undef, + {'only_body' => 1}); + my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs + (undef,'Searching','Searching',undef,undef, + $env{'form.catalogmode'} ne 'groupsearch'); $r->print(< END @@ -2998,16 +2990,14 @@ the name of the input field to put the t ###################################################################### sub search_results_header { my ($importbutton,$closebutton) = @_; - my $result = - &Apache::lonxml::xmlbegin(). - &Apache::loncommon::headtag(); + my $js; # output beginning of search page # conditional output of script functions dependent on the mode in # which the search was invoked if ($env{'form.catalogmode'} eq 'interactive'){ if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') { - $result.=< function select_data(title,url) { changeTitle(title); @@ -3046,7 +3036,7 @@ function changeTitle(val) { END } - $result.=< function select_data(title,url) { changeURL(url); @@ -3066,7 +3056,7 @@ function changeURL(val) { SCRIPT } } - $result.=< SCRIPT - my $end_head = &Apache::loncommon::endheadtag(); - my $bodytag = &Apache::loncommon::bodytag(undef,undef,undef,1); - $result.=<1}); + my $result=< $importbutton @@ -3107,13 +3096,10 @@ END ###################################################################### ###################################################################### sub search_status_header { - my $bodytag = &Apache::loncommon::bodytag(undef,undef,undef,1); - my $html = &Apache::lonxml::xmlbegin(); - my $head = &Apache::loncommon::head('Search Status'); + my $start_page = &Apache::loncommon::start_page('Search Status',undef, + {'only_body' => 1}); return <Search Status Sending search request to LON-CAPA servers.
ENDSTATUS @@ -3135,17 +3121,17 @@ sub print_frames_interface { "&persistent_db_id=".$env{'form.persistent_db_id'}; my $run_search_link = $basic_link."&phase=run_search"; my $results_link = &results_link(); + my $js = < +var targetwin = opener; +var queue = ''; + +JS my $html = &Apache::lonxml::xmlbegin(); - my $head = &Apache::loncommon::headtag('LON-CAPA Digital Library Search Results'); - my $end_head = &Apache::loncommon::endheadtag(); + my $head = &Apache::loncommon::head('LON-CAPA Digital Library Search Results',$js); my $result = <<"ENDFRAMES"; $html $head - -$end_head @@ -3621,7 +3607,6 @@ $parms is extra information to include i ###################################################################### sub output_blank_field_error { 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 $revise = &mt('Revise Search Request'); my $heading = &mt('Unactionable Search Queary');