--- loncom/interface/lonsearchcat.pm 2006/03/06 18:23:10 1.255 +++ loncom/interface/lonsearchcat.pm 2006/03/15 20:56:16 1.256 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.255 2006/03/06 18:23:10 www Exp $ +# $Id: lonsearchcat.pm,v 1.256 2006/03/15 20:56:16 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -198,18 +198,11 @@ sub handler { &Apache::lonnet::logthis('lonsearchcat:'. 'Unable to recover data from '. $persistent_db_file); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -LON-CAPA Search Error -$bodytag -We were unable to retrieve data describing your search. This is a serious -error and has been logged. Please alert your LON-CAPA administrator. - - -END - return OK; + my $msg = + '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); } } } else { @@ -229,10 +222,8 @@ END } else { # This is a stupid error to give to the user. # It really tells them nothing. - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.''.$bodytag. - 'Unable to tie hash to db file'); - return OK; + my $msg = 'Unable to tie hash to db file.'; + return &error_page($r,$msg); } } ## @@ -369,33 +360,19 @@ END &Apache::lonnet::logthis('lonsearchcat.pm: Unable to create '. 'needed table. lonmysql error:'. $errorstring); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -Search Error -$bodytag -Unable to create table in which to store search results. -The search has been aborted. - - -END - return OK; + + my $msg = + 'Unable to create table in which to store search results. '. + 'The search has been aborted.'; + return &error_page($r,$msg); } delete($env{'form.launch'}); if (! &make_form_data_persistent($r,$persistent_db_file)) { - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -Search Error -$bodytag -Unable to properly store search information. The search has been aborted. - - -END - return OK; - } + my $msg= + 'Unable to properly store search information. '. + 'The search has been aborted.'; + return &error_page($r,$msg); + } ## ## Print out the frames interface ## @@ -406,6 +383,14 @@ 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. @@ -467,7 +452,6 @@ sub make_symb { sub course_search { my $r=shift; - my $bodytag=&Apache::loncommon::bodytag('Course Search'); my $pretty_search_string = ''.$env{'form.courseexp'}.''; my $search_string = $env{'form.courseexp'}; my @New_Words; @@ -484,9 +468,10 @@ sub course_search { my $discuss=$env{'form.crsdiscuss'}; my @allwords=($search_string,@New_Words); $totalfound=0; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'LON-CAPA Course Search'. - $bodytag.'
'.$pretty_search_string.'

'.&mt('Course content').':
'); + $r->print(&Apache::loncommon::start_page('Course Search'). + '
'. + $pretty_search_string.'
'. + '
'.&mt('Course content').':
'); $r->rflush(); # ======================================================= Go through the course my $c=$r->connection; @@ -584,7 +569,7 @@ sub course_search { } # =================================================== Done going through course - $r->print(''); + $r->print(&Apache::loncommon::end_page()); } # =============================== This pulls up a resource and its dependencies @@ -660,16 +645,6 @@ sub untiehash { } # End of course search scoping -sub search_html_header { - my $html=&Apache::lonxml::xmlbegin(); - my $Str = < -The LearningOnline Network with CAPA - -ENDHEADER - return $Str; -} ###################################################################### ###################################################################### @@ -687,11 +662,11 @@ Prints the form for the basic search. S sub print_basic_search_form { my ($r,$closebutton,$hidden_fields) = @_; my $result = ($env{'form.catalogmode'} ne 'groupsearch'); - my $bodytag=&Apache::loncommon::bodytag('Search'). + my $bread_crumb = &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Search_Basic', undef,undef, $env{'form.catalogmode'} ne 'groupsearch'); - my $scrout = &search_html_header().$bodytag; + my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb; if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { # Define interface components my $userelatedwords= '