--- loncom/interface/lonsearchcat.pm 2009/07/31 10:58:57 1.312 +++ loncom/interface/lonsearchcat.pm 2009/07/31 16:01:48 1.313 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.312 2009/07/31 10:58:57 bisitz Exp $ +# $Id: lonsearchcat.pm,v 1.313 2009/07/31 16:01:48 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -266,25 +266,25 @@ sub handler { ## Configure dynamic components of interface ## if ($env{'form.catalogmode'} eq 'interactive') { - $closebutton=" +onclick='javascript:select_group()'> END } else { $closebutton = ''; @@ -798,7 +798,7 @@ sub setup_basic_search { $scrout .= ''; } # - $scrout .= '
'.$/; + $scrout .= '
'.$/; # if ($env{'request.course.id'}) { $scrout .= '

'.$lt{$area}.'

'; # } else { @@ -810,23 +810,27 @@ sub setup_basic_search { &Apache::lonhtmlcommon::textbox('basicexp', $env{'form.basicexp'},50). '
'. - ''.&searchhelp().''.''. - ''. + ''.&searchhelp().''.''. + ''. ''.(' 'x3).$adv_search_link.''.'
'. ''.(' 'x1).$userelatedwords.''.'
'. ''.(' 'x1).$onlysearchdomain.''.'
'. ''.(' 'x1).$inclext.''.'
'. - '
'. - ''.$/; + ''. + ''. + ''.$/; + # + $scrout .= '

' + .&viewoptions() + .'

' + .'

' + .'' + .' ' + .$closebutton + .'

'; # - $scrout .= ''. - ''. - ''. - (' 'x2).$closebutton.(' 'x2). &viewoptions(). - ''. - ''.$/; - $scrout .= ''.$/.'
'.''; + $scrout .= ''.''; return $scrout; } @@ -861,6 +865,7 @@ END if ($env{'form.area'} eq 'portfolio') { $srchtype = 'Portfolio'; $jscript = ''; } my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search", @@ -1172,21 +1178,23 @@ Outputs: text for box with view options ###################################################################### ###################################################################### sub viewoptions { - my $scrout = ''; + my $scrout; if (! defined($env{'form.viewselect'})) { $env{'form.viewselect'}='detailed'; } - $scrout.=&Apache::lonmeta::selectbox('viewselect', - $env{'form.viewselect'}, - \&viewoptiontext, - sort(keys(%Views))); - $scrout.= '  '; + $scrout .= '' + .&mt('Type:').' ' + .&Apache::lonmeta::selectbox('viewselect', + $env{'form.viewselect'}, + \&viewoptiontext, + sort(keys(%Views))) + .''; my $countselect = &Apache::lonmeta::selectbox('show', $env{'form.show'}, undef, (10,20,50,100,1000,10000)); - $scrout .= (' 'x2) - .&mt('[_1] Records per Page',$countselect) + $scrout .= ' ' + .&mt('Records per Page:').' '.$countselect .''.$/; return $scrout; } @@ -2167,9 +2175,13 @@ sub ensure_db_and_table { ## Sanity check the table id. ## if (! defined($table) || $table eq '' || $table =~ /\D/ ) { - $r->print("Unable to retrieve search results. ". - "Unable to determine the table results were saved in. ". - &Apache::loncommon::end_page()); + $r->print(&Apache::loncommon::start_page(&mt('Error')) +. '

table: |'.$table.'|

' # SB + .'

' + .&mt('Unable to retrieve search results. ' + .'Unable to determine the table results were saved in.') + .&Apache::loncommon::end_page() + ); return undef; } ## @@ -2251,6 +2263,7 @@ sub print_sort_form { } my $js =< +// END @@ -2400,16 +2414,28 @@ Returns: Nothing. sub update_count_status { my ($r,$text) = @_; $text =~ s/\'/\\\'/g; - $r->print - ("\n"); + $r->print(< +// + +SCRIPT + $r->rflush(); } sub update_status { my ($r,$text) = @_; $text =~ s/\'/\\\'/g; - $r->print - ("\n"); + $r->print(< +// + +SCRIPT + $r->rflush(); } @@ -2436,9 +2462,14 @@ sub update_seconds { my ($r) = @_; my $time = &time_left(); if (($last_time-$time) > 0) { - $r->print("\n"); + $r->print(< +// + +SCRIPT + $r->rflush(); } $last_time = $time; @@ -2470,7 +2501,7 @@ sub revise_button { '&cleargroupsort=1'. '&phase='.$revise_phase; my $result = qq{ }; + qq{ onclick="parent.location='$newloc';" /> }; return $result; } @@ -2691,7 +2722,7 @@ END last if ($connection->aborted()); &update_seconds($r); } - &update_status($r,&mt('Search Complete [_1]',$server)); + &update_status($r,&mt('Search Complete on Server [_1]',$server)); &update_seconds($r); # &Apache::lonmysql::disconnect_from_db(); # This is unneccessary @@ -2701,11 +2732,11 @@ END # loaded from /adm/searchcat $r->print(&Apache::loncommon::end_page()); # if ($env{'form.catalogmode'} ne 'import') { - $r->print(""); + $r->print(< +window.location='/adm/searchcat?phase=sort&persistent_db_id=$env{'form.persistent_db_id'}'; + +SCRIPT # } return; } @@ -2728,15 +2759,15 @@ sub prev_next_buttons { return '' if ($show eq 'all'); # No links if you get them all at once. # # Create buttons - my $buttons = ''; - $buttons .= ' 'x3; - $buttons .= '' + .'' + .' ' + .'' + .' ' + .'' + .'

'; } ###################################################################### @@ -2905,29 +2936,32 @@ sub display_results { $env{'form.sortorder'}='asc'; } } - my $sortform = &mt('Sort by [_1] [_2]', - &Apache::loncommon::select_form($env{'form.sortfield'}, + my $sortform = '' + .&mt('Sort by:').' ' + .&Apache::loncommon::select_form($env{'form.sortfield'}, 'sortfield', - %sort_fields), - &Apache::loncommon::select_form($env{'form.sortorder'}, + %sort_fields) + .' ' + .&Apache::loncommon::select_form($env{'form.sortorder'}, 'sortorder', (asc =>&mt('Ascending'), desc=>&mt('Descending') )) - ); + .''; ## - ## Output links (if necessary) for 'prev' and 'next' pages. - $r->print - ('
'. - ''.$sortform.''. - ''. - &prev_next_buttons($min,$env{'form.show'},$total_results). - ''. - &viewoptions().'
' - ); + ## Display links for 'prev' and 'next' pages (if necessary) and Display Options + $r->print('
'."\n" + .''.&mt('Display Options').''."\n" + .$sortform + .' ' + .&viewoptions() + .'
' + .&prev_next_buttons($min,$env{'form.show'},$total_results) + ); + if ($total_results == 0) { $r->print(''. - '

'.&mt('There are currently no results').'.

'. + '

'.&mt('There are currently no results.').'

'. "". &Apache::loncommon::end_page()); return; @@ -2995,15 +3029,13 @@ sub display_results { .&mt('There were no results matching your query.') .'

'); } else { - $r->print - ('
'. - &prev_next_buttons($min,$env{'form.show'},$total_results, + $r->print( + &prev_next_buttons($min,$env{'form.show'},$total_results, "table=".$env{'form.table'}. "&phase=results". "&persistent_db_id=". $env{'form.persistent_db_id'}) - ."
\n" - ); + ); } $r->print("".&Apache::loncommon::end_page()); $r->rflush(); @@ -3033,7 +3065,7 @@ sub catalogmode_output { if ($env{'form.catalogmode'} eq 'interactive') { $output.=< +onclick="javascript:select_data('$title','$url')" /> END } @@ -3043,7 +3075,7 @@ END $output.=< +onclick="javascript:queue($checkbox_num,$fnum)" /> END } @@ -3212,6 +3244,7 @@ sub search_results_header { if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') { $js.=< +// SCRIPT } elsif ($env{'form.mode'} eq 'edit') { @@ -3251,6 +3285,7 @@ END $js.=< +// SCRIPT } @@ -3272,6 +3308,7 @@ SCRIPT my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check(); $js.=< SCRIPT @@ -3324,8 +3362,10 @@ sub print_frames_interface { my $results_link = &results_link(); my $js = < +// JS @@ -3875,7 +3915,7 @@ $start_page
$hidden_fields +onclick='this.form.submit();' /> $closebutton