--- loncom/interface/loncommon.pm 2007/03/03 01:33:20 1.512 +++ loncom/interface/loncommon.pm 2007/04/04 00:10:01 1.518 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.512 2007/03/03 01:33:20 albertel Exp $ +# $Id: loncommon.pm,v 1.518 2007/04/04 00:10:01 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,8 +68,12 @@ use Apache::lontexconvert(); use Apache::lonclonecourse(); use LONCAPA qw(:DEFAULT :match); +# ---------------------------------------------- Designs +use vars qw(%defaultdesign); + my $readit; + ## ## Global Variables ## @@ -82,10 +86,6 @@ my %scprtag; my %fe; my %fd; my %fm; my %category_extensions; -# ---------------------------------------------- Designs - -my %designhash; - # ---------------------------------------------- Thesaurus variables # # %Keywords: @@ -151,30 +151,18 @@ BEGIN { } } -# -------------------------------------------------------------- domain designs - - my $filename; +# -------------------------------------------------------------- default domain designs my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors'; - opendir(DIR,$designdir); - while ($filename=readdir(DIR)) { - if ($filename!~/\.tab$/) { next; } - my ($domain)=($filename=~/^($match_domain)\./); - { - my $designfile = $designdir.'/'.$filename; - if ( open (my $fh,"<$designfile") ) { - while (my $line = <$fh>) { - next if ($line =~ /^\#/); - chomp($line); - my ($key,$val)=(split(/\=/,$line)); - if ($val) { $designhash{$domain.'.'.$key}=$val; } - } - close($fh); - } - } - + my $designfile = $designdir.'/default.tab'; + if ( open (my $fh,"<$designfile") ) { + while (my $line = <$fh>) { + next if ($line =~ /^\#/); + chomp($line); + my ($key,$val)=(split(/\=/,$line)); + if ($val) { $defaultdesign{$key}=$val; } + } + close($fh); } - closedir(DIR); - # ------------------------------------------------------------- file categories { @@ -1270,7 +1258,7 @@ sub create_text_file { sub domain_select { my ($name,$value,$multiple)=@_; my %domains=map { - $_ => $_.' '.$Apache::lonnet::domaindescription{$_} + $_ => $_.' '. &Apache::lonnet::domain($_,'description') } &Apache::lonnet::all_domains(); if ($multiple) { $domains{''}=&mt('Any domain'); @@ -1435,7 +1423,7 @@ selected"); #------------------------------------------- sub select_dom_form { my ($defdom,$name,$includeempty) = @_; - my @domains = &Apache::lonnet::all_domains(); + my @domains = sort(&Apache::lonnet::all_domains()); if ($includeempty) { @domains=('',@domains); } my $selectdomain = "