--- loncom/interface/lonsearchcat.pm 2007/05/01 02:13:40 1.285
+++ loncom/interface/lonsearchcat.pm 2007/07/11 20:32:15 1.288
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.285 2007/05/01 02:13:40 www Exp $
+# $Id: lonsearchcat.pm,v 1.288 2007/07/11 20:32:15 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,7 +138,7 @@ sub handler {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['catalogmode','launch','acts','mode','form','element','pause',
'phase','persistent_db_id','table','start','show',
- 'cleargroupsort','titleelement','area']);
+ 'cleargroupsort','titleelement','area','inhibitmenu']);
##
## The following is a trick - we wait a few seconds if asked to so
## the daemon running the search can get ahead of the daemon
@@ -190,7 +190,8 @@ sub handler {
}
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/searchcat?'.
- 'catalogmode='.$env{'form.catalogmode'}.
+ &Apache::loncommon::inhibit_menu_check().
+ '&catalogmode='.$env{'form.catalogmode'}.
'&launch='.$env{'form.launch'}.
'&mode='.$env{'form.mode'},
text=>"$crumb_text",
@@ -258,6 +259,9 @@ sub handler {
if (exists($env{'form.area'})) {
$hidden_fields .= &hidden_field('area');
}
+ if (exists($env{'form.inhibitmenu'})) {
+ $hidden_fields .= &hidden_field('inhibitmenu');
+ }
##
## Configure dynamic components of interface
##
@@ -308,15 +312,17 @@ END
$srchtype = 'Portfolio';
}
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/searchcat?phase=disp_adv&'.
- 'catalogmode='.$env{'form.catalogmode'}.
+ ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check().
+ '&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?phase=disp_adv&'.
+ ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check().
+ '&phase=disp_adv'.
'catalogmode='.$env{'form.catalogmode'}.
'&launch='.$env{'form.launch'}.
'&mode='.$env{'form.mode'},
@@ -379,7 +385,7 @@ END
$errorstring);
my $msg =
- 'Unable to create table in which to store search results. '.
+ 'Unable to create table in which to save search results. '.
'The search has been aborted.';
&Apache::loncommon::simple_error_page($r,'Search Error',
$msg);
@@ -388,7 +394,7 @@ END
delete($env{'form.launch'});
if (! &make_form_data_persistent($r,$persistent_db_file)) {
my $msg=
- 'Unable to properly store search information. '.
+ 'Unable to properly save search information. '.
'The search has been aborted.';
&Apache::loncommon::simple_error_page($r,'Search Error',
$msg);
@@ -759,8 +765,9 @@ sub setup_basic_search {
'';
}
$adv_search_link = 'print("Unable to connect to the MySQL database where your results".
- " are stored.".
+ " are saved.".
&Apache::loncommon::end_page());
&Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".
" connect to database.");
@@ -2522,7 +2529,7 @@ END
# Check on the mysql table we will use to store results.
my $table =$env{'form.table'};
if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
- $r->print("Unable to determine table id to store search results in.".
+ $r->print("Unable to determine table id to save search results in.".
"The search has been aborted.".
&Apache::loncommon::end_page());
return;
@@ -2760,7 +2767,7 @@ sub display_results {
if ($env{'form.catalogmode'} eq 'import') {
if (! tie(%groupsearch_db,'GDBM_File',$diropendb,
&GDBM_WRCREAT(),0640)) {
- $r->print('Unable to store import results.'.
+ $r->print('Unable to save import results.'.
&Apache::loncommon::end_page());
$r->rflush();
return;
@@ -2997,8 +3004,8 @@ sub catalogmode_output {
$title=~ s/\'/\\\'/g;
if ($env{'form.catalogmode'} eq 'interactive') {
$output.=< \n";
$result .= ''.$values{'author'}.','.
@@ -3444,11 +3452,8 @@ sub detailed_citation_view {
if (exists($field->{'type'}) && $field->{'type'} eq 'list') {
$result .= ''.&mt($field->{'translate'}).'';
foreach my $item (split(',',$values{$field->{'name'}})){
- $result .=
- &Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($item),
- 'preview',
- '',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
+ $item = &Apache::lonnet::clutter($item);
+ $result .= &display_url($item,[2,0,1]);
}
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
$result.= &mt($field->{'translate'},
@@ -3456,15 +3461,7 @@ sub detailed_citation_view {
$values{$field->{'name'}}))."
\n";
} else {
if ($field->{'special'} eq 'url link') {
- if ($jumpurl=~/^http\:\/\//) {
- $result.=''.$jumpurl.'';
- } else {
- $result .=
- &Apache::lonhtmlcommon::crumbs($jumpurl,
- 'preview',
- '',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),3,0,1);
- }
+ $result .= &display_url($jumpurl,[3,0,1]);
} else {
$result.= &mt($field->{'translate'},
$values{$field->{'name'}});
@@ -3520,19 +3517,13 @@ sub summary_view {
$result .= ' '.$tmp.' ';
}
my $jumpurl=$values{'url'};
- my $link;
- if ($jumpurl=~m|^/ext/|) {
- $jumpurl=~s|^/ext/|http://|;
- $link='
'.$jumpurl.'';
- } else {
- $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
- 'preview',
- '',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
- }
+ $jumpurl=~s|^/ext/|http://|;
+ my $link = &display_url($jumpurl,[2,0,1]);
+
$result.=<
+$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
$values{'copyrighttag'}
$values{'extrashow'}
@@ -3565,16 +3556,10 @@ sub summary_preview {
sub compact_view {
my ($prefix,%values) = @_;
my $jumpurl=$values{'url'};
- my $link;
- if ($jumpurl=~m|^/ext/|) {
- $jumpurl=~s|^/ext/|http://|;
- $link=''.$jumpurl.'';
- } else {
- $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
- 'preview',
- '',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1,1,1).' ';
- }
+ $jumpurl=~s|^/ext/|http://|;
+
+ my $link = &display_url($jumpurl,[1,1,1]);
+
my $result =
$prefix.'';
if (exists($env{'form.sortfield'}) &&
@@ -3583,12 +3568,30 @@ sub compact_view {
if (! defined($tmp)) { $tmp = 'undefined'; }
$result .= ' '.$tmp.' ';
}
- $result.=' '.
- $values{'title'}.''.(' 'x2).$link.
- ''.$values{'author'}.' ('.$values{'domain'}.')
';
+ $jumpurl = &HTML::Entities::encode($jumpurl,'<>&"');
+ $result.=' '.
+ ''.
+ &HTML::Entities::encode($values{'title'},'<>&"').' '.
+ $link.' '.$values{'author'}.' ('.$values{'domain'}.')
';
return $result;
}
+sub display_url {
+ my ($url,$crumb_args) = @_;
+ my $link;
+ if ($url=~m|^/ext/|) {
+ $url=~s|^/ext/|http://|;
+ $link=''.$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}).' ';
+ }
+ return $link;
+}
######################################################################
######################################################################
@@ -3612,7 +3615,7 @@ sub fielded_format_view {
$prefix