--- loncom/interface/lonsearchcat.pm 2009/07/31 10:58:57 1.312
+++ loncom/interface/lonsearchcat.pm 2010/02/13 01:12:16 1.320
@@ -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.320 2010/02/13 01:12:16 raeburn 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 = '';
@@ -324,7 +324,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 +492,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 +770,26 @@ sub setup_basic_search {
portfolio => 'Portfolio Search',
);
my ($userelatedwords,$onlysearchdomain,$inclext,$adv_search_link,$scrout);
- $userelatedwords = '';
- $onlysearchdomain = '';
+
+ $userelatedwords = '';
+
+ $onlysearchdomain = '';
+
$adv_search_link = '';
}
#
- $scrout .= '
'.$/;
+ $scrout .= ''.$/;
# if ($env{'request.course.id'}) {
$scrout .= '
'.$lt{$area}.'
';
# } else {
@@ -810,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;
}
@@ -852,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
-';
+
$scrout .= &Apache::loncommon::end_page();
$r->print($scrout);
return;
@@ -1172,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;
}
@@ -2167,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;
}
##
@@ -2251,6 +2295,7 @@ sub print_sort_form {
}
my $js =<
+//
END
@@ -2400,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();
}
@@ -2436,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;
@@ -2470,7 +2533,7 @@ sub revise_button {
'&cleargroupsort=1'.
'&phase='.$revise_phase;
my $result = qq{ };
+ qq{ onclick="parent.location='$newloc';" /> };
return $result;
}
@@ -2691,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
@@ -2701,11 +2764,11 @@ END
# loaded from /adm/searchcat
$r->print(&Apache::loncommon::end_page());
# if ($env{'form.catalogmode'} ne 'import') {
- $r->print("");
+ $r->print(<
+SCRIPT
# }
return;
}
@@ -2728,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 .= ''
+ .''
+ .' '
+ .''
+ .' '
+ .''
+ .'
';
}
######################################################################
@@ -2905,29 +2968,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(''
+ .&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 +3061,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 +3097,7 @@ sub catalogmode_output {
if ($env{'form.catalogmode'} eq 'interactive') {
$output.=<
+onclick="javascript:select_data('$title','$url')" />
END
}
@@ -3043,7 +3107,7 @@ END
$output.=<
+onclick="javascript:queue($checkbox_num,$fnum)" />
END
}
@@ -3212,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') {
@@ -3251,6 +3317,7 @@ END
$js.=<
SCRIPT
}
@@ -3272,6 +3340,7 @@ SCRIPT
my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check();
$js.=<
SCRIPT
@@ -3324,8 +3394,10 @@ sub print_frames_interface {
my $results_link = &results_link();
my $js = <
+//
JS
@@ -3481,7 +3553,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 +3561,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,7 +3615,7 @@ 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).'
';
$result.=<';
@@ -3598,7 +3670,7 @@ sub compact_view {
}
sub display_url {
- my ($url,$crumb_args) = @_;
+ my ($url,$skiplast) = @_;
my $link;
if ($url=~m|^/ext/|) {
$url=~s|^/ext/|http://|;
@@ -3606,10 +3678,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;
}
@@ -3824,21 +3898,30 @@ 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 $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
@@ -3875,7 +3958,7 @@ $start_page