[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonsearchcat.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 17 Nov 2003 20:53:28 -0000
albertel Mon Nov 17 15:53:28 2003 EDT
Modified files:
/loncom/interface loncommon.pm lonsearchcat.pm
Log:
- BUG#2392 added icons to search results
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.155 loncom/interface/loncommon.pm:1.156
--- loncom/interface/loncommon.pm:1.155 Mon Nov 17 10:14:48 2003
+++ loncom/interface/loncommon.pm Mon Nov 17 15:53:28 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.155 2003/11/17 15:14:48 www Exp $
+# $Id: loncommon.pm,v 1.156 2003/11/17 20:53:28 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3208,6 +3208,18 @@
$subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
my $proname="$Apache::lonnet::perlvar{'lonUsersDir'}/$udom/$subdir/$uname";
return $proname;
+}
+
+sub icon {
+ my ($file)=@_;
+ my @file_ext = split(/\./,$file);
+ my $curfext = $file_ext[-1];
+ my $iconname="unknown.gif";
+ my $embstyle = &Apache::loncommon::fileembstyle($curfext);
+ # The unless conditional that follows is a bit of overkill
+ $iconname = $curfext.".gif" unless
+ (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');
+ return $Apache::lonnet::perlvar{'lonIconsURL'}."/$iconname";
}
=pod
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.191 loncom/interface/lonsearchcat.pm:1.192
--- loncom/interface/lonsearchcat.pm:1.191 Fri Oct 24 17:09:24 2003
+++ loncom/interface/lonsearchcat.pm Mon Nov 17 15:53:28 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.191 2003/10/24 21:09:24 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.192 2003/11/17 20:53:28 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2880,8 +2880,9 @@
######################################################################
sub detailed_citation_view {
my ($prefix,%values) = @_;
+ my $icon=&Apache::loncommon::icon($values{'url'});
my $result=<<END;
-<b>$prefix<a href="http://$ENV{'HTTP_HOST'}$values{'url'}"
+<b>$prefix<img src="$icon" /><a href="http://$ENV{'HTTP_HOST'}$values{'url'}"
target='search_preview'>$values{'title'}</a></b>
<p>
<b>$values{'author'}</b>, <i>$values{'owner'}</i><br />
@@ -2914,8 +2915,9 @@
######################################################################
sub summary_view {
my ($prefix,%values) = @_;
+ my $icon=&Apache::loncommon::icon($values{'url'});
my $result=<<END;
-$prefix<a href="http://$ENV{'HTTP_HOST'}$values{'url'}"
+$prefix<img src="$icon" /><a href="http://$ENV{'HTTP_HOST'}$values{'url'}"
target='search_preview'>$values{'author'}</a><br />
$values{'title'}<br />
$values{'owner'} -- $values{'lastrevisiondate'}<br />
@@ -2940,8 +2942,9 @@
######################################################################
sub compact_view {
my ($prefix,%values) = @_;
+ my $icon=&Apache::loncommon::icon($values{'url'});
my $result=<<END;
-$prefix <a href="http://$ENV{'HTTP_HOST'}$values{'url'}" target='search_preview'>
+$prefix <img src="$icon" /> <a href="http://$ENV{'HTTP_HOST'}$values{'url'}" target='search_preview'>
$values{'title'}</a>
<b>$values{'author'}</b><br />
END
@@ -2962,8 +2965,9 @@
######################################################################
sub fielded_format_view {
my ($prefix,%values) = @_;
+ my $icon=&Apache::loncommon::icon($values{'url'});
my $result=<<END;
-$prefix
+$prefix <img src="$icon" />
<b>URL: </b> <a href="http://$ENV{'HTTP_HOST'}$values{'url'}"
target='search_preview'>$values{'url'}</a>
<br />