--- loncom/interface/lonsearchcat.pm 2009/07/31 10:58:57 1.312 +++ loncom/interface/lonsearchcat.pm 2010/08/13 13:32:36 1.325 @@ -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.325 2010/08/13 13:32:36 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -118,8 +118,6 @@ sub handler { # This is set and used in &handler() and is also used in # &output_results(). - my $loaderror=&Apache::lonnet::overloaderror($r); - if ($loaderror) { return $loaderror; } # my $closebutton; # button that closes the search window # This button is different for the RAT compared to @@ -266,25 +264,25 @@ sub handler { ## Configure dynamic components of interface ## if ($env{'form.catalogmode'} eq 'interactive') { - $closebutton=" +onclick='javascript:select_group()' /> END } else { $closebutton = ''; @@ -324,7 +322,7 @@ END &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). '&phase=disp_adv'. - 'catalogmode='.$env{'form.catalogmode'}. + '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. '&mode='.$env{'form.mode'}, text=>"Course Search", @@ -492,7 +490,7 @@ sub course_search { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). '&phase=disp_adv'. - 'catalogmode='.$env{'form.catalogmode'}. + '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. '&mode='.$env{'form.mode'}, text=>"Course Search", @@ -770,14 +768,26 @@ sub setup_basic_search { portfolio => 'Portfolio Search', ); my ($userelatedwords,$onlysearchdomain,$inclext,$adv_search_link,$scrout); - $userelatedwords = ''; - $onlysearchdomain = ''; + + $userelatedwords = ''; + + $onlysearchdomain = ''; + $adv_search_link = ''; } # - $scrout .= '
' + .&viewoptions() + .'
' + .'' + .'' + .' ' + .$closebutton + .'
'; # - $scrout .= '$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 -'; + $scrout .= &Apache::loncommon::end_page(); $r->print($scrout); return; @@ -1172,21 +1208,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; } @@ -1695,7 +1733,7 @@ sub parse_domain_restrictions { foreach (sort @allowed_domains) { $pretty_domains_string .= "".$_." "; } - my %servers = &Apache::lonnet::get_servers(\@allowed_domains, + my %servers = &Apache::lonnet::get_unique_servers(\@allowed_domains, 'library'); $libraries_to_query = [keys(%servers)]; } @@ -2167,9 +2205,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,13 +2293,15 @@ sub print_sort_form {
}
my $js =<
'. - ''.$sortform.''. - ' | '. - &prev_next_buttons($min,$env{'form.show'},$total_results). - ' | '. - &viewoptions().' |
'.&mt('There are currently no results').'.
'. + ''.&mt('There are currently no results.').'
'. "". &Apache::loncommon::end_page()); return; @@ -2995,15 +3059,13 @@ sub display_results { .&mt('There were no results matching your query.') .''); } else { - $r->print - ('\n";
$result .= ''.$values{'author'}.','.
' '.$values{'owner'}.' '.$closebutton.'
$errormsg
';
@@ -3481,7 +3634,7 @@ sub detailed_citation_view {
$result .= ''.&mt($field->{'translate'}).'';
foreach my $item (split(',',$values{$field->{'name'}})){
$item = &Apache::lonnet::clutter($item);
- $result .= &display_url($item,[2,0,1]);
+ $result .= '
'.&display_url($item,1).'
';
}
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
$result.= &mt($field->{'translate'},
@@ -3489,7 +3642,7 @@ sub detailed_citation_view {
$values{$field->{'name'}}))."
\n";
} else {
if ($field->{'special'} eq 'url link') {
- $result .= &display_url($jumpurl,[3,0,1]);
+ $result .= '
'.&display_url($jumpurl,1).'
';
} else {
$result.= &mt($field->{'translate'},
$values{$field->{'name'}});
@@ -3543,11 +3696,18 @@ sub summary_view {
}
my $jumpurl=$values{'url'};
$jumpurl=~s|^/ext/|http://|;
- my $link = &display_url($jumpurl,[2,0,1]);
+ my $link = '
'.&display_url($jumpurl,1).'
';
+ my $titleWL = &mt('Set link to wishlist');
$result.=<
+ target="preview">$values{'title'}
+
+
+
+
$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
$values{'copyrighttag'}
@@ -3579,7 +3739,7 @@ sub compact_view {
my $jumpurl=$values{'url'};
$jumpurl=~s|^/ext/|http://|;
- my $link = &display_url($jumpurl,[1,1,1]);
+ my $link = &display_url($jumpurl,1);
my $result =
$prefix.'';
@@ -3593,12 +3753,17 @@ sub compact_view {
$result.=' '.
''.
&HTML::Entities::encode($values{'title'},'<>&"').' '.
+ ''.
+ ''.
+ ''.
$link.' '.$values{'author'}.' ('.$values{'domain'}.')';
return $result;
}
sub display_url {
- my ($url,$crumb_args) = @_;
+ my ($url,$skiplast) = @_;
my $link;
if ($url=~m|^/ext/|) {
$url=~s|^/ext/|http://|;
@@ -3606,10 +3771,12 @@ sub display_url {
} elsif ($url=~m{^(http://|/uploaded/)}) {
$link=''.$url.'';
} else {
- $link=&Apache::lonhtmlcommon::crumbs($url,
- 'preview',
- '',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),@{$crumb_args}).' ';
+ $link=&Apache::lonhtmlcommon::crumbs(
+ $url,
+ 'preview',
+ '',
+ (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),
+ $skiplast).' ';
}
return $link;
}
@@ -3632,12 +3799,19 @@ sub fielded_format_view {
my $jumpurl=$values{'url'};
$jumpurl=~s|^/ext/|http://|;
+ my $titleWL = ('Set link to wishlist');
my $result=<
';
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'',
+ text=>$heading,});
+ $start_page .= &Apache::lonhtmlcommon::breadcrumbs();
+ }
+
$r->print(<
+
$heading