version 1.167, 2003/12/29 21:17:00
|
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 1641 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 3284 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 |