[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm lonsearchcat.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jul 2006 19:16:15 -0000
www Fri Jul 28 15:16:15 2006 EDT
Modified files:
/loncom/interface lonindexer.pm lonsearchcat.pm
Log:
* Bug #4941: avoid getting trapped when clicking previewing during search
* Make display of external resources less ugly
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.149 loncom/interface/lonindexer.pm:1.150
--- loncom/interface/lonindexer.pm:1.149 Fri Jul 21 04:25:25 2006
+++ loncom/interface/lonindexer.pm Fri Jul 28 15:16:08 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.149 2006/07/21 08:25:25 albertel Exp $
+# $Id: lonindexer.pm,v 1.150 2006/07/28 19:16:08 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1163,6 +1163,9 @@
sub showpreview {
my ($filelink)=@_;
+ if ($filelink=~/^(\/ext\/|http\:\/\/)/) {
+ return &mt('External Resource, preview not enabled');
+ }
my ($curfext)=($filelink=~/\.(\w+)$/);
my $output='';
my $embstyle=&Apache::loncommon::fileembstyle($curfext);
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.273 loncom/interface/lonsearchcat.pm:1.274
--- loncom/interface/lonsearchcat.pm:1.273 Mon Jul 17 15:47:20 2006
+++ loncom/interface/lonsearchcat.pm Fri Jul 28 15:16:08 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.273 2006/07/17 19:47:20 www Exp $
+# $Id: lonsearchcat.pm,v 1.274 2006/07/28 19:16:08 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3204,7 +3204,7 @@
$result .= '<b>'.$prefix.
'<img src="'.&Apache::loncommon::icon($values{'url'}).'" />'.' '.
'<a href="'.$jumpurl.'" '.
- 'target="search_preview">'.$values{'title'}."</a></b>\n";
+ 'target="preview">'.$values{'title'}."</a></b>\n";
$result .= "<p>\n";
$result .= '<b>'.$values{'author'}.'</b>,'.
' <i>'.$values{'owner'}.'</i><br />';
@@ -3271,9 +3271,9 @@
$result .= '<b>'.&mt($field->{'translate'}).'</b>';
foreach my $item (split(',',$values{$field->{'name'}})){
$result .=
- &Apache::lonhtmlcommon::crumbs($item,
- (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
- '/res',
+ &Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($item),
+ 'preview',
+ '',
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
}
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
@@ -3282,11 +3282,15 @@
$values{$field->{'name'}}))."<br />\n";
} else {
if ($field->{'special'} eq 'url link') {
- $result.=
+ if ($jumpurl=~/^http\:\/\//) {
+ $result.='<tt>'.$jumpurl.'</tt>';
+ } else {
+ $result .=
&Apache::lonhtmlcommon::crumbs($jumpurl,
- (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
+ 'preview',
'',
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),3,0,1);
+ }
} else {
$result.= &mt($field->{'translate'},
$values{$field->{'name'}});
@@ -3342,15 +3346,19 @@
$result .= ' '.$tmp.' ';
}
my $jumpurl=$values{'url'};
- $jumpurl=~s/^\/ext\//http\:\/\//;
- my $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
- (($env{'form.catalogmode'} eq 'import')?'':'preview'),
+ my $link;
+ if ($jumpurl=~/^\/ext\//) {
+ $jumpurl=~s/^\/ext\//http\:\/\//;
+ $link='<br /><tt>'.$jumpurl.'</tt>';
+ } else {
+ $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
+ 'preview',
'',
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
-
+ }
$result.=<<END;
<a href="$jumpurl"
- target='search_preview'>$values{'title'}</a>$link
+ target='preview'>$values{'title'}</a>$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
$values{'copyrighttag'}<br />
$values{'extrashow'}
@@ -3383,11 +3391,16 @@
sub compact_view {
my ($prefix,%values) = @_;
my $jumpurl=$values{'url'};
- $jumpurl=~s/^\/ext\//http\:\/\//;
- my $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
- (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
+ my $link;
+ if ($jumpurl=~/^\/ext\//) {
+ $jumpurl=~s/^\/ext\//http\:\/\//;
+ $link='<tt>'.$jumpurl.'</tt>';
+ } else {
+ $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
+ 'preview',
'',
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1,1,1).' ';
+ }
my $result =
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">';
if (exists($env{'form.sortfield'}) &&
@@ -3396,7 +3409,7 @@
if (! defined($tmp)) { $tmp = 'undefined'; }
$result .= ' '.$tmp.' ';
}
- $result.=' <a href="'.$jumpurl.'" target="search_preview">'.
+ $result.=' <a href="'.$jumpurl.'" target="preview">'.
$values{'title'}.'</a>'.(' 'x2).$link.
'<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';
return $result;
@@ -3426,7 +3439,7 @@
<dl>
<dt>URL:</dt>
<dd><a href="$jumpurl"
- target='search_preview'>$values{'url'}</a></dd>
+ target='preview'>$values{'url'}</a></dd>
END
foreach my $field ('title','author','domain','subject','keywords','notes',
'mimetag','language','creationdate','lastrevisiondate',