--- loncom/interface/loncommon.pm 2003/12/29 21:17:00 1.167 +++ loncom/interface/loncommon.pm 2003/12/30 20:47:23 1.168 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.167 2003/12/29 21:17:00 www Exp $ +# $Id: loncommon.pm,v 1.168 2003/12/30 20:47:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3284,14 +3284,18 @@ sub propath { sub icon { my ($file)=@_; - my @file_ext = split(/\./,$file); - my $curfext = $file_ext[-1]; - my $iconname="unknown.gif"; + my $curfext = (split(/\./,$file))[-1]; + my $iconname=$Apache::lonnet::perlvar{'lonIconsURL'}.'/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"; + if (!(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn')) { + if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/'. + $Apache::lonnet::perlvar{'lonIconsURL'}.'/'. + $curfext.".gif") { + $iconname=$Apache::lonnet::perlvar{'lonIconsURL'}.'/'. + $curfext.".gif"; + } + } + return $iconname; } =pod