--- loncom/interface/lonsearchcat.pm 2007/05/02 01:33:49 1.286 +++ 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.286 2007/05/02 01:33:49 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.287 2007/06/15 23:29:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2997,8 +2997,8 @@ sub catalogmode_output { $title=~ s/\'/\\\'/g; if ($env{'form.catalogmode'} eq 'interactive') { $output.=< + END } @@ -3007,7 +3007,7 @@ END $groupsearch_db{"pre_${fnum}_title"}=$title; $output.=< - END @@ -3444,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'}, @@ -3456,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'}}); @@ -3520,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'} @@ -3565,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'}) && @@ -3583,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; +} ###################################################################### ######################################################################