--- loncom/interface/lonsearchcat.pm 2007/03/12 17:06:15 1.281
+++ loncom/interface/lonsearchcat.pm 2007/06/15 23:29:17 1.287
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.281 2007/03/12 17:06:15 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.287 2007/06/15 23:29:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -379,7 +379,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 +388,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);
@@ -750,7 +750,8 @@ sub setup_basic_search {
'';
$onlysearchdomain = ''.&mt('[_1] only search domain [_2]',
&Apache::lonhtmlcommon::checkbox('domains',$env{'form.domains'},
- $r->dir_config('lonDefDomain'))).
+ $r->dir_config('lonDefDomain')),
+ $r->dir_config('lonDefDomain')).
' ';
if ($area eq 'res') {
$inclext= ''.&mt('[_1] include external resources',
@@ -763,6 +764,9 @@ sub setup_basic_search {
'&launch='.$env{'form.launch'}.
'&mode='.$env{'form.mode'}.
'&area='.$area.
+ '&form='.$env{'form.form'}.
+ '&titleelement='.$env{'form.titleelement'}.
+ '&element='.$env{'form.element'}.
'">'.&mt('Advanced Search').'';
#
$scrout.=''.
+ $r->print('Unable to save import results.'.
&Apache::loncommon::end_page());
$r->rflush();
return;
@@ -2993,8 +2997,8 @@ sub catalogmode_output {
$title=~ s/\'/\\\'/g;
if ($env{'form.catalogmode'} eq 'interactive') {
$output.=<
+
END
}
@@ -3003,7 +3007,7 @@ END
$groupsearch_db{"pre_${fnum}_title"}=$title;
$output.=<
-
END
@@ -3440,11 +3444,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'},
@@ -3452,15 +3453,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'}});
@@ -3516,19 +3509,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.=<$values{'title'}$link
+ target='preview'>$values{'title'}
+$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
$values{'copyrighttag'}
$values{'extrashow'}
@@ -3561,16 +3548,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'}) &&
@@ -3579,12 +3560,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;
+}
######################################################################
######################################################################