version 1.11, 2001/12/07 23:41:25
|
version 1.15, 2001/12/11 23:38:28
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# 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 |
# Makes a table out of the previous attempts |
# Inputs result_from_symbread, user, domain, course_id |
# Inputs result_from_symbread, user, domain, course_id |
Line 37 use POSIX qw(strftime);
|
Line 39 use POSIX qw(strftime);
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
|
|
|
my %language; |
|
my %cprtag; |
|
my %fe; my %fd; |
|
my %fc; |
|
|
|
# ----------------------------------------------------------------------- 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)); |
|
$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"); |
|
while (<$fh>) { |
|
next if (/^\#/); |
|
chomp; |
|
my ($ending,$emb,$descr)=split(/\s+/,$_,3); |
|
if ($descr ne '') { |
|
$fe{$ending}=lc($emb); |
|
$fd{$ending}=join(' ',@descr); |
|
} |
|
} |
|
} |
|
} |
|
|
|
# ---------------------------------------------------------------- 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 { |
sub get_previous_attempt { |
my ($symb,$username,$domain,$course)=@_; |
my ($symb,$username,$domain,$course)=@_; |
my $prevattempts=''; |
my $prevattempts=''; |