--- loncom/interface/loncommon.pm 2003/11/17 15:14:48 1.155 +++ loncom/interface/loncommon.pm 2003/11/17 20:53:28 1.156 @@ -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 # @@ -3210,6 +3210,18 @@ sub propath { 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 =back