--- loncom/interface/loncommon.pm 2001/12/07 23:41:25 1.11 +++ loncom/interface/loncommon.pm 2001/12/11 13:49:57 1.12 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.11 2001/12/07 23:41:25 albertel Exp $ +# $Id: loncommon.pm,v 1.12 2001/12/11 13:49:57 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,7 +25,9 @@ # # http://www.lon-capa.org/ # -# 2/13 Guy Albertelli +# YEAR=2001 +# 2/13-12/7 Guy Albertelli +# 12/11 Scott Harrison # Makes a table out of the previous attempts # Inputs result_from_symbread, user, domain, course_id @@ -37,6 +39,49 @@ use POSIX qw(strftime); use Apache::Constants qw(:common); use Apache::lonmsg(); +my %language; +my %cprtag; +my %fe; my %fd; + +# ----------------------------------------------------------------------- BEGIN +sub BEGIN { +# ------------------------------------------------------------------- languages + { + my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. + '/language.tab'); + while (<$fh>) { + next if /^\#/; + chomp; + my ($key,$val)=(split(/\s+/,$_,2)); + $language{$key}=$val; + } + } +# ------------------------------------------------------------------ copyrights + { + my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. + '/copyright.tab'); + while (<$fh>) { + next if /^\#/; + chomp; + my ($key,$val)=(split(/\s+/,$_,2)); + $copyright{$key}=$val; + } + } +# ------------------------------------------------------------------ file types + { + my $fh=Apache::File->new("$perlvar{'lonTabDir'}/filetypes.tab"); + while (<$fh>) { + next if (/^\#/); + chomp; + my ($ending,$emb,$descr)=split(/\s+/,$_,3); + if ($descr ne '') { + $fe{$ending}=lc($emb); + $fd{$ending}=join(' ',@descr); + } + } + } +} + sub get_previous_attempt { my ($symb,$username,$domain,$course)=@_; my $prevattempts='';