--- loncom/interface/lonsearchcat.pm 2007/07/11 20:32:15 1.288 +++ loncom/interface/lonsearchcat.pm 2009/07/31 10:58:57 1.312 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.288 2007/07/11 20:32:15 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.312 2009/07/31 10:58:57 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -191,9 +191,9 @@ sub handler { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'. &Apache::loncommon::inhibit_menu_check(). - '&catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"$crumb_text", target=>'_top', bug=>'Searching',}); @@ -266,7 +266,7 @@ sub handler { ## Configure dynamic components of interface ## if ($env{'form.catalogmode'} eq 'interactive') { - $closebutton=" END } else { @@ -313,19 +314,19 @@ END } &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). - '&phase=disp_adv'. - '&catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&phase=disp_adv'. + '&catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"Advanced $srchtype Search", bug=>'Searching',}); } elsif ($env{'form.searchmode'} eq 'course search') { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). - '&phase=disp_adv'. + '&phase=disp_adv'. 'catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"Course Search", bug=>'Searching',}); } @@ -487,7 +488,20 @@ sub course_search { my $discuss=$env{'form.crsdiscuss'}; my @allwords=($search_string,@New_Words); $totalfound=0; - $r->print(&Apache::loncommon::start_page('Course Search'). + + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). + '&phase=disp_adv'. + 'catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, + text=>"Course Search", + bug=>'Searching',}); + $r->print(&Apache::loncommon::start_page('Course Search')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', + $env{'form.catalogmode'} ne 'import')); + + $r->print( '
'.&mt('No matches found in resources').'.
'); + $r->print(''.&mt('No matches found in resources.').'
'); } # Check discussions if requested @@ -518,72 +532,77 @@ sub course_search { my $totaldiscussions = 0; $r->print(''.&mt('No matches found in postings').'.
'); + unless ($totaldiscussions) { + $r->print(''.&mt('No matches found in postings.').'
'); + } + } else { + $r->print('$lt{'note'}.
-
ENDCOURSESEARCH @@ -731,8 +749,9 @@ ENDCOURSESEARCH | |
- + +
+
@@ -759,21 +778,16 @@ sub setup_basic_search { $r->dir_config('lonDefDomain')), $r->dir_config('lonDefDomain')). ''; - if ($area eq 'res') { - $inclext= ''; - } $adv_search_link = ''.&mt('Advanced Search').''; # $scrout.=''. ''.&searchhelp().''.''. ''. (' 'x2).&searchhelp()." | '; } @@ -925,12 +939,7 @@ ENDHEADER &titlefield(&mt('Domains')).' | '.
&Apache::loncommon::domain_select('domains',
$env{'form.domains'},1).
- ' ' - } + ' '; $scrout .= ' | '.$/;
#
# Misc metadata
@@ -1044,6 +1053,7 @@ ENDHEADER
# Creation/Modification date limits
$scrout .= '
".&mt('Month[_1]Day[_2]Year',' 'x14,' 'x6)." | |
Created between | '. - '[_1] |
and | '. - '[_2] |
'.&mt('Created between').' | ' + .''.$cafter.' |
'.&mt('and').' | ' + .''.$cbefore.' |
Last modified between | '. - '[_1] |
and | '. - '[_2] |
'.&mt('Last modified between').' | ' + .''.$lafter.' |
'.&mt('and').' | ' + .''.$lbefore.' |
-Search: $pretty_query_string -
- -END + $result.='' + .&mt('There are [_1] matches to your query.',$total_results) + .' '.$revise.'
' + .''.&mt('Search: ').$pretty_query_string + .'
'; $r->print($result.&Apache::loncommon::end_page()); return; } @@ -2451,13 +2462,14 @@ Returns: html string for a 'revise searc ###################################################################### ###################################################################### sub revise_button { + my $revisetext = &mt('Revise search'); my $revise_phase = 'disp_basic'; $revise_phase = 'disp_adv' if ($env{'form.searchmode'} eq 'advanced'); my $newloc = '/adm/searchcat'. '?persistent_db_id='.$env{'form.persistent_db_id'}. - '&cleargroupsort=1'. - '&phase='.$revise_phase; - my $result = qq{ }; return $result; } @@ -2487,16 +2499,13 @@ sub run_search { # # Print run_search header # - my $start_page = &Apache::loncommon::start_page('Search Status',undef, - {'no_title' => 1}); + my $start_page = &Apache::loncommon::start_page('Search Status',undef); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', $env{'form.catalogmode'} ne 'import'); $r->print(<' + .&mt('Internal Error - Bad view selected.') + .'
'."\n"); $r->rflush(); return; } @@ -2767,7 +2780,10 @@ sub display_results { if ($env{'form.catalogmode'} eq 'import') { if (! tie(%groupsearch_db,'GDBM_File',$diropendb, &GDBM_WRCREAT(),0640)) { - $r->print('Unable to save import results.'. + $r->print(''. + &mt('Unable to save import results.'). + '
'. + ''. &Apache::loncommon::end_page()); $r->rflush(); return; @@ -2781,7 +2797,10 @@ sub display_results { ## Get the number of results my $total_results = &Apache::lonmysql::number_of_rows($table); if (! defined($total_results)) { - $r->print("A MySQL error has occurred.". + $r->print(''. + &mt('A MySQL error has occurred.'). + '
'. + ''. &Apache::loncommon::end_page()); &Apache::lonnet::logthis("lonmysql was unable to determine the number". " of rows in table ".$table); @@ -2900,7 +2919,7 @@ sub display_results { ## Output links (if necessary) for 'prev' and 'next' pages. $r->print (''.
- ' | '. &prev_next_buttons($min,$env{'form.show'},$total_results). ' | '.
@@ -2908,15 +2927,15 @@ sub display_results {
);
if ($total_results == 0) {
$r->print(''.
- ''.&mt('There are currently no results').'.'. + ''.&mt('There are currently no results').'. '. "". &Apache::loncommon::end_page()); return; } else { - $r->print(''.
mt('Results [_1] to [_2] out of [_3]',
$min,$max,$total_results).
- "\n");
+ " \n");
}
##
## Get results from MySQL table
@@ -2946,13 +2965,14 @@ sub display_results {
if ($area eq 'portfolio') {
$tabletype = 'portfolio_search';
}
+ $r->print(&Apache::loncommon::start_data_table());
foreach my $row (@Results) {
if ($connection->aborted()) {
&cleanup();
return;
}
my %Fields = %{&parse_row($tabletype,@$row)};
- my $output="\n"; + my $output; if (! defined($Fields{'title'}) || $Fields{'title'} eq '') { $Fields{'title'} = 'Untitled'; } @@ -2961,18 +2981,26 @@ sub display_results { # Render the result into html $output.= &$viewfunction($prefix,%Fields); # Print them out as they come in. - $r->print($output); + $r->print(&Apache::loncommon::start_data_table_row() + .' '
+ .$output
+ .' | '
+ .&Apache::loncommon::end_data_table_row()
+ );
$r->rflush();
}
+ $r->print(&Apache::loncommon::end_data_table());
if (@Results < 1) {
- $r->print(&mt("There were no results matching your query"));
+ $r->print('' + .&mt('There were no results matching your query.') + .' '); } else { $r->print ('\n"; @@ -3476,17 +3504,14 @@ sub detailed_citation_view { if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { $result .= ' '.$values{'shortabstract'}.' '; } - $result .= ''."\n"; return $result; } sub detailed_citation_preview { my ($prefix,%values)=@_; - return '
'; + &Apache::lonindexer::showpreview($values{'url'}); } @@ -3503,7 +3528,7 @@ sub detailed_citation_preview { sub summary_view { my ($prefix,%values) = @_; my $icon=&Apache::loncommon::icon($values{'url'}); - my $result=qq{$prefix}; + my $result=qq{$prefix}; if (exists($env{'form.sortfield'}) && $env{'form.sortfield'} !~ /^(default| author| @@ -3522,24 +3547,20 @@ sub summary_view { $result.=< -$link + target="preview">$values{'title'} +$link $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'} $values{'copyrighttag'} $values{'extrashow'} - - END return $result; } sub summary_preview { my ($prefix,%values)=@_; - return '
'; + &Apache::lonindexer::showpreview($values{'url'}); } ###################################################################### @@ -3561,7 +3582,7 @@ sub compact_view { my $link = &display_url($jumpurl,[1,1,1]); my $result = - $prefix.''; + $prefix.''; if (exists($env{'form.sortfield'}) && $env{'form.sortfield'} !~ /^(default|author|url|title)$/) { my $tmp = $values{$env{'form.sortfield'}}; @@ -3572,7 +3593,7 @@ sub compact_view { $result.=' '. ''. &HTML::Entities::encode($values{'title'},'<>&"').' '. - $link.' '.$values{'author'}.' ('.$values{'domain'}.') '; + $link.' '.$values{'author'}.' ('.$values{'domain'}.')'; return $result; } @@ -3612,7 +3633,7 @@ sub fielded_format_view { $jumpurl=~s|^/ext/|http://|; my $result=< |