--- loncom/interface/loncommon.pm 2001/12/11 13:51:38 1.13 +++ loncom/interface/loncommon.pm 2001/12/11 23:38:28 1.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.13 2001/12/11 13:51:38 harris41 Exp $ +# $Id: loncommon.pm,v 1.15 2001/12/11 23:38:28 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,7 @@ use Apache::lonmsg(); my %language; my %cprtag; my %fe; my %fd; +my %fc; # ----------------------------------------------------------------------- BEGIN sub BEGIN { @@ -67,6 +68,17 @@ sub BEGIN { $cprtag{$key}=$val; } } +# ------------------------------------------------------------- file categories + { + my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. + '/filecategories.tab'); + while (<$fh>) { + next if /^\#/; + chomp; + my ($key,$val)=(split(/\s+/,$_,2)); + push @{$fc{$key}},$val; + } + } # ------------------------------------------------------------------ file types { my $fh=Apache::File->new("$perlvar{'lonTabDir'}/filetypes.tab"); @@ -82,6 +94,51 @@ sub BEGIN { } } +# ---------------------------------------------------------------- Language IDs +sub languageids { + return keys(%language); +} + +# -------------------------------------------------------- Language Description +sub languagedescription { + return $language{shift}; +} + +# --------------------------------------------------------------- Copyright IDs +sub copyrightids { + return keys(%cprtag); +} + +# ------------------------------------------------------- Copyright Description +sub copyrightdescription { + return $cprtag{shift}; +} + +# ------------------------------------------------------------- File Categories +sub filecategories { + return keys(%fc); +} + +# ------------------------------------------------------------- File Categories +sub filecategorytypes { + return @{$fc{lc(shift)}}; +} + +# ------------------------------------------------------------------ File Types +sub fileextensions { + return keys(%fe); +} + +# ------------------------------------------------------------- Embedding Style +sub fileembstyle { + return $fe{lc(shift)}; +} + +# ------------------------------------------------------------ Description Text +sub filedescription { + return $fd{lc(shift)}; +} + sub get_previous_attempt { my ($symb,$username,$domain,$course)=@_; my $prevattempts='';