--- loncom/interface/lonsearchcat.pm 2009/02/26 16:17:30 1.305 +++ loncom/interface/lonsearchcat.pm 2009/10/23 16:55:15 1.318 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.305 2009/02/26 16:17:30 schafran Exp $ +# $Id: lonsearchcat.pm,v 1.318 2009/10/23 16:55:15 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,25 +266,25 @@ sub handler { ## Configure dynamic components of interface ## if ($env{'form.catalogmode'} eq 'interactive') { - $closebutton=" +onclick='javascript:select_group()' /> END } else { $closebutton = ''; @@ -314,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',}); } @@ -488,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( '
'. $pretty_search_string.'
'. '
'.&mt('Course content').':
'); @@ -511,7 +524,7 @@ sub course_search { untie(%hash); } unless ($totalfound) { - $r->print('

'.&mt('No matches found in resources').'.

'); + $r->print('

'.&mt('No matches found in resources.').'

'); } # Check discussions if requested @@ -571,7 +584,7 @@ sub course_search { $url = '/res/'.$url; } if ($url =~ /\?/) { - $url .= '&symb='; + $url .= '&symb='; } else { $url .= '?symb='; } @@ -586,7 +599,7 @@ sub course_search { } } unless ($totaldiscussions) { - $r->print('

'.&mt('No matches found in postings').'.

'); + $r->print('

'.&mt('No matches found in postings.').'

'); } } else { $r->print('
'.&mt('An error occurred retrieving information about resources in the course.').'
'.&mt('It is recommended that you [_1]re-initialize the course[_2] and then try your search again.','','').'
'); @@ -716,7 +729,6 @@ $hidden_fields

$lt{'note'}.

-

-
ENDCOURSESEARCH @@ -737,8 +749,9 @@ ENDCOURSESEARCH

+ +

+

@@ -757,24 +770,36 @@ sub setup_basic_search { portfolio => 'Portfolio Search', ); my ($userelatedwords,$onlysearchdomain,$inclext,$adv_search_link,$scrout); - $userelatedwords = ''; - $onlysearchdomain = ''; + + $userelatedwords = ''; + + $onlysearchdomain = ''; + $adv_search_link = ''.&mt('Advanced Search').''; # $scrout.='
'; } # - $scrout .= '
'.$/; + $scrout .= '
'.$/; # if ($env{'request.course.id'}) { $scrout .= '

'.$lt{$area}.'

'; # } else { @@ -797,23 +822,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; } @@ -839,15 +868,18 @@ sub print_advanced_search_form{ 'reset' => 'Reset', 'help' => 'Help'); my $advanced_buttons=<<"END"; +

$closebutton +

END my $srchtype = 'Catalog'; my $jscript; if ($env{'form.area'} eq 'portfolio') { $srchtype = 'Portfolio'; $jscript = ''; } my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search", $jscript); - $scrout .= <<"ENDHEADER"; -$bread_crumb -
-

-$advanced_buttons -ENDHEADER - $scrout.=(' 'x2).&viewoptions().'

'.$hidden_fields. - ''; + $scrout .= $bread_crumb; + + $scrout .= '' + .$hidden_fields + .''; + + $scrout .= '
'."\n" + .''.&mt('Display Options').''."\n" + .&viewoptions() + .'
'; + + $scrout .= $advanced_buttons; + + $scrout .= &Apache::lonhtmlcommon::start_pick_box(); + my %fields=&Apache::lonmeta::fieldnames(); - # - $scrout .= '

'.&mt("Standard $srchtype Metadata").'

'; - $scrout .= "\n"; - $scrout .= '\n"; + + # Standard Metadata + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt("Standard $srchtype Metadata").'

' + .&searchhelp() + .&Apache::lonhtmlcommon::row_closure(); my %related_word_search = ('title' => 1, 'author' => 0, @@ -884,110 +925,111 @@ ENDHEADER 'abstract' => 1, 'standards'=> 1, 'mime' => 1, - 'subject' => 1, + 'subject' => 1, ); # foreach my $field ('title','author','subject','owner','authorspace', - 'modifyinguser','keywords','notes','abstract', - 'standards','mime') { - $scrout.=''.$/; + $scrout .= &Apache::lonhtmlcommon::row_closure(); } foreach my $field ('lowestgradelevel','highestgradelevel') { - $scrout.=''. - ''. - ''.$/; + 0) + .&Apache::lonhtmlcommon::row_closure(); } - $scrout.=''.$/; - $scrout.=''.$/; - # + + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('MIME Type Category'))) + .&Apache::loncommon::filecategoryselect('category', + $env{'form.category'}) + .&Apache::lonhtmlcommon::row_closure(); + + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains'))) + .&Apache::loncommon::domain_select('domains', + $env{'form.domains'},1) + .&Apache::lonhtmlcommon::row_closure(); + # Misc metadata if ($env{'form.area'} ne 'portfolio') { - $scrout.=''.$/; + ) + .&Apache::lonhtmlcommon::row_closure(); } - $scrout.=''; - $scrout .= "
 '. - (' 'x2).&searchhelp()."
'.&titlefield($fields{$field}).''. - &Apache::lonmeta::prettyinput($field, + 'modifyinguser','keywords','notes','abstract', + 'standards','mime') { + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield($fields{$field})) + .&Apache::lonmeta::prettyinput($field, $env{'form.'.$field}, $field, 'advsearch', - $related_word_search{$field}, - '', + $related_word_search{$field}, + '', $env{'form.'.$field.'_related'}, 50); if ($related_word_search{$field}) { $scrout .= &mt('related words'); } else { - $scrout .= ' '; + $scrout .= ''; } - $scrout .= '
'.&titlefield($fields{$field}).''. - &Apache::lonmeta::prettyinput($field, + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield($fields{$field})) + .&Apache::lonmeta::prettyinput($field, $env{'form.'.$field}, $field, 'advsearch', - 0). - '
'. - &titlefield(&mt('MIME Type Category')).''. - &Apache::loncommon::filecategoryselect('category', - $env{'form.category'}). - '
'. - &titlefield(&mt('Domains')).''. - &Apache::loncommon::domain_select('domains', - $env{'form.domains'},1). - '
'. - &titlefield(&mt('Copyright/Distribution')). - ''. - &Apache::lonmeta::selectbox('copyright', + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Copyright/Distribution'))) + .&Apache::lonmeta::selectbox('copyright', $env{'form.copyright'}, \&Apache::loncommon::copyrightdescription, ( undef, &Apache::loncommon::copyrightids) - ).'
'. - &titlefield(&mt('Language')).''. - &Apache::lonmeta::selectbox('language', + + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Language'))) + .&Apache::lonmeta::selectbox('language', $env{'form.language'}, \&Apache::loncommon::languagedescription, ('any',&Apache::loncommon::languageids) - ).'
\n"; - + ) + .&Apache::lonhtmlcommon::row_closure(); + # Portfolio Metadata if ($env{'form.area'} eq 'portfolio') { # Added fields my $curnumadd = $env{'form.numaddedfields'}; if ($curnumadd eq '') { $curnumadd = 1; } - $scrout .= '

'.&mt('Custom Metadata fields').'

'; - $scrout .= "\n"; - $scrout .= ''.''; + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Custom Metadata fields').'

' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title('') + .&mt('Field Name').' | '.&mt('Field Value(s)') + .&Apache::lonhtmlcommon::row_closure(); for (my $j=0; $j<$curnumadd; $j++) { my $num = $j+1; - $scrout .= ''. - ''; - } - $scrout .= '
 '. - &mt('Field Name').''. - &mt('Field Value(s)').'
'.&mt('Custom metadata [_1]: ',$num). - ''. - '
'. - '
'; - } else { + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Custom metadata [_1]',$num)) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + $scrout .= &Apache::lonhtmlcommon::row_title('') + .'' + .'' + .&Apache::lonhtmlcommon::row_closure(); +} else { # # Dynamic metadata - $scrout .= '

'.&mt('Problem Statistics').'

'; - $scrout .= "\n"; - $scrout .= ''.''."\n"; + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Problem Statistics').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&mt('Minimum').' | '.&mt('Maximum') + .&Apache::lonhtmlcommon::row_closure(); foreach my $statistic ({ name=>'count', description=>'Network-wide number of accesses (hits)',}, @@ -1000,20 +1042,21 @@ ENDHEADER description=>'Degree of difficulty',}, { name => 'disc', description=>'Degree of discrimination'}) { - $scrout .= ''.$/; - } - $scrout .= "
 '. - &mt('Minimum').''. - &mt('Maximum').'
'. - &titlefield(&mt($statistic->{'description'})). - ''. - ''. - '
\n"; - $scrout .= '

'.&mt('Evaluation Data').'

'; - $scrout .= "\n"; - $scrout .= ''.''."\n"; + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($statistic->{'description'}))) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Evaluation Data').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&mt('Minimum').' | '.&mt('Maximum') + .&Apache::lonhtmlcommon::row_closure(); foreach my $evaluation ( { name => 'clear', description => 'Material presented in clear way'}, @@ -1025,22 +1068,24 @@ ENDHEADER description => 'Material appears to be correct'}, { name => 'technical', description => 'Resource is technically correct'}){ - $scrout .= ''.$/; + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($evaluation->{'description'}))) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); } - $scrout .= "
 '. - &mt('Minimum').''. - &mt('Maximum').'
'. - &titlefield(&mt($evaluation->{'description'})). - ''. - ''. - ''. - '
\n"; } # # Creation/Modification date limits - $scrout .= '

'.&mt('Creation and Modification dates').'

'; - $scrout .= "\n\n"; - $scrout .= "\n"; + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Creation and Modification dates').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&mt('Month[_1]Day[_2]Year',' 'x14,' 'x6) + .&Apache::lonhtmlcommon::row_closure(); + my $cafter = &Apache::lonhtmlcommon::date_setter('advsearch', # formname 'creationdate1', # fieldname @@ -1059,10 +1104,13 @@ ENDHEADER '', # state 1, # no_hh_mm_ss ); - $scrout .= '' - .'' - .'' - .''; + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Created between')) + .$cafter + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::row_title(&mt('and')) + .$cbefore + .&Apache::lonhtmlcommon::row_closure(); + my $lafter = &Apache::lonhtmlcommon::date_setter('advsearch', 'revisiondate1', @@ -1081,15 +1129,18 @@ ENDHEADER '', # state 1, # no_hh_mm_ss ); - $scrout .= '' - .'' - .'' - .''; - $scrout.="
 ".&mt('Month[_1]Day[_2]Year',' 'x14,' 'x6)."
'.&mt('Created between').''.$cafter.'
'.&mt('and').''.$cbefore.'
'.&mt('Last modified between').''.$lafter.'
'.&mt('and').''.$lbefore.'
\n"; - $scrout.=< -ENDDOCUMENT + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Last modified between')) + .$lafter + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::row_title(&mt('and')) + .$lbefore + .&Apache::lonhtmlcommon::row_closure(1); # Last row of total pick_box + + $scrout .= &Apache::lonhtmlcommon::end_pick_box(); + + $scrout .= $advanced_buttons + .''; + $scrout .= &Apache::loncommon::end_page(); $r->print($scrout); return; @@ -1159,21 +1210,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; } @@ -2154,9 +2207,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; } ## @@ -2238,18 +2295,19 @@ sub print_sort_form { } my $js =< +// END - my $start_page = &Apache::loncommon::start_page('Results',$js, - {'no_title' => 1}); + my $start_page = &Apache::loncommon::start_page('Results',$js); my $breadcrumbs= &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', $env{'form.catalogmode'} ne 'import'); @@ -2388,16 +2446,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(); } @@ -2424,9 +2494,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; @@ -2455,10 +2530,10 @@ sub revise_button { $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; + '&cleargroupsort=1'. + '&phase='.$revise_phase; my $result = qq{ }; + qq{ onclick="parent.location='$newloc';" /> }; return $result; } @@ -2487,8 +2562,7 @@ 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'); @@ -2680,7 +2754,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 @@ -2690,11 +2764,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; } @@ -2717,15 +2791,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 .= '' + .'' + .' ' + .'' + .' ' + .'' + .'

'; } ###################################################################### @@ -2750,7 +2824,9 @@ sub display_results { ## my $viewfunction = $Views{$env{'form.viewselect'}}; if (!defined($viewfunction)) { - $r->print("Internal Error - Bad view selected.\n"); + $r->print('

' + .&mt('Internal Error - Bad view selected.') + .'

'."\n"); $r->rflush(); return; } @@ -2767,7 +2843,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 +2860,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); @@ -2886,37 +2968,40 @@ 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; } else { - $r->print('
'. + $r->print('
'. mt('Results [_1] to [_2] out of [_3]', $min,$max,$total_results). - "
\n"); + "\n"); } ## ## Get results from MySQL table @@ -2946,13 +3031,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,21 +3047,27 @@ 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 - ('
'. - &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=". + "&phase=results". + "&persistent_db_id=". $env{'form.persistent_db_id'}) - ."
\n" - ); + ); } $r->print("".&Apache::loncommon::end_page()); $r->rflush(); @@ -3005,7 +3097,7 @@ sub catalogmode_output { if ($env{'form.catalogmode'} eq 'interactive') { $output.=< +onclick="javascript:select_data('$title','$url')" /> END } @@ -3015,7 +3107,7 @@ END $output.=< +onclick="javascript:queue($checkbox_num,$fnum)" /> END } @@ -3184,6 +3276,7 @@ sub search_results_header { if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') { $js.=< +// SCRIPT } elsif ($env{'form.mode'} eq 'edit') { @@ -3223,6 +3317,7 @@ END $js.=< +// SCRIPT } @@ -3244,6 +3340,7 @@ SCRIPT my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check(); $js.=< SCRIPT @@ -3279,10 +3377,10 @@ END } sub results_link { - my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. - "&persistent_db_id=".$env{'form.persistent_db_id'}; - my $results_link = $basic_link."&phase=results". - "&pause=1"."&start=1"; + my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. + "&persistent_db_id=".$env{'form.persistent_db_id'}; + my $results_link = $basic_link."&phase=results". + "&pause=1"."&start=1"; return $results_link; } @@ -3290,14 +3388,16 @@ sub results_link { ###################################################################### sub print_frames_interface { my $r = shift; - my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. - "&persistent_db_id=".$env{'form.persistent_db_id'}; - my $run_search_link = $basic_link."&phase=run_search"; + my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. + "&persistent_db_id=".$env{'form.persistent_db_id'}; + my $run_search_link = $basic_link."&phase=run_search"; my $results_link = &results_link(); my $js = < +// JS @@ -3384,7 +3484,7 @@ sub detailed_citation_view { my $jumpurl=$values{'url'}; $jumpurl=~s|^/ext/|http://|; $result .= ''.$prefix. - ''.' '. + ''.' '. ''.$values{'title'}."\n"; $result .= "

\n"; @@ -3476,17 +3576,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 '
'. - &detailed_citation_view($prefix,%values). + return &detailed_citation_view($prefix,%values). ''. - &Apache::lonindexer::showpreview($values{'url'}). - '

'; + &Apache::lonindexer::showpreview($values{'url'}); } @@ -3503,7 +3600,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 +3619,20 @@ sub summary_view { $result.=<$values{'title'}
-$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 '
'. - &summary_view($prefix,%values). + return &summary_view($prefix,%values). ''. - &Apache::lonindexer::showpreview($values{'url'}). - '

'; + &Apache::lonindexer::showpreview($values{'url'}); } ###################################################################### @@ -3561,7 +3654,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 +3665,7 @@ sub compact_view { $result.=' '. ''. &HTML::Entities::encode($values{'title'},'<>&"').' '. - $link.' '.$values{'author'}.' ('.$values{'domain'}.')
'; + $link.' '.$values{'author'}.' ('.$values{'domain'}.')'; return $result; } @@ -3612,7 +3705,7 @@ sub fielded_format_view { $jumpurl=~s|^/ext/|http://|; my $result=< +$prefix
URL:
$values{'extrashow'} -
END return $result; } @@ -3752,9 +3843,12 @@ sub output_unparsed_phrase_error { my ($r,$closebutton,$parms,$hidden_fields,$field)=@_; my $errorstring; if ($field eq 'basicexp') { - $errorstring = &mt('Unable to understand the search phrase [_1]. Please modify your search.',$env{'form.basicexp'}); + $errorstring = &mt('Unable to understand the search phrase [_1]. Please modify your search.' + ,''.$env{'form.basicexp'}.''); } else { - $errorstring = &mt('Unable to understand the search phrase [_1]:[_2].',$field,$env{'form.'.$field}); + $errorstring = &mt('Unable to understand the search phrase [_1]: [_2]' + ,''.$field.'' + ,$env{'form.'.$field}); } my $heading = &mt('Unparsed Field'); my $revise = &mt('Revise search request'); @@ -3768,11 +3862,11 @@ $hidden_fields $closebutton

$heading

-

+

$errorstring

-$revise +$revise

$end_page ENDPAGE @@ -3800,23 +3894,32 @@ $parms is extra information to include i ###################################################################### sub output_blank_field_error { my ($r,$closebutton,$parms,$hidden_fields)=@_; - 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 $heading = &mt('Unactionable Search Queary'); + my $heading = &mt('Unactionable Search Query'); my $start_page = &Apache::loncommon::start_page('Search'); my $end_page = &Apache::loncommon::end_page(); + if ($closebutton) { + $closebutton = '

'.$closebutton.'


'; + } else { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'', + text=>$heading,}); + $start_page .= &Apache::lonhtmlcommon::breadcrumbs(); + } + $r->print(< $hidden_fields $closebutton -
+

$heading

-

+

$errormsg

-$revise  +$revise

$end_page ENDPAGE @@ -3847,16 +3950,18 @@ sub output_date_error { # make query information persistent to allow for subsequent revision my $start_page = &Apache::loncommon::start_page('Search'); my $end_page = &Apache::loncommon::end_page(); + my $heading = &mt('Error'); $r->print(< $hidden_fields +onclick='this.form.submit();' /> $closebutton +
-

Error

-

+

$heading

+

$message

$end_page