version 1.165, 2003/12/27 23:55:10
|
version 1.169, 2004/01/02 19:23:47
|
Line 726 sub get_domains {
|
Line 726 sub get_domains {
|
my @domains; |
my @domains; |
my %seen; |
my %seen; |
foreach (sort values(%Apache::lonnet::hostdom)) { |
foreach (sort values(%Apache::lonnet::hostdom)) { |
push (@domains,$_) unless $seen{$_}++; |
push (@domains,$_) unless $seen{$_}++; |
} |
} |
return @domains; |
return @domains; |
} |
} |
|
|
|
# ------------------------------------------ |
|
|
|
sub domain_select { |
|
my ($name,$value,$multiple)=@_; |
|
my %domains=map { |
|
$_ => $_.' '.$Apache::lonnet::domaindescription{$_} |
|
} &get_domains; |
|
if ($multiple) { |
|
$domains{''}=&mt('Any domain'); |
|
return &multiple_select_form($name,$value,%domains); |
|
} else { |
|
return &select_form($name,$value,%domains); |
|
} |
|
} |
|
|
|
sub multiple_select_form { |
|
my ($name,$value,%hash)=@_; |
|
my %selected = map { $_ => 1 } ref($value)?@{$value}:($value); |
|
my $output=''; |
|
my $size =(scalar keys %hash<4?scalar keys %hash:4); |
|
$output.="\n<select name='$name' size='$size' multiple='1'>"; |
|
foreach (sort keys %hash) { |
|
$output.="<option name='$_'". |
|
($selected{$_}?' selected="1"' :'').">$hash{$_}</option>\n"; |
|
} |
|
$output.="</select>\n"; |
|
return $output; |
|
} |
|
|
#------------------------------------------- |
#------------------------------------------- |
|
|
=pod |
=pod |
Line 762 sub select_form {
|
Line 791 sub select_form {
|
return $selectform; |
return $selectform; |
} |
} |
|
|
|
sub gradeleveldescription { |
|
my $gradelevel=shift; |
|
my %gradelevels=(0 => 'Not specified', |
|
1 => 'Grade 1', |
|
2 => 'Grade 2', |
|
3 => 'Grade 3', |
|
4 => 'Grade 4', |
|
5 => 'Grade 5', |
|
6 => 'Grade 6', |
|
7 => 'Grade 7', |
|
8 => 'Grade 8', |
|
9 => 'Grade 9', |
|
10 => 'Grade 10', |
|
11 => 'Grade 11', |
|
12 => 'Grade 12', |
|
13 => 'Grade 13', |
|
14 => '100 Level', |
|
15 => '200 Level', |
|
16 => '300 Level', |
|
17 => '400 Level', |
|
18 => 'Graduate Level'); |
|
return &mt($gradelevels{$gradelevel}); |
|
} |
|
|
sub select_level_form { |
sub select_level_form { |
my ($deflevel,$name)=@_; |
my ($deflevel,$name)=@_; |
unless ($deflevel) { $deflevel=0; } |
unless ($deflevel) { $deflevel=0; } |
return &select_form($deflevel,$name,( |
my $selectform = "<select name=\"$name\" size=\"1\">\n"; |
0 => 'Not specified', |
for (my $i=0; $i<=18; $i++) { |
1 => 'Grade 1', |
$selectform.="<option value=\"$i\" ". |
2 => 'Grade 2', |
($i==$deflevel ? 'selected' : ''). |
3 => 'Grade 3', |
">".&gradeleveldescription($i)."</option>\n"; |
4 => 'Grade 4', |
} |
5 => 'Grade 5', |
$selectform.="</select>"; |
6 => 'Grade 6', |
return $selectform; |
7 => 'Grade 7', |
|
8 => 'Grade 8', |
|
9 => 'Grade 9', |
|
10 => 'Grade 10', |
|
11 => 'Grade 11', |
|
12 => 'Grade 12', |
|
13 => 'Grade 13', |
|
14 => '100 Level', |
|
15 => '200 Level', |
|
16 => '300 Level', |
|
17 => '400 Level', |
|
18 => 'Graduate Level')); |
|
} |
} |
|
|
#------------------------------------------- |
#------------------------------------------- |
|
|
=pod |
=pod |
Line 1508 sub noteswrapper {
|
Line 1550 sub noteswrapper {
|
# ------------------------------------------------------------- Aboutme Wrapper |
# ------------------------------------------------------------- Aboutme Wrapper |
|
|
sub aboutmewrapper { |
sub aboutmewrapper { |
my ($link,$username,$domain)=@_; |
my ($link,$username,$domain,$target)=@_; |
return "<a href='/adm/$domain/$username/aboutme'>$link</a>"; |
return "<a href='/adm/$domain/$username/aboutme'". |
|
($target?" target='$target'":'').">$link</a>"; |
} |
} |
|
|
# ------------------------------------------------------------ Syllabus Wrapper |
# ------------------------------------------------------------ Syllabus Wrapper |
Line 1587 returns description of a specified copyr
|
Line 1630 returns description of a specified copyr
|
=cut |
=cut |
|
|
sub copyrightdescription { |
sub copyrightdescription { |
return $cprtag{shift(@_)}; |
return &mt($cprtag{shift(@_)}); |
} |
} |
|
|
=pod |
=pod |
Line 1627 sub fileembstyle {
|
Line 1670 sub fileembstyle {
|
return $fe{lc(shift(@_))}; |
return $fe{lc(shift(@_))}; |
} |
} |
|
|
|
|
|
sub filecategoryselect { |
|
my ($name,$value)=@_; |
|
return &select_form($name,$value, |
|
'' => &mt('Any category'), |
|
map { $_,$_ } sort(keys(%category_extensions))); |
|
} |
|
|
=pod |
=pod |
|
|
=item * filedescription() |
=item * filedescription() |
Line 1636 returns description for a specified file
|
Line 1687 returns description for a specified file
|
=cut |
=cut |
|
|
sub filedescription { |
sub filedescription { |
return $fd{lc(shift(@_))}; |
return &mt($fd{lc(shift(@_))}); |
} |
} |
|
|
=pod |
=pod |
Line 1650 extra formatting
|
Line 1701 extra formatting
|
|
|
sub filedescriptionex { |
sub filedescriptionex { |
my $ex=shift; |
my $ex=shift; |
return '.'.$ex.' '.$fd{lc($ex)}; |
return '.'.$ex.' '.&mt($fd{lc($ex)}); |
} |
} |
|
|
# End of .tab access |
# End of .tab access |
Line 3270 sub propath {
|
Line 3321 sub propath {
|
|
|
sub icon { |
sub icon { |
my ($file)=@_; |
my ($file)=@_; |
my @file_ext = split(/\./,$file); |
my $curfext = (split(/\./,$file))[-1]; |
my $curfext = $file_ext[-1]; |
my $iconname=$Apache::lonnet::perlvar{'lonIconsURL'}.'/unknown.gif'; |
my $iconname="unknown.gif"; |
|
my $embstyle = &Apache::loncommon::fileembstyle($curfext); |
my $embstyle = &Apache::loncommon::fileembstyle($curfext); |
# The unless conditional that follows is a bit of overkill |
if (!(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn')) { |
$iconname = $curfext.".gif" unless |
if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/'. |
(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn'); |
$Apache::lonnet::perlvar{'lonIconsURL'}.'/'. |
return $Apache::lonnet::perlvar{'lonIconsURL'}."/$iconname"; |
$curfext.".gif") { |
|
$iconname=$Apache::lonnet::perlvar{'lonIconsURL'}.'/'. |
|
$curfext.".gif"; |
|
} |
|
} |
|
return $iconname; |
} |
} |
|
|
=pod |
=pod |