--- loncom/interface/loncommon.pm	2003/11/17 15:14:48	1.155
+++ loncom/interface/loncommon.pm	2003/12/01 14:36:22	1.157
@@ -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.157 2003/12/01 14:36:22 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,13 +25,6 @@
 #
 # http://www.lon-capa.org/
 #
-# YEAR=2001
-# 2/13-12/7 Guy Albertelli
-# 12/21 Gerd Kortemeyer
-# 12/25,12/28 Gerd Kortemeyer
-# YEAR=2002
-# 1/4 Gerd Kortemeyer
-# 6/24,7/2 H. K. Ng
 
 # Makes a table out of the previous attempts
 # Inputs result_from_symbread, user, domain, course_id
@@ -73,11 +66,9 @@ use HTML::Entities;
 
 my $readit;
 
-=pod 
-
-=head1 Global Variables
-
-=cut
+##
+## Global Variables
+##
 
 # ----------------------------------------------- Filetypes/Languages/Copyright
 my %language;
@@ -204,10 +195,6 @@ BEGIN {
 
 =pod 
 
-=head1 General Subroutines
-
-=over 4
-
 =head1 HTML and Javascript Functions
 
 =over 4
@@ -219,8 +206,6 @@ containing javascript with two functions
 C<opensearcher>. Returned string does not contain E<lt>scriptE<gt>
 tags.
 
-=over 4
-
 =item * openbrowser(formname,elementname,only,omit) [javascript]
 
 inputs: formname, elementname, only, omit
@@ -241,8 +226,6 @@ Inputs: formname, elementname
 formname and elementname specify the name of the html form and the name
 of the element the selection from the search results will be placed in.
 
-=back
-
 =cut
 
 sub browser_and_searcher_javascript {
@@ -887,6 +870,8 @@ Outputs:
 
 =back
 
+=back 
+
 =cut
 
 ###############################################################
@@ -925,12 +910,6 @@ sub decode_user_agent {
             $clientunicode,$clientos,);
 }
 
-=pod
-
-=back
-
-=cut
-
 ###############################################################
 ##    Authentication changing form generation subroutines    ##
 ###############################################################
@@ -971,6 +950,8 @@ See loncreateuser.pm for invocation and
 
 =back
 
+=back 
+
 =cut
 
 #-------------------------------------------
@@ -1155,12 +1136,6 @@ sub authform_filesystem{
     return $result;
 }
 
-=pod
-
-=back
-
-=cut
-
 ###############################################################
 ##    Get Authentication Defaults for Domain                 ##
 ###############################################################
@@ -2729,8 +2704,12 @@ sub check_if_partid_hidden {
 
 =pod
 
+=back 
+
 =head1 cgi-bin script and graphing routines
 
+=over 4
+
 =item get_cgi_id
 
 Inputs: none
@@ -3063,10 +3042,14 @@ sub DrawXYYGraph {
 
 =pod
 
+=back 
+
 =head1 Statistics helper routines?  
 
 Bad place for them but what the hell.
 
+=over 4
+
 =item &chartlink
 
 Returns a link to the chart for a specific student.  
@@ -3083,6 +3066,8 @@ Inputs:
 
 =back
 
+=back
+
 =cut
 
 ############################################################
@@ -3102,6 +3087,8 @@ sub chartlink {
 
 =head1 Course Environment Routines
 
+=over 4
+
 =item &restore_course_settings 
 
 =item &store_course_settings
@@ -3210,6 +3197,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